// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![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_gax;
extern crate google_cloud_location;
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;
/// A Dialogflow agent is a virtual agent that handles conversations with your
/// end-users. It is a natural language understanding module that understands the
/// nuances of human language. Dialogflow translates end-user text or audio
/// during a conversation to structured data that your apps and services can
/// understand. You design and build a Dialogflow agent to handle the types of
/// conversations required for your system.
///
/// For more information about agents, see the
/// [Agent guide](https://cloud.google.com/dialogflow/docs/agents-overview).
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Agent {
/// Required. The project of this agent.
/// Format: `projects/<Project ID>`.
pub parent: std::string::String,
/// Required. The name of this agent.
pub display_name: std::string::String,
/// Required. The default language of the agent as a language tag. See
/// [Language
/// Support](https://cloud.google.com/dialogflow/docs/reference/language)
/// for a list of the currently supported language codes. This field cannot be
/// set by the `Update` method.
pub default_language_code: std::string::String,
/// Optional. The list of all languages supported by this agent (except for the
/// `default_language_code`).
pub supported_language_codes: std::vec::Vec<std::string::String>,
/// Required. The time zone of this agent from the
/// [time zone database](https://www.iana.org/time-zones), e.g.,
/// America/New_York, Europe/Paris.
pub time_zone: std::string::String,
/// Optional. The description of this agent.
/// The maximum length is 500 characters. If exceeded, the request is rejected.
pub description: std::string::String,
/// Optional. The URI of the agent's avatar.
/// Avatars are used throughout the Dialogflow console and in the self-hosted
/// [Web
/// Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo)
/// integration.
pub avatar_uri: std::string::String,
/// Optional. Determines whether this agent should log conversation queries.
pub enable_logging: bool,
/// Optional. Determines how intents are detected from user queries.
#[deprecated]
pub match_mode: crate::model::agent::MatchMode,
/// Optional. To filter out false positive results and still get variety in
/// matched natural language inputs for your agent, you can tune the machine
/// learning classification threshold. If the returned score value is less than
/// the threshold value, then a fallback intent will be triggered or, if there
/// are no fallback intents defined, no intent will be triggered. The score
/// values range from 0.0 (completely uncertain) to 1.0 (completely certain).
/// If set to 0.0, the default of 0.3 is used.
pub classification_threshold: f32,
/// Optional. API version displayed in Dialogflow console. If not specified,
/// V2 API is assumed. Clients are free to query different service endpoints
/// for different API versions. However, bots connectors and webhook calls will
/// follow the specified API version.
pub api_version: crate::model::agent::ApiVersion,
/// Optional. The agent tier. If not specified, TIER_STANDARD is assumed.
pub tier: crate::model::agent::Tier,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl Agent {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::Agent::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Agent;
/// let x = Agent::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [display_name][crate::model::Agent::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Agent;
/// let x = Agent::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [default_language_code][crate::model::Agent::default_language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Agent;
/// let x = Agent::new().set_default_language_code("example");
/// ```
pub fn set_default_language_code<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.default_language_code = v.into();
self
}
/// Sets the value of [supported_language_codes][crate::model::Agent::supported_language_codes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Agent;
/// let x = Agent::new().set_supported_language_codes(["a", "b", "c"]);
/// ```
pub fn set_supported_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.supported_language_codes = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [time_zone][crate::model::Agent::time_zone].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Agent;
/// let x = Agent::new().set_time_zone("example");
/// ```
pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.time_zone = v.into();
self
}
/// Sets the value of [description][crate::model::Agent::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Agent;
/// let x = Agent::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
/// Sets the value of [avatar_uri][crate::model::Agent::avatar_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Agent;
/// let x = Agent::new().set_avatar_uri("example");
/// ```
pub fn set_avatar_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.avatar_uri = v.into();
self
}
/// Sets the value of [enable_logging][crate::model::Agent::enable_logging].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Agent;
/// let x = Agent::new().set_enable_logging(true);
/// ```
pub fn set_enable_logging<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_logging = v.into();
self
}
/// Sets the value of [match_mode][crate::model::Agent::match_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Agent;
/// use google_cloud_dialogflow_v2::model::agent::MatchMode;
/// let x0 = Agent::new().set_match_mode(MatchMode::Hybrid);
/// let x1 = Agent::new().set_match_mode(MatchMode::MlOnly);
/// ```
#[deprecated]
pub fn set_match_mode<T: std::convert::Into<crate::model::agent::MatchMode>>(
mut self,
v: T,
) -> Self {
self.match_mode = v.into();
self
}
/// Sets the value of [classification_threshold][crate::model::Agent::classification_threshold].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Agent;
/// let x = Agent::new().set_classification_threshold(42.0);
/// ```
pub fn set_classification_threshold<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.classification_threshold = v.into();
self
}
/// Sets the value of [api_version][crate::model::Agent::api_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Agent;
/// use google_cloud_dialogflow_v2::model::agent::ApiVersion;
/// let x0 = Agent::new().set_api_version(ApiVersion::V1);
/// let x1 = Agent::new().set_api_version(ApiVersion::V2);
/// let x2 = Agent::new().set_api_version(ApiVersion::V2Beta1);
/// ```
pub fn set_api_version<T: std::convert::Into<crate::model::agent::ApiVersion>>(
mut self,
v: T,
) -> Self {
self.api_version = v.into();
self
}
/// Sets the value of [tier][crate::model::Agent::tier].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Agent;
/// use google_cloud_dialogflow_v2::model::agent::Tier;
/// let x0 = Agent::new().set_tier(Tier::Standard);
/// let x1 = Agent::new().set_tier(Tier::Enterprise);
/// ```
pub fn set_tier<T: std::convert::Into<crate::model::agent::Tier>>(mut self, v: T) -> Self {
self.tier = v.into();
self
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for Agent {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Agent"
}
}
/// Defines additional types related to [Agent].
#[cfg(feature = "agents")]
pub mod agent {
#[allow(unused_imports)]
use super::*;
/// Match mode determines how intents are detected from user queries.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "agents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MatchMode {
/// Not specified.
Unspecified,
/// Best for agents with a small number of examples in intents and/or wide
/// use of templates syntax and composite entities.
Hybrid,
/// Can be used for agents with a large number of examples in intents,
/// especially the ones using @sys.any or very large custom entities.
MlOnly,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [MatchMode::value] or
/// [MatchMode::name].
UnknownValue(match_mode::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "agents")]
pub mod match_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "agents")]
impl MatchMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Hybrid => std::option::Option::Some(1),
Self::MlOnly => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MATCH_MODE_UNSPECIFIED"),
Self::Hybrid => std::option::Option::Some("MATCH_MODE_HYBRID"),
Self::MlOnly => std::option::Option::Some("MATCH_MODE_ML_ONLY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "agents")]
impl std::default::Default for MatchMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "agents")]
impl std::fmt::Display for MatchMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "agents")]
impl std::convert::From<i32> for MatchMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Hybrid,
2 => Self::MlOnly,
_ => Self::UnknownValue(match_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "agents")]
impl std::convert::From<&str> for MatchMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MATCH_MODE_UNSPECIFIED" => Self::Unspecified,
"MATCH_MODE_HYBRID" => Self::Hybrid,
"MATCH_MODE_ML_ONLY" => Self::MlOnly,
_ => Self::UnknownValue(match_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "agents")]
impl serde::ser::Serialize for MatchMode {
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::Hybrid => serializer.serialize_i32(1),
Self::MlOnly => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "agents")]
impl<'de> serde::de::Deserialize<'de> for MatchMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<MatchMode>::new(
".google.cloud.dialogflow.v2.Agent.MatchMode",
))
}
}
/// API version for the agent.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "agents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ApiVersion {
/// Not specified.
Unspecified,
/// Legacy V1 API.
V1,
/// V2 API.
V2,
/// V2beta1 API.
V2Beta1,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ApiVersion::value] or
/// [ApiVersion::name].
UnknownValue(api_version::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "agents")]
pub mod api_version {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "agents")]
impl ApiVersion {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::V1 => std::option::Option::Some(1),
Self::V2 => std::option::Option::Some(2),
Self::V2Beta1 => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("API_VERSION_UNSPECIFIED"),
Self::V1 => std::option::Option::Some("API_VERSION_V1"),
Self::V2 => std::option::Option::Some("API_VERSION_V2"),
Self::V2Beta1 => std::option::Option::Some("API_VERSION_V2_BETA_1"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "agents")]
impl std::default::Default for ApiVersion {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "agents")]
impl std::fmt::Display for ApiVersion {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "agents")]
impl std::convert::From<i32> for ApiVersion {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::V1,
2 => Self::V2,
3 => Self::V2Beta1,
_ => Self::UnknownValue(api_version::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "agents")]
impl std::convert::From<&str> for ApiVersion {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"API_VERSION_UNSPECIFIED" => Self::Unspecified,
"API_VERSION_V1" => Self::V1,
"API_VERSION_V2" => Self::V2,
"API_VERSION_V2_BETA_1" => Self::V2Beta1,
_ => Self::UnknownValue(api_version::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "agents")]
impl serde::ser::Serialize for ApiVersion {
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::V1 => serializer.serialize_i32(1),
Self::V2 => serializer.serialize_i32(2),
Self::V2Beta1 => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "agents")]
impl<'de> serde::de::Deserialize<'de> for ApiVersion {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ApiVersion>::new(
".google.cloud.dialogflow.v2.Agent.ApiVersion",
))
}
}
/// Represents the agent tier.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "agents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Tier {
/// Not specified. This value should never be used.
Unspecified,
/// Trial Edition, previously known as Standard Edition.
Standard,
/// Essentials Edition, previously known as Enterprise Essential Edition.
Enterprise,
/// Essentials Edition (same as TIER_ENTERPRISE), previously known as
/// Enterprise Plus Edition.
#[deprecated]
EnterprisePlus,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Tier::value] or
/// [Tier::name].
UnknownValue(tier::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "agents")]
pub mod tier {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "agents")]
impl Tier {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Standard => std::option::Option::Some(1),
Self::Enterprise => std::option::Option::Some(2),
Self::EnterprisePlus => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TIER_UNSPECIFIED"),
Self::Standard => std::option::Option::Some("TIER_STANDARD"),
Self::Enterprise => std::option::Option::Some("TIER_ENTERPRISE"),
Self::EnterprisePlus => std::option::Option::Some("TIER_ENTERPRISE_PLUS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "agents")]
impl std::default::Default for Tier {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "agents")]
impl std::fmt::Display for Tier {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "agents")]
impl std::convert::From<i32> for Tier {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Standard,
2 => Self::Enterprise,
3 => Self::EnterprisePlus,
_ => Self::UnknownValue(tier::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "agents")]
impl std::convert::From<&str> for Tier {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TIER_UNSPECIFIED" => Self::Unspecified,
"TIER_STANDARD" => Self::Standard,
"TIER_ENTERPRISE" => Self::Enterprise,
"TIER_ENTERPRISE_PLUS" => Self::EnterprisePlus,
_ => Self::UnknownValue(tier::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "agents")]
impl serde::ser::Serialize for Tier {
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::Standard => serializer.serialize_i32(1),
Self::Enterprise => serializer.serialize_i32(2),
Self::EnterprisePlus => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "agents")]
impl<'de> serde::de::Deserialize<'de> for Tier {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Tier>::new(
".google.cloud.dialogflow.v2.Agent.Tier",
))
}
}
}
/// The request message for
/// [Agents.GetAgent][google.cloud.dialogflow.v2.Agents.GetAgent].
///
/// [google.cloud.dialogflow.v2.Agents.GetAgent]: crate::client::Agents::get_agent
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetAgentRequest {
/// Required. The project that the agent to fetch is associated with.
/// Format: `projects/<Project ID>`.
pub parent: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl GetAgentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::GetAgentRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetAgentRequest;
/// let x = GetAgentRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for GetAgentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetAgentRequest"
}
}
/// The request message for
/// [Agents.SetAgent][google.cloud.dialogflow.v2.Agents.SetAgent].
///
/// [google.cloud.dialogflow.v2.Agents.SetAgent]: crate::client::Agents::set_agent
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SetAgentRequest {
/// Required. The agent to update.
pub agent: std::option::Option<crate::model::Agent>,
/// Optional. The mask to control which fields get updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl SetAgentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [agent][crate::model::SetAgentRequest::agent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SetAgentRequest;
/// use google_cloud_dialogflow_v2::model::Agent;
/// let x = SetAgentRequest::new().set_agent(Agent::default()/* use setters */);
/// ```
pub fn set_agent<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Agent>,
{
self.agent = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [agent][crate::model::SetAgentRequest::agent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SetAgentRequest;
/// use google_cloud_dialogflow_v2::model::Agent;
/// let x = SetAgentRequest::new().set_or_clear_agent(Some(Agent::default()/* use setters */));
/// let x = SetAgentRequest::new().set_or_clear_agent(None::<Agent>);
/// ```
pub fn set_or_clear_agent<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Agent>,
{
self.agent = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::SetAgentRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SetAgentRequest;
/// use wkt::FieldMask;
/// let x = SetAgentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::SetAgentRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SetAgentRequest;
/// use wkt::FieldMask;
/// let x = SetAgentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = SetAgentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for SetAgentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SetAgentRequest"
}
}
/// The request message for
/// [Agents.DeleteAgent][google.cloud.dialogflow.v2.Agents.DeleteAgent].
///
/// [google.cloud.dialogflow.v2.Agents.DeleteAgent]: crate::client::Agents::delete_agent
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteAgentRequest {
/// Required. The project that the agent to delete is associated with.
/// Format: `projects/<Project ID>`.
pub parent: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl DeleteAgentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::DeleteAgentRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteAgentRequest;
/// let x = DeleteAgentRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for DeleteAgentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteAgentRequest"
}
}
/// The request message for
/// [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
///
/// [google.cloud.dialogflow.v2.Agents.SearchAgents]: crate::client::Agents::search_agents
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchAgentsRequest {
/// Required. The project to list agents from.
/// Format: `projects/<Project ID or '-'>`.
pub parent: std::string::String,
/// Optional. The maximum number of items to return in a single page. By
/// default 100 and at most 1000.
pub page_size: i32,
/// The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl SearchAgentsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::SearchAgentsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchAgentsRequest;
/// let x = SearchAgentsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::SearchAgentsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchAgentsRequest;
/// let x = SearchAgentsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::SearchAgentsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchAgentsRequest;
/// let x = SearchAgentsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for SearchAgentsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchAgentsRequest"
}
}
/// The response message for
/// [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
///
/// [google.cloud.dialogflow.v2.Agents.SearchAgents]: crate::client::Agents::search_agents
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchAgentsResponse {
/// The list of agents. There will be a maximum number of items returned based
/// on the page_size field in the request.
pub agents: std::vec::Vec<crate::model::Agent>,
/// Token to retrieve the next page of results, or empty if there are no
/// more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl SearchAgentsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [agents][crate::model::SearchAgentsResponse::agents].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchAgentsResponse;
/// use google_cloud_dialogflow_v2::model::Agent;
/// let x = SearchAgentsResponse::new()
/// .set_agents([
/// Agent::default()/* use setters */,
/// Agent::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_agents<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Agent>,
{
use std::iter::Iterator;
self.agents = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::SearchAgentsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchAgentsResponse;
/// let x = SearchAgentsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for SearchAgentsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchAgentsResponse"
}
}
#[cfg(feature = "agents")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for SearchAgentsResponse {
type PageItem = crate::model::Agent;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.agents
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [Agents.TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent].
///
/// [google.cloud.dialogflow.v2.Agents.TrainAgent]: crate::client::Agents::train_agent
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TrainAgentRequest {
/// Required. The project that the agent to train is associated with.
/// Format: `projects/<Project ID>`.
pub parent: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl TrainAgentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::TrainAgentRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::TrainAgentRequest;
/// let x = TrainAgentRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for TrainAgentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.TrainAgentRequest"
}
}
/// The request message for
/// [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
///
/// [google.cloud.dialogflow.v2.Agents.ExportAgent]: crate::client::Agents::export_agent
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportAgentRequest {
/// Required. The project that the agent to export is associated with.
/// Format: `projects/<Project ID>`.
pub parent: std::string::String,
/// Required. The [Google Cloud
/// Storage](https://cloud.google.com/storage/docs/) URI to export the agent
/// to. The format of this URI must be `gs://<bucket-name>/<object-name>`. If
/// left unspecified, the serialized agent is returned inline.
///
/// Dialogflow performs a write operation for the Cloud Storage object
/// on the caller's behalf, so your request authentication must
/// have write permissions for the object. For more information, see
/// [Dialogflow access
/// control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
pub agent_uri: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl ExportAgentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ExportAgentRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ExportAgentRequest;
/// let x = ExportAgentRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [agent_uri][crate::model::ExportAgentRequest::agent_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ExportAgentRequest;
/// let x = ExportAgentRequest::new().set_agent_uri("example");
/// ```
pub fn set_agent_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.agent_uri = v.into();
self
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for ExportAgentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ExportAgentRequest"
}
}
/// The response message for
/// [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
///
/// [google.cloud.dialogflow.v2.Agents.ExportAgent]: crate::client::Agents::export_agent
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportAgentResponse {
/// The exported agent.
pub agent: std::option::Option<crate::model::export_agent_response::Agent>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl ExportAgentResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [agent][crate::model::ExportAgentResponse::agent].
///
/// Note that all the setters affecting `agent` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ExportAgentResponse;
/// use google_cloud_dialogflow_v2::model::export_agent_response::Agent;
/// let x = ExportAgentResponse::new().set_agent(Some(Agent::AgentUri("example".to_string())));
/// ```
pub fn set_agent<
T: std::convert::Into<std::option::Option<crate::model::export_agent_response::Agent>>,
>(
mut self,
v: T,
) -> Self {
self.agent = v.into();
self
}
/// The value of [agent][crate::model::ExportAgentResponse::agent]
/// if it holds a `AgentUri`, `None` if the field is not set or
/// holds a different branch.
pub fn agent_uri(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.agent.as_ref().and_then(|v| match v {
crate::model::export_agent_response::Agent::AgentUri(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [agent][crate::model::ExportAgentResponse::agent]
/// to hold a `AgentUri`.
///
/// Note that all the setters affecting `agent` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ExportAgentResponse;
/// let x = ExportAgentResponse::new().set_agent_uri("example");
/// assert!(x.agent_uri().is_some());
/// assert!(x.agent_content().is_none());
/// ```
pub fn set_agent_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.agent = std::option::Option::Some(
crate::model::export_agent_response::Agent::AgentUri(v.into()),
);
self
}
/// The value of [agent][crate::model::ExportAgentResponse::agent]
/// if it holds a `AgentContent`, `None` if the field is not set or
/// holds a different branch.
pub fn agent_content(&self) -> std::option::Option<&::bytes::Bytes> {
#[allow(unreachable_patterns)]
self.agent.as_ref().and_then(|v| match v {
crate::model::export_agent_response::Agent::AgentContent(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [agent][crate::model::ExportAgentResponse::agent]
/// to hold a `AgentContent`.
///
/// Note that all the setters affecting `agent` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ExportAgentResponse;
/// let x = ExportAgentResponse::new().set_agent_content(bytes::Bytes::from_static(b"example"));
/// assert!(x.agent_content().is_some());
/// assert!(x.agent_uri().is_none());
/// ```
pub fn set_agent_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.agent = std::option::Option::Some(
crate::model::export_agent_response::Agent::AgentContent(v.into()),
);
self
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for ExportAgentResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ExportAgentResponse"
}
}
/// Defines additional types related to [ExportAgentResponse].
#[cfg(feature = "agents")]
pub mod export_agent_response {
#[allow(unused_imports)]
use super::*;
/// The exported agent.
#[cfg(feature = "agents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Agent {
/// The URI to a file containing the exported agent. This field is populated
/// only if `agent_uri` is specified in `ExportAgentRequest`.
AgentUri(std::string::String),
/// Zip compressed raw byte content for agent.
AgentContent(::bytes::Bytes),
}
}
/// The request message for
/// [Agents.ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent].
///
/// [google.cloud.dialogflow.v2.Agents.ImportAgent]: crate::client::Agents::import_agent
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportAgentRequest {
/// Required. The project that the agent to import is associated with.
/// Format: `projects/<Project ID>`.
pub parent: std::string::String,
/// Required. The agent to import.
pub agent: std::option::Option<crate::model::import_agent_request::Agent>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl ImportAgentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ImportAgentRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportAgentRequest;
/// let x = ImportAgentRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [agent][crate::model::ImportAgentRequest::agent].
///
/// Note that all the setters affecting `agent` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportAgentRequest;
/// use google_cloud_dialogflow_v2::model::import_agent_request::Agent;
/// let x = ImportAgentRequest::new().set_agent(Some(Agent::AgentUri("example".to_string())));
/// ```
pub fn set_agent<
T: std::convert::Into<std::option::Option<crate::model::import_agent_request::Agent>>,
>(
mut self,
v: T,
) -> Self {
self.agent = v.into();
self
}
/// The value of [agent][crate::model::ImportAgentRequest::agent]
/// if it holds a `AgentUri`, `None` if the field is not set or
/// holds a different branch.
pub fn agent_uri(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.agent.as_ref().and_then(|v| match v {
crate::model::import_agent_request::Agent::AgentUri(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [agent][crate::model::ImportAgentRequest::agent]
/// to hold a `AgentUri`.
///
/// Note that all the setters affecting `agent` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportAgentRequest;
/// let x = ImportAgentRequest::new().set_agent_uri("example");
/// assert!(x.agent_uri().is_some());
/// assert!(x.agent_content().is_none());
/// ```
pub fn set_agent_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.agent = std::option::Option::Some(
crate::model::import_agent_request::Agent::AgentUri(v.into()),
);
self
}
/// The value of [agent][crate::model::ImportAgentRequest::agent]
/// if it holds a `AgentContent`, `None` if the field is not set or
/// holds a different branch.
pub fn agent_content(&self) -> std::option::Option<&::bytes::Bytes> {
#[allow(unreachable_patterns)]
self.agent.as_ref().and_then(|v| match v {
crate::model::import_agent_request::Agent::AgentContent(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [agent][crate::model::ImportAgentRequest::agent]
/// to hold a `AgentContent`.
///
/// Note that all the setters affecting `agent` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportAgentRequest;
/// let x = ImportAgentRequest::new().set_agent_content(bytes::Bytes::from_static(b"example"));
/// assert!(x.agent_content().is_some());
/// assert!(x.agent_uri().is_none());
/// ```
pub fn set_agent_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.agent = std::option::Option::Some(
crate::model::import_agent_request::Agent::AgentContent(v.into()),
);
self
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for ImportAgentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ImportAgentRequest"
}
}
/// Defines additional types related to [ImportAgentRequest].
#[cfg(feature = "agents")]
pub mod import_agent_request {
#[allow(unused_imports)]
use super::*;
/// Required. The agent to import.
#[cfg(feature = "agents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Agent {
/// The URI to a Google Cloud Storage file containing the agent to import.
/// Note: The URI must start with "gs://".
///
/// Dialogflow performs a read operation for the Cloud Storage object
/// on the caller's behalf, so your request authentication must
/// have read permissions for the object. For more information, see
/// [Dialogflow access
/// control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
AgentUri(std::string::String),
/// Zip compressed raw byte content for agent.
AgentContent(::bytes::Bytes),
}
}
/// The request message for
/// [Agents.RestoreAgent][google.cloud.dialogflow.v2.Agents.RestoreAgent].
///
/// [google.cloud.dialogflow.v2.Agents.RestoreAgent]: crate::client::Agents::restore_agent
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RestoreAgentRequest {
/// Required. The project that the agent to restore is associated with.
/// Format: `projects/<Project ID>`.
pub parent: std::string::String,
/// Required. The agent to restore.
pub agent: std::option::Option<crate::model::restore_agent_request::Agent>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl RestoreAgentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::RestoreAgentRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::RestoreAgentRequest;
/// let x = RestoreAgentRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [agent][crate::model::RestoreAgentRequest::agent].
///
/// Note that all the setters affecting `agent` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::RestoreAgentRequest;
/// use google_cloud_dialogflow_v2::model::restore_agent_request::Agent;
/// let x = RestoreAgentRequest::new().set_agent(Some(Agent::AgentUri("example".to_string())));
/// ```
pub fn set_agent<
T: std::convert::Into<std::option::Option<crate::model::restore_agent_request::Agent>>,
>(
mut self,
v: T,
) -> Self {
self.agent = v.into();
self
}
/// The value of [agent][crate::model::RestoreAgentRequest::agent]
/// if it holds a `AgentUri`, `None` if the field is not set or
/// holds a different branch.
pub fn agent_uri(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.agent.as_ref().and_then(|v| match v {
crate::model::restore_agent_request::Agent::AgentUri(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [agent][crate::model::RestoreAgentRequest::agent]
/// to hold a `AgentUri`.
///
/// Note that all the setters affecting `agent` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::RestoreAgentRequest;
/// let x = RestoreAgentRequest::new().set_agent_uri("example");
/// assert!(x.agent_uri().is_some());
/// assert!(x.agent_content().is_none());
/// ```
pub fn set_agent_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.agent = std::option::Option::Some(
crate::model::restore_agent_request::Agent::AgentUri(v.into()),
);
self
}
/// The value of [agent][crate::model::RestoreAgentRequest::agent]
/// if it holds a `AgentContent`, `None` if the field is not set or
/// holds a different branch.
pub fn agent_content(&self) -> std::option::Option<&::bytes::Bytes> {
#[allow(unreachable_patterns)]
self.agent.as_ref().and_then(|v| match v {
crate::model::restore_agent_request::Agent::AgentContent(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [agent][crate::model::RestoreAgentRequest::agent]
/// to hold a `AgentContent`.
///
/// Note that all the setters affecting `agent` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::RestoreAgentRequest;
/// let x = RestoreAgentRequest::new().set_agent_content(bytes::Bytes::from_static(b"example"));
/// assert!(x.agent_content().is_some());
/// assert!(x.agent_uri().is_none());
/// ```
pub fn set_agent_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.agent = std::option::Option::Some(
crate::model::restore_agent_request::Agent::AgentContent(v.into()),
);
self
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for RestoreAgentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.RestoreAgentRequest"
}
}
/// Defines additional types related to [RestoreAgentRequest].
#[cfg(feature = "agents")]
pub mod restore_agent_request {
#[allow(unused_imports)]
use super::*;
/// Required. The agent to restore.
#[cfg(feature = "agents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Agent {
/// The URI to a Google Cloud Storage file containing the agent to restore.
/// Note: The URI must start with "gs://".
///
/// Dialogflow performs a read operation for the Cloud Storage object
/// on the caller's behalf, so your request authentication must
/// have read permissions for the object. For more information, see
/// [Dialogflow access
/// control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
AgentUri(std::string::String),
/// Zip compressed raw byte content for agent.
AgentContent(::bytes::Bytes),
}
}
/// The request message for
/// [Agents.GetValidationResult][google.cloud.dialogflow.v2.Agents.GetValidationResult].
///
/// [google.cloud.dialogflow.v2.Agents.GetValidationResult]: crate::client::Agents::get_validation_result
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetValidationResultRequest {
/// Required. The project that the agent is associated with.
/// Format: `projects/<Project ID>`.
pub parent: std::string::String,
/// Optional. The language for which you want a validation result. If not
/// specified, the agent's default language is used. [Many
/// languages](https://cloud.google.com/dialogflow/docs/reference/language)
/// are supported. Note: languages must be enabled in the agent before they can
/// be used.
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl GetValidationResultRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::GetValidationResultRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetValidationResultRequest;
/// let x = GetValidationResultRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [language_code][crate::model::GetValidationResultRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetValidationResultRequest;
/// let x = GetValidationResultRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for GetValidationResultRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetValidationResultRequest"
}
}
/// Agent Coaching instructions that customer can configure.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AgentCoachingInstruction {
/// Optional. Display name for the instruction.
pub display_name: std::string::String,
/// Optional. The detailed description of this instruction.
pub display_details: std::string::String,
/// Optional. The condition of the instruction. For example, "the customer
/// wants to cancel an order". If the users want the instruction to be
/// triggered unconditionally, the condition can be empty.
pub condition: std::string::String,
/// Optional. The action that human agent should take. For example, "apologize
/// for the slow shipping". If the users only want to use agent coaching for
/// intent detection, agent_action can be empty
pub agent_action: std::string::String,
/// Optional. The action that system should take. For example,
/// "call GetOrderTime with order_number={order number provided by the
/// customer}". If the users don't have plugins or don't want to trigger
/// plugins, the system_action can be empty
pub system_action: std::string::String,
/// Output only. Duplication check for the AgentCoachingInstruction.
pub duplicate_check_result:
std::option::Option<crate::model::agent_coaching_instruction::DuplicateCheckResult>,
/// Optional. The event that should trigger this instruction.
/// If UNSPECIFIED, the instruction triggering will be same as the generator's
/// trigger_event.
pub triggering_event: crate::model::agent_coaching_instruction::TriggerEvent,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl AgentCoachingInstruction {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [display_name][crate::model::AgentCoachingInstruction::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingInstruction;
/// let x = AgentCoachingInstruction::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [display_details][crate::model::AgentCoachingInstruction::display_details].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingInstruction;
/// let x = AgentCoachingInstruction::new().set_display_details("example");
/// ```
pub fn set_display_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_details = v.into();
self
}
/// Sets the value of [condition][crate::model::AgentCoachingInstruction::condition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingInstruction;
/// let x = AgentCoachingInstruction::new().set_condition("example");
/// ```
pub fn set_condition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.condition = v.into();
self
}
/// Sets the value of [agent_action][crate::model::AgentCoachingInstruction::agent_action].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingInstruction;
/// let x = AgentCoachingInstruction::new().set_agent_action("example");
/// ```
pub fn set_agent_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.agent_action = v.into();
self
}
/// Sets the value of [system_action][crate::model::AgentCoachingInstruction::system_action].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingInstruction;
/// let x = AgentCoachingInstruction::new().set_system_action("example");
/// ```
pub fn set_system_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.system_action = v.into();
self
}
/// Sets the value of [duplicate_check_result][crate::model::AgentCoachingInstruction::duplicate_check_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingInstruction;
/// use google_cloud_dialogflow_v2::model::agent_coaching_instruction::DuplicateCheckResult;
/// let x = AgentCoachingInstruction::new().set_duplicate_check_result(DuplicateCheckResult::default()/* use setters */);
/// ```
pub fn set_duplicate_check_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::agent_coaching_instruction::DuplicateCheckResult>,
{
self.duplicate_check_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [duplicate_check_result][crate::model::AgentCoachingInstruction::duplicate_check_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingInstruction;
/// use google_cloud_dialogflow_v2::model::agent_coaching_instruction::DuplicateCheckResult;
/// let x = AgentCoachingInstruction::new().set_or_clear_duplicate_check_result(Some(DuplicateCheckResult::default()/* use setters */));
/// let x = AgentCoachingInstruction::new().set_or_clear_duplicate_check_result(None::<DuplicateCheckResult>);
/// ```
pub fn set_or_clear_duplicate_check_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::agent_coaching_instruction::DuplicateCheckResult>,
{
self.duplicate_check_result = v.map(|x| x.into());
self
}
/// Sets the value of [triggering_event][crate::model::AgentCoachingInstruction::triggering_event].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingInstruction;
/// use google_cloud_dialogflow_v2::model::agent_coaching_instruction::TriggerEvent;
/// let x0 = AgentCoachingInstruction::new().set_triggering_event(TriggerEvent::EndOfUtterance);
/// let x1 = AgentCoachingInstruction::new().set_triggering_event(TriggerEvent::ManualCall);
/// let x2 = AgentCoachingInstruction::new().set_triggering_event(TriggerEvent::CustomerMessage);
/// ```
pub fn set_triggering_event<
T: std::convert::Into<crate::model::agent_coaching_instruction::TriggerEvent>,
>(
mut self,
v: T,
) -> Self {
self.triggering_event = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for AgentCoachingInstruction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentCoachingInstruction"
}
}
/// Defines additional types related to [AgentCoachingInstruction].
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
pub mod agent_coaching_instruction {
#[allow(unused_imports)]
use super::*;
/// Duplication check for the suggestion.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DuplicateCheckResult {
/// Output only. The duplicate suggestions.
pub duplicate_suggestions: std::vec::Vec<
crate::model::agent_coaching_instruction::duplicate_check_result::DuplicateSuggestion,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl DuplicateCheckResult {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [duplicate_suggestions][crate::model::agent_coaching_instruction::DuplicateCheckResult::duplicate_suggestions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_instruction::DuplicateCheckResult;
/// use google_cloud_dialogflow_v2::model::agent_coaching_instruction::duplicate_check_result::DuplicateSuggestion;
/// let x = DuplicateCheckResult::new()
/// .set_duplicate_suggestions([
/// DuplicateSuggestion::default()/* use setters */,
/// DuplicateSuggestion::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_duplicate_suggestions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::agent_coaching_instruction::duplicate_check_result::DuplicateSuggestion>
{
use std::iter::Iterator;
self.duplicate_suggestions = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for DuplicateCheckResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentCoachingInstruction.DuplicateCheckResult"
}
}
/// Defines additional types related to [DuplicateCheckResult].
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
pub mod duplicate_check_result {
#[allow(unused_imports)]
use super::*;
/// The duplicate suggestion details.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DuplicateSuggestion {
/// Output only. The answer record id of the past duplicate suggestion.
pub answer_record: std::string::String,
/// Output only. The index of the duplicate suggestion in the past
/// suggestion list.
pub suggestion_index: i32,
/// Output only. The similarity score of between the past and current
/// suggestion.
pub similarity_score: f32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl DuplicateSuggestion {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer_record][crate::model::agent_coaching_instruction::duplicate_check_result::DuplicateSuggestion::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_instruction::duplicate_check_result::DuplicateSuggestion;
/// let x = DuplicateSuggestion::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.answer_record = v.into();
self
}
/// Sets the value of [suggestion_index][crate::model::agent_coaching_instruction::duplicate_check_result::DuplicateSuggestion::suggestion_index].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_instruction::duplicate_check_result::DuplicateSuggestion;
/// let x = DuplicateSuggestion::new().set_suggestion_index(42);
/// ```
pub fn set_suggestion_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.suggestion_index = v.into();
self
}
/// Sets the value of [similarity_score][crate::model::agent_coaching_instruction::duplicate_check_result::DuplicateSuggestion::similarity_score].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_instruction::duplicate_check_result::DuplicateSuggestion;
/// let x = DuplicateSuggestion::new().set_similarity_score(42.0);
/// ```
pub fn set_similarity_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.similarity_score = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for DuplicateSuggestion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentCoachingInstruction.DuplicateCheckResult.DuplicateSuggestion"
}
}
}
/// The event that should trigger this instruction.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TriggerEvent {
/// Default value for TriggerEvent.
Unspecified,
/// Triggers when each chat message or voice utterance ends.
EndOfUtterance,
/// Triggers on the conversation manually by API calls.
ManualCall,
/// Triggers after each customer message.
CustomerMessage,
/// Triggers after each agent message.
AgentMessage,
/// Triggers on tool call completion.
ToolCallCompletion,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [TriggerEvent::value] or
/// [TriggerEvent::name].
UnknownValue(trigger_event::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
pub mod trigger_event {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl TriggerEvent {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::EndOfUtterance => std::option::Option::Some(1),
Self::ManualCall => std::option::Option::Some(2),
Self::CustomerMessage => std::option::Option::Some(3),
Self::AgentMessage => std::option::Option::Some(4),
Self::ToolCallCompletion => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TRIGGER_EVENT_UNSPECIFIED"),
Self::EndOfUtterance => std::option::Option::Some("END_OF_UTTERANCE"),
Self::ManualCall => std::option::Option::Some("MANUAL_CALL"),
Self::CustomerMessage => std::option::Option::Some("CUSTOMER_MESSAGE"),
Self::AgentMessage => std::option::Option::Some("AGENT_MESSAGE"),
Self::ToolCallCompletion => std::option::Option::Some("TOOL_CALL_COMPLETION"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl std::default::Default for TriggerEvent {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl std::fmt::Display for TriggerEvent {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl std::convert::From<i32> for TriggerEvent {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::EndOfUtterance,
2 => Self::ManualCall,
3 => Self::CustomerMessage,
4 => Self::AgentMessage,
5 => Self::ToolCallCompletion,
_ => Self::UnknownValue(trigger_event::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl std::convert::From<&str> for TriggerEvent {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TRIGGER_EVENT_UNSPECIFIED" => Self::Unspecified,
"END_OF_UTTERANCE" => Self::EndOfUtterance,
"MANUAL_CALL" => Self::ManualCall,
"CUSTOMER_MESSAGE" => Self::CustomerMessage,
"AGENT_MESSAGE" => Self::AgentMessage,
"TOOL_CALL_COMPLETION" => Self::ToolCallCompletion,
_ => Self::UnknownValue(trigger_event::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl serde::ser::Serialize for TriggerEvent {
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::EndOfUtterance => serializer.serialize_i32(1),
Self::ManualCall => serializer.serialize_i32(2),
Self::CustomerMessage => serializer.serialize_i32(3),
Self::AgentMessage => serializer.serialize_i32(4),
Self::ToolCallCompletion => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl<'de> serde::de::Deserialize<'de> for TriggerEvent {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TriggerEvent>::new(
".google.cloud.dialogflow.v2.AgentCoachingInstruction.TriggerEvent",
))
}
}
}
/// Answer records are records to manage answer history and feedbacks for
/// Dialogflow.
///
/// Currently, answer record includes:
///
/// - human agent assistant article suggestion
/// - human agent assistant faq article
///
/// It doesn't include:
///
/// - `DetectIntent` intent matching
/// - `DetectIntent` knowledge
///
/// Answer records are not related to the conversation history in the
/// Dialogflow Console. A Record is generated even when the end-user disables
/// conversation history in the console. Records are created when there's a human
/// agent assistant suggestion generated.
///
/// A typical workflow for customers provide feedback to an answer is:
///
/// 1. For human agent assistant, customers get suggestion via ListSuggestions
/// API. Together with the answers,
/// [AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name] are
/// returned to the customers.
/// 1. The customer uses the
/// [AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name] to call the
/// [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord]
/// method to send feedback about a specific answer that they believe is
/// wrong.
///
/// [google.cloud.dialogflow.v2.AnswerRecord.name]: crate::model::AnswerRecord::name
/// [google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord]: crate::client::AnswerRecords::update_answer_record
#[cfg(feature = "answer-records")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AnswerRecord {
/// The unique identifier of this answer record.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/answerRecords/<Answer Record ID>`.
pub name: std::string::String,
/// Required. The AnswerFeedback for this record. You can set this with
/// [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord]
/// in order to give us feedback about this answer.
///
/// [google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord]: crate::client::AnswerRecords::update_answer_record
pub answer_feedback: std::option::Option<crate::model::AnswerFeedback>,
/// The record for this answer.
pub record: std::option::Option<crate::model::answer_record::Record>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "answer-records")]
impl AnswerRecord {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::AnswerRecord::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerRecord;
/// let x = AnswerRecord::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [answer_feedback][crate::model::AnswerRecord::answer_feedback].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerRecord;
/// use google_cloud_dialogflow_v2::model::AnswerFeedback;
/// let x = AnswerRecord::new().set_answer_feedback(AnswerFeedback::default()/* use setters */);
/// ```
pub fn set_answer_feedback<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AnswerFeedback>,
{
self.answer_feedback = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [answer_feedback][crate::model::AnswerRecord::answer_feedback].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerRecord;
/// use google_cloud_dialogflow_v2::model::AnswerFeedback;
/// let x = AnswerRecord::new().set_or_clear_answer_feedback(Some(AnswerFeedback::default()/* use setters */));
/// let x = AnswerRecord::new().set_or_clear_answer_feedback(None::<AnswerFeedback>);
/// ```
pub fn set_or_clear_answer_feedback<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AnswerFeedback>,
{
self.answer_feedback = v.map(|x| x.into());
self
}
/// Sets the value of [record][crate::model::AnswerRecord::record].
///
/// Note that all the setters affecting `record` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerRecord;
/// use google_cloud_dialogflow_v2::model::AgentAssistantRecord;
/// let x = AnswerRecord::new().set_record(Some(
/// google_cloud_dialogflow_v2::model::answer_record::Record::AgentAssistantRecord(AgentAssistantRecord::default().into())));
/// ```
pub fn set_record<
T: std::convert::Into<std::option::Option<crate::model::answer_record::Record>>,
>(
mut self,
v: T,
) -> Self {
self.record = v.into();
self
}
/// The value of [record][crate::model::AnswerRecord::record]
/// if it holds a `AgentAssistantRecord`, `None` if the field is not set or
/// holds a different branch.
pub fn agent_assistant_record(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::AgentAssistantRecord>> {
#[allow(unreachable_patterns)]
self.record.as_ref().and_then(|v| match v {
crate::model::answer_record::Record::AgentAssistantRecord(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [record][crate::model::AnswerRecord::record]
/// to hold a `AgentAssistantRecord`.
///
/// Note that all the setters affecting `record` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerRecord;
/// use google_cloud_dialogflow_v2::model::AgentAssistantRecord;
/// let x = AnswerRecord::new().set_agent_assistant_record(AgentAssistantRecord::default()/* use setters */);
/// assert!(x.agent_assistant_record().is_some());
/// ```
pub fn set_agent_assistant_record<
T: std::convert::Into<std::boxed::Box<crate::model::AgentAssistantRecord>>,
>(
mut self,
v: T,
) -> Self {
self.record = std::option::Option::Some(
crate::model::answer_record::Record::AgentAssistantRecord(v.into()),
);
self
}
}
#[cfg(feature = "answer-records")]
impl wkt::message::Message for AnswerRecord {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AnswerRecord"
}
}
/// Defines additional types related to [AnswerRecord].
#[cfg(feature = "answer-records")]
pub mod answer_record {
#[allow(unused_imports)]
use super::*;
/// The record for this answer.
#[cfg(feature = "answer-records")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Record {
/// Output only. The record for human agent assistant.
AgentAssistantRecord(std::boxed::Box<crate::model::AgentAssistantRecord>),
}
}
/// Request message for
/// [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords].
///
/// [google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords]: crate::client::AnswerRecords::list_answer_records
#[cfg(feature = "answer-records")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAnswerRecordsRequest {
/// Required. The project to list all answer records for in reverse
/// chronological order. Format: `projects/<Project ID>/locations/<Location
/// ID>`.
pub parent: std::string::String,
/// Optional. Filters to restrict results to specific answer records. The
/// expression has the following syntax:
///
/// ```norust
/// <field> <operator> <value> [AND <field> <operator> <value>] ...
/// ```
///
/// The following fields and operators are supported:
///
/// * conversation_id with equals(=) operator
///
/// Examples:
///
/// * `conversation_id=bar` matches answer records in the
/// `projects/foo/locations/global/conversations/bar` conversation
/// (assuming the parent is `projects/foo/locations/global`).
///
/// For more information about filtering, see
/// [API Filtering](https://aip.dev/160).
pub filter: std::string::String,
/// Optional. The maximum number of records to return in a single page.
/// The server may return fewer records than this. If unspecified, we use 10.
/// The maximum is 100.
pub page_size: i32,
/// Optional. The
/// [ListAnswerRecordsResponse.next_page_token][google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token]
/// value returned from a previous list request used to continue listing on
/// the next page.
///
/// [google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token]: crate::model::ListAnswerRecordsResponse::next_page_token
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "answer-records")]
impl ListAnswerRecordsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListAnswerRecordsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListAnswerRecordsRequest;
/// let x = ListAnswerRecordsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListAnswerRecordsRequest::filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListAnswerRecordsRequest;
/// let x = ListAnswerRecordsRequest::new().set_filter("example");
/// ```
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListAnswerRecordsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListAnswerRecordsRequest;
/// let x = ListAnswerRecordsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListAnswerRecordsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListAnswerRecordsRequest;
/// let x = ListAnswerRecordsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "answer-records")]
impl wkt::message::Message for ListAnswerRecordsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListAnswerRecordsRequest"
}
}
/// Response message for
/// [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords].
///
/// [google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords]: crate::client::AnswerRecords::list_answer_records
#[cfg(feature = "answer-records")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListAnswerRecordsResponse {
/// The list of answer records.
pub answer_records: std::vec::Vec<crate::model::AnswerRecord>,
/// A token to retrieve next page of results. Or empty if there are no more
/// results.
/// Pass this value in the
/// [ListAnswerRecordsRequest.page_token][google.cloud.dialogflow.v2.ListAnswerRecordsRequest.page_token]
/// field in the subsequent call to `ListAnswerRecords` method to retrieve the
/// next page of results.
///
/// [google.cloud.dialogflow.v2.ListAnswerRecordsRequest.page_token]: crate::model::ListAnswerRecordsRequest::page_token
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "answer-records")]
impl ListAnswerRecordsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer_records][crate::model::ListAnswerRecordsResponse::answer_records].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListAnswerRecordsResponse;
/// use google_cloud_dialogflow_v2::model::AnswerRecord;
/// let x = ListAnswerRecordsResponse::new()
/// .set_answer_records([
/// AnswerRecord::default()/* use setters */,
/// AnswerRecord::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_answer_records<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::AnswerRecord>,
{
use std::iter::Iterator;
self.answer_records = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListAnswerRecordsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListAnswerRecordsResponse;
/// let x = ListAnswerRecordsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "answer-records")]
impl wkt::message::Message for ListAnswerRecordsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListAnswerRecordsResponse"
}
}
#[cfg(feature = "answer-records")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListAnswerRecordsResponse {
type PageItem = crate::model::AnswerRecord;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.answer_records
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Request message for
/// [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord].
///
/// [google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord]: crate::client::AnswerRecords::update_answer_record
#[cfg(feature = "answer-records")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateAnswerRecordRequest {
/// Required. Answer record to update.
pub answer_record: std::option::Option<crate::model::AnswerRecord>,
/// Required. The mask to control which fields get updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "answer-records")]
impl UpdateAnswerRecordRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer_record][crate::model::UpdateAnswerRecordRequest::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateAnswerRecordRequest;
/// use google_cloud_dialogflow_v2::model::AnswerRecord;
/// let x = UpdateAnswerRecordRequest::new().set_answer_record(AnswerRecord::default()/* use setters */);
/// ```
pub fn set_answer_record<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AnswerRecord>,
{
self.answer_record = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [answer_record][crate::model::UpdateAnswerRecordRequest::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateAnswerRecordRequest;
/// use google_cloud_dialogflow_v2::model::AnswerRecord;
/// let x = UpdateAnswerRecordRequest::new().set_or_clear_answer_record(Some(AnswerRecord::default()/* use setters */));
/// let x = UpdateAnswerRecordRequest::new().set_or_clear_answer_record(None::<AnswerRecord>);
/// ```
pub fn set_or_clear_answer_record<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AnswerRecord>,
{
self.answer_record = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateAnswerRecordRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateAnswerRecordRequest;
/// use wkt::FieldMask;
/// let x = UpdateAnswerRecordRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateAnswerRecordRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateAnswerRecordRequest;
/// use wkt::FieldMask;
/// let x = UpdateAnswerRecordRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateAnswerRecordRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "answer-records")]
impl wkt::message::Message for UpdateAnswerRecordRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateAnswerRecordRequest"
}
}
/// Represents feedback the customer has about the quality & correctness of a
/// certain answer in a conversation.
#[cfg(feature = "answer-records")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AnswerFeedback {
/// The correctness level of the specific answer.
pub correctness_level: crate::model::answer_feedback::CorrectnessLevel,
/// Indicates whether the answer/item was clicked by the human agent
/// or not. Default to false.
/// For knowledge search and knowledge assist, the answer record is considered
/// to be clicked if the answer was copied or any URI was clicked.
pub clicked: bool,
/// Time when the answer/item was clicked.
pub click_time: std::option::Option<wkt::Timestamp>,
/// Indicates whether the answer/item was displayed to the human
/// agent in the agent desktop UI. Default to false.
pub displayed: bool,
/// Time when the answer/item was displayed.
pub display_time: std::option::Option<wkt::Timestamp>,
/// Normally, detail feedback is provided when answer is not fully correct.
pub detail_feedback: std::option::Option<crate::model::answer_feedback::DetailFeedback>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "answer-records")]
impl AnswerFeedback {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [correctness_level][crate::model::AnswerFeedback::correctness_level].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerFeedback;
/// use google_cloud_dialogflow_v2::model::answer_feedback::CorrectnessLevel;
/// let x0 = AnswerFeedback::new().set_correctness_level(CorrectnessLevel::NotCorrect);
/// let x1 = AnswerFeedback::new().set_correctness_level(CorrectnessLevel::PartiallyCorrect);
/// let x2 = AnswerFeedback::new().set_correctness_level(CorrectnessLevel::FullyCorrect);
/// ```
pub fn set_correctness_level<
T: std::convert::Into<crate::model::answer_feedback::CorrectnessLevel>,
>(
mut self,
v: T,
) -> Self {
self.correctness_level = v.into();
self
}
/// Sets the value of [clicked][crate::model::AnswerFeedback::clicked].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerFeedback;
/// let x = AnswerFeedback::new().set_clicked(true);
/// ```
pub fn set_clicked<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.clicked = v.into();
self
}
/// Sets the value of [click_time][crate::model::AnswerFeedback::click_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerFeedback;
/// use wkt::Timestamp;
/// let x = AnswerFeedback::new().set_click_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_click_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.click_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [click_time][crate::model::AnswerFeedback::click_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerFeedback;
/// use wkt::Timestamp;
/// let x = AnswerFeedback::new().set_or_clear_click_time(Some(Timestamp::default()/* use setters */));
/// let x = AnswerFeedback::new().set_or_clear_click_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_click_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.click_time = v.map(|x| x.into());
self
}
/// Sets the value of [displayed][crate::model::AnswerFeedback::displayed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerFeedback;
/// let x = AnswerFeedback::new().set_displayed(true);
/// ```
pub fn set_displayed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.displayed = v.into();
self
}
/// Sets the value of [display_time][crate::model::AnswerFeedback::display_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerFeedback;
/// use wkt::Timestamp;
/// let x = AnswerFeedback::new().set_display_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_display_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.display_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [display_time][crate::model::AnswerFeedback::display_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerFeedback;
/// use wkt::Timestamp;
/// let x = AnswerFeedback::new().set_or_clear_display_time(Some(Timestamp::default()/* use setters */));
/// let x = AnswerFeedback::new().set_or_clear_display_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_display_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.display_time = v.map(|x| x.into());
self
}
/// Sets the value of [detail_feedback][crate::model::AnswerFeedback::detail_feedback].
///
/// Note that all the setters affecting `detail_feedback` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerFeedback;
/// use google_cloud_dialogflow_v2::model::AgentAssistantFeedback;
/// let x = AnswerFeedback::new().set_detail_feedback(Some(
/// google_cloud_dialogflow_v2::model::answer_feedback::DetailFeedback::AgentAssistantDetailFeedback(AgentAssistantFeedback::default().into())));
/// ```
pub fn set_detail_feedback<
T: std::convert::Into<std::option::Option<crate::model::answer_feedback::DetailFeedback>>,
>(
mut self,
v: T,
) -> Self {
self.detail_feedback = v.into();
self
}
/// The value of [detail_feedback][crate::model::AnswerFeedback::detail_feedback]
/// if it holds a `AgentAssistantDetailFeedback`, `None` if the field is not set or
/// holds a different branch.
pub fn agent_assistant_detail_feedback(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::AgentAssistantFeedback>> {
#[allow(unreachable_patterns)]
self.detail_feedback.as_ref().and_then(|v| match v {
crate::model::answer_feedback::DetailFeedback::AgentAssistantDetailFeedback(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [detail_feedback][crate::model::AnswerFeedback::detail_feedback]
/// to hold a `AgentAssistantDetailFeedback`.
///
/// Note that all the setters affecting `detail_feedback` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnswerFeedback;
/// use google_cloud_dialogflow_v2::model::AgentAssistantFeedback;
/// let x = AnswerFeedback::new().set_agent_assistant_detail_feedback(AgentAssistantFeedback::default()/* use setters */);
/// assert!(x.agent_assistant_detail_feedback().is_some());
/// ```
pub fn set_agent_assistant_detail_feedback<
T: std::convert::Into<std::boxed::Box<crate::model::AgentAssistantFeedback>>,
>(
mut self,
v: T,
) -> Self {
self.detail_feedback = std::option::Option::Some(
crate::model::answer_feedback::DetailFeedback::AgentAssistantDetailFeedback(v.into()),
);
self
}
}
#[cfg(feature = "answer-records")]
impl wkt::message::Message for AnswerFeedback {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AnswerFeedback"
}
}
/// Defines additional types related to [AnswerFeedback].
#[cfg(feature = "answer-records")]
pub mod answer_feedback {
#[allow(unused_imports)]
use super::*;
/// The correctness level of an answer.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "answer-records")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum CorrectnessLevel {
/// Correctness level unspecified.
Unspecified,
/// Answer is totally wrong.
NotCorrect,
/// Answer is partially correct.
PartiallyCorrect,
/// Answer is fully correct.
FullyCorrect,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [CorrectnessLevel::value] or
/// [CorrectnessLevel::name].
UnknownValue(correctness_level::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "answer-records")]
pub mod correctness_level {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "answer-records")]
impl CorrectnessLevel {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::NotCorrect => std::option::Option::Some(1),
Self::PartiallyCorrect => std::option::Option::Some(2),
Self::FullyCorrect => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CORRECTNESS_LEVEL_UNSPECIFIED"),
Self::NotCorrect => std::option::Option::Some("NOT_CORRECT"),
Self::PartiallyCorrect => std::option::Option::Some("PARTIALLY_CORRECT"),
Self::FullyCorrect => std::option::Option::Some("FULLY_CORRECT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "answer-records")]
impl std::default::Default for CorrectnessLevel {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "answer-records")]
impl std::fmt::Display for CorrectnessLevel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "answer-records")]
impl std::convert::From<i32> for CorrectnessLevel {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::NotCorrect,
2 => Self::PartiallyCorrect,
3 => Self::FullyCorrect,
_ => Self::UnknownValue(correctness_level::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "answer-records")]
impl std::convert::From<&str> for CorrectnessLevel {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CORRECTNESS_LEVEL_UNSPECIFIED" => Self::Unspecified,
"NOT_CORRECT" => Self::NotCorrect,
"PARTIALLY_CORRECT" => Self::PartiallyCorrect,
"FULLY_CORRECT" => Self::FullyCorrect,
_ => Self::UnknownValue(correctness_level::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "answer-records")]
impl serde::ser::Serialize for CorrectnessLevel {
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::NotCorrect => serializer.serialize_i32(1),
Self::PartiallyCorrect => serializer.serialize_i32(2),
Self::FullyCorrect => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "answer-records")]
impl<'de> serde::de::Deserialize<'de> for CorrectnessLevel {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<CorrectnessLevel>::new(
".google.cloud.dialogflow.v2.AnswerFeedback.CorrectnessLevel",
))
}
}
/// Normally, detail feedback is provided when answer is not fully correct.
#[cfg(feature = "answer-records")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DetailFeedback {
/// Detail feedback of agent assist suggestions.
AgentAssistantDetailFeedback(std::boxed::Box<crate::model::AgentAssistantFeedback>),
}
}
/// Detail feedback of Agent Assist result.
#[cfg(feature = "answer-records")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AgentAssistantFeedback {
/// Optional. Whether or not the suggested answer is relevant.
///
/// For example:
///
/// * Query: "Can I change my mailing address?"
/// * Suggested document says: "Items must be returned/exchanged within 60
/// days of the purchase date."
/// * [answer_relevance][google.cloud.dialogflow.v2.AgentAssistantFeedback.answer_relevance]: [AnswerRelevance.IRRELEVANT][google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance.IRRELEVANT]
///
/// [google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance.IRRELEVANT]: crate::model::agent_assistant_feedback::AnswerRelevance::Irrelevant
/// [google.cloud.dialogflow.v2.AgentAssistantFeedback.answer_relevance]: crate::model::AgentAssistantFeedback::answer_relevance
pub answer_relevance: crate::model::agent_assistant_feedback::AnswerRelevance,
/// Optional. Whether or not the information in the document is correct.
///
/// For example:
///
/// * Query: "Can I return the package in 2 days once received?"
/// * Suggested document says: "Items must be returned/exchanged within 60
/// days of the purchase date."
/// * Ground truth: "No return or exchange is allowed."
/// * [document_correctness][google.cloud.dialogflow.v2.AgentAssistantFeedback.document_correctness]: [INCORRECT][google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness.INCORRECT]
///
/// [google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness.INCORRECT]: crate::model::agent_assistant_feedback::DocumentCorrectness::Incorrect
/// [google.cloud.dialogflow.v2.AgentAssistantFeedback.document_correctness]: crate::model::AgentAssistantFeedback::document_correctness
pub document_correctness: crate::model::agent_assistant_feedback::DocumentCorrectness,
/// Optional. Whether or not the suggested document is efficient. For example,
/// if the document is poorly written, hard to understand, hard to use or
/// too long to find useful information,
/// [document_efficiency][google.cloud.dialogflow.v2.AgentAssistantFeedback.document_efficiency]
/// is
/// [DocumentEfficiency.INEFFICIENT][google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency.INEFFICIENT].
///
/// [google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency.INEFFICIENT]: crate::model::agent_assistant_feedback::DocumentEfficiency::Inefficient
/// [google.cloud.dialogflow.v2.AgentAssistantFeedback.document_efficiency]: crate::model::AgentAssistantFeedback::document_efficiency
pub document_efficiency: crate::model::agent_assistant_feedback::DocumentEfficiency,
/// Optional. Feedback for conversation summarization.
pub summarization_feedback:
std::option::Option<crate::model::agent_assistant_feedback::SummarizationFeedback>,
/// Optional. Feedback for knowledge search.
pub knowledge_search_feedback:
std::option::Option<crate::model::agent_assistant_feedback::KnowledgeSearchFeedback>,
/// Optional. Feedback for knowledge assist.
pub knowledge_assist_feedback:
std::option::Option<crate::model::agent_assistant_feedback::KnowledgeAssistFeedback>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "answer-records")]
impl AgentAssistantFeedback {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer_relevance][crate::model::AgentAssistantFeedback::answer_relevance].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantFeedback;
/// use google_cloud_dialogflow_v2::model::agent_assistant_feedback::AnswerRelevance;
/// let x0 = AgentAssistantFeedback::new().set_answer_relevance(AnswerRelevance::Irrelevant);
/// let x1 = AgentAssistantFeedback::new().set_answer_relevance(AnswerRelevance::Relevant);
/// ```
pub fn set_answer_relevance<
T: std::convert::Into<crate::model::agent_assistant_feedback::AnswerRelevance>,
>(
mut self,
v: T,
) -> Self {
self.answer_relevance = v.into();
self
}
/// Sets the value of [document_correctness][crate::model::AgentAssistantFeedback::document_correctness].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantFeedback;
/// use google_cloud_dialogflow_v2::model::agent_assistant_feedback::DocumentCorrectness;
/// let x0 = AgentAssistantFeedback::new().set_document_correctness(DocumentCorrectness::Incorrect);
/// let x1 = AgentAssistantFeedback::new().set_document_correctness(DocumentCorrectness::Correct);
/// ```
pub fn set_document_correctness<
T: std::convert::Into<crate::model::agent_assistant_feedback::DocumentCorrectness>,
>(
mut self,
v: T,
) -> Self {
self.document_correctness = v.into();
self
}
/// Sets the value of [document_efficiency][crate::model::AgentAssistantFeedback::document_efficiency].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantFeedback;
/// use google_cloud_dialogflow_v2::model::agent_assistant_feedback::DocumentEfficiency;
/// let x0 = AgentAssistantFeedback::new().set_document_efficiency(DocumentEfficiency::Inefficient);
/// let x1 = AgentAssistantFeedback::new().set_document_efficiency(DocumentEfficiency::Efficient);
/// ```
pub fn set_document_efficiency<
T: std::convert::Into<crate::model::agent_assistant_feedback::DocumentEfficiency>,
>(
mut self,
v: T,
) -> Self {
self.document_efficiency = v.into();
self
}
/// Sets the value of [summarization_feedback][crate::model::AgentAssistantFeedback::summarization_feedback].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantFeedback;
/// use google_cloud_dialogflow_v2::model::agent_assistant_feedback::SummarizationFeedback;
/// let x = AgentAssistantFeedback::new().set_summarization_feedback(SummarizationFeedback::default()/* use setters */);
/// ```
pub fn set_summarization_feedback<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::agent_assistant_feedback::SummarizationFeedback>,
{
self.summarization_feedback = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [summarization_feedback][crate::model::AgentAssistantFeedback::summarization_feedback].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantFeedback;
/// use google_cloud_dialogflow_v2::model::agent_assistant_feedback::SummarizationFeedback;
/// let x = AgentAssistantFeedback::new().set_or_clear_summarization_feedback(Some(SummarizationFeedback::default()/* use setters */));
/// let x = AgentAssistantFeedback::new().set_or_clear_summarization_feedback(None::<SummarizationFeedback>);
/// ```
pub fn set_or_clear_summarization_feedback<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::agent_assistant_feedback::SummarizationFeedback>,
{
self.summarization_feedback = v.map(|x| x.into());
self
}
/// Sets the value of [knowledge_search_feedback][crate::model::AgentAssistantFeedback::knowledge_search_feedback].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantFeedback;
/// use google_cloud_dialogflow_v2::model::agent_assistant_feedback::KnowledgeSearchFeedback;
/// let x = AgentAssistantFeedback::new().set_knowledge_search_feedback(KnowledgeSearchFeedback::default()/* use setters */);
/// ```
pub fn set_knowledge_search_feedback<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::agent_assistant_feedback::KnowledgeSearchFeedback>,
{
self.knowledge_search_feedback = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [knowledge_search_feedback][crate::model::AgentAssistantFeedback::knowledge_search_feedback].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantFeedback;
/// use google_cloud_dialogflow_v2::model::agent_assistant_feedback::KnowledgeSearchFeedback;
/// let x = AgentAssistantFeedback::new().set_or_clear_knowledge_search_feedback(Some(KnowledgeSearchFeedback::default()/* use setters */));
/// let x = AgentAssistantFeedback::new().set_or_clear_knowledge_search_feedback(None::<KnowledgeSearchFeedback>);
/// ```
pub fn set_or_clear_knowledge_search_feedback<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::agent_assistant_feedback::KnowledgeSearchFeedback>,
{
self.knowledge_search_feedback = v.map(|x| x.into());
self
}
/// Sets the value of [knowledge_assist_feedback][crate::model::AgentAssistantFeedback::knowledge_assist_feedback].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantFeedback;
/// use google_cloud_dialogflow_v2::model::agent_assistant_feedback::KnowledgeAssistFeedback;
/// let x = AgentAssistantFeedback::new().set_knowledge_assist_feedback(KnowledgeAssistFeedback::default()/* use setters */);
/// ```
pub fn set_knowledge_assist_feedback<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::agent_assistant_feedback::KnowledgeAssistFeedback>,
{
self.knowledge_assist_feedback = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [knowledge_assist_feedback][crate::model::AgentAssistantFeedback::knowledge_assist_feedback].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantFeedback;
/// use google_cloud_dialogflow_v2::model::agent_assistant_feedback::KnowledgeAssistFeedback;
/// let x = AgentAssistantFeedback::new().set_or_clear_knowledge_assist_feedback(Some(KnowledgeAssistFeedback::default()/* use setters */));
/// let x = AgentAssistantFeedback::new().set_or_clear_knowledge_assist_feedback(None::<KnowledgeAssistFeedback>);
/// ```
pub fn set_or_clear_knowledge_assist_feedback<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::agent_assistant_feedback::KnowledgeAssistFeedback>,
{
self.knowledge_assist_feedback = v.map(|x| x.into());
self
}
}
#[cfg(feature = "answer-records")]
impl wkt::message::Message for AgentAssistantFeedback {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentAssistantFeedback"
}
}
/// Defines additional types related to [AgentAssistantFeedback].
#[cfg(feature = "answer-records")]
pub mod agent_assistant_feedback {
#[allow(unused_imports)]
use super::*;
/// Feedback for conversation summarization.
#[cfg(feature = "answer-records")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SummarizationFeedback {
/// Timestamp when composing of the summary starts.
pub start_time: std::option::Option<wkt::Timestamp>,
/// Timestamp when the summary was submitted.
pub submit_time: std::option::Option<wkt::Timestamp>,
/// Text of actual submitted summary.
pub summary_text: std::string::String,
/// Optional. Actual text sections of submitted summary.
pub text_sections: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "answer-records")]
impl SummarizationFeedback {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [start_time][crate::model::agent_assistant_feedback::SummarizationFeedback::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_assistant_feedback::SummarizationFeedback;
/// use wkt::Timestamp;
/// let x = SummarizationFeedback::new().set_start_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [start_time][crate::model::agent_assistant_feedback::SummarizationFeedback::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_assistant_feedback::SummarizationFeedback;
/// use wkt::Timestamp;
/// let x = SummarizationFeedback::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
/// let x = SummarizationFeedback::new().set_or_clear_start_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [submit_time][crate::model::agent_assistant_feedback::SummarizationFeedback::submit_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_assistant_feedback::SummarizationFeedback;
/// use wkt::Timestamp;
/// let x = SummarizationFeedback::new().set_submit_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_submit_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.submit_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [submit_time][crate::model::agent_assistant_feedback::SummarizationFeedback::submit_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_assistant_feedback::SummarizationFeedback;
/// use wkt::Timestamp;
/// let x = SummarizationFeedback::new().set_or_clear_submit_time(Some(Timestamp::default()/* use setters */));
/// let x = SummarizationFeedback::new().set_or_clear_submit_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_submit_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.submit_time = v.map(|x| x.into());
self
}
/// Sets the value of [summary_text][crate::model::agent_assistant_feedback::SummarizationFeedback::summary_text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_assistant_feedback::SummarizationFeedback;
/// let x = SummarizationFeedback::new().set_summary_text("example");
/// ```
pub fn set_summary_text<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.summary_text = v.into();
self
}
/// Sets the value of [text_sections][crate::model::agent_assistant_feedback::SummarizationFeedback::text_sections].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_assistant_feedback::SummarizationFeedback;
/// let x = SummarizationFeedback::new().set_text_sections([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_text_sections<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.text_sections = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
#[cfg(feature = "answer-records")]
impl wkt::message::Message for SummarizationFeedback {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentAssistantFeedback.SummarizationFeedback"
}
}
/// Feedback for knowledge search.
#[cfg(feature = "answer-records")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KnowledgeSearchFeedback {
/// Whether the answer was copied by the human agent or not.
/// If the value is set to be true,
/// [AnswerFeedback.clicked][google.cloud.dialogflow.v2.AnswerFeedback.clicked]
/// will be updated to be true.
///
/// [google.cloud.dialogflow.v2.AnswerFeedback.clicked]: crate::model::AnswerFeedback::clicked
pub answer_copied: bool,
/// The URIs clicked by the human agent. The value is appended for each
/// [UpdateAnswerRecordRequest][google.cloud.dialogflow.v2.UpdateAnswerRecordRequest].
/// If the value is not empty,
/// [AnswerFeedback.clicked][google.cloud.dialogflow.v2.AnswerFeedback.clicked]
/// will be updated to be true.
///
/// [google.cloud.dialogflow.v2.AnswerFeedback.clicked]: crate::model::AnswerFeedback::clicked
/// [google.cloud.dialogflow.v2.UpdateAnswerRecordRequest]: crate::model::UpdateAnswerRecordRequest
pub clicked_uris: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "answer-records")]
impl KnowledgeSearchFeedback {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer_copied][crate::model::agent_assistant_feedback::KnowledgeSearchFeedback::answer_copied].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_assistant_feedback::KnowledgeSearchFeedback;
/// let x = KnowledgeSearchFeedback::new().set_answer_copied(true);
/// ```
pub fn set_answer_copied<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.answer_copied = v.into();
self
}
/// Sets the value of [clicked_uris][crate::model::agent_assistant_feedback::KnowledgeSearchFeedback::clicked_uris].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_assistant_feedback::KnowledgeSearchFeedback;
/// let x = KnowledgeSearchFeedback::new().set_clicked_uris(["a", "b", "c"]);
/// ```
pub fn set_clicked_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.clicked_uris = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "answer-records")]
impl wkt::message::Message for KnowledgeSearchFeedback {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentAssistantFeedback.KnowledgeSearchFeedback"
}
}
/// Feedback for knowledge assist.
#[cfg(feature = "answer-records")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KnowledgeAssistFeedback {
/// Whether the suggested answer was copied by the human agent.
/// If the value is set to be true,
/// [AnswerFeedback.clicked][google.cloud.dialogflow.v2.AnswerFeedback.clicked]
/// will be updated to be true.
///
/// [google.cloud.dialogflow.v2.AnswerFeedback.clicked]: crate::model::AnswerFeedback::clicked
pub answer_copied: bool,
/// The URIs clicked by the human agent. The value is appended for each
/// UpdateAnswerRecordRequest.
/// If the value is not empty,
/// [AnswerFeedback.clicked][google.cloud.dialogflow.v2.AnswerFeedback.clicked]
/// will be updated to be true.
///
/// [google.cloud.dialogflow.v2.AnswerFeedback.clicked]: crate::model::AnswerFeedback::clicked
pub clicked_uris: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "answer-records")]
impl KnowledgeAssistFeedback {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer_copied][crate::model::agent_assistant_feedback::KnowledgeAssistFeedback::answer_copied].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_assistant_feedback::KnowledgeAssistFeedback;
/// let x = KnowledgeAssistFeedback::new().set_answer_copied(true);
/// ```
pub fn set_answer_copied<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.answer_copied = v.into();
self
}
/// Sets the value of [clicked_uris][crate::model::agent_assistant_feedback::KnowledgeAssistFeedback::clicked_uris].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_assistant_feedback::KnowledgeAssistFeedback;
/// let x = KnowledgeAssistFeedback::new().set_clicked_uris(["a", "b", "c"]);
/// ```
pub fn set_clicked_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.clicked_uris = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "answer-records")]
impl wkt::message::Message for KnowledgeAssistFeedback {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentAssistantFeedback.KnowledgeAssistFeedback"
}
}
/// Relevance of an answer.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "answer-records")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AnswerRelevance {
/// Answer relevance unspecified.
Unspecified,
/// Answer is irrelevant to query.
Irrelevant,
/// Answer is relevant to query.
Relevant,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [AnswerRelevance::value] or
/// [AnswerRelevance::name].
UnknownValue(answer_relevance::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "answer-records")]
pub mod answer_relevance {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "answer-records")]
impl AnswerRelevance {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Irrelevant => std::option::Option::Some(1),
Self::Relevant => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ANSWER_RELEVANCE_UNSPECIFIED"),
Self::Irrelevant => std::option::Option::Some("IRRELEVANT"),
Self::Relevant => std::option::Option::Some("RELEVANT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "answer-records")]
impl std::default::Default for AnswerRelevance {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "answer-records")]
impl std::fmt::Display for AnswerRelevance {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "answer-records")]
impl std::convert::From<i32> for AnswerRelevance {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Irrelevant,
2 => Self::Relevant,
_ => Self::UnknownValue(answer_relevance::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "answer-records")]
impl std::convert::From<&str> for AnswerRelevance {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ANSWER_RELEVANCE_UNSPECIFIED" => Self::Unspecified,
"IRRELEVANT" => Self::Irrelevant,
"RELEVANT" => Self::Relevant,
_ => Self::UnknownValue(answer_relevance::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "answer-records")]
impl serde::ser::Serialize for AnswerRelevance {
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::Irrelevant => serializer.serialize_i32(1),
Self::Relevant => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "answer-records")]
impl<'de> serde::de::Deserialize<'de> for AnswerRelevance {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AnswerRelevance>::new(
".google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance",
))
}
}
/// Correctness of document.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "answer-records")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DocumentCorrectness {
/// Document correctness unspecified.
Unspecified,
/// Information in document is incorrect.
Incorrect,
/// Information in document is correct.
Correct,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [DocumentCorrectness::value] or
/// [DocumentCorrectness::name].
UnknownValue(document_correctness::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "answer-records")]
pub mod document_correctness {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "answer-records")]
impl DocumentCorrectness {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Incorrect => std::option::Option::Some(1),
Self::Correct => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DOCUMENT_CORRECTNESS_UNSPECIFIED"),
Self::Incorrect => std::option::Option::Some("INCORRECT"),
Self::Correct => std::option::Option::Some("CORRECT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "answer-records")]
impl std::default::Default for DocumentCorrectness {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "answer-records")]
impl std::fmt::Display for DocumentCorrectness {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "answer-records")]
impl std::convert::From<i32> for DocumentCorrectness {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Incorrect,
2 => Self::Correct,
_ => Self::UnknownValue(document_correctness::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "answer-records")]
impl std::convert::From<&str> for DocumentCorrectness {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DOCUMENT_CORRECTNESS_UNSPECIFIED" => Self::Unspecified,
"INCORRECT" => Self::Incorrect,
"CORRECT" => Self::Correct,
_ => Self::UnknownValue(document_correctness::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "answer-records")]
impl serde::ser::Serialize for DocumentCorrectness {
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::Incorrect => serializer.serialize_i32(1),
Self::Correct => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "answer-records")]
impl<'de> serde::de::Deserialize<'de> for DocumentCorrectness {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DocumentCorrectness>::new(
".google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness",
))
}
}
/// Efficiency of document.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "answer-records")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DocumentEfficiency {
/// Document efficiency unspecified.
Unspecified,
/// Document is inefficient.
Inefficient,
/// Document is efficient.
Efficient,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [DocumentEfficiency::value] or
/// [DocumentEfficiency::name].
UnknownValue(document_efficiency::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "answer-records")]
pub mod document_efficiency {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "answer-records")]
impl DocumentEfficiency {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Inefficient => std::option::Option::Some(1),
Self::Efficient => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DOCUMENT_EFFICIENCY_UNSPECIFIED"),
Self::Inefficient => std::option::Option::Some("INEFFICIENT"),
Self::Efficient => std::option::Option::Some("EFFICIENT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "answer-records")]
impl std::default::Default for DocumentEfficiency {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "answer-records")]
impl std::fmt::Display for DocumentEfficiency {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "answer-records")]
impl std::convert::From<i32> for DocumentEfficiency {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Inefficient,
2 => Self::Efficient,
_ => Self::UnknownValue(document_efficiency::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "answer-records")]
impl std::convert::From<&str> for DocumentEfficiency {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DOCUMENT_EFFICIENCY_UNSPECIFIED" => Self::Unspecified,
"INEFFICIENT" => Self::Inefficient,
"EFFICIENT" => Self::Efficient,
_ => Self::UnknownValue(document_efficiency::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "answer-records")]
impl serde::ser::Serialize for DocumentEfficiency {
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::Inefficient => serializer.serialize_i32(1),
Self::Efficient => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "answer-records")]
impl<'de> serde::de::Deserialize<'de> for DocumentEfficiency {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DocumentEfficiency>::new(
".google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency",
))
}
}
}
/// Represents a record of a human agent assist answer.
#[cfg(feature = "answer-records")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AgentAssistantRecord {
/// Output only. The agent assist answer.
pub answer: std::option::Option<crate::model::agent_assistant_record::Answer>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "answer-records")]
impl AgentAssistantRecord {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer][crate::model::AgentAssistantRecord::answer].
///
/// Note that all the setters affecting `answer` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantRecord;
/// use google_cloud_dialogflow_v2::model::ArticleAnswer;
/// let x = AgentAssistantRecord::new().set_answer(Some(
/// google_cloud_dialogflow_v2::model::agent_assistant_record::Answer::ArticleSuggestionAnswer(ArticleAnswer::default().into())));
/// ```
pub fn set_answer<
T: std::convert::Into<std::option::Option<crate::model::agent_assistant_record::Answer>>,
>(
mut self,
v: T,
) -> Self {
self.answer = v.into();
self
}
/// The value of [answer][crate::model::AgentAssistantRecord::answer]
/// if it holds a `ArticleSuggestionAnswer`, `None` if the field is not set or
/// holds a different branch.
pub fn article_suggestion_answer(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ArticleAnswer>> {
#[allow(unreachable_patterns)]
self.answer.as_ref().and_then(|v| match v {
crate::model::agent_assistant_record::Answer::ArticleSuggestionAnswer(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [answer][crate::model::AgentAssistantRecord::answer]
/// to hold a `ArticleSuggestionAnswer`.
///
/// Note that all the setters affecting `answer` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantRecord;
/// use google_cloud_dialogflow_v2::model::ArticleAnswer;
/// let x = AgentAssistantRecord::new().set_article_suggestion_answer(ArticleAnswer::default()/* use setters */);
/// assert!(x.article_suggestion_answer().is_some());
/// assert!(x.faq_answer().is_none());
/// assert!(x.dialogflow_assist_answer().is_none());
/// assert!(x.generator_suggestion().is_none());
/// ```
pub fn set_article_suggestion_answer<
T: std::convert::Into<std::boxed::Box<crate::model::ArticleAnswer>>,
>(
mut self,
v: T,
) -> Self {
self.answer = std::option::Option::Some(
crate::model::agent_assistant_record::Answer::ArticleSuggestionAnswer(v.into()),
);
self
}
/// The value of [answer][crate::model::AgentAssistantRecord::answer]
/// if it holds a `FaqAnswer`, `None` if the field is not set or
/// holds a different branch.
pub fn faq_answer(&self) -> std::option::Option<&std::boxed::Box<crate::model::FaqAnswer>> {
#[allow(unreachable_patterns)]
self.answer.as_ref().and_then(|v| match v {
crate::model::agent_assistant_record::Answer::FaqAnswer(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [answer][crate::model::AgentAssistantRecord::answer]
/// to hold a `FaqAnswer`.
///
/// Note that all the setters affecting `answer` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantRecord;
/// use google_cloud_dialogflow_v2::model::FaqAnswer;
/// let x = AgentAssistantRecord::new().set_faq_answer(FaqAnswer::default()/* use setters */);
/// assert!(x.faq_answer().is_some());
/// assert!(x.article_suggestion_answer().is_none());
/// assert!(x.dialogflow_assist_answer().is_none());
/// assert!(x.generator_suggestion().is_none());
/// ```
pub fn set_faq_answer<T: std::convert::Into<std::boxed::Box<crate::model::FaqAnswer>>>(
mut self,
v: T,
) -> Self {
self.answer = std::option::Option::Some(
crate::model::agent_assistant_record::Answer::FaqAnswer(v.into()),
);
self
}
/// The value of [answer][crate::model::AgentAssistantRecord::answer]
/// if it holds a `DialogflowAssistAnswer`, `None` if the field is not set or
/// holds a different branch.
pub fn dialogflow_assist_answer(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::DialogflowAssistAnswer>> {
#[allow(unreachable_patterns)]
self.answer.as_ref().and_then(|v| match v {
crate::model::agent_assistant_record::Answer::DialogflowAssistAnswer(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [answer][crate::model::AgentAssistantRecord::answer]
/// to hold a `DialogflowAssistAnswer`.
///
/// Note that all the setters affecting `answer` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantRecord;
/// use google_cloud_dialogflow_v2::model::DialogflowAssistAnswer;
/// let x = AgentAssistantRecord::new().set_dialogflow_assist_answer(DialogflowAssistAnswer::default()/* use setters */);
/// assert!(x.dialogflow_assist_answer().is_some());
/// assert!(x.article_suggestion_answer().is_none());
/// assert!(x.faq_answer().is_none());
/// assert!(x.generator_suggestion().is_none());
/// ```
pub fn set_dialogflow_assist_answer<
T: std::convert::Into<std::boxed::Box<crate::model::DialogflowAssistAnswer>>,
>(
mut self,
v: T,
) -> Self {
self.answer = std::option::Option::Some(
crate::model::agent_assistant_record::Answer::DialogflowAssistAnswer(v.into()),
);
self
}
/// The value of [answer][crate::model::AgentAssistantRecord::answer]
/// if it holds a `GeneratorSuggestion`, `None` if the field is not set or
/// holds a different branch.
pub fn generator_suggestion(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::GeneratorSuggestion>> {
#[allow(unreachable_patterns)]
self.answer.as_ref().and_then(|v| match v {
crate::model::agent_assistant_record::Answer::GeneratorSuggestion(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [answer][crate::model::AgentAssistantRecord::answer]
/// to hold a `GeneratorSuggestion`.
///
/// Note that all the setters affecting `answer` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentAssistantRecord;
/// use google_cloud_dialogflow_v2::model::GeneratorSuggestion;
/// let x = AgentAssistantRecord::new().set_generator_suggestion(GeneratorSuggestion::default()/* use setters */);
/// assert!(x.generator_suggestion().is_some());
/// assert!(x.article_suggestion_answer().is_none());
/// assert!(x.faq_answer().is_none());
/// assert!(x.dialogflow_assist_answer().is_none());
/// ```
pub fn set_generator_suggestion<
T: std::convert::Into<std::boxed::Box<crate::model::GeneratorSuggestion>>,
>(
mut self,
v: T,
) -> Self {
self.answer = std::option::Option::Some(
crate::model::agent_assistant_record::Answer::GeneratorSuggestion(v.into()),
);
self
}
}
#[cfg(feature = "answer-records")]
impl wkt::message::Message for AgentAssistantRecord {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentAssistantRecord"
}
}
/// Defines additional types related to [AgentAssistantRecord].
#[cfg(feature = "answer-records")]
pub mod agent_assistant_record {
#[allow(unused_imports)]
use super::*;
/// Output only. The agent assist answer.
#[cfg(feature = "answer-records")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Answer {
/// Output only. The article suggestion answer.
ArticleSuggestionAnswer(std::boxed::Box<crate::model::ArticleAnswer>),
/// Output only. The FAQ answer.
FaqAnswer(std::boxed::Box<crate::model::FaqAnswer>),
/// Output only. Dialogflow assist answer.
DialogflowAssistAnswer(std::boxed::Box<crate::model::DialogflowAssistAnswer>),
/// Output only. The generator suggestion.
GeneratorSuggestion(std::boxed::Box<crate::model::GeneratorSuggestion>),
}
}
/// Hints for the speech recognizer to help with recognition in a specific
/// conversation state.
#[cfg(any(feature = "participants", feature = "sessions",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SpeechContext {
/// Optional. A list of strings containing words and phrases that the speech
/// recognizer should recognize with higher likelihood.
///
/// This list can be used to:
///
/// * improve accuracy for words and phrases you expect the user to say,
/// e.g. typical commands for your Dialogflow agent
/// * add additional words to the speech recognizer vocabulary
/// * ...
///
/// See the [Cloud Speech
/// documentation](https://cloud.google.com/speech-to-text/quotas) for usage
/// limits.
pub phrases: std::vec::Vec<std::string::String>,
/// Optional. Boost for this context compared to other contexts:
///
/// * If the boost is positive, Dialogflow will increase the probability that
/// the phrases in this context are recognized over similar sounding phrases.
/// * If the boost is unspecified or non-positive, Dialogflow will not apply
/// any boost.
///
/// Dialogflow recommends that you use boosts in the range (0, 20] and that you
/// find a value that fits your use case with binary search.
pub boost: f32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl SpeechContext {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [phrases][crate::model::SpeechContext::phrases].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechContext;
/// let x = SpeechContext::new().set_phrases(["a", "b", "c"]);
/// ```
pub fn set_phrases<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.phrases = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [boost][crate::model::SpeechContext::boost].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechContext;
/// let x = SpeechContext::new().set_boost(42.0);
/// ```
pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.boost = v.into();
self
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl wkt::message::Message for SpeechContext {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SpeechContext"
}
}
/// Information for a word recognized by the speech recognizer.
#[cfg(any(feature = "participants", feature = "sessions",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SpeechWordInfo {
/// The word this info is for.
pub word: std::string::String,
/// Time offset relative to the beginning of the audio that corresponds to the
/// start of the spoken word. This is an experimental feature and the accuracy
/// of the time offset can vary.
pub start_offset: std::option::Option<wkt::Duration>,
/// Time offset relative to the beginning of the audio that corresponds to the
/// end of the spoken word. This is an experimental feature and the accuracy of
/// the time offset can vary.
pub end_offset: std::option::Option<wkt::Duration>,
/// The Speech confidence between 0.0 and 1.0 for this word. A higher number
/// indicates an estimated greater likelihood that the recognized word is
/// correct. The default of 0.0 is a sentinel value indicating that confidence
/// was not set.
///
/// This field is not guaranteed to be fully stable over time for the same
/// audio input. Users should also not rely on it to always be provided.
pub confidence: f32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl SpeechWordInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [word][crate::model::SpeechWordInfo::word].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechWordInfo;
/// let x = SpeechWordInfo::new().set_word("example");
/// ```
pub fn set_word<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.word = v.into();
self
}
/// Sets the value of [start_offset][crate::model::SpeechWordInfo::start_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechWordInfo;
/// use wkt::Duration;
/// let x = SpeechWordInfo::new().set_start_offset(Duration::default()/* use setters */);
/// ```
pub fn set_start_offset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.start_offset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [start_offset][crate::model::SpeechWordInfo::start_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechWordInfo;
/// use wkt::Duration;
/// let x = SpeechWordInfo::new().set_or_clear_start_offset(Some(Duration::default()/* use setters */));
/// let x = SpeechWordInfo::new().set_or_clear_start_offset(None::<Duration>);
/// ```
pub fn set_or_clear_start_offset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.start_offset = v.map(|x| x.into());
self
}
/// Sets the value of [end_offset][crate::model::SpeechWordInfo::end_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechWordInfo;
/// use wkt::Duration;
/// let x = SpeechWordInfo::new().set_end_offset(Duration::default()/* use setters */);
/// ```
pub fn set_end_offset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.end_offset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [end_offset][crate::model::SpeechWordInfo::end_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechWordInfo;
/// use wkt::Duration;
/// let x = SpeechWordInfo::new().set_or_clear_end_offset(Some(Duration::default()/* use setters */));
/// let x = SpeechWordInfo::new().set_or_clear_end_offset(None::<Duration>);
/// ```
pub fn set_or_clear_end_offset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.end_offset = v.map(|x| x.into());
self
}
/// Sets the value of [confidence][crate::model::SpeechWordInfo::confidence].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechWordInfo;
/// let x = SpeechWordInfo::new().set_confidence(42.0);
/// ```
pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.confidence = v.into();
self
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl wkt::message::Message for SpeechWordInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SpeechWordInfo"
}
}
/// Instructs the speech recognizer how to process the audio content.
#[cfg(any(feature = "participants", feature = "sessions",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InputAudioConfig {
/// Required. Audio encoding of the audio content to process.
pub audio_encoding: crate::model::AudioEncoding,
/// Required. Sample rate (in Hertz) of the audio content sent in the query.
/// Refer to [Cloud Speech API
/// documentation](https://cloud.google.com/speech-to-text/docs/basics) for
/// more details.
pub sample_rate_hertz: i32,
/// Required. The language of the supplied audio. Dialogflow does not do
/// translations. See [Language
/// Support](https://cloud.google.com/dialogflow/docs/reference/language)
/// for a list of the currently supported language codes. Note that queries in
/// the same session do not necessarily need to specify the same language.
/// If not set, the language is inferred from the
/// [ConversationProfile.stt_config][google.cloud.dialogflow.v2.ConversationProfile.stt_config].
///
/// [google.cloud.dialogflow.v2.ConversationProfile.stt_config]: crate::model::ConversationProfile::stt_config
pub language_code: std::string::String,
/// If `true`, Dialogflow returns
/// [SpeechWordInfo][google.cloud.dialogflow.v2.SpeechWordInfo] in
/// [StreamingRecognitionResult][google.cloud.dialogflow.v2.StreamingRecognitionResult]
/// with information about the recognized speech words, e.g. start and end time
/// offsets. If false or unspecified, Speech doesn't return any word-level
/// information.
///
/// [google.cloud.dialogflow.v2.SpeechWordInfo]: crate::model::SpeechWordInfo
/// [google.cloud.dialogflow.v2.StreamingRecognitionResult]: crate::model::StreamingRecognitionResult
pub enable_word_info: bool,
/// A list of strings containing words and phrases that the speech
/// recognizer should recognize with higher likelihood.
///
/// See [the Cloud Speech
/// documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints)
/// for more details.
///
/// This field is deprecated. Please use [`speech_contexts`]() instead. If you
/// specify both [`phrase_hints`]() and [`speech_contexts`](), Dialogflow will
/// treat the [`phrase_hints`]() as a single additional [`SpeechContext`]().
#[deprecated]
pub phrase_hints: std::vec::Vec<std::string::String>,
/// Context information to assist speech recognition.
///
/// See [the Cloud Speech
/// documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints)
/// for more details.
pub speech_contexts: std::vec::Vec<crate::model::SpeechContext>,
/// Optional. Which Speech model to select for the given request.
/// For more information, see
/// [Speech models](https://cloud.google.com/dialogflow/es/docs/speech-models).
pub model: std::string::String,
/// Which variant of the [Speech
/// model][google.cloud.dialogflow.v2.InputAudioConfig.model] to use.
///
/// [google.cloud.dialogflow.v2.InputAudioConfig.model]: crate::model::InputAudioConfig::model
pub model_variant: crate::model::SpeechModelVariant,
/// If `false` (default), recognition does not cease until the
/// client closes the stream.
/// If `true`, the recognizer will detect a single spoken utterance in input
/// audio. Recognition ceases when it detects the audio's voice has
/// stopped or paused. In this case, once a detected intent is received, the
/// client should close the stream and start a new request with a new stream as
/// needed.
/// Note: This setting is relevant only for streaming methods.
/// Note: When specified, InputAudioConfig.single_utterance takes precedence
/// over StreamingDetectIntentRequest.single_utterance.
pub single_utterance: bool,
/// Only used in
/// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]
/// and
/// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent].
/// If `false` and recognition doesn't return any result, trigger
/// `NO_SPEECH_RECOGNIZED` event to Dialogflow agent.
///
/// [google.cloud.dialogflow.v2.Participants.AnalyzeContent]: crate::client::Participants::analyze_content
pub disable_no_speech_recognized_event: bool,
/// Enable automatic punctuation option at the speech backend.
pub enable_automatic_punctuation: bool,
/// A collection of phrase set resources to use for speech adaptation.
pub phrase_sets: std::vec::Vec<std::string::String>,
/// If `true`, the request will opt out for STT conformer model migration.
/// This field will be deprecated once force migration takes place in June
/// 2024. Please refer to [Dialogflow ES Speech model
/// migration](https://cloud.google.com/dialogflow/es/docs/speech-model-migration).
pub opt_out_conformer_model_migration: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl InputAudioConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [audio_encoding][crate::model::InputAudioConfig::audio_encoding].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// use google_cloud_dialogflow_v2::model::AudioEncoding;
/// let x0 = InputAudioConfig::new().set_audio_encoding(AudioEncoding::Linear16);
/// let x1 = InputAudioConfig::new().set_audio_encoding(AudioEncoding::Flac);
/// let x2 = InputAudioConfig::new().set_audio_encoding(AudioEncoding::Mulaw);
/// ```
pub fn set_audio_encoding<T: std::convert::Into<crate::model::AudioEncoding>>(
mut self,
v: T,
) -> Self {
self.audio_encoding = v.into();
self
}
/// Sets the value of [sample_rate_hertz][crate::model::InputAudioConfig::sample_rate_hertz].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = InputAudioConfig::new().set_sample_rate_hertz(42);
/// ```
pub fn set_sample_rate_hertz<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.sample_rate_hertz = v.into();
self
}
/// Sets the value of [language_code][crate::model::InputAudioConfig::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = InputAudioConfig::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [enable_word_info][crate::model::InputAudioConfig::enable_word_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = InputAudioConfig::new().set_enable_word_info(true);
/// ```
pub fn set_enable_word_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_word_info = v.into();
self
}
/// Sets the value of [phrase_hints][crate::model::InputAudioConfig::phrase_hints].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = InputAudioConfig::new().set_phrase_hints(["a", "b", "c"]);
/// ```
#[deprecated]
pub fn set_phrase_hints<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.phrase_hints = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [speech_contexts][crate::model::InputAudioConfig::speech_contexts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// use google_cloud_dialogflow_v2::model::SpeechContext;
/// let x = InputAudioConfig::new()
/// .set_speech_contexts([
/// SpeechContext::default()/* use setters */,
/// SpeechContext::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_speech_contexts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SpeechContext>,
{
use std::iter::Iterator;
self.speech_contexts = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [model][crate::model::InputAudioConfig::model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = InputAudioConfig::new().set_model("example");
/// ```
pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.model = v.into();
self
}
/// Sets the value of [model_variant][crate::model::InputAudioConfig::model_variant].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// use google_cloud_dialogflow_v2::model::SpeechModelVariant;
/// let x0 = InputAudioConfig::new().set_model_variant(SpeechModelVariant::UseBestAvailable);
/// let x1 = InputAudioConfig::new().set_model_variant(SpeechModelVariant::UseStandard);
/// let x2 = InputAudioConfig::new().set_model_variant(SpeechModelVariant::UseEnhanced);
/// ```
pub fn set_model_variant<T: std::convert::Into<crate::model::SpeechModelVariant>>(
mut self,
v: T,
) -> Self {
self.model_variant = v.into();
self
}
/// Sets the value of [single_utterance][crate::model::InputAudioConfig::single_utterance].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = InputAudioConfig::new().set_single_utterance(true);
/// ```
pub fn set_single_utterance<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.single_utterance = v.into();
self
}
/// Sets the value of [disable_no_speech_recognized_event][crate::model::InputAudioConfig::disable_no_speech_recognized_event].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = InputAudioConfig::new().set_disable_no_speech_recognized_event(true);
/// ```
pub fn set_disable_no_speech_recognized_event<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.disable_no_speech_recognized_event = v.into();
self
}
/// Sets the value of [enable_automatic_punctuation][crate::model::InputAudioConfig::enable_automatic_punctuation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = InputAudioConfig::new().set_enable_automatic_punctuation(true);
/// ```
pub fn set_enable_automatic_punctuation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_automatic_punctuation = v.into();
self
}
/// Sets the value of [phrase_sets][crate::model::InputAudioConfig::phrase_sets].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = InputAudioConfig::new().set_phrase_sets(["a", "b", "c"]);
/// ```
pub fn set_phrase_sets<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.phrase_sets = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [opt_out_conformer_model_migration][crate::model::InputAudioConfig::opt_out_conformer_model_migration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = InputAudioConfig::new().set_opt_out_conformer_model_migration(true);
/// ```
pub fn set_opt_out_conformer_model_migration<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.opt_out_conformer_model_migration = v.into();
self
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl wkt::message::Message for InputAudioConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.InputAudioConfig"
}
}
/// Description of which voice to use for speech synthesis.
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VoiceSelectionParams {
/// Optional. The name of the voice. If not set, the service will choose a
/// voice based on the other parameters such as language_code and
/// [ssml_gender][google.cloud.dialogflow.v2.VoiceSelectionParams.ssml_gender].
///
/// [google.cloud.dialogflow.v2.VoiceSelectionParams.ssml_gender]: crate::model::VoiceSelectionParams::ssml_gender
pub name: std::string::String,
/// Optional. The preferred gender of the voice. If not set, the service will
/// choose a voice based on the other parameters such as language_code and
/// [name][google.cloud.dialogflow.v2.VoiceSelectionParams.name]. Note that
/// this is only a preference, not requirement. If a voice of the appropriate
/// gender is not available, the synthesizer should substitute a voice with a
/// different gender rather than failing the request.
///
/// [google.cloud.dialogflow.v2.VoiceSelectionParams.name]: crate::model::VoiceSelectionParams::name
pub ssml_gender: crate::model::SsmlVoiceGender,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl VoiceSelectionParams {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::VoiceSelectionParams::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::VoiceSelectionParams;
/// let x = VoiceSelectionParams::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [ssml_gender][crate::model::VoiceSelectionParams::ssml_gender].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::VoiceSelectionParams;
/// use google_cloud_dialogflow_v2::model::SsmlVoiceGender;
/// let x0 = VoiceSelectionParams::new().set_ssml_gender(SsmlVoiceGender::Male);
/// let x1 = VoiceSelectionParams::new().set_ssml_gender(SsmlVoiceGender::Female);
/// let x2 = VoiceSelectionParams::new().set_ssml_gender(SsmlVoiceGender::Neutral);
/// ```
pub fn set_ssml_gender<T: std::convert::Into<crate::model::SsmlVoiceGender>>(
mut self,
v: T,
) -> Self {
self.ssml_gender = v.into();
self
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for VoiceSelectionParams {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.VoiceSelectionParams"
}
}
/// Configuration of how speech should be synthesized.
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SynthesizeSpeechConfig {
/// Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal
/// native speed supported by the specific voice. 2.0 is twice as fast, and 0.5
/// is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any other
/// values < 0.25 or > 4.0 will return an error.
pub speaking_rate: f64,
/// Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20
/// semitones from the original pitch. -20 means decrease 20 semitones from the
/// original pitch.
pub pitch: f64,
/// Optional. Volume gain (in dB) of the normal native volume supported by the
/// specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of
/// 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB)
/// will play at approximately half the amplitude of the normal native signal
/// amplitude. A value of +6.0 (dB) will play at approximately twice the
/// amplitude of the normal native signal amplitude. We strongly recommend not
/// to exceed +10 (dB) as there's usually no effective increase in loudness for
/// any value greater than that.
pub volume_gain_db: f64,
/// Optional. An identifier which selects 'audio effects' profiles that are
/// applied on (post synthesized) text to speech. Effects are applied on top of
/// each other in the order they are given.
pub effects_profile_id: std::vec::Vec<std::string::String>,
/// Optional. The desired voice of the synthesized audio.
pub voice: std::option::Option<crate::model::VoiceSelectionParams>,
/// Optional. The custom pronunciations for the synthesized audio.
pub pronunciations: std::vec::Vec<crate::model::CustomPronunciationParams>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl SynthesizeSpeechConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [speaking_rate][crate::model::SynthesizeSpeechConfig::speaking_rate].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SynthesizeSpeechConfig;
/// let x = SynthesizeSpeechConfig::new().set_speaking_rate(42.0);
/// ```
pub fn set_speaking_rate<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.speaking_rate = v.into();
self
}
/// Sets the value of [pitch][crate::model::SynthesizeSpeechConfig::pitch].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SynthesizeSpeechConfig;
/// let x = SynthesizeSpeechConfig::new().set_pitch(42.0);
/// ```
pub fn set_pitch<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.pitch = v.into();
self
}
/// Sets the value of [volume_gain_db][crate::model::SynthesizeSpeechConfig::volume_gain_db].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SynthesizeSpeechConfig;
/// let x = SynthesizeSpeechConfig::new().set_volume_gain_db(42.0);
/// ```
pub fn set_volume_gain_db<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.volume_gain_db = v.into();
self
}
/// Sets the value of [effects_profile_id][crate::model::SynthesizeSpeechConfig::effects_profile_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SynthesizeSpeechConfig;
/// let x = SynthesizeSpeechConfig::new().set_effects_profile_id(["a", "b", "c"]);
/// ```
pub fn set_effects_profile_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.effects_profile_id = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [voice][crate::model::SynthesizeSpeechConfig::voice].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SynthesizeSpeechConfig;
/// use google_cloud_dialogflow_v2::model::VoiceSelectionParams;
/// let x = SynthesizeSpeechConfig::new().set_voice(VoiceSelectionParams::default()/* use setters */);
/// ```
pub fn set_voice<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::VoiceSelectionParams>,
{
self.voice = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [voice][crate::model::SynthesizeSpeechConfig::voice].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SynthesizeSpeechConfig;
/// use google_cloud_dialogflow_v2::model::VoiceSelectionParams;
/// let x = SynthesizeSpeechConfig::new().set_or_clear_voice(Some(VoiceSelectionParams::default()/* use setters */));
/// let x = SynthesizeSpeechConfig::new().set_or_clear_voice(None::<VoiceSelectionParams>);
/// ```
pub fn set_or_clear_voice<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::VoiceSelectionParams>,
{
self.voice = v.map(|x| x.into());
self
}
/// Sets the value of [pronunciations][crate::model::SynthesizeSpeechConfig::pronunciations].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SynthesizeSpeechConfig;
/// use google_cloud_dialogflow_v2::model::CustomPronunciationParams;
/// let x = SynthesizeSpeechConfig::new()
/// .set_pronunciations([
/// CustomPronunciationParams::default()/* use setters */,
/// CustomPronunciationParams::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_pronunciations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::CustomPronunciationParams>,
{
use std::iter::Iterator;
self.pronunciations = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for SynthesizeSpeechConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SynthesizeSpeechConfig"
}
}
/// Pronunciation customization for a phrase.
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CustomPronunciationParams {
/// The phrase to which the customization is applied.
/// The phrase can be multiple words, such as proper nouns, but shouldn't span
/// the length of the sentence.
pub phrase: std::string::String,
/// The phonetic encoding of the phrase.
pub phonetic_encoding: crate::model::custom_pronunciation_params::PhoneticEncoding,
/// The pronunciation of the phrase. This must be in the phonetic encoding
/// specified above.
pub pronunciation: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl CustomPronunciationParams {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [phrase][crate::model::CustomPronunciationParams::phrase].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CustomPronunciationParams;
/// let x = CustomPronunciationParams::new().set_phrase("example");
/// ```
pub fn set_phrase<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.phrase = v.into();
self
}
/// Sets the value of [phonetic_encoding][crate::model::CustomPronunciationParams::phonetic_encoding].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CustomPronunciationParams;
/// use google_cloud_dialogflow_v2::model::custom_pronunciation_params::PhoneticEncoding;
/// let x0 = CustomPronunciationParams::new().set_phonetic_encoding(PhoneticEncoding::Ipa);
/// let x1 = CustomPronunciationParams::new().set_phonetic_encoding(PhoneticEncoding::XSampa);
/// ```
pub fn set_phonetic_encoding<
T: std::convert::Into<crate::model::custom_pronunciation_params::PhoneticEncoding>,
>(
mut self,
v: T,
) -> Self {
self.phonetic_encoding = v.into();
self
}
/// Sets the value of [pronunciation][crate::model::CustomPronunciationParams::pronunciation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CustomPronunciationParams;
/// let x = CustomPronunciationParams::new().set_pronunciation("example");
/// ```
pub fn set_pronunciation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.pronunciation = v.into();
self
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for CustomPronunciationParams {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CustomPronunciationParams"
}
}
/// Defines additional types related to [CustomPronunciationParams].
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
pub mod custom_pronunciation_params {
#[allow(unused_imports)]
use super::*;
/// The phonetic encoding of the phrase.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum PhoneticEncoding {
/// Not specified.
Unspecified,
/// IPA, such as apple -> ˈæpəl.
/// <https://en.wikipedia.org/wiki/International_Phonetic_Alphabet>
Ipa,
/// X-SAMPA, such as apple -> "{p@l".
/// <https://en.wikipedia.org/wiki/X-SAMPA>
XSampa,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [PhoneticEncoding::value] or
/// [PhoneticEncoding::name].
UnknownValue(phonetic_encoding::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
pub mod phonetic_encoding {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl PhoneticEncoding {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Ipa => std::option::Option::Some(1),
Self::XSampa => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("PHONETIC_ENCODING_UNSPECIFIED"),
Self::Ipa => std::option::Option::Some("PHONETIC_ENCODING_IPA"),
Self::XSampa => std::option::Option::Some("PHONETIC_ENCODING_X_SAMPA"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl std::default::Default for PhoneticEncoding {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl std::fmt::Display for PhoneticEncoding {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<i32> for PhoneticEncoding {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Ipa,
2 => Self::XSampa,
_ => Self::UnknownValue(phonetic_encoding::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<&str> for PhoneticEncoding {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"PHONETIC_ENCODING_UNSPECIFIED" => Self::Unspecified,
"PHONETIC_ENCODING_IPA" => Self::Ipa,
"PHONETIC_ENCODING_X_SAMPA" => Self::XSampa,
_ => Self::UnknownValue(phonetic_encoding::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl serde::ser::Serialize for PhoneticEncoding {
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::Ipa => serializer.serialize_i32(1),
Self::XSampa => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for PhoneticEncoding {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<PhoneticEncoding>::new(
".google.cloud.dialogflow.v2.CustomPronunciationParams.PhoneticEncoding",
))
}
}
}
/// Instructs the speech synthesizer on how to generate the output audio content.
/// If this audio config is supplied in a request, it overrides all existing
/// text-to-speech settings applied to the agent.
#[cfg(any(feature = "participants", feature = "sessions",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OutputAudioConfig {
/// Required. Audio encoding of the synthesized audio content.
pub audio_encoding: crate::model::OutputAudioEncoding,
/// The synthesis sample rate (in hertz) for this audio. If not
/// provided, then the synthesizer will use the default sample rate based on
/// the audio encoding. If this is different from the voice's natural sample
/// rate, then the synthesizer will honor this request by converting to the
/// desired sample rate (which might result in worse audio quality).
pub sample_rate_hertz: i32,
/// Configuration of how speech should be synthesized.
pub synthesize_speech_config: std::option::Option<crate::model::SynthesizeSpeechConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl OutputAudioConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [audio_encoding][crate::model::OutputAudioConfig::audio_encoding].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// use google_cloud_dialogflow_v2::model::OutputAudioEncoding;
/// let x0 = OutputAudioConfig::new().set_audio_encoding(OutputAudioEncoding::Linear16);
/// let x1 = OutputAudioConfig::new().set_audio_encoding(OutputAudioEncoding::Mp3);
/// let x2 = OutputAudioConfig::new().set_audio_encoding(OutputAudioEncoding::Mp364Kbps);
/// ```
pub fn set_audio_encoding<T: std::convert::Into<crate::model::OutputAudioEncoding>>(
mut self,
v: T,
) -> Self {
self.audio_encoding = v.into();
self
}
/// Sets the value of [sample_rate_hertz][crate::model::OutputAudioConfig::sample_rate_hertz].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = OutputAudioConfig::new().set_sample_rate_hertz(42);
/// ```
pub fn set_sample_rate_hertz<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.sample_rate_hertz = v.into();
self
}
/// Sets the value of [synthesize_speech_config][crate::model::OutputAudioConfig::synthesize_speech_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// use google_cloud_dialogflow_v2::model::SynthesizeSpeechConfig;
/// let x = OutputAudioConfig::new().set_synthesize_speech_config(SynthesizeSpeechConfig::default()/* use setters */);
/// ```
pub fn set_synthesize_speech_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SynthesizeSpeechConfig>,
{
self.synthesize_speech_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [synthesize_speech_config][crate::model::OutputAudioConfig::synthesize_speech_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// use google_cloud_dialogflow_v2::model::SynthesizeSpeechConfig;
/// let x = OutputAudioConfig::new().set_or_clear_synthesize_speech_config(Some(SynthesizeSpeechConfig::default()/* use setters */));
/// let x = OutputAudioConfig::new().set_or_clear_synthesize_speech_config(None::<SynthesizeSpeechConfig>);
/// ```
pub fn set_or_clear_synthesize_speech_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SynthesizeSpeechConfig>,
{
self.synthesize_speech_config = v.map(|x| x.into());
self
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl wkt::message::Message for OutputAudioConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.OutputAudioConfig"
}
}
/// A wrapper of repeated TelephonyDtmf digits.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TelephonyDtmfEvents {
/// A sequence of TelephonyDtmf digits.
pub dtmf_events: std::vec::Vec<crate::model::TelephonyDtmf>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl TelephonyDtmfEvents {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [dtmf_events][crate::model::TelephonyDtmfEvents::dtmf_events].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::TelephonyDtmfEvents;
/// use google_cloud_dialogflow_v2::model::TelephonyDtmf;
/// let x = TelephonyDtmfEvents::new().set_dtmf_events([
/// TelephonyDtmf::DtmfOne,
/// TelephonyDtmf::DtmfTwo,
/// TelephonyDtmf::DtmfThree,
/// ]);
/// ```
pub fn set_dtmf_events<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::TelephonyDtmf>,
{
use std::iter::Iterator;
self.dtmf_events = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for TelephonyDtmfEvents {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.TelephonyDtmfEvents"
}
}
/// Configures speech transcription for
/// [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile].
///
/// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SpeechToTextConfig {
/// The speech model used in speech to text.
/// `SPEECH_MODEL_VARIANT_UNSPECIFIED`, `USE_BEST_AVAILABLE` will be treated as
/// `USE_ENHANCED`. It can be overridden in
/// [AnalyzeContentRequest][google.cloud.dialogflow.v2.AnalyzeContentRequest]
/// and
/// [StreamingAnalyzeContentRequest][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest]
/// request. If enhanced model variant is specified and an enhanced version of
/// the specified model for the language does not exist, then it would emit an
/// error.
///
/// [google.cloud.dialogflow.v2.AnalyzeContentRequest]: crate::model::AnalyzeContentRequest
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest]: crate::model::StreamingAnalyzeContentRequest
pub speech_model_variant: crate::model::SpeechModelVariant,
/// Which Speech model to select. Select the
/// model best suited to your domain to get best results. If a model is not
/// explicitly specified, then Dialogflow auto-selects a model based on other
/// parameters in the SpeechToTextConfig and Agent settings.
/// If enhanced speech model is enabled for the agent and an enhanced
/// version of the specified model for the language does not exist, then the
/// speech is recognized using the standard version of the specified model.
/// Refer to
/// [Cloud Speech API
/// documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model)
/// for more details.
/// If you specify a model, the following models typically have the best
/// performance:
///
/// - phone_call (best for Agent Assist and telephony)
/// - latest_short (best for Dialogflow non-telephony)
/// - command_and_search
///
/// Leave this field unspecified to use
/// [Agent Speech
/// settings](https://cloud.google.com/dialogflow/cx/docs/concept/agent#settings-speech)
/// for model selection.
pub model: std::string::String,
/// List of names of Cloud Speech phrase sets that are used for transcription.
/// For phrase set limitations, please refer to [Cloud Speech API quotas and
/// limits](https://cloud.google.com/speech-to-text/quotas#content).
pub phrase_sets: std::vec::Vec<std::string::String>,
/// Audio encoding of the audio content to process.
pub audio_encoding: crate::model::AudioEncoding,
/// Sample rate (in Hertz) of the audio content sent in the query.
/// Refer to [Cloud Speech API
/// documentation](https://cloud.google.com/speech-to-text/docs/basics) for
/// more details.
pub sample_rate_hertz: i32,
/// The language of the supplied audio. Dialogflow does not do
/// translations. See [Language
/// Support](https://cloud.google.com/dialogflow/docs/reference/language)
/// for a list of the currently supported language codes. Note that queries in
/// the same session do not necessarily need to specify the same language.
/// If not specified, the default language configured at
/// [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile] is
/// used.
///
/// [google.cloud.dialogflow.v2.ConversationProfile]: crate::model::ConversationProfile
pub language_code: std::string::String,
/// If `true`, Dialogflow returns
/// [SpeechWordInfo][google.cloud.dialogflow.v2.SpeechWordInfo] in
/// [StreamingRecognitionResult][google.cloud.dialogflow.v2.StreamingRecognitionResult]
/// with information about the recognized speech words, e.g. start and end time
/// offsets. If false or unspecified, Speech doesn't return any word-level
/// information.
///
/// [google.cloud.dialogflow.v2.SpeechWordInfo]: crate::model::SpeechWordInfo
/// [google.cloud.dialogflow.v2.StreamingRecognitionResult]: crate::model::StreamingRecognitionResult
pub enable_word_info: bool,
/// Use timeout based endpointing, interpreting endpointer sensitivity as
/// seconds of timeout value.
pub use_timeout_based_endpointing: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl SpeechToTextConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [speech_model_variant][crate::model::SpeechToTextConfig::speech_model_variant].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechToTextConfig;
/// use google_cloud_dialogflow_v2::model::SpeechModelVariant;
/// let x0 = SpeechToTextConfig::new().set_speech_model_variant(SpeechModelVariant::UseBestAvailable);
/// let x1 = SpeechToTextConfig::new().set_speech_model_variant(SpeechModelVariant::UseStandard);
/// let x2 = SpeechToTextConfig::new().set_speech_model_variant(SpeechModelVariant::UseEnhanced);
/// ```
pub fn set_speech_model_variant<T: std::convert::Into<crate::model::SpeechModelVariant>>(
mut self,
v: T,
) -> Self {
self.speech_model_variant = v.into();
self
}
/// Sets the value of [model][crate::model::SpeechToTextConfig::model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechToTextConfig;
/// let x = SpeechToTextConfig::new().set_model("example");
/// ```
pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.model = v.into();
self
}
/// Sets the value of [phrase_sets][crate::model::SpeechToTextConfig::phrase_sets].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechToTextConfig;
/// let x = SpeechToTextConfig::new().set_phrase_sets(["a", "b", "c"]);
/// ```
pub fn set_phrase_sets<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.phrase_sets = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [audio_encoding][crate::model::SpeechToTextConfig::audio_encoding].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechToTextConfig;
/// use google_cloud_dialogflow_v2::model::AudioEncoding;
/// let x0 = SpeechToTextConfig::new().set_audio_encoding(AudioEncoding::Linear16);
/// let x1 = SpeechToTextConfig::new().set_audio_encoding(AudioEncoding::Flac);
/// let x2 = SpeechToTextConfig::new().set_audio_encoding(AudioEncoding::Mulaw);
/// ```
pub fn set_audio_encoding<T: std::convert::Into<crate::model::AudioEncoding>>(
mut self,
v: T,
) -> Self {
self.audio_encoding = v.into();
self
}
/// Sets the value of [sample_rate_hertz][crate::model::SpeechToTextConfig::sample_rate_hertz].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechToTextConfig;
/// let x = SpeechToTextConfig::new().set_sample_rate_hertz(42);
/// ```
pub fn set_sample_rate_hertz<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.sample_rate_hertz = v.into();
self
}
/// Sets the value of [language_code][crate::model::SpeechToTextConfig::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechToTextConfig;
/// let x = SpeechToTextConfig::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [enable_word_info][crate::model::SpeechToTextConfig::enable_word_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechToTextConfig;
/// let x = SpeechToTextConfig::new().set_enable_word_info(true);
/// ```
pub fn set_enable_word_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_word_info = v.into();
self
}
/// Sets the value of [use_timeout_based_endpointing][crate::model::SpeechToTextConfig::use_timeout_based_endpointing].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SpeechToTextConfig;
/// let x = SpeechToTextConfig::new().set_use_timeout_based_endpointing(true);
/// ```
pub fn set_use_timeout_based_endpointing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.use_timeout_based_endpointing = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for SpeechToTextConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SpeechToTextConfig"
}
}
/// Spec of CES app that the generator can choose from.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CesAppSpec {
/// Optional. Format: `projects/<Project ID>/locations/<Location ID>/apps/<app
/// ID>`.
pub ces_app: std::string::String,
/// Optional. Indicates whether the app requires human confirmation.
pub confirmation_requirement: crate::model::tool::ConfirmationRequirement,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl CesAppSpec {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [ces_app][crate::model::CesAppSpec::ces_app].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CesAppSpec;
/// let x = CesAppSpec::new().set_ces_app("example");
/// ```
pub fn set_ces_app<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.ces_app = v.into();
self
}
/// Sets the value of [confirmation_requirement][crate::model::CesAppSpec::confirmation_requirement].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CesAppSpec;
/// use google_cloud_dialogflow_v2::model::tool::ConfirmationRequirement;
/// let x0 = CesAppSpec::new().set_confirmation_requirement(ConfirmationRequirement::Required);
/// let x1 = CesAppSpec::new().set_confirmation_requirement(ConfirmationRequirement::NotRequired);
/// ```
pub fn set_confirmation_requirement<
T: std::convert::Into<crate::model::tool::ConfirmationRequirement>,
>(
mut self,
v: T,
) -> Self {
self.confirmation_requirement = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for CesAppSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CesAppSpec"
}
}
/// Spec of CES tool that the generator can choose from.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CesToolSpec {
/// Optional. Format: `projects/<Project ID>/locations/<Location ID>/apps/<app
/// ID>/tools/<tool ID>`.
pub ces_tool: std::string::String,
/// Optional. Indicates whether the tool requires human confirmation.
pub confirmation_requirement: crate::model::tool::ConfirmationRequirement,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl CesToolSpec {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [ces_tool][crate::model::CesToolSpec::ces_tool].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CesToolSpec;
/// let x = CesToolSpec::new().set_ces_tool("example");
/// ```
pub fn set_ces_tool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.ces_tool = v.into();
self
}
/// Sets the value of [confirmation_requirement][crate::model::CesToolSpec::confirmation_requirement].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CesToolSpec;
/// use google_cloud_dialogflow_v2::model::tool::ConfirmationRequirement;
/// let x0 = CesToolSpec::new().set_confirmation_requirement(ConfirmationRequirement::Required);
/// let x1 = CesToolSpec::new().set_confirmation_requirement(ConfirmationRequirement::NotRequired);
/// ```
pub fn set_confirmation_requirement<
T: std::convert::Into<crate::model::tool::ConfirmationRequirement>,
>(
mut self,
v: T,
) -> Self {
self.confirmation_requirement = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for CesToolSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CesToolSpec"
}
}
/// Dialogflow contexts are similar to natural language context. If a person says
/// to you "they are orange", you need context in order to understand what "they"
/// is referring to. Similarly, for Dialogflow to handle an end-user expression
/// like that, it needs to be provided with context in order to correctly match
/// an intent.
///
/// Using contexts, you can control the flow of a conversation. You can configure
/// contexts for an intent by setting input and output contexts, which are
/// identified by string names. When an intent is matched, any configured output
/// contexts for that intent become active. While any contexts are active,
/// Dialogflow is more likely to match intents that are configured with input
/// contexts that correspond to the currently active contexts.
///
/// For more information about context, see the
/// [Contexts guide](https://cloud.google.com/dialogflow/docs/contexts-overview).
#[cfg(any(
feature = "answer-records",
feature = "contexts",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Context {
/// Required. The unique identifier of the context. Format:
/// `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`,
/// or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
/// ID>/sessions/<Session ID>/contexts/<Context ID>`.
///
/// The `Context ID` is always converted to lowercase, may only contain
/// characters in `a-zA-Z0-9_-%` and may be at most 250 bytes long.
///
/// If `Environment ID` is not specified, we assume default 'draft'
/// environment. If `User ID` is not specified, we assume default '-' user.
///
/// The following context names are reserved for internal use by Dialogflow.
/// You should not use these contexts or create contexts with these names:
///
/// * `__system_counters__`
/// * `*_id_dialog_context`
/// * `*_dialog_params_size`
pub name: std::string::String,
/// Optional. The number of conversational query requests after which the
/// context expires. The default is `0`. If set to `0`, the context expires
/// immediately. Contexts expire automatically after 20 minutes if there
/// are no matching queries.
pub lifespan_count: i32,
/// Optional. The collection of parameters associated with this context.
///
/// Depending on your protocol or client library language, this is a
/// map, associative array, symbol table, dictionary, or JSON object
/// composed of a collection of (MapKey, MapValue) pairs:
///
/// * MapKey type: string
/// * MapKey value: parameter name
/// * MapValue type: If parameter's entity type is a composite entity then use
/// map, otherwise, depending on the parameter value type, it could be one of
/// string, number, boolean, null, list or map.
/// * MapValue value: If parameter's entity type is a composite entity then use
/// map from composite entity property names to property values, otherwise,
/// use parameter value.
pub parameters: std::option::Option<wkt::Struct>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "contexts",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Context {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::Context::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Context;
/// let x = Context::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [lifespan_count][crate::model::Context::lifespan_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Context;
/// let x = Context::new().set_lifespan_count(42);
/// ```
pub fn set_lifespan_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.lifespan_count = v.into();
self
}
/// Sets the value of [parameters][crate::model::Context::parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Context;
/// use wkt::Struct;
/// let x = Context::new().set_parameters(Struct::default()/* use setters */);
/// ```
pub fn set_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.parameters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parameters][crate::model::Context::parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Context;
/// use wkt::Struct;
/// let x = Context::new().set_or_clear_parameters(Some(Struct::default()/* use setters */));
/// let x = Context::new().set_or_clear_parameters(None::<Struct>);
/// ```
pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.parameters = v.map(|x| x.into());
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "contexts",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Context {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Context"
}
}
/// The request message for
/// [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts].
///
/// [google.cloud.dialogflow.v2.Contexts.ListContexts]: crate::client::Contexts::list_contexts
#[cfg(feature = "contexts")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListContextsRequest {
/// Required. The session to list all contexts from.
/// Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
/// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
/// ID>/sessions/<Session ID>`.
/// If `Environment ID` is not specified, we assume default 'draft'
/// environment. If `User ID` is not specified, we assume default '-' user.
pub parent: std::string::String,
/// Optional. The maximum number of items to return in a single page. By
/// default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "contexts")]
impl ListContextsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListContextsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListContextsRequest;
/// let x = ListContextsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListContextsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListContextsRequest;
/// let x = ListContextsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListContextsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListContextsRequest;
/// let x = ListContextsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "contexts")]
impl wkt::message::Message for ListContextsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListContextsRequest"
}
}
/// The response message for
/// [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts].
///
/// [google.cloud.dialogflow.v2.Contexts.ListContexts]: crate::client::Contexts::list_contexts
#[cfg(feature = "contexts")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListContextsResponse {
/// The list of contexts. There will be a maximum number of items
/// returned based on the page_size field in the request.
pub contexts: std::vec::Vec<crate::model::Context>,
/// Token to retrieve the next page of results, or empty if there are no
/// more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "contexts")]
impl ListContextsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [contexts][crate::model::ListContextsResponse::contexts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListContextsResponse;
/// use google_cloud_dialogflow_v2::model::Context;
/// let x = ListContextsResponse::new()
/// .set_contexts([
/// Context::default()/* use setters */,
/// Context::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_contexts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Context>,
{
use std::iter::Iterator;
self.contexts = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListContextsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListContextsResponse;
/// let x = ListContextsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "contexts")]
impl wkt::message::Message for ListContextsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListContextsResponse"
}
}
#[cfg(feature = "contexts")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListContextsResponse {
type PageItem = crate::model::Context;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.contexts
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [Contexts.GetContext][google.cloud.dialogflow.v2.Contexts.GetContext].
///
/// [google.cloud.dialogflow.v2.Contexts.GetContext]: crate::client::Contexts::get_context
#[cfg(feature = "contexts")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetContextRequest {
/// Required. The name of the context. Format:
/// `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`
/// or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
/// ID>/sessions/<Session ID>/contexts/<Context ID>`.
/// If `Environment ID` is not specified, we assume default 'draft'
/// environment. If `User ID` is not specified, we assume default '-' user.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "contexts")]
impl GetContextRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetContextRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetContextRequest;
/// let x = GetContextRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "contexts")]
impl wkt::message::Message for GetContextRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetContextRequest"
}
}
/// The request message for
/// [Contexts.CreateContext][google.cloud.dialogflow.v2.Contexts.CreateContext].
///
/// [google.cloud.dialogflow.v2.Contexts.CreateContext]: crate::client::Contexts::create_context
#[cfg(feature = "contexts")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateContextRequest {
/// Required. The session to create a context for.
/// Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
/// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
/// ID>/sessions/<Session ID>`.
/// If `Environment ID` is not specified, we assume default 'draft'
/// environment. If `User ID` is not specified, we assume default '-' user.
pub parent: std::string::String,
/// Required. The context to create.
pub context: std::option::Option<crate::model::Context>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "contexts")]
impl CreateContextRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateContextRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateContextRequest;
/// let x = CreateContextRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [context][crate::model::CreateContextRequest::context].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateContextRequest;
/// use google_cloud_dialogflow_v2::model::Context;
/// let x = CreateContextRequest::new().set_context(Context::default()/* use setters */);
/// ```
pub fn set_context<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Context>,
{
self.context = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [context][crate::model::CreateContextRequest::context].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateContextRequest;
/// use google_cloud_dialogflow_v2::model::Context;
/// let x = CreateContextRequest::new().set_or_clear_context(Some(Context::default()/* use setters */));
/// let x = CreateContextRequest::new().set_or_clear_context(None::<Context>);
/// ```
pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Context>,
{
self.context = v.map(|x| x.into());
self
}
}
#[cfg(feature = "contexts")]
impl wkt::message::Message for CreateContextRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateContextRequest"
}
}
/// The request message for
/// [Contexts.UpdateContext][google.cloud.dialogflow.v2.Contexts.UpdateContext].
///
/// [google.cloud.dialogflow.v2.Contexts.UpdateContext]: crate::client::Contexts::update_context
#[cfg(feature = "contexts")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateContextRequest {
/// Required. The context to update.
pub context: std::option::Option<crate::model::Context>,
/// Optional. The mask to control which fields get updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "contexts")]
impl UpdateContextRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [context][crate::model::UpdateContextRequest::context].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateContextRequest;
/// use google_cloud_dialogflow_v2::model::Context;
/// let x = UpdateContextRequest::new().set_context(Context::default()/* use setters */);
/// ```
pub fn set_context<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Context>,
{
self.context = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [context][crate::model::UpdateContextRequest::context].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateContextRequest;
/// use google_cloud_dialogflow_v2::model::Context;
/// let x = UpdateContextRequest::new().set_or_clear_context(Some(Context::default()/* use setters */));
/// let x = UpdateContextRequest::new().set_or_clear_context(None::<Context>);
/// ```
pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Context>,
{
self.context = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateContextRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateContextRequest;
/// use wkt::FieldMask;
/// let x = UpdateContextRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateContextRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateContextRequest;
/// use wkt::FieldMask;
/// let x = UpdateContextRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateContextRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "contexts")]
impl wkt::message::Message for UpdateContextRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateContextRequest"
}
}
/// The request message for
/// [Contexts.DeleteContext][google.cloud.dialogflow.v2.Contexts.DeleteContext].
///
/// [google.cloud.dialogflow.v2.Contexts.DeleteContext]: crate::client::Contexts::delete_context
#[cfg(feature = "contexts")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteContextRequest {
/// Required. The name of the context to delete. Format:
/// `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`
/// or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
/// ID>/sessions/<Session ID>/contexts/<Context ID>`.
/// If `Environment ID` is not specified, we assume default 'draft'
/// environment. If `User ID` is not specified, we assume default '-' user.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "contexts")]
impl DeleteContextRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteContextRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteContextRequest;
/// let x = DeleteContextRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "contexts")]
impl wkt::message::Message for DeleteContextRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteContextRequest"
}
}
/// The request message for
/// [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2.Contexts.DeleteAllContexts].
///
/// [google.cloud.dialogflow.v2.Contexts.DeleteAllContexts]: crate::client::Contexts::delete_all_contexts
#[cfg(feature = "contexts")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteAllContextsRequest {
/// Required. The name of the session to delete all contexts from. Format:
/// `projects/<Project ID>/agent/sessions/<Session ID>` or `projects/<Project
/// ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session
/// ID>`.
/// If `Environment ID` is not specified we assume default 'draft' environment.
/// If `User ID` is not specified, we assume default '-' user.
pub parent: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "contexts")]
impl DeleteAllContextsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::DeleteAllContextsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteAllContextsRequest;
/// let x = DeleteAllContextsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
}
#[cfg(feature = "contexts")]
impl wkt::message::Message for DeleteAllContextsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteAllContextsRequest"
}
}
/// Represents a conversation.
/// A conversation is an interaction between an agent, including live agents
/// and Dialogflow agents, and a support customer. Conversations can
/// include phone calls and text-based chat sessions.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Conversation {
/// Output only. Identifier. The unique identifier of this conversation.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>`.
pub name: std::string::String,
/// Output only. The current state of the Conversation.
pub lifecycle_state: crate::model::conversation::LifecycleState,
/// Required. The Conversation Profile to be used to configure this
/// Conversation. This field cannot be updated.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversationProfiles/<Conversation Profile ID>`.
pub conversation_profile: std::string::String,
/// Output only. It will not be empty if the conversation is to be connected
/// over telephony.
pub phone_number: std::option::Option<crate::model::ConversationPhoneNumber>,
/// Output only. The time the conversation was started.
pub start_time: std::option::Option<wkt::Timestamp>,
/// Output only. The time the conversation was finished.
pub end_time: std::option::Option<wkt::Timestamp>,
/// Optional. The stage of a conversation. It indicates whether the virtual
/// agent or a human agent is handling the conversation.
///
/// If the conversation is created with the conversation profile that has
/// Dialogflow config set, defaults to
/// [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE];
/// Otherwise, defaults to
/// [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE].
///
/// If the conversation is created with the conversation profile that has
/// Dialogflow config set but explicitly sets conversation_stage to
/// [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE],
/// it skips
/// [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE]
/// stage and directly goes to
/// [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE].
///
/// [google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE]: crate::model::conversation::ConversationStage::HumanAssistStage
/// [google.cloud.dialogflow.v2.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE]: crate::model::conversation::ConversationStage::VirtualAgentStage
pub conversation_stage: crate::model::conversation::ConversationStage,
/// Output only. The telephony connection information.
pub telephony_connection_info:
std::option::Option<crate::model::conversation::TelephonyConnectionInfo>,
/// Optional. Output only. The initial conversation profile to be used to
/// configure this conversation, which is a copy of the conversation profile
/// config read at conversation creation time.
pub initial_conversation_profile: std::option::Option<crate::model::ConversationProfile>,
/// Output only. The context reference updates provided by external systems.
pub ingested_context_references: std::collections::HashMap<
std::string::String,
crate::model::conversation::ContextReference,
>,
/// Output only. A map with generator name as key and generator context as
/// value.
pub initial_generator_contexts: std::collections::HashMap<
std::string::String,
crate::model::conversation::GeneratorContext,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl Conversation {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::Conversation::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// let x = Conversation::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [lifecycle_state][crate::model::Conversation::lifecycle_state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use google_cloud_dialogflow_v2::model::conversation::LifecycleState;
/// let x0 = Conversation::new().set_lifecycle_state(LifecycleState::InProgress);
/// let x1 = Conversation::new().set_lifecycle_state(LifecycleState::Completed);
/// ```
pub fn set_lifecycle_state<
T: std::convert::Into<crate::model::conversation::LifecycleState>,
>(
mut self,
v: T,
) -> Self {
self.lifecycle_state = v.into();
self
}
/// Sets the value of [conversation_profile][crate::model::Conversation::conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// let x = Conversation::new().set_conversation_profile("example");
/// ```
pub fn set_conversation_profile<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_profile = v.into();
self
}
/// Sets the value of [phone_number][crate::model::Conversation::phone_number].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use google_cloud_dialogflow_v2::model::ConversationPhoneNumber;
/// let x = Conversation::new().set_phone_number(ConversationPhoneNumber::default()/* use setters */);
/// ```
pub fn set_phone_number<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ConversationPhoneNumber>,
{
self.phone_number = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [phone_number][crate::model::Conversation::phone_number].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use google_cloud_dialogflow_v2::model::ConversationPhoneNumber;
/// let x = Conversation::new().set_or_clear_phone_number(Some(ConversationPhoneNumber::default()/* use setters */));
/// let x = Conversation::new().set_or_clear_phone_number(None::<ConversationPhoneNumber>);
/// ```
pub fn set_or_clear_phone_number<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ConversationPhoneNumber>,
{
self.phone_number = v.map(|x| x.into());
self
}
/// Sets the value of [start_time][crate::model::Conversation::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use wkt::Timestamp;
/// let x = Conversation::new().set_start_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [start_time][crate::model::Conversation::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use wkt::Timestamp;
/// let x = Conversation::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
/// let x = Conversation::new().set_or_clear_start_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [end_time][crate::model::Conversation::end_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use wkt::Timestamp;
/// let x = Conversation::new().set_end_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [end_time][crate::model::Conversation::end_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use wkt::Timestamp;
/// let x = Conversation::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
/// let x = Conversation::new().set_or_clear_end_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [conversation_stage][crate::model::Conversation::conversation_stage].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use google_cloud_dialogflow_v2::model::conversation::ConversationStage;
/// let x0 = Conversation::new().set_conversation_stage(ConversationStage::VirtualAgentStage);
/// let x1 = Conversation::new().set_conversation_stage(ConversationStage::HumanAssistStage);
/// ```
pub fn set_conversation_stage<
T: std::convert::Into<crate::model::conversation::ConversationStage>,
>(
mut self,
v: T,
) -> Self {
self.conversation_stage = v.into();
self
}
/// Sets the value of [telephony_connection_info][crate::model::Conversation::telephony_connection_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use google_cloud_dialogflow_v2::model::conversation::TelephonyConnectionInfo;
/// let x = Conversation::new().set_telephony_connection_info(TelephonyConnectionInfo::default()/* use setters */);
/// ```
pub fn set_telephony_connection_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::conversation::TelephonyConnectionInfo>,
{
self.telephony_connection_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [telephony_connection_info][crate::model::Conversation::telephony_connection_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use google_cloud_dialogflow_v2::model::conversation::TelephonyConnectionInfo;
/// let x = Conversation::new().set_or_clear_telephony_connection_info(Some(TelephonyConnectionInfo::default()/* use setters */));
/// let x = Conversation::new().set_or_clear_telephony_connection_info(None::<TelephonyConnectionInfo>);
/// ```
pub fn set_or_clear_telephony_connection_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::conversation::TelephonyConnectionInfo>,
{
self.telephony_connection_info = v.map(|x| x.into());
self
}
/// Sets the value of [initial_conversation_profile][crate::model::Conversation::initial_conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = Conversation::new().set_initial_conversation_profile(ConversationProfile::default()/* use setters */);
/// ```
pub fn set_initial_conversation_profile<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ConversationProfile>,
{
self.initial_conversation_profile = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [initial_conversation_profile][crate::model::Conversation::initial_conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = Conversation::new().set_or_clear_initial_conversation_profile(Some(ConversationProfile::default()/* use setters */));
/// let x = Conversation::new().set_or_clear_initial_conversation_profile(None::<ConversationProfile>);
/// ```
pub fn set_or_clear_initial_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ConversationProfile>,
{
self.initial_conversation_profile = v.map(|x| x.into());
self
}
/// Sets the value of [ingested_context_references][crate::model::Conversation::ingested_context_references].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use google_cloud_dialogflow_v2::model::conversation::ContextReference;
/// let x = Conversation::new().set_ingested_context_references([
/// ("key0", ContextReference::default()/* use setters */),
/// ("key1", ContextReference::default()/* use (different) setters */),
/// ]);
/// ```
pub fn set_ingested_context_references<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::conversation::ContextReference>,
{
use std::iter::Iterator;
self.ingested_context_references =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [initial_generator_contexts][crate::model::Conversation::initial_generator_contexts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Conversation;
/// use google_cloud_dialogflow_v2::model::conversation::GeneratorContext;
/// let x = Conversation::new().set_initial_generator_contexts([
/// ("key0", GeneratorContext::default()/* use setters */),
/// ("key1", GeneratorContext::default()/* use (different) setters */),
/// ]);
/// ```
pub fn set_initial_generator_contexts<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::conversation::GeneratorContext>,
{
use std::iter::Iterator;
self.initial_generator_contexts =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for Conversation {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Conversation"
}
}
/// Defines additional types related to [Conversation].
#[cfg(feature = "conversations")]
pub mod conversation {
#[allow(unused_imports)]
use super::*;
/// The information about phone calls connected via phone gateway to the
/// conversation.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TelephonyConnectionInfo {
/// Output only. The number dialed to connect this call in E.164 format.
pub dialed_number: std::string::String,
/// Optional. SDP of the call. It's initially the SDP answer to the incoming
/// call, but maybe later updated for the purpose of making the link active,
/// etc.
pub sdp: std::string::String,
/// Output only. The SIP headers from the initial SIP INVITE.
pub sip_headers:
std::vec::Vec<crate::model::conversation::telephony_connection_info::SipHeader>,
/// Output only. The mime content from the initial SIP INVITE.
pub extra_mime_contents:
std::vec::Vec<crate::model::conversation::telephony_connection_info::MimeContent>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl TelephonyConnectionInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [dialed_number][crate::model::conversation::TelephonyConnectionInfo::dialed_number].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::TelephonyConnectionInfo;
/// let x = TelephonyConnectionInfo::new().set_dialed_number("example");
/// ```
pub fn set_dialed_number<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.dialed_number = v.into();
self
}
/// Sets the value of [sdp][crate::model::conversation::TelephonyConnectionInfo::sdp].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::TelephonyConnectionInfo;
/// let x = TelephonyConnectionInfo::new().set_sdp("example");
/// ```
pub fn set_sdp<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.sdp = v.into();
self
}
/// Sets the value of [sip_headers][crate::model::conversation::TelephonyConnectionInfo::sip_headers].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::TelephonyConnectionInfo;
/// use google_cloud_dialogflow_v2::model::conversation::telephony_connection_info::SipHeader;
/// let x = TelephonyConnectionInfo::new()
/// .set_sip_headers([
/// SipHeader::default()/* use setters */,
/// SipHeader::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_sip_headers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::conversation::telephony_connection_info::SipHeader>,
{
use std::iter::Iterator;
self.sip_headers = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [extra_mime_contents][crate::model::conversation::TelephonyConnectionInfo::extra_mime_contents].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::TelephonyConnectionInfo;
/// use google_cloud_dialogflow_v2::model::conversation::telephony_connection_info::MimeContent;
/// let x = TelephonyConnectionInfo::new()
/// .set_extra_mime_contents([
/// MimeContent::default()/* use setters */,
/// MimeContent::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_extra_mime_contents<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::conversation::telephony_connection_info::MimeContent,
>,
{
use std::iter::Iterator;
self.extra_mime_contents = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for TelephonyConnectionInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Conversation.TelephonyConnectionInfo"
}
}
/// Defines additional types related to [TelephonyConnectionInfo].
#[cfg(feature = "conversations")]
pub mod telephony_connection_info {
#[allow(unused_imports)]
use super::*;
/// The SIP headers from the initial SIP INVITE.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SipHeader {
/// Optional. The name of the header.
pub name: std::string::String,
/// Optional. The value of the header.
pub value: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl SipHeader {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::conversation::telephony_connection_info::SipHeader::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::telephony_connection_info::SipHeader;
/// let x = SipHeader::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [value][crate::model::conversation::telephony_connection_info::SipHeader::value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::telephony_connection_info::SipHeader;
/// let x = SipHeader::new().set_value("example");
/// ```
pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for SipHeader {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Conversation.TelephonyConnectionInfo.SipHeader"
}
}
/// The mime content from the initial SIP INVITE.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MimeContent {
/// Optional. The mime type of the content.
pub mime_type: std::string::String,
/// Optional. The content payload.
pub content: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl MimeContent {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [mime_type][crate::model::conversation::telephony_connection_info::MimeContent::mime_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::telephony_connection_info::MimeContent;
/// let x = MimeContent::new().set_mime_type("example");
/// ```
pub fn set_mime_type<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.mime_type = v.into();
self
}
/// Sets the value of [content][crate::model::conversation::telephony_connection_info::MimeContent::content].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::telephony_connection_info::MimeContent;
/// let x = MimeContent::new().set_content(bytes::Bytes::from_static(b"example"));
/// ```
pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.content = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for MimeContent {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Conversation.TelephonyConnectionInfo.MimeContent"
}
}
}
/// Represents a section of ingested context information.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ContextReference {
/// Required. The list of content updates for a context reference.
pub context_contents:
std::vec::Vec<crate::model::conversation::context_reference::ContextContent>,
/// Required. The mode in which context reference contents are updated.
pub update_mode: crate::model::conversation::context_reference::UpdateMode,
/// Optional. The language of the information ingested, defaults to "en-US"
/// if not set.
pub language_code: std::string::String,
/// Output only. The time the context reference was first created.
pub create_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl ContextReference {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [context_contents][crate::model::conversation::ContextReference::context_contents].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::ContextReference;
/// use google_cloud_dialogflow_v2::model::conversation::context_reference::ContextContent;
/// let x = ContextReference::new()
/// .set_context_contents([
/// ContextContent::default()/* use setters */,
/// ContextContent::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_context_contents<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::conversation::context_reference::ContextContent>,
{
use std::iter::Iterator;
self.context_contents = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [update_mode][crate::model::conversation::ContextReference::update_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::ContextReference;
/// use google_cloud_dialogflow_v2::model::conversation::context_reference::UpdateMode;
/// let x0 = ContextReference::new().set_update_mode(UpdateMode::Append);
/// let x1 = ContextReference::new().set_update_mode(UpdateMode::Overwrite);
/// ```
pub fn set_update_mode<
T: std::convert::Into<crate::model::conversation::context_reference::UpdateMode>,
>(
mut self,
v: T,
) -> Self {
self.update_mode = v.into();
self
}
/// Sets the value of [language_code][crate::model::conversation::ContextReference::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::ContextReference;
/// let x = ContextReference::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [create_time][crate::model::conversation::ContextReference::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::ContextReference;
/// use wkt::Timestamp;
/// let x = ContextReference::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::conversation::ContextReference::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::ContextReference;
/// use wkt::Timestamp;
/// let x = ContextReference::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = ContextReference::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for ContextReference {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Conversation.ContextReference"
}
}
/// Defines additional types related to [ContextReference].
#[cfg(feature = "conversations")]
pub mod context_reference {
#[allow(unused_imports)]
use super::*;
/// Contents ingested.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ContextContent {
/// Required. The information ingested in a single request.
pub content: std::string::String,
/// Required. The format of the ingested string.
pub content_format:
crate::model::conversation::context_reference::context_content::ContentFormat,
/// Output only. The time when this information was incorporated into the
/// relevant context reference.
pub ingestion_time: std::option::Option<wkt::Timestamp>,
/// If the context content was generated from a tool call, specify the
/// answer record associated with the tool call.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/answerRecords/<Answer Record ID>`.
pub answer_record: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl ContextContent {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [content][crate::model::conversation::context_reference::ContextContent::content].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::context_reference::ContextContent;
/// let x = ContextContent::new().set_content("example");
/// ```
pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.content = v.into();
self
}
/// Sets the value of [content_format][crate::model::conversation::context_reference::ContextContent::content_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::context_reference::ContextContent;
/// use google_cloud_dialogflow_v2::model::conversation::context_reference::context_content::ContentFormat;
/// let x0 = ContextContent::new().set_content_format(ContentFormat::Json);
/// let x1 = ContextContent::new().set_content_format(ContentFormat::PlainText);
/// ```
pub fn set_content_format<T: std::convert::Into<crate::model::conversation::context_reference::context_content::ContentFormat>>(mut self, v: T) -> Self{
self.content_format = v.into();
self
}
/// Sets the value of [ingestion_time][crate::model::conversation::context_reference::ContextContent::ingestion_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::context_reference::ContextContent;
/// use wkt::Timestamp;
/// let x = ContextContent::new().set_ingestion_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_ingestion_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.ingestion_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [ingestion_time][crate::model::conversation::context_reference::ContextContent::ingestion_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::context_reference::ContextContent;
/// use wkt::Timestamp;
/// let x = ContextContent::new().set_or_clear_ingestion_time(Some(Timestamp::default()/* use setters */));
/// let x = ContextContent::new().set_or_clear_ingestion_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_ingestion_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.ingestion_time = v.map(|x| x.into());
self
}
/// Sets the value of [answer_record][crate::model::conversation::context_reference::ContextContent::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::context_reference::ContextContent;
/// let x = ContextContent::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.answer_record = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for ContextContent {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Conversation.ContextReference.ContextContent"
}
}
/// Defines additional types related to [ContextContent].
#[cfg(feature = "conversations")]
pub mod context_content {
#[allow(unused_imports)]
use super::*;
/// Represents the format of the ingested string.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "conversations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ContentFormat {
/// Unspecified content format.
Unspecified,
/// Content was provided in JSON format.
Json,
/// Content was provided as plain text.
PlainText,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ContentFormat::value] or
/// [ContentFormat::name].
UnknownValue(content_format::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "conversations")]
pub mod content_format {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "conversations")]
impl ContentFormat {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Json => std::option::Option::Some(1),
Self::PlainText => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("CONTENT_FORMAT_UNSPECIFIED")
}
Self::Json => std::option::Option::Some("JSON"),
Self::PlainText => std::option::Option::Some("PLAIN_TEXT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "conversations")]
impl std::default::Default for ContentFormat {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "conversations")]
impl std::fmt::Display for ContentFormat {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<i32> for ContentFormat {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Json,
2 => Self::PlainText,
_ => Self::UnknownValue(content_format::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<&str> for ContentFormat {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CONTENT_FORMAT_UNSPECIFIED" => Self::Unspecified,
"JSON" => Self::Json,
"PLAIN_TEXT" => Self::PlainText,
_ => Self::UnknownValue(content_format::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "conversations")]
impl serde::ser::Serialize for ContentFormat {
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::Json => serializer.serialize_i32(1),
Self::PlainText => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "conversations")]
impl<'de> serde::de::Deserialize<'de> for ContentFormat {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContentFormat>::new(
".google.cloud.dialogflow.v2.Conversation.ContextReference.ContextContent.ContentFormat"))
}
}
}
/// Represents the mode in which context reference contents are updated.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "conversations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum UpdateMode {
/// Unspecified update mode.
Unspecified,
/// Context content updates are applied in append mode.
Append,
/// Context content updates are applied in overwrite mode.
Overwrite,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [UpdateMode::value] or
/// [UpdateMode::name].
UnknownValue(update_mode::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "conversations")]
pub mod update_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "conversations")]
impl UpdateMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Append => std::option::Option::Some(1),
Self::Overwrite => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("UPDATE_MODE_UNSPECIFIED"),
Self::Append => std::option::Option::Some("APPEND"),
Self::Overwrite => std::option::Option::Some("OVERWRITE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "conversations")]
impl std::default::Default for UpdateMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "conversations")]
impl std::fmt::Display for UpdateMode {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<i32> for UpdateMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Append,
2 => Self::Overwrite,
_ => Self::UnknownValue(update_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<&str> for UpdateMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"UPDATE_MODE_UNSPECIFIED" => Self::Unspecified,
"APPEND" => Self::Append,
"OVERWRITE" => Self::Overwrite,
_ => Self::UnknownValue(update_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "conversations")]
impl serde::ser::Serialize for UpdateMode {
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::Append => serializer.serialize_i32(1),
Self::Overwrite => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "conversations")]
impl<'de> serde::de::Deserialize<'de> for UpdateMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<UpdateMode>::new(
".google.cloud.dialogflow.v2.Conversation.ContextReference.UpdateMode",
))
}
}
}
/// Represents the context of a generator.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GeneratorContext {
/// Output only. The type of the generator.
pub generator_type: crate::model::conversation::generator_context::GeneratorType,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl GeneratorContext {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [generator_type][crate::model::conversation::GeneratorContext::generator_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::conversation::GeneratorContext;
/// use google_cloud_dialogflow_v2::model::conversation::generator_context::GeneratorType;
/// let x0 = GeneratorContext::new().set_generator_type(GeneratorType::FreeForm);
/// let x1 = GeneratorContext::new().set_generator_type(GeneratorType::AgentCoaching);
/// let x2 = GeneratorContext::new().set_generator_type(GeneratorType::Summarization);
/// ```
pub fn set_generator_type<
T: std::convert::Into<crate::model::conversation::generator_context::GeneratorType>,
>(
mut self,
v: T,
) -> Self {
self.generator_type = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for GeneratorContext {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Conversation.GeneratorContext"
}
}
/// Defines additional types related to [GeneratorContext].
#[cfg(feature = "conversations")]
pub mod generator_context {
#[allow(unused_imports)]
use super::*;
/// The available generator types.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "conversations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum GeneratorType {
/// Unspecified generator type.
Unspecified,
/// Free form generator type.
FreeForm,
/// Agent coaching generator type.
AgentCoaching,
/// Summarization generator type.
Summarization,
/// Translation generator type.
Translation,
/// Agent feedback generator type.
AgentFeedback,
/// Customer message generation generator type.
CustomerMessageGeneration,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [GeneratorType::value] or
/// [GeneratorType::name].
UnknownValue(generator_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "conversations")]
pub mod generator_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "conversations")]
impl GeneratorType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::FreeForm => std::option::Option::Some(1),
Self::AgentCoaching => std::option::Option::Some(2),
Self::Summarization => std::option::Option::Some(3),
Self::Translation => std::option::Option::Some(4),
Self::AgentFeedback => std::option::Option::Some(5),
Self::CustomerMessageGeneration => std::option::Option::Some(6),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("GENERATOR_TYPE_UNSPECIFIED"),
Self::FreeForm => std::option::Option::Some("FREE_FORM"),
Self::AgentCoaching => std::option::Option::Some("AGENT_COACHING"),
Self::Summarization => std::option::Option::Some("SUMMARIZATION"),
Self::Translation => std::option::Option::Some("TRANSLATION"),
Self::AgentFeedback => std::option::Option::Some("AGENT_FEEDBACK"),
Self::CustomerMessageGeneration => {
std::option::Option::Some("CUSTOMER_MESSAGE_GENERATION")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "conversations")]
impl std::default::Default for GeneratorType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "conversations")]
impl std::fmt::Display for GeneratorType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<i32> for GeneratorType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::FreeForm,
2 => Self::AgentCoaching,
3 => Self::Summarization,
4 => Self::Translation,
5 => Self::AgentFeedback,
6 => Self::CustomerMessageGeneration,
_ => Self::UnknownValue(generator_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<&str> for GeneratorType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"GENERATOR_TYPE_UNSPECIFIED" => Self::Unspecified,
"FREE_FORM" => Self::FreeForm,
"AGENT_COACHING" => Self::AgentCoaching,
"SUMMARIZATION" => Self::Summarization,
"TRANSLATION" => Self::Translation,
"AGENT_FEEDBACK" => Self::AgentFeedback,
"CUSTOMER_MESSAGE_GENERATION" => Self::CustomerMessageGeneration,
_ => Self::UnknownValue(generator_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "conversations")]
impl serde::ser::Serialize for GeneratorType {
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::FreeForm => serializer.serialize_i32(1),
Self::AgentCoaching => serializer.serialize_i32(2),
Self::Summarization => serializer.serialize_i32(3),
Self::Translation => serializer.serialize_i32(4),
Self::AgentFeedback => serializer.serialize_i32(5),
Self::CustomerMessageGeneration => serializer.serialize_i32(6),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "conversations")]
impl<'de> serde::de::Deserialize<'de> for GeneratorType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<GeneratorType>::new(
".google.cloud.dialogflow.v2.Conversation.GeneratorContext.GeneratorType",
))
}
}
}
/// Enumeration of the completion status of the conversation.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "conversations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum LifecycleState {
/// Unknown.
Unspecified,
/// Conversation is currently open for media analysis.
InProgress,
/// Conversation has been completed.
Completed,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [LifecycleState::value] or
/// [LifecycleState::name].
UnknownValue(lifecycle_state::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "conversations")]
pub mod lifecycle_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "conversations")]
impl LifecycleState {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::InProgress => std::option::Option::Some(1),
Self::Completed => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("LIFECYCLE_STATE_UNSPECIFIED"),
Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
Self::Completed => std::option::Option::Some("COMPLETED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "conversations")]
impl std::default::Default for LifecycleState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "conversations")]
impl std::fmt::Display for LifecycleState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<i32> for LifecycleState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::InProgress,
2 => Self::Completed,
_ => Self::UnknownValue(lifecycle_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<&str> for LifecycleState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"LIFECYCLE_STATE_UNSPECIFIED" => Self::Unspecified,
"IN_PROGRESS" => Self::InProgress,
"COMPLETED" => Self::Completed,
_ => Self::UnknownValue(lifecycle_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "conversations")]
impl serde::ser::Serialize for LifecycleState {
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::InProgress => serializer.serialize_i32(1),
Self::Completed => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "conversations")]
impl<'de> serde::de::Deserialize<'de> for LifecycleState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<LifecycleState>::new(
".google.cloud.dialogflow.v2.Conversation.LifecycleState",
))
}
}
/// Enumeration of the different conversation stages a conversation can be in.
/// Reference:
/// <https://cloud.google.com/agent-assist/docs/basics#conversation_stages>
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "conversations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ConversationStage {
/// Unknown. Should never be used after a conversation is successfully
/// created.
Unspecified,
/// The conversation should return virtual agent responses into the
/// conversation.
VirtualAgentStage,
/// The conversation should not provide responses, just listen and provide
/// suggestions.
HumanAssistStage,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ConversationStage::value] or
/// [ConversationStage::name].
UnknownValue(conversation_stage::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "conversations")]
pub mod conversation_stage {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "conversations")]
impl ConversationStage {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::VirtualAgentStage => std::option::Option::Some(1),
Self::HumanAssistStage => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CONVERSATION_STAGE_UNSPECIFIED"),
Self::VirtualAgentStage => std::option::Option::Some("VIRTUAL_AGENT_STAGE"),
Self::HumanAssistStage => std::option::Option::Some("HUMAN_ASSIST_STAGE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "conversations")]
impl std::default::Default for ConversationStage {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "conversations")]
impl std::fmt::Display for ConversationStage {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<i32> for ConversationStage {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::VirtualAgentStage,
2 => Self::HumanAssistStage,
_ => Self::UnknownValue(conversation_stage::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<&str> for ConversationStage {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CONVERSATION_STAGE_UNSPECIFIED" => Self::Unspecified,
"VIRTUAL_AGENT_STAGE" => Self::VirtualAgentStage,
"HUMAN_ASSIST_STAGE" => Self::HumanAssistStage,
_ => Self::UnknownValue(conversation_stage::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "conversations")]
impl serde::ser::Serialize for ConversationStage {
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::VirtualAgentStage => serializer.serialize_i32(1),
Self::HumanAssistStage => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "conversations")]
impl<'de> serde::de::Deserialize<'de> for ConversationStage {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConversationStage>::new(
".google.cloud.dialogflow.v2.Conversation.ConversationStage",
))
}
}
}
/// The request message for
/// [Conversations.CreateConversation][google.cloud.dialogflow.v2.Conversations.CreateConversation].
///
/// [google.cloud.dialogflow.v2.Conversations.CreateConversation]: crate::client::Conversations::create_conversation
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateConversationRequest {
/// Required. Resource identifier of the project creating the conversation.
/// Format: `projects/<Project ID>/locations/<Location ID>`.
pub parent: std::string::String,
/// Required. The conversation to create.
pub conversation: std::option::Option<crate::model::Conversation>,
/// Optional. Identifier of the conversation. Generally it's auto generated by
/// Google. Only set it if you cannot wait for the response to return a
/// auto-generated one to you.
///
/// The conversation ID must be compliant with the regression formula
/// `[a-zA-Z][a-zA-Z0-9_-]*` with the characters length in range of [3,64].
/// If the field is provided, the caller is responsible for
///
/// 1. the uniqueness of the ID, otherwise the request will be rejected.
/// 1. the consistency for whether to use custom ID or not under a project to
/// better ensure uniqueness.
pub conversation_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl CreateConversationRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateConversationRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationRequest;
/// let x = CreateConversationRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [conversation][crate::model::CreateConversationRequest::conversation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationRequest;
/// use google_cloud_dialogflow_v2::model::Conversation;
/// let x = CreateConversationRequest::new().set_conversation(Conversation::default()/* use setters */);
/// ```
pub fn set_conversation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Conversation>,
{
self.conversation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [conversation][crate::model::CreateConversationRequest::conversation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationRequest;
/// use google_cloud_dialogflow_v2::model::Conversation;
/// let x = CreateConversationRequest::new().set_or_clear_conversation(Some(Conversation::default()/* use setters */));
/// let x = CreateConversationRequest::new().set_or_clear_conversation(None::<Conversation>);
/// ```
pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Conversation>,
{
self.conversation = v.map(|x| x.into());
self
}
/// Sets the value of [conversation_id][crate::model::CreateConversationRequest::conversation_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationRequest;
/// let x = CreateConversationRequest::new().set_conversation_id("example");
/// ```
pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.conversation_id = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for CreateConversationRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateConversationRequest"
}
}
/// The request message for
/// [Conversations.ListConversations][google.cloud.dialogflow.v2.Conversations.ListConversations].
///
/// [google.cloud.dialogflow.v2.Conversations.ListConversations]: crate::client::Conversations::list_conversations
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConversationsRequest {
/// Required. The project from which to list all conversation.
/// Format: `projects/<Project ID>/locations/<Location ID>`.
pub parent: std::string::String,
/// Optional. The maximum number of items to return in a single page. By
/// default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
/// Optional. A filter expression that filters conversations listed in the
/// response. Only `lifecycle_state` can be filtered on in this way. For
/// example, the following expression only returns `COMPLETED` conversations:
///
/// `lifecycle_state = "COMPLETED"`
///
/// For more information about filtering, see
/// [API Filtering](https://aip.dev/160).
pub filter: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl ListConversationsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListConversationsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationsRequest;
/// let x = ListConversationsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListConversationsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationsRequest;
/// let x = ListConversationsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListConversationsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationsRequest;
/// let x = ListConversationsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
/// Sets the value of [filter][crate::model::ListConversationsRequest::filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationsRequest;
/// let x = ListConversationsRequest::new().set_filter("example");
/// ```
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for ListConversationsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListConversationsRequest"
}
}
/// The response message for
/// [Conversations.ListConversations][google.cloud.dialogflow.v2.Conversations.ListConversations].
///
/// [google.cloud.dialogflow.v2.Conversations.ListConversations]: crate::client::Conversations::list_conversations
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConversationsResponse {
/// The list of conversations. There will be a maximum number of items
/// returned based on the page_size field in the request.
pub conversations: std::vec::Vec<crate::model::Conversation>,
/// Token to retrieve the next page of results, or empty if there are no
/// more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl ListConversationsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversations][crate::model::ListConversationsResponse::conversations].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationsResponse;
/// use google_cloud_dialogflow_v2::model::Conversation;
/// let x = ListConversationsResponse::new()
/// .set_conversations([
/// Conversation::default()/* use setters */,
/// Conversation::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_conversations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Conversation>,
{
use std::iter::Iterator;
self.conversations = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListConversationsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationsResponse;
/// let x = ListConversationsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for ListConversationsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListConversationsResponse"
}
}
#[cfg(feature = "conversations")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListConversationsResponse {
type PageItem = crate::model::Conversation;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.conversations
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [Conversations.GetConversation][google.cloud.dialogflow.v2.Conversations.GetConversation].
///
/// [google.cloud.dialogflow.v2.Conversations.GetConversation]: crate::client::Conversations::get_conversation
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetConversationRequest {
/// Required. The name of the conversation. Format:
/// `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation
/// ID>`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl GetConversationRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetConversationRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetConversationRequest;
/// let x = GetConversationRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for GetConversationRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetConversationRequest"
}
}
/// The request message for
/// [Conversations.CompleteConversation][google.cloud.dialogflow.v2.Conversations.CompleteConversation].
///
/// [google.cloud.dialogflow.v2.Conversations.CompleteConversation]: crate::client::Conversations::complete_conversation
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CompleteConversationRequest {
/// Required. Resource identifier of the conversation to close.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl CompleteConversationRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::CompleteConversationRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CompleteConversationRequest;
/// let x = CompleteConversationRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for CompleteConversationRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CompleteConversationRequest"
}
}
/// The request message for
/// [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages].
///
/// [google.cloud.dialogflow.v2.Conversations.ListMessages]: crate::client::Conversations::list_messages
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListMessagesRequest {
/// Required. The name of the conversation to list messages for.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>`
pub parent: std::string::String,
/// Optional. Filter on message fields. Currently predicates on `create_time`
/// and `create_time_epoch_microseconds` are supported. `create_time` only
/// support milliseconds accuracy. E.g.,
/// `create_time_epoch_microseconds > 1551790877964485` or
/// `create_time > 2017-01-15T01:30:15.01Z`.
///
/// For more information about filtering, see
/// [API Filtering](https://aip.dev/160).
pub filter: std::string::String,
/// Optional. The maximum number of items to return in a single page. By
/// default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl ListMessagesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListMessagesRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListMessagesRequest;
/// let x = ListMessagesRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [filter][crate::model::ListMessagesRequest::filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListMessagesRequest;
/// let x = ListMessagesRequest::new().set_filter("example");
/// ```
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListMessagesRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListMessagesRequest;
/// let x = ListMessagesRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListMessagesRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListMessagesRequest;
/// let x = ListMessagesRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for ListMessagesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListMessagesRequest"
}
}
/// The response message for
/// [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages].
///
/// [google.cloud.dialogflow.v2.Conversations.ListMessages]: crate::client::Conversations::list_messages
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListMessagesResponse {
/// The list of messages. There will be a maximum number of items
/// returned based on the page_size field in the request.
/// `messages` is sorted by `create_time` in descending order.
pub messages: std::vec::Vec<crate::model::Message>,
/// Token to retrieve the next page of results, or empty if there are
/// no more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl ListMessagesResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [messages][crate::model::ListMessagesResponse::messages].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListMessagesResponse;
/// use google_cloud_dialogflow_v2::model::Message;
/// let x = ListMessagesResponse::new()
/// .set_messages([
/// Message::default()/* use setters */,
/// Message::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_messages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Message>,
{
use std::iter::Iterator;
self.messages = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListMessagesResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListMessagesResponse;
/// let x = ListMessagesResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for ListMessagesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListMessagesResponse"
}
}
#[cfg(feature = "conversations")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListMessagesResponse {
type PageItem = crate::model::Message;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.messages
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Represents a phone number for telephony integration. It allows for connecting
/// a particular conversation over telephony.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationPhoneNumber {
/// Output only. Desired country code for the phone number.
pub country_code: i32,
/// Output only. The phone number to connect to this conversation.
pub phone_number: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl ConversationPhoneNumber {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [country_code][crate::model::ConversationPhoneNumber::country_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationPhoneNumber;
/// let x = ConversationPhoneNumber::new().set_country_code(42);
/// ```
pub fn set_country_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.country_code = v.into();
self
}
/// Sets the value of [phone_number][crate::model::ConversationPhoneNumber::phone_number].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationPhoneNumber;
/// let x = ConversationPhoneNumber::new().set_phone_number("example");
/// ```
pub fn set_phone_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.phone_number = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for ConversationPhoneNumber {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ConversationPhoneNumber"
}
}
/// The request message for [ConversationsService.IngestContextReferences][].
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IngestContextReferencesRequest {
/// Required. Resource identifier of the conversation to ingest context
/// information for. Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>`.
pub conversation: std::string::String,
/// Required. The context references to ingest. The key is the name of the
/// context reference and the value contains the contents of the context
/// reference. The key is used to incorporate ingested context references to
/// enhance the generator.
pub context_references: std::collections::HashMap<
std::string::String,
crate::model::conversation::ContextReference,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl IngestContextReferencesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation][crate::model::IngestContextReferencesRequest::conversation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::IngestContextReferencesRequest;
/// let x = IngestContextReferencesRequest::new().set_conversation("example");
/// ```
pub fn set_conversation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.conversation = v.into();
self
}
/// Sets the value of [context_references][crate::model::IngestContextReferencesRequest::context_references].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::IngestContextReferencesRequest;
/// use google_cloud_dialogflow_v2::model::conversation::ContextReference;
/// let x = IngestContextReferencesRequest::new().set_context_references([
/// ("key0", ContextReference::default()/* use setters */),
/// ("key1", ContextReference::default()/* use (different) setters */),
/// ]);
/// ```
pub fn set_context_references<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::conversation::ContextReference>,
{
use std::iter::Iterator;
self.context_references = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for IngestContextReferencesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.IngestContextReferencesRequest"
}
}
/// The response message for [ConversationsService.IngestContextReferences][].
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IngestContextReferencesResponse {
/// All context references ingested.
pub ingested_context_references: std::collections::HashMap<
std::string::String,
crate::model::conversation::ContextReference,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl IngestContextReferencesResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [ingested_context_references][crate::model::IngestContextReferencesResponse::ingested_context_references].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::IngestContextReferencesResponse;
/// use google_cloud_dialogflow_v2::model::conversation::ContextReference;
/// let x = IngestContextReferencesResponse::new().set_ingested_context_references([
/// ("key0", ContextReference::default()/* use setters */),
/// ("key1", ContextReference::default()/* use (different) setters */),
/// ]);
/// ```
pub fn set_ingested_context_references<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::conversation::ContextReference>,
{
use std::iter::Iterator;
self.ingested_context_references =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for IngestContextReferencesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.IngestContextReferencesResponse"
}
}
/// The request message for
/// [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2.Conversations.SuggestConversationSummary].
///
/// [google.cloud.dialogflow.v2.Conversations.SuggestConversationSummary]: crate::client::Conversations::suggest_conversation_summary
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestConversationSummaryRequest {
/// Required. The conversation to fetch suggestion for.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>`.
pub conversation: std::string::String,
/// Optional. The name of the latest conversation message used as context for
/// compiling suggestion. If empty, the latest message of the conversation will
/// be used.
///
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub latest_message: std::string::String,
/// Optional. Max number of messages prior to and including
/// [latest_message] to use as context when compiling the
/// suggestion. By default 500 and at most 1000.
pub context_size: i32,
/// Optional. Parameters for a human assist query. Only used for POC/demo
/// purpose.
pub assist_query_params: std::option::Option<crate::model::AssistQueryParameters>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl SuggestConversationSummaryRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation][crate::model::SuggestConversationSummaryRequest::conversation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestConversationSummaryRequest;
/// let x = SuggestConversationSummaryRequest::new().set_conversation("example");
/// ```
pub fn set_conversation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.conversation = v.into();
self
}
/// Sets the value of [latest_message][crate::model::SuggestConversationSummaryRequest::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestConversationSummaryRequest;
/// let x = SuggestConversationSummaryRequest::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [context_size][crate::model::SuggestConversationSummaryRequest::context_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestConversationSummaryRequest;
/// let x = SuggestConversationSummaryRequest::new().set_context_size(42);
/// ```
pub fn set_context_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.context_size = v.into();
self
}
/// Sets the value of [assist_query_params][crate::model::SuggestConversationSummaryRequest::assist_query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestConversationSummaryRequest;
/// use google_cloud_dialogflow_v2::model::AssistQueryParameters;
/// let x = SuggestConversationSummaryRequest::new().set_assist_query_params(AssistQueryParameters::default()/* use setters */);
/// ```
pub fn set_assist_query_params<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AssistQueryParameters>,
{
self.assist_query_params = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [assist_query_params][crate::model::SuggestConversationSummaryRequest::assist_query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestConversationSummaryRequest;
/// use google_cloud_dialogflow_v2::model::AssistQueryParameters;
/// let x = SuggestConversationSummaryRequest::new().set_or_clear_assist_query_params(Some(AssistQueryParameters::default()/* use setters */));
/// let x = SuggestConversationSummaryRequest::new().set_or_clear_assist_query_params(None::<AssistQueryParameters>);
/// ```
pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AssistQueryParameters>,
{
self.assist_query_params = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for SuggestConversationSummaryRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestConversationSummaryRequest"
}
}
/// The response message for
/// [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2.Conversations.SuggestConversationSummary].
///
/// [google.cloud.dialogflow.v2.Conversations.SuggestConversationSummary]: crate::client::Conversations::suggest_conversation_summary
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestConversationSummaryResponse {
/// Generated summary.
pub summary: std::option::Option<crate::model::suggest_conversation_summary_response::Summary>,
/// The name of the latest conversation message used as context for
/// compiling suggestion.
///
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub latest_message: std::string::String,
/// Number of messages prior to and including
/// [latest_message][google.cloud.dialogflow.v2.SuggestConversationSummaryResponse.latest_message]
/// used to compile the suggestion. It may be smaller than the
/// [SuggestConversationSummaryRequest.context_size][google.cloud.dialogflow.v2.SuggestConversationSummaryRequest.context_size]
/// field in the request if there weren't that many messages in the
/// conversation.
///
/// [google.cloud.dialogflow.v2.SuggestConversationSummaryRequest.context_size]: crate::model::SuggestConversationSummaryRequest::context_size
/// [google.cloud.dialogflow.v2.SuggestConversationSummaryResponse.latest_message]: crate::model::SuggestConversationSummaryResponse::latest_message
pub context_size: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl SuggestConversationSummaryResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [summary][crate::model::SuggestConversationSummaryResponse::summary].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestConversationSummaryResponse;
/// use google_cloud_dialogflow_v2::model::suggest_conversation_summary_response::Summary;
/// let x = SuggestConversationSummaryResponse::new().set_summary(Summary::default()/* use setters */);
/// ```
pub fn set_summary<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::suggest_conversation_summary_response::Summary>,
{
self.summary = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [summary][crate::model::SuggestConversationSummaryResponse::summary].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestConversationSummaryResponse;
/// use google_cloud_dialogflow_v2::model::suggest_conversation_summary_response::Summary;
/// let x = SuggestConversationSummaryResponse::new().set_or_clear_summary(Some(Summary::default()/* use setters */));
/// let x = SuggestConversationSummaryResponse::new().set_or_clear_summary(None::<Summary>);
/// ```
pub fn set_or_clear_summary<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::suggest_conversation_summary_response::Summary>,
{
self.summary = v.map(|x| x.into());
self
}
/// Sets the value of [latest_message][crate::model::SuggestConversationSummaryResponse::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestConversationSummaryResponse;
/// let x = SuggestConversationSummaryResponse::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [context_size][crate::model::SuggestConversationSummaryResponse::context_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestConversationSummaryResponse;
/// let x = SuggestConversationSummaryResponse::new().set_context_size(42);
/// ```
pub fn set_context_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.context_size = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for SuggestConversationSummaryResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestConversationSummaryResponse"
}
}
/// Defines additional types related to [SuggestConversationSummaryResponse].
#[cfg(feature = "conversations")]
pub mod suggest_conversation_summary_response {
#[allow(unused_imports)]
use super::*;
/// Generated summary for a conversation.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Summary {
/// The summary content that is concatenated into one string.
pub text: std::string::String,
/// The summary content that is divided into sections. The key is the
/// section's name and the value is the section's content. There is no
/// specific format for the key or value.
pub text_sections: std::collections::HashMap<std::string::String, std::string::String>,
/// Same as text_sections, but in an order that is consistent with the order
/// of the sections in the generator.
pub sorted_text_sections: std::vec::Vec<
crate::model::suggest_conversation_summary_response::summary::SummarySection,
>,
/// The name of the answer record. Format:
/// "projects/\<Project ID\>/answerRecords/\<Answer Record ID\>"
pub answer_record: std::string::String,
/// The baseline model version used to generate this summary. It is empty if
/// a baseline model was not used to generate this summary.
pub baseline_model_version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl Summary {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [text][crate::model::suggest_conversation_summary_response::Summary::text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::suggest_conversation_summary_response::Summary;
/// let x = Summary::new().set_text("example");
/// ```
pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.text = v.into();
self
}
/// Sets the value of [text_sections][crate::model::suggest_conversation_summary_response::Summary::text_sections].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::suggest_conversation_summary_response::Summary;
/// let x = Summary::new().set_text_sections([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_text_sections<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.text_sections = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [sorted_text_sections][crate::model::suggest_conversation_summary_response::Summary::sorted_text_sections].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::suggest_conversation_summary_response::Summary;
/// use google_cloud_dialogflow_v2::model::suggest_conversation_summary_response::summary::SummarySection;
/// let x = Summary::new()
/// .set_sorted_text_sections([
/// SummarySection::default()/* use setters */,
/// SummarySection::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_sorted_text_sections<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::suggest_conversation_summary_response::summary::SummarySection,
>,
{
use std::iter::Iterator;
self.sorted_text_sections = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [answer_record][crate::model::suggest_conversation_summary_response::Summary::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::suggest_conversation_summary_response::Summary;
/// let x = Summary::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.answer_record = v.into();
self
}
/// Sets the value of [baseline_model_version][crate::model::suggest_conversation_summary_response::Summary::baseline_model_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::suggest_conversation_summary_response::Summary;
/// let x = Summary::new().set_baseline_model_version("example");
/// ```
pub fn set_baseline_model_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.baseline_model_version = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for Summary {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestConversationSummaryResponse.Summary"
}
}
/// Defines additional types related to [Summary].
#[cfg(feature = "conversations")]
pub mod summary {
#[allow(unused_imports)]
use super::*;
/// A component of the generated summary.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SummarySection {
/// Output only. Name of the section.
pub section: std::string::String,
/// Output only. Summary text for the section.
pub summary: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl SummarySection {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [section][crate::model::suggest_conversation_summary_response::summary::SummarySection::section].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::suggest_conversation_summary_response::summary::SummarySection;
/// let x = SummarySection::new().set_section("example");
/// ```
pub fn set_section<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.section = v.into();
self
}
/// Sets the value of [summary][crate::model::suggest_conversation_summary_response::summary::SummarySection::summary].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::suggest_conversation_summary_response::summary::SummarySection;
/// let x = SummarySection::new().set_summary("example");
/// ```
pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.summary = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for SummarySection {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestConversationSummaryResponse.Summary.SummarySection"
}
}
}
}
/// The request message for
/// [Conversations.GenerateStatelessSummary][google.cloud.dialogflow.v2.Conversations.GenerateStatelessSummary].
///
/// [google.cloud.dialogflow.v2.Conversations.GenerateStatelessSummary]: crate::client::Conversations::generate_stateless_summary
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateStatelessSummaryRequest {
/// Required. The conversation to suggest a summary for.
pub stateless_conversation:
std::option::Option<crate::model::generate_stateless_summary_request::MinimalConversation>,
/// Required. A ConversationProfile containing information required for Summary
/// generation.
/// Required fields: {language_code, security_settings}
/// Optional fields: {agent_assistant_config}
pub conversation_profile: std::option::Option<crate::model::ConversationProfile>,
/// Optional. The name of the latest conversation message used as context for
/// generating a Summary. If empty, the latest message of the conversation will
/// be used. The format is specific to the user and the names of the messages
/// provided.
pub latest_message: std::string::String,
/// Optional. Max number of messages prior to and including
/// [latest_message] to use as context when compiling the
/// suggestion. By default 500 and at most 1000.
pub max_context_size: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl GenerateStatelessSummaryRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [stateless_conversation][crate::model::GenerateStatelessSummaryRequest::stateless_conversation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSummaryRequest;
/// use google_cloud_dialogflow_v2::model::generate_stateless_summary_request::MinimalConversation;
/// let x = GenerateStatelessSummaryRequest::new().set_stateless_conversation(MinimalConversation::default()/* use setters */);
/// ```
pub fn set_stateless_conversation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::generate_stateless_summary_request::MinimalConversation,
>,
{
self.stateless_conversation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [stateless_conversation][crate::model::GenerateStatelessSummaryRequest::stateless_conversation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSummaryRequest;
/// use google_cloud_dialogflow_v2::model::generate_stateless_summary_request::MinimalConversation;
/// let x = GenerateStatelessSummaryRequest::new().set_or_clear_stateless_conversation(Some(MinimalConversation::default()/* use setters */));
/// let x = GenerateStatelessSummaryRequest::new().set_or_clear_stateless_conversation(None::<MinimalConversation>);
/// ```
pub fn set_or_clear_stateless_conversation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<
crate::model::generate_stateless_summary_request::MinimalConversation,
>,
{
self.stateless_conversation = v.map(|x| x.into());
self
}
/// Sets the value of [conversation_profile][crate::model::GenerateStatelessSummaryRequest::conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSummaryRequest;
/// use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = GenerateStatelessSummaryRequest::new().set_conversation_profile(ConversationProfile::default()/* use setters */);
/// ```
pub fn set_conversation_profile<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ConversationProfile>,
{
self.conversation_profile = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [conversation_profile][crate::model::GenerateStatelessSummaryRequest::conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSummaryRequest;
/// use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = GenerateStatelessSummaryRequest::new().set_or_clear_conversation_profile(Some(ConversationProfile::default()/* use setters */));
/// let x = GenerateStatelessSummaryRequest::new().set_or_clear_conversation_profile(None::<ConversationProfile>);
/// ```
pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ConversationProfile>,
{
self.conversation_profile = v.map(|x| x.into());
self
}
/// Sets the value of [latest_message][crate::model::GenerateStatelessSummaryRequest::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSummaryRequest;
/// let x = GenerateStatelessSummaryRequest::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [max_context_size][crate::model::GenerateStatelessSummaryRequest::max_context_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSummaryRequest;
/// let x = GenerateStatelessSummaryRequest::new().set_max_context_size(42);
/// ```
pub fn set_max_context_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_context_size = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for GenerateStatelessSummaryRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GenerateStatelessSummaryRequest"
}
}
/// Defines additional types related to [GenerateStatelessSummaryRequest].
#[cfg(feature = "conversations")]
pub mod generate_stateless_summary_request {
#[allow(unused_imports)]
use super::*;
/// The minimum amount of information required to generate a Summary without
/// having a Conversation resource created.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MinimalConversation {
/// Required. The messages that the Summary will be generated from. It is
/// expected that this message content is already redacted and does not
/// contain any PII. Required fields: {content, language_code, participant,
/// participant_role} Optional fields: {send_time} If send_time is not
/// provided, then the messages must be provided in chronological order.
pub messages: std::vec::Vec<crate::model::Message>,
/// Required. The parent resource to charge for the Summary's generation.
/// Format: `projects/<Project ID>/locations/<Location ID>`.
pub parent: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl MinimalConversation {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [messages][crate::model::generate_stateless_summary_request::MinimalConversation::messages].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generate_stateless_summary_request::MinimalConversation;
/// use google_cloud_dialogflow_v2::model::Message;
/// let x = MinimalConversation::new()
/// .set_messages([
/// Message::default()/* use setters */,
/// Message::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_messages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Message>,
{
use std::iter::Iterator;
self.messages = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [parent][crate::model::generate_stateless_summary_request::MinimalConversation::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generate_stateless_summary_request::MinimalConversation;
/// let x = MinimalConversation::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for MinimalConversation {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GenerateStatelessSummaryRequest.MinimalConversation"
}
}
}
/// The response message for
/// [Conversations.GenerateStatelessSummary][google.cloud.dialogflow.v2.Conversations.GenerateStatelessSummary].
///
/// [google.cloud.dialogflow.v2.Conversations.GenerateStatelessSummary]: crate::client::Conversations::generate_stateless_summary
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateStatelessSummaryResponse {
/// Generated summary.
pub summary: std::option::Option<crate::model::generate_stateless_summary_response::Summary>,
/// The name of the latest conversation message used as context for
/// compiling suggestion. The format is specific to the user and the names of
/// the messages provided.
pub latest_message: std::string::String,
/// Number of messages prior to and including
/// [latest_message][google.cloud.dialogflow.v2.GenerateStatelessSummaryResponse.latest_message]
/// used to compile the suggestion. It may be smaller than the
/// [GenerateStatelessSummaryRequest.max_context_size][google.cloud.dialogflow.v2.GenerateStatelessSummaryRequest.max_context_size]
/// field in the request if there weren't that many messages in the
/// conversation.
///
/// [google.cloud.dialogflow.v2.GenerateStatelessSummaryRequest.max_context_size]: crate::model::GenerateStatelessSummaryRequest::max_context_size
/// [google.cloud.dialogflow.v2.GenerateStatelessSummaryResponse.latest_message]: crate::model::GenerateStatelessSummaryResponse::latest_message
pub context_size: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl GenerateStatelessSummaryResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [summary][crate::model::GenerateStatelessSummaryResponse::summary].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSummaryResponse;
/// use google_cloud_dialogflow_v2::model::generate_stateless_summary_response::Summary;
/// let x = GenerateStatelessSummaryResponse::new().set_summary(Summary::default()/* use setters */);
/// ```
pub fn set_summary<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::generate_stateless_summary_response::Summary>,
{
self.summary = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [summary][crate::model::GenerateStatelessSummaryResponse::summary].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSummaryResponse;
/// use google_cloud_dialogflow_v2::model::generate_stateless_summary_response::Summary;
/// let x = GenerateStatelessSummaryResponse::new().set_or_clear_summary(Some(Summary::default()/* use setters */));
/// let x = GenerateStatelessSummaryResponse::new().set_or_clear_summary(None::<Summary>);
/// ```
pub fn set_or_clear_summary<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::generate_stateless_summary_response::Summary>,
{
self.summary = v.map(|x| x.into());
self
}
/// Sets the value of [latest_message][crate::model::GenerateStatelessSummaryResponse::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSummaryResponse;
/// let x = GenerateStatelessSummaryResponse::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [context_size][crate::model::GenerateStatelessSummaryResponse::context_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSummaryResponse;
/// let x = GenerateStatelessSummaryResponse::new().set_context_size(42);
/// ```
pub fn set_context_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.context_size = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for GenerateStatelessSummaryResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GenerateStatelessSummaryResponse"
}
}
/// Defines additional types related to [GenerateStatelessSummaryResponse].
#[cfg(feature = "conversations")]
pub mod generate_stateless_summary_response {
#[allow(unused_imports)]
use super::*;
/// Generated summary for a conversation.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Summary {
/// The summary content that is concatenated into one string.
pub text: std::string::String,
/// The summary content that is divided into sections. The key is the
/// section's name and the value is the section's content. There is no
/// specific format for the key or value.
pub text_sections: std::collections::HashMap<std::string::String, std::string::String>,
/// The baseline model version used to generate this summary. It is empty if
/// a baseline model was not used to generate this summary.
pub baseline_model_version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl Summary {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [text][crate::model::generate_stateless_summary_response::Summary::text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generate_stateless_summary_response::Summary;
/// let x = Summary::new().set_text("example");
/// ```
pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.text = v.into();
self
}
/// Sets the value of [text_sections][crate::model::generate_stateless_summary_response::Summary::text_sections].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generate_stateless_summary_response::Summary;
/// let x = Summary::new().set_text_sections([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_text_sections<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.text_sections = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [baseline_model_version][crate::model::generate_stateless_summary_response::Summary::baseline_model_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generate_stateless_summary_response::Summary;
/// let x = Summary::new().set_baseline_model_version("example");
/// ```
pub fn set_baseline_model_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.baseline_model_version = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for Summary {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GenerateStatelessSummaryResponse.Summary"
}
}
}
/// The request message for
/// [Conversations.GenerateStatelessSuggestion][google.cloud.dialogflow.v2.Conversations.GenerateStatelessSuggestion].
///
/// [google.cloud.dialogflow.v2.Conversations.GenerateStatelessSuggestion]: crate::client::Conversations::generate_stateless_suggestion
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateStatelessSuggestionRequest {
/// Required. The parent resource to charge for the Suggestion's generation.
/// Format: `projects/<Project ID>/locations/<Location ID>`.
pub parent: std::string::String,
/// Optional. A section of ingested context information. The key is the name of
/// the context reference and the value contains the contents of the context
/// reference. The key is used to incorporate ingested context references to
/// enhance the generator.
pub context_references: std::collections::HashMap<
std::string::String,
crate::model::conversation::ContextReference,
>,
/// Optional. Context of the conversation, including transcripts.
pub conversation_context: std::option::Option<crate::model::ConversationContext>,
/// Optional. A list of trigger events. Generator will be triggered only if
/// it's trigger event is included here.
pub trigger_events: std::vec::Vec<crate::model::TriggerEvent>,
/// Optional. Name of the CX SecuritySettings which is used to redact generated
/// response. If this field is empty, try to fetch v2 security_settings, which
/// is a project level setting. If this field is empty and no v2
/// security_settings set up in this project, no redaction will be done.
///
/// Format:
/// `projects/<Project ID>/locations/<Location ID>/securitySettings/<Security
/// Settings ID>`.
pub security_settings: std::string::String,
/// Generator.
pub generator_resource:
std::option::Option<crate::model::generate_stateless_suggestion_request::GeneratorResource>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl GenerateStatelessSuggestionRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::GenerateStatelessSuggestionRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSuggestionRequest;
/// let x = GenerateStatelessSuggestionRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [context_references][crate::model::GenerateStatelessSuggestionRequest::context_references].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSuggestionRequest;
/// use google_cloud_dialogflow_v2::model::conversation::ContextReference;
/// let x = GenerateStatelessSuggestionRequest::new().set_context_references([
/// ("key0", ContextReference::default()/* use setters */),
/// ("key1", ContextReference::default()/* use (different) setters */),
/// ]);
/// ```
pub fn set_context_references<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::conversation::ContextReference>,
{
use std::iter::Iterator;
self.context_references = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [conversation_context][crate::model::GenerateStatelessSuggestionRequest::conversation_context].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSuggestionRequest;
/// use google_cloud_dialogflow_v2::model::ConversationContext;
/// let x = GenerateStatelessSuggestionRequest::new().set_conversation_context(ConversationContext::default()/* use setters */);
/// ```
pub fn set_conversation_context<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ConversationContext>,
{
self.conversation_context = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [conversation_context][crate::model::GenerateStatelessSuggestionRequest::conversation_context].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSuggestionRequest;
/// use google_cloud_dialogflow_v2::model::ConversationContext;
/// let x = GenerateStatelessSuggestionRequest::new().set_or_clear_conversation_context(Some(ConversationContext::default()/* use setters */));
/// let x = GenerateStatelessSuggestionRequest::new().set_or_clear_conversation_context(None::<ConversationContext>);
/// ```
pub fn set_or_clear_conversation_context<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ConversationContext>,
{
self.conversation_context = v.map(|x| x.into());
self
}
/// Sets the value of [trigger_events][crate::model::GenerateStatelessSuggestionRequest::trigger_events].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSuggestionRequest;
/// use google_cloud_dialogflow_v2::model::TriggerEvent;
/// let x = GenerateStatelessSuggestionRequest::new().set_trigger_events([
/// TriggerEvent::EndOfUtterance,
/// TriggerEvent::ManualCall,
/// TriggerEvent::CustomerMessage,
/// ]);
/// ```
pub fn set_trigger_events<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::TriggerEvent>,
{
use std::iter::Iterator;
self.trigger_events = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [security_settings][crate::model::GenerateStatelessSuggestionRequest::security_settings].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSuggestionRequest;
/// let x = GenerateStatelessSuggestionRequest::new().set_security_settings("example");
/// ```
pub fn set_security_settings<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.security_settings = v.into();
self
}
/// Sets the value of [generator_resource][crate::model::GenerateStatelessSuggestionRequest::generator_resource].
///
/// Note that all the setters affecting `generator_resource` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSuggestionRequest;
/// use google_cloud_dialogflow_v2::model::generate_stateless_suggestion_request::GeneratorResource;
/// let x = GenerateStatelessSuggestionRequest::new().set_generator_resource(Some(GeneratorResource::GeneratorName("example".to_string())));
/// ```
pub fn set_generator_resource<
T: std::convert::Into<
std::option::Option<
crate::model::generate_stateless_suggestion_request::GeneratorResource,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.generator_resource = v.into();
self
}
/// The value of [generator_resource][crate::model::GenerateStatelessSuggestionRequest::generator_resource]
/// if it holds a `Generator`, `None` if the field is not set or
/// holds a different branch.
pub fn generator(&self) -> std::option::Option<&std::boxed::Box<crate::model::Generator>> {
#[allow(unreachable_patterns)]
self.generator_resource.as_ref().and_then(|v| match v {
crate::model::generate_stateless_suggestion_request::GeneratorResource::Generator(
v,
) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [generator_resource][crate::model::GenerateStatelessSuggestionRequest::generator_resource]
/// to hold a `Generator`.
///
/// Note that all the setters affecting `generator_resource` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSuggestionRequest;
/// use google_cloud_dialogflow_v2::model::Generator;
/// let x = GenerateStatelessSuggestionRequest::new().set_generator(Generator::default()/* use setters */);
/// assert!(x.generator().is_some());
/// assert!(x.generator_name().is_none());
/// ```
pub fn set_generator<T: std::convert::Into<std::boxed::Box<crate::model::Generator>>>(
mut self,
v: T,
) -> Self {
self.generator_resource = std::option::Option::Some(
crate::model::generate_stateless_suggestion_request::GeneratorResource::Generator(
v.into(),
),
);
self
}
/// The value of [generator_resource][crate::model::GenerateStatelessSuggestionRequest::generator_resource]
/// if it holds a `GeneratorName`, `None` if the field is not set or
/// holds a different branch.
pub fn generator_name(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.generator_resource.as_ref().and_then(|v| match v {
crate::model::generate_stateless_suggestion_request::GeneratorResource::GeneratorName(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [generator_resource][crate::model::GenerateStatelessSuggestionRequest::generator_resource]
/// to hold a `GeneratorName`.
///
/// Note that all the setters affecting `generator_resource` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSuggestionRequest;
/// let x = GenerateStatelessSuggestionRequest::new().set_generator_name("example");
/// assert!(x.generator_name().is_some());
/// assert!(x.generator().is_none());
/// ```
pub fn set_generator_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.generator_resource = std::option::Option::Some(
crate::model::generate_stateless_suggestion_request::GeneratorResource::GeneratorName(
v.into(),
),
);
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for GenerateStatelessSuggestionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GenerateStatelessSuggestionRequest"
}
}
/// Defines additional types related to [GenerateStatelessSuggestionRequest].
#[cfg(feature = "conversations")]
pub mod generate_stateless_suggestion_request {
#[allow(unused_imports)]
use super::*;
/// Generator.
#[cfg(feature = "conversations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum GeneratorResource {
/// Uncreated generator. It should be a complete generator that includes all
/// information about the generator.
Generator(std::boxed::Box<crate::model::Generator>),
/// The resource name of the existing created generator. Format:
/// `projects/<Project ID>/locations/<Location ID>/generators/<Generator ID>`
GeneratorName(std::string::String),
}
}
/// The response message for
/// [Conversations.GenerateStatelessSuggestion][google.cloud.dialogflow.v2.Conversations.GenerateStatelessSuggestion].
///
/// [google.cloud.dialogflow.v2.Conversations.GenerateStatelessSuggestion]: crate::client::Conversations::generate_stateless_suggestion
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateStatelessSuggestionResponse {
/// Required. Generated suggestion for a conversation.
pub generator_suggestion: std::option::Option<crate::model::GeneratorSuggestion>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl GenerateStatelessSuggestionResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [generator_suggestion][crate::model::GenerateStatelessSuggestionResponse::generator_suggestion].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSuggestionResponse;
/// use google_cloud_dialogflow_v2::model::GeneratorSuggestion;
/// let x = GenerateStatelessSuggestionResponse::new().set_generator_suggestion(GeneratorSuggestion::default()/* use setters */);
/// ```
pub fn set_generator_suggestion<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GeneratorSuggestion>,
{
self.generator_suggestion = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [generator_suggestion][crate::model::GenerateStatelessSuggestionResponse::generator_suggestion].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateStatelessSuggestionResponse;
/// use google_cloud_dialogflow_v2::model::GeneratorSuggestion;
/// let x = GenerateStatelessSuggestionResponse::new().set_or_clear_generator_suggestion(Some(GeneratorSuggestion::default()/* use setters */));
/// let x = GenerateStatelessSuggestionResponse::new().set_or_clear_generator_suggestion(None::<GeneratorSuggestion>);
/// ```
pub fn set_or_clear_generator_suggestion<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GeneratorSuggestion>,
{
self.generator_suggestion = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for GenerateStatelessSuggestionResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GenerateStatelessSuggestionResponse"
}
}
/// The request message for
/// [Conversations.SearchKnowledge][google.cloud.dialogflow.v2.Conversations.SearchKnowledge].
///
/// [google.cloud.dialogflow.v2.Conversations.SearchKnowledge]: crate::client::Conversations::search_knowledge
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchKnowledgeRequest {
/// Required. The parent resource contains the conversation profile
/// Format: 'projects/\<Project ID\>' or `projects/<Project
/// ID>/locations/<Location ID>`.
pub parent: std::string::String,
/// Required. The natural language text query for knowledge search.
pub query: std::option::Option<crate::model::TextInput>,
/// Required. The conversation profile used to configure the search.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversationProfiles/<Conversation Profile ID>`.
pub conversation_profile: std::string::String,
/// Required. The ID of the search session.
/// The session_id can be combined with Dialogflow V3 Agent ID retrieved from
/// conversation profile or on its own to identify a search session. The search
/// history of the same session will impact the search result. It's up to the
/// API caller to choose an appropriate `Session ID`. It can be a random number
/// or some type of session identifiers (preferably hashed). The length must
/// not exceed 36 characters.
pub session_id: std::string::String,
/// Optional. The conversation (between human agent and end user) where the
/// search request is triggered. Format: `projects/<Project
/// ID>/locations/<Location ID>/conversations/<Conversation ID>`.
pub conversation: std::string::String,
/// Optional. The name of the latest conversation message when the request is
/// triggered.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub latest_message: std::string::String,
/// Optional. The source of the query in the request.
pub query_source: crate::model::search_knowledge_request::QuerySource,
/// Optional. Information about the end-user to improve the relevance and
/// accuracy of generative answers.
///
/// This will be interpreted and used by a language model, so, for good
/// results, the data should be self-descriptive, and in a simple structure.
///
/// Example:
///
/// ```norust
/// {
/// "subscription plan": "Business Premium Plus",
/// "devices owned": [
/// {"model": "Google Pixel 7"},
/// {"model": "Google Pixel Tablet"}
/// ]
/// }
/// ```
pub end_user_metadata: std::option::Option<wkt::Struct>,
/// Optional. Configuration specific to search queries with data stores.
pub search_config: std::option::Option<crate::model::search_knowledge_request::SearchConfig>,
/// Optional. Whether to search the query exactly without query rewrite.
pub exact_search: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl SearchKnowledgeRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::SearchKnowledgeRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeRequest;
/// let x = SearchKnowledgeRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [query][crate::model::SearchKnowledgeRequest::query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeRequest;
/// use google_cloud_dialogflow_v2::model::TextInput;
/// let x = SearchKnowledgeRequest::new().set_query(TextInput::default()/* use setters */);
/// ```
pub fn set_query<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TextInput>,
{
self.query = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query][crate::model::SearchKnowledgeRequest::query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeRequest;
/// use google_cloud_dialogflow_v2::model::TextInput;
/// let x = SearchKnowledgeRequest::new().set_or_clear_query(Some(TextInput::default()/* use setters */));
/// let x = SearchKnowledgeRequest::new().set_or_clear_query(None::<TextInput>);
/// ```
pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TextInput>,
{
self.query = v.map(|x| x.into());
self
}
/// Sets the value of [conversation_profile][crate::model::SearchKnowledgeRequest::conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeRequest;
/// let x = SearchKnowledgeRequest::new().set_conversation_profile("example");
/// ```
pub fn set_conversation_profile<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_profile = v.into();
self
}
/// Sets the value of [session_id][crate::model::SearchKnowledgeRequest::session_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeRequest;
/// let x = SearchKnowledgeRequest::new().set_session_id("example");
/// ```
pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session_id = v.into();
self
}
/// Sets the value of [conversation][crate::model::SearchKnowledgeRequest::conversation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeRequest;
/// let x = SearchKnowledgeRequest::new().set_conversation("example");
/// ```
pub fn set_conversation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.conversation = v.into();
self
}
/// Sets the value of [latest_message][crate::model::SearchKnowledgeRequest::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeRequest;
/// let x = SearchKnowledgeRequest::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [query_source][crate::model::SearchKnowledgeRequest::query_source].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeRequest;
/// use google_cloud_dialogflow_v2::model::search_knowledge_request::QuerySource;
/// let x0 = SearchKnowledgeRequest::new().set_query_source(QuerySource::AgentQuery);
/// let x1 = SearchKnowledgeRequest::new().set_query_source(QuerySource::SuggestedQuery);
/// ```
pub fn set_query_source<
T: std::convert::Into<crate::model::search_knowledge_request::QuerySource>,
>(
mut self,
v: T,
) -> Self {
self.query_source = v.into();
self
}
/// Sets the value of [end_user_metadata][crate::model::SearchKnowledgeRequest::end_user_metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeRequest;
/// use wkt::Struct;
/// let x = SearchKnowledgeRequest::new().set_end_user_metadata(Struct::default()/* use setters */);
/// ```
pub fn set_end_user_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.end_user_metadata = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [end_user_metadata][crate::model::SearchKnowledgeRequest::end_user_metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeRequest;
/// use wkt::Struct;
/// let x = SearchKnowledgeRequest::new().set_or_clear_end_user_metadata(Some(Struct::default()/* use setters */));
/// let x = SearchKnowledgeRequest::new().set_or_clear_end_user_metadata(None::<Struct>);
/// ```
pub fn set_or_clear_end_user_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.end_user_metadata = v.map(|x| x.into());
self
}
/// Sets the value of [search_config][crate::model::SearchKnowledgeRequest::search_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeRequest;
/// use google_cloud_dialogflow_v2::model::search_knowledge_request::SearchConfig;
/// let x = SearchKnowledgeRequest::new().set_search_config(SearchConfig::default()/* use setters */);
/// ```
pub fn set_search_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_knowledge_request::SearchConfig>,
{
self.search_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [search_config][crate::model::SearchKnowledgeRequest::search_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeRequest;
/// use google_cloud_dialogflow_v2::model::search_knowledge_request::SearchConfig;
/// let x = SearchKnowledgeRequest::new().set_or_clear_search_config(Some(SearchConfig::default()/* use setters */));
/// let x = SearchKnowledgeRequest::new().set_or_clear_search_config(None::<SearchConfig>);
/// ```
pub fn set_or_clear_search_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_knowledge_request::SearchConfig>,
{
self.search_config = v.map(|x| x.into());
self
}
/// Sets the value of [exact_search][crate::model::SearchKnowledgeRequest::exact_search].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeRequest;
/// let x = SearchKnowledgeRequest::new().set_exact_search(true);
/// ```
pub fn set_exact_search<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.exact_search = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for SearchKnowledgeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchKnowledgeRequest"
}
}
/// Defines additional types related to [SearchKnowledgeRequest].
#[cfg(feature = "conversations")]
pub mod search_knowledge_request {
#[allow(unused_imports)]
use super::*;
/// Configuration specific to search queries with data stores.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchConfig {
/// Optional. Boost specifications for data stores.
///
/// Maps from datastore name to their boost configuration. Do not specify
/// more than one BoostSpecs for each datastore name. If multiple BoostSpecs
/// are provided for the same datastore name, the behavior is undefined.
pub boost_specs:
std::vec::Vec<crate::model::search_knowledge_request::search_config::BoostSpecs>,
/// Optional. Filter specification for data store queries.
///
/// TMaps from datastore name to the filter expression for that datastore. Do
/// not specify more than one FilterSpecs for each datastore name. If
/// multiple FilterSpecs are provided for the same datastore name, the
/// behavior is undefined.
pub filter_specs:
std::vec::Vec<crate::model::search_knowledge_request::search_config::FilterSpecs>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl SearchConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [boost_specs][crate::model::search_knowledge_request::SearchConfig::boost_specs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::SearchConfig;
/// use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::BoostSpecs;
/// let x = SearchConfig::new()
/// .set_boost_specs([
/// BoostSpecs::default()/* use setters */,
/// BoostSpecs::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_boost_specs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::search_knowledge_request::search_config::BoostSpecs,
>,
{
use std::iter::Iterator;
self.boost_specs = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [filter_specs][crate::model::search_knowledge_request::SearchConfig::filter_specs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::SearchConfig;
/// use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::FilterSpecs;
/// let x = SearchConfig::new()
/// .set_filter_specs([
/// FilterSpecs::default()/* use setters */,
/// FilterSpecs::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_filter_specs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::search_knowledge_request::search_config::FilterSpecs,
>,
{
use std::iter::Iterator;
self.filter_specs = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for SearchConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig"
}
}
/// Defines additional types related to [SearchConfig].
#[cfg(feature = "conversations")]
pub mod search_config {
#[allow(unused_imports)]
use super::*;
/// Boost specifications for data stores.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BoostSpecs {
/// Optional. Data Stores where the boosting configuration is applied. The
/// full names of the referenced data stores. Formats:
/// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
/// `projects/{project}/locations/{location}/dataStores/{data_store}`
pub data_stores: std::vec::Vec<std::string::String>,
/// Optional. A list of boosting specifications.
pub spec: std::vec::Vec<
crate::model::search_knowledge_request::search_config::boost_specs::BoostSpec,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl BoostSpecs {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [data_stores][crate::model::search_knowledge_request::search_config::BoostSpecs::data_stores].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::BoostSpecs;
/// let x = BoostSpecs::new().set_data_stores(["a", "b", "c"]);
/// ```
pub fn set_data_stores<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.data_stores = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [spec][crate::model::search_knowledge_request::search_config::BoostSpecs::spec].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::BoostSpecs;
/// use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::BoostSpec;
/// let x = BoostSpecs::new()
/// .set_spec([
/// BoostSpec::default()/* use setters */,
/// BoostSpec::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_spec<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::search_knowledge_request::search_config::boost_specs::BoostSpec>
{
use std::iter::Iterator;
self.spec = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for BoostSpecs {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs"
}
}
/// Defines additional types related to [BoostSpecs].
#[cfg(feature = "conversations")]
pub mod boost_specs {
#[allow(unused_imports)]
use super::*;
/// Boost specification to boost certain documents.
/// A copy of google.cloud.discoveryengine.v1main.BoostSpec, field
/// documentation is available at
/// <https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1alpha/BoostSpec>
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BoostSpec {
/// Optional. Condition boost specifications. If a document matches
/// multiple conditions in the specifications, boost scores from these
/// specifications are all applied and combined in a non-linear way.
/// Maximum number of specifications is 20.
pub condition_boost_specs: std::vec::Vec<crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::ConditionBoostSpec>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl BoostSpec {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [condition_boost_specs][crate::model::search_knowledge_request::search_config::boost_specs::BoostSpec::condition_boost_specs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::BoostSpec;
/// use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::ConditionBoostSpec;
/// let x = BoostSpec::new()
/// .set_condition_boost_specs([
/// ConditionBoostSpec::default()/* use setters */,
/// ConditionBoostSpec::default()/* use (different) setters */,
/// ]);
/// ```
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_knowledge_request::search_config::boost_specs::boost_spec::ConditionBoostSpec>
{
use std::iter::Iterator;
self.condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for BoostSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec"
}
}
/// Defines additional types related to [BoostSpec].
#[cfg(feature = "conversations")]
pub mod boost_spec {
#[allow(unused_imports)]
use super::*;
/// Boost applies to documents which match a condition.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConditionBoostSpec {
/// Optional. An expression which specifies a boost condition. The
/// syntax and supported fields are the same as a filter expression.
/// Examples:
///
/// * To boost documents with document ID "doc_1" or "doc_2", and
/// color
/// "Red" or "Blue":
/// * (id: ANY("doc_1", "doc_2")) AND (color: ANY("Red","Blue"))
pub condition: std::string::String,
/// Optional. Strength of the condition boost, which should be in [-1,
/// 1]. Negative boost means demotion. Default is 0.0.
///
/// Setting to 1.0 gives the document a big promotion. However, it does
/// not necessarily mean that the boosted document will be the top
/// result at all times, nor that other documents will be excluded.
/// Results could still be shown even when none of them matches the
/// condition. And results that are significantly more relevant to the
/// search query can still trump your heavily favored but irrelevant
/// documents.
///
/// Setting to -1.0 gives the document a big demotion. However, results
/// that are deeply relevant might still be shown. The document will
/// have an upstream battle to get a fairly high ranking, but it is not
/// blocked out completely.
///
/// Setting to 0.0 means no boost applied. The boosting condition is
/// ignored.
pub boost: f32,
/// Optional. Complex specification for custom ranking based on
/// customer defined attribute value.
pub boost_control_spec: std::option::Option<crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::BoostControlSpec>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl ConditionBoostSpec {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [condition][crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::ConditionBoostSpec::condition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::ConditionBoostSpec;
/// let x = ConditionBoostSpec::new().set_condition("example");
/// ```
pub fn set_condition<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.condition = v.into();
self
}
/// Sets the value of [boost][crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::ConditionBoostSpec::boost].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::ConditionBoostSpec;
/// let x = ConditionBoostSpec::new().set_boost(42.0);
/// ```
pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.boost = v.into();
self
}
/// Sets the value of [boost_control_spec][crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::ConditionBoostSpec::boost_control_spec].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::ConditionBoostSpec;
/// use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::BoostControlSpec;
/// let x = ConditionBoostSpec::new().set_boost_control_spec(BoostControlSpec::default()/* use setters */);
/// ```
pub fn set_boost_control_spec<T>(mut self, v: T) -> Self
where T: std::convert::Into<crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::BoostControlSpec>
{
self.boost_control_spec = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [boost_control_spec][crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::ConditionBoostSpec::boost_control_spec].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::ConditionBoostSpec;
/// use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::BoostControlSpec;
/// let x = ConditionBoostSpec::new().set_or_clear_boost_control_spec(Some(BoostControlSpec::default()/* use setters */));
/// let x = ConditionBoostSpec::new().set_or_clear_boost_control_spec(None::<BoostControlSpec>);
/// ```
pub fn set_or_clear_boost_control_spec<T>(mut self, v: std::option::Option<T>) -> Self
where T: std::convert::Into<crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::BoostControlSpec>
{
self.boost_control_spec = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for ConditionBoostSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec"
}
}
/// Defines additional types related to [ConditionBoostSpec].
#[cfg(feature = "conversations")]
pub mod condition_boost_spec {
#[allow(unused_imports)]
use super::*;
/// Specification for custom ranking based on customer specified
/// attribute
/// value. It provides more controls for customized ranking than the
/// simple (condition, boost) combination above.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BoostControlSpec {
/// Optional. The name of the field whose value will be used to
/// determine the boost amount.
pub field_name: std::string::String,
/// Optional. The attribute type to be used to determine the boost
/// amount. The attribute value can be derived from the field value
/// of the specified field_name. In the case of numerical it is
/// straightforward i.e. attribute_value = numerical_field_value. In
/// the case of freshness however, attribute_value = (time.now() -
/// datetime_field_value).
pub attribute_type: crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::boost_control_spec::AttributeType,
/// Optional. The interpolation type to be applied to connect the
/// control points listed below.
pub interpolation_type: crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::boost_control_spec::InterpolationType,
/// Optional. The control points used to define the curve. The
/// monotonic function (defined through the interpolation_type above)
/// passes through the control points listed here.
pub control_points: std::vec::Vec<crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::boost_control_spec::ControlPoint>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl BoostControlSpec {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [field_name][crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::BoostControlSpec::field_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::BoostControlSpec;
/// let x = BoostControlSpec::new().set_field_name("example");
/// ```
pub fn set_field_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.field_name = v.into();
self
}
/// Sets the value of [attribute_type][crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::BoostControlSpec::attribute_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::BoostControlSpec;
/// use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::boost_control_spec::AttributeType;
/// let x0 = BoostControlSpec::new().set_attribute_type(AttributeType::Numerical);
/// let x1 = BoostControlSpec::new().set_attribute_type(AttributeType::Freshness);
/// ```
pub fn set_attribute_type<T: std::convert::Into<crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::boost_control_spec::AttributeType>>(mut self, v: T) -> Self{
self.attribute_type = v.into();
self
}
/// Sets the value of [interpolation_type][crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::BoostControlSpec::interpolation_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::BoostControlSpec;
/// use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::boost_control_spec::InterpolationType;
/// let x0 = BoostControlSpec::new().set_interpolation_type(InterpolationType::Linear);
/// ```
pub fn set_interpolation_type<T: std::convert::Into<crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::boost_control_spec::InterpolationType>>(mut self, v: T) -> Self{
self.interpolation_type = v.into();
self
}
/// Sets the value of [control_points][crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::BoostControlSpec::control_points].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::BoostControlSpec;
/// use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::boost_control_spec::ControlPoint;
/// let x = BoostControlSpec::new()
/// .set_control_points([
/// ControlPoint::default()/* use setters */,
/// ControlPoint::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_control_points<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::boost_control_spec::ControlPoint>
{
use std::iter::Iterator;
self.control_points = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for BoostControlSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec"
}
}
/// Defines additional types related to [BoostControlSpec].
#[cfg(feature = "conversations")]
pub mod boost_control_spec {
#[allow(unused_imports)]
use super::*;
/// The control points used to define the curve. The curve defined
/// through these control points can only be monotonically increasing
/// or decreasing(constant values are acceptable).
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ControlPoint {
/// Optional. Can be one of:
///
/// 1. The numerical field value.
/// 1. The duration spec for freshness:
/// The value must be formatted as an XSD `dayTimeDuration` value
/// (a restricted subset of an ISO 8601 duration value). The
/// pattern for this is: `[nD][T[nH][nM][nS]]`.
pub attribute_value: std::string::String,
/// Optional. The value between -1 to 1 by which to boost the score
/// if the attribute_value evaluates to the value specified above.
pub boost_amount: f32,
pub(crate) _unknown_fields:
serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl ControlPoint {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [attribute_value][crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::boost_control_spec::ControlPoint::attribute_value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::boost_control_spec::ControlPoint;
/// let x = ControlPoint::new().set_attribute_value("example");
/// ```
pub fn set_attribute_value<
T: std::convert::Into<std::string::String>,
>(
mut self,
v: T,
) -> Self {
self.attribute_value = v.into();
self
}
/// Sets the value of [boost_amount][crate::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::boost_control_spec::ControlPoint::boost_amount].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::boost_specs::boost_spec::condition_boost_spec::boost_control_spec::ControlPoint;
/// let x = ControlPoint::new().set_boost_amount(42.0);
/// ```
pub fn set_boost_amount<T: std::convert::Into<f32>>(
mut self,
v: T,
) -> Self {
self.boost_amount = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for ControlPoint {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.ControlPoint"
}
}
/// The attribute(or function) for which the custom ranking is to be
/// applied.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "conversations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AttributeType {
/// Unspecified AttributeType.
Unspecified,
/// The value of the numerical field will be used to dynamically
/// update the boost amount. In this case, the attribute_value (the
/// x value) of the control point will be the actual value of the
/// numerical field for which the boost_amount is specified.
Numerical,
/// For the freshness use case the attribute value will be the
/// duration between the current time and the date in the datetime
/// field specified. The value must be formatted as an XSD
/// `dayTimeDuration` value (a restricted subset of an ISO 8601
/// duration value). The pattern for this is:
/// `[nD][T[nH][nM][nS]]`. E.g. `5D`, `3DT12H30M`, `T24H`.
Freshness,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [AttributeType::value] or
/// [AttributeType::name].
UnknownValue(attribute_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "conversations")]
pub mod attribute_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "conversations")]
impl AttributeType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Numerical => std::option::Option::Some(1),
Self::Freshness => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("ATTRIBUTE_TYPE_UNSPECIFIED")
}
Self::Numerical => std::option::Option::Some("NUMERICAL"),
Self::Freshness => std::option::Option::Some("FRESHNESS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "conversations")]
impl std::default::Default for AttributeType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "conversations")]
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())
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<i32> for AttributeType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Numerical,
2 => Self::Freshness,
_ => Self::UnknownValue(attribute_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<&str> for AttributeType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ATTRIBUTE_TYPE_UNSPECIFIED" => Self::Unspecified,
"NUMERICAL" => Self::Numerical,
"FRESHNESS" => Self::Freshness,
_ => Self::UnknownValue(attribute_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "conversations")]
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::Unspecified => serializer.serialize_i32(0),
Self::Numerical => serializer.serialize_i32(1),
Self::Freshness => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "conversations")]
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.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.AttributeType"))
}
}
/// The interpolation type to be applied. Default will be linear
/// (Piecewise Linear).
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "conversations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum InterpolationType {
/// Interpolation type is unspecified. In this case, it defaults to
/// Linear.
Unspecified,
/// Piecewise linear interpolation will be applied.
Linear,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [InterpolationType::value] or
/// [InterpolationType::name].
UnknownValue(interpolation_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "conversations")]
pub mod interpolation_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "conversations")]
impl InterpolationType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Linear => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("INTERPOLATION_TYPE_UNSPECIFIED")
}
Self::Linear => std::option::Option::Some("LINEAR"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "conversations")]
impl std::default::Default for InterpolationType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "conversations")]
impl std::fmt::Display for InterpolationType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error>
{
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<i32> for InterpolationType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Linear,
_ => Self::UnknownValue(interpolation_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<&str> for InterpolationType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"INTERPOLATION_TYPE_UNSPECIFIED" => Self::Unspecified,
"LINEAR" => Self::Linear,
_ => Self::UnknownValue(interpolation_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "conversations")]
impl serde::ser::Serialize for InterpolationType {
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::Linear => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "conversations")]
impl<'de> serde::de::Deserialize<'de> for InterpolationType {
fn deserialize<D>(
deserializer: D,
) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<InterpolationType>::new(
".google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.BoostSpecs.BoostSpec.ConditionBoostSpec.BoostControlSpec.InterpolationType"))
}
}
}
}
}
}
/// Filter specification for data store queries.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FilterSpecs {
/// Optional. The data store where the filter configuration is applied.
/// Full resource name of data store, such as
/// projects/{project}/locations/{location}/collections/{collectionId}/
/// dataStores/{dataStoreId}.
pub data_stores: std::vec::Vec<std::string::String>,
/// Optional. The filter expression to be applied.
/// Expression syntax is documented at
/// <https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata#filter-expression-syntax>
pub filter: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl FilterSpecs {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [data_stores][crate::model::search_knowledge_request::search_config::FilterSpecs::data_stores].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::FilterSpecs;
/// let x = FilterSpecs::new().set_data_stores(["a", "b", "c"]);
/// ```
pub fn set_data_stores<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.data_stores = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [filter][crate::model::search_knowledge_request::search_config::FilterSpecs::filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_request::search_config::FilterSpecs;
/// let x = FilterSpecs::new().set_filter("example");
/// ```
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for FilterSpecs {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchKnowledgeRequest.SearchConfig.FilterSpecs"
}
}
}
/// The source of the query. We use QuerySource to distinguish queries directly
/// entered by agents and suggested queries from
/// [Participants.SuggestKnowledgeAssist][google.cloud.dialogflow.v2.Participants.SuggestKnowledgeAssist].
/// If SUGGESTED_QUERY source is specified, we will treat it as a continuation
/// of a SuggestKnowledgeAssist call.
///
/// [google.cloud.dialogflow.v2.Participants.SuggestKnowledgeAssist]: crate::client::Participants::suggest_knowledge_assist
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "conversations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum QuerySource {
/// Unknown query source.
Unspecified,
/// The query is from agents.
AgentQuery,
/// The query is a suggested query from
/// [Participants.SuggestKnowledgeAssist][google.cloud.dialogflow.v2.Participants.SuggestKnowledgeAssist].
///
/// [google.cloud.dialogflow.v2.Participants.SuggestKnowledgeAssist]: crate::client::Participants::suggest_knowledge_assist
SuggestedQuery,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [QuerySource::value] or
/// [QuerySource::name].
UnknownValue(query_source::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "conversations")]
pub mod query_source {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "conversations")]
impl QuerySource {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::AgentQuery => std::option::Option::Some(1),
Self::SuggestedQuery => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("QUERY_SOURCE_UNSPECIFIED"),
Self::AgentQuery => std::option::Option::Some("AGENT_QUERY"),
Self::SuggestedQuery => std::option::Option::Some("SUGGESTED_QUERY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "conversations")]
impl std::default::Default for QuerySource {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "conversations")]
impl std::fmt::Display for QuerySource {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<i32> for QuerySource {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::AgentQuery,
2 => Self::SuggestedQuery,
_ => Self::UnknownValue(query_source::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<&str> for QuerySource {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"QUERY_SOURCE_UNSPECIFIED" => Self::Unspecified,
"AGENT_QUERY" => Self::AgentQuery,
"SUGGESTED_QUERY" => Self::SuggestedQuery,
_ => Self::UnknownValue(query_source::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "conversations")]
impl serde::ser::Serialize for QuerySource {
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::AgentQuery => serializer.serialize_i32(1),
Self::SuggestedQuery => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "conversations")]
impl<'de> serde::de::Deserialize<'de> for QuerySource {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<QuerySource>::new(
".google.cloud.dialogflow.v2.SearchKnowledgeRequest.QuerySource",
))
}
}
}
/// Debug information related to SearchKnowledge feature.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchKnowledgeDebugInfo {
/// Response reason from datastore which indicates data serving status or
/// answer quality degradation.
pub datastore_response_reason: crate::model::DatastoreResponseReason,
/// Configured behaviors for SearchKnowledge.
pub search_knowledge_behavior:
std::option::Option<crate::model::search_knowledge_debug_info::SearchKnowledgeBehavior>,
/// Information about parameters ingested for search knowledge.
pub ingested_context_reference_debug_info:
std::option::Option<crate::model::IngestedContextReferenceDebugInfo>,
/// The latency of the service.
pub service_latency: std::option::Option<crate::model::ServiceLatency>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl SearchKnowledgeDebugInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [datastore_response_reason][crate::model::SearchKnowledgeDebugInfo::datastore_response_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeDebugInfo;
/// use google_cloud_dialogflow_v2::model::DatastoreResponseReason;
/// let x0 = SearchKnowledgeDebugInfo::new().set_datastore_response_reason(DatastoreResponseReason::None);
/// let x1 = SearchKnowledgeDebugInfo::new().set_datastore_response_reason(DatastoreResponseReason::SearchOutOfQuota);
/// let x2 = SearchKnowledgeDebugInfo::new().set_datastore_response_reason(DatastoreResponseReason::SearchEmptyResults);
/// ```
pub fn set_datastore_response_reason<
T: std::convert::Into<crate::model::DatastoreResponseReason>,
>(
mut self,
v: T,
) -> Self {
self.datastore_response_reason = v.into();
self
}
/// Sets the value of [search_knowledge_behavior][crate::model::SearchKnowledgeDebugInfo::search_knowledge_behavior].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeDebugInfo;
/// use google_cloud_dialogflow_v2::model::search_knowledge_debug_info::SearchKnowledgeBehavior;
/// let x = SearchKnowledgeDebugInfo::new().set_search_knowledge_behavior(SearchKnowledgeBehavior::default()/* use setters */);
/// ```
pub fn set_search_knowledge_behavior<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::search_knowledge_debug_info::SearchKnowledgeBehavior>,
{
self.search_knowledge_behavior = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [search_knowledge_behavior][crate::model::SearchKnowledgeDebugInfo::search_knowledge_behavior].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeDebugInfo;
/// use google_cloud_dialogflow_v2::model::search_knowledge_debug_info::SearchKnowledgeBehavior;
/// let x = SearchKnowledgeDebugInfo::new().set_or_clear_search_knowledge_behavior(Some(SearchKnowledgeBehavior::default()/* use setters */));
/// let x = SearchKnowledgeDebugInfo::new().set_or_clear_search_knowledge_behavior(None::<SearchKnowledgeBehavior>);
/// ```
pub fn set_or_clear_search_knowledge_behavior<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::search_knowledge_debug_info::SearchKnowledgeBehavior>,
{
self.search_knowledge_behavior = v.map(|x| x.into());
self
}
/// Sets the value of [ingested_context_reference_debug_info][crate::model::SearchKnowledgeDebugInfo::ingested_context_reference_debug_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeDebugInfo;
/// use google_cloud_dialogflow_v2::model::IngestedContextReferenceDebugInfo;
/// let x = SearchKnowledgeDebugInfo::new().set_ingested_context_reference_debug_info(IngestedContextReferenceDebugInfo::default()/* use setters */);
/// ```
pub fn set_ingested_context_reference_debug_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::IngestedContextReferenceDebugInfo>,
{
self.ingested_context_reference_debug_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [ingested_context_reference_debug_info][crate::model::SearchKnowledgeDebugInfo::ingested_context_reference_debug_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeDebugInfo;
/// use google_cloud_dialogflow_v2::model::IngestedContextReferenceDebugInfo;
/// let x = SearchKnowledgeDebugInfo::new().set_or_clear_ingested_context_reference_debug_info(Some(IngestedContextReferenceDebugInfo::default()/* use setters */));
/// let x = SearchKnowledgeDebugInfo::new().set_or_clear_ingested_context_reference_debug_info(None::<IngestedContextReferenceDebugInfo>);
/// ```
pub fn set_or_clear_ingested_context_reference_debug_info<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::IngestedContextReferenceDebugInfo>,
{
self.ingested_context_reference_debug_info = v.map(|x| x.into());
self
}
/// Sets the value of [service_latency][crate::model::SearchKnowledgeDebugInfo::service_latency].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeDebugInfo;
/// use google_cloud_dialogflow_v2::model::ServiceLatency;
/// let x = SearchKnowledgeDebugInfo::new().set_service_latency(ServiceLatency::default()/* use setters */);
/// ```
pub fn set_service_latency<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ServiceLatency>,
{
self.service_latency = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [service_latency][crate::model::SearchKnowledgeDebugInfo::service_latency].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeDebugInfo;
/// use google_cloud_dialogflow_v2::model::ServiceLatency;
/// let x = SearchKnowledgeDebugInfo::new().set_or_clear_service_latency(Some(ServiceLatency::default()/* use setters */));
/// let x = SearchKnowledgeDebugInfo::new().set_or_clear_service_latency(None::<ServiceLatency>);
/// ```
pub fn set_or_clear_service_latency<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ServiceLatency>,
{
self.service_latency = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for SearchKnowledgeDebugInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchKnowledgeDebugInfo"
}
}
/// Defines additional types related to [SearchKnowledgeDebugInfo].
#[cfg(feature = "conversations")]
pub mod search_knowledge_debug_info {
#[allow(unused_imports)]
use super::*;
/// Configured behaviors for SearchKnowledge.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchKnowledgeBehavior {
/// Whether data store agent rewriter was turned on for the request.
pub answer_generation_rewriter_on: bool,
/// Whether end_user_metadata is included in the data store agent call.
pub end_user_metadata_included: bool,
/// This field indicates whether third party connectors are enabled for the
/// project. Note that this field only indicates if the project is
/// allowlisted for connectors.
pub third_party_connector_allowed: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl SearchKnowledgeBehavior {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer_generation_rewriter_on][crate::model::search_knowledge_debug_info::SearchKnowledgeBehavior::answer_generation_rewriter_on].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_debug_info::SearchKnowledgeBehavior;
/// let x = SearchKnowledgeBehavior::new().set_answer_generation_rewriter_on(true);
/// ```
pub fn set_answer_generation_rewriter_on<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.answer_generation_rewriter_on = v.into();
self
}
/// Sets the value of [end_user_metadata_included][crate::model::search_knowledge_debug_info::SearchKnowledgeBehavior::end_user_metadata_included].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_debug_info::SearchKnowledgeBehavior;
/// let x = SearchKnowledgeBehavior::new().set_end_user_metadata_included(true);
/// ```
pub fn set_end_user_metadata_included<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.end_user_metadata_included = v.into();
self
}
/// Sets the value of [third_party_connector_allowed][crate::model::search_knowledge_debug_info::SearchKnowledgeBehavior::third_party_connector_allowed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_debug_info::SearchKnowledgeBehavior;
/// let x = SearchKnowledgeBehavior::new().set_third_party_connector_allowed(true);
/// ```
pub fn set_third_party_connector_allowed<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.third_party_connector_allowed = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for SearchKnowledgeBehavior {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchKnowledgeDebugInfo.SearchKnowledgeBehavior"
}
}
}
/// The response message for
/// [Conversations.SearchKnowledge][google.cloud.dialogflow.v2.Conversations.SearchKnowledge].
///
/// [google.cloud.dialogflow.v2.Conversations.SearchKnowledge]: crate::client::Conversations::search_knowledge
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchKnowledgeResponse {
/// Most relevant snippets extracted from articles in the given knowledge base,
/// ordered by confidence.
pub answers: std::vec::Vec<crate::model::SearchKnowledgeAnswer>,
/// The rewritten query used to search knowledge.
pub rewritten_query: std::string::String,
/// Debug info for SearchKnowledge.
pub search_knowledge_debug_info: std::option::Option<crate::model::SearchKnowledgeDebugInfo>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl SearchKnowledgeResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answers][crate::model::SearchKnowledgeResponse::answers].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeResponse;
/// use google_cloud_dialogflow_v2::model::SearchKnowledgeAnswer;
/// let x = SearchKnowledgeResponse::new()
/// .set_answers([
/// SearchKnowledgeAnswer::default()/* use setters */,
/// SearchKnowledgeAnswer::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_answers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SearchKnowledgeAnswer>,
{
use std::iter::Iterator;
self.answers = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [rewritten_query][crate::model::SearchKnowledgeResponse::rewritten_query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeResponse;
/// let x = SearchKnowledgeResponse::new().set_rewritten_query("example");
/// ```
pub fn set_rewritten_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.rewritten_query = v.into();
self
}
/// Sets the value of [search_knowledge_debug_info][crate::model::SearchKnowledgeResponse::search_knowledge_debug_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeResponse;
/// use google_cloud_dialogflow_v2::model::SearchKnowledgeDebugInfo;
/// let x = SearchKnowledgeResponse::new().set_search_knowledge_debug_info(SearchKnowledgeDebugInfo::default()/* use setters */);
/// ```
pub fn set_search_knowledge_debug_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SearchKnowledgeDebugInfo>,
{
self.search_knowledge_debug_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [search_knowledge_debug_info][crate::model::SearchKnowledgeResponse::search_knowledge_debug_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeResponse;
/// use google_cloud_dialogflow_v2::model::SearchKnowledgeDebugInfo;
/// let x = SearchKnowledgeResponse::new().set_or_clear_search_knowledge_debug_info(Some(SearchKnowledgeDebugInfo::default()/* use setters */));
/// let x = SearchKnowledgeResponse::new().set_or_clear_search_knowledge_debug_info(None::<SearchKnowledgeDebugInfo>);
/// ```
pub fn set_or_clear_search_knowledge_debug_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SearchKnowledgeDebugInfo>,
{
self.search_knowledge_debug_info = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for SearchKnowledgeResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchKnowledgeResponse"
}
}
/// Represents a SearchKnowledge answer.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SearchKnowledgeAnswer {
/// The piece of text from the knowledge base documents that answers
/// the search query
pub answer: std::string::String,
/// The type of the answer.
pub answer_type: crate::model::search_knowledge_answer::AnswerType,
/// All sources used to generate the answer.
pub answer_sources: std::vec::Vec<crate::model::search_knowledge_answer::AnswerSource>,
/// The name of the answer record.
/// Format: `projects/<Project ID>/locations/<location ID>/answer
/// Records/<Answer Record ID>`
pub answer_record: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl SearchKnowledgeAnswer {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer][crate::model::SearchKnowledgeAnswer::answer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeAnswer;
/// let x = SearchKnowledgeAnswer::new().set_answer("example");
/// ```
pub fn set_answer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.answer = v.into();
self
}
/// Sets the value of [answer_type][crate::model::SearchKnowledgeAnswer::answer_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeAnswer;
/// use google_cloud_dialogflow_v2::model::search_knowledge_answer::AnswerType;
/// let x0 = SearchKnowledgeAnswer::new().set_answer_type(AnswerType::Faq);
/// let x1 = SearchKnowledgeAnswer::new().set_answer_type(AnswerType::Generative);
/// let x2 = SearchKnowledgeAnswer::new().set_answer_type(AnswerType::Intent);
/// ```
pub fn set_answer_type<
T: std::convert::Into<crate::model::search_knowledge_answer::AnswerType>,
>(
mut self,
v: T,
) -> Self {
self.answer_type = v.into();
self
}
/// Sets the value of [answer_sources][crate::model::SearchKnowledgeAnswer::answer_sources].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeAnswer;
/// use google_cloud_dialogflow_v2::model::search_knowledge_answer::AnswerSource;
/// let x = SearchKnowledgeAnswer::new()
/// .set_answer_sources([
/// AnswerSource::default()/* use setters */,
/// AnswerSource::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_answer_sources<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::search_knowledge_answer::AnswerSource>,
{
use std::iter::Iterator;
self.answer_sources = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [answer_record][crate::model::SearchKnowledgeAnswer::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SearchKnowledgeAnswer;
/// let x = SearchKnowledgeAnswer::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.answer_record = v.into();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for SearchKnowledgeAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchKnowledgeAnswer"
}
}
/// Defines additional types related to [SearchKnowledgeAnswer].
#[cfg(feature = "conversations")]
pub mod search_knowledge_answer {
#[allow(unused_imports)]
use super::*;
/// The sources of the answers.
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AnswerSource {
/// The title of the article.
pub title: std::string::String,
/// The URI of the article.
pub uri: std::string::String,
/// The relevant snippet of the article.
pub snippet: std::string::String,
/// Metadata associated with the article.
pub metadata: std::option::Option<wkt::Struct>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl AnswerSource {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [title][crate::model::search_knowledge_answer::AnswerSource::title].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_answer::AnswerSource;
/// let x = AnswerSource::new().set_title("example");
/// ```
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = v.into();
self
}
/// Sets the value of [uri][crate::model::search_knowledge_answer::AnswerSource::uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_answer::AnswerSource;
/// let x = AnswerSource::new().set_uri("example");
/// ```
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
/// Sets the value of [snippet][crate::model::search_knowledge_answer::AnswerSource::snippet].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_answer::AnswerSource;
/// let x = AnswerSource::new().set_snippet("example");
/// ```
pub fn set_snippet<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.snippet = v.into();
self
}
/// Sets the value of [metadata][crate::model::search_knowledge_answer::AnswerSource::metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_answer::AnswerSource;
/// use wkt::Struct;
/// let x = AnswerSource::new().set_metadata(Struct::default()/* use setters */);
/// ```
pub fn set_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.metadata = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [metadata][crate::model::search_knowledge_answer::AnswerSource::metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::search_knowledge_answer::AnswerSource;
/// use wkt::Struct;
/// let x = AnswerSource::new().set_or_clear_metadata(Some(Struct::default()/* use setters */));
/// let x = AnswerSource::new().set_or_clear_metadata(None::<Struct>);
/// ```
pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.metadata = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for AnswerSource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SearchKnowledgeAnswer.AnswerSource"
}
}
/// The type of the answer.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "conversations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AnswerType {
/// The answer has a unspecified type.
Unspecified,
/// The answer is from FAQ documents.
Faq,
/// The answer is from generative model.
Generative,
/// The answer is from intent matching.
Intent,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [AnswerType::value] or
/// [AnswerType::name].
UnknownValue(answer_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "conversations")]
pub mod answer_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "conversations")]
impl AnswerType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Faq => std::option::Option::Some(1),
Self::Generative => std::option::Option::Some(2),
Self::Intent => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ANSWER_TYPE_UNSPECIFIED"),
Self::Faq => std::option::Option::Some("FAQ"),
Self::Generative => std::option::Option::Some("GENERATIVE"),
Self::Intent => std::option::Option::Some("INTENT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "conversations")]
impl std::default::Default for AnswerType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "conversations")]
impl std::fmt::Display for AnswerType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<i32> for AnswerType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Faq,
2 => Self::Generative,
3 => Self::Intent,
_ => Self::UnknownValue(answer_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "conversations")]
impl std::convert::From<&str> for AnswerType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ANSWER_TYPE_UNSPECIFIED" => Self::Unspecified,
"FAQ" => Self::Faq,
"GENERATIVE" => Self::Generative,
"INTENT" => Self::Intent,
_ => Self::UnknownValue(answer_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "conversations")]
impl serde::ser::Serialize for AnswerType {
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::Faq => serializer.serialize_i32(1),
Self::Generative => serializer.serialize_i32(2),
Self::Intent => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "conversations")]
impl<'de> serde::de::Deserialize<'de> for AnswerType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AnswerType>::new(
".google.cloud.dialogflow.v2.SearchKnowledgeAnswer.AnswerType",
))
}
}
}
/// The request message for
/// [Conversations.GenerateSuggestions][google.cloud.dialogflow.v2.Conversations.GenerateSuggestions].
///
/// [google.cloud.dialogflow.v2.Conversations.GenerateSuggestions]: crate::client::Conversations::generate_suggestions
#[cfg(feature = "conversations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateSuggestionsRequest {
/// Required. The conversation for which the suggestions are generated. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>`.
///
/// The conversation must be created with a conversation profile which has
/// generators configured in it to be able to get suggestions.
pub conversation: std::string::String,
/// Optional. The name of the latest conversation message for which the request
/// is triggered. Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub latest_message: std::string::String,
/// Optional. A list of trigger events. Only generators configured in the
/// conversation_profile whose trigger_event is listed here will be triggered.
pub trigger_events: std::vec::Vec<crate::model::TriggerEvent>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversations")]
impl GenerateSuggestionsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation][crate::model::GenerateSuggestionsRequest::conversation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateSuggestionsRequest;
/// let x = GenerateSuggestionsRequest::new().set_conversation("example");
/// ```
pub fn set_conversation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.conversation = v.into();
self
}
/// Sets the value of [latest_message][crate::model::GenerateSuggestionsRequest::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateSuggestionsRequest;
/// let x = GenerateSuggestionsRequest::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [trigger_events][crate::model::GenerateSuggestionsRequest::trigger_events].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateSuggestionsRequest;
/// use google_cloud_dialogflow_v2::model::TriggerEvent;
/// let x = GenerateSuggestionsRequest::new().set_trigger_events([
/// TriggerEvent::EndOfUtterance,
/// TriggerEvent::ManualCall,
/// TriggerEvent::CustomerMessage,
/// ]);
/// ```
pub fn set_trigger_events<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::TriggerEvent>,
{
use std::iter::Iterator;
self.trigger_events = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "conversations")]
impl wkt::message::Message for GenerateSuggestionsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GenerateSuggestionsRequest"
}
}
/// Represents metadata of a conversation.
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationInfo {
/// Optional. The language code of the conversation data within this dataset.
/// See <https://cloud.google.com/apis/design/standard_fields> for more
/// information. Supports all UTF-8 languages.
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-datasets")]
impl ConversationInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [language_code][crate::model::ConversationInfo::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationInfo;
/// let x = ConversationInfo::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
#[cfg(feature = "conversation-datasets")]
impl wkt::message::Message for ConversationInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ConversationInfo"
}
}
/// Represents the configuration of importing a set of conversation files in
/// Google Cloud Storage.
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InputConfig {
/// Required. Where the data is from.
pub source: std::option::Option<crate::model::input_config::Source>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-datasets")]
impl InputConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [source][crate::model::InputConfig::source].
///
/// Note that all the setters affecting `source` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputConfig;
/// use google_cloud_dialogflow_v2::model::GcsSources;
/// let x = InputConfig::new().set_source(Some(
/// google_cloud_dialogflow_v2::model::input_config::Source::GcsSource(GcsSources::default().into())));
/// ```
pub fn set_source<
T: std::convert::Into<std::option::Option<crate::model::input_config::Source>>,
>(
mut self,
v: T,
) -> Self {
self.source = v.into();
self
}
/// The value of [source][crate::model::InputConfig::source]
/// if it holds a `GcsSource`, `None` if the field is not set or
/// holds a different branch.
pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSources>> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::input_config::Source::GcsSource(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::InputConfig::source]
/// to hold a `GcsSource`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputConfig;
/// use google_cloud_dialogflow_v2::model::GcsSources;
/// let x = InputConfig::new().set_gcs_source(GcsSources::default()/* use setters */);
/// assert!(x.gcs_source().is_some());
/// ```
pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSources>>>(
mut self,
v: T,
) -> Self {
self.source =
std::option::Option::Some(crate::model::input_config::Source::GcsSource(v.into()));
self
}
}
#[cfg(feature = "conversation-datasets")]
impl wkt::message::Message for InputConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.InputConfig"
}
}
/// Defines additional types related to [InputConfig].
#[cfg(feature = "conversation-datasets")]
pub mod input_config {
#[allow(unused_imports)]
use super::*;
/// Required. Where the data is from.
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Source {
/// The Cloud Storage URI has the form gs://\<Google Cloud Storage bucket
/// name\>//agent*.json. Wildcards are allowed and will be expanded into all
/// matched JSON files, which will be read as one conversation per file.
GcsSource(std::boxed::Box<crate::model::GcsSources>),
}
}
/// Represents a conversation dataset that a user imports raw data into.
/// The data inside ConversationDataset can not be changed after
/// ImportConversationData finishes (and calling ImportConversationData on a
/// dataset that already has data is not allowed).
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationDataset {
/// Output only. ConversationDataset resource name. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversationDatasets/<Conversation Dataset ID>`
pub name: std::string::String,
/// Required. The display name of the dataset. Maximum of 64 bytes.
pub display_name: std::string::String,
/// Optional. The description of the dataset. Maximum of 10000 bytes.
pub description: std::string::String,
/// Output only. Creation time of this dataset.
pub create_time: std::option::Option<wkt::Timestamp>,
/// Output only. Input configurations set during conversation data import.
pub input_config: std::option::Option<crate::model::InputConfig>,
/// Output only. Metadata set during conversation data import.
pub conversation_info: std::option::Option<crate::model::ConversationInfo>,
/// Output only. The number of conversations this conversation dataset
/// contains.
pub conversation_count: i64,
/// Output only. A read only boolean field reflecting Zone Isolation status of
/// the dataset.
pub satisfies_pzi: std::option::Option<bool>,
/// Output only. A read only boolean field reflecting Zone Separation status of
/// the dataset.
pub satisfies_pzs: std::option::Option<bool>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-datasets")]
impl ConversationDataset {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::ConversationDataset::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// let x = ConversationDataset::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [display_name][crate::model::ConversationDataset::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// let x = ConversationDataset::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [description][crate::model::ConversationDataset::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// let x = ConversationDataset::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
/// Sets the value of [create_time][crate::model::ConversationDataset::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// use wkt::Timestamp;
/// let x = ConversationDataset::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::ConversationDataset::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// use wkt::Timestamp;
/// let x = ConversationDataset::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = ConversationDataset::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [input_config][crate::model::ConversationDataset::input_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// use google_cloud_dialogflow_v2::model::InputConfig;
/// let x = ConversationDataset::new().set_input_config(InputConfig::default()/* use setters */);
/// ```
pub fn set_input_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::InputConfig>,
{
self.input_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [input_config][crate::model::ConversationDataset::input_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// use google_cloud_dialogflow_v2::model::InputConfig;
/// let x = ConversationDataset::new().set_or_clear_input_config(Some(InputConfig::default()/* use setters */));
/// let x = ConversationDataset::new().set_or_clear_input_config(None::<InputConfig>);
/// ```
pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::InputConfig>,
{
self.input_config = v.map(|x| x.into());
self
}
/// Sets the value of [conversation_info][crate::model::ConversationDataset::conversation_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// use google_cloud_dialogflow_v2::model::ConversationInfo;
/// let x = ConversationDataset::new().set_conversation_info(ConversationInfo::default()/* use setters */);
/// ```
pub fn set_conversation_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ConversationInfo>,
{
self.conversation_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [conversation_info][crate::model::ConversationDataset::conversation_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// use google_cloud_dialogflow_v2::model::ConversationInfo;
/// let x = ConversationDataset::new().set_or_clear_conversation_info(Some(ConversationInfo::default()/* use setters */));
/// let x = ConversationDataset::new().set_or_clear_conversation_info(None::<ConversationInfo>);
/// ```
pub fn set_or_clear_conversation_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ConversationInfo>,
{
self.conversation_info = v.map(|x| x.into());
self
}
/// Sets the value of [conversation_count][crate::model::ConversationDataset::conversation_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// let x = ConversationDataset::new().set_conversation_count(42);
/// ```
pub fn set_conversation_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.conversation_count = v.into();
self
}
/// Sets the value of [satisfies_pzi][crate::model::ConversationDataset::satisfies_pzi].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// let x = ConversationDataset::new().set_satisfies_pzi(true);
/// ```
pub fn set_satisfies_pzi<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzi = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [satisfies_pzi][crate::model::ConversationDataset::satisfies_pzi].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// let x = ConversationDataset::new().set_or_clear_satisfies_pzi(Some(false));
/// let x = ConversationDataset::new().set_or_clear_satisfies_pzi(None::<bool>);
/// ```
pub fn set_or_clear_satisfies_pzi<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzi = v.map(|x| x.into());
self
}
/// Sets the value of [satisfies_pzs][crate::model::ConversationDataset::satisfies_pzs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// let x = ConversationDataset::new().set_satisfies_pzs(true);
/// ```
pub fn set_satisfies_pzs<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzs = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [satisfies_pzs][crate::model::ConversationDataset::satisfies_pzs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationDataset;
/// let x = ConversationDataset::new().set_or_clear_satisfies_pzs(Some(false));
/// let x = ConversationDataset::new().set_or_clear_satisfies_pzs(None::<bool>);
/// ```
pub fn set_or_clear_satisfies_pzs<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzs = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversation-datasets")]
impl wkt::message::Message for ConversationDataset {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ConversationDataset"
}
}
/// The request message for
/// [ConversationDatasets.CreateConversationDataset][google.cloud.dialogflow.v2.ConversationDatasets.CreateConversationDataset].
///
/// [google.cloud.dialogflow.v2.ConversationDatasets.CreateConversationDataset]: crate::client::ConversationDatasets::create_conversation_dataset
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateConversationDatasetRequest {
/// Required. The project to create conversation dataset for. Format:
/// `projects/<Project ID>/locations/<Location ID>`
pub parent: std::string::String,
/// Required. The conversation dataset to create.
pub conversation_dataset: std::option::Option<crate::model::ConversationDataset>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-datasets")]
impl CreateConversationDatasetRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateConversationDatasetRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationDatasetRequest;
/// let x = CreateConversationDatasetRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [conversation_dataset][crate::model::CreateConversationDatasetRequest::conversation_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationDatasetRequest;
/// use google_cloud_dialogflow_v2::model::ConversationDataset;
/// let x = CreateConversationDatasetRequest::new().set_conversation_dataset(ConversationDataset::default()/* use setters */);
/// ```
pub fn set_conversation_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ConversationDataset>,
{
self.conversation_dataset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [conversation_dataset][crate::model::CreateConversationDatasetRequest::conversation_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationDatasetRequest;
/// use google_cloud_dialogflow_v2::model::ConversationDataset;
/// let x = CreateConversationDatasetRequest::new().set_or_clear_conversation_dataset(Some(ConversationDataset::default()/* use setters */));
/// let x = CreateConversationDatasetRequest::new().set_or_clear_conversation_dataset(None::<ConversationDataset>);
/// ```
pub fn set_or_clear_conversation_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ConversationDataset>,
{
self.conversation_dataset = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversation-datasets")]
impl wkt::message::Message for CreateConversationDatasetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateConversationDatasetRequest"
}
}
/// The request message for
/// [ConversationDatasets.GetConversationDataset][google.cloud.dialogflow.v2.ConversationDatasets.GetConversationDataset].
///
/// [google.cloud.dialogflow.v2.ConversationDatasets.GetConversationDataset]: crate::client::ConversationDatasets::get_conversation_dataset
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetConversationDatasetRequest {
/// Required. The conversation dataset to retrieve. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversationDatasets/<Conversation Dataset ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-datasets")]
impl GetConversationDatasetRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetConversationDatasetRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetConversationDatasetRequest;
/// let x = GetConversationDatasetRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "conversation-datasets")]
impl wkt::message::Message for GetConversationDatasetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetConversationDatasetRequest"
}
}
/// The request message for
/// [ConversationDatasets.ListConversationDatasets][google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets].
///
/// [google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets]: crate::client::ConversationDatasets::list_conversation_datasets
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConversationDatasetsRequest {
/// Required. The project and location name to list all conversation datasets
/// for. Format: `projects/<Project ID>/locations/<Location ID>`
pub parent: std::string::String,
/// Optional. Maximum number of conversation datasets to return in a single
/// page. By default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-datasets")]
impl ListConversationDatasetsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListConversationDatasetsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationDatasetsRequest;
/// let x = ListConversationDatasetsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListConversationDatasetsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationDatasetsRequest;
/// let x = ListConversationDatasetsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListConversationDatasetsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationDatasetsRequest;
/// let x = ListConversationDatasetsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "conversation-datasets")]
impl wkt::message::Message for ListConversationDatasetsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListConversationDatasetsRequest"
}
}
/// The response message for
/// [ConversationDatasets.ListConversationDatasets][google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets].
///
/// [google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets]: crate::client::ConversationDatasets::list_conversation_datasets
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConversationDatasetsResponse {
/// The list of datasets to return.
pub conversation_datasets: std::vec::Vec<crate::model::ConversationDataset>,
/// The token to use to retrieve the next page of results, or empty if there
/// are no more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-datasets")]
impl ListConversationDatasetsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_datasets][crate::model::ListConversationDatasetsResponse::conversation_datasets].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationDatasetsResponse;
/// use google_cloud_dialogflow_v2::model::ConversationDataset;
/// let x = ListConversationDatasetsResponse::new()
/// .set_conversation_datasets([
/// ConversationDataset::default()/* use setters */,
/// ConversationDataset::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_conversation_datasets<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ConversationDataset>,
{
use std::iter::Iterator;
self.conversation_datasets = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListConversationDatasetsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationDatasetsResponse;
/// let x = ListConversationDatasetsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "conversation-datasets")]
impl wkt::message::Message for ListConversationDatasetsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListConversationDatasetsResponse"
}
}
#[cfg(feature = "conversation-datasets")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListConversationDatasetsResponse {
type PageItem = crate::model::ConversationDataset;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.conversation_datasets
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [ConversationDatasets.DeleteConversationDataset][google.cloud.dialogflow.v2.ConversationDatasets.DeleteConversationDataset].
///
/// [google.cloud.dialogflow.v2.ConversationDatasets.DeleteConversationDataset]: crate::client::ConversationDatasets::delete_conversation_dataset
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteConversationDatasetRequest {
/// Required. The conversation dataset to delete. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversationDatasets/<Conversation Dataset ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-datasets")]
impl DeleteConversationDatasetRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteConversationDatasetRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteConversationDatasetRequest;
/// let x = DeleteConversationDatasetRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "conversation-datasets")]
impl wkt::message::Message for DeleteConversationDatasetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteConversationDatasetRequest"
}
}
/// The request message for
/// [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData].
///
/// [google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData]: crate::client::ConversationDatasets::import_conversation_data
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportConversationDataRequest {
/// Required. Dataset resource name. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversationDatasets/<Conversation Dataset ID>`
pub name: std::string::String,
/// Required. Configuration describing where to import data from.
pub input_config: std::option::Option<crate::model::InputConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-datasets")]
impl ImportConversationDataRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::ImportConversationDataRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportConversationDataRequest;
/// let x = ImportConversationDataRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [input_config][crate::model::ImportConversationDataRequest::input_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportConversationDataRequest;
/// use google_cloud_dialogflow_v2::model::InputConfig;
/// let x = ImportConversationDataRequest::new().set_input_config(InputConfig::default()/* use setters */);
/// ```
pub fn set_input_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::InputConfig>,
{
self.input_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [input_config][crate::model::ImportConversationDataRequest::input_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportConversationDataRequest;
/// use google_cloud_dialogflow_v2::model::InputConfig;
/// let x = ImportConversationDataRequest::new().set_or_clear_input_config(Some(InputConfig::default()/* use setters */));
/// let x = ImportConversationDataRequest::new().set_or_clear_input_config(None::<InputConfig>);
/// ```
pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::InputConfig>,
{
self.input_config = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversation-datasets")]
impl wkt::message::Message for ImportConversationDataRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ImportConversationDataRequest"
}
}
/// Metadata for a
/// [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData]
/// operation.
///
/// [google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData]: crate::client::ConversationDatasets::import_conversation_data
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportConversationDataOperationMetadata {
/// The resource name of the imported conversation dataset. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversationDatasets/<Conversation Dataset Id>`
pub conversation_dataset: std::string::String,
/// Partial failures are failures that don't fail the whole long running
/// operation, e.g. single files that couldn't be read.
pub partial_failures: std::vec::Vec<google_cloud_rpc::model::Status>,
/// Timestamp when import conversation data request was created. The time is
/// measured on server side.
pub create_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-datasets")]
impl ImportConversationDataOperationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_dataset][crate::model::ImportConversationDataOperationMetadata::conversation_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportConversationDataOperationMetadata;
/// let x = ImportConversationDataOperationMetadata::new().set_conversation_dataset("example");
/// ```
pub fn set_conversation_dataset<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_dataset = v.into();
self
}
/// Sets the value of [partial_failures][crate::model::ImportConversationDataOperationMetadata::partial_failures].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportConversationDataOperationMetadata;
/// use google_cloud_rpc::model::Status;
/// let x = ImportConversationDataOperationMetadata::new()
/// .set_partial_failures([
/// Status::default()/* use setters */,
/// Status::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_partial_failures<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.partial_failures = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [create_time][crate::model::ImportConversationDataOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportConversationDataOperationMetadata;
/// use wkt::Timestamp;
/// let x = ImportConversationDataOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::ImportConversationDataOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportConversationDataOperationMetadata;
/// use wkt::Timestamp;
/// let x = ImportConversationDataOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = ImportConversationDataOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
}
#[cfg(feature = "conversation-datasets")]
impl wkt::message::Message for ImportConversationDataOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata"
}
}
/// Response used for
/// [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData]
/// long running operation.
///
/// [google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData]: crate::client::ConversationDatasets::import_conversation_data
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportConversationDataOperationResponse {
/// The resource name of the imported conversation dataset. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversationDatasets/<Conversation Dataset Id>`
pub conversation_dataset: std::string::String,
/// Number of conversations imported successfully.
pub import_count: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-datasets")]
impl ImportConversationDataOperationResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_dataset][crate::model::ImportConversationDataOperationResponse::conversation_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportConversationDataOperationResponse;
/// let x = ImportConversationDataOperationResponse::new().set_conversation_dataset("example");
/// ```
pub fn set_conversation_dataset<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_dataset = v.into();
self
}
/// Sets the value of [import_count][crate::model::ImportConversationDataOperationResponse::import_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportConversationDataOperationResponse;
/// let x = ImportConversationDataOperationResponse::new().set_import_count(42);
/// ```
pub fn set_import_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.import_count = v.into();
self
}
}
#[cfg(feature = "conversation-datasets")]
impl wkt::message::Message for ImportConversationDataOperationResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ImportConversationDataOperationResponse"
}
}
/// Metadata for [CreateConversationDataset][].
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateConversationDatasetOperationMetadata {
/// The resource name of the conversation dataset that will be created. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversationDatasets/<Conversation Dataset Id>`
pub conversation_dataset: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-datasets")]
impl CreateConversationDatasetOperationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_dataset][crate::model::CreateConversationDatasetOperationMetadata::conversation_dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationDatasetOperationMetadata;
/// let x = CreateConversationDatasetOperationMetadata::new().set_conversation_dataset("example");
/// ```
pub fn set_conversation_dataset<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_dataset = v.into();
self
}
}
#[cfg(feature = "conversation-datasets")]
impl wkt::message::Message for CreateConversationDatasetOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata"
}
}
/// Metadata for [DeleteConversationDataset][].
#[cfg(feature = "conversation-datasets")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteConversationDatasetOperationMetadata {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-datasets")]
impl DeleteConversationDatasetOperationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
}
#[cfg(feature = "conversation-datasets")]
impl wkt::message::Message for DeleteConversationDatasetOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata"
}
}
/// Represents a notification sent to Pub/Sub subscribers for conversation
/// lifecycle events.
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationEvent {
/// The unique identifier of the conversation this notification
/// refers to.
/// Format: `projects/<Project ID>/conversations/<Conversation ID>`.
pub conversation: std::string::String,
/// The type of the event that this notification refers to.
pub r#type: crate::model::conversation_event::Type,
/// More detailed information about an error. Only set for type
/// UNRECOVERABLE_ERROR_IN_PHONE_CALL.
pub error_status: std::option::Option<google_cloud_rpc::model::Status>,
/// Payload of conversation event.
pub payload: std::option::Option<crate::model::conversation_event::Payload>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl ConversationEvent {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation][crate::model::ConversationEvent::conversation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationEvent;
/// let x = ConversationEvent::new().set_conversation("example");
/// ```
pub fn set_conversation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.conversation = v.into();
self
}
/// Sets the value of [r#type][crate::model::ConversationEvent::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationEvent;
/// use google_cloud_dialogflow_v2::model::conversation_event::Type;
/// let x0 = ConversationEvent::new().set_type(Type::ConversationStarted);
/// let x1 = ConversationEvent::new().set_type(Type::ConversationFinished);
/// let x2 = ConversationEvent::new().set_type(Type::HumanInterventionNeeded);
/// ```
pub fn set_type<T: std::convert::Into<crate::model::conversation_event::Type>>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [error_status][crate::model::ConversationEvent::error_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationEvent;
/// use google_cloud_rpc::model::Status;
/// let x = ConversationEvent::new().set_error_status(Status::default()/* use setters */);
/// ```
pub fn set_error_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.error_status = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [error_status][crate::model::ConversationEvent::error_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationEvent;
/// use google_cloud_rpc::model::Status;
/// let x = ConversationEvent::new().set_or_clear_error_status(Some(Status::default()/* use setters */));
/// let x = ConversationEvent::new().set_or_clear_error_status(None::<Status>);
/// ```
pub fn set_or_clear_error_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.error_status = v.map(|x| x.into());
self
}
/// Sets the value of [payload][crate::model::ConversationEvent::payload].
///
/// Note that all the setters affecting `payload` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationEvent;
/// use google_cloud_dialogflow_v2::model::Message;
/// let x = ConversationEvent::new().set_payload(Some(
/// google_cloud_dialogflow_v2::model::conversation_event::Payload::NewMessagePayload(Message::default().into())));
/// ```
pub fn set_payload<
T: std::convert::Into<std::option::Option<crate::model::conversation_event::Payload>>,
>(
mut self,
v: T,
) -> Self {
self.payload = v.into();
self
}
/// The value of [payload][crate::model::ConversationEvent::payload]
/// if it holds a `NewMessagePayload`, `None` if the field is not set or
/// holds a different branch.
pub fn new_message_payload(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::Message>> {
#[allow(unreachable_patterns)]
self.payload.as_ref().and_then(|v| match v {
crate::model::conversation_event::Payload::NewMessagePayload(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [payload][crate::model::ConversationEvent::payload]
/// to hold a `NewMessagePayload`.
///
/// Note that all the setters affecting `payload` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationEvent;
/// use google_cloud_dialogflow_v2::model::Message;
/// let x = ConversationEvent::new().set_new_message_payload(Message::default()/* use setters */);
/// assert!(x.new_message_payload().is_some());
/// assert!(x.new_recognition_result_payload().is_none());
/// ```
pub fn set_new_message_payload<
T: std::convert::Into<std::boxed::Box<crate::model::Message>>,
>(
mut self,
v: T,
) -> Self {
self.payload = std::option::Option::Some(
crate::model::conversation_event::Payload::NewMessagePayload(v.into()),
);
self
}
/// The value of [payload][crate::model::ConversationEvent::payload]
/// if it holds a `NewRecognitionResultPayload`, `None` if the field is not set or
/// holds a different branch.
pub fn new_recognition_result_payload(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::StreamingRecognitionResult>> {
#[allow(unreachable_patterns)]
self.payload.as_ref().and_then(|v| match v {
crate::model::conversation_event::Payload::NewRecognitionResultPayload(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [payload][crate::model::ConversationEvent::payload]
/// to hold a `NewRecognitionResultPayload`.
///
/// Note that all the setters affecting `payload` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationEvent;
/// use google_cloud_dialogflow_v2::model::StreamingRecognitionResult;
/// let x = ConversationEvent::new().set_new_recognition_result_payload(StreamingRecognitionResult::default()/* use setters */);
/// assert!(x.new_recognition_result_payload().is_some());
/// assert!(x.new_message_payload().is_none());
/// ```
pub fn set_new_recognition_result_payload<
T: std::convert::Into<std::boxed::Box<crate::model::StreamingRecognitionResult>>,
>(
mut self,
v: T,
) -> Self {
self.payload = std::option::Option::Some(
crate::model::conversation_event::Payload::NewRecognitionResultPayload(v.into()),
);
self
}
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl wkt::message::Message for ConversationEvent {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ConversationEvent"
}
}
/// Defines additional types related to [ConversationEvent].
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
pub mod conversation_event {
#[allow(unused_imports)]
use super::*;
/// Enumeration of the types of events available.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Type {
/// Type not set.
Unspecified,
/// A new conversation has been opened. This is fired when a telephone call
/// is answered, or a conversation is created via the API.
ConversationStarted,
/// An existing conversation has closed. This is fired when a telephone call
/// is terminated, or a conversation is closed via the API.
/// The event is fired for every CompleteConversation call, even if the
/// conversation is already closed.
ConversationFinished,
/// An existing conversation has received notification from Dialogflow that
/// human intervention is required.
HumanInterventionNeeded,
/// An existing conversation has received a new message, either from API or
/// telephony. It is configured in
/// [ConversationProfile.new_message_event_notification_config][google.cloud.dialogflow.v2.ConversationProfile.new_message_event_notification_config]
///
/// [google.cloud.dialogflow.v2.ConversationProfile.new_message_event_notification_config]: crate::model::ConversationProfile::new_message_event_notification_config
NewMessage,
/// An existing conversation has received a new speech recognition result.
/// This is mainly for delivering intermediate transcripts. The notification
/// is configured in
/// [ConversationProfile.new_recognition_event_notification_config][].
NewRecognitionResult,
/// Unrecoverable error during a telephone call.
///
/// In general non-recoverable errors only occur if something was
/// misconfigured in the ConversationProfile corresponding to the call. After
/// a non-recoverable error, Dialogflow may stop responding.
///
/// We don't fire this event:
///
/// * in an API call because we can directly return the error, or,
/// * when we can recover from an error.
UnrecoverableError,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Type::value] or
/// [Type::name].
UnknownValue(r#type::UnknownValue),
}
#[doc(hidden)]
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
pub mod r#type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl Type {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ConversationStarted => std::option::Option::Some(1),
Self::ConversationFinished => std::option::Option::Some(2),
Self::HumanInterventionNeeded => std::option::Option::Some(3),
Self::NewMessage => std::option::Option::Some(5),
Self::NewRecognitionResult => std::option::Option::Some(7),
Self::UnrecoverableError => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
Self::ConversationStarted => std::option::Option::Some("CONVERSATION_STARTED"),
Self::ConversationFinished => std::option::Option::Some("CONVERSATION_FINISHED"),
Self::HumanInterventionNeeded => {
std::option::Option::Some("HUMAN_INTERVENTION_NEEDED")
}
Self::NewMessage => std::option::Option::Some("NEW_MESSAGE"),
Self::NewRecognitionResult => std::option::Option::Some("NEW_RECOGNITION_RESULT"),
Self::UnrecoverableError => std::option::Option::Some("UNRECOVERABLE_ERROR"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl std::default::Default for Type {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
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())
}
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl std::convert::From<i32> for Type {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ConversationStarted,
2 => Self::ConversationFinished,
3 => Self::HumanInterventionNeeded,
4 => Self::UnrecoverableError,
5 => Self::NewMessage,
7 => Self::NewRecognitionResult,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl std::convert::From<&str> for Type {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_UNSPECIFIED" => Self::Unspecified,
"CONVERSATION_STARTED" => Self::ConversationStarted,
"CONVERSATION_FINISHED" => Self::ConversationFinished,
"HUMAN_INTERVENTION_NEEDED" => Self::HumanInterventionNeeded,
"NEW_MESSAGE" => Self::NewMessage,
"NEW_RECOGNITION_RESULT" => Self::NewRecognitionResult,
"UNRECOVERABLE_ERROR" => Self::UnrecoverableError,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
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::ConversationStarted => serializer.serialize_i32(1),
Self::ConversationFinished => serializer.serialize_i32(2),
Self::HumanInterventionNeeded => serializer.serialize_i32(3),
Self::NewMessage => serializer.serialize_i32(5),
Self::NewRecognitionResult => serializer.serialize_i32(7),
Self::UnrecoverableError => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
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.dialogflow.v2.ConversationEvent.Type",
))
}
}
/// Payload of conversation event.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Payload {
/// Payload of NEW_MESSAGE event.
NewMessagePayload(std::boxed::Box<crate::model::Message>),
/// Payload of NEW_RECOGNITION_RESULT event.
NewRecognitionResultPayload(std::boxed::Box<crate::model::StreamingRecognitionResult>),
}
}
/// Represents a conversation model.
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationModel {
/// ConversationModel resource name. Format:
/// `projects/<Project ID>/conversationModels/<Conversation Model ID>`
pub name: std::string::String,
/// Required. The display name of the model. At most 64 bytes long.
pub display_name: std::string::String,
/// Output only. Creation time of this model.
pub create_time: std::option::Option<wkt::Timestamp>,
/// Required. Datasets used to create model.
pub datasets: std::vec::Vec<crate::model::InputDataset>,
/// Output only. State of the model. A model can only serve prediction requests
/// after it gets deployed.
pub state: crate::model::conversation_model::State,
/// Language code for the conversation model. If not specified, the language
/// is en-US. Language at ConversationModel should be set for all non en-us
/// languages.
/// This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
/// language tag. Example: "en-US".
pub language_code: std::string::String,
/// Output only. A read only boolean field reflecting Zone Separation
/// status of the model.
pub satisfies_pzs: std::option::Option<bool>,
/// Output only. A read only boolean field reflecting Zone Isolation status
/// of the model.
pub satisfies_pzi: std::option::Option<bool>,
/// Required.
/// The model metadata that is specific to the problem type.
/// Must match the metadata type of the dataset used to train the model.
pub model_metadata: std::option::Option<crate::model::conversation_model::ModelMetadata>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl ConversationModel {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::ConversationModel::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// let x = ConversationModel::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [display_name][crate::model::ConversationModel::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// let x = ConversationModel::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [create_time][crate::model::ConversationModel::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// use wkt::Timestamp;
/// let x = ConversationModel::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::ConversationModel::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// use wkt::Timestamp;
/// let x = ConversationModel::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = ConversationModel::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [datasets][crate::model::ConversationModel::datasets].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// use google_cloud_dialogflow_v2::model::InputDataset;
/// let x = ConversationModel::new()
/// .set_datasets([
/// InputDataset::default()/* use setters */,
/// InputDataset::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_datasets<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::InputDataset>,
{
use std::iter::Iterator;
self.datasets = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [state][crate::model::ConversationModel::state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// use google_cloud_dialogflow_v2::model::conversation_model::State;
/// let x0 = ConversationModel::new().set_state(State::Creating);
/// let x1 = ConversationModel::new().set_state(State::Undeployed);
/// let x2 = ConversationModel::new().set_state(State::Deploying);
/// ```
pub fn set_state<T: std::convert::Into<crate::model::conversation_model::State>>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
/// Sets the value of [language_code][crate::model::ConversationModel::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// let x = ConversationModel::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [satisfies_pzs][crate::model::ConversationModel::satisfies_pzs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// let x = ConversationModel::new().set_satisfies_pzs(true);
/// ```
pub fn set_satisfies_pzs<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzs = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [satisfies_pzs][crate::model::ConversationModel::satisfies_pzs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// let x = ConversationModel::new().set_or_clear_satisfies_pzs(Some(false));
/// let x = ConversationModel::new().set_or_clear_satisfies_pzs(None::<bool>);
/// ```
pub fn set_or_clear_satisfies_pzs<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzs = v.map(|x| x.into());
self
}
/// Sets the value of [satisfies_pzi][crate::model::ConversationModel::satisfies_pzi].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// let x = ConversationModel::new().set_satisfies_pzi(true);
/// ```
pub fn set_satisfies_pzi<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzi = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [satisfies_pzi][crate::model::ConversationModel::satisfies_pzi].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// let x = ConversationModel::new().set_or_clear_satisfies_pzi(Some(false));
/// let x = ConversationModel::new().set_or_clear_satisfies_pzi(None::<bool>);
/// ```
pub fn set_or_clear_satisfies_pzi<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzi = v.map(|x| x.into());
self
}
/// Sets the value of [model_metadata][crate::model::ConversationModel::model_metadata].
///
/// Note that all the setters affecting `model_metadata` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// use google_cloud_dialogflow_v2::model::ArticleSuggestionModelMetadata;
/// let x = ConversationModel::new().set_model_metadata(Some(
/// google_cloud_dialogflow_v2::model::conversation_model::ModelMetadata::ArticleSuggestionModelMetadata(ArticleSuggestionModelMetadata::default().into())));
/// ```
pub fn set_model_metadata<
T: std::convert::Into<std::option::Option<crate::model::conversation_model::ModelMetadata>>,
>(
mut self,
v: T,
) -> Self {
self.model_metadata = v.into();
self
}
/// The value of [model_metadata][crate::model::ConversationModel::model_metadata]
/// if it holds a `ArticleSuggestionModelMetadata`, `None` if the field is not set or
/// holds a different branch.
pub fn article_suggestion_model_metadata(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ArticleSuggestionModelMetadata>> {
#[allow(unreachable_patterns)]
self.model_metadata.as_ref().and_then(|v| match v {
crate::model::conversation_model::ModelMetadata::ArticleSuggestionModelMetadata(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [model_metadata][crate::model::ConversationModel::model_metadata]
/// to hold a `ArticleSuggestionModelMetadata`.
///
/// Note that all the setters affecting `model_metadata` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// use google_cloud_dialogflow_v2::model::ArticleSuggestionModelMetadata;
/// let x = ConversationModel::new().set_article_suggestion_model_metadata(ArticleSuggestionModelMetadata::default()/* use setters */);
/// assert!(x.article_suggestion_model_metadata().is_some());
/// assert!(x.smart_reply_model_metadata().is_none());
/// ```
pub fn set_article_suggestion_model_metadata<
T: std::convert::Into<std::boxed::Box<crate::model::ArticleSuggestionModelMetadata>>,
>(
mut self,
v: T,
) -> Self {
self.model_metadata = std::option::Option::Some(
crate::model::conversation_model::ModelMetadata::ArticleSuggestionModelMetadata(
v.into(),
),
);
self
}
/// The value of [model_metadata][crate::model::ConversationModel::model_metadata]
/// if it holds a `SmartReplyModelMetadata`, `None` if the field is not set or
/// holds a different branch.
pub fn smart_reply_model_metadata(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SmartReplyModelMetadata>> {
#[allow(unreachable_patterns)]
self.model_metadata.as_ref().and_then(|v| match v {
crate::model::conversation_model::ModelMetadata::SmartReplyModelMetadata(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [model_metadata][crate::model::ConversationModel::model_metadata]
/// to hold a `SmartReplyModelMetadata`.
///
/// Note that all the setters affecting `model_metadata` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModel;
/// use google_cloud_dialogflow_v2::model::SmartReplyModelMetadata;
/// let x = ConversationModel::new().set_smart_reply_model_metadata(SmartReplyModelMetadata::default()/* use setters */);
/// assert!(x.smart_reply_model_metadata().is_some());
/// assert!(x.article_suggestion_model_metadata().is_none());
/// ```
pub fn set_smart_reply_model_metadata<
T: std::convert::Into<std::boxed::Box<crate::model::SmartReplyModelMetadata>>,
>(
mut self,
v: T,
) -> Self {
self.model_metadata = std::option::Option::Some(
crate::model::conversation_model::ModelMetadata::SmartReplyModelMetadata(v.into()),
);
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for ConversationModel {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ConversationModel"
}
}
/// Defines additional types related to [ConversationModel].
#[cfg(feature = "conversation-models")]
pub mod conversation_model {
#[allow(unused_imports)]
use super::*;
/// State of the model.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "conversation-models")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
/// Should not be used, an un-set enum has this value by default.
Unspecified,
/// Model being created.
Creating,
/// Model is not deployed but ready to deploy.
Undeployed,
/// Model is deploying.
Deploying,
/// Model is deployed and ready to use.
Deployed,
/// Model is undeploying.
Undeploying,
/// Model is deleting.
Deleting,
/// Model is in error state. Not ready to deploy and use.
Failed,
/// Model is being created but the training has not started,
/// The model may remain in this state until there is enough capacity to
/// start training.
Pending,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [State::value] or
/// [State::name].
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "conversation-models")]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "conversation-models")]
impl State {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Creating => std::option::Option::Some(1),
Self::Undeployed => std::option::Option::Some(2),
Self::Deploying => std::option::Option::Some(3),
Self::Deployed => std::option::Option::Some(4),
Self::Undeploying => std::option::Option::Some(5),
Self::Deleting => std::option::Option::Some(6),
Self::Failed => std::option::Option::Some(7),
Self::Pending => std::option::Option::Some(8),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Creating => std::option::Option::Some("CREATING"),
Self::Undeployed => std::option::Option::Some("UNDEPLOYED"),
Self::Deploying => std::option::Option::Some("DEPLOYING"),
Self::Deployed => std::option::Option::Some("DEPLOYED"),
Self::Undeploying => std::option::Option::Some("UNDEPLOYING"),
Self::Deleting => std::option::Option::Some("DELETING"),
Self::Failed => std::option::Option::Some("FAILED"),
Self::Pending => std::option::Option::Some("PENDING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "conversation-models")]
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "conversation-models")]
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())
}
}
#[cfg(feature = "conversation-models")]
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Creating,
2 => Self::Undeployed,
3 => Self::Deploying,
4 => Self::Deployed,
5 => Self::Undeploying,
6 => Self::Deleting,
7 => Self::Failed,
8 => Self::Pending,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "conversation-models")]
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"CREATING" => Self::Creating,
"UNDEPLOYED" => Self::Undeployed,
"DEPLOYING" => Self::Deploying,
"DEPLOYED" => Self::Deployed,
"UNDEPLOYING" => Self::Undeploying,
"DELETING" => Self::Deleting,
"FAILED" => Self::Failed,
"PENDING" => Self::Pending,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "conversation-models")]
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::Creating => serializer.serialize_i32(1),
Self::Undeployed => serializer.serialize_i32(2),
Self::Deploying => serializer.serialize_i32(3),
Self::Deployed => serializer.serialize_i32(4),
Self::Undeploying => serializer.serialize_i32(5),
Self::Deleting => serializer.serialize_i32(6),
Self::Failed => serializer.serialize_i32(7),
Self::Pending => serializer.serialize_i32(8),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "conversation-models")]
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.dialogflow.v2.ConversationModel.State",
))
}
}
/// Model type.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "conversation-models")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ModelType {
/// ModelType unspecified.
Unspecified,
/// ModelType smart reply dual encoder model.
SmartReplyDualEncoderModel,
/// ModelType smart reply bert model.
SmartReplyBertModel,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ModelType::value] or
/// [ModelType::name].
UnknownValue(model_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "conversation-models")]
pub mod model_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "conversation-models")]
impl ModelType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::SmartReplyDualEncoderModel => std::option::Option::Some(2),
Self::SmartReplyBertModel => std::option::Option::Some(6),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MODEL_TYPE_UNSPECIFIED"),
Self::SmartReplyDualEncoderModel => {
std::option::Option::Some("SMART_REPLY_DUAL_ENCODER_MODEL")
}
Self::SmartReplyBertModel => std::option::Option::Some("SMART_REPLY_BERT_MODEL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "conversation-models")]
impl std::default::Default for ModelType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "conversation-models")]
impl std::fmt::Display for ModelType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "conversation-models")]
impl std::convert::From<i32> for ModelType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
2 => Self::SmartReplyDualEncoderModel,
6 => Self::SmartReplyBertModel,
_ => Self::UnknownValue(model_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "conversation-models")]
impl std::convert::From<&str> for ModelType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
"SMART_REPLY_DUAL_ENCODER_MODEL" => Self::SmartReplyDualEncoderModel,
"SMART_REPLY_BERT_MODEL" => Self::SmartReplyBertModel,
_ => Self::UnknownValue(model_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "conversation-models")]
impl serde::ser::Serialize for ModelType {
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::SmartReplyDualEncoderModel => serializer.serialize_i32(2),
Self::SmartReplyBertModel => serializer.serialize_i32(6),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "conversation-models")]
impl<'de> serde::de::Deserialize<'de> for ModelType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ModelType>::new(
".google.cloud.dialogflow.v2.ConversationModel.ModelType",
))
}
}
/// Required.
/// The model metadata that is specific to the problem type.
/// Must match the metadata type of the dataset used to train the model.
#[cfg(feature = "conversation-models")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ModelMetadata {
/// Metadata for article suggestion models.
ArticleSuggestionModelMetadata(
std::boxed::Box<crate::model::ArticleSuggestionModelMetadata>,
),
/// Metadata for smart reply models.
SmartReplyModelMetadata(std::boxed::Box<crate::model::SmartReplyModelMetadata>),
}
}
/// Represents evaluation result of a conversation model.
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationModelEvaluation {
/// The resource name of the evaluation. Format:
/// `projects/<Project ID>/conversationModels/<Conversation Model
/// ID>/evaluations/<Evaluation ID>`
pub name: std::string::String,
/// Optional. The display name of the model evaluation. At most 64 bytes long.
pub display_name: std::string::String,
/// Optional. The configuration of the evaluation task.
pub evaluation_config: std::option::Option<crate::model::EvaluationConfig>,
/// Output only. Creation time of this model.
pub create_time: std::option::Option<wkt::Timestamp>,
/// Output only. Human eval template in csv format.
/// It takes real-world conversations provided through input dataset, generates
/// example suggestions for customer to verify quality of the model.
/// For Smart Reply, the generated csv file contains columns of
/// Context, (Suggestions,Q1,Q2)*3, Actual reply.
/// Context contains at most 10 latest messages in the conversation prior to
/// the current suggestion.
/// Q1: "Would you send it as the next message of agent?"
/// Evaluated based on whether the suggest is appropriate to be sent by
/// agent in current context.
/// Q2: "Does the suggestion move the conversation closer to resolution?"
/// Evaluated based on whether the suggestion provide solutions, or answers
/// customer's question or collect information from customer to resolve the
/// customer's issue.
/// Actual reply column contains the actual agent reply sent in the context.
pub raw_human_eval_template_csv: std::string::String,
/// Metrics details.
pub metrics: std::option::Option<crate::model::conversation_model_evaluation::Metrics>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl ConversationModelEvaluation {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::ConversationModelEvaluation::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModelEvaluation;
/// let x = ConversationModelEvaluation::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [display_name][crate::model::ConversationModelEvaluation::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModelEvaluation;
/// let x = ConversationModelEvaluation::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [evaluation_config][crate::model::ConversationModelEvaluation::evaluation_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModelEvaluation;
/// use google_cloud_dialogflow_v2::model::EvaluationConfig;
/// let x = ConversationModelEvaluation::new().set_evaluation_config(EvaluationConfig::default()/* use setters */);
/// ```
pub fn set_evaluation_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EvaluationConfig>,
{
self.evaluation_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [evaluation_config][crate::model::ConversationModelEvaluation::evaluation_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModelEvaluation;
/// use google_cloud_dialogflow_v2::model::EvaluationConfig;
/// let x = ConversationModelEvaluation::new().set_or_clear_evaluation_config(Some(EvaluationConfig::default()/* use setters */));
/// let x = ConversationModelEvaluation::new().set_or_clear_evaluation_config(None::<EvaluationConfig>);
/// ```
pub fn set_or_clear_evaluation_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EvaluationConfig>,
{
self.evaluation_config = v.map(|x| x.into());
self
}
/// Sets the value of [create_time][crate::model::ConversationModelEvaluation::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModelEvaluation;
/// use wkt::Timestamp;
/// let x = ConversationModelEvaluation::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::ConversationModelEvaluation::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModelEvaluation;
/// use wkt::Timestamp;
/// let x = ConversationModelEvaluation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = ConversationModelEvaluation::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [raw_human_eval_template_csv][crate::model::ConversationModelEvaluation::raw_human_eval_template_csv].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModelEvaluation;
/// let x = ConversationModelEvaluation::new().set_raw_human_eval_template_csv("example");
/// ```
pub fn set_raw_human_eval_template_csv<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.raw_human_eval_template_csv = v.into();
self
}
/// Sets the value of [metrics][crate::model::ConversationModelEvaluation::metrics].
///
/// Note that all the setters affecting `metrics` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModelEvaluation;
/// use google_cloud_dialogflow_v2::model::SmartReplyMetrics;
/// let x = ConversationModelEvaluation::new().set_metrics(Some(
/// google_cloud_dialogflow_v2::model::conversation_model_evaluation::Metrics::SmartReplyMetrics(SmartReplyMetrics::default().into())));
/// ```
pub fn set_metrics<
T: std::convert::Into<
std::option::Option<crate::model::conversation_model_evaluation::Metrics>,
>,
>(
mut self,
v: T,
) -> Self {
self.metrics = v.into();
self
}
/// The value of [metrics][crate::model::ConversationModelEvaluation::metrics]
/// if it holds a `SmartReplyMetrics`, `None` if the field is not set or
/// holds a different branch.
pub fn smart_reply_metrics(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SmartReplyMetrics>> {
#[allow(unreachable_patterns)]
self.metrics.as_ref().and_then(|v| match v {
crate::model::conversation_model_evaluation::Metrics::SmartReplyMetrics(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [metrics][crate::model::ConversationModelEvaluation::metrics]
/// to hold a `SmartReplyMetrics`.
///
/// Note that all the setters affecting `metrics` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationModelEvaluation;
/// use google_cloud_dialogflow_v2::model::SmartReplyMetrics;
/// let x = ConversationModelEvaluation::new().set_smart_reply_metrics(SmartReplyMetrics::default()/* use setters */);
/// assert!(x.smart_reply_metrics().is_some());
/// ```
pub fn set_smart_reply_metrics<
T: std::convert::Into<std::boxed::Box<crate::model::SmartReplyMetrics>>,
>(
mut self,
v: T,
) -> Self {
self.metrics = std::option::Option::Some(
crate::model::conversation_model_evaluation::Metrics::SmartReplyMetrics(v.into()),
);
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for ConversationModelEvaluation {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ConversationModelEvaluation"
}
}
/// Defines additional types related to [ConversationModelEvaluation].
#[cfg(feature = "conversation-models")]
pub mod conversation_model_evaluation {
#[allow(unused_imports)]
use super::*;
/// Metrics details.
#[cfg(feature = "conversation-models")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Metrics {
/// Output only. Only available when model is for smart reply.
SmartReplyMetrics(std::boxed::Box<crate::model::SmartReplyMetrics>),
}
}
/// The configuration for model evaluation.
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EvaluationConfig {
/// Required. Datasets used for evaluation.
pub datasets: std::vec::Vec<crate::model::InputDataset>,
/// Specific configurations for different models in order to do evaluation.
pub model_specific_config:
std::option::Option<crate::model::evaluation_config::ModelSpecificConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl EvaluationConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [datasets][crate::model::EvaluationConfig::datasets].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EvaluationConfig;
/// use google_cloud_dialogflow_v2::model::InputDataset;
/// let x = EvaluationConfig::new()
/// .set_datasets([
/// InputDataset::default()/* use setters */,
/// InputDataset::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_datasets<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::InputDataset>,
{
use std::iter::Iterator;
self.datasets = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [model_specific_config][crate::model::EvaluationConfig::model_specific_config].
///
/// Note that all the setters affecting `model_specific_config` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EvaluationConfig;
/// use google_cloud_dialogflow_v2::model::evaluation_config::SmartReplyConfig;
/// let x = EvaluationConfig::new().set_model_specific_config(Some(
/// google_cloud_dialogflow_v2::model::evaluation_config::ModelSpecificConfig::SmartReplyConfig(SmartReplyConfig::default().into())));
/// ```
pub fn set_model_specific_config<
T: std::convert::Into<
std::option::Option<crate::model::evaluation_config::ModelSpecificConfig>,
>,
>(
mut self,
v: T,
) -> Self {
self.model_specific_config = v.into();
self
}
/// The value of [model_specific_config][crate::model::EvaluationConfig::model_specific_config]
/// if it holds a `SmartReplyConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn smart_reply_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::evaluation_config::SmartReplyConfig>>
{
#[allow(unreachable_patterns)]
self.model_specific_config.as_ref().and_then(|v| match v {
crate::model::evaluation_config::ModelSpecificConfig::SmartReplyConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [model_specific_config][crate::model::EvaluationConfig::model_specific_config]
/// to hold a `SmartReplyConfig`.
///
/// Note that all the setters affecting `model_specific_config` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EvaluationConfig;
/// use google_cloud_dialogflow_v2::model::evaluation_config::SmartReplyConfig;
/// let x = EvaluationConfig::new().set_smart_reply_config(SmartReplyConfig::default()/* use setters */);
/// assert!(x.smart_reply_config().is_some());
/// assert!(x.smart_compose_config().is_none());
/// ```
pub fn set_smart_reply_config<
T: std::convert::Into<std::boxed::Box<crate::model::evaluation_config::SmartReplyConfig>>,
>(
mut self,
v: T,
) -> Self {
self.model_specific_config = std::option::Option::Some(
crate::model::evaluation_config::ModelSpecificConfig::SmartReplyConfig(v.into()),
);
self
}
/// The value of [model_specific_config][crate::model::EvaluationConfig::model_specific_config]
/// if it holds a `SmartComposeConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn smart_compose_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::evaluation_config::SmartComposeConfig>>
{
#[allow(unreachable_patterns)]
self.model_specific_config.as_ref().and_then(|v| match v {
crate::model::evaluation_config::ModelSpecificConfig::SmartComposeConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [model_specific_config][crate::model::EvaluationConfig::model_specific_config]
/// to hold a `SmartComposeConfig`.
///
/// Note that all the setters affecting `model_specific_config` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EvaluationConfig;
/// use google_cloud_dialogflow_v2::model::evaluation_config::SmartComposeConfig;
/// let x = EvaluationConfig::new().set_smart_compose_config(SmartComposeConfig::default()/* use setters */);
/// assert!(x.smart_compose_config().is_some());
/// assert!(x.smart_reply_config().is_none());
/// ```
pub fn set_smart_compose_config<
T: std::convert::Into<std::boxed::Box<crate::model::evaluation_config::SmartComposeConfig>>,
>(
mut self,
v: T,
) -> Self {
self.model_specific_config = std::option::Option::Some(
crate::model::evaluation_config::ModelSpecificConfig::SmartComposeConfig(v.into()),
);
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for EvaluationConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.EvaluationConfig"
}
}
/// Defines additional types related to [EvaluationConfig].
#[cfg(feature = "conversation-models")]
pub mod evaluation_config {
#[allow(unused_imports)]
use super::*;
/// Smart reply specific configuration for evaluation job.
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SmartReplyConfig {
/// The allowlist document resource name.
/// Format: `projects/<Project ID>/knowledgeBases/<Knowledge Base
/// ID>/documents/<Document ID>`. Only used for smart reply model.
pub allowlist_document: std::string::String,
/// Required. The model to be evaluated can return multiple results with
/// confidence score on each query. These results will be sorted by the
/// descending order of the scores and we only keep the first
/// max_result_count results as the final results to evaluate.
pub max_result_count: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl SmartReplyConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [allowlist_document][crate::model::evaluation_config::SmartReplyConfig::allowlist_document].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::evaluation_config::SmartReplyConfig;
/// let x = SmartReplyConfig::new().set_allowlist_document("example");
/// ```
pub fn set_allowlist_document<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.allowlist_document = v.into();
self
}
/// Sets the value of [max_result_count][crate::model::evaluation_config::SmartReplyConfig::max_result_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::evaluation_config::SmartReplyConfig;
/// let x = SmartReplyConfig::new().set_max_result_count(42);
/// ```
pub fn set_max_result_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_result_count = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for SmartReplyConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig"
}
}
/// Smart compose specific configuration for evaluation job.
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SmartComposeConfig {
/// The allowlist document resource name.
/// Format: `projects/<Project ID>/knowledgeBases/<Knowledge Base
/// ID>/documents/<Document ID>`. Only used for smart compose model.
pub allowlist_document: std::string::String,
/// Required. The model to be evaluated can return multiple results with
/// confidence score on each query. These results will be sorted by the
/// descending order of the scores and we only keep the first
/// max_result_count results as the final results to evaluate.
pub max_result_count: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl SmartComposeConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [allowlist_document][crate::model::evaluation_config::SmartComposeConfig::allowlist_document].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::evaluation_config::SmartComposeConfig;
/// let x = SmartComposeConfig::new().set_allowlist_document("example");
/// ```
pub fn set_allowlist_document<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.allowlist_document = v.into();
self
}
/// Sets the value of [max_result_count][crate::model::evaluation_config::SmartComposeConfig::max_result_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::evaluation_config::SmartComposeConfig;
/// let x = SmartComposeConfig::new().set_max_result_count(42);
/// ```
pub fn set_max_result_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_result_count = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for SmartComposeConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig"
}
}
/// Specific configurations for different models in order to do evaluation.
#[cfg(feature = "conversation-models")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ModelSpecificConfig {
/// Configuration for smart reply model evaluation.
SmartReplyConfig(std::boxed::Box<crate::model::evaluation_config::SmartReplyConfig>),
/// Configuration for smart compose model evaluation.
SmartComposeConfig(std::boxed::Box<crate::model::evaluation_config::SmartComposeConfig>),
}
}
/// InputDataset used to create model or do evaluation.
/// NextID:5
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InputDataset {
/// Required. ConversationDataset resource name. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversationDatasets/<Conversation Dataset ID>`
pub dataset: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl InputDataset {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [dataset][crate::model::InputDataset::dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputDataset;
/// let x = InputDataset::new().set_dataset("example");
/// ```
pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for InputDataset {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.InputDataset"
}
}
/// Metadata for article suggestion models.
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ArticleSuggestionModelMetadata {
/// Optional. Type of the article suggestion model. If not provided, model_type
/// is used.
pub training_model_type: crate::model::conversation_model::ModelType,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl ArticleSuggestionModelMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [training_model_type][crate::model::ArticleSuggestionModelMetadata::training_model_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ArticleSuggestionModelMetadata;
/// use google_cloud_dialogflow_v2::model::conversation_model::ModelType;
/// let x0 = ArticleSuggestionModelMetadata::new().set_training_model_type(ModelType::SmartReplyDualEncoderModel);
/// let x1 = ArticleSuggestionModelMetadata::new().set_training_model_type(ModelType::SmartReplyBertModel);
/// ```
pub fn set_training_model_type<
T: std::convert::Into<crate::model::conversation_model::ModelType>,
>(
mut self,
v: T,
) -> Self {
self.training_model_type = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for ArticleSuggestionModelMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata"
}
}
/// Metadata for smart reply models.
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SmartReplyModelMetadata {
/// Optional. Type of the smart reply model. If not provided, model_type is
/// used.
pub training_model_type: crate::model::conversation_model::ModelType,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl SmartReplyModelMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [training_model_type][crate::model::SmartReplyModelMetadata::training_model_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SmartReplyModelMetadata;
/// use google_cloud_dialogflow_v2::model::conversation_model::ModelType;
/// let x0 = SmartReplyModelMetadata::new().set_training_model_type(ModelType::SmartReplyDualEncoderModel);
/// let x1 = SmartReplyModelMetadata::new().set_training_model_type(ModelType::SmartReplyBertModel);
/// ```
pub fn set_training_model_type<
T: std::convert::Into<crate::model::conversation_model::ModelType>,
>(
mut self,
v: T,
) -> Self {
self.training_model_type = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for SmartReplyModelMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SmartReplyModelMetadata"
}
}
/// The evaluation metrics for smart reply model.
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SmartReplyMetrics {
/// Percentage of target participant messages in the evaluation dataset for
/// which similar messages have appeared at least once in the allowlist. Should
/// be [0, 1].
pub allowlist_coverage: f32,
/// Metrics of top n smart replies, sorted by [TopNMetric.n][].
pub top_n_metrics: std::vec::Vec<crate::model::smart_reply_metrics::TopNMetrics>,
/// Total number of conversations used to generate this metric.
pub conversation_count: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl SmartReplyMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [allowlist_coverage][crate::model::SmartReplyMetrics::allowlist_coverage].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SmartReplyMetrics;
/// let x = SmartReplyMetrics::new().set_allowlist_coverage(42.0);
/// ```
pub fn set_allowlist_coverage<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.allowlist_coverage = v.into();
self
}
/// Sets the value of [top_n_metrics][crate::model::SmartReplyMetrics::top_n_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SmartReplyMetrics;
/// use google_cloud_dialogflow_v2::model::smart_reply_metrics::TopNMetrics;
/// let x = SmartReplyMetrics::new()
/// .set_top_n_metrics([
/// TopNMetrics::default()/* use setters */,
/// TopNMetrics::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_top_n_metrics<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::smart_reply_metrics::TopNMetrics>,
{
use std::iter::Iterator;
self.top_n_metrics = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [conversation_count][crate::model::SmartReplyMetrics::conversation_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SmartReplyMetrics;
/// let x = SmartReplyMetrics::new().set_conversation_count(42);
/// ```
pub fn set_conversation_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.conversation_count = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for SmartReplyMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SmartReplyMetrics"
}
}
/// Defines additional types related to [SmartReplyMetrics].
#[cfg(feature = "conversation-models")]
pub mod smart_reply_metrics {
#[allow(unused_imports)]
use super::*;
/// Evaluation metrics when retrieving `n` smart replies with the model.
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TopNMetrics {
/// Number of retrieved smart replies. For example, when `n` is 3, this
/// evaluation contains metrics for when Dialogflow retrieves 3 smart replies
/// with the model.
pub n: i32,
/// Defined as `number of queries whose top n smart replies have at least one
/// similar (token match similarity above the defined threshold) reply as the
/// real reply` divided by `number of queries with at least one smart reply`.
/// Value ranges from 0.0 to 1.0 inclusive.
pub recall: f32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl TopNMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [n][crate::model::smart_reply_metrics::TopNMetrics::n].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::smart_reply_metrics::TopNMetrics;
/// let x = TopNMetrics::new().set_n(42);
/// ```
pub fn set_n<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.n = v.into();
self
}
/// Sets the value of [recall][crate::model::smart_reply_metrics::TopNMetrics::recall].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::smart_reply_metrics::TopNMetrics;
/// let x = TopNMetrics::new().set_recall(42.0);
/// ```
pub fn set_recall<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.recall = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for TopNMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics"
}
}
}
/// The request message for
/// [ConversationModels.CreateConversationModel][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel]
///
/// [google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel]: crate::client::ConversationModels::create_conversation_model
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateConversationModelRequest {
/// The project to create conversation model for. Format:
/// `projects/<Project ID>`
pub parent: std::string::String,
/// Required. The conversation model to create.
pub conversation_model: std::option::Option<crate::model::ConversationModel>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl CreateConversationModelRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateConversationModelRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelRequest;
/// let x = CreateConversationModelRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [conversation_model][crate::model::CreateConversationModelRequest::conversation_model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelRequest;
/// use google_cloud_dialogflow_v2::model::ConversationModel;
/// let x = CreateConversationModelRequest::new().set_conversation_model(ConversationModel::default()/* use setters */);
/// ```
pub fn set_conversation_model<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ConversationModel>,
{
self.conversation_model = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [conversation_model][crate::model::CreateConversationModelRequest::conversation_model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelRequest;
/// use google_cloud_dialogflow_v2::model::ConversationModel;
/// let x = CreateConversationModelRequest::new().set_or_clear_conversation_model(Some(ConversationModel::default()/* use setters */));
/// let x = CreateConversationModelRequest::new().set_or_clear_conversation_model(None::<ConversationModel>);
/// ```
pub fn set_or_clear_conversation_model<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ConversationModel>,
{
self.conversation_model = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for CreateConversationModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateConversationModelRequest"
}
}
/// The request message for
/// [ConversationModels.GetConversationModel][google.cloud.dialogflow.v2.ConversationModels.GetConversationModel]
///
/// [google.cloud.dialogflow.v2.ConversationModels.GetConversationModel]: crate::client::ConversationModels::get_conversation_model
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetConversationModelRequest {
/// Required. The conversation model to retrieve. Format:
/// `projects/<Project ID>/conversationModels/<Conversation Model ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl GetConversationModelRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetConversationModelRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetConversationModelRequest;
/// let x = GetConversationModelRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for GetConversationModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetConversationModelRequest"
}
}
/// The request message for
/// [ConversationModels.ListConversationModels][google.cloud.dialogflow.v2.ConversationModels.ListConversationModels]
///
/// [google.cloud.dialogflow.v2.ConversationModels.ListConversationModels]: crate::client::ConversationModels::list_conversation_models
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConversationModelsRequest {
/// Required. The project to list all conversation models for.
/// Format: `projects/<Project ID>`
pub parent: std::string::String,
/// Optional. Maximum number of conversation models to return in a single
/// page. By default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl ListConversationModelsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListConversationModelsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationModelsRequest;
/// let x = ListConversationModelsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListConversationModelsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationModelsRequest;
/// let x = ListConversationModelsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListConversationModelsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationModelsRequest;
/// let x = ListConversationModelsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for ListConversationModelsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListConversationModelsRequest"
}
}
/// The response message for
/// [ConversationModels.ListConversationModels][google.cloud.dialogflow.v2.ConversationModels.ListConversationModels]
///
/// [google.cloud.dialogflow.v2.ConversationModels.ListConversationModels]: crate::client::ConversationModels::list_conversation_models
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConversationModelsResponse {
/// The list of models to return.
pub conversation_models: std::vec::Vec<crate::model::ConversationModel>,
/// Token to retrieve the next page of results, or empty if there are no more
/// results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl ListConversationModelsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_models][crate::model::ListConversationModelsResponse::conversation_models].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationModelsResponse;
/// use google_cloud_dialogflow_v2::model::ConversationModel;
/// let x = ListConversationModelsResponse::new()
/// .set_conversation_models([
/// ConversationModel::default()/* use setters */,
/// ConversationModel::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_conversation_models<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ConversationModel>,
{
use std::iter::Iterator;
self.conversation_models = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListConversationModelsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationModelsResponse;
/// let x = ListConversationModelsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for ListConversationModelsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListConversationModelsResponse"
}
}
#[cfg(feature = "conversation-models")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListConversationModelsResponse {
type PageItem = crate::model::ConversationModel;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.conversation_models
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [ConversationModels.DeleteConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel]
///
/// [google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel]: crate::client::ConversationModels::delete_conversation_model
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteConversationModelRequest {
/// Required. The conversation model to delete. Format:
/// `projects/<Project ID>/conversationModels/<Conversation Model ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl DeleteConversationModelRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteConversationModelRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteConversationModelRequest;
/// let x = DeleteConversationModelRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for DeleteConversationModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteConversationModelRequest"
}
}
/// The request message for
/// [ConversationModels.DeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel]
///
/// [google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel]: crate::client::ConversationModels::deploy_conversation_model
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeployConversationModelRequest {
/// Required. The conversation model to deploy. Format:
/// `projects/<Project ID>/conversationModels/<Conversation Model ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl DeployConversationModelRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeployConversationModelRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeployConversationModelRequest;
/// let x = DeployConversationModelRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for DeployConversationModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeployConversationModelRequest"
}
}
/// The request message for
/// [ConversationModels.UndeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel]
///
/// [google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel]: crate::client::ConversationModels::undeploy_conversation_model
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeployConversationModelRequest {
/// Required. The conversation model to undeploy. Format:
/// `projects/<Project ID>/conversationModels/<Conversation Model ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl UndeployConversationModelRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::UndeployConversationModelRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UndeployConversationModelRequest;
/// let x = UndeployConversationModelRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for UndeployConversationModelRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UndeployConversationModelRequest"
}
}
/// The request message for
/// [ConversationModels.GetConversationModelEvaluation][google.cloud.dialogflow.v2.ConversationModels.GetConversationModelEvaluation]
///
/// [google.cloud.dialogflow.v2.ConversationModels.GetConversationModelEvaluation]: crate::client::ConversationModels::get_conversation_model_evaluation
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetConversationModelEvaluationRequest {
/// Required. The conversation model evaluation resource name. Format:
/// `projects/<Project ID>/conversationModels/<Conversation Model
/// ID>/evaluations/<Evaluation ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl GetConversationModelEvaluationRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetConversationModelEvaluationRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetConversationModelEvaluationRequest;
/// let x = GetConversationModelEvaluationRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for GetConversationModelEvaluationRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest"
}
}
/// The request message for
/// [ConversationModels.ListConversationModelEvaluations][google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations]
///
/// [google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations]: crate::client::ConversationModels::list_conversation_model_evaluations
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConversationModelEvaluationsRequest {
/// Required. The conversation model resource name. Format:
/// `projects/<Project ID>/conversationModels/<Conversation Model ID>`
pub parent: std::string::String,
/// Optional. Maximum number of evaluations to return in a
/// single page. By default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl ListConversationModelEvaluationsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListConversationModelEvaluationsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationModelEvaluationsRequest;
/// let x = ListConversationModelEvaluationsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListConversationModelEvaluationsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationModelEvaluationsRequest;
/// let x = ListConversationModelEvaluationsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListConversationModelEvaluationsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationModelEvaluationsRequest;
/// let x = ListConversationModelEvaluationsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for ListConversationModelEvaluationsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest"
}
}
/// The response message for
/// [ConversationModels.ListConversationModelEvaluations][google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations]
///
/// [google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations]: crate::client::ConversationModels::list_conversation_model_evaluations
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConversationModelEvaluationsResponse {
/// The list of evaluations to return.
pub conversation_model_evaluations: std::vec::Vec<crate::model::ConversationModelEvaluation>,
/// Token to retrieve the next page of results, or empty if there are no more
/// results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl ListConversationModelEvaluationsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_model_evaluations][crate::model::ListConversationModelEvaluationsResponse::conversation_model_evaluations].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationModelEvaluationsResponse;
/// use google_cloud_dialogflow_v2::model::ConversationModelEvaluation;
/// let x = ListConversationModelEvaluationsResponse::new()
/// .set_conversation_model_evaluations([
/// ConversationModelEvaluation::default()/* use setters */,
/// ConversationModelEvaluation::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_conversation_model_evaluations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ConversationModelEvaluation>,
{
use std::iter::Iterator;
self.conversation_model_evaluations = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListConversationModelEvaluationsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationModelEvaluationsResponse;
/// let x = ListConversationModelEvaluationsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for ListConversationModelEvaluationsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse"
}
}
#[cfg(feature = "conversation-models")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse
for ListConversationModelEvaluationsResponse
{
type PageItem = crate::model::ConversationModelEvaluation;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.conversation_model_evaluations
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [ConversationModels.CreateConversationModelEvaluation][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation]
///
/// [google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation]: crate::client::ConversationModels::create_conversation_model_evaluation
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateConversationModelEvaluationRequest {
/// Required. The conversation model resource name. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversationModels/<Conversation Model ID>`
pub parent: std::string::String,
/// Required. The conversation model evaluation to be created.
pub conversation_model_evaluation:
std::option::Option<crate::model::ConversationModelEvaluation>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl CreateConversationModelEvaluationRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateConversationModelEvaluationRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelEvaluationRequest;
/// let x = CreateConversationModelEvaluationRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [conversation_model_evaluation][crate::model::CreateConversationModelEvaluationRequest::conversation_model_evaluation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelEvaluationRequest;
/// use google_cloud_dialogflow_v2::model::ConversationModelEvaluation;
/// let x = CreateConversationModelEvaluationRequest::new().set_conversation_model_evaluation(ConversationModelEvaluation::default()/* use setters */);
/// ```
pub fn set_conversation_model_evaluation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ConversationModelEvaluation>,
{
self.conversation_model_evaluation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [conversation_model_evaluation][crate::model::CreateConversationModelEvaluationRequest::conversation_model_evaluation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelEvaluationRequest;
/// use google_cloud_dialogflow_v2::model::ConversationModelEvaluation;
/// let x = CreateConversationModelEvaluationRequest::new().set_or_clear_conversation_model_evaluation(Some(ConversationModelEvaluation::default()/* use setters */));
/// let x = CreateConversationModelEvaluationRequest::new().set_or_clear_conversation_model_evaluation(None::<ConversationModelEvaluation>);
/// ```
pub fn set_or_clear_conversation_model_evaluation<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::ConversationModelEvaluation>,
{
self.conversation_model_evaluation = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for CreateConversationModelEvaluationRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest"
}
}
/// Metadata for a
/// [ConversationModels.CreateConversationModel][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel]
/// operation.
///
/// [google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel]: crate::client::ConversationModels::create_conversation_model
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateConversationModelOperationMetadata {
/// The resource name of the conversation model. Format:
/// `projects/<Project ID>/conversationModels/<Conversation Model Id>`
pub conversation_model: std::string::String,
/// State of CreateConversationModel operation.
pub state: crate::model::create_conversation_model_operation_metadata::State,
/// Timestamp when the request to create conversation model is submitted. The
/// time is measured on server side.
pub create_time: std::option::Option<wkt::Timestamp>,
/// The time when the operation finished.
pub done_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl CreateConversationModelOperationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_model][crate::model::CreateConversationModelOperationMetadata::conversation_model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelOperationMetadata;
/// let x = CreateConversationModelOperationMetadata::new().set_conversation_model("example");
/// ```
pub fn set_conversation_model<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_model = v.into();
self
}
/// Sets the value of [state][crate::model::CreateConversationModelOperationMetadata::state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelOperationMetadata;
/// use google_cloud_dialogflow_v2::model::create_conversation_model_operation_metadata::State;
/// let x0 = CreateConversationModelOperationMetadata::new().set_state(State::Pending);
/// let x1 = CreateConversationModelOperationMetadata::new().set_state(State::Succeeded);
/// let x2 = CreateConversationModelOperationMetadata::new().set_state(State::Failed);
/// ```
pub fn set_state<
T: std::convert::Into<crate::model::create_conversation_model_operation_metadata::State>,
>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
/// Sets the value of [create_time][crate::model::CreateConversationModelOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = CreateConversationModelOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::CreateConversationModelOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = CreateConversationModelOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = CreateConversationModelOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [done_time][crate::model::CreateConversationModelOperationMetadata::done_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = CreateConversationModelOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_done_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.done_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [done_time][crate::model::CreateConversationModelOperationMetadata::done_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = CreateConversationModelOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
/// let x = CreateConversationModelOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.done_time = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for CreateConversationModelOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata"
}
}
/// Defines additional types related to [CreateConversationModelOperationMetadata].
#[cfg(feature = "conversation-models")]
pub mod create_conversation_model_operation_metadata {
#[allow(unused_imports)]
use super::*;
/// State of CreateConversationModel operation.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "conversation-models")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
/// Invalid.
Unspecified,
/// Request is submitted, but training has not started yet.
/// The model may remain in this state until there is enough capacity to
/// start training.
Pending,
/// The training has succeeded.
Succeeded,
/// The training has succeeded.
Failed,
/// The training has been cancelled.
Cancelled,
/// The training is in cancelling state.
Cancelling,
/// Custom model is training.
Training,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [State::value] or
/// [State::name].
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "conversation-models")]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "conversation-models")]
impl State {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Pending => std::option::Option::Some(1),
Self::Succeeded => std::option::Option::Some(2),
Self::Failed => std::option::Option::Some(3),
Self::Cancelled => std::option::Option::Some(4),
Self::Cancelling => std::option::Option::Some(5),
Self::Training => std::option::Option::Some(6),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Pending => std::option::Option::Some("PENDING"),
Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
Self::Failed => std::option::Option::Some("FAILED"),
Self::Cancelled => std::option::Option::Some("CANCELLED"),
Self::Cancelling => std::option::Option::Some("CANCELLING"),
Self::Training => std::option::Option::Some("TRAINING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "conversation-models")]
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "conversation-models")]
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())
}
}
#[cfg(feature = "conversation-models")]
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Pending,
2 => Self::Succeeded,
3 => Self::Failed,
4 => Self::Cancelled,
5 => Self::Cancelling,
6 => Self::Training,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "conversation-models")]
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"PENDING" => Self::Pending,
"SUCCEEDED" => Self::Succeeded,
"FAILED" => Self::Failed,
"CANCELLED" => Self::Cancelled,
"CANCELLING" => Self::Cancelling,
"TRAINING" => Self::Training,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "conversation-models")]
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::Pending => serializer.serialize_i32(1),
Self::Succeeded => serializer.serialize_i32(2),
Self::Failed => serializer.serialize_i32(3),
Self::Cancelled => serializer.serialize_i32(4),
Self::Cancelling => serializer.serialize_i32(5),
Self::Training => serializer.serialize_i32(6),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "conversation-models")]
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.dialogflow.v2.CreateConversationModelOperationMetadata.State",
))
}
}
}
/// Metadata for a
/// [ConversationModels.DeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel]
/// operation.
///
/// [google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel]: crate::client::ConversationModels::deploy_conversation_model
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeployConversationModelOperationMetadata {
/// The resource name of the conversation model. Format:
/// `projects/<Project ID>/conversationModels/<Conversation Model Id>`
pub conversation_model: std::string::String,
/// Timestamp when request to deploy conversation model was submitted. The time
/// is measured on server side.
pub create_time: std::option::Option<wkt::Timestamp>,
/// The time when the operation finished.
pub done_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl DeployConversationModelOperationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_model][crate::model::DeployConversationModelOperationMetadata::conversation_model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeployConversationModelOperationMetadata;
/// let x = DeployConversationModelOperationMetadata::new().set_conversation_model("example");
/// ```
pub fn set_conversation_model<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_model = v.into();
self
}
/// Sets the value of [create_time][crate::model::DeployConversationModelOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeployConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = DeployConversationModelOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::DeployConversationModelOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeployConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = DeployConversationModelOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = DeployConversationModelOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [done_time][crate::model::DeployConversationModelOperationMetadata::done_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeployConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = DeployConversationModelOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_done_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.done_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [done_time][crate::model::DeployConversationModelOperationMetadata::done_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeployConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = DeployConversationModelOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
/// let x = DeployConversationModelOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.done_time = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for DeployConversationModelOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata"
}
}
/// Metadata for a
/// [ConversationModels.UndeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel]
/// operation.
///
/// [google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel]: crate::client::ConversationModels::undeploy_conversation_model
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeployConversationModelOperationMetadata {
/// The resource name of the conversation model. Format:
/// `projects/<Project ID>/conversationModels/<Conversation Model Id>`
pub conversation_model: std::string::String,
/// Timestamp when the request to undeploy conversation model was submitted.
/// The time is measured on server side.
pub create_time: std::option::Option<wkt::Timestamp>,
/// The time when the operation finished.
pub done_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl UndeployConversationModelOperationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_model][crate::model::UndeployConversationModelOperationMetadata::conversation_model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UndeployConversationModelOperationMetadata;
/// let x = UndeployConversationModelOperationMetadata::new().set_conversation_model("example");
/// ```
pub fn set_conversation_model<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_model = v.into();
self
}
/// Sets the value of [create_time][crate::model::UndeployConversationModelOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UndeployConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = UndeployConversationModelOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::UndeployConversationModelOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UndeployConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = UndeployConversationModelOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = UndeployConversationModelOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [done_time][crate::model::UndeployConversationModelOperationMetadata::done_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UndeployConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = UndeployConversationModelOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_done_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.done_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [done_time][crate::model::UndeployConversationModelOperationMetadata::done_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UndeployConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = UndeployConversationModelOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
/// let x = UndeployConversationModelOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.done_time = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for UndeployConversationModelOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata"
}
}
/// Metadata for a
/// [ConversationModels.DeleteConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel]
/// operation.
///
/// [google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel]: crate::client::ConversationModels::delete_conversation_model
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteConversationModelOperationMetadata {
/// The resource name of the conversation model. Format:
/// `projects/<Project ID>/conversationModels/<Conversation Model Id>`
pub conversation_model: std::string::String,
/// Timestamp when delete conversation model request was created. The time is
/// measured on server side.
pub create_time: std::option::Option<wkt::Timestamp>,
/// The time when the operation finished.
pub done_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl DeleteConversationModelOperationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_model][crate::model::DeleteConversationModelOperationMetadata::conversation_model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteConversationModelOperationMetadata;
/// let x = DeleteConversationModelOperationMetadata::new().set_conversation_model("example");
/// ```
pub fn set_conversation_model<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_model = v.into();
self
}
/// Sets the value of [create_time][crate::model::DeleteConversationModelOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = DeleteConversationModelOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::DeleteConversationModelOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = DeleteConversationModelOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = DeleteConversationModelOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [done_time][crate::model::DeleteConversationModelOperationMetadata::done_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = DeleteConversationModelOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_done_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.done_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [done_time][crate::model::DeleteConversationModelOperationMetadata::done_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteConversationModelOperationMetadata;
/// use wkt::Timestamp;
/// let x = DeleteConversationModelOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
/// let x = DeleteConversationModelOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.done_time = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for DeleteConversationModelOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata"
}
}
/// Metadata for a
/// [ConversationModels.CreateConversationModelEvaluation][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation]
/// operation.
///
/// [google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation]: crate::client::ConversationModels::create_conversation_model_evaluation
#[cfg(feature = "conversation-models")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateConversationModelEvaluationOperationMetadata {
/// The resource name of the conversation model. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversationModels/<Conversation Model Id>/evaluations/<Evaluation Id>`
pub conversation_model_evaluation: std::string::String,
/// The resource name of the conversation model. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversationModels/<Conversation Model Id>`
pub conversation_model: std::string::String,
/// State of CreateConversationModel operation.
pub state: crate::model::create_conversation_model_evaluation_operation_metadata::State,
/// Timestamp when the request to create conversation model was submitted. The
/// time is measured on server side.
pub create_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-models")]
impl CreateConversationModelEvaluationOperationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_model_evaluation][crate::model::CreateConversationModelEvaluationOperationMetadata::conversation_model_evaluation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelEvaluationOperationMetadata;
/// let x = CreateConversationModelEvaluationOperationMetadata::new().set_conversation_model_evaluation("example");
/// ```
pub fn set_conversation_model_evaluation<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_model_evaluation = v.into();
self
}
/// Sets the value of [conversation_model][crate::model::CreateConversationModelEvaluationOperationMetadata::conversation_model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelEvaluationOperationMetadata;
/// let x = CreateConversationModelEvaluationOperationMetadata::new().set_conversation_model("example");
/// ```
pub fn set_conversation_model<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_model = v.into();
self
}
/// Sets the value of [state][crate::model::CreateConversationModelEvaluationOperationMetadata::state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelEvaluationOperationMetadata;
/// use google_cloud_dialogflow_v2::model::create_conversation_model_evaluation_operation_metadata::State;
/// let x0 = CreateConversationModelEvaluationOperationMetadata::new().set_state(State::Initializing);
/// let x1 = CreateConversationModelEvaluationOperationMetadata::new().set_state(State::Running);
/// let x2 = CreateConversationModelEvaluationOperationMetadata::new().set_state(State::Cancelled);
/// ```
pub fn set_state<
T: std::convert::Into<
crate::model::create_conversation_model_evaluation_operation_metadata::State,
>,
>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
/// Sets the value of [create_time][crate::model::CreateConversationModelEvaluationOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelEvaluationOperationMetadata;
/// use wkt::Timestamp;
/// let x = CreateConversationModelEvaluationOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::CreateConversationModelEvaluationOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationModelEvaluationOperationMetadata;
/// use wkt::Timestamp;
/// let x = CreateConversationModelEvaluationOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = CreateConversationModelEvaluationOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
}
#[cfg(feature = "conversation-models")]
impl wkt::message::Message for CreateConversationModelEvaluationOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata"
}
}
/// Defines additional types related to [CreateConversationModelEvaluationOperationMetadata].
#[cfg(feature = "conversation-models")]
pub mod create_conversation_model_evaluation_operation_metadata {
#[allow(unused_imports)]
use super::*;
/// State of CreateConversationModel operation.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "conversation-models")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
/// Operation status not specified.
Unspecified,
/// The operation is being prepared.
Initializing,
/// The operation is running.
Running,
/// The operation is cancelled.
Cancelled,
/// The operation has succeeded.
Succeeded,
/// The operation has failed.
Failed,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [State::value] or
/// [State::name].
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "conversation-models")]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "conversation-models")]
impl State {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Initializing => std::option::Option::Some(1),
Self::Running => std::option::Option::Some(2),
Self::Cancelled => std::option::Option::Some(3),
Self::Succeeded => std::option::Option::Some(4),
Self::Failed => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Initializing => std::option::Option::Some("INITIALIZING"),
Self::Running => std::option::Option::Some("RUNNING"),
Self::Cancelled => std::option::Option::Some("CANCELLED"),
Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
Self::Failed => std::option::Option::Some("FAILED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "conversation-models")]
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "conversation-models")]
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())
}
}
#[cfg(feature = "conversation-models")]
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Initializing,
2 => Self::Running,
3 => Self::Cancelled,
4 => Self::Succeeded,
5 => Self::Failed,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "conversation-models")]
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"INITIALIZING" => Self::Initializing,
"RUNNING" => Self::Running,
"CANCELLED" => Self::Cancelled,
"SUCCEEDED" => Self::Succeeded,
"FAILED" => Self::Failed,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "conversation-models")]
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::Initializing => serializer.serialize_i32(1),
Self::Running => serializer.serialize_i32(2),
Self::Cancelled => serializer.serialize_i32(3),
Self::Succeeded => serializer.serialize_i32(4),
Self::Failed => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "conversation-models")]
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.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.State"))
}
}
}
/// Defines the services to connect to incoming Dialogflow conversations.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationProfile {
/// The unique identifier of this conversation profile.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversationProfiles/<Conversation Profile ID>`.
pub name: std::string::String,
/// Required. Human readable name for this profile. Max length 1024 bytes.
pub display_name: std::string::String,
/// Output only. Create time of the conversation profile.
pub create_time: std::option::Option<wkt::Timestamp>,
/// Output only. Update time of the conversation profile.
pub update_time: std::option::Option<wkt::Timestamp>,
/// Configuration for an automated agent to use with this profile.
pub automated_agent_config: std::option::Option<crate::model::AutomatedAgentConfig>,
/// Configuration for agent assistance to use with this profile.
pub human_agent_assistant_config: std::option::Option<crate::model::HumanAgentAssistantConfig>,
/// Configuration for connecting to a live agent.
///
/// Currently, this feature is not general available, please contact Google
/// to get access.
pub human_agent_handoff_config: std::option::Option<crate::model::HumanAgentHandoffConfig>,
/// Configuration for publishing conversation lifecycle events.
pub notification_config: std::option::Option<crate::model::NotificationConfig>,
/// Configuration for logging conversation lifecycle events.
pub logging_config: std::option::Option<crate::model::LoggingConfig>,
/// Configuration for publishing new message events. Event will be sent in
/// format of [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent]
///
/// [google.cloud.dialogflow.v2.ConversationEvent]: crate::model::ConversationEvent
pub new_message_event_notification_config:
std::option::Option<crate::model::NotificationConfig>,
/// Optional. Configuration for publishing transcription intermediate results.
/// Event will be sent in format of
/// [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent]. If
/// configured, the following information will be populated as
/// [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent] Pub/Sub
/// message attributes:
///
/// - "participant_id"
/// - "participant_role"
/// - "message_id"
///
/// [google.cloud.dialogflow.v2.ConversationEvent]: crate::model::ConversationEvent
pub new_recognition_result_notification_config:
std::option::Option<crate::model::NotificationConfig>,
/// Settings for speech transcription.
pub stt_config: std::option::Option<crate::model::SpeechToTextConfig>,
/// Language code for the conversation profile. If not specified, the language
/// is en-US. Language at ConversationProfile should be set for all non en-US
/// languages.
/// This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
/// language tag. Example: "en-US".
pub language_code: std::string::String,
/// The time zone of this conversational profile from the
/// [time zone database](https://www.iana.org/time-zones), e.g.,
/// America/New_York, Europe/Paris. Defaults to America/New_York.
pub time_zone: std::string::String,
/// Name of the CX SecuritySettings reference for the agent.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/securitySettings/<Security Settings ID>`.
pub security_settings: std::string::String,
/// Configuration for Text-to-Speech synthesization.
///
/// Used by Phone Gateway to specify synthesization options. If agent defines
/// synthesization options as well, agent settings overrides the option here.
pub tts_config: std::option::Option<crate::model::SynthesizeSpeechConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl ConversationProfile {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::ConversationProfile::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = ConversationProfile::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [display_name][crate::model::ConversationProfile::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = ConversationProfile::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [create_time][crate::model::ConversationProfile::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use wkt::Timestamp;
/// let x = ConversationProfile::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::ConversationProfile::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use wkt::Timestamp;
/// let x = ConversationProfile::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = ConversationProfile::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [update_time][crate::model::ConversationProfile::update_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use wkt::Timestamp;
/// let x = ConversationProfile::new().set_update_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_time][crate::model::ConversationProfile::update_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use wkt::Timestamp;
/// let x = ConversationProfile::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
/// let x = ConversationProfile::new().set_or_clear_update_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [automated_agent_config][crate::model::ConversationProfile::automated_agent_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::AutomatedAgentConfig;
/// let x = ConversationProfile::new().set_automated_agent_config(AutomatedAgentConfig::default()/* use setters */);
/// ```
pub fn set_automated_agent_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AutomatedAgentConfig>,
{
self.automated_agent_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [automated_agent_config][crate::model::ConversationProfile::automated_agent_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::AutomatedAgentConfig;
/// let x = ConversationProfile::new().set_or_clear_automated_agent_config(Some(AutomatedAgentConfig::default()/* use setters */));
/// let x = ConversationProfile::new().set_or_clear_automated_agent_config(None::<AutomatedAgentConfig>);
/// ```
pub fn set_or_clear_automated_agent_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AutomatedAgentConfig>,
{
self.automated_agent_config = v.map(|x| x.into());
self
}
/// Sets the value of [human_agent_assistant_config][crate::model::ConversationProfile::human_agent_assistant_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::HumanAgentAssistantConfig;
/// let x = ConversationProfile::new().set_human_agent_assistant_config(HumanAgentAssistantConfig::default()/* use setters */);
/// ```
pub fn set_human_agent_assistant_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::HumanAgentAssistantConfig>,
{
self.human_agent_assistant_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [human_agent_assistant_config][crate::model::ConversationProfile::human_agent_assistant_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::HumanAgentAssistantConfig;
/// let x = ConversationProfile::new().set_or_clear_human_agent_assistant_config(Some(HumanAgentAssistantConfig::default()/* use setters */));
/// let x = ConversationProfile::new().set_or_clear_human_agent_assistant_config(None::<HumanAgentAssistantConfig>);
/// ```
pub fn set_or_clear_human_agent_assistant_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::HumanAgentAssistantConfig>,
{
self.human_agent_assistant_config = v.map(|x| x.into());
self
}
/// Sets the value of [human_agent_handoff_config][crate::model::ConversationProfile::human_agent_handoff_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::HumanAgentHandoffConfig;
/// let x = ConversationProfile::new().set_human_agent_handoff_config(HumanAgentHandoffConfig::default()/* use setters */);
/// ```
pub fn set_human_agent_handoff_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::HumanAgentHandoffConfig>,
{
self.human_agent_handoff_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [human_agent_handoff_config][crate::model::ConversationProfile::human_agent_handoff_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::HumanAgentHandoffConfig;
/// let x = ConversationProfile::new().set_or_clear_human_agent_handoff_config(Some(HumanAgentHandoffConfig::default()/* use setters */));
/// let x = ConversationProfile::new().set_or_clear_human_agent_handoff_config(None::<HumanAgentHandoffConfig>);
/// ```
pub fn set_or_clear_human_agent_handoff_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::HumanAgentHandoffConfig>,
{
self.human_agent_handoff_config = v.map(|x| x.into());
self
}
/// Sets the value of [notification_config][crate::model::ConversationProfile::notification_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::NotificationConfig;
/// let x = ConversationProfile::new().set_notification_config(NotificationConfig::default()/* use setters */);
/// ```
pub fn set_notification_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::NotificationConfig>,
{
self.notification_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [notification_config][crate::model::ConversationProfile::notification_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::NotificationConfig;
/// let x = ConversationProfile::new().set_or_clear_notification_config(Some(NotificationConfig::default()/* use setters */));
/// let x = ConversationProfile::new().set_or_clear_notification_config(None::<NotificationConfig>);
/// ```
pub fn set_or_clear_notification_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::NotificationConfig>,
{
self.notification_config = v.map(|x| x.into());
self
}
/// Sets the value of [logging_config][crate::model::ConversationProfile::logging_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::LoggingConfig;
/// let x = ConversationProfile::new().set_logging_config(LoggingConfig::default()/* use setters */);
/// ```
pub fn set_logging_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::LoggingConfig>,
{
self.logging_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [logging_config][crate::model::ConversationProfile::logging_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::LoggingConfig;
/// let x = ConversationProfile::new().set_or_clear_logging_config(Some(LoggingConfig::default()/* use setters */));
/// let x = ConversationProfile::new().set_or_clear_logging_config(None::<LoggingConfig>);
/// ```
pub fn set_or_clear_logging_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::LoggingConfig>,
{
self.logging_config = v.map(|x| x.into());
self
}
/// Sets the value of [new_message_event_notification_config][crate::model::ConversationProfile::new_message_event_notification_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::NotificationConfig;
/// let x = ConversationProfile::new().set_new_message_event_notification_config(NotificationConfig::default()/* use setters */);
/// ```
pub fn set_new_message_event_notification_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::NotificationConfig>,
{
self.new_message_event_notification_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [new_message_event_notification_config][crate::model::ConversationProfile::new_message_event_notification_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::NotificationConfig;
/// let x = ConversationProfile::new().set_or_clear_new_message_event_notification_config(Some(NotificationConfig::default()/* use setters */));
/// let x = ConversationProfile::new().set_or_clear_new_message_event_notification_config(None::<NotificationConfig>);
/// ```
pub fn set_or_clear_new_message_event_notification_config<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::NotificationConfig>,
{
self.new_message_event_notification_config = v.map(|x| x.into());
self
}
/// Sets the value of [new_recognition_result_notification_config][crate::model::ConversationProfile::new_recognition_result_notification_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::NotificationConfig;
/// let x = ConversationProfile::new().set_new_recognition_result_notification_config(NotificationConfig::default()/* use setters */);
/// ```
pub fn set_new_recognition_result_notification_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::NotificationConfig>,
{
self.new_recognition_result_notification_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [new_recognition_result_notification_config][crate::model::ConversationProfile::new_recognition_result_notification_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::NotificationConfig;
/// let x = ConversationProfile::new().set_or_clear_new_recognition_result_notification_config(Some(NotificationConfig::default()/* use setters */));
/// let x = ConversationProfile::new().set_or_clear_new_recognition_result_notification_config(None::<NotificationConfig>);
/// ```
pub fn set_or_clear_new_recognition_result_notification_config<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::NotificationConfig>,
{
self.new_recognition_result_notification_config = v.map(|x| x.into());
self
}
/// Sets the value of [stt_config][crate::model::ConversationProfile::stt_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::SpeechToTextConfig;
/// let x = ConversationProfile::new().set_stt_config(SpeechToTextConfig::default()/* use setters */);
/// ```
pub fn set_stt_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SpeechToTextConfig>,
{
self.stt_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [stt_config][crate::model::ConversationProfile::stt_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::SpeechToTextConfig;
/// let x = ConversationProfile::new().set_or_clear_stt_config(Some(SpeechToTextConfig::default()/* use setters */));
/// let x = ConversationProfile::new().set_or_clear_stt_config(None::<SpeechToTextConfig>);
/// ```
pub fn set_or_clear_stt_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SpeechToTextConfig>,
{
self.stt_config = v.map(|x| x.into());
self
}
/// Sets the value of [language_code][crate::model::ConversationProfile::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = ConversationProfile::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [time_zone][crate::model::ConversationProfile::time_zone].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = ConversationProfile::new().set_time_zone("example");
/// ```
pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.time_zone = v.into();
self
}
/// Sets the value of [security_settings][crate::model::ConversationProfile::security_settings].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = ConversationProfile::new().set_security_settings("example");
/// ```
pub fn set_security_settings<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.security_settings = v.into();
self
}
/// Sets the value of [tts_config][crate::model::ConversationProfile::tts_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::SynthesizeSpeechConfig;
/// let x = ConversationProfile::new().set_tts_config(SynthesizeSpeechConfig::default()/* use setters */);
/// ```
pub fn set_tts_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SynthesizeSpeechConfig>,
{
self.tts_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tts_config][crate::model::ConversationProfile::tts_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationProfile;
/// use google_cloud_dialogflow_v2::model::SynthesizeSpeechConfig;
/// let x = ConversationProfile::new().set_or_clear_tts_config(Some(SynthesizeSpeechConfig::default()/* use setters */));
/// let x = ConversationProfile::new().set_or_clear_tts_config(None::<SynthesizeSpeechConfig>);
/// ```
pub fn set_or_clear_tts_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SynthesizeSpeechConfig>,
{
self.tts_config = v.map(|x| x.into());
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for ConversationProfile {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ConversationProfile"
}
}
/// The request message for
/// [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles].
///
/// [google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles]: crate::client::ConversationProfiles::list_conversation_profiles
#[cfg(feature = "conversation-profiles")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConversationProfilesRequest {
/// Required. The project to list all conversation profiles from.
/// Format: `projects/<Project ID>/locations/<Location ID>`.
pub parent: std::string::String,
/// The maximum number of items to return in a single page. By
/// default 100 and at most 1000.
pub page_size: i32,
/// The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-profiles")]
impl ListConversationProfilesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListConversationProfilesRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationProfilesRequest;
/// let x = ListConversationProfilesRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListConversationProfilesRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationProfilesRequest;
/// let x = ListConversationProfilesRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListConversationProfilesRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationProfilesRequest;
/// let x = ListConversationProfilesRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "conversation-profiles")]
impl wkt::message::Message for ListConversationProfilesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListConversationProfilesRequest"
}
}
/// The response message for
/// [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles].
///
/// [google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles]: crate::client::ConversationProfiles::list_conversation_profiles
#[cfg(feature = "conversation-profiles")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListConversationProfilesResponse {
/// The list of project conversation profiles. There is a maximum number
/// of items returned based on the page_size field in the request.
pub conversation_profiles: std::vec::Vec<crate::model::ConversationProfile>,
/// Token to retrieve the next page of results, or empty if there are no
/// more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-profiles")]
impl ListConversationProfilesResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_profiles][crate::model::ListConversationProfilesResponse::conversation_profiles].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationProfilesResponse;
/// use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = ListConversationProfilesResponse::new()
/// .set_conversation_profiles([
/// ConversationProfile::default()/* use setters */,
/// ConversationProfile::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_conversation_profiles<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ConversationProfile>,
{
use std::iter::Iterator;
self.conversation_profiles = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListConversationProfilesResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListConversationProfilesResponse;
/// let x = ListConversationProfilesResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "conversation-profiles")]
impl wkt::message::Message for ListConversationProfilesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListConversationProfilesResponse"
}
}
#[cfg(feature = "conversation-profiles")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListConversationProfilesResponse {
type PageItem = crate::model::ConversationProfile;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.conversation_profiles
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [ConversationProfiles.GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile].
///
/// [google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]: crate::client::ConversationProfiles::get_conversation_profile
#[cfg(feature = "conversation-profiles")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetConversationProfileRequest {
/// Required. The resource name of the conversation profile.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversationProfiles/<Conversation Profile ID>`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-profiles")]
impl GetConversationProfileRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetConversationProfileRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetConversationProfileRequest;
/// let x = GetConversationProfileRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "conversation-profiles")]
impl wkt::message::Message for GetConversationProfileRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetConversationProfileRequest"
}
}
/// The request message for
/// [ConversationProfiles.CreateConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.CreateConversationProfile].
///
/// [google.cloud.dialogflow.v2.ConversationProfiles.CreateConversationProfile]: crate::client::ConversationProfiles::create_conversation_profile
#[cfg(feature = "conversation-profiles")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateConversationProfileRequest {
/// Required. The project to create a conversation profile for.
/// Format: `projects/<Project ID>/locations/<Location ID>`.
pub parent: std::string::String,
/// Required. The conversation profile to create.
pub conversation_profile: std::option::Option<crate::model::ConversationProfile>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-profiles")]
impl CreateConversationProfileRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateConversationProfileRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationProfileRequest;
/// let x = CreateConversationProfileRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [conversation_profile][crate::model::CreateConversationProfileRequest::conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationProfileRequest;
/// use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = CreateConversationProfileRequest::new().set_conversation_profile(ConversationProfile::default()/* use setters */);
/// ```
pub fn set_conversation_profile<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ConversationProfile>,
{
self.conversation_profile = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [conversation_profile][crate::model::CreateConversationProfileRequest::conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateConversationProfileRequest;
/// use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = CreateConversationProfileRequest::new().set_or_clear_conversation_profile(Some(ConversationProfile::default()/* use setters */));
/// let x = CreateConversationProfileRequest::new().set_or_clear_conversation_profile(None::<ConversationProfile>);
/// ```
pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ConversationProfile>,
{
self.conversation_profile = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversation-profiles")]
impl wkt::message::Message for CreateConversationProfileRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateConversationProfileRequest"
}
}
/// The request message for
/// [ConversationProfiles.UpdateConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.UpdateConversationProfile].
///
/// [google.cloud.dialogflow.v2.ConversationProfiles.UpdateConversationProfile]: crate::client::ConversationProfiles::update_conversation_profile
#[cfg(feature = "conversation-profiles")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateConversationProfileRequest {
/// Required. The conversation profile to update.
pub conversation_profile: std::option::Option<crate::model::ConversationProfile>,
/// Required. The mask to control which fields to update.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-profiles")]
impl UpdateConversationProfileRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_profile][crate::model::UpdateConversationProfileRequest::conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateConversationProfileRequest;
/// use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = UpdateConversationProfileRequest::new().set_conversation_profile(ConversationProfile::default()/* use setters */);
/// ```
pub fn set_conversation_profile<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ConversationProfile>,
{
self.conversation_profile = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [conversation_profile][crate::model::UpdateConversationProfileRequest::conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateConversationProfileRequest;
/// use google_cloud_dialogflow_v2::model::ConversationProfile;
/// let x = UpdateConversationProfileRequest::new().set_or_clear_conversation_profile(Some(ConversationProfile::default()/* use setters */));
/// let x = UpdateConversationProfileRequest::new().set_or_clear_conversation_profile(None::<ConversationProfile>);
/// ```
pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ConversationProfile>,
{
self.conversation_profile = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateConversationProfileRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateConversationProfileRequest;
/// use wkt::FieldMask;
/// let x = UpdateConversationProfileRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateConversationProfileRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateConversationProfileRequest;
/// use wkt::FieldMask;
/// let x = UpdateConversationProfileRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateConversationProfileRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "conversation-profiles")]
impl wkt::message::Message for UpdateConversationProfileRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateConversationProfileRequest"
}
}
/// The request message for
/// [ConversationProfiles.DeleteConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.DeleteConversationProfile].
///
/// This operation fails if the conversation profile is still referenced from
/// a phone number.
///
/// [google.cloud.dialogflow.v2.ConversationProfiles.DeleteConversationProfile]: crate::client::ConversationProfiles::delete_conversation_profile
#[cfg(feature = "conversation-profiles")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteConversationProfileRequest {
/// Required. The name of the conversation profile to delete.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversationProfiles/<Conversation Profile ID>`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-profiles")]
impl DeleteConversationProfileRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteConversationProfileRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteConversationProfileRequest;
/// let x = DeleteConversationProfileRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "conversation-profiles")]
impl wkt::message::Message for DeleteConversationProfileRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteConversationProfileRequest"
}
}
/// Defines the Automated Agent to connect to a conversation.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AutomatedAgentConfig {
/// Required. ID of the Dialogflow agent environment to use.
///
/// This project needs to either be the same project as the conversation or you
/// need to grant `service-<Conversation Project
/// Number>@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow API
/// Service Agent` role in this project.
///
/// - For ES agents, use format: `projects/<Project ID>/locations/<Location
/// ID>/agent/environments/<Environment ID or '-'>`. If environment is not
/// specified, the default `draft` environment is used. Refer to
/// [DetectIntentRequest](/dialogflow/docs/reference/rpc/google.cloud.dialogflow.v2#google.cloud.dialogflow.v2.DetectIntentRequest)
/// for more details.
///
/// - For CX agents, use format `projects/<Project ID>/locations/<Location
/// ID>/agents/<Agent ID>/environments/<Environment ID
/// or '-'>`. If environment is not specified, the default `draft` environment
/// is used.
///
pub agent: std::string::String,
/// Optional. Configure lifetime of the Dialogflow session.
/// By default, a Dialogflow CX session remains active and its data is stored
/// for 30 minutes after the last request is sent for the session.
/// This value should be no longer than 1 day.
pub session_ttl: std::option::Option<wkt::Duration>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl AutomatedAgentConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [agent][crate::model::AutomatedAgentConfig::agent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AutomatedAgentConfig;
/// let x = AutomatedAgentConfig::new().set_agent("example");
/// ```
pub fn set_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.agent = v.into();
self
}
/// Sets the value of [session_ttl][crate::model::AutomatedAgentConfig::session_ttl].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AutomatedAgentConfig;
/// use wkt::Duration;
/// let x = AutomatedAgentConfig::new().set_session_ttl(Duration::default()/* use setters */);
/// ```
pub fn set_session_ttl<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.session_ttl = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [session_ttl][crate::model::AutomatedAgentConfig::session_ttl].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AutomatedAgentConfig;
/// use wkt::Duration;
/// let x = AutomatedAgentConfig::new().set_or_clear_session_ttl(Some(Duration::default()/* use setters */));
/// let x = AutomatedAgentConfig::new().set_or_clear_session_ttl(None::<Duration>);
/// ```
pub fn set_or_clear_session_ttl<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.session_ttl = v.map(|x| x.into());
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for AutomatedAgentConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AutomatedAgentConfig"
}
}
/// Defines the Human Agent Assist to connect to a conversation.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HumanAgentAssistantConfig {
/// Pub/Sub topic on which to publish new agent assistant events.
pub notification_config: std::option::Option<crate::model::NotificationConfig>,
/// Configuration for agent assistance of human agent participant.
pub human_agent_suggestion_config:
std::option::Option<crate::model::human_agent_assistant_config::SuggestionConfig>,
/// Configuration for agent assistance of end user participant.
///
/// Currently, this feature is not general available, please contact Google
/// to get access.
pub end_user_suggestion_config:
std::option::Option<crate::model::human_agent_assistant_config::SuggestionConfig>,
/// Configuration for message analysis.
pub message_analysis_config:
std::option::Option<crate::model::human_agent_assistant_config::MessageAnalysisConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl HumanAgentAssistantConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [notification_config][crate::model::HumanAgentAssistantConfig::notification_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentAssistantConfig;
/// use google_cloud_dialogflow_v2::model::NotificationConfig;
/// let x = HumanAgentAssistantConfig::new().set_notification_config(NotificationConfig::default()/* use setters */);
/// ```
pub fn set_notification_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::NotificationConfig>,
{
self.notification_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [notification_config][crate::model::HumanAgentAssistantConfig::notification_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentAssistantConfig;
/// use google_cloud_dialogflow_v2::model::NotificationConfig;
/// let x = HumanAgentAssistantConfig::new().set_or_clear_notification_config(Some(NotificationConfig::default()/* use setters */));
/// let x = HumanAgentAssistantConfig::new().set_or_clear_notification_config(None::<NotificationConfig>);
/// ```
pub fn set_or_clear_notification_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::NotificationConfig>,
{
self.notification_config = v.map(|x| x.into());
self
}
/// Sets the value of [human_agent_suggestion_config][crate::model::HumanAgentAssistantConfig::human_agent_suggestion_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentAssistantConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionConfig;
/// let x = HumanAgentAssistantConfig::new().set_human_agent_suggestion_config(SuggestionConfig::default()/* use setters */);
/// ```
pub fn set_human_agent_suggestion_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::human_agent_assistant_config::SuggestionConfig>,
{
self.human_agent_suggestion_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [human_agent_suggestion_config][crate::model::HumanAgentAssistantConfig::human_agent_suggestion_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentAssistantConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionConfig;
/// let x = HumanAgentAssistantConfig::new().set_or_clear_human_agent_suggestion_config(Some(SuggestionConfig::default()/* use setters */));
/// let x = HumanAgentAssistantConfig::new().set_or_clear_human_agent_suggestion_config(None::<SuggestionConfig>);
/// ```
pub fn set_or_clear_human_agent_suggestion_config<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::human_agent_assistant_config::SuggestionConfig>,
{
self.human_agent_suggestion_config = v.map(|x| x.into());
self
}
/// Sets the value of [end_user_suggestion_config][crate::model::HumanAgentAssistantConfig::end_user_suggestion_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentAssistantConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionConfig;
/// let x = HumanAgentAssistantConfig::new().set_end_user_suggestion_config(SuggestionConfig::default()/* use setters */);
/// ```
pub fn set_end_user_suggestion_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::human_agent_assistant_config::SuggestionConfig>,
{
self.end_user_suggestion_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [end_user_suggestion_config][crate::model::HumanAgentAssistantConfig::end_user_suggestion_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentAssistantConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionConfig;
/// let x = HumanAgentAssistantConfig::new().set_or_clear_end_user_suggestion_config(Some(SuggestionConfig::default()/* use setters */));
/// let x = HumanAgentAssistantConfig::new().set_or_clear_end_user_suggestion_config(None::<SuggestionConfig>);
/// ```
pub fn set_or_clear_end_user_suggestion_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::human_agent_assistant_config::SuggestionConfig>,
{
self.end_user_suggestion_config = v.map(|x| x.into());
self
}
/// Sets the value of [message_analysis_config][crate::model::HumanAgentAssistantConfig::message_analysis_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentAssistantConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::MessageAnalysisConfig;
/// let x = HumanAgentAssistantConfig::new().set_message_analysis_config(MessageAnalysisConfig::default()/* use setters */);
/// ```
pub fn set_message_analysis_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::human_agent_assistant_config::MessageAnalysisConfig>,
{
self.message_analysis_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [message_analysis_config][crate::model::HumanAgentAssistantConfig::message_analysis_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentAssistantConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::MessageAnalysisConfig;
/// let x = HumanAgentAssistantConfig::new().set_or_clear_message_analysis_config(Some(MessageAnalysisConfig::default()/* use setters */));
/// let x = HumanAgentAssistantConfig::new().set_or_clear_message_analysis_config(None::<MessageAnalysisConfig>);
/// ```
pub fn set_or_clear_message_analysis_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::human_agent_assistant_config::MessageAnalysisConfig>,
{
self.message_analysis_config = v.map(|x| x.into());
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for HumanAgentAssistantConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig"
}
}
/// Defines additional types related to [HumanAgentAssistantConfig].
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod human_agent_assistant_config {
#[allow(unused_imports)]
use super::*;
/// Settings of suggestion trigger.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestionTriggerSettings {
/// Do not trigger if last utterance is small talk.
pub no_smalltalk: bool,
/// Only trigger suggestion if participant role of last utterance is
/// END_USER.
pub only_end_user: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl SuggestionTriggerSettings {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [no_smalltalk][crate::model::human_agent_assistant_config::SuggestionTriggerSettings::no_smalltalk].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionTriggerSettings;
/// let x = SuggestionTriggerSettings::new().set_no_smalltalk(true);
/// ```
pub fn set_no_smalltalk<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.no_smalltalk = v.into();
self
}
/// Sets the value of [only_end_user][crate::model::human_agent_assistant_config::SuggestionTriggerSettings::only_end_user].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionTriggerSettings;
/// let x = SuggestionTriggerSettings::new().set_only_end_user(true);
/// ```
pub fn set_only_end_user<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.only_end_user = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for SuggestionTriggerSettings {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings"
}
}
/// Config for suggestion features.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestionFeatureConfig {
/// The suggestion feature.
pub suggestion_feature: std::option::Option<crate::model::SuggestionFeature>,
/// Automatically iterates all participants and tries to compile
/// suggestions.
///
/// Supported features: ARTICLE_SUGGESTION, FAQ, DIALOGFLOW_ASSIST,
/// KNOWLEDGE_ASSIST.
pub enable_event_based_suggestion: bool,
/// Optional. Disable the logging of search queries sent by human agents. It
/// can prevent those queries from being stored at answer records.
///
/// Supported features: KNOWLEDGE_SEARCH.
pub disable_agent_query_logging: bool,
/// Optional. Enable query suggestion even if we can't find its answer.
/// By default, queries are suggested only if we find its answer.
/// Supported features: KNOWLEDGE_ASSIST
pub enable_query_suggestion_when_no_answer: bool,
/// Optional. Enable including conversation context during query answer
/// generation. Supported features: KNOWLEDGE_SEARCH.
pub enable_conversation_augmented_query: bool,
/// Optional. Enable query suggestion only.
/// Supported features: KNOWLEDGE_ASSIST
pub enable_query_suggestion_only: bool,
/// Optional. Enable returning detailed reasons for suggestion results.
///
/// For example, with this field disabled, Knowledge Search feature returns
/// NotFound error when no answer is found for the input query. Enabling this
/// field will change the behavior to return an OK response with
/// detailed information indicating the lack of results.
///
/// Supported features: KNOWLEDGE_SEARCH, KNOWLEDGE_ASSIST
pub enable_response_debug_info: bool,
/// Optional. Settings for Responsible AI checks.
/// Supported features: KNOWLEDGE_ASSIST
pub rai_settings: std::option::Option<crate::model::RaiSettings>,
/// Settings of suggestion trigger.
///
/// Currently, only ARTICLE_SUGGESTION and FAQ will use this field.
pub suggestion_trigger_settings: std::option::Option<
crate::model::human_agent_assistant_config::SuggestionTriggerSettings,
>,
/// Configs of query.
pub query_config:
std::option::Option<crate::model::human_agent_assistant_config::SuggestionQueryConfig>,
/// Configs of custom conversation model.
pub conversation_model_config: std::option::Option<
crate::model::human_agent_assistant_config::ConversationModelConfig,
>,
/// Configs for processing conversation.
pub conversation_process_config: std::option::Option<
crate::model::human_agent_assistant_config::ConversationProcessConfig,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl SuggestionFeatureConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [suggestion_feature][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::suggestion_feature].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// use google_cloud_dialogflow_v2::model::SuggestionFeature;
/// let x = SuggestionFeatureConfig::new().set_suggestion_feature(SuggestionFeature::default()/* use setters */);
/// ```
pub fn set_suggestion_feature<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SuggestionFeature>,
{
self.suggestion_feature = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [suggestion_feature][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::suggestion_feature].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// use google_cloud_dialogflow_v2::model::SuggestionFeature;
/// let x = SuggestionFeatureConfig::new().set_or_clear_suggestion_feature(Some(SuggestionFeature::default()/* use setters */));
/// let x = SuggestionFeatureConfig::new().set_or_clear_suggestion_feature(None::<SuggestionFeature>);
/// ```
pub fn set_or_clear_suggestion_feature<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SuggestionFeature>,
{
self.suggestion_feature = v.map(|x| x.into());
self
}
/// Sets the value of [enable_event_based_suggestion][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::enable_event_based_suggestion].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// let x = SuggestionFeatureConfig::new().set_enable_event_based_suggestion(true);
/// ```
pub fn set_enable_event_based_suggestion<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.enable_event_based_suggestion = v.into();
self
}
/// Sets the value of [disable_agent_query_logging][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::disable_agent_query_logging].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// let x = SuggestionFeatureConfig::new().set_disable_agent_query_logging(true);
/// ```
pub fn set_disable_agent_query_logging<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.disable_agent_query_logging = v.into();
self
}
/// Sets the value of [enable_query_suggestion_when_no_answer][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::enable_query_suggestion_when_no_answer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// let x = SuggestionFeatureConfig::new().set_enable_query_suggestion_when_no_answer(true);
/// ```
pub fn set_enable_query_suggestion_when_no_answer<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.enable_query_suggestion_when_no_answer = v.into();
self
}
/// Sets the value of [enable_conversation_augmented_query][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::enable_conversation_augmented_query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// let x = SuggestionFeatureConfig::new().set_enable_conversation_augmented_query(true);
/// ```
pub fn set_enable_conversation_augmented_query<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.enable_conversation_augmented_query = v.into();
self
}
/// Sets the value of [enable_query_suggestion_only][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::enable_query_suggestion_only].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// let x = SuggestionFeatureConfig::new().set_enable_query_suggestion_only(true);
/// ```
pub fn set_enable_query_suggestion_only<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.enable_query_suggestion_only = v.into();
self
}
/// Sets the value of [enable_response_debug_info][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::enable_response_debug_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// let x = SuggestionFeatureConfig::new().set_enable_response_debug_info(true);
/// ```
pub fn set_enable_response_debug_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_response_debug_info = v.into();
self
}
/// Sets the value of [rai_settings][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::rai_settings].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// use google_cloud_dialogflow_v2::model::RaiSettings;
/// let x = SuggestionFeatureConfig::new().set_rai_settings(RaiSettings::default()/* use setters */);
/// ```
pub fn set_rai_settings<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RaiSettings>,
{
self.rai_settings = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [rai_settings][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::rai_settings].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// use google_cloud_dialogflow_v2::model::RaiSettings;
/// let x = SuggestionFeatureConfig::new().set_or_clear_rai_settings(Some(RaiSettings::default()/* use setters */));
/// let x = SuggestionFeatureConfig::new().set_or_clear_rai_settings(None::<RaiSettings>);
/// ```
pub fn set_or_clear_rai_settings<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RaiSettings>,
{
self.rai_settings = v.map(|x| x.into());
self
}
/// Sets the value of [suggestion_trigger_settings][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::suggestion_trigger_settings].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionTriggerSettings;
/// let x = SuggestionFeatureConfig::new().set_suggestion_trigger_settings(SuggestionTriggerSettings::default()/* use setters */);
/// ```
pub fn set_suggestion_trigger_settings<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::human_agent_assistant_config::SuggestionTriggerSettings,
>,
{
self.suggestion_trigger_settings = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [suggestion_trigger_settings][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::suggestion_trigger_settings].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionTriggerSettings;
/// let x = SuggestionFeatureConfig::new().set_or_clear_suggestion_trigger_settings(Some(SuggestionTriggerSettings::default()/* use setters */));
/// let x = SuggestionFeatureConfig::new().set_or_clear_suggestion_trigger_settings(None::<SuggestionTriggerSettings>);
/// ```
pub fn set_or_clear_suggestion_trigger_settings<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<
crate::model::human_agent_assistant_config::SuggestionTriggerSettings,
>,
{
self.suggestion_trigger_settings = v.map(|x| x.into());
self
}
/// Sets the value of [query_config][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::query_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionQueryConfig;
/// let x = SuggestionFeatureConfig::new().set_query_config(SuggestionQueryConfig::default()/* use setters */);
/// ```
pub fn set_query_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::human_agent_assistant_config::SuggestionQueryConfig,
>,
{
self.query_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query_config][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::query_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionQueryConfig;
/// let x = SuggestionFeatureConfig::new().set_or_clear_query_config(Some(SuggestionQueryConfig::default()/* use setters */));
/// let x = SuggestionFeatureConfig::new().set_or_clear_query_config(None::<SuggestionQueryConfig>);
/// ```
pub fn set_or_clear_query_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<
crate::model::human_agent_assistant_config::SuggestionQueryConfig,
>,
{
self.query_config = v.map(|x| x.into());
self
}
/// Sets the value of [conversation_model_config][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::conversation_model_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::ConversationModelConfig;
/// let x = SuggestionFeatureConfig::new().set_conversation_model_config(ConversationModelConfig::default()/* use setters */);
/// ```
pub fn set_conversation_model_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::human_agent_assistant_config::ConversationModelConfig,
>,
{
self.conversation_model_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [conversation_model_config][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::conversation_model_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::ConversationModelConfig;
/// let x = SuggestionFeatureConfig::new().set_or_clear_conversation_model_config(Some(ConversationModelConfig::default()/* use setters */));
/// let x = SuggestionFeatureConfig::new().set_or_clear_conversation_model_config(None::<ConversationModelConfig>);
/// ```
pub fn set_or_clear_conversation_model_config<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<
crate::model::human_agent_assistant_config::ConversationModelConfig,
>,
{
self.conversation_model_config = v.map(|x| x.into());
self
}
/// Sets the value of [conversation_process_config][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::conversation_process_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::ConversationProcessConfig;
/// let x = SuggestionFeatureConfig::new().set_conversation_process_config(ConversationProcessConfig::default()/* use setters */);
/// ```
pub fn set_conversation_process_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::human_agent_assistant_config::ConversationProcessConfig,
>,
{
self.conversation_process_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [conversation_process_config][crate::model::human_agent_assistant_config::SuggestionFeatureConfig::conversation_process_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::ConversationProcessConfig;
/// let x = SuggestionFeatureConfig::new().set_or_clear_conversation_process_config(Some(ConversationProcessConfig::default()/* use setters */));
/// let x = SuggestionFeatureConfig::new().set_or_clear_conversation_process_config(None::<ConversationProcessConfig>);
/// ```
pub fn set_or_clear_conversation_process_config<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<
crate::model::human_agent_assistant_config::ConversationProcessConfig,
>,
{
self.conversation_process_config = v.map(|x| x.into());
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for SuggestionFeatureConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig"
}
}
/// Detail human agent assistant config.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestionConfig {
/// Configuration of different suggestion features. One feature can have only
/// one config.
pub feature_configs:
std::vec::Vec<crate::model::human_agent_assistant_config::SuggestionFeatureConfig>,
/// If `group_suggestion_responses` is false, and there are multiple
/// `feature_configs` in `event based suggestion` or
/// StreamingAnalyzeContent, we will try to deliver suggestions to customers
/// as soon as we get new suggestion. Different type of suggestions based on
/// the same context will be in separate Pub/Sub event or
/// `StreamingAnalyzeContentResponse`.
///
/// If `group_suggestion_responses` set to true. All the suggestions to the
/// same participant based on the same context will be grouped into a single
/// Pub/Sub event or StreamingAnalyzeContentResponse.
pub group_suggestion_responses: bool,
/// Optional. List of various generator resource names used in the
/// conversation profile.
pub generators: std::vec::Vec<std::string::String>,
/// Optional. When disable_high_latency_features_sync_delivery is true and
/// using the AnalyzeContent API, we will not deliver the responses from high
/// latency features in the API response. The
/// human_agent_assistant_config.notification_config must be configured and
/// enable_event_based_suggestion must be set to true to receive the
/// responses from high latency features in Pub/Sub. High latency feature(s):
/// KNOWLEDGE_ASSIST
pub disable_high_latency_features_sync_delivery: bool,
/// Optional. Enable skipping event based suggestion if the suggestion is
/// empty.
///
/// For example, with this field disabled, Knowledge Assist feature sends
/// a Pub/Sub message when there are no suggestions. Enabling this field
/// will change the behavior to skip the Pub/Sub message in this situation.
pub skip_empty_event_based_suggestion: bool,
/// Optional. If true,
/// use unredacted transcript data (Supported features: AI_COACH) and
/// use unredacted ingested context (Supported features: All Agent Assist
/// features)
pub use_unredacted_conversation_data: bool,
/// Optional. If true, enable asynchronous execution of tools.
pub enable_async_tool_call: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl SuggestionConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [feature_configs][crate::model::human_agent_assistant_config::SuggestionConfig::feature_configs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// let x = SuggestionConfig::new()
/// .set_feature_configs([
/// SuggestionFeatureConfig::default()/* use setters */,
/// SuggestionFeatureConfig::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_feature_configs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::human_agent_assistant_config::SuggestionFeatureConfig,
>,
{
use std::iter::Iterator;
self.feature_configs = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [group_suggestion_responses][crate::model::human_agent_assistant_config::SuggestionConfig::group_suggestion_responses].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionConfig;
/// let x = SuggestionConfig::new().set_group_suggestion_responses(true);
/// ```
pub fn set_group_suggestion_responses<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.group_suggestion_responses = v.into();
self
}
/// Sets the value of [generators][crate::model::human_agent_assistant_config::SuggestionConfig::generators].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionConfig;
/// let x = SuggestionConfig::new().set_generators(["a", "b", "c"]);
/// ```
pub fn set_generators<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.generators = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [disable_high_latency_features_sync_delivery][crate::model::human_agent_assistant_config::SuggestionConfig::disable_high_latency_features_sync_delivery].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionConfig;
/// let x = SuggestionConfig::new().set_disable_high_latency_features_sync_delivery(true);
/// ```
pub fn set_disable_high_latency_features_sync_delivery<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.disable_high_latency_features_sync_delivery = v.into();
self
}
/// Sets the value of [skip_empty_event_based_suggestion][crate::model::human_agent_assistant_config::SuggestionConfig::skip_empty_event_based_suggestion].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionConfig;
/// let x = SuggestionConfig::new().set_skip_empty_event_based_suggestion(true);
/// ```
pub fn set_skip_empty_event_based_suggestion<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.skip_empty_event_based_suggestion = v.into();
self
}
/// Sets the value of [use_unredacted_conversation_data][crate::model::human_agent_assistant_config::SuggestionConfig::use_unredacted_conversation_data].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionConfig;
/// let x = SuggestionConfig::new().set_use_unredacted_conversation_data(true);
/// ```
pub fn set_use_unredacted_conversation_data<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.use_unredacted_conversation_data = v.into();
self
}
/// Sets the value of [enable_async_tool_call][crate::model::human_agent_assistant_config::SuggestionConfig::enable_async_tool_call].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionConfig;
/// let x = SuggestionConfig::new().set_enable_async_tool_call(true);
/// ```
pub fn set_enable_async_tool_call<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_async_tool_call = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for SuggestionConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig"
}
}
/// Config for suggestion query.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestionQueryConfig {
/// Maximum number of results to return. Currently, if unset, defaults to 10.
/// And the max number is 20.
pub max_results: i32,
/// Confidence threshold of query result.
///
/// Agent Assist gives each suggestion a score in the range [0.0, 1.0], based
/// on the relevance between the suggestion and the current conversation
/// context. A score of 0.0 has no relevance, while a score of 1.0 has high
/// relevance. Only suggestions with a score greater than or equal to the
/// value of this field are included in the results.
///
/// For a baseline model (the default), the recommended value is in the range
/// [0.05, 0.1].
///
/// For a custom model, there is no recommended value. Tune this value by
/// starting from a very low value and slowly increasing until you have
/// desired results.
///
/// If this field is not set, it defaults to 0.0, which means that all
/// suggestions are returned.
///
/// Supported features: ARTICLE_SUGGESTION, FAQ, SMART_REPLY, SMART_COMPOSE,
/// KNOWLEDGE_SEARCH, KNOWLEDGE_ASSIST, ENTITY_EXTRACTION.
pub confidence_threshold: f32,
/// Determines how recent conversation context is filtered when generating
/// suggestions. If unspecified, no messages will be dropped.
pub context_filter_settings: std::option::Option<crate::model::human_agent_assistant_config::suggestion_query_config::ContextFilterSettings>,
/// Optional. The customized sections chosen to return when requesting a
/// summary of a conversation.
pub sections: std::option::Option<crate::model::human_agent_assistant_config::suggestion_query_config::Sections>,
/// Optional. The number of recent messages to include in the context.
/// Supported features: KNOWLEDGE_ASSIST.
pub context_size: i32,
/// Source of query.
pub query_source: std::option::Option<crate::model::human_agent_assistant_config::suggestion_query_config::QuerySource>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl SuggestionQueryConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [max_results][crate::model::human_agent_assistant_config::SuggestionQueryConfig::max_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionQueryConfig;
/// let x = SuggestionQueryConfig::new().set_max_results(42);
/// ```
pub fn set_max_results<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_results = v.into();
self
}
/// Sets the value of [confidence_threshold][crate::model::human_agent_assistant_config::SuggestionQueryConfig::confidence_threshold].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionQueryConfig;
/// let x = SuggestionQueryConfig::new().set_confidence_threshold(42.0);
/// ```
pub fn set_confidence_threshold<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.confidence_threshold = v.into();
self
}
/// Sets the value of [context_filter_settings][crate::model::human_agent_assistant_config::SuggestionQueryConfig::context_filter_settings].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionQueryConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::ContextFilterSettings;
/// let x = SuggestionQueryConfig::new().set_context_filter_settings(ContextFilterSettings::default()/* use setters */);
/// ```
pub fn set_context_filter_settings<T>(mut self, v: T) -> Self
where T: std::convert::Into<crate::model::human_agent_assistant_config::suggestion_query_config::ContextFilterSettings>
{
self.context_filter_settings = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [context_filter_settings][crate::model::human_agent_assistant_config::SuggestionQueryConfig::context_filter_settings].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionQueryConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::ContextFilterSettings;
/// let x = SuggestionQueryConfig::new().set_or_clear_context_filter_settings(Some(ContextFilterSettings::default()/* use setters */));
/// let x = SuggestionQueryConfig::new().set_or_clear_context_filter_settings(None::<ContextFilterSettings>);
/// ```
pub fn set_or_clear_context_filter_settings<T>(mut self, v: std::option::Option<T>) -> Self
where T: std::convert::Into<crate::model::human_agent_assistant_config::suggestion_query_config::ContextFilterSettings>
{
self.context_filter_settings = v.map(|x| x.into());
self
}
/// Sets the value of [sections][crate::model::human_agent_assistant_config::SuggestionQueryConfig::sections].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionQueryConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::Sections;
/// let x = SuggestionQueryConfig::new().set_sections(Sections::default()/* use setters */);
/// ```
pub fn set_sections<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::human_agent_assistant_config::suggestion_query_config::Sections,
>,
{
self.sections = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [sections][crate::model::human_agent_assistant_config::SuggestionQueryConfig::sections].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionQueryConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::Sections;
/// let x = SuggestionQueryConfig::new().set_or_clear_sections(Some(Sections::default()/* use setters */));
/// let x = SuggestionQueryConfig::new().set_or_clear_sections(None::<Sections>);
/// ```
pub fn set_or_clear_sections<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<
crate::model::human_agent_assistant_config::suggestion_query_config::Sections,
>,
{
self.sections = v.map(|x| x.into());
self
}
/// Sets the value of [context_size][crate::model::human_agent_assistant_config::SuggestionQueryConfig::context_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionQueryConfig;
/// let x = SuggestionQueryConfig::new().set_context_size(42);
/// ```
pub fn set_context_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.context_size = v.into();
self
}
/// Sets the value of [query_source][crate::model::human_agent_assistant_config::SuggestionQueryConfig::query_source].
///
/// Note that all the setters affecting `query_source` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionQueryConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::KnowledgeBaseQuerySource;
/// let x = SuggestionQueryConfig::new().set_query_source(Some(
/// google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::QuerySource::KnowledgeBaseQuerySource(KnowledgeBaseQuerySource::default().into())));
/// ```
pub fn set_query_source<T: std::convert::Into<std::option::Option<crate::model::human_agent_assistant_config::suggestion_query_config::QuerySource>>>(mut self, v: T) -> Self
{
self.query_source = v.into();
self
}
/// The value of [query_source][crate::model::human_agent_assistant_config::SuggestionQueryConfig::query_source]
/// if it holds a `KnowledgeBaseQuerySource`, `None` if the field is not set or
/// holds a different branch.
pub fn knowledge_base_query_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::human_agent_assistant_config::suggestion_query_config::KnowledgeBaseQuerySource>>{
#[allow(unreachable_patterns)]
self.query_source.as_ref().and_then(|v| match v {
crate::model::human_agent_assistant_config::suggestion_query_config::QuerySource::KnowledgeBaseQuerySource(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [query_source][crate::model::human_agent_assistant_config::SuggestionQueryConfig::query_source]
/// to hold a `KnowledgeBaseQuerySource`.
///
/// Note that all the setters affecting `query_source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionQueryConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::KnowledgeBaseQuerySource;
/// let x = SuggestionQueryConfig::new().set_knowledge_base_query_source(KnowledgeBaseQuerySource::default()/* use setters */);
/// assert!(x.knowledge_base_query_source().is_some());
/// assert!(x.document_query_source().is_none());
/// assert!(x.dialogflow_query_source().is_none());
/// ```
pub fn set_knowledge_base_query_source<T: std::convert::Into<std::boxed::Box<crate::model::human_agent_assistant_config::suggestion_query_config::KnowledgeBaseQuerySource>>>(mut self, v: T) -> Self{
self.query_source = std::option::Option::Some(
crate::model::human_agent_assistant_config::suggestion_query_config::QuerySource::KnowledgeBaseQuerySource(
v.into()
)
);
self
}
/// The value of [query_source][crate::model::human_agent_assistant_config::SuggestionQueryConfig::query_source]
/// if it holds a `DocumentQuerySource`, `None` if the field is not set or
/// holds a different branch.
pub fn document_query_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::human_agent_assistant_config::suggestion_query_config::DocumentQuerySource>>{
#[allow(unreachable_patterns)]
self.query_source.as_ref().and_then(|v| match v {
crate::model::human_agent_assistant_config::suggestion_query_config::QuerySource::DocumentQuerySource(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [query_source][crate::model::human_agent_assistant_config::SuggestionQueryConfig::query_source]
/// to hold a `DocumentQuerySource`.
///
/// Note that all the setters affecting `query_source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionQueryConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::DocumentQuerySource;
/// let x = SuggestionQueryConfig::new().set_document_query_source(DocumentQuerySource::default()/* use setters */);
/// assert!(x.document_query_source().is_some());
/// assert!(x.knowledge_base_query_source().is_none());
/// assert!(x.dialogflow_query_source().is_none());
/// ```
pub fn set_document_query_source<T: std::convert::Into<std::boxed::Box<crate::model::human_agent_assistant_config::suggestion_query_config::DocumentQuerySource>>>(mut self, v: T) -> Self{
self.query_source = std::option::Option::Some(
crate::model::human_agent_assistant_config::suggestion_query_config::QuerySource::DocumentQuerySource(
v.into()
)
);
self
}
/// The value of [query_source][crate::model::human_agent_assistant_config::SuggestionQueryConfig::query_source]
/// if it holds a `DialogflowQuerySource`, `None` if the field is not set or
/// holds a different branch.
pub fn dialogflow_query_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::human_agent_assistant_config::suggestion_query_config::DialogflowQuerySource>>{
#[allow(unreachable_patterns)]
self.query_source.as_ref().and_then(|v| match v {
crate::model::human_agent_assistant_config::suggestion_query_config::QuerySource::DialogflowQuerySource(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [query_source][crate::model::human_agent_assistant_config::SuggestionQueryConfig::query_source]
/// to hold a `DialogflowQuerySource`.
///
/// Note that all the setters affecting `query_source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionQueryConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::DialogflowQuerySource;
/// let x = SuggestionQueryConfig::new().set_dialogflow_query_source(DialogflowQuerySource::default()/* use setters */);
/// assert!(x.dialogflow_query_source().is_some());
/// assert!(x.knowledge_base_query_source().is_none());
/// assert!(x.document_query_source().is_none());
/// ```
pub fn set_dialogflow_query_source<T: std::convert::Into<std::boxed::Box<crate::model::human_agent_assistant_config::suggestion_query_config::DialogflowQuerySource>>>(mut self, v: T) -> Self{
self.query_source = std::option::Option::Some(
crate::model::human_agent_assistant_config::suggestion_query_config::QuerySource::DialogflowQuerySource(
v.into()
)
);
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for SuggestionQueryConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig"
}
}
/// Defines additional types related to [SuggestionQueryConfig].
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod suggestion_query_config {
#[allow(unused_imports)]
use super::*;
/// Knowledge base source settings.
///
/// Supported features: ARTICLE_SUGGESTION, FAQ.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KnowledgeBaseQuerySource {
/// Required. Knowledge bases to query. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/knowledgeBases/<Knowledge Base ID>`. Currently, at most 5 knowledge
/// bases are supported.
pub knowledge_bases: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl KnowledgeBaseQuerySource {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [knowledge_bases][crate::model::human_agent_assistant_config::suggestion_query_config::KnowledgeBaseQuerySource::knowledge_bases].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::KnowledgeBaseQuerySource;
/// let x = KnowledgeBaseQuerySource::new().set_knowledge_bases(["a", "b", "c"]);
/// ```
pub fn set_knowledge_bases<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.knowledge_bases = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for KnowledgeBaseQuerySource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource"
}
}
/// Document source settings.
///
/// Supported features: SMART_REPLY, SMART_COMPOSE.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DocumentQuerySource {
/// Required. Knowledge documents to query from. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/knowledgeBases/<KnowledgeBase ID>/documents/<Document ID>`.
/// Currently, at most 5 documents are supported.
pub documents: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl DocumentQuerySource {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [documents][crate::model::human_agent_assistant_config::suggestion_query_config::DocumentQuerySource::documents].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::DocumentQuerySource;
/// let x = DocumentQuerySource::new().set_documents(["a", "b", "c"]);
/// ```
pub fn set_documents<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.documents = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for DocumentQuerySource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource"
}
}
/// Dialogflow source setting.
///
/// Supported feature: DIALOGFLOW_ASSIST.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DialogflowQuerySource {
/// Required. The name of a Dialogflow virtual agent used for end user side
/// intent detection and suggestion. Format: `projects/<Project
/// ID>/locations/<Location ID>/agent`. When multiple agents are allowed in
/// the same Dialogflow project.
pub agent: std::string::String,
/// Optional. The Dialogflow assist configuration for human agent.
pub human_agent_side_config: std::option::Option<crate::model::human_agent_assistant_config::suggestion_query_config::dialogflow_query_source::HumanAgentSideConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl DialogflowQuerySource {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [agent][crate::model::human_agent_assistant_config::suggestion_query_config::DialogflowQuerySource::agent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::DialogflowQuerySource;
/// let x = DialogflowQuerySource::new().set_agent("example");
/// ```
pub fn set_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.agent = v.into();
self
}
/// Sets the value of [human_agent_side_config][crate::model::human_agent_assistant_config::suggestion_query_config::DialogflowQuerySource::human_agent_side_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::DialogflowQuerySource;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::dialogflow_query_source::HumanAgentSideConfig;
/// let x = DialogflowQuerySource::new().set_human_agent_side_config(HumanAgentSideConfig::default()/* use setters */);
/// ```
pub fn set_human_agent_side_config<T>(mut self, v: T) -> Self
where T: std::convert::Into<crate::model::human_agent_assistant_config::suggestion_query_config::dialogflow_query_source::HumanAgentSideConfig>
{
self.human_agent_side_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [human_agent_side_config][crate::model::human_agent_assistant_config::suggestion_query_config::DialogflowQuerySource::human_agent_side_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::DialogflowQuerySource;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::dialogflow_query_source::HumanAgentSideConfig;
/// let x = DialogflowQuerySource::new().set_or_clear_human_agent_side_config(Some(HumanAgentSideConfig::default()/* use setters */));
/// let x = DialogflowQuerySource::new().set_or_clear_human_agent_side_config(None::<HumanAgentSideConfig>);
/// ```
pub fn set_or_clear_human_agent_side_config<T>(mut self, v: std::option::Option<T>) -> Self
where T: std::convert::Into<crate::model::human_agent_assistant_config::suggestion_query_config::dialogflow_query_source::HumanAgentSideConfig>
{
self.human_agent_side_config = v.map(|x| x.into());
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for DialogflowQuerySource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource"
}
}
/// Defines additional types related to [DialogflowQuerySource].
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod dialogflow_query_source {
#[allow(unused_imports)]
use super::*;
/// The configuration used for human agent side Dialogflow assist
/// suggestion.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HumanAgentSideConfig {
/// Optional. The name of a dialogflow virtual agent used for intent
/// detection and suggestion triggered by human agent.
/// Format: `projects/<Project ID>/locations/<Location ID>/agent`.
pub agent: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl HumanAgentSideConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [agent][crate::model::human_agent_assistant_config::suggestion_query_config::dialogflow_query_source::HumanAgentSideConfig::agent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::dialogflow_query_source::HumanAgentSideConfig;
/// let x = HumanAgentSideConfig::new().set_agent("example");
/// ```
pub fn set_agent<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.agent = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for HumanAgentSideConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.HumanAgentSideConfig"
}
}
}
/// Settings that determine how to filter recent conversation context when
/// generating suggestions.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ContextFilterSettings {
/// If set to true, the last message from virtual agent (hand off message)
/// and the message before it (trigger message of hand off) are dropped.
pub drop_handoff_messages: bool,
/// If set to true, all messages from virtual agent are dropped.
pub drop_virtual_agent_messages: bool,
/// If set to true, all messages from ivr stage are dropped.
pub drop_ivr_messages: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl ContextFilterSettings {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [drop_handoff_messages][crate::model::human_agent_assistant_config::suggestion_query_config::ContextFilterSettings::drop_handoff_messages].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::ContextFilterSettings;
/// let x = ContextFilterSettings::new().set_drop_handoff_messages(true);
/// ```
pub fn set_drop_handoff_messages<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.drop_handoff_messages = v.into();
self
}
/// Sets the value of [drop_virtual_agent_messages][crate::model::human_agent_assistant_config::suggestion_query_config::ContextFilterSettings::drop_virtual_agent_messages].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::ContextFilterSettings;
/// let x = ContextFilterSettings::new().set_drop_virtual_agent_messages(true);
/// ```
pub fn set_drop_virtual_agent_messages<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.drop_virtual_agent_messages = v.into();
self
}
/// Sets the value of [drop_ivr_messages][crate::model::human_agent_assistant_config::suggestion_query_config::ContextFilterSettings::drop_ivr_messages].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::ContextFilterSettings;
/// let x = ContextFilterSettings::new().set_drop_ivr_messages(true);
/// ```
pub fn set_drop_ivr_messages<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.drop_ivr_messages = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for ContextFilterSettings {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings"
}
}
/// Custom sections to return when requesting a summary of a conversation.
/// This is only supported when `baseline_model_version` == '2.0'.
///
/// Supported features: CONVERSATION_SUMMARIZATION,
/// CONVERSATION_SUMMARIZATION_VOICE.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Sections {
/// The selected sections chosen to return when requesting a summary of a
/// conversation. A duplicate selected section will be treated as a single
/// selected section. If section types are not provided, the default will
/// be {SITUATION, ACTION, RESULT}.
pub section_types: std::vec::Vec<crate::model::human_agent_assistant_config::suggestion_query_config::sections::SectionType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl Sections {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [section_types][crate::model::human_agent_assistant_config::suggestion_query_config::Sections::section_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::Sections;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::suggestion_query_config::sections::SectionType;
/// let x = Sections::new().set_section_types([
/// SectionType::Situation,
/// SectionType::Action,
/// SectionType::Resolution,
/// ]);
/// ```
pub fn set_section_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::human_agent_assistant_config::suggestion_query_config::sections::SectionType>
{
use std::iter::Iterator;
self.section_types = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for Sections {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.Sections"
}
}
/// Defines additional types related to [Sections].
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod sections {
#[allow(unused_imports)]
use super::*;
/// Selectable sections to return when requesting a summary of a
/// conversation.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SectionType {
/// Undefined section type, does not return anything.
Unspecified,
/// What the customer needs help with or has question about.
/// Section name: "situation".
Situation,
/// What the agent does to help the customer.
/// Section name: "action".
Action,
/// Result of the customer service. A single word describing the result
/// of the conversation.
/// Section name: "resolution".
Resolution,
/// Reason for cancellation if the customer requests for a cancellation.
/// "N/A" otherwise.
/// Section name: "reason_for_cancellation".
ReasonForCancellation,
/// "Unsatisfied" or "Satisfied" depending on the customer's feelings at
/// the end of the conversation.
/// Section name: "customer_satisfaction".
CustomerSatisfaction,
/// Key entities extracted from the conversation, such as ticket number,
/// order number, dollar amount, etc.
/// Section names are prefixed by "entities/".
Entities,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [SectionType::value] or
/// [SectionType::name].
UnknownValue(section_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod section_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl SectionType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Situation => std::option::Option::Some(1),
Self::Action => std::option::Option::Some(2),
Self::Resolution => std::option::Option::Some(3),
Self::ReasonForCancellation => std::option::Option::Some(4),
Self::CustomerSatisfaction => std::option::Option::Some(5),
Self::Entities => std::option::Option::Some(6),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SECTION_TYPE_UNSPECIFIED"),
Self::Situation => std::option::Option::Some("SITUATION"),
Self::Action => std::option::Option::Some("ACTION"),
Self::Resolution => std::option::Option::Some("RESOLUTION"),
Self::ReasonForCancellation => {
std::option::Option::Some("REASON_FOR_CANCELLATION")
}
Self::CustomerSatisfaction => {
std::option::Option::Some("CUSTOMER_SATISFACTION")
}
Self::Entities => std::option::Option::Some("ENTITIES"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::default::Default for SectionType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::fmt::Display for SectionType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::convert::From<i32> for SectionType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Situation,
2 => Self::Action,
3 => Self::Resolution,
4 => Self::ReasonForCancellation,
5 => Self::CustomerSatisfaction,
6 => Self::Entities,
_ => Self::UnknownValue(section_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::convert::From<&str> for SectionType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SECTION_TYPE_UNSPECIFIED" => Self::Unspecified,
"SITUATION" => Self::Situation,
"ACTION" => Self::Action,
"RESOLUTION" => Self::Resolution,
"REASON_FOR_CANCELLATION" => Self::ReasonForCancellation,
"CUSTOMER_SATISFACTION" => Self::CustomerSatisfaction,
"ENTITIES" => Self::Entities,
_ => Self::UnknownValue(section_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl serde::ser::Serialize for SectionType {
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::Situation => serializer.serialize_i32(1),
Self::Action => serializer.serialize_i32(2),
Self::Resolution => serializer.serialize_i32(3),
Self::ReasonForCancellation => serializer.serialize_i32(4),
Self::CustomerSatisfaction => serializer.serialize_i32(5),
Self::Entities => serializer.serialize_i32(6),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl<'de> serde::de::Deserialize<'de> for SectionType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SectionType>::new(
".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.Sections.SectionType"))
}
}
}
/// Source of query.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum QuerySource {
/// Query from knowledgebase. It is used by:
/// ARTICLE_SUGGESTION, FAQ.
KnowledgeBaseQuerySource(std::boxed::Box<crate::model::human_agent_assistant_config::suggestion_query_config::KnowledgeBaseQuerySource>),
/// Query from knowledge base document. It is used by:
/// SMART_REPLY, SMART_COMPOSE.
DocumentQuerySource(std::boxed::Box<crate::model::human_agent_assistant_config::suggestion_query_config::DocumentQuerySource>),
/// Query from Dialogflow agent. It is used by DIALOGFLOW_ASSIST.
DialogflowQuerySource(std::boxed::Box<crate::model::human_agent_assistant_config::suggestion_query_config::DialogflowQuerySource>),
}
}
/// Custom conversation models used in agent assist feature.
///
/// Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY,
/// CONVERSATION_SUMMARIZATION
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationModelConfig {
/// Conversation model resource name. Format: `projects/<Project
/// ID>/conversationModels/<Model ID>`.
pub model: std::string::String,
/// Version of current baseline model. It will be ignored if
/// [model][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig.model]
/// is set. Valid versions are:
///
/// - Article Suggestion baseline model:
/// - 0.9
/// - 1.0 (default)
/// - Summarization baseline model:
/// - 1.0
///
/// [google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig.model]: crate::model::human_agent_assistant_config::ConversationModelConfig::model
pub baseline_model_version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl ConversationModelConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [model][crate::model::human_agent_assistant_config::ConversationModelConfig::model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::ConversationModelConfig;
/// let x = ConversationModelConfig::new().set_model("example");
/// ```
pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.model = v.into();
self
}
/// Sets the value of [baseline_model_version][crate::model::human_agent_assistant_config::ConversationModelConfig::baseline_model_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::ConversationModelConfig;
/// let x = ConversationModelConfig::new().set_baseline_model_version("example");
/// ```
pub fn set_baseline_model_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.baseline_model_version = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for ConversationModelConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig"
}
}
/// Config to process conversation.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationProcessConfig {
/// Number of recent non-small-talk sentences to use as context for article
/// and FAQ suggestion
pub recent_sentences_count: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl ConversationProcessConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [recent_sentences_count][crate::model::human_agent_assistant_config::ConversationProcessConfig::recent_sentences_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::ConversationProcessConfig;
/// let x = ConversationProcessConfig::new().set_recent_sentences_count(42);
/// ```
pub fn set_recent_sentences_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.recent_sentences_count = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for ConversationProcessConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig"
}
}
/// Configuration for analyses to run on each conversation message.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageAnalysisConfig {
/// Enable entity extraction in conversation messages on [agent assist
/// stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages).
/// If unspecified, defaults to false.
///
/// Currently, this feature is not general available, please contact Google
/// to get access.
pub enable_entity_extraction: bool,
/// Enable sentiment analysis in conversation messages on [agent assist
/// stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages).
/// If unspecified, defaults to false. Sentiment analysis inspects user input
/// and identifies the prevailing subjective opinion, especially to determine
/// a user's attitude as positive, negative, or neutral:
/// <https://cloud.google.com/natural-language/docs/basics#sentiment_analysis>
/// For
/// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent]
/// method, result will be in
/// [StreamingAnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.message].
/// For
/// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]
/// method, result will be in
/// [AnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2.AnalyzeContentResponse.message]
/// For
/// [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages]
/// method, result will be in
/// [ListMessagesResponse.messages.SentimentAnalysisResult][google.cloud.dialogflow.v2.ListMessagesResponse.messages]
/// If Pub/Sub notification is configured, result will be in
/// [ConversationEvent.new_message_payload.SentimentAnalysisResult][google.cloud.dialogflow.v2.ConversationEvent.new_message_payload].
///
/// [google.cloud.dialogflow.v2.AnalyzeContentResponse.message]: crate::model::AnalyzeContentResponse::message
/// [google.cloud.dialogflow.v2.ConversationEvent.new_message_payload]: crate::model::ConversationEvent::payload
/// [google.cloud.dialogflow.v2.Conversations.ListMessages]: crate::client::Conversations::list_messages
/// [google.cloud.dialogflow.v2.ListMessagesResponse.messages]: crate::model::ListMessagesResponse::messages
/// [google.cloud.dialogflow.v2.Participants.AnalyzeContent]: crate::client::Participants::analyze_content
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.message]: crate::model::StreamingAnalyzeContentResponse::message
pub enable_sentiment_analysis: bool,
/// Optional. Enables sentiment analysis for audio input and conversation
/// messages. If unspecified, defaults to false. If this flag is set to true,
/// other 'enable_sentiment_analysis' fields will be ignored.
///
/// Sentiment analysis inspects user input and identifies the prevailing
/// subjective opinion, especially to determine a user's attitude as
/// positive, negative, or neutral.
/// <https://cloud.google.com/natural-language/docs/basics#sentiment_analysis>
/// For
/// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent]
/// method, result will be in
/// [StreamingAnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.message].
/// For
/// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]
/// method, result will be in
/// [AnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2.AnalyzeContentResponse.message]
/// For
/// [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages]
/// method, result will be in
/// [ListMessagesResponse.messages.SentimentAnalysisResult][google.cloud.dialogflow.v2.ListMessagesResponse.messages]
/// If Pub/Sub notification is configured, result will be in
/// [ConversationEvent.new_message_payload.SentimentAnalysisResult][google.cloud.dialogflow.v2.ConversationEvent.new_message_payload].
///
/// [google.cloud.dialogflow.v2.AnalyzeContentResponse.message]: crate::model::AnalyzeContentResponse::message
/// [google.cloud.dialogflow.v2.ConversationEvent.new_message_payload]: crate::model::ConversationEvent::payload
/// [google.cloud.dialogflow.v2.Conversations.ListMessages]: crate::client::Conversations::list_messages
/// [google.cloud.dialogflow.v2.ListMessagesResponse.messages]: crate::model::ListMessagesResponse::messages
/// [google.cloud.dialogflow.v2.Participants.AnalyzeContent]: crate::client::Participants::analyze_content
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.message]: crate::model::StreamingAnalyzeContentResponse::message
pub enable_sentiment_analysis_v3: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl MessageAnalysisConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [enable_entity_extraction][crate::model::human_agent_assistant_config::MessageAnalysisConfig::enable_entity_extraction].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::MessageAnalysisConfig;
/// let x = MessageAnalysisConfig::new().set_enable_entity_extraction(true);
/// ```
pub fn set_enable_entity_extraction<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_entity_extraction = v.into();
self
}
/// Sets the value of [enable_sentiment_analysis][crate::model::human_agent_assistant_config::MessageAnalysisConfig::enable_sentiment_analysis].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::MessageAnalysisConfig;
/// let x = MessageAnalysisConfig::new().set_enable_sentiment_analysis(true);
/// ```
pub fn set_enable_sentiment_analysis<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_sentiment_analysis = v.into();
self
}
/// Sets the value of [enable_sentiment_analysis_v3][crate::model::human_agent_assistant_config::MessageAnalysisConfig::enable_sentiment_analysis_v3].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_assistant_config::MessageAnalysisConfig;
/// let x = MessageAnalysisConfig::new().set_enable_sentiment_analysis_v3(true);
/// ```
pub fn set_enable_sentiment_analysis_v3<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.enable_sentiment_analysis_v3 = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for MessageAnalysisConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig"
}
}
}
/// Defines the hand off to a live agent, typically on which external agent
/// service provider to connect to a conversation.
///
/// Currently, this feature is not general available, please contact Google
/// to get access.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HumanAgentHandoffConfig {
/// Required. Specifies which agent service to connect for human agent handoff.
pub agent_service: std::option::Option<crate::model::human_agent_handoff_config::AgentService>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl HumanAgentHandoffConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [agent_service][crate::model::HumanAgentHandoffConfig::agent_service].
///
/// Note that all the setters affecting `agent_service` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentHandoffConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_handoff_config::LivePersonConfig;
/// let x = HumanAgentHandoffConfig::new().set_agent_service(Some(
/// google_cloud_dialogflow_v2::model::human_agent_handoff_config::AgentService::LivePersonConfig(LivePersonConfig::default().into())));
/// ```
pub fn set_agent_service<
T: std::convert::Into<
std::option::Option<crate::model::human_agent_handoff_config::AgentService>,
>,
>(
mut self,
v: T,
) -> Self {
self.agent_service = v.into();
self
}
/// The value of [agent_service][crate::model::HumanAgentHandoffConfig::agent_service]
/// if it holds a `LivePersonConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn live_person_config(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::human_agent_handoff_config::LivePersonConfig>,
> {
#[allow(unreachable_patterns)]
self.agent_service.as_ref().and_then(|v| match v {
crate::model::human_agent_handoff_config::AgentService::LivePersonConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [agent_service][crate::model::HumanAgentHandoffConfig::agent_service]
/// to hold a `LivePersonConfig`.
///
/// Note that all the setters affecting `agent_service` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentHandoffConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_handoff_config::LivePersonConfig;
/// let x = HumanAgentHandoffConfig::new().set_live_person_config(LivePersonConfig::default()/* use setters */);
/// assert!(x.live_person_config().is_some());
/// assert!(x.salesforce_live_agent_config().is_none());
/// ```
pub fn set_live_person_config<
T: std::convert::Into<
std::boxed::Box<crate::model::human_agent_handoff_config::LivePersonConfig>,
>,
>(
mut self,
v: T,
) -> Self {
self.agent_service = std::option::Option::Some(
crate::model::human_agent_handoff_config::AgentService::LivePersonConfig(v.into()),
);
self
}
/// The value of [agent_service][crate::model::HumanAgentHandoffConfig::agent_service]
/// if it holds a `SalesforceLiveAgentConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn salesforce_live_agent_config(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::human_agent_handoff_config::SalesforceLiveAgentConfig>,
> {
#[allow(unreachable_patterns)]
self.agent_service.as_ref().and_then(|v| match v {
crate::model::human_agent_handoff_config::AgentService::SalesforceLiveAgentConfig(
v,
) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [agent_service][crate::model::HumanAgentHandoffConfig::agent_service]
/// to hold a `SalesforceLiveAgentConfig`.
///
/// Note that all the setters affecting `agent_service` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentHandoffConfig;
/// use google_cloud_dialogflow_v2::model::human_agent_handoff_config::SalesforceLiveAgentConfig;
/// let x = HumanAgentHandoffConfig::new().set_salesforce_live_agent_config(SalesforceLiveAgentConfig::default()/* use setters */);
/// assert!(x.salesforce_live_agent_config().is_some());
/// assert!(x.live_person_config().is_none());
/// ```
pub fn set_salesforce_live_agent_config<
T: std::convert::Into<
std::boxed::Box<
crate::model::human_agent_handoff_config::SalesforceLiveAgentConfig,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.agent_service = std::option::Option::Some(
crate::model::human_agent_handoff_config::AgentService::SalesforceLiveAgentConfig(
v.into(),
),
);
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for HumanAgentHandoffConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentHandoffConfig"
}
}
/// Defines additional types related to [HumanAgentHandoffConfig].
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod human_agent_handoff_config {
#[allow(unused_imports)]
use super::*;
/// Configuration specific to [LivePerson](https://www.liveperson.com).
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LivePersonConfig {
/// Required. Account number of the LivePerson account to connect. This is
/// the account number you input at the login page.
pub account_number: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl LivePersonConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [account_number][crate::model::human_agent_handoff_config::LivePersonConfig::account_number].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_handoff_config::LivePersonConfig;
/// let x = LivePersonConfig::new().set_account_number("example");
/// ```
pub fn set_account_number<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.account_number = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for LivePersonConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig"
}
}
/// Configuration specific to Salesforce Live Agent.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SalesforceLiveAgentConfig {
/// Required. The organization ID of the Salesforce account.
pub organization_id: std::string::String,
/// Required. Live Agent deployment ID.
pub deployment_id: std::string::String,
/// Required. Live Agent chat button ID.
pub button_id: std::string::String,
/// Required. Domain of the Live Agent endpoint for this agent. You can find
/// the endpoint URL in the `Live Agent settings` page. For example if URL
/// has the form <https://d.la4-c2-phx.salesforceliveagent.com/..>.,
/// you should fill in d.la4-c2-phx.salesforceliveagent.com.
pub endpoint_domain: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl SalesforceLiveAgentConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [organization_id][crate::model::human_agent_handoff_config::SalesforceLiveAgentConfig::organization_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_handoff_config::SalesforceLiveAgentConfig;
/// let x = SalesforceLiveAgentConfig::new().set_organization_id("example");
/// ```
pub fn set_organization_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.organization_id = v.into();
self
}
/// Sets the value of [deployment_id][crate::model::human_agent_handoff_config::SalesforceLiveAgentConfig::deployment_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_handoff_config::SalesforceLiveAgentConfig;
/// let x = SalesforceLiveAgentConfig::new().set_deployment_id("example");
/// ```
pub fn set_deployment_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.deployment_id = v.into();
self
}
/// Sets the value of [button_id][crate::model::human_agent_handoff_config::SalesforceLiveAgentConfig::button_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_handoff_config::SalesforceLiveAgentConfig;
/// let x = SalesforceLiveAgentConfig::new().set_button_id("example");
/// ```
pub fn set_button_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.button_id = v.into();
self
}
/// Sets the value of [endpoint_domain][crate::model::human_agent_handoff_config::SalesforceLiveAgentConfig::endpoint_domain].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::human_agent_handoff_config::SalesforceLiveAgentConfig;
/// let x = SalesforceLiveAgentConfig::new().set_endpoint_domain("example");
/// ```
pub fn set_endpoint_domain<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.endpoint_domain = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for SalesforceLiveAgentConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig"
}
}
/// Required. Specifies which agent service to connect for human agent handoff.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AgentService {
/// Uses [LivePerson](https://www.liveperson.com).
LivePersonConfig(
std::boxed::Box<crate::model::human_agent_handoff_config::LivePersonConfig>,
),
/// Uses Salesforce Live Agent.
SalesforceLiveAgentConfig(
std::boxed::Box<crate::model::human_agent_handoff_config::SalesforceLiveAgentConfig>,
),
}
}
/// Defines notification behavior.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NotificationConfig {
/// Name of the Pub/Sub topic to publish conversation
/// events like
/// [CONVERSATION_STARTED][google.cloud.dialogflow.v2.ConversationEvent.Type.CONVERSATION_STARTED]
/// as serialized
/// [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent] protos.
///
/// For telephony integration to receive notification, make sure either this
/// topic is in the same project as the conversation or you grant
/// `service-<Conversation Project
/// Number>@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow Service
/// Agent` role in the topic project.
///
/// For chat integration to receive notification, make sure API caller has been
/// granted the `Dialogflow Service Agent` role for the topic.
///
/// Format: `projects/<Project ID>/locations/<Location ID>/topics/<Topic ID>`.
///
/// [google.cloud.dialogflow.v2.ConversationEvent]: crate::model::ConversationEvent
/// [google.cloud.dialogflow.v2.ConversationEvent.Type.CONVERSATION_STARTED]: crate::model::conversation_event::Type::ConversationStarted
pub topic: std::string::String,
/// Format of message.
pub message_format: crate::model::notification_config::MessageFormat,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl NotificationConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [topic][crate::model::NotificationConfig::topic].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::NotificationConfig;
/// let x = NotificationConfig::new().set_topic("example");
/// ```
pub fn set_topic<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.topic = v.into();
self
}
/// Sets the value of [message_format][crate::model::NotificationConfig::message_format].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::NotificationConfig;
/// use google_cloud_dialogflow_v2::model::notification_config::MessageFormat;
/// let x0 = NotificationConfig::new().set_message_format(MessageFormat::Proto);
/// let x1 = NotificationConfig::new().set_message_format(MessageFormat::Json);
/// ```
pub fn set_message_format<
T: std::convert::Into<crate::model::notification_config::MessageFormat>,
>(
mut self,
v: T,
) -> Self {
self.message_format = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for NotificationConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.NotificationConfig"
}
}
/// Defines additional types related to [NotificationConfig].
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod notification_config {
#[allow(unused_imports)]
use super::*;
/// Format of cloud pub/sub message.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MessageFormat {
/// If it is unspecified, PROTO will be used.
Unspecified,
/// Pub/Sub message will be serialized proto.
Proto,
/// Pub/Sub message will be json.
Json,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [MessageFormat::value] or
/// [MessageFormat::name].
UnknownValue(message_format::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod message_format {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl MessageFormat {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Proto => std::option::Option::Some(1),
Self::Json => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MESSAGE_FORMAT_UNSPECIFIED"),
Self::Proto => std::option::Option::Some("PROTO"),
Self::Json => std::option::Option::Some("JSON"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::default::Default for MessageFormat {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::fmt::Display for MessageFormat {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::convert::From<i32> for MessageFormat {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Proto,
2 => Self::Json,
_ => Self::UnknownValue(message_format::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::convert::From<&str> for MessageFormat {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MESSAGE_FORMAT_UNSPECIFIED" => Self::Unspecified,
"PROTO" => Self::Proto,
"JSON" => Self::Json,
_ => Self::UnknownValue(message_format::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl serde::ser::Serialize for MessageFormat {
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::Proto => serializer.serialize_i32(1),
Self::Json => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl<'de> serde::de::Deserialize<'de> for MessageFormat {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<MessageFormat>::new(
".google.cloud.dialogflow.v2.NotificationConfig.MessageFormat",
))
}
}
}
/// Defines logging behavior for conversation lifecycle events.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LoggingConfig {
/// Whether to log conversation events like
/// [CONVERSATION_STARTED][google.cloud.dialogflow.v2.ConversationEvent.Type.CONVERSATION_STARTED]
/// to Stackdriver in the conversation project as JSON format
/// [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent] protos.
///
/// [google.cloud.dialogflow.v2.ConversationEvent]: crate::model::ConversationEvent
/// [google.cloud.dialogflow.v2.ConversationEvent.Type.CONVERSATION_STARTED]: crate::model::conversation_event::Type::ConversationStarted
pub enable_stackdriver_logging: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl LoggingConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [enable_stackdriver_logging][crate::model::LoggingConfig::enable_stackdriver_logging].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::LoggingConfig;
/// let x = LoggingConfig::new().set_enable_stackdriver_logging(true);
/// ```
pub fn set_enable_stackdriver_logging<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_stackdriver_logging = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for LoggingConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.LoggingConfig"
}
}
/// The type of Human Agent Assistant API suggestion to perform, and the maximum
/// number of results to return for that type. Multiple `Feature` objects can
/// be specified in the `features` list.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestionFeature {
/// Type of Human Agent Assistant API feature to request.
pub r#type: crate::model::suggestion_feature::Type,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl SuggestionFeature {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [r#type][crate::model::SuggestionFeature::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionFeature;
/// use google_cloud_dialogflow_v2::model::suggestion_feature::Type;
/// let x0 = SuggestionFeature::new().set_type(Type::ArticleSuggestion);
/// let x1 = SuggestionFeature::new().set_type(Type::Faq);
/// let x2 = SuggestionFeature::new().set_type(Type::SmartReply);
/// ```
pub fn set_type<T: std::convert::Into<crate::model::suggestion_feature::Type>>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for SuggestionFeature {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestionFeature"
}
}
/// Defines additional types related to [SuggestionFeature].
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod suggestion_feature {
#[allow(unused_imports)]
use super::*;
/// Defines the type of Human Agent Assistant feature.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Type {
/// Unspecified feature type.
Unspecified,
/// Run article suggestion model for chat.
ArticleSuggestion,
/// Run FAQ model for chat.
Faq,
/// Run smart reply model for chat.
SmartReply,
/// Run conversation summarization model for chat.
ConversationSummarization,
/// Run knowledge search with text input from agent or text generated query.
KnowledgeSearch,
/// Run knowledge assist with automatic query generation.
KnowledgeAssist,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Type::value] or
/// [Type::name].
UnknownValue(r#type::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod r#type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl Type {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ArticleSuggestion => std::option::Option::Some(1),
Self::Faq => std::option::Option::Some(2),
Self::SmartReply => std::option::Option::Some(3),
Self::ConversationSummarization => std::option::Option::Some(8),
Self::KnowledgeSearch => std::option::Option::Some(14),
Self::KnowledgeAssist => std::option::Option::Some(15),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
Self::ArticleSuggestion => std::option::Option::Some("ARTICLE_SUGGESTION"),
Self::Faq => std::option::Option::Some("FAQ"),
Self::SmartReply => std::option::Option::Some("SMART_REPLY"),
Self::ConversationSummarization => {
std::option::Option::Some("CONVERSATION_SUMMARIZATION")
}
Self::KnowledgeSearch => std::option::Option::Some("KNOWLEDGE_SEARCH"),
Self::KnowledgeAssist => std::option::Option::Some("KNOWLEDGE_ASSIST"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::default::Default for Type {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
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())
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::convert::From<i32> for Type {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ArticleSuggestion,
2 => Self::Faq,
3 => Self::SmartReply,
8 => Self::ConversationSummarization,
14 => Self::KnowledgeSearch,
15 => Self::KnowledgeAssist,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::convert::From<&str> for Type {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_UNSPECIFIED" => Self::Unspecified,
"ARTICLE_SUGGESTION" => Self::ArticleSuggestion,
"FAQ" => Self::Faq,
"SMART_REPLY" => Self::SmartReply,
"CONVERSATION_SUMMARIZATION" => Self::ConversationSummarization,
"KNOWLEDGE_SEARCH" => Self::KnowledgeSearch,
"KNOWLEDGE_ASSIST" => Self::KnowledgeAssist,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
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::ArticleSuggestion => serializer.serialize_i32(1),
Self::Faq => serializer.serialize_i32(2),
Self::SmartReply => serializer.serialize_i32(3),
Self::ConversationSummarization => serializer.serialize_i32(8),
Self::KnowledgeSearch => serializer.serialize_i32(14),
Self::KnowledgeAssist => serializer.serialize_i32(15),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
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.dialogflow.v2.SuggestionFeature.Type",
))
}
}
}
/// The request message for
/// [ConversationProfiles.SetSuggestionFeatureConfig][google.cloud.dialogflow.v2.ConversationProfiles.SetSuggestionFeatureConfig].
///
/// [google.cloud.dialogflow.v2.ConversationProfiles.SetSuggestionFeatureConfig]: crate::client::ConversationProfiles::set_suggestion_feature_config
#[cfg(feature = "conversation-profiles")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SetSuggestionFeatureConfigRequest {
/// Required. The Conversation Profile to add or update the suggestion feature
/// config. Format: `projects/<Project ID>/locations/<Location
/// ID>/conversationProfiles/<Conversation Profile ID>`.
pub conversation_profile: std::string::String,
/// Required. The participant role to add or update the suggestion feature
/// config. Only HUMAN_AGENT or END_USER can be used.
pub participant_role: crate::model::participant::Role,
/// Required. The suggestion feature config to add or update.
pub suggestion_feature_config:
std::option::Option<crate::model::human_agent_assistant_config::SuggestionFeatureConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-profiles")]
impl SetSuggestionFeatureConfigRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_profile][crate::model::SetSuggestionFeatureConfigRequest::conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SetSuggestionFeatureConfigRequest;
/// let x = SetSuggestionFeatureConfigRequest::new().set_conversation_profile("example");
/// ```
pub fn set_conversation_profile<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_profile = v.into();
self
}
/// Sets the value of [participant_role][crate::model::SetSuggestionFeatureConfigRequest::participant_role].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SetSuggestionFeatureConfigRequest;
/// use google_cloud_dialogflow_v2::model::participant::Role;
/// let x0 = SetSuggestionFeatureConfigRequest::new().set_participant_role(Role::HumanAgent);
/// let x1 = SetSuggestionFeatureConfigRequest::new().set_participant_role(Role::AutomatedAgent);
/// let x2 = SetSuggestionFeatureConfigRequest::new().set_participant_role(Role::EndUser);
/// ```
pub fn set_participant_role<T: std::convert::Into<crate::model::participant::Role>>(
mut self,
v: T,
) -> Self {
self.participant_role = v.into();
self
}
/// Sets the value of [suggestion_feature_config][crate::model::SetSuggestionFeatureConfigRequest::suggestion_feature_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SetSuggestionFeatureConfigRequest;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// let x = SetSuggestionFeatureConfigRequest::new().set_suggestion_feature_config(SuggestionFeatureConfig::default()/* use setters */);
/// ```
pub fn set_suggestion_feature_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::human_agent_assistant_config::SuggestionFeatureConfig>,
{
self.suggestion_feature_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [suggestion_feature_config][crate::model::SetSuggestionFeatureConfigRequest::suggestion_feature_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SetSuggestionFeatureConfigRequest;
/// use google_cloud_dialogflow_v2::model::human_agent_assistant_config::SuggestionFeatureConfig;
/// let x = SetSuggestionFeatureConfigRequest::new().set_or_clear_suggestion_feature_config(Some(SuggestionFeatureConfig::default()/* use setters */));
/// let x = SetSuggestionFeatureConfigRequest::new().set_or_clear_suggestion_feature_config(None::<SuggestionFeatureConfig>);
/// ```
pub fn set_or_clear_suggestion_feature_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::human_agent_assistant_config::SuggestionFeatureConfig>,
{
self.suggestion_feature_config = v.map(|x| x.into());
self
}
}
#[cfg(feature = "conversation-profiles")]
impl wkt::message::Message for SetSuggestionFeatureConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest"
}
}
/// The request message for
/// [ConversationProfiles.ClearSuggestionFeatureConfig][google.cloud.dialogflow.v2.ConversationProfiles.ClearSuggestionFeatureConfig].
///
/// [google.cloud.dialogflow.v2.ConversationProfiles.ClearSuggestionFeatureConfig]: crate::client::ConversationProfiles::clear_suggestion_feature_config
#[cfg(feature = "conversation-profiles")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ClearSuggestionFeatureConfigRequest {
/// Required. The Conversation Profile to add or update the suggestion feature
/// config. Format: `projects/<Project ID>/locations/<Location
/// ID>/conversationProfiles/<Conversation Profile ID>`.
pub conversation_profile: std::string::String,
/// Required. The participant role to remove the suggestion feature
/// config. Only HUMAN_AGENT or END_USER can be used.
pub participant_role: crate::model::participant::Role,
/// Required. The type of the suggestion feature to remove.
pub suggestion_feature_type: crate::model::suggestion_feature::Type,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-profiles")]
impl ClearSuggestionFeatureConfigRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_profile][crate::model::ClearSuggestionFeatureConfigRequest::conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ClearSuggestionFeatureConfigRequest;
/// let x = ClearSuggestionFeatureConfigRequest::new().set_conversation_profile("example");
/// ```
pub fn set_conversation_profile<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_profile = v.into();
self
}
/// Sets the value of [participant_role][crate::model::ClearSuggestionFeatureConfigRequest::participant_role].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ClearSuggestionFeatureConfigRequest;
/// use google_cloud_dialogflow_v2::model::participant::Role;
/// let x0 = ClearSuggestionFeatureConfigRequest::new().set_participant_role(Role::HumanAgent);
/// let x1 = ClearSuggestionFeatureConfigRequest::new().set_participant_role(Role::AutomatedAgent);
/// let x2 = ClearSuggestionFeatureConfigRequest::new().set_participant_role(Role::EndUser);
/// ```
pub fn set_participant_role<T: std::convert::Into<crate::model::participant::Role>>(
mut self,
v: T,
) -> Self {
self.participant_role = v.into();
self
}
/// Sets the value of [suggestion_feature_type][crate::model::ClearSuggestionFeatureConfigRequest::suggestion_feature_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ClearSuggestionFeatureConfigRequest;
/// use google_cloud_dialogflow_v2::model::suggestion_feature::Type;
/// let x0 = ClearSuggestionFeatureConfigRequest::new().set_suggestion_feature_type(Type::ArticleSuggestion);
/// let x1 = ClearSuggestionFeatureConfigRequest::new().set_suggestion_feature_type(Type::Faq);
/// let x2 = ClearSuggestionFeatureConfigRequest::new().set_suggestion_feature_type(Type::SmartReply);
/// ```
pub fn set_suggestion_feature_type<
T: std::convert::Into<crate::model::suggestion_feature::Type>,
>(
mut self,
v: T,
) -> Self {
self.suggestion_feature_type = v.into();
self
}
}
#[cfg(feature = "conversation-profiles")]
impl wkt::message::Message for ClearSuggestionFeatureConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest"
}
}
/// Metadata for a
/// [ConversationProfiles.SetSuggestionFeatureConfig][google.cloud.dialogflow.v2.ConversationProfiles.SetSuggestionFeatureConfig]
/// operation.
///
/// [google.cloud.dialogflow.v2.ConversationProfiles.SetSuggestionFeatureConfig]: crate::client::ConversationProfiles::set_suggestion_feature_config
#[cfg(feature = "conversation-profiles")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SetSuggestionFeatureConfigOperationMetadata {
/// The resource name of the conversation profile. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversationProfiles/<Conversation Profile ID>`
pub conversation_profile: std::string::String,
/// Required. The participant role to add or update the suggestion feature
/// config. Only HUMAN_AGENT or END_USER can be used.
pub participant_role: crate::model::participant::Role,
/// Required. The type of the suggestion feature to add or update.
pub suggestion_feature_type: crate::model::suggestion_feature::Type,
/// Timestamp whe the request was created. The time is measured on server side.
pub create_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-profiles")]
impl SetSuggestionFeatureConfigOperationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_profile][crate::model::SetSuggestionFeatureConfigOperationMetadata::conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SetSuggestionFeatureConfigOperationMetadata;
/// let x = SetSuggestionFeatureConfigOperationMetadata::new().set_conversation_profile("example");
/// ```
pub fn set_conversation_profile<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_profile = v.into();
self
}
/// Sets the value of [participant_role][crate::model::SetSuggestionFeatureConfigOperationMetadata::participant_role].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SetSuggestionFeatureConfigOperationMetadata;
/// use google_cloud_dialogflow_v2::model::participant::Role;
/// let x0 = SetSuggestionFeatureConfigOperationMetadata::new().set_participant_role(Role::HumanAgent);
/// let x1 = SetSuggestionFeatureConfigOperationMetadata::new().set_participant_role(Role::AutomatedAgent);
/// let x2 = SetSuggestionFeatureConfigOperationMetadata::new().set_participant_role(Role::EndUser);
/// ```
pub fn set_participant_role<T: std::convert::Into<crate::model::participant::Role>>(
mut self,
v: T,
) -> Self {
self.participant_role = v.into();
self
}
/// Sets the value of [suggestion_feature_type][crate::model::SetSuggestionFeatureConfigOperationMetadata::suggestion_feature_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SetSuggestionFeatureConfigOperationMetadata;
/// use google_cloud_dialogflow_v2::model::suggestion_feature::Type;
/// let x0 = SetSuggestionFeatureConfigOperationMetadata::new().set_suggestion_feature_type(Type::ArticleSuggestion);
/// let x1 = SetSuggestionFeatureConfigOperationMetadata::new().set_suggestion_feature_type(Type::Faq);
/// let x2 = SetSuggestionFeatureConfigOperationMetadata::new().set_suggestion_feature_type(Type::SmartReply);
/// ```
pub fn set_suggestion_feature_type<
T: std::convert::Into<crate::model::suggestion_feature::Type>,
>(
mut self,
v: T,
) -> Self {
self.suggestion_feature_type = v.into();
self
}
/// Sets the value of [create_time][crate::model::SetSuggestionFeatureConfigOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SetSuggestionFeatureConfigOperationMetadata;
/// use wkt::Timestamp;
/// let x = SetSuggestionFeatureConfigOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::SetSuggestionFeatureConfigOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SetSuggestionFeatureConfigOperationMetadata;
/// use wkt::Timestamp;
/// let x = SetSuggestionFeatureConfigOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = SetSuggestionFeatureConfigOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
}
#[cfg(feature = "conversation-profiles")]
impl wkt::message::Message for SetSuggestionFeatureConfigOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata"
}
}
/// Metadata for a
/// [ConversationProfiles.ClearSuggestionFeatureConfig][google.cloud.dialogflow.v2.ConversationProfiles.ClearSuggestionFeatureConfig]
/// operation.
///
/// [google.cloud.dialogflow.v2.ConversationProfiles.ClearSuggestionFeatureConfig]: crate::client::ConversationProfiles::clear_suggestion_feature_config
#[cfg(feature = "conversation-profiles")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ClearSuggestionFeatureConfigOperationMetadata {
/// The resource name of the conversation profile. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/conversationProfiles/<Conversation Profile ID>`
pub conversation_profile: std::string::String,
/// Required. The participant role to remove the suggestion feature
/// config. Only HUMAN_AGENT or END_USER can be used.
pub participant_role: crate::model::participant::Role,
/// Required. The type of the suggestion feature to remove.
pub suggestion_feature_type: crate::model::suggestion_feature::Type,
/// Timestamp whe the request was created. The time is measured on server side.
pub create_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "conversation-profiles")]
impl ClearSuggestionFeatureConfigOperationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_profile][crate::model::ClearSuggestionFeatureConfigOperationMetadata::conversation_profile].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ClearSuggestionFeatureConfigOperationMetadata;
/// let x = ClearSuggestionFeatureConfigOperationMetadata::new().set_conversation_profile("example");
/// ```
pub fn set_conversation_profile<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.conversation_profile = v.into();
self
}
/// Sets the value of [participant_role][crate::model::ClearSuggestionFeatureConfigOperationMetadata::participant_role].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ClearSuggestionFeatureConfigOperationMetadata;
/// use google_cloud_dialogflow_v2::model::participant::Role;
/// let x0 = ClearSuggestionFeatureConfigOperationMetadata::new().set_participant_role(Role::HumanAgent);
/// let x1 = ClearSuggestionFeatureConfigOperationMetadata::new().set_participant_role(Role::AutomatedAgent);
/// let x2 = ClearSuggestionFeatureConfigOperationMetadata::new().set_participant_role(Role::EndUser);
/// ```
pub fn set_participant_role<T: std::convert::Into<crate::model::participant::Role>>(
mut self,
v: T,
) -> Self {
self.participant_role = v.into();
self
}
/// Sets the value of [suggestion_feature_type][crate::model::ClearSuggestionFeatureConfigOperationMetadata::suggestion_feature_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ClearSuggestionFeatureConfigOperationMetadata;
/// use google_cloud_dialogflow_v2::model::suggestion_feature::Type;
/// let x0 = ClearSuggestionFeatureConfigOperationMetadata::new().set_suggestion_feature_type(Type::ArticleSuggestion);
/// let x1 = ClearSuggestionFeatureConfigOperationMetadata::new().set_suggestion_feature_type(Type::Faq);
/// let x2 = ClearSuggestionFeatureConfigOperationMetadata::new().set_suggestion_feature_type(Type::SmartReply);
/// ```
pub fn set_suggestion_feature_type<
T: std::convert::Into<crate::model::suggestion_feature::Type>,
>(
mut self,
v: T,
) -> Self {
self.suggestion_feature_type = v.into();
self
}
/// Sets the value of [create_time][crate::model::ClearSuggestionFeatureConfigOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ClearSuggestionFeatureConfigOperationMetadata;
/// use wkt::Timestamp;
/// let x = ClearSuggestionFeatureConfigOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::ClearSuggestionFeatureConfigOperationMetadata::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ClearSuggestionFeatureConfigOperationMetadata;
/// use wkt::Timestamp;
/// let x = ClearSuggestionFeatureConfigOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = ClearSuggestionFeatureConfigOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
}
#[cfg(feature = "conversation-profiles")]
impl wkt::message::Message for ClearSuggestionFeatureConfigOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata"
}
}
/// A knowledge document to be used by a
/// [KnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBase].
///
/// For more information, see the [knowledge base
/// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases).
///
/// Note: The `projects.agent.knowledgeBases.documents` resource is deprecated;
/// only use `projects.knowledgeBases.documents`.
///
/// [google.cloud.dialogflow.v2.KnowledgeBase]: crate::model::KnowledgeBase
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Document {
/// Optional. The document resource name.
/// The name must be empty when creating a document.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
pub name: std::string::String,
/// Required. The display name of the document. The name must be 1024 bytes or
/// less; otherwise, the creation request fails.
pub display_name: std::string::String,
/// Required. The MIME type of this document.
pub mime_type: std::string::String,
/// Required. The knowledge type of document content.
pub knowledge_types: std::vec::Vec<crate::model::document::KnowledgeType>,
/// Optional. If true, we try to automatically reload the document every day
/// (at a time picked by the system). If false or unspecified, we don't try
/// to automatically reload the document.
///
/// Currently you can only enable automatic reload for documents sourced from
/// a public url, see `source` field for the source types.
///
/// Reload status can be tracked in `latest_reload_status`. If a reload
/// fails, we will keep the document unchanged.
///
/// If a reload fails with internal errors, the system will try to reload the
/// document on the next day.
/// If a reload fails with non-retriable errors (e.g. PERMISSION_DENIED), the
/// system will not try to reload the document anymore. You need to manually
/// reload the document successfully by calling `ReloadDocument` and clear the
/// errors.
pub enable_auto_reload: bool,
/// Output only. The time and status of the latest reload.
/// This reload may have been triggered automatically or manually
/// and may not have succeeded.
pub latest_reload_status: std::option::Option<crate::model::document::ReloadStatus>,
/// Optional. Metadata for the document. The metadata supports arbitrary
/// key-value pairs. Suggested use cases include storing a document's title,
/// an external URL distinct from the document's content_uri, etc.
/// The max size of a `key` or a `value` of the metadata is 1024 bytes.
pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
/// Output only. The current state of the document.
pub state: crate::model::document::State,
/// Required. The source of this document.
pub source: std::option::Option<crate::model::document::Source>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl Document {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::Document::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Document;
/// let x = Document::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [display_name][crate::model::Document::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Document;
/// let x = Document::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [mime_type][crate::model::Document::mime_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Document;
/// let x = Document::new().set_mime_type("example");
/// ```
pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.mime_type = v.into();
self
}
/// Sets the value of [knowledge_types][crate::model::Document::knowledge_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Document;
/// use google_cloud_dialogflow_v2::model::document::KnowledgeType;
/// let x = Document::new().set_knowledge_types([
/// KnowledgeType::Faq,
/// KnowledgeType::ExtractiveQa,
/// KnowledgeType::ArticleSuggestion,
/// ]);
/// ```
pub fn set_knowledge_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::document::KnowledgeType>,
{
use std::iter::Iterator;
self.knowledge_types = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [enable_auto_reload][crate::model::Document::enable_auto_reload].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Document;
/// let x = Document::new().set_enable_auto_reload(true);
/// ```
pub fn set_enable_auto_reload<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_auto_reload = v.into();
self
}
/// Sets the value of [latest_reload_status][crate::model::Document::latest_reload_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Document;
/// use google_cloud_dialogflow_v2::model::document::ReloadStatus;
/// let x = Document::new().set_latest_reload_status(ReloadStatus::default()/* use setters */);
/// ```
pub fn set_latest_reload_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::document::ReloadStatus>,
{
self.latest_reload_status = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [latest_reload_status][crate::model::Document::latest_reload_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Document;
/// use google_cloud_dialogflow_v2::model::document::ReloadStatus;
/// let x = Document::new().set_or_clear_latest_reload_status(Some(ReloadStatus::default()/* use setters */));
/// let x = Document::new().set_or_clear_latest_reload_status(None::<ReloadStatus>);
/// ```
pub fn set_or_clear_latest_reload_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::document::ReloadStatus>,
{
self.latest_reload_status = v.map(|x| x.into());
self
}
/// Sets the value of [metadata][crate::model::Document::metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Document;
/// let x = Document::new().set_metadata([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
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<std::string::String>,
{
use std::iter::Iterator;
self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [state][crate::model::Document::state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Document;
/// use google_cloud_dialogflow_v2::model::document::State;
/// let x0 = Document::new().set_state(State::Creating);
/// let x1 = Document::new().set_state(State::Active);
/// let x2 = Document::new().set_state(State::Updating);
/// ```
pub fn set_state<T: std::convert::Into<crate::model::document::State>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
/// Sets the value of [source][crate::model::Document::source].
///
/// Note that all the setters affecting `source` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Document;
/// use google_cloud_dialogflow_v2::model::document::Source;
/// let x = Document::new().set_source(Some(Source::ContentUri("example".to_string())));
/// ```
pub fn set_source<
T: std::convert::Into<std::option::Option<crate::model::document::Source>>,
>(
mut self,
v: T,
) -> Self {
self.source = v.into();
self
}
/// The value of [source][crate::model::Document::source]
/// if it holds a `ContentUri`, `None` if the field is not set or
/// holds a different branch.
pub fn content_uri(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::document::Source::ContentUri(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::Document::source]
/// to hold a `ContentUri`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Document;
/// let x = Document::new().set_content_uri("example");
/// assert!(x.content_uri().is_some());
/// assert!(x.raw_content().is_none());
/// ```
pub fn set_content_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source =
std::option::Option::Some(crate::model::document::Source::ContentUri(v.into()));
self
}
/// The value of [source][crate::model::Document::source]
/// if it holds a `RawContent`, `None` if the field is not set or
/// holds a different branch.
pub fn raw_content(&self) -> std::option::Option<&::bytes::Bytes> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::document::Source::RawContent(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::Document::source]
/// to hold a `RawContent`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Document;
/// let x = Document::new().set_raw_content(bytes::Bytes::from_static(b"example"));
/// assert!(x.raw_content().is_some());
/// assert!(x.content_uri().is_none());
/// ```
pub fn set_raw_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.source =
std::option::Option::Some(crate::model::document::Source::RawContent(v.into()));
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for Document {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Document"
}
}
/// Defines additional types related to [Document].
#[cfg(feature = "documents")]
pub mod document {
#[allow(unused_imports)]
use super::*;
/// The status of a reload attempt.
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReloadStatus {
/// The time of a reload attempt.
/// This reload may have been triggered automatically or manually and may
/// not have succeeded.
pub time: std::option::Option<wkt::Timestamp>,
/// The status of a reload attempt or the initial load.
pub status: std::option::Option<google_cloud_rpc::model::Status>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl ReloadStatus {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [time][crate::model::document::ReloadStatus::time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::document::ReloadStatus;
/// use wkt::Timestamp;
/// let x = ReloadStatus::new().set_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [time][crate::model::document::ReloadStatus::time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::document::ReloadStatus;
/// use wkt::Timestamp;
/// let x = ReloadStatus::new().set_or_clear_time(Some(Timestamp::default()/* use setters */));
/// let x = ReloadStatus::new().set_or_clear_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.time = v.map(|x| x.into());
self
}
/// Sets the value of [status][crate::model::document::ReloadStatus::status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::document::ReloadStatus;
/// use google_cloud_rpc::model::Status;
/// let x = ReloadStatus::new().set_status(Status::default()/* use setters */);
/// ```
pub fn set_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.status = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [status][crate::model::document::ReloadStatus::status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::document::ReloadStatus;
/// use google_cloud_rpc::model::Status;
/// let x = ReloadStatus::new().set_or_clear_status(Some(Status::default()/* use setters */));
/// let x = ReloadStatus::new().set_or_clear_status(None::<Status>);
/// ```
pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.status = v.map(|x| x.into());
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for ReloadStatus {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Document.ReloadStatus"
}
}
/// The knowledge type of document content.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "documents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum KnowledgeType {
/// The type is unspecified or arbitrary.
Unspecified,
/// The document content contains question and answer pairs as either HTML or
/// CSV. Typical FAQ HTML formats are parsed accurately, but unusual formats
/// may fail to be parsed.
///
/// CSV must have questions in the first column and answers in the second,
/// with no header. Because of this explicit format, they are always parsed
/// accurately.
Faq,
/// Documents for which unstructured text is extracted and used for
/// question answering.
ExtractiveQa,
/// The entire document content as a whole can be used for query results.
/// Only for Contact Center Solutions on Dialogflow.
ArticleSuggestion,
/// The document contains agent-facing Smart Reply entries.
AgentFacingSmartReply,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [KnowledgeType::value] or
/// [KnowledgeType::name].
UnknownValue(knowledge_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "documents")]
pub mod knowledge_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "documents")]
impl KnowledgeType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Faq => std::option::Option::Some(1),
Self::ExtractiveQa => std::option::Option::Some(2),
Self::ArticleSuggestion => std::option::Option::Some(3),
Self::AgentFacingSmartReply => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("KNOWLEDGE_TYPE_UNSPECIFIED"),
Self::Faq => std::option::Option::Some("FAQ"),
Self::ExtractiveQa => std::option::Option::Some("EXTRACTIVE_QA"),
Self::ArticleSuggestion => std::option::Option::Some("ARTICLE_SUGGESTION"),
Self::AgentFacingSmartReply => {
std::option::Option::Some("AGENT_FACING_SMART_REPLY")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "documents")]
impl std::default::Default for KnowledgeType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "documents")]
impl std::fmt::Display for KnowledgeType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "documents")]
impl std::convert::From<i32> for KnowledgeType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Faq,
2 => Self::ExtractiveQa,
3 => Self::ArticleSuggestion,
4 => Self::AgentFacingSmartReply,
_ => Self::UnknownValue(knowledge_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "documents")]
impl std::convert::From<&str> for KnowledgeType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"KNOWLEDGE_TYPE_UNSPECIFIED" => Self::Unspecified,
"FAQ" => Self::Faq,
"EXTRACTIVE_QA" => Self::ExtractiveQa,
"ARTICLE_SUGGESTION" => Self::ArticleSuggestion,
"AGENT_FACING_SMART_REPLY" => Self::AgentFacingSmartReply,
_ => Self::UnknownValue(knowledge_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "documents")]
impl serde::ser::Serialize for KnowledgeType {
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::Faq => serializer.serialize_i32(1),
Self::ExtractiveQa => serializer.serialize_i32(2),
Self::ArticleSuggestion => serializer.serialize_i32(3),
Self::AgentFacingSmartReply => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "documents")]
impl<'de> serde::de::Deserialize<'de> for KnowledgeType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<KnowledgeType>::new(
".google.cloud.dialogflow.v2.Document.KnowledgeType",
))
}
}
/// Possible states of the document
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "documents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
/// The document state is unspecified.
Unspecified,
/// The document creation is in progress.
Creating,
/// The document is active and ready to use.
Active,
/// The document updation is in progress.
Updating,
/// The document is reloading.
Reloading,
/// The document deletion is in progress.
Deleting,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [State::value] or
/// [State::name].
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "documents")]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "documents")]
impl State {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Creating => std::option::Option::Some(1),
Self::Active => std::option::Option::Some(2),
Self::Updating => std::option::Option::Some(3),
Self::Reloading => std::option::Option::Some(4),
Self::Deleting => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Creating => std::option::Option::Some("CREATING"),
Self::Active => std::option::Option::Some("ACTIVE"),
Self::Updating => std::option::Option::Some("UPDATING"),
Self::Reloading => std::option::Option::Some("RELOADING"),
Self::Deleting => std::option::Option::Some("DELETING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "documents")]
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "documents")]
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())
}
}
#[cfg(feature = "documents")]
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Creating,
2 => Self::Active,
3 => Self::Updating,
4 => Self::Reloading,
5 => Self::Deleting,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "documents")]
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"CREATING" => Self::Creating,
"ACTIVE" => Self::Active,
"UPDATING" => Self::Updating,
"RELOADING" => Self::Reloading,
"DELETING" => Self::Deleting,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "documents")]
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::Creating => serializer.serialize_i32(1),
Self::Active => serializer.serialize_i32(2),
Self::Updating => serializer.serialize_i32(3),
Self::Reloading => serializer.serialize_i32(4),
Self::Deleting => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "documents")]
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.dialogflow.v2.Document.State",
))
}
}
/// Required. The source of this document.
#[cfg(feature = "documents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Source {
/// The URI where the file content is located.
///
/// For documents stored in Google Cloud Storage, these URIs must have
/// the form `gs://<bucket-name>/<object-name>`.
///
/// NOTE: External URLs must correspond to public webpages, i.e., they must
/// be indexed by Google Search. In particular, URLs for showing documents in
/// Google Cloud Storage (i.e. the URL in your browser) are not supported.
/// Instead use the `gs://` format URI described above.
ContentUri(std::string::String),
/// The raw content of the document. This field is only permitted for
/// EXTRACTIVE_QA and FAQ knowledge types.
RawContent(::bytes::Bytes),
}
}
/// Request message for
/// [Documents.GetDocument][google.cloud.dialogflow.v2.Documents.GetDocument].
///
/// [google.cloud.dialogflow.v2.Documents.GetDocument]: crate::client::Documents::get_document
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetDocumentRequest {
/// Required. The name of the document to retrieve.
/// Format `projects/<Project ID>/locations/<Location
/// ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl GetDocumentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetDocumentRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetDocumentRequest;
/// let x = GetDocumentRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for GetDocumentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetDocumentRequest"
}
}
/// Request message for
/// [Documents.ListDocuments][google.cloud.dialogflow.v2.Documents.ListDocuments].
///
/// [google.cloud.dialogflow.v2.Documents.ListDocuments]: crate::client::Documents::list_documents
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListDocumentsRequest {
/// Required. The knowledge base to list all documents for.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/knowledgeBases/<Knowledge Base ID>`.
pub parent: std::string::String,
/// The maximum number of items to return in a single page. By
/// default 10 and at most 100.
pub page_size: i32,
/// The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
/// The filter expression used to filter documents returned by the list method.
/// The expression has the following syntax:
///
/// \<field\> \<operator\> \<value\> [AND \<field\> \<operator\> \<value\>] ...
///
/// The following fields and operators are supported:
///
/// * knowledge_types with has(:) operator
/// * display_name with has(:) operator
/// * state with equals(=) operator
///
/// Examples:
///
/// * "knowledge_types:FAQ" matches documents with FAQ knowledge type.
/// * "display_name:customer" matches documents whose display name contains
/// "customer".
/// * "state=ACTIVE" matches documents with ACTIVE state.
/// * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents.
///
/// For more information about filtering, see
/// [API Filtering](https://aip.dev/160).
pub filter: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl ListDocumentsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListDocumentsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListDocumentsRequest;
/// let x = ListDocumentsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListDocumentsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListDocumentsRequest;
/// let x = ListDocumentsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListDocumentsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListDocumentsRequest;
/// let x = ListDocumentsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
/// Sets the value of [filter][crate::model::ListDocumentsRequest::filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListDocumentsRequest;
/// let x = ListDocumentsRequest::new().set_filter("example");
/// ```
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for ListDocumentsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListDocumentsRequest"
}
}
/// Response message for
/// [Documents.ListDocuments][google.cloud.dialogflow.v2.Documents.ListDocuments].
///
/// [google.cloud.dialogflow.v2.Documents.ListDocuments]: crate::client::Documents::list_documents
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListDocumentsResponse {
/// The list of documents.
pub documents: std::vec::Vec<crate::model::Document>,
/// Token to retrieve the next page of results, or empty if there are no
/// more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl ListDocumentsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [documents][crate::model::ListDocumentsResponse::documents].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListDocumentsResponse;
/// use google_cloud_dialogflow_v2::model::Document;
/// let x = ListDocumentsResponse::new()
/// .set_documents([
/// Document::default()/* use setters */,
/// Document::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_documents<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Document>,
{
use std::iter::Iterator;
self.documents = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListDocumentsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListDocumentsResponse;
/// let x = ListDocumentsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for ListDocumentsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListDocumentsResponse"
}
}
#[cfg(feature = "documents")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListDocumentsResponse {
type PageItem = crate::model::Document;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.documents
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Request message for
/// [Documents.CreateDocument][google.cloud.dialogflow.v2.Documents.CreateDocument].
///
/// [google.cloud.dialogflow.v2.Documents.CreateDocument]: crate::client::Documents::create_document
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateDocumentRequest {
/// Required. The knowledge base to create a document for.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/knowledgeBases/<Knowledge Base ID>`.
pub parent: std::string::String,
/// Required. The document to create.
pub document: std::option::Option<crate::model::Document>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl CreateDocumentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateDocumentRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateDocumentRequest;
/// let x = CreateDocumentRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [document][crate::model::CreateDocumentRequest::document].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateDocumentRequest;
/// use google_cloud_dialogflow_v2::model::Document;
/// let x = CreateDocumentRequest::new().set_document(Document::default()/* use setters */);
/// ```
pub fn set_document<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Document>,
{
self.document = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [document][crate::model::CreateDocumentRequest::document].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateDocumentRequest;
/// use google_cloud_dialogflow_v2::model::Document;
/// let x = CreateDocumentRequest::new().set_or_clear_document(Some(Document::default()/* use setters */));
/// let x = CreateDocumentRequest::new().set_or_clear_document(None::<Document>);
/// ```
pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Document>,
{
self.document = v.map(|x| x.into());
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for CreateDocumentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateDocumentRequest"
}
}
/// Request message for
/// [Documents.ImportDocuments][google.cloud.dialogflow.v2.Documents.ImportDocuments].
///
/// [google.cloud.dialogflow.v2.Documents.ImportDocuments]: crate::client::Documents::import_documents
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportDocumentsRequest {
/// Required. The knowledge base to import documents into.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/knowledgeBases/<Knowledge Base ID>`.
pub parent: std::string::String,
/// Required. Document template used for importing all the documents.
pub document_template: std::option::Option<crate::model::ImportDocumentTemplate>,
/// Whether to import custom metadata from Google Cloud Storage.
/// Only valid when the document source is Google Cloud Storage URI.
pub import_gcs_custom_metadata: bool,
/// Required. The source to use for importing documents.
///
/// If the source captures multiple objects, then multiple documents will be
/// created, one corresponding to each object, and all of these documents will
/// be created using the same document template.
///
/// Dialogflow supports up to 350 documents in each request. If you try to
/// import more, Dialogflow will return an error.
pub source: std::option::Option<crate::model::import_documents_request::Source>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl ImportDocumentsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ImportDocumentsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportDocumentsRequest;
/// let x = ImportDocumentsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [document_template][crate::model::ImportDocumentsRequest::document_template].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportDocumentsRequest;
/// use google_cloud_dialogflow_v2::model::ImportDocumentTemplate;
/// let x = ImportDocumentsRequest::new().set_document_template(ImportDocumentTemplate::default()/* use setters */);
/// ```
pub fn set_document_template<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ImportDocumentTemplate>,
{
self.document_template = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [document_template][crate::model::ImportDocumentsRequest::document_template].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportDocumentsRequest;
/// use google_cloud_dialogflow_v2::model::ImportDocumentTemplate;
/// let x = ImportDocumentsRequest::new().set_or_clear_document_template(Some(ImportDocumentTemplate::default()/* use setters */));
/// let x = ImportDocumentsRequest::new().set_or_clear_document_template(None::<ImportDocumentTemplate>);
/// ```
pub fn set_or_clear_document_template<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ImportDocumentTemplate>,
{
self.document_template = v.map(|x| x.into());
self
}
/// Sets the value of [import_gcs_custom_metadata][crate::model::ImportDocumentsRequest::import_gcs_custom_metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportDocumentsRequest;
/// let x = ImportDocumentsRequest::new().set_import_gcs_custom_metadata(true);
/// ```
pub fn set_import_gcs_custom_metadata<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.import_gcs_custom_metadata = v.into();
self
}
/// Sets the value of [source][crate::model::ImportDocumentsRequest::source].
///
/// Note that all the setters affecting `source` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportDocumentsRequest;
/// use google_cloud_dialogflow_v2::model::GcsSources;
/// let x = ImportDocumentsRequest::new().set_source(Some(
/// google_cloud_dialogflow_v2::model::import_documents_request::Source::GcsSource(GcsSources::default().into())));
/// ```
pub fn set_source<
T: std::convert::Into<std::option::Option<crate::model::import_documents_request::Source>>,
>(
mut self,
v: T,
) -> Self {
self.source = v.into();
self
}
/// The value of [source][crate::model::ImportDocumentsRequest::source]
/// if it holds a `GcsSource`, `None` if the field is not set or
/// holds a different branch.
pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSources>> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::import_documents_request::Source::GcsSource(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::ImportDocumentsRequest::source]
/// to hold a `GcsSource`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportDocumentsRequest;
/// use google_cloud_dialogflow_v2::model::GcsSources;
/// let x = ImportDocumentsRequest::new().set_gcs_source(GcsSources::default()/* use setters */);
/// assert!(x.gcs_source().is_some());
/// ```
pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSources>>>(
mut self,
v: T,
) -> Self {
self.source = std::option::Option::Some(
crate::model::import_documents_request::Source::GcsSource(v.into()),
);
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for ImportDocumentsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ImportDocumentsRequest"
}
}
/// Defines additional types related to [ImportDocumentsRequest].
#[cfg(feature = "documents")]
pub mod import_documents_request {
#[allow(unused_imports)]
use super::*;
/// Required. The source to use for importing documents.
///
/// If the source captures multiple objects, then multiple documents will be
/// created, one corresponding to each object, and all of these documents will
/// be created using the same document template.
///
/// Dialogflow supports up to 350 documents in each request. If you try to
/// import more, Dialogflow will return an error.
#[cfg(feature = "documents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Source {
/// Optional. The Google Cloud Storage location for the documents.
/// The path can include a wildcard.
///
/// These URIs may have the forms
/// `gs://<bucket-name>/<object-name>`.
/// `gs://<bucket-name>/<object-path>/*.<extension>`.
GcsSource(std::boxed::Box<crate::model::GcsSources>),
}
}
/// The template used for importing documents.
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportDocumentTemplate {
/// Required. The MIME type of the document.
pub mime_type: std::string::String,
/// Required. The knowledge type of document content.
pub knowledge_types: std::vec::Vec<crate::model::document::KnowledgeType>,
/// Metadata for the document. The metadata supports arbitrary
/// key-value pairs. Suggested use cases include storing a document's title,
/// an external URL distinct from the document's content_uri, etc.
/// The max size of a `key` or a `value` of the metadata is 1024 bytes.
pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl ImportDocumentTemplate {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [mime_type][crate::model::ImportDocumentTemplate::mime_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportDocumentTemplate;
/// let x = ImportDocumentTemplate::new().set_mime_type("example");
/// ```
pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.mime_type = v.into();
self
}
/// Sets the value of [knowledge_types][crate::model::ImportDocumentTemplate::knowledge_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportDocumentTemplate;
/// use google_cloud_dialogflow_v2::model::document::KnowledgeType;
/// let x = ImportDocumentTemplate::new().set_knowledge_types([
/// KnowledgeType::Faq,
/// KnowledgeType::ExtractiveQa,
/// KnowledgeType::ArticleSuggestion,
/// ]);
/// ```
pub fn set_knowledge_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::document::KnowledgeType>,
{
use std::iter::Iterator;
self.knowledge_types = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [metadata][crate::model::ImportDocumentTemplate::metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportDocumentTemplate;
/// let x = ImportDocumentTemplate::new().set_metadata([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
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<std::string::String>,
{
use std::iter::Iterator;
self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for ImportDocumentTemplate {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ImportDocumentTemplate"
}
}
/// Response message for
/// [Documents.ImportDocuments][google.cloud.dialogflow.v2.Documents.ImportDocuments].
///
/// [google.cloud.dialogflow.v2.Documents.ImportDocuments]: crate::client::Documents::import_documents
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportDocumentsResponse {
/// Includes details about skipped documents or any other warnings.
pub warnings: std::vec::Vec<google_cloud_rpc::model::Status>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl ImportDocumentsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [warnings][crate::model::ImportDocumentsResponse::warnings].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ImportDocumentsResponse;
/// use google_cloud_rpc::model::Status;
/// let x = ImportDocumentsResponse::new()
/// .set_warnings([
/// Status::default()/* use setters */,
/// Status::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_warnings<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.warnings = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for ImportDocumentsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ImportDocumentsResponse"
}
}
/// Request message for
/// [Documents.DeleteDocument][google.cloud.dialogflow.v2.Documents.DeleteDocument].
///
/// [google.cloud.dialogflow.v2.Documents.DeleteDocument]: crate::client::Documents::delete_document
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteDocumentRequest {
/// Required. The name of the document to delete.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl DeleteDocumentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteDocumentRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteDocumentRequest;
/// let x = DeleteDocumentRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for DeleteDocumentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteDocumentRequest"
}
}
/// Request message for
/// [Documents.UpdateDocument][google.cloud.dialogflow.v2.Documents.UpdateDocument].
///
/// [google.cloud.dialogflow.v2.Documents.UpdateDocument]: crate::client::Documents::update_document
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateDocumentRequest {
/// Required. The document to update.
pub document: std::option::Option<crate::model::Document>,
/// Optional. Not specified means `update all`.
/// Currently, only `display_name` can be updated, an InvalidArgument will be
/// returned for attempting to update other fields.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl UpdateDocumentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [document][crate::model::UpdateDocumentRequest::document].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateDocumentRequest;
/// use google_cloud_dialogflow_v2::model::Document;
/// let x = UpdateDocumentRequest::new().set_document(Document::default()/* use setters */);
/// ```
pub fn set_document<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Document>,
{
self.document = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [document][crate::model::UpdateDocumentRequest::document].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateDocumentRequest;
/// use google_cloud_dialogflow_v2::model::Document;
/// let x = UpdateDocumentRequest::new().set_or_clear_document(Some(Document::default()/* use setters */));
/// let x = UpdateDocumentRequest::new().set_or_clear_document(None::<Document>);
/// ```
pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Document>,
{
self.document = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateDocumentRequest;
/// use wkt::FieldMask;
/// let x = UpdateDocumentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateDocumentRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateDocumentRequest;
/// use wkt::FieldMask;
/// let x = UpdateDocumentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateDocumentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for UpdateDocumentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateDocumentRequest"
}
}
/// Request message for
/// [Documents.ReloadDocument][google.cloud.dialogflow.v2.Documents.ReloadDocument].
///
/// [google.cloud.dialogflow.v2.Documents.ReloadDocument]: crate::client::Documents::reload_document
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ReloadDocumentRequest {
/// Required. The name of the document to reload.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`
pub name: std::string::String,
/// Optional. Whether to import custom metadata from Google Cloud Storage.
/// Only valid when the document source is Google Cloud Storage URI.
pub import_gcs_custom_metadata: bool,
/// Optional. When enabled, the reload request is to apply partial update to
/// the smart messaging allowlist.
pub smart_messaging_partial_update: bool,
/// The source for document reloading.
///
/// If provided, the service will load the contents from the source
/// and update document in the knowledge base.
///
/// Reloading from a new document source is allowed for smart messaging
/// documents only. If you want to update the source for other document types,
/// please delete the existing document and create a new one instead.
pub source: std::option::Option<crate::model::reload_document_request::Source>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl ReloadDocumentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::ReloadDocumentRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ReloadDocumentRequest;
/// let x = ReloadDocumentRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [import_gcs_custom_metadata][crate::model::ReloadDocumentRequest::import_gcs_custom_metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ReloadDocumentRequest;
/// let x = ReloadDocumentRequest::new().set_import_gcs_custom_metadata(true);
/// ```
pub fn set_import_gcs_custom_metadata<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.import_gcs_custom_metadata = v.into();
self
}
/// Sets the value of [smart_messaging_partial_update][crate::model::ReloadDocumentRequest::smart_messaging_partial_update].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ReloadDocumentRequest;
/// let x = ReloadDocumentRequest::new().set_smart_messaging_partial_update(true);
/// ```
pub fn set_smart_messaging_partial_update<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.smart_messaging_partial_update = v.into();
self
}
/// Sets the value of [source][crate::model::ReloadDocumentRequest::source].
///
/// Note that all the setters affecting `source` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ReloadDocumentRequest;
/// use google_cloud_dialogflow_v2::model::reload_document_request::Source;
/// let x = ReloadDocumentRequest::new().set_source(Some(Source::ContentUri("example".to_string())));
/// ```
pub fn set_source<
T: std::convert::Into<std::option::Option<crate::model::reload_document_request::Source>>,
>(
mut self,
v: T,
) -> Self {
self.source = v.into();
self
}
/// The value of [source][crate::model::ReloadDocumentRequest::source]
/// if it holds a `ContentUri`, `None` if the field is not set or
/// holds a different branch.
pub fn content_uri(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::reload_document_request::Source::ContentUri(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::ReloadDocumentRequest::source]
/// to hold a `ContentUri`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ReloadDocumentRequest;
/// let x = ReloadDocumentRequest::new().set_content_uri("example");
/// assert!(x.content_uri().is_some());
/// ```
pub fn set_content_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source = std::option::Option::Some(
crate::model::reload_document_request::Source::ContentUri(v.into()),
);
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for ReloadDocumentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ReloadDocumentRequest"
}
}
/// Defines additional types related to [ReloadDocumentRequest].
#[cfg(feature = "documents")]
pub mod reload_document_request {
#[allow(unused_imports)]
use super::*;
/// The source for document reloading.
///
/// If provided, the service will load the contents from the source
/// and update document in the knowledge base.
///
/// Reloading from a new document source is allowed for smart messaging
/// documents only. If you want to update the source for other document types,
/// please delete the existing document and create a new one instead.
#[cfg(feature = "documents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Source {
/// Optional. The path of gcs source file for reloading document content. For
/// now, only gcs uri is supported.
///
/// For documents stored in Google Cloud Storage, these URIs must have
/// the form `gs://<bucket-name>/<object-name>`.
ContentUri(std::string::String),
}
}
/// Request message for
/// [Documents.ExportDocument][google.cloud.dialogflow.v2.Documents.ExportDocument].
///
/// [google.cloud.dialogflow.v2.Documents.ExportDocument]: crate::client::Documents::export_document
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportDocumentRequest {
/// Required. The name of the document to export.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
pub name: std::string::String,
/// When enabled, export the full content of the document including empirical
/// probability.
pub export_full_content: bool,
/// When enabled, export the smart messaging allowlist document for partial
/// update.
pub smart_messaging_partial_update: bool,
/// Required. The destination for the export.
pub destination: std::option::Option<crate::model::export_document_request::Destination>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl ExportDocumentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::ExportDocumentRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ExportDocumentRequest;
/// let x = ExportDocumentRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [export_full_content][crate::model::ExportDocumentRequest::export_full_content].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ExportDocumentRequest;
/// let x = ExportDocumentRequest::new().set_export_full_content(true);
/// ```
pub fn set_export_full_content<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.export_full_content = v.into();
self
}
/// Sets the value of [smart_messaging_partial_update][crate::model::ExportDocumentRequest::smart_messaging_partial_update].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ExportDocumentRequest;
/// let x = ExportDocumentRequest::new().set_smart_messaging_partial_update(true);
/// ```
pub fn set_smart_messaging_partial_update<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.smart_messaging_partial_update = v.into();
self
}
/// Sets the value of [destination][crate::model::ExportDocumentRequest::destination].
///
/// Note that all the setters affecting `destination` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ExportDocumentRequest;
/// use google_cloud_dialogflow_v2::model::GcsDestination;
/// let x = ExportDocumentRequest::new().set_destination(Some(
/// google_cloud_dialogflow_v2::model::export_document_request::Destination::GcsDestination(GcsDestination::default().into())));
/// ```
pub fn set_destination<
T: std::convert::Into<std::option::Option<crate::model::export_document_request::Destination>>,
>(
mut self,
v: T,
) -> Self {
self.destination = v.into();
self
}
/// The value of [destination][crate::model::ExportDocumentRequest::destination]
/// if it holds a `GcsDestination`, `None` if the field is not set or
/// holds a different branch.
pub fn gcs_destination(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::GcsDestination>> {
#[allow(unreachable_patterns)]
self.destination.as_ref().and_then(|v| match v {
crate::model::export_document_request::Destination::GcsDestination(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [destination][crate::model::ExportDocumentRequest::destination]
/// to hold a `GcsDestination`.
///
/// Note that all the setters affecting `destination` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ExportDocumentRequest;
/// use google_cloud_dialogflow_v2::model::GcsDestination;
/// let x = ExportDocumentRequest::new().set_gcs_destination(GcsDestination::default()/* use setters */);
/// assert!(x.gcs_destination().is_some());
/// ```
pub fn set_gcs_destination<
T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
>(
mut self,
v: T,
) -> Self {
self.destination = std::option::Option::Some(
crate::model::export_document_request::Destination::GcsDestination(v.into()),
);
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for ExportDocumentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ExportDocumentRequest"
}
}
/// Defines additional types related to [ExportDocumentRequest].
#[cfg(feature = "documents")]
pub mod export_document_request {
#[allow(unused_imports)]
use super::*;
/// Required. The destination for the export.
#[cfg(feature = "documents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Destination {
/// Cloud Storage file path to export the document.
GcsDestination(std::boxed::Box<crate::model::GcsDestination>),
}
}
/// Metadata related to the Export Data Operations (e.g. ExportDocument).
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExportOperationMetadata {
/// Cloud Storage file path of the exported data.
pub exported_gcs_destination: std::option::Option<crate::model::GcsDestination>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl ExportOperationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [exported_gcs_destination][crate::model::ExportOperationMetadata::exported_gcs_destination].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ExportOperationMetadata;
/// use google_cloud_dialogflow_v2::model::GcsDestination;
/// let x = ExportOperationMetadata::new().set_exported_gcs_destination(GcsDestination::default()/* use setters */);
/// ```
pub fn set_exported_gcs_destination<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GcsDestination>,
{
self.exported_gcs_destination = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [exported_gcs_destination][crate::model::ExportOperationMetadata::exported_gcs_destination].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ExportOperationMetadata;
/// use google_cloud_dialogflow_v2::model::GcsDestination;
/// let x = ExportOperationMetadata::new().set_or_clear_exported_gcs_destination(Some(GcsDestination::default()/* use setters */));
/// let x = ExportOperationMetadata::new().set_or_clear_exported_gcs_destination(None::<GcsDestination>);
/// ```
pub fn set_or_clear_exported_gcs_destination<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GcsDestination>,
{
self.exported_gcs_destination = v.map(|x| x.into());
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for ExportOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ExportOperationMetadata"
}
}
/// Metadata in google::longrunning::Operation for Knowledge operations.
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KnowledgeOperationMetadata {
/// Output only. The current state of this operation.
pub state: crate::model::knowledge_operation_metadata::State,
/// The name of the knowledge base interacted with during the operation.
pub knowledge_base: std::string::String,
/// The time when the operation finished.
pub done_time: std::option::Option<wkt::Timestamp>,
/// Additional metadata for the Knowledge operation.
pub operation_metadata:
std::option::Option<crate::model::knowledge_operation_metadata::OperationMetadata>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl KnowledgeOperationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [state][crate::model::KnowledgeOperationMetadata::state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeOperationMetadata;
/// use google_cloud_dialogflow_v2::model::knowledge_operation_metadata::State;
/// let x0 = KnowledgeOperationMetadata::new().set_state(State::Pending);
/// let x1 = KnowledgeOperationMetadata::new().set_state(State::Running);
/// let x2 = KnowledgeOperationMetadata::new().set_state(State::Done);
/// ```
pub fn set_state<T: std::convert::Into<crate::model::knowledge_operation_metadata::State>>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
/// Sets the value of [knowledge_base][crate::model::KnowledgeOperationMetadata::knowledge_base].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeOperationMetadata;
/// let x = KnowledgeOperationMetadata::new().set_knowledge_base("example");
/// ```
pub fn set_knowledge_base<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.knowledge_base = v.into();
self
}
/// Sets the value of [done_time][crate::model::KnowledgeOperationMetadata::done_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeOperationMetadata;
/// use wkt::Timestamp;
/// let x = KnowledgeOperationMetadata::new().set_done_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_done_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.done_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [done_time][crate::model::KnowledgeOperationMetadata::done_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeOperationMetadata;
/// use wkt::Timestamp;
/// let x = KnowledgeOperationMetadata::new().set_or_clear_done_time(Some(Timestamp::default()/* use setters */));
/// let x = KnowledgeOperationMetadata::new().set_or_clear_done_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_done_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.done_time = v.map(|x| x.into());
self
}
/// Sets the value of [operation_metadata][crate::model::KnowledgeOperationMetadata::operation_metadata].
///
/// Note that all the setters affecting `operation_metadata` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeOperationMetadata;
/// use google_cloud_dialogflow_v2::model::ExportOperationMetadata;
/// let x = KnowledgeOperationMetadata::new().set_operation_metadata(Some(
/// google_cloud_dialogflow_v2::model::knowledge_operation_metadata::OperationMetadata::ExportOperationMetadata(ExportOperationMetadata::default().into())));
/// ```
pub fn set_operation_metadata<
T: std::convert::Into<
std::option::Option<crate::model::knowledge_operation_metadata::OperationMetadata>,
>,
>(
mut self,
v: T,
) -> Self {
self.operation_metadata = v.into();
self
}
/// The value of [operation_metadata][crate::model::KnowledgeOperationMetadata::operation_metadata]
/// if it holds a `ExportOperationMetadata`, `None` if the field is not set or
/// holds a different branch.
pub fn export_operation_metadata(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ExportOperationMetadata>> {
#[allow(unreachable_patterns)]
self.operation_metadata.as_ref().and_then(|v| match v {
crate::model::knowledge_operation_metadata::OperationMetadata::ExportOperationMetadata(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [operation_metadata][crate::model::KnowledgeOperationMetadata::operation_metadata]
/// to hold a `ExportOperationMetadata`.
///
/// Note that all the setters affecting `operation_metadata` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeOperationMetadata;
/// use google_cloud_dialogflow_v2::model::ExportOperationMetadata;
/// let x = KnowledgeOperationMetadata::new().set_export_operation_metadata(ExportOperationMetadata::default()/* use setters */);
/// assert!(x.export_operation_metadata().is_some());
/// ```
pub fn set_export_operation_metadata<
T: std::convert::Into<std::boxed::Box<crate::model::ExportOperationMetadata>>,
>(
mut self,
v: T,
) -> Self {
self.operation_metadata = std::option::Option::Some(
crate::model::knowledge_operation_metadata::OperationMetadata::ExportOperationMetadata(
v.into(),
),
);
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for KnowledgeOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.KnowledgeOperationMetadata"
}
}
/// Defines additional types related to [KnowledgeOperationMetadata].
#[cfg(feature = "documents")]
pub mod knowledge_operation_metadata {
#[allow(unused_imports)]
use super::*;
/// States of the operation.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "documents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
/// State unspecified.
Unspecified,
/// The operation has been created.
Pending,
/// The operation is currently running.
Running,
/// The operation is done, either cancelled or completed.
Done,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [State::value] or
/// [State::name].
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "documents")]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "documents")]
impl State {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Pending => std::option::Option::Some(1),
Self::Running => std::option::Option::Some(2),
Self::Done => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Pending => std::option::Option::Some("PENDING"),
Self::Running => std::option::Option::Some("RUNNING"),
Self::Done => std::option::Option::Some("DONE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "documents")]
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "documents")]
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())
}
}
#[cfg(feature = "documents")]
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Pending,
2 => Self::Running,
3 => Self::Done,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "documents")]
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"PENDING" => Self::Pending,
"RUNNING" => Self::Running,
"DONE" => Self::Done,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "documents")]
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::Pending => serializer.serialize_i32(1),
Self::Running => serializer.serialize_i32(2),
Self::Done => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "documents")]
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.dialogflow.v2.KnowledgeOperationMetadata.State",
))
}
}
/// Additional metadata for the Knowledge operation.
#[cfg(feature = "documents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum OperationMetadata {
/// Metadata for the Export Data Operation such as the destination of export.
ExportOperationMetadata(std::boxed::Box<crate::model::ExportOperationMetadata>),
}
}
/// The request to get location-level encryption specification.
#[cfg(feature = "encryption-spec-service")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetEncryptionSpecRequest {
/// Required. The name of the encryption spec resource to get.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "encryption-spec-service")]
impl GetEncryptionSpecRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetEncryptionSpecRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetEncryptionSpecRequest;
/// let x = GetEncryptionSpecRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "encryption-spec-service")]
impl wkt::message::Message for GetEncryptionSpecRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetEncryptionSpecRequest"
}
}
/// A customer-managed encryption key specification that can be applied to all
/// created resources (e.g. Conversation).
#[cfg(feature = "encryption-spec-service")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EncryptionSpec {
/// Immutable. The resource name of the encryption key specification resource.
/// Format:
/// projects/{project}/locations/{location}/encryptionSpec
pub name: std::string::String,
/// Required. The name of customer-managed encryption key that is used to
/// secure a resource and its sub-resources. If empty, the resource is secured
/// by the default Google encryption key. Only the key in the same location as
/// this resource is allowed to be used for encryption. Format:
/// `projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{key}`
pub kms_key: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "encryption-spec-service")]
impl EncryptionSpec {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::EncryptionSpec::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EncryptionSpec;
/// let x = EncryptionSpec::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [kms_key][crate::model::EncryptionSpec::kms_key].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EncryptionSpec;
/// let x = EncryptionSpec::new().set_kms_key("example");
/// ```
pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kms_key = v.into();
self
}
}
#[cfg(feature = "encryption-spec-service")]
impl wkt::message::Message for EncryptionSpec {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.EncryptionSpec"
}
}
/// The request to initialize a location-level encryption specification.
#[cfg(feature = "encryption-spec-service")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InitializeEncryptionSpecRequest {
/// Required. The encryption spec used for CMEK encryption. It is required that
/// the kms key is in the same region as the endpoint. The same key will be
/// used for all provisioned resources, if encryption is available. If the
/// kms_key_name is left empty, no encryption will be enforced.
pub encryption_spec: std::option::Option<crate::model::EncryptionSpec>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "encryption-spec-service")]
impl InitializeEncryptionSpecRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [encryption_spec][crate::model::InitializeEncryptionSpecRequest::encryption_spec].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InitializeEncryptionSpecRequest;
/// use google_cloud_dialogflow_v2::model::EncryptionSpec;
/// let x = InitializeEncryptionSpecRequest::new().set_encryption_spec(EncryptionSpec::default()/* use setters */);
/// ```
pub fn set_encryption_spec<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EncryptionSpec>,
{
self.encryption_spec = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [encryption_spec][crate::model::InitializeEncryptionSpecRequest::encryption_spec].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InitializeEncryptionSpecRequest;
/// use google_cloud_dialogflow_v2::model::EncryptionSpec;
/// let x = InitializeEncryptionSpecRequest::new().set_or_clear_encryption_spec(Some(EncryptionSpec::default()/* use setters */));
/// let x = InitializeEncryptionSpecRequest::new().set_or_clear_encryption_spec(None::<EncryptionSpec>);
/// ```
pub fn set_or_clear_encryption_spec<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EncryptionSpec>,
{
self.encryption_spec = v.map(|x| x.into());
self
}
}
#[cfg(feature = "encryption-spec-service")]
impl wkt::message::Message for InitializeEncryptionSpecRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.InitializeEncryptionSpecRequest"
}
}
/// The response to initialize a location-level encryption specification.
#[cfg(feature = "encryption-spec-service")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InitializeEncryptionSpecResponse {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "encryption-spec-service")]
impl InitializeEncryptionSpecResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
}
#[cfg(feature = "encryption-spec-service")]
impl wkt::message::Message for InitializeEncryptionSpecResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.InitializeEncryptionSpecResponse"
}
}
/// Metadata for initializing a location-level encryption specification.
#[cfg(feature = "encryption-spec-service")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InitializeEncryptionSpecMetadata {
/// Output only. The original request for initialization.
pub request: std::option::Option<crate::model::InitializeEncryptionSpecRequest>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "encryption-spec-service")]
impl InitializeEncryptionSpecMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [request][crate::model::InitializeEncryptionSpecMetadata::request].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InitializeEncryptionSpecMetadata;
/// use google_cloud_dialogflow_v2::model::InitializeEncryptionSpecRequest;
/// let x = InitializeEncryptionSpecMetadata::new().set_request(InitializeEncryptionSpecRequest::default()/* use setters */);
/// ```
pub fn set_request<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::InitializeEncryptionSpecRequest>,
{
self.request = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [request][crate::model::InitializeEncryptionSpecMetadata::request].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InitializeEncryptionSpecMetadata;
/// use google_cloud_dialogflow_v2::model::InitializeEncryptionSpecRequest;
/// let x = InitializeEncryptionSpecMetadata::new().set_or_clear_request(Some(InitializeEncryptionSpecRequest::default()/* use setters */));
/// let x = InitializeEncryptionSpecMetadata::new().set_or_clear_request(None::<InitializeEncryptionSpecRequest>);
/// ```
pub fn set_or_clear_request<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::InitializeEncryptionSpecRequest>,
{
self.request = v.map(|x| x.into());
self
}
}
#[cfg(feature = "encryption-spec-service")]
impl wkt::message::Message for InitializeEncryptionSpecMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.InitializeEncryptionSpecMetadata"
}
}
/// Each intent parameter has a type, called the entity type, which dictates
/// exactly how data from an end-user expression is extracted.
///
/// Dialogflow provides predefined system entities that can match many common
/// types of data. For example, there are system entities for matching dates,
/// times, colors, email addresses, and so on. You can also create your own
/// custom entities for matching custom data. For example, you could define a
/// vegetable entity that can match the types of vegetables available for
/// purchase with a grocery store agent.
///
/// For more information, see the
/// [Entity guide](https://cloud.google.com/dialogflow/docs/entities-overview).
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EntityType {
/// The unique identifier of the entity type.
/// Required for
/// [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType]
/// and
/// [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]
/// methods. Format: `projects/<Project ID>/agent/entityTypes/<Entity Type
/// ID>`.
///
/// [google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]: crate::client::EntityTypes::batch_update_entity_types
/// [google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType]: crate::client::EntityTypes::update_entity_type
pub name: std::string::String,
/// Required. The name of the entity type.
pub display_name: std::string::String,
/// Required. Indicates the kind of entity type.
pub kind: crate::model::entity_type::Kind,
/// Optional. Indicates whether the entity type can be automatically
/// expanded.
pub auto_expansion_mode: crate::model::entity_type::AutoExpansionMode,
/// Optional. The collection of entity entries associated with the entity type.
pub entities: std::vec::Vec<crate::model::entity_type::Entity>,
/// Optional. Enables fuzzy entity extraction during classification.
pub enable_fuzzy_extraction: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl EntityType {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::EntityType::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EntityType;
/// let x = EntityType::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [display_name][crate::model::EntityType::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EntityType;
/// let x = EntityType::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [kind][crate::model::EntityType::kind].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EntityType;
/// use google_cloud_dialogflow_v2::model::entity_type::Kind;
/// let x0 = EntityType::new().set_kind(Kind::Map);
/// let x1 = EntityType::new().set_kind(Kind::List);
/// let x2 = EntityType::new().set_kind(Kind::Regexp);
/// ```
pub fn set_kind<T: std::convert::Into<crate::model::entity_type::Kind>>(
mut self,
v: T,
) -> Self {
self.kind = v.into();
self
}
/// Sets the value of [auto_expansion_mode][crate::model::EntityType::auto_expansion_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EntityType;
/// use google_cloud_dialogflow_v2::model::entity_type::AutoExpansionMode;
/// let x0 = EntityType::new().set_auto_expansion_mode(AutoExpansionMode::Default);
/// ```
pub fn set_auto_expansion_mode<
T: std::convert::Into<crate::model::entity_type::AutoExpansionMode>,
>(
mut self,
v: T,
) -> Self {
self.auto_expansion_mode = v.into();
self
}
/// Sets the value of [entities][crate::model::EntityType::entities].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EntityType;
/// use google_cloud_dialogflow_v2::model::entity_type::Entity;
/// let x = EntityType::new()
/// .set_entities([
/// Entity::default()/* use setters */,
/// Entity::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_entities<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::entity_type::Entity>,
{
use std::iter::Iterator;
self.entities = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [enable_fuzzy_extraction][crate::model::EntityType::enable_fuzzy_extraction].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EntityType;
/// let x = EntityType::new().set_enable_fuzzy_extraction(true);
/// ```
pub fn set_enable_fuzzy_extraction<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_fuzzy_extraction = v.into();
self
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl wkt::message::Message for EntityType {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.EntityType"
}
}
/// Defines additional types related to [EntityType].
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
pub mod entity_type {
#[allow(unused_imports)]
use super::*;
/// An **entity entry** for an associated entity type.
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Entity {
/// Required. The primary value associated with this entity entry.
/// For example, if the entity type is *vegetable*, the value could be
/// *scallions*.
///
/// For `KIND_MAP` entity types:
///
/// * A reference value to be used in place of synonyms.
///
/// For `KIND_LIST` entity types:
///
/// * A string that can contain references to other entity types (with or
/// without aliases).
pub value: std::string::String,
/// Required. A collection of value synonyms. For example, if the entity type
/// is *vegetable*, and `value` is *scallions*, a synonym could be *green
/// onions*.
///
/// For `KIND_LIST` entity types:
///
/// * This collection must contain exactly one synonym equal to `value`.
pub synonyms: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl Entity {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [value][crate::model::entity_type::Entity::value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::entity_type::Entity;
/// let x = Entity::new().set_value("example");
/// ```
pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value = v.into();
self
}
/// Sets the value of [synonyms][crate::model::entity_type::Entity::synonyms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::entity_type::Entity;
/// let x = Entity::new().set_synonyms(["a", "b", "c"]);
/// ```
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
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl wkt::message::Message for Entity {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.EntityType.Entity"
}
}
/// Represents kinds of entities.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Kind {
/// Not specified. This value should be never used.
Unspecified,
/// Map entity types allow mapping of a group of synonyms to a reference
/// value.
Map,
/// List entity types contain a set of entries that do not map to reference
/// values. However, list entity types can contain references to other entity
/// types (with or without aliases).
List,
/// Regexp entity types allow to specify regular expressions in entries
/// values.
Regexp,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Kind::value] or
/// [Kind::name].
UnknownValue(kind::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
pub mod kind {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl Kind {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Map => std::option::Option::Some(1),
Self::List => std::option::Option::Some(2),
Self::Regexp => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("KIND_UNSPECIFIED"),
Self::Map => std::option::Option::Some("KIND_MAP"),
Self::List => std::option::Option::Some("KIND_LIST"),
Self::Regexp => std::option::Option::Some("KIND_REGEXP"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl std::default::Default for Kind {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl std::fmt::Display for Kind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl std::convert::From<i32> for Kind {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Map,
2 => Self::List,
3 => Self::Regexp,
_ => Self::UnknownValue(kind::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl std::convert::From<&str> for Kind {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"KIND_UNSPECIFIED" => Self::Unspecified,
"KIND_MAP" => Self::Map,
"KIND_LIST" => Self::List,
"KIND_REGEXP" => Self::Regexp,
_ => Self::UnknownValue(kind::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl serde::ser::Serialize for Kind {
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::Map => serializer.serialize_i32(1),
Self::List => serializer.serialize_i32(2),
Self::Regexp => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for Kind {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Kind>::new(
".google.cloud.dialogflow.v2.EntityType.Kind",
))
}
}
/// Represents different entity type expansion modes. Automated expansion
/// allows an agent to recognize values that have not been explicitly listed in
/// the entity (for example, new kinds of shopping list items).
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AutoExpansionMode {
/// Auto expansion disabled for the entity.
Unspecified,
/// Allows an agent to recognize values that have not been explicitly
/// listed in the entity.
Default,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [AutoExpansionMode::value] or
/// [AutoExpansionMode::name].
UnknownValue(auto_expansion_mode::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
pub mod auto_expansion_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl AutoExpansionMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Default => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("AUTO_EXPANSION_MODE_UNSPECIFIED"),
Self::Default => std::option::Option::Some("AUTO_EXPANSION_MODE_DEFAULT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl std::default::Default for AutoExpansionMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl std::fmt::Display for AutoExpansionMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl std::convert::From<i32> for AutoExpansionMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Default,
_ => Self::UnknownValue(auto_expansion_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl std::convert::From<&str> for AutoExpansionMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"AUTO_EXPANSION_MODE_UNSPECIFIED" => Self::Unspecified,
"AUTO_EXPANSION_MODE_DEFAULT" => Self::Default,
_ => Self::UnknownValue(auto_expansion_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl serde::ser::Serialize for AutoExpansionMode {
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::Default => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "entity-types",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for AutoExpansionMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AutoExpansionMode>::new(
".google.cloud.dialogflow.v2.EntityType.AutoExpansionMode",
))
}
}
}
/// The request message for
/// [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes].
///
/// [google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]: crate::client::EntityTypes::list_entity_types
#[cfg(feature = "entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListEntityTypesRequest {
/// Required. The agent to list all entity types from.
/// Format: `projects/<Project ID>/agent`.
pub parent: std::string::String,
/// Optional. The language used to access language-specific data.
/// If not specified, the agent's default language is used.
/// For more information, see
/// [Multilingual intent and entity
/// data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
pub language_code: std::string::String,
/// Optional. The maximum number of items to return in a single page. By
/// default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "entity-types")]
impl ListEntityTypesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListEntityTypesRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListEntityTypesRequest;
/// let x = ListEntityTypesRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [language_code][crate::model::ListEntityTypesRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListEntityTypesRequest;
/// let x = ListEntityTypesRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListEntityTypesRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListEntityTypesRequest;
/// let x = ListEntityTypesRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListEntityTypesRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListEntityTypesRequest;
/// let x = ListEntityTypesRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "entity-types")]
impl wkt::message::Message for ListEntityTypesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListEntityTypesRequest"
}
}
/// The response message for
/// [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes].
///
/// [google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]: crate::client::EntityTypes::list_entity_types
#[cfg(feature = "entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListEntityTypesResponse {
/// The list of agent entity types. There will be a maximum number of items
/// returned based on the page_size field in the request.
pub entity_types: std::vec::Vec<crate::model::EntityType>,
/// Token to retrieve the next page of results, or empty if there are no
/// more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "entity-types")]
impl ListEntityTypesResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [entity_types][crate::model::ListEntityTypesResponse::entity_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListEntityTypesResponse;
/// use google_cloud_dialogflow_v2::model::EntityType;
/// let x = ListEntityTypesResponse::new()
/// .set_entity_types([
/// EntityType::default()/* use setters */,
/// EntityType::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_entity_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::EntityType>,
{
use std::iter::Iterator;
self.entity_types = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListEntityTypesResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListEntityTypesResponse;
/// let x = ListEntityTypesResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "entity-types")]
impl wkt::message::Message for ListEntityTypesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListEntityTypesResponse"
}
}
#[cfg(feature = "entity-types")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListEntityTypesResponse {
type PageItem = crate::model::EntityType;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.entity_types
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [EntityTypes.GetEntityType][google.cloud.dialogflow.v2.EntityTypes.GetEntityType].
///
/// [google.cloud.dialogflow.v2.EntityTypes.GetEntityType]: crate::client::EntityTypes::get_entity_type
#[cfg(feature = "entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetEntityTypeRequest {
/// Required. The name of the entity type.
/// Format: `projects/<Project ID>/agent/entityTypes/<EntityType ID>`.
pub name: std::string::String,
/// Optional. The language used to access language-specific data.
/// If not specified, the agent's default language is used.
/// For more information, see
/// [Multilingual intent and entity
/// data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "entity-types")]
impl GetEntityTypeRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetEntityTypeRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetEntityTypeRequest;
/// let x = GetEntityTypeRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [language_code][crate::model::GetEntityTypeRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetEntityTypeRequest;
/// let x = GetEntityTypeRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
#[cfg(feature = "entity-types")]
impl wkt::message::Message for GetEntityTypeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetEntityTypeRequest"
}
}
/// The request message for
/// [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2.EntityTypes.CreateEntityType].
///
/// [google.cloud.dialogflow.v2.EntityTypes.CreateEntityType]: crate::client::EntityTypes::create_entity_type
#[cfg(feature = "entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateEntityTypeRequest {
/// Required. The agent to create a entity type for.
/// Format: `projects/<Project ID>/agent`.
pub parent: std::string::String,
/// Required. The entity type to create.
pub entity_type: std::option::Option<crate::model::EntityType>,
/// Optional. The language used to access language-specific data.
/// If not specified, the agent's default language is used.
/// For more information, see
/// [Multilingual intent and entity
/// data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "entity-types")]
impl CreateEntityTypeRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateEntityTypeRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateEntityTypeRequest;
/// let x = CreateEntityTypeRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [entity_type][crate::model::CreateEntityTypeRequest::entity_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateEntityTypeRequest;
/// use google_cloud_dialogflow_v2::model::EntityType;
/// let x = CreateEntityTypeRequest::new().set_entity_type(EntityType::default()/* use setters */);
/// ```
pub fn set_entity_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EntityType>,
{
self.entity_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [entity_type][crate::model::CreateEntityTypeRequest::entity_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateEntityTypeRequest;
/// use google_cloud_dialogflow_v2::model::EntityType;
/// let x = CreateEntityTypeRequest::new().set_or_clear_entity_type(Some(EntityType::default()/* use setters */));
/// let x = CreateEntityTypeRequest::new().set_or_clear_entity_type(None::<EntityType>);
/// ```
pub fn set_or_clear_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EntityType>,
{
self.entity_type = v.map(|x| x.into());
self
}
/// Sets the value of [language_code][crate::model::CreateEntityTypeRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateEntityTypeRequest;
/// let x = CreateEntityTypeRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
#[cfg(feature = "entity-types")]
impl wkt::message::Message for CreateEntityTypeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateEntityTypeRequest"
}
}
/// The request message for
/// [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType].
///
/// [google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType]: crate::client::EntityTypes::update_entity_type
#[cfg(feature = "entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateEntityTypeRequest {
/// Required. The entity type to update.
pub entity_type: std::option::Option<crate::model::EntityType>,
/// Optional. The language used to access language-specific data.
/// If not specified, the agent's default language is used.
/// For more information, see
/// [Multilingual intent and entity
/// data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
pub language_code: std::string::String,
/// Optional. The mask to control which fields get updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "entity-types")]
impl UpdateEntityTypeRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [entity_type][crate::model::UpdateEntityTypeRequest::entity_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateEntityTypeRequest;
/// use google_cloud_dialogflow_v2::model::EntityType;
/// let x = UpdateEntityTypeRequest::new().set_entity_type(EntityType::default()/* use setters */);
/// ```
pub fn set_entity_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EntityType>,
{
self.entity_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [entity_type][crate::model::UpdateEntityTypeRequest::entity_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateEntityTypeRequest;
/// use google_cloud_dialogflow_v2::model::EntityType;
/// let x = UpdateEntityTypeRequest::new().set_or_clear_entity_type(Some(EntityType::default()/* use setters */));
/// let x = UpdateEntityTypeRequest::new().set_or_clear_entity_type(None::<EntityType>);
/// ```
pub fn set_or_clear_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EntityType>,
{
self.entity_type = v.map(|x| x.into());
self
}
/// Sets the value of [language_code][crate::model::UpdateEntityTypeRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateEntityTypeRequest;
/// let x = UpdateEntityTypeRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [update_mask][crate::model::UpdateEntityTypeRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateEntityTypeRequest;
/// use wkt::FieldMask;
/// let x = UpdateEntityTypeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateEntityTypeRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateEntityTypeRequest;
/// use wkt::FieldMask;
/// let x = UpdateEntityTypeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateEntityTypeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "entity-types")]
impl wkt::message::Message for UpdateEntityTypeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateEntityTypeRequest"
}
}
/// The request message for
/// [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType].
///
/// [google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType]: crate::client::EntityTypes::delete_entity_type
#[cfg(feature = "entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteEntityTypeRequest {
/// Required. The name of the entity type to delete.
/// Format: `projects/<Project ID>/agent/entityTypes/<EntityType ID>`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "entity-types")]
impl DeleteEntityTypeRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteEntityTypeRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteEntityTypeRequest;
/// let x = DeleteEntityTypeRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "entity-types")]
impl wkt::message::Message for DeleteEntityTypeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteEntityTypeRequest"
}
}
/// The request message for
/// [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes].
///
/// [google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]: crate::client::EntityTypes::batch_update_entity_types
#[cfg(feature = "entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchUpdateEntityTypesRequest {
/// Required. The name of the agent to update or create entity types in.
/// Format: `projects/<Project ID>/agent`.
pub parent: std::string::String,
/// Optional. The language used to access language-specific data.
/// If not specified, the agent's default language is used.
/// For more information, see
/// [Multilingual intent and entity
/// data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
pub language_code: std::string::String,
/// Optional. The mask to control which fields get updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
/// The source of the entity type batch.
///
/// For each entity type in the batch:
///
/// * If `name` is specified, we update an existing entity type.
/// * If `name` is not specified, we create a new entity type.
pub entity_type_batch:
std::option::Option<crate::model::batch_update_entity_types_request::EntityTypeBatch>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "entity-types")]
impl BatchUpdateEntityTypesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::BatchUpdateEntityTypesRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateEntityTypesRequest;
/// let x = BatchUpdateEntityTypesRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [language_code][crate::model::BatchUpdateEntityTypesRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateEntityTypesRequest;
/// let x = BatchUpdateEntityTypesRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [update_mask][crate::model::BatchUpdateEntityTypesRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateEntityTypesRequest;
/// use wkt::FieldMask;
/// let x = BatchUpdateEntityTypesRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::BatchUpdateEntityTypesRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateEntityTypesRequest;
/// use wkt::FieldMask;
/// let x = BatchUpdateEntityTypesRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = BatchUpdateEntityTypesRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
/// Sets the value of [entity_type_batch][crate::model::BatchUpdateEntityTypesRequest::entity_type_batch].
///
/// Note that all the setters affecting `entity_type_batch` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateEntityTypesRequest;
/// use google_cloud_dialogflow_v2::model::batch_update_entity_types_request::EntityTypeBatch;
/// let x = BatchUpdateEntityTypesRequest::new().set_entity_type_batch(Some(EntityTypeBatch::EntityTypeBatchUri("example".to_string())));
/// ```
pub fn set_entity_type_batch<
T: std::convert::Into<
std::option::Option<
crate::model::batch_update_entity_types_request::EntityTypeBatch,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.entity_type_batch = v.into();
self
}
/// The value of [entity_type_batch][crate::model::BatchUpdateEntityTypesRequest::entity_type_batch]
/// if it holds a `EntityTypeBatchUri`, `None` if the field is not set or
/// holds a different branch.
pub fn entity_type_batch_uri(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.entity_type_batch.as_ref().and_then(|v| match v {
crate::model::batch_update_entity_types_request::EntityTypeBatch::EntityTypeBatchUri(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [entity_type_batch][crate::model::BatchUpdateEntityTypesRequest::entity_type_batch]
/// to hold a `EntityTypeBatchUri`.
///
/// Note that all the setters affecting `entity_type_batch` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateEntityTypesRequest;
/// let x = BatchUpdateEntityTypesRequest::new().set_entity_type_batch_uri("example");
/// assert!(x.entity_type_batch_uri().is_some());
/// assert!(x.entity_type_batch_inline().is_none());
/// ```
pub fn set_entity_type_batch_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.entity_type_batch = std::option::Option::Some(
crate::model::batch_update_entity_types_request::EntityTypeBatch::EntityTypeBatchUri(
v.into(),
),
);
self
}
/// The value of [entity_type_batch][crate::model::BatchUpdateEntityTypesRequest::entity_type_batch]
/// if it holds a `EntityTypeBatchInline`, `None` if the field is not set or
/// holds a different branch.
pub fn entity_type_batch_inline(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::EntityTypeBatch>> {
#[allow(unreachable_patterns)]
self.entity_type_batch.as_ref().and_then(|v| match v {
crate::model::batch_update_entity_types_request::EntityTypeBatch::EntityTypeBatchInline(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [entity_type_batch][crate::model::BatchUpdateEntityTypesRequest::entity_type_batch]
/// to hold a `EntityTypeBatchInline`.
///
/// Note that all the setters affecting `entity_type_batch` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateEntityTypesRequest;
/// use google_cloud_dialogflow_v2::model::EntityTypeBatch;
/// let x = BatchUpdateEntityTypesRequest::new().set_entity_type_batch_inline(EntityTypeBatch::default()/* use setters */);
/// assert!(x.entity_type_batch_inline().is_some());
/// assert!(x.entity_type_batch_uri().is_none());
/// ```
pub fn set_entity_type_batch_inline<
T: std::convert::Into<std::boxed::Box<crate::model::EntityTypeBatch>>,
>(
mut self,
v: T,
) -> Self {
self.entity_type_batch = std::option::Option::Some(
crate::model::batch_update_entity_types_request::EntityTypeBatch::EntityTypeBatchInline(
v.into(),
),
);
self
}
}
#[cfg(feature = "entity-types")]
impl wkt::message::Message for BatchUpdateEntityTypesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest"
}
}
/// Defines additional types related to [BatchUpdateEntityTypesRequest].
#[cfg(feature = "entity-types")]
pub mod batch_update_entity_types_request {
#[allow(unused_imports)]
use super::*;
/// The source of the entity type batch.
///
/// For each entity type in the batch:
///
/// * If `name` is specified, we update an existing entity type.
/// * If `name` is not specified, we create a new entity type.
#[cfg(feature = "entity-types")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EntityTypeBatch {
/// The URI to a Google Cloud Storage file containing entity types to update
/// or create. The file format can either be a serialized proto (of
/// EntityBatch type) or a JSON object. Note: The URI must start with
/// "gs://".
EntityTypeBatchUri(std::string::String),
/// The collection of entity types to update or create.
EntityTypeBatchInline(std::boxed::Box<crate::model::EntityTypeBatch>),
}
}
/// The response message for
/// [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes].
///
/// [google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]: crate::client::EntityTypes::batch_update_entity_types
#[cfg(feature = "entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchUpdateEntityTypesResponse {
/// The collection of updated or created entity types.
pub entity_types: std::vec::Vec<crate::model::EntityType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "entity-types")]
impl BatchUpdateEntityTypesResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [entity_types][crate::model::BatchUpdateEntityTypesResponse::entity_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateEntityTypesResponse;
/// use google_cloud_dialogflow_v2::model::EntityType;
/// let x = BatchUpdateEntityTypesResponse::new()
/// .set_entity_types([
/// EntityType::default()/* use setters */,
/// EntityType::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_entity_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::EntityType>,
{
use std::iter::Iterator;
self.entity_types = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "entity-types")]
impl wkt::message::Message for BatchUpdateEntityTypesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse"
}
}
/// The request message for
/// [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes].
///
/// [google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes]: crate::client::EntityTypes::batch_delete_entity_types
#[cfg(feature = "entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchDeleteEntityTypesRequest {
/// Required. The name of the agent to delete all entities types for. Format:
/// `projects/<Project ID>/agent`.
pub parent: std::string::String,
/// Required. The names entity types to delete. All names must point to the
/// same agent as `parent`.
pub entity_type_names: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "entity-types")]
impl BatchDeleteEntityTypesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::BatchDeleteEntityTypesRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchDeleteEntityTypesRequest;
/// let x = BatchDeleteEntityTypesRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [entity_type_names][crate::model::BatchDeleteEntityTypesRequest::entity_type_names].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchDeleteEntityTypesRequest;
/// let x = BatchDeleteEntityTypesRequest::new().set_entity_type_names(["a", "b", "c"]);
/// ```
pub fn set_entity_type_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.entity_type_names = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "entity-types")]
impl wkt::message::Message for BatchDeleteEntityTypesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest"
}
}
/// The request message for
/// [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities].
///
/// [google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities]: crate::client::EntityTypes::batch_create_entities
#[cfg(feature = "entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchCreateEntitiesRequest {
/// Required. The name of the entity type to create entities in. Format:
/// `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
pub parent: std::string::String,
/// Required. The entities to create.
pub entities: std::vec::Vec<crate::model::entity_type::Entity>,
/// Optional. The language used to access language-specific data.
/// If not specified, the agent's default language is used.
/// For more information, see
/// [Multilingual intent and entity
/// data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "entity-types")]
impl BatchCreateEntitiesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::BatchCreateEntitiesRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchCreateEntitiesRequest;
/// let x = BatchCreateEntitiesRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [entities][crate::model::BatchCreateEntitiesRequest::entities].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchCreateEntitiesRequest;
/// use google_cloud_dialogflow_v2::model::entity_type::Entity;
/// let x = BatchCreateEntitiesRequest::new()
/// .set_entities([
/// Entity::default()/* use setters */,
/// Entity::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_entities<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::entity_type::Entity>,
{
use std::iter::Iterator;
self.entities = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [language_code][crate::model::BatchCreateEntitiesRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchCreateEntitiesRequest;
/// let x = BatchCreateEntitiesRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
#[cfg(feature = "entity-types")]
impl wkt::message::Message for BatchCreateEntitiesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.BatchCreateEntitiesRequest"
}
}
/// The request message for
/// [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities].
///
/// [google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities]: crate::client::EntityTypes::batch_update_entities
#[cfg(feature = "entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchUpdateEntitiesRequest {
/// Required. The name of the entity type to update or create entities in.
/// Format: `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
pub parent: std::string::String,
/// Required. The entities to update or create.
pub entities: std::vec::Vec<crate::model::entity_type::Entity>,
/// Optional. The language used to access language-specific data.
/// If not specified, the agent's default language is used.
/// For more information, see
/// [Multilingual intent and entity
/// data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
pub language_code: std::string::String,
/// Optional. The mask to control which fields get updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "entity-types")]
impl BatchUpdateEntitiesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::BatchUpdateEntitiesRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateEntitiesRequest;
/// let x = BatchUpdateEntitiesRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [entities][crate::model::BatchUpdateEntitiesRequest::entities].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateEntitiesRequest;
/// use google_cloud_dialogflow_v2::model::entity_type::Entity;
/// let x = BatchUpdateEntitiesRequest::new()
/// .set_entities([
/// Entity::default()/* use setters */,
/// Entity::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_entities<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::entity_type::Entity>,
{
use std::iter::Iterator;
self.entities = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [language_code][crate::model::BatchUpdateEntitiesRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateEntitiesRequest;
/// let x = BatchUpdateEntitiesRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [update_mask][crate::model::BatchUpdateEntitiesRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateEntitiesRequest;
/// use wkt::FieldMask;
/// let x = BatchUpdateEntitiesRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::BatchUpdateEntitiesRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateEntitiesRequest;
/// use wkt::FieldMask;
/// let x = BatchUpdateEntitiesRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = BatchUpdateEntitiesRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "entity-types")]
impl wkt::message::Message for BatchUpdateEntitiesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest"
}
}
/// The request message for
/// [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities].
///
/// [google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities]: crate::client::EntityTypes::batch_delete_entities
#[cfg(feature = "entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchDeleteEntitiesRequest {
/// Required. The name of the entity type to delete entries for. Format:
/// `projects/<Project ID>/agent/entityTypes/<Entity Type ID>`.
pub parent: std::string::String,
/// Required. The reference `values` of the entities to delete. Note that
/// these are not fully-qualified names, i.e. they don't start with
/// `projects/<Project ID>`.
pub entity_values: std::vec::Vec<std::string::String>,
/// Optional. The language used to access language-specific data.
/// If not specified, the agent's default language is used.
/// For more information, see
/// [Multilingual intent and entity
/// data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "entity-types")]
impl BatchDeleteEntitiesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::BatchDeleteEntitiesRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchDeleteEntitiesRequest;
/// let x = BatchDeleteEntitiesRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [entity_values][crate::model::BatchDeleteEntitiesRequest::entity_values].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchDeleteEntitiesRequest;
/// let x = BatchDeleteEntitiesRequest::new().set_entity_values(["a", "b", "c"]);
/// ```
pub fn set_entity_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.entity_values = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [language_code][crate::model::BatchDeleteEntitiesRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchDeleteEntitiesRequest;
/// let x = BatchDeleteEntitiesRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
#[cfg(feature = "entity-types")]
impl wkt::message::Message for BatchDeleteEntitiesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest"
}
}
/// This message is a wrapper around a collection of entity types.
#[cfg(feature = "entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EntityTypeBatch {
/// A collection of entity types.
pub entity_types: std::vec::Vec<crate::model::EntityType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "entity-types")]
impl EntityTypeBatch {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [entity_types][crate::model::EntityTypeBatch::entity_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EntityTypeBatch;
/// use google_cloud_dialogflow_v2::model::EntityType;
/// let x = EntityTypeBatch::new()
/// .set_entity_types([
/// EntityType::default()/* use setters */,
/// EntityType::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_entity_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::EntityType>,
{
use std::iter::Iterator;
self.entity_types = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "entity-types")]
impl wkt::message::Message for EntityTypeBatch {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.EntityTypeBatch"
}
}
/// You can create multiple versions of your agent and publish them to separate
/// environments.
///
/// When you edit an agent, you are editing the draft agent. At any point, you
/// can save the draft agent as an agent version, which is an immutable snapshot
/// of your agent.
///
/// When you save the draft agent, it is published to the default environment.
/// When you create agent versions, you can publish them to custom environments.
/// You can create a variety of custom environments for:
///
/// - testing
/// - development
/// - production
/// - etc.
///
/// For more information, see the [versions and environments
/// guide](https://cloud.google.com/dialogflow/docs/agents-versions).
#[cfg(feature = "environments")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Environment {
/// Output only. The unique identifier of this agent environment.
/// Supported formats:
///
/// - `projects/<Project ID>/agent/environments/<Environment ID>`
/// - `projects/<Project ID>/locations/<Location
/// ID>/agent/environments/<Environment ID>`
///
/// The environment ID for the default environment is `-`.
pub name: std::string::String,
/// Optional. The developer-provided description for this environment.
/// The maximum length is 500 characters. If exceeded, the request is rejected.
pub description: std::string::String,
/// Optional. The agent version loaded into this environment.
/// Supported formats:
///
/// - `projects/<Project ID>/agent/versions/<Version ID>`
/// - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version
/// ID>`
pub agent_version: std::string::String,
/// Output only. The state of this environment. This field is read-only, i.e.,
/// it cannot be set by create and update methods.
pub state: crate::model::environment::State,
/// Output only. The last update time of this environment. This field is
/// read-only, i.e., it cannot be set by create and update methods.
pub update_time: std::option::Option<wkt::Timestamp>,
/// Optional. Text to speech settings for this environment.
pub text_to_speech_settings: std::option::Option<crate::model::TextToSpeechSettings>,
/// Optional. The fulfillment settings to use for this environment.
pub fulfillment: std::option::Option<crate::model::Fulfillment>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "environments")]
impl Environment {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::Environment::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Environment;
/// let x = Environment::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [description][crate::model::Environment::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Environment;
/// let x = Environment::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
/// Sets the value of [agent_version][crate::model::Environment::agent_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Environment;
/// let x = Environment::new().set_agent_version("example");
/// ```
pub fn set_agent_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.agent_version = v.into();
self
}
/// Sets the value of [state][crate::model::Environment::state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Environment;
/// use google_cloud_dialogflow_v2::model::environment::State;
/// let x0 = Environment::new().set_state(State::Stopped);
/// let x1 = Environment::new().set_state(State::Loading);
/// let x2 = Environment::new().set_state(State::Running);
/// ```
pub fn set_state<T: std::convert::Into<crate::model::environment::State>>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
/// Sets the value of [update_time][crate::model::Environment::update_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Environment;
/// use wkt::Timestamp;
/// let x = Environment::new().set_update_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_time][crate::model::Environment::update_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Environment;
/// use wkt::Timestamp;
/// let x = Environment::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
/// let x = Environment::new().set_or_clear_update_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [text_to_speech_settings][crate::model::Environment::text_to_speech_settings].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Environment;
/// use google_cloud_dialogflow_v2::model::TextToSpeechSettings;
/// let x = Environment::new().set_text_to_speech_settings(TextToSpeechSettings::default()/* use setters */);
/// ```
pub fn set_text_to_speech_settings<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TextToSpeechSettings>,
{
self.text_to_speech_settings = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [text_to_speech_settings][crate::model::Environment::text_to_speech_settings].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Environment;
/// use google_cloud_dialogflow_v2::model::TextToSpeechSettings;
/// let x = Environment::new().set_or_clear_text_to_speech_settings(Some(TextToSpeechSettings::default()/* use setters */));
/// let x = Environment::new().set_or_clear_text_to_speech_settings(None::<TextToSpeechSettings>);
/// ```
pub fn set_or_clear_text_to_speech_settings<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TextToSpeechSettings>,
{
self.text_to_speech_settings = v.map(|x| x.into());
self
}
/// Sets the value of [fulfillment][crate::model::Environment::fulfillment].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Environment;
/// use google_cloud_dialogflow_v2::model::Fulfillment;
/// let x = Environment::new().set_fulfillment(Fulfillment::default()/* use setters */);
/// ```
pub fn set_fulfillment<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Fulfillment>,
{
self.fulfillment = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [fulfillment][crate::model::Environment::fulfillment].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Environment;
/// use google_cloud_dialogflow_v2::model::Fulfillment;
/// let x = Environment::new().set_or_clear_fulfillment(Some(Fulfillment::default()/* use setters */));
/// let x = Environment::new().set_or_clear_fulfillment(None::<Fulfillment>);
/// ```
pub fn set_or_clear_fulfillment<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Fulfillment>,
{
self.fulfillment = v.map(|x| x.into());
self
}
}
#[cfg(feature = "environments")]
impl wkt::message::Message for Environment {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Environment"
}
}
/// Defines additional types related to [Environment].
#[cfg(feature = "environments")]
pub mod environment {
#[allow(unused_imports)]
use super::*;
/// Represents an environment state. When an environment is pointed to a new
/// agent version, the environment is temporarily set to the `LOADING` state.
/// During that time, the environment keeps on serving the previous version of
/// the agent. After the new agent version is done loading, the environment is
/// set back to the `RUNNING` state.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "environments")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
/// Not specified. This value is not used.
Unspecified,
/// Stopped.
Stopped,
/// Loading.
Loading,
/// Running.
Running,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [State::value] or
/// [State::name].
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "environments")]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "environments")]
impl State {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Stopped => std::option::Option::Some(1),
Self::Loading => std::option::Option::Some(2),
Self::Running => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Stopped => std::option::Option::Some("STOPPED"),
Self::Loading => std::option::Option::Some("LOADING"),
Self::Running => std::option::Option::Some("RUNNING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "environments")]
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "environments")]
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())
}
}
#[cfg(feature = "environments")]
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Stopped,
2 => Self::Loading,
3 => Self::Running,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "environments")]
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"STOPPED" => Self::Stopped,
"LOADING" => Self::Loading,
"RUNNING" => Self::Running,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "environments")]
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::Stopped => serializer.serialize_i32(1),
Self::Loading => serializer.serialize_i32(2),
Self::Running => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "environments")]
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.dialogflow.v2.Environment.State",
))
}
}
}
/// Instructs the speech synthesizer on how to generate the output audio content.
#[cfg(feature = "environments")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TextToSpeechSettings {
/// Optional. Indicates whether text to speech is enabled. Even when this field
/// is false, other settings in this proto are still retained.
pub enable_text_to_speech: bool,
/// Required. Audio encoding of the synthesized audio content.
pub output_audio_encoding: crate::model::OutputAudioEncoding,
/// Optional. The synthesis sample rate (in hertz) for this audio. If not
/// provided, then the synthesizer will use the default sample rate based on
/// the audio encoding. If this is different from the voice's natural sample
/// rate, then the synthesizer will honor this request by converting to the
/// desired sample rate (which might result in worse audio quality).
pub sample_rate_hertz: i32,
/// Optional. Configuration of how speech should be synthesized, mapping from
/// language (<https://cloud.google.com/dialogflow/docs/reference/language>) to
/// SynthesizeSpeechConfig.
pub synthesize_speech_configs:
std::collections::HashMap<std::string::String, crate::model::SynthesizeSpeechConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "environments")]
impl TextToSpeechSettings {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [enable_text_to_speech][crate::model::TextToSpeechSettings::enable_text_to_speech].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::TextToSpeechSettings;
/// let x = TextToSpeechSettings::new().set_enable_text_to_speech(true);
/// ```
pub fn set_enable_text_to_speech<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_text_to_speech = v.into();
self
}
/// Sets the value of [output_audio_encoding][crate::model::TextToSpeechSettings::output_audio_encoding].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::TextToSpeechSettings;
/// use google_cloud_dialogflow_v2::model::OutputAudioEncoding;
/// let x0 = TextToSpeechSettings::new().set_output_audio_encoding(OutputAudioEncoding::Linear16);
/// let x1 = TextToSpeechSettings::new().set_output_audio_encoding(OutputAudioEncoding::Mp3);
/// let x2 = TextToSpeechSettings::new().set_output_audio_encoding(OutputAudioEncoding::Mp364Kbps);
/// ```
pub fn set_output_audio_encoding<T: std::convert::Into<crate::model::OutputAudioEncoding>>(
mut self,
v: T,
) -> Self {
self.output_audio_encoding = v.into();
self
}
/// Sets the value of [sample_rate_hertz][crate::model::TextToSpeechSettings::sample_rate_hertz].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::TextToSpeechSettings;
/// let x = TextToSpeechSettings::new().set_sample_rate_hertz(42);
/// ```
pub fn set_sample_rate_hertz<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.sample_rate_hertz = v.into();
self
}
/// Sets the value of [synthesize_speech_configs][crate::model::TextToSpeechSettings::synthesize_speech_configs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::TextToSpeechSettings;
/// use google_cloud_dialogflow_v2::model::SynthesizeSpeechConfig;
/// let x = TextToSpeechSettings::new().set_synthesize_speech_configs([
/// ("key0", SynthesizeSpeechConfig::default()/* use setters */),
/// ("key1", SynthesizeSpeechConfig::default()/* use (different) setters */),
/// ]);
/// ```
pub fn set_synthesize_speech_configs<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::SynthesizeSpeechConfig>,
{
use std::iter::Iterator;
self.synthesize_speech_configs = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
#[cfg(feature = "environments")]
impl wkt::message::Message for TextToSpeechSettings {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.TextToSpeechSettings"
}
}
/// The request message for
/// [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments].
///
/// [google.cloud.dialogflow.v2.Environments.ListEnvironments]: crate::client::Environments::list_environments
#[cfg(feature = "environments")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListEnvironmentsRequest {
/// Required. The agent to list all environments from.
/// Format:
///
/// - `projects/<Project ID>/agent`
/// - `projects/<Project ID>/locations/<Location ID>/agent`
pub parent: std::string::String,
/// Optional. The maximum number of items to return in a single page. By
/// default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "environments")]
impl ListEnvironmentsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListEnvironmentsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListEnvironmentsRequest;
/// let x = ListEnvironmentsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListEnvironmentsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListEnvironmentsRequest;
/// let x = ListEnvironmentsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListEnvironmentsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListEnvironmentsRequest;
/// let x = ListEnvironmentsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "environments")]
impl wkt::message::Message for ListEnvironmentsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListEnvironmentsRequest"
}
}
/// The response message for
/// [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments].
///
/// [google.cloud.dialogflow.v2.Environments.ListEnvironments]: crate::client::Environments::list_environments
#[cfg(feature = "environments")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListEnvironmentsResponse {
/// The list of agent environments. There will be a maximum number of items
/// returned based on the page_size field in the request.
pub environments: std::vec::Vec<crate::model::Environment>,
/// Token to retrieve the next page of results, or empty if there are no
/// more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "environments")]
impl ListEnvironmentsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [environments][crate::model::ListEnvironmentsResponse::environments].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListEnvironmentsResponse;
/// use google_cloud_dialogflow_v2::model::Environment;
/// let x = ListEnvironmentsResponse::new()
/// .set_environments([
/// Environment::default()/* use setters */,
/// Environment::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_environments<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Environment>,
{
use std::iter::Iterator;
self.environments = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListEnvironmentsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListEnvironmentsResponse;
/// let x = ListEnvironmentsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "environments")]
impl wkt::message::Message for ListEnvironmentsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListEnvironmentsResponse"
}
}
#[cfg(feature = "environments")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListEnvironmentsResponse {
type PageItem = crate::model::Environment;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.environments
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [Environments.GetEnvironment][google.cloud.dialogflow.v2.Environments.GetEnvironment].
///
/// [google.cloud.dialogflow.v2.Environments.GetEnvironment]: crate::client::Environments::get_environment
#[cfg(feature = "environments")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetEnvironmentRequest {
/// Required. The name of the environment.
/// Supported formats:
///
/// - `projects/<Project ID>/agent/environments/<Environment ID>`
/// - `projects/<Project ID>/locations/<Location
/// ID>/agent/environments/<Environment ID>`
///
/// The environment ID for the default environment is `-`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "environments")]
impl GetEnvironmentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetEnvironmentRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetEnvironmentRequest;
/// let x = GetEnvironmentRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "environments")]
impl wkt::message::Message for GetEnvironmentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetEnvironmentRequest"
}
}
/// The request message for
/// [Environments.CreateEnvironment][google.cloud.dialogflow.v2.Environments.CreateEnvironment].
///
/// [google.cloud.dialogflow.v2.Environments.CreateEnvironment]: crate::client::Environments::create_environment
#[cfg(feature = "environments")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateEnvironmentRequest {
/// Required. The agent to create an environment for.
/// Supported formats:
///
/// - `projects/<Project ID>/agent`
/// - `projects/<Project ID>/locations/<Location ID>/agent`
pub parent: std::string::String,
/// Required. The environment to create.
pub environment: std::option::Option<crate::model::Environment>,
/// Required. The unique id of the new environment.
pub environment_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "environments")]
impl CreateEnvironmentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateEnvironmentRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateEnvironmentRequest;
/// let x = CreateEnvironmentRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [environment][crate::model::CreateEnvironmentRequest::environment].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateEnvironmentRequest;
/// use google_cloud_dialogflow_v2::model::Environment;
/// let x = CreateEnvironmentRequest::new().set_environment(Environment::default()/* use setters */);
/// ```
pub fn set_environment<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Environment>,
{
self.environment = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [environment][crate::model::CreateEnvironmentRequest::environment].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateEnvironmentRequest;
/// use google_cloud_dialogflow_v2::model::Environment;
/// let x = CreateEnvironmentRequest::new().set_or_clear_environment(Some(Environment::default()/* use setters */));
/// let x = CreateEnvironmentRequest::new().set_or_clear_environment(None::<Environment>);
/// ```
pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Environment>,
{
self.environment = v.map(|x| x.into());
self
}
/// Sets the value of [environment_id][crate::model::CreateEnvironmentRequest::environment_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateEnvironmentRequest;
/// let x = CreateEnvironmentRequest::new().set_environment_id("example");
/// ```
pub fn set_environment_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.environment_id = v.into();
self
}
}
#[cfg(feature = "environments")]
impl wkt::message::Message for CreateEnvironmentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateEnvironmentRequest"
}
}
/// The request message for
/// [Environments.UpdateEnvironment][google.cloud.dialogflow.v2.Environments.UpdateEnvironment].
///
/// [google.cloud.dialogflow.v2.Environments.UpdateEnvironment]: crate::client::Environments::update_environment
#[cfg(feature = "environments")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateEnvironmentRequest {
/// Required. The environment to update.
pub environment: std::option::Option<crate::model::Environment>,
/// Required. The mask to control which fields get updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
/// Optional. This field is used to prevent accidental overwrite of the default
/// environment, which is an operation that cannot be undone. To confirm that
/// the caller desires this overwrite, this field must be explicitly set to
/// true when updating the default environment (environment ID = `-`).
pub allow_load_to_draft_and_discard_changes: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "environments")]
impl UpdateEnvironmentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [environment][crate::model::UpdateEnvironmentRequest::environment].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateEnvironmentRequest;
/// use google_cloud_dialogflow_v2::model::Environment;
/// let x = UpdateEnvironmentRequest::new().set_environment(Environment::default()/* use setters */);
/// ```
pub fn set_environment<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Environment>,
{
self.environment = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [environment][crate::model::UpdateEnvironmentRequest::environment].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateEnvironmentRequest;
/// use google_cloud_dialogflow_v2::model::Environment;
/// let x = UpdateEnvironmentRequest::new().set_or_clear_environment(Some(Environment::default()/* use setters */));
/// let x = UpdateEnvironmentRequest::new().set_or_clear_environment(None::<Environment>);
/// ```
pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Environment>,
{
self.environment = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateEnvironmentRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateEnvironmentRequest;
/// use wkt::FieldMask;
/// let x = UpdateEnvironmentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateEnvironmentRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateEnvironmentRequest;
/// use wkt::FieldMask;
/// let x = UpdateEnvironmentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateEnvironmentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
/// Sets the value of [allow_load_to_draft_and_discard_changes][crate::model::UpdateEnvironmentRequest::allow_load_to_draft_and_discard_changes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateEnvironmentRequest;
/// let x = UpdateEnvironmentRequest::new().set_allow_load_to_draft_and_discard_changes(true);
/// ```
pub fn set_allow_load_to_draft_and_discard_changes<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.allow_load_to_draft_and_discard_changes = v.into();
self
}
}
#[cfg(feature = "environments")]
impl wkt::message::Message for UpdateEnvironmentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateEnvironmentRequest"
}
}
/// The request message for
/// [Environments.DeleteEnvironment][google.cloud.dialogflow.v2.Environments.DeleteEnvironment].
///
/// [google.cloud.dialogflow.v2.Environments.DeleteEnvironment]: crate::client::Environments::delete_environment
#[cfg(feature = "environments")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteEnvironmentRequest {
/// Required. The name of the environment to delete.
/// / Format:
///
/// - `projects/<Project ID>/agent/environments/<Environment ID>`
/// - `projects/<Project ID>/locations/<Location
/// ID>/agent/environments/<Environment ID>`
///
/// The environment ID for the default environment is `-`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "environments")]
impl DeleteEnvironmentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteEnvironmentRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteEnvironmentRequest;
/// let x = DeleteEnvironmentRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "environments")]
impl wkt::message::Message for DeleteEnvironmentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteEnvironmentRequest"
}
}
/// The request message for
/// [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory].
///
/// [google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory]: crate::client::Environments::get_environment_history
#[cfg(feature = "environments")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetEnvironmentHistoryRequest {
/// Required. The name of the environment to retrieve history for.
/// Supported formats:
///
/// - `projects/<Project ID>/agent/environments/<Environment ID>`
/// - `projects/<Project ID>/locations/<Location
/// ID>/agent/environments/<Environment ID>`
///
/// The environment ID for the default environment is `-`.
pub parent: std::string::String,
/// Optional. The maximum number of items to return in a single page. By
/// default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "environments")]
impl GetEnvironmentHistoryRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::GetEnvironmentHistoryRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetEnvironmentHistoryRequest;
/// let x = GetEnvironmentHistoryRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::GetEnvironmentHistoryRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetEnvironmentHistoryRequest;
/// let x = GetEnvironmentHistoryRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::GetEnvironmentHistoryRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetEnvironmentHistoryRequest;
/// let x = GetEnvironmentHistoryRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "environments")]
impl wkt::message::Message for GetEnvironmentHistoryRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest"
}
}
/// The response message for
/// [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory].
///
/// [google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory]: crate::client::Environments::get_environment_history
#[cfg(feature = "environments")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EnvironmentHistory {
/// Output only. The name of the environment this history is for.
/// Supported formats:
///
/// - `projects/<Project ID>/agent/environments/<Environment ID>`
/// - `projects/<Project ID>/locations/<Location
/// ID>/agent/environments/<Environment ID>`
///
/// The environment ID for the default environment is `-`.
pub parent: std::string::String,
/// Output only. The list of agent environments. There will be a maximum number
/// of items returned based on the page_size field in the request.
pub entries: std::vec::Vec<crate::model::environment_history::Entry>,
/// Output only. Token to retrieve the next page of results, or empty if there
/// are no more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "environments")]
impl EnvironmentHistory {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::EnvironmentHistory::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EnvironmentHistory;
/// let x = EnvironmentHistory::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [entries][crate::model::EnvironmentHistory::entries].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EnvironmentHistory;
/// use google_cloud_dialogflow_v2::model::environment_history::Entry;
/// let x = EnvironmentHistory::new()
/// .set_entries([
/// Entry::default()/* use setters */,
/// Entry::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_entries<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::environment_history::Entry>,
{
use std::iter::Iterator;
self.entries = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::EnvironmentHistory::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EnvironmentHistory;
/// let x = EnvironmentHistory::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "environments")]
impl wkt::message::Message for EnvironmentHistory {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.EnvironmentHistory"
}
}
#[cfg(feature = "environments")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for EnvironmentHistory {
type PageItem = crate::model::environment_history::Entry;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.entries
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Defines additional types related to [EnvironmentHistory].
#[cfg(feature = "environments")]
pub mod environment_history {
#[allow(unused_imports)]
use super::*;
/// Represents an environment history entry.
#[cfg(feature = "environments")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Entry {
/// The agent version loaded into this environment history entry.
pub agent_version: std::string::String,
/// The developer-provided description for this environment history entry.
pub description: std::string::String,
/// The creation time of this environment history entry.
pub create_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "environments")]
impl Entry {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [agent_version][crate::model::environment_history::Entry::agent_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::environment_history::Entry;
/// let x = Entry::new().set_agent_version("example");
/// ```
pub fn set_agent_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.agent_version = v.into();
self
}
/// Sets the value of [description][crate::model::environment_history::Entry::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::environment_history::Entry;
/// let x = Entry::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
/// Sets the value of [create_time][crate::model::environment_history::Entry::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::environment_history::Entry;
/// use wkt::Timestamp;
/// let x = Entry::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::environment_history::Entry::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::environment_history::Entry;
/// use wkt::Timestamp;
/// let x = Entry::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = Entry::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
}
#[cfg(feature = "environments")]
impl wkt::message::Message for Entry {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.EnvironmentHistory.Entry"
}
}
}
/// By default, your agent responds to a matched intent with a static response.
/// As an alternative, you can provide a more dynamic response by using
/// fulfillment. When you enable fulfillment for an intent, Dialogflow responds
/// to that intent by calling a service that you define. For example, if an
/// end-user wants to schedule a haircut on Friday, your service can check your
/// database and respond to the end-user with availability information for
/// Friday.
///
/// For more information, see the [fulfillment
/// guide](https://cloud.google.com/dialogflow/docs/fulfillment-overview).
#[cfg(any(feature = "environments", feature = "fulfillments",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Fulfillment {
/// Required. The unique identifier of the fulfillment.
/// Supported formats:
///
/// - `projects/<Project ID>/agent/fulfillment`
/// - `projects/<Project ID>/locations/<Location ID>/agent/fulfillment`
///
/// This field is not used for Fulfillment in an Environment.
pub name: std::string::String,
/// Optional. The human-readable name of the fulfillment, unique within the
/// agent.
///
/// This field is not used for Fulfillment in an Environment.
pub display_name: std::string::String,
/// Optional. Whether fulfillment is enabled.
pub enabled: bool,
/// Optional. The field defines whether the fulfillment is enabled for certain
/// features.
pub features: std::vec::Vec<crate::model::fulfillment::Feature>,
/// Required. The fulfillment configuration.
pub fulfillment: std::option::Option<crate::model::fulfillment::Fulfillment>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "environments", feature = "fulfillments",))]
impl Fulfillment {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::Fulfillment::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Fulfillment;
/// let x = Fulfillment::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [display_name][crate::model::Fulfillment::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Fulfillment;
/// let x = Fulfillment::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [enabled][crate::model::Fulfillment::enabled].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Fulfillment;
/// let x = Fulfillment::new().set_enabled(true);
/// ```
pub fn set_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enabled = v.into();
self
}
/// Sets the value of [features][crate::model::Fulfillment::features].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Fulfillment;
/// use google_cloud_dialogflow_v2::model::fulfillment::Feature;
/// let x = Fulfillment::new()
/// .set_features([
/// Feature::default()/* use setters */,
/// Feature::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_features<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::fulfillment::Feature>,
{
use std::iter::Iterator;
self.features = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [fulfillment][crate::model::Fulfillment::fulfillment].
///
/// Note that all the setters affecting `fulfillment` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Fulfillment;
/// use google_cloud_dialogflow_v2::model::fulfillment::GenericWebService;
/// let x = Fulfillment::new().set_fulfillment(Some(
/// google_cloud_dialogflow_v2::model::fulfillment::Fulfillment::GenericWebService(GenericWebService::default().into())));
/// ```
pub fn set_fulfillment<
T: std::convert::Into<std::option::Option<crate::model::fulfillment::Fulfillment>>,
>(
mut self,
v: T,
) -> Self {
self.fulfillment = v.into();
self
}
/// The value of [fulfillment][crate::model::Fulfillment::fulfillment]
/// if it holds a `GenericWebService`, `None` if the field is not set or
/// holds a different branch.
pub fn generic_web_service(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::fulfillment::GenericWebService>> {
#[allow(unreachable_patterns)]
self.fulfillment.as_ref().and_then(|v| match v {
crate::model::fulfillment::Fulfillment::GenericWebService(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [fulfillment][crate::model::Fulfillment::fulfillment]
/// to hold a `GenericWebService`.
///
/// Note that all the setters affecting `fulfillment` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Fulfillment;
/// use google_cloud_dialogflow_v2::model::fulfillment::GenericWebService;
/// let x = Fulfillment::new().set_generic_web_service(GenericWebService::default()/* use setters */);
/// assert!(x.generic_web_service().is_some());
/// ```
pub fn set_generic_web_service<
T: std::convert::Into<std::boxed::Box<crate::model::fulfillment::GenericWebService>>,
>(
mut self,
v: T,
) -> Self {
self.fulfillment = std::option::Option::Some(
crate::model::fulfillment::Fulfillment::GenericWebService(v.into()),
);
self
}
}
#[cfg(any(feature = "environments", feature = "fulfillments",))]
impl wkt::message::Message for Fulfillment {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Fulfillment"
}
}
/// Defines additional types related to [Fulfillment].
#[cfg(any(feature = "environments", feature = "fulfillments",))]
pub mod fulfillment {
#[allow(unused_imports)]
use super::*;
/// Represents configuration for a generic web service.
/// Dialogflow supports two mechanisms for authentications:
///
/// - Basic authentication with username and password.
/// - Authentication with additional authentication headers.
///
/// More information could be found at:
/// <https://cloud.google.com/dialogflow/docs/fulfillment-configure>.
#[cfg(any(feature = "environments", feature = "fulfillments",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenericWebService {
/// Required. The fulfillment URI for receiving POST requests.
/// It must use https protocol.
pub uri: std::string::String,
/// Optional. The user name for HTTP Basic authentication.
pub username: std::string::String,
/// Optional. The password for HTTP Basic authentication.
pub password: std::string::String,
/// Optional. The HTTP request headers to send together with fulfillment
/// requests.
pub request_headers: std::collections::HashMap<std::string::String, std::string::String>,
/// Optional. Indicates if generic web service is created through Cloud
/// Functions integration. Defaults to false.
///
/// is_cloud_function is deprecated. Cloud functions can be configured by
/// its uri as a regular web service now.
#[deprecated]
pub is_cloud_function: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "environments", feature = "fulfillments",))]
impl GenericWebService {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [uri][crate::model::fulfillment::GenericWebService::uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::fulfillment::GenericWebService;
/// let x = GenericWebService::new().set_uri("example");
/// ```
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
/// Sets the value of [username][crate::model::fulfillment::GenericWebService::username].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::fulfillment::GenericWebService;
/// let x = GenericWebService::new().set_username("example");
/// ```
pub fn set_username<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.username = v.into();
self
}
/// Sets the value of [password][crate::model::fulfillment::GenericWebService::password].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::fulfillment::GenericWebService;
/// let x = GenericWebService::new().set_password("example");
/// ```
pub fn set_password<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.password = v.into();
self
}
/// Sets the value of [request_headers][crate::model::fulfillment::GenericWebService::request_headers].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::fulfillment::GenericWebService;
/// let x = GenericWebService::new().set_request_headers([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_request_headers<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.request_headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [is_cloud_function][crate::model::fulfillment::GenericWebService::is_cloud_function].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::fulfillment::GenericWebService;
/// let x = GenericWebService::new().set_is_cloud_function(true);
/// ```
#[deprecated]
pub fn set_is_cloud_function<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.is_cloud_function = v.into();
self
}
}
#[cfg(any(feature = "environments", feature = "fulfillments",))]
impl wkt::message::Message for GenericWebService {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Fulfillment.GenericWebService"
}
}
/// Whether fulfillment is enabled for the specific feature.
#[cfg(any(feature = "environments", feature = "fulfillments",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Feature {
/// The type of the feature that enabled for fulfillment.
pub r#type: crate::model::fulfillment::feature::Type,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "environments", feature = "fulfillments",))]
impl Feature {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [r#type][crate::model::fulfillment::Feature::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::fulfillment::Feature;
/// use google_cloud_dialogflow_v2::model::fulfillment::feature::Type;
/// let x0 = Feature::new().set_type(Type::Smalltalk);
/// ```
pub fn set_type<T: std::convert::Into<crate::model::fulfillment::feature::Type>>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
}
#[cfg(any(feature = "environments", feature = "fulfillments",))]
impl wkt::message::Message for Feature {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Fulfillment.Feature"
}
}
/// Defines additional types related to [Feature].
#[cfg(any(feature = "environments", feature = "fulfillments",))]
pub mod feature {
#[allow(unused_imports)]
use super::*;
/// The type of the feature.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(feature = "environments", feature = "fulfillments",))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Type {
/// Feature type not specified.
Unspecified,
/// Fulfillment is enabled for SmallTalk.
Smalltalk,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Type::value] or
/// [Type::name].
UnknownValue(r#type::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(feature = "environments", feature = "fulfillments",))]
pub mod r#type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(feature = "environments", feature = "fulfillments",))]
impl Type {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Smalltalk => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
Self::Smalltalk => std::option::Option::Some("SMALLTALK"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(feature = "environments", feature = "fulfillments",))]
impl std::default::Default for Type {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(feature = "environments", feature = "fulfillments",))]
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())
}
}
#[cfg(any(feature = "environments", feature = "fulfillments",))]
impl std::convert::From<i32> for Type {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Smalltalk,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(feature = "environments", feature = "fulfillments",))]
impl std::convert::From<&str> for Type {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_UNSPECIFIED" => Self::Unspecified,
"SMALLTALK" => Self::Smalltalk,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(feature = "environments", feature = "fulfillments",))]
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::Smalltalk => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(feature = "environments", feature = "fulfillments",))]
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.dialogflow.v2.Fulfillment.Feature.Type",
))
}
}
}
/// Required. The fulfillment configuration.
#[cfg(any(feature = "environments", feature = "fulfillments",))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Fulfillment {
/// Configuration for a generic web service.
GenericWebService(std::boxed::Box<crate::model::fulfillment::GenericWebService>),
}
}
/// The request message for
/// [Fulfillments.GetFulfillment][google.cloud.dialogflow.v2.Fulfillments.GetFulfillment].
///
/// [google.cloud.dialogflow.v2.Fulfillments.GetFulfillment]: crate::client::Fulfillments::get_fulfillment
#[cfg(feature = "fulfillments")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetFulfillmentRequest {
/// Required. The name of the fulfillment.
/// Format: `projects/<Project ID>/agent/fulfillment`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "fulfillments")]
impl GetFulfillmentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetFulfillmentRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetFulfillmentRequest;
/// let x = GetFulfillmentRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "fulfillments")]
impl wkt::message::Message for GetFulfillmentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetFulfillmentRequest"
}
}
/// The request message for
/// [Fulfillments.UpdateFulfillment][google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillment].
///
/// [google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillment]: crate::client::Fulfillments::update_fulfillment
#[cfg(feature = "fulfillments")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateFulfillmentRequest {
/// Required. The fulfillment to update.
pub fulfillment: std::option::Option<crate::model::Fulfillment>,
/// Required. The mask to control which fields get updated. If the mask is not
/// present, all fields will be updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "fulfillments")]
impl UpdateFulfillmentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [fulfillment][crate::model::UpdateFulfillmentRequest::fulfillment].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateFulfillmentRequest;
/// use google_cloud_dialogflow_v2::model::Fulfillment;
/// let x = UpdateFulfillmentRequest::new().set_fulfillment(Fulfillment::default()/* use setters */);
/// ```
pub fn set_fulfillment<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Fulfillment>,
{
self.fulfillment = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [fulfillment][crate::model::UpdateFulfillmentRequest::fulfillment].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateFulfillmentRequest;
/// use google_cloud_dialogflow_v2::model::Fulfillment;
/// let x = UpdateFulfillmentRequest::new().set_or_clear_fulfillment(Some(Fulfillment::default()/* use setters */));
/// let x = UpdateFulfillmentRequest::new().set_or_clear_fulfillment(None::<Fulfillment>);
/// ```
pub fn set_or_clear_fulfillment<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Fulfillment>,
{
self.fulfillment = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateFulfillmentRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateFulfillmentRequest;
/// use wkt::FieldMask;
/// let x = UpdateFulfillmentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateFulfillmentRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateFulfillmentRequest;
/// use wkt::FieldMask;
/// let x = UpdateFulfillmentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateFulfillmentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "fulfillments")]
impl wkt::message::Message for UpdateFulfillmentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateFulfillmentRequest"
}
}
/// Google Cloud Storage location for the inputs.
#[cfg(any(feature = "conversation-datasets", feature = "documents",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GcsSources {
/// Required. Google Cloud Storage URIs for the inputs. A URI is of the form:
/// `gs://bucket/object-prefix-or-name`
/// Whether a prefix or name is used depends on the use case.
pub uris: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-datasets", feature = "documents",))]
impl GcsSources {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [uris][crate::model::GcsSources::uris].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GcsSources;
/// let x = GcsSources::new().set_uris(["a", "b", "c"]);
/// ```
pub fn set_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.uris = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(feature = "conversation-datasets", feature = "documents",))]
impl wkt::message::Message for GcsSources {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GcsSources"
}
}
/// Google Cloud Storage location for the output.
#[cfg(feature = "documents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GcsDestination {
/// The Google Cloud Storage URIs for the output. A URI is of the
/// form:
/// `gs://bucket/object-prefix-or-name`
/// Whether a prefix or name is used depends on the use case. The requesting
/// user must have "write-permission" to the bucket.
pub uri: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "documents")]
impl GcsDestination {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [uri][crate::model::GcsDestination::uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GcsDestination;
/// let x = GcsDestination::new().set_uri("example");
/// ```
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
}
#[cfg(feature = "documents")]
impl wkt::message::Message for GcsDestination {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GcsDestination"
}
}
/// Request message of CreateGenerator.
#[cfg(feature = "generators")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateGeneratorRequest {
/// Required. The project/location to create generator for. Format:
/// `projects/<Project ID>/locations/<Location ID>`
pub parent: std::string::String,
/// Required. The generator to create.
pub generator: std::option::Option<crate::model::Generator>,
/// Optional. The ID to use for the generator, which will become the final
/// component of the generator's resource name.
///
/// The generator ID must be compliant with the regression formula
/// `[a-zA-Z][a-zA-Z0-9_-]*` with the characters length in range of [3,64].
/// If the field is not provided, an Id will be auto-generated.
/// If the field is provided, the caller is responsible for
///
/// 1. the uniqueness of the ID, otherwise the request will be rejected.
/// 1. the consistency for whether to use custom ID or not under a project to
/// better ensure uniqueness.
pub generator_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generators")]
impl CreateGeneratorRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateGeneratorRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateGeneratorRequest;
/// let x = CreateGeneratorRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [generator][crate::model::CreateGeneratorRequest::generator].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateGeneratorRequest;
/// use google_cloud_dialogflow_v2::model::Generator;
/// let x = CreateGeneratorRequest::new().set_generator(Generator::default()/* use setters */);
/// ```
pub fn set_generator<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Generator>,
{
self.generator = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [generator][crate::model::CreateGeneratorRequest::generator].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateGeneratorRequest;
/// use google_cloud_dialogflow_v2::model::Generator;
/// let x = CreateGeneratorRequest::new().set_or_clear_generator(Some(Generator::default()/* use setters */));
/// let x = CreateGeneratorRequest::new().set_or_clear_generator(None::<Generator>);
/// ```
pub fn set_or_clear_generator<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Generator>,
{
self.generator = v.map(|x| x.into());
self
}
/// Sets the value of [generator_id][crate::model::CreateGeneratorRequest::generator_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateGeneratorRequest;
/// let x = CreateGeneratorRequest::new().set_generator_id("example");
/// ```
pub fn set_generator_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.generator_id = v.into();
self
}
}
#[cfg(feature = "generators")]
impl wkt::message::Message for CreateGeneratorRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateGeneratorRequest"
}
}
/// Request message of GetGenerator.
#[cfg(feature = "generators")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetGeneratorRequest {
/// Required. The generator resource name to retrieve. Format:
/// `projects/<Project ID>/locations/<Location ID>/generators/<Generator ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generators")]
impl GetGeneratorRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetGeneratorRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetGeneratorRequest;
/// let x = GetGeneratorRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "generators")]
impl wkt::message::Message for GetGeneratorRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetGeneratorRequest"
}
}
/// Request message of ListGenerators.
#[cfg(feature = "generators")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListGeneratorsRequest {
/// Required. The project/location to list generators for. Format:
/// `projects/<Project ID>/locations/<Location ID>`
pub parent: std::string::String,
/// Optional. Maximum number of conversation models to return in a single page.
/// Default to 10.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generators")]
impl ListGeneratorsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListGeneratorsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListGeneratorsRequest;
/// let x = ListGeneratorsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListGeneratorsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListGeneratorsRequest;
/// let x = ListGeneratorsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListGeneratorsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListGeneratorsRequest;
/// let x = ListGeneratorsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "generators")]
impl wkt::message::Message for ListGeneratorsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListGeneratorsRequest"
}
}
/// Response of ListGenerators.
#[cfg(feature = "generators")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListGeneratorsResponse {
/// List of generators retrieved.
pub generators: std::vec::Vec<crate::model::Generator>,
/// Token to retrieve the next page of results, or empty if there are no more
/// results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generators")]
impl ListGeneratorsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [generators][crate::model::ListGeneratorsResponse::generators].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListGeneratorsResponse;
/// use google_cloud_dialogflow_v2::model::Generator;
/// let x = ListGeneratorsResponse::new()
/// .set_generators([
/// Generator::default()/* use setters */,
/// Generator::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_generators<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Generator>,
{
use std::iter::Iterator;
self.generators = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListGeneratorsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListGeneratorsResponse;
/// let x = ListGeneratorsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "generators")]
impl wkt::message::Message for ListGeneratorsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListGeneratorsResponse"
}
}
#[cfg(feature = "generators")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListGeneratorsResponse {
type PageItem = crate::model::Generator;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.generators
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Request of DeleteGenerator.
#[cfg(feature = "generators")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteGeneratorRequest {
/// Required. The generator resource name to delete. Format:
/// `projects/<Project ID>/locations/<Location ID>/generators/<Generator ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generators")]
impl DeleteGeneratorRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteGeneratorRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteGeneratorRequest;
/// let x = DeleteGeneratorRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "generators")]
impl wkt::message::Message for DeleteGeneratorRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteGeneratorRequest"
}
}
/// Request of UpdateGenerator.
#[cfg(feature = "generators")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateGeneratorRequest {
/// Required. The generator to update.
/// The name field of generator is to identify the generator to update.
pub generator: std::option::Option<crate::model::Generator>,
/// Optional. The list of fields to update.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generators")]
impl UpdateGeneratorRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [generator][crate::model::UpdateGeneratorRequest::generator].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateGeneratorRequest;
/// use google_cloud_dialogflow_v2::model::Generator;
/// let x = UpdateGeneratorRequest::new().set_generator(Generator::default()/* use setters */);
/// ```
pub fn set_generator<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Generator>,
{
self.generator = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [generator][crate::model::UpdateGeneratorRequest::generator].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateGeneratorRequest;
/// use google_cloud_dialogflow_v2::model::Generator;
/// let x = UpdateGeneratorRequest::new().set_or_clear_generator(Some(Generator::default()/* use setters */));
/// let x = UpdateGeneratorRequest::new().set_or_clear_generator(None::<Generator>);
/// ```
pub fn set_or_clear_generator<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Generator>,
{
self.generator = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateGeneratorRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateGeneratorRequest;
/// use wkt::FieldMask;
/// let x = UpdateGeneratorRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateGeneratorRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateGeneratorRequest;
/// use wkt::FieldMask;
/// let x = UpdateGeneratorRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateGeneratorRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "generators")]
impl wkt::message::Message for UpdateGeneratorRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateGeneratorRequest"
}
}
/// Represents a message entry of a conversation.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageEntry {
/// Optional. Participant role of the message.
pub role: crate::model::message_entry::Role,
/// Optional. Transcript content of the message.
pub text: std::string::String,
/// Optional. The language of the text. See [Language
/// Support](https://cloud.google.com/dialogflow/docs/reference/language) for a
/// list of the currently supported language codes.
pub language_code: std::string::String,
/// Optional. Create time of the message entry.
pub create_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl MessageEntry {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [role][crate::model::MessageEntry::role].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::MessageEntry;
/// use google_cloud_dialogflow_v2::model::message_entry::Role;
/// let x0 = MessageEntry::new().set_role(Role::HumanAgent);
/// let x1 = MessageEntry::new().set_role(Role::AutomatedAgent);
/// let x2 = MessageEntry::new().set_role(Role::EndUser);
/// ```
pub fn set_role<T: std::convert::Into<crate::model::message_entry::Role>>(
mut self,
v: T,
) -> Self {
self.role = v.into();
self
}
/// Sets the value of [text][crate::model::MessageEntry::text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::MessageEntry;
/// let x = MessageEntry::new().set_text("example");
/// ```
pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.text = v.into();
self
}
/// Sets the value of [language_code][crate::model::MessageEntry::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::MessageEntry;
/// let x = MessageEntry::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [create_time][crate::model::MessageEntry::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::MessageEntry;
/// use wkt::Timestamp;
/// let x = MessageEntry::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::MessageEntry::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::MessageEntry;
/// use wkt::Timestamp;
/// let x = MessageEntry::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = MessageEntry::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for MessageEntry {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.MessageEntry"
}
}
/// Defines additional types related to [MessageEntry].
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
pub mod message_entry {
#[allow(unused_imports)]
use super::*;
/// Enumeration of the roles a participant can play in a conversation.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Role {
/// Participant role not set.
Unspecified,
/// Participant is a human agent.
HumanAgent,
/// Participant is an automated agent, such as a Dialogflow agent.
AutomatedAgent,
/// Participant is an end user that has called or chatted with
/// Dialogflow services.
EndUser,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Role::value] or
/// [Role::name].
UnknownValue(role::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
pub mod role {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl Role {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::HumanAgent => std::option::Option::Some(1),
Self::AutomatedAgent => std::option::Option::Some(2),
Self::EndUser => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
Self::HumanAgent => std::option::Option::Some("HUMAN_AGENT"),
Self::AutomatedAgent => std::option::Option::Some("AUTOMATED_AGENT"),
Self::EndUser => std::option::Option::Some("END_USER"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl std::default::Default for Role {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl std::fmt::Display for Role {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl std::convert::From<i32> for Role {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::HumanAgent,
2 => Self::AutomatedAgent,
3 => Self::EndUser,
_ => Self::UnknownValue(role::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl std::convert::From<&str> for Role {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ROLE_UNSPECIFIED" => Self::Unspecified,
"HUMAN_AGENT" => Self::HumanAgent,
"AUTOMATED_AGENT" => Self::AutomatedAgent,
"END_USER" => Self::EndUser,
_ => Self::UnknownValue(role::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl serde::ser::Serialize for Role {
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::HumanAgent => serializer.serialize_i32(1),
Self::AutomatedAgent => serializer.serialize_i32(2),
Self::EndUser => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl<'de> serde::de::Deserialize<'de> for Role {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
".google.cloud.dialogflow.v2.MessageEntry.Role",
))
}
}
}
/// Context of the conversation, including transcripts.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationContext {
/// Optional. List of message transcripts in the conversation.
pub message_entries: std::vec::Vec<crate::model::MessageEntry>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl ConversationContext {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [message_entries][crate::model::ConversationContext::message_entries].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ConversationContext;
/// use google_cloud_dialogflow_v2::model::MessageEntry;
/// let x = ConversationContext::new()
/// .set_message_entries([
/// MessageEntry::default()/* use setters */,
/// MessageEntry::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_message_entries<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::MessageEntry>,
{
use std::iter::Iterator;
self.message_entries = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for ConversationContext {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ConversationContext"
}
}
/// List of summarization sections.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SummarizationSectionList {
/// Optional. Summarization sections.
pub summarization_sections: std::vec::Vec<crate::model::SummarizationSection>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl SummarizationSectionList {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [summarization_sections][crate::model::SummarizationSectionList::summarization_sections].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarizationSectionList;
/// use google_cloud_dialogflow_v2::model::SummarizationSection;
/// let x = SummarizationSectionList::new()
/// .set_summarization_sections([
/// SummarizationSection::default()/* use setters */,
/// SummarizationSection::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_summarization_sections<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SummarizationSection>,
{
use std::iter::Iterator;
self.summarization_sections = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for SummarizationSectionList {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationSectionList"
}
}
/// Providing examples in the generator (i.e. building a few-shot generator)
/// helps convey the desired format of the LLM response.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FewShotExample {
/// Optional. Conversation transcripts.
pub conversation_context: std::option::Option<crate::model::ConversationContext>,
/// Optional. Key is the placeholder field name in input, value is the value of
/// the placeholder. E.g. instruction contains "@price", and ingested data has
/// <"price", "10">
pub extra_info: std::collections::HashMap<std::string::String, std::string::String>,
/// Required. Example output of the model.
pub output: std::option::Option<crate::model::GeneratorSuggestion>,
/// Instruction list of this few_shot example.
pub instruction_list: std::option::Option<crate::model::few_shot_example::InstructionList>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl FewShotExample {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation_context][crate::model::FewShotExample::conversation_context].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FewShotExample;
/// use google_cloud_dialogflow_v2::model::ConversationContext;
/// let x = FewShotExample::new().set_conversation_context(ConversationContext::default()/* use setters */);
/// ```
pub fn set_conversation_context<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ConversationContext>,
{
self.conversation_context = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [conversation_context][crate::model::FewShotExample::conversation_context].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FewShotExample;
/// use google_cloud_dialogflow_v2::model::ConversationContext;
/// let x = FewShotExample::new().set_or_clear_conversation_context(Some(ConversationContext::default()/* use setters */));
/// let x = FewShotExample::new().set_or_clear_conversation_context(None::<ConversationContext>);
/// ```
pub fn set_or_clear_conversation_context<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ConversationContext>,
{
self.conversation_context = v.map(|x| x.into());
self
}
/// Sets the value of [extra_info][crate::model::FewShotExample::extra_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FewShotExample;
/// let x = FewShotExample::new().set_extra_info([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_extra_info<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.extra_info = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [output][crate::model::FewShotExample::output].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FewShotExample;
/// use google_cloud_dialogflow_v2::model::GeneratorSuggestion;
/// let x = FewShotExample::new().set_output(GeneratorSuggestion::default()/* use setters */);
/// ```
pub fn set_output<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GeneratorSuggestion>,
{
self.output = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output][crate::model::FewShotExample::output].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FewShotExample;
/// use google_cloud_dialogflow_v2::model::GeneratorSuggestion;
/// let x = FewShotExample::new().set_or_clear_output(Some(GeneratorSuggestion::default()/* use setters */));
/// let x = FewShotExample::new().set_or_clear_output(None::<GeneratorSuggestion>);
/// ```
pub fn set_or_clear_output<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GeneratorSuggestion>,
{
self.output = v.map(|x| x.into());
self
}
/// Sets the value of [instruction_list][crate::model::FewShotExample::instruction_list].
///
/// Note that all the setters affecting `instruction_list` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FewShotExample;
/// use google_cloud_dialogflow_v2::model::SummarizationSectionList;
/// let x = FewShotExample::new().set_instruction_list(Some(
/// google_cloud_dialogflow_v2::model::few_shot_example::InstructionList::SummarizationSectionList(SummarizationSectionList::default().into())));
/// ```
pub fn set_instruction_list<
T: std::convert::Into<std::option::Option<crate::model::few_shot_example::InstructionList>>,
>(
mut self,
v: T,
) -> Self {
self.instruction_list = v.into();
self
}
/// The value of [instruction_list][crate::model::FewShotExample::instruction_list]
/// if it holds a `SummarizationSectionList`, `None` if the field is not set or
/// holds a different branch.
pub fn summarization_section_list(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SummarizationSectionList>> {
#[allow(unreachable_patterns)]
self.instruction_list.as_ref().and_then(|v| match v {
crate::model::few_shot_example::InstructionList::SummarizationSectionList(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [instruction_list][crate::model::FewShotExample::instruction_list]
/// to hold a `SummarizationSectionList`.
///
/// Note that all the setters affecting `instruction_list` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FewShotExample;
/// use google_cloud_dialogflow_v2::model::SummarizationSectionList;
/// let x = FewShotExample::new().set_summarization_section_list(SummarizationSectionList::default()/* use setters */);
/// assert!(x.summarization_section_list().is_some());
/// ```
pub fn set_summarization_section_list<
T: std::convert::Into<std::boxed::Box<crate::model::SummarizationSectionList>>,
>(
mut self,
v: T,
) -> Self {
self.instruction_list = std::option::Option::Some(
crate::model::few_shot_example::InstructionList::SummarizationSectionList(v.into()),
);
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for FewShotExample {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.FewShotExample"
}
}
/// Defines additional types related to [FewShotExample].
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
pub mod few_shot_example {
#[allow(unused_imports)]
use super::*;
/// Instruction list of this few_shot example.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum InstructionList {
/// Summarization sections.
SummarizationSectionList(std::boxed::Box<crate::model::SummarizationSectionList>),
}
}
/// The parameters of inference.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InferenceParameter {
/// Optional. Maximum number of the output tokens for the generator.
pub max_output_tokens: std::option::Option<i32>,
/// Optional. Controls the randomness of LLM predictions.
/// Low temperature = less random. High temperature = more random.
/// If unset (or 0), uses a default value of 0.
pub temperature: std::option::Option<f64>,
/// Optional. Top-k changes how the model selects tokens for output. A top-k of
/// 1 means the selected token is the most probable among all tokens in the
/// model's vocabulary (also called greedy decoding), while a top-k of 3 means
/// that the next token is selected from among the 3 most probable tokens
/// (using temperature). For each token selection step, the top K tokens with
/// the highest probabilities are sampled. Then tokens are further filtered
/// based on topP with the final token selected using temperature sampling.
/// Specify a lower value for less random responses and a higher value for more
/// random responses. Acceptable value is [1, 40], default to 40.
pub top_k: std::option::Option<i32>,
/// Optional. Top-p changes how the model selects tokens for output. Tokens are
/// selected from most K (see topK parameter) probable to least until the sum
/// of their probabilities equals the top-p value. For example, if tokens A, B,
/// and C have a probability of 0.3, 0.2, and 0.1 and the top-p value is 0.5,
/// then the model will select either A or B as the next token (using
/// temperature) and doesn't consider C. The default top-p value is 0.95.
/// Specify a lower value for less random responses and a higher value for more
/// random responses. Acceptable value is [0.0, 1.0], default to 0.95.
pub top_p: std::option::Option<f64>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl InferenceParameter {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [max_output_tokens][crate::model::InferenceParameter::max_output_tokens].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InferenceParameter;
/// let x = InferenceParameter::new().set_max_output_tokens(42);
/// ```
pub fn set_max_output_tokens<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i32>,
{
self.max_output_tokens = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [max_output_tokens][crate::model::InferenceParameter::max_output_tokens].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InferenceParameter;
/// let x = InferenceParameter::new().set_or_clear_max_output_tokens(Some(42));
/// let x = InferenceParameter::new().set_or_clear_max_output_tokens(None::<i32>);
/// ```
pub fn set_or_clear_max_output_tokens<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i32>,
{
self.max_output_tokens = v.map(|x| x.into());
self
}
/// Sets the value of [temperature][crate::model::InferenceParameter::temperature].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InferenceParameter;
/// let x = InferenceParameter::new().set_temperature(42.0);
/// ```
pub fn set_temperature<T>(mut self, v: T) -> Self
where
T: std::convert::Into<f64>,
{
self.temperature = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [temperature][crate::model::InferenceParameter::temperature].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InferenceParameter;
/// let x = InferenceParameter::new().set_or_clear_temperature(Some(42.0));
/// let x = InferenceParameter::new().set_or_clear_temperature(None::<f32>);
/// ```
pub fn set_or_clear_temperature<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<f64>,
{
self.temperature = v.map(|x| x.into());
self
}
/// Sets the value of [top_k][crate::model::InferenceParameter::top_k].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InferenceParameter;
/// let x = InferenceParameter::new().set_top_k(42);
/// ```
pub fn set_top_k<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i32>,
{
self.top_k = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [top_k][crate::model::InferenceParameter::top_k].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InferenceParameter;
/// let x = InferenceParameter::new().set_or_clear_top_k(Some(42));
/// let x = InferenceParameter::new().set_or_clear_top_k(None::<i32>);
/// ```
pub fn set_or_clear_top_k<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i32>,
{
self.top_k = v.map(|x| x.into());
self
}
/// Sets the value of [top_p][crate::model::InferenceParameter::top_p].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InferenceParameter;
/// let x = InferenceParameter::new().set_top_p(42.0);
/// ```
pub fn set_top_p<T>(mut self, v: T) -> Self
where
T: std::convert::Into<f64>,
{
self.top_p = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [top_p][crate::model::InferenceParameter::top_p].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InferenceParameter;
/// let x = InferenceParameter::new().set_or_clear_top_p(Some(42.0));
/// let x = InferenceParameter::new().set_or_clear_top_p(None::<f32>);
/// ```
pub fn set_or_clear_top_p<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<f64>,
{
self.top_p = v.map(|x| x.into());
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for InferenceParameter {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.InferenceParameter"
}
}
/// Agent Coaching context that customer can configure.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AgentCoachingContext {
/// Optional. The overarching guidance for the agent coaching. This should be
/// set only for v1.5 and later versions.
pub overarching_guidance: std::string::String,
/// Optional. Customized instructions for agent coaching.
pub instructions: std::vec::Vec<crate::model::AgentCoachingInstruction>,
/// Optional. Version of the feature. If not set, default to latest version.
/// Current candidates are ["1.2"].
pub version: std::string::String,
/// Optional. Output language code.
pub output_language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl AgentCoachingContext {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [overarching_guidance][crate::model::AgentCoachingContext::overarching_guidance].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingContext;
/// let x = AgentCoachingContext::new().set_overarching_guidance("example");
/// ```
pub fn set_overarching_guidance<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.overarching_guidance = v.into();
self
}
/// Sets the value of [instructions][crate::model::AgentCoachingContext::instructions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingContext;
/// use google_cloud_dialogflow_v2::model::AgentCoachingInstruction;
/// let x = AgentCoachingContext::new()
/// .set_instructions([
/// AgentCoachingInstruction::default()/* use setters */,
/// AgentCoachingInstruction::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_instructions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::AgentCoachingInstruction>,
{
use std::iter::Iterator;
self.instructions = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [version][crate::model::AgentCoachingContext::version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingContext;
/// let x = AgentCoachingContext::new().set_version("example");
/// ```
pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.version = v.into();
self
}
/// Sets the value of [output_language_code][crate::model::AgentCoachingContext::output_language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingContext;
/// let x = AgentCoachingContext::new().set_output_language_code("example");
/// ```
pub fn set_output_language_code<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.output_language_code = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for AgentCoachingContext {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentCoachingContext"
}
}
/// Represents the section of summarization.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SummarizationSection {
/// Optional. Name of the section, for example, "situation".
pub key: std::string::String,
/// Optional. Definition of the section, for example, "what the customer needs
/// help with or has question about."
pub definition: std::string::String,
/// Optional. Type of the summarization section.
pub r#type: crate::model::summarization_section::Type,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl SummarizationSection {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [key][crate::model::SummarizationSection::key].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarizationSection;
/// let x = SummarizationSection::new().set_key("example");
/// ```
pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key = v.into();
self
}
/// Sets the value of [definition][crate::model::SummarizationSection::definition].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarizationSection;
/// let x = SummarizationSection::new().set_definition("example");
/// ```
pub fn set_definition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.definition = v.into();
self
}
/// Sets the value of [r#type][crate::model::SummarizationSection::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarizationSection;
/// use google_cloud_dialogflow_v2::model::summarization_section::Type;
/// let x0 = SummarizationSection::new().set_type(Type::Situation);
/// let x1 = SummarizationSection::new().set_type(Type::Action);
/// let x2 = SummarizationSection::new().set_type(Type::Resolution);
/// ```
pub fn set_type<T: std::convert::Into<crate::model::summarization_section::Type>>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for SummarizationSection {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationSection"
}
}
/// Defines additional types related to [SummarizationSection].
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
pub mod summarization_section {
#[allow(unused_imports)]
use super::*;
/// Type enum of the summarization sections.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Type {
/// Undefined section type, does not return anything.
Unspecified,
/// What the customer needs help with or has question about.
/// Section name: "situation".
Situation,
/// What the agent does to help the customer.
/// Section name: "action".
Action,
/// Result of the customer service. A single word describing the result
/// of the conversation.
/// Section name: "resolution".
Resolution,
/// Reason for cancellation if the customer requests for a cancellation.
/// "N/A" otherwise.
/// Section name: "reason_for_cancellation".
ReasonForCancellation,
/// "Unsatisfied" or "Satisfied" depending on the customer's feelings at
/// the end of the conversation.
/// Section name: "customer_satisfaction".
CustomerSatisfaction,
/// Key entities extracted from the conversation, such as ticket number,
/// order number, dollar amount, etc.
/// Section names are prefixed by "entities/".
Entities,
/// Customer defined sections.
CustomerDefined,
/// Concise version of the situation section. This type is only available if
/// type SITUATION is not selected.
SituationConcise,
/// Concise version of the action section. This type is only available if
/// type ACTION is not selected.
ActionConcise,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Type::value] or
/// [Type::name].
UnknownValue(r#type::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
pub mod r#type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl Type {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Situation => std::option::Option::Some(1),
Self::Action => std::option::Option::Some(2),
Self::Resolution => std::option::Option::Some(3),
Self::ReasonForCancellation => std::option::Option::Some(4),
Self::CustomerSatisfaction => std::option::Option::Some(5),
Self::Entities => std::option::Option::Some(6),
Self::CustomerDefined => std::option::Option::Some(7),
Self::SituationConcise => std::option::Option::Some(9),
Self::ActionConcise => std::option::Option::Some(10),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
Self::Situation => std::option::Option::Some("SITUATION"),
Self::Action => std::option::Option::Some("ACTION"),
Self::Resolution => std::option::Option::Some("RESOLUTION"),
Self::ReasonForCancellation => std::option::Option::Some("REASON_FOR_CANCELLATION"),
Self::CustomerSatisfaction => std::option::Option::Some("CUSTOMER_SATISFACTION"),
Self::Entities => std::option::Option::Some("ENTITIES"),
Self::CustomerDefined => std::option::Option::Some("CUSTOMER_DEFINED"),
Self::SituationConcise => std::option::Option::Some("SITUATION_CONCISE"),
Self::ActionConcise => std::option::Option::Some("ACTION_CONCISE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl std::default::Default for Type {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
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())
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl std::convert::From<i32> for Type {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Situation,
2 => Self::Action,
3 => Self::Resolution,
4 => Self::ReasonForCancellation,
5 => Self::CustomerSatisfaction,
6 => Self::Entities,
7 => Self::CustomerDefined,
9 => Self::SituationConcise,
10 => Self::ActionConcise,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl std::convert::From<&str> for Type {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_UNSPECIFIED" => Self::Unspecified,
"SITUATION" => Self::Situation,
"ACTION" => Self::Action,
"RESOLUTION" => Self::Resolution,
"REASON_FOR_CANCELLATION" => Self::ReasonForCancellation,
"CUSTOMER_SATISFACTION" => Self::CustomerSatisfaction,
"ENTITIES" => Self::Entities,
"CUSTOMER_DEFINED" => Self::CustomerDefined,
"SITUATION_CONCISE" => Self::SituationConcise,
"ACTION_CONCISE" => Self::ActionConcise,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
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::Situation => serializer.serialize_i32(1),
Self::Action => serializer.serialize_i32(2),
Self::Resolution => serializer.serialize_i32(3),
Self::ReasonForCancellation => serializer.serialize_i32(4),
Self::CustomerSatisfaction => serializer.serialize_i32(5),
Self::Entities => serializer.serialize_i32(6),
Self::CustomerDefined => serializer.serialize_i32(7),
Self::SituationConcise => serializer.serialize_i32(9),
Self::ActionConcise => serializer.serialize_i32(10),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
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.dialogflow.v2.SummarizationSection.Type",
))
}
}
}
/// Summarization context that customer can configure.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SummarizationContext {
/// Optional. List of sections. Note it contains both predefined section sand
/// customer defined sections.
pub summarization_sections: std::vec::Vec<crate::model::SummarizationSection>,
/// Optional. List of few shot examples.
pub few_shot_examples: std::vec::Vec<crate::model::FewShotExample>,
/// Optional. Version of the feature. If not set, default to latest version.
/// Current candidates are ["1.0"].
pub version: std::string::String,
/// Optional. The target language of the generated summary. The language code
/// for conversation will be used if this field is empty. Supported 2.0 and
/// later versions.
pub output_language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl SummarizationContext {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [summarization_sections][crate::model::SummarizationContext::summarization_sections].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarizationContext;
/// use google_cloud_dialogflow_v2::model::SummarizationSection;
/// let x = SummarizationContext::new()
/// .set_summarization_sections([
/// SummarizationSection::default()/* use setters */,
/// SummarizationSection::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_summarization_sections<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SummarizationSection>,
{
use std::iter::Iterator;
self.summarization_sections = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [few_shot_examples][crate::model::SummarizationContext::few_shot_examples].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarizationContext;
/// use google_cloud_dialogflow_v2::model::FewShotExample;
/// let x = SummarizationContext::new()
/// .set_few_shot_examples([
/// FewShotExample::default()/* use setters */,
/// FewShotExample::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_few_shot_examples<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::FewShotExample>,
{
use std::iter::Iterator;
self.few_shot_examples = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [version][crate::model::SummarizationContext::version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarizationContext;
/// let x = SummarizationContext::new().set_version("example");
/// ```
pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.version = v.into();
self
}
/// Sets the value of [output_language_code][crate::model::SummarizationContext::output_language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarizationContext;
/// let x = SummarizationContext::new().set_output_language_code("example");
/// ```
pub fn set_output_language_code<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.output_language_code = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for SummarizationContext {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationContext"
}
}
/// Free form generator context that customer can configure.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FreeFormContext {
/// Optional. Free form text input to LLM.
pub text: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl FreeFormContext {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [text][crate::model::FreeFormContext::text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FreeFormContext;
/// let x = FreeFormContext::new().set_text("example");
/// ```
pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.text = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for FreeFormContext {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.FreeFormContext"
}
}
/// LLM generator.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Generator {
/// Output only. Identifier. The resource name of the generator. Format:
/// `projects/<Project ID>/locations/<Location ID>/generators/<Generator ID>`
pub name: std::string::String,
/// Optional. Human readable description of the generator.
pub description: std::string::String,
/// Optional. Inference parameters for this generator.
pub inference_parameter: std::option::Option<crate::model::InferenceParameter>,
/// Optional. The trigger event of the generator. It defines when the generator
/// is triggered in a conversation.
pub trigger_event: crate::model::TriggerEvent,
/// Output only. Creation time of this generator.
pub create_time: std::option::Option<wkt::Timestamp>,
/// Output only. Update time of this generator.
pub update_time: std::option::Option<wkt::Timestamp>,
/// Optional. Resource names of the tools that the generator can choose from.
/// Format: `projects/<Project ID>/locations/<Location ID>/tools/<tool ID>`.
pub tools: std::vec::Vec<std::string::String>,
/// Optional. Configuration for suggestion deduping. This is only applicable to
/// AI Coach feature.
pub suggestion_deduping_config: std::option::Option<crate::model::SuggestionDedupingConfig>,
/// Optional. List of CES toolset specs that the generator can choose from.
pub toolset_tools: std::vec::Vec<crate::model::ToolsetTool>,
/// Optional. List of CES tool specs that the generator can choose from.
pub ces_tool_specs: std::vec::Vec<crate::model::CesToolSpec>,
/// Optional. List of CES app specs that the generator can choose from.
pub ces_app_specs: std::vec::Vec<crate::model::CesAppSpec>,
/// Required. Input context of the generator.
pub context: std::option::Option<crate::model::generator::Context>,
/// The foundation model to use for generating suggestions. If a foundation
/// model isn't specified here, a model specifically tuned for the feature
/// type (and version when applicable) will be used.
pub foundation_model: std::option::Option<crate::model::generator::FoundationModel>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl Generator {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::Generator::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// let x = Generator::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [description][crate::model::Generator::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// let x = Generator::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
/// Sets the value of [inference_parameter][crate::model::Generator::inference_parameter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use google_cloud_dialogflow_v2::model::InferenceParameter;
/// let x = Generator::new().set_inference_parameter(InferenceParameter::default()/* use setters */);
/// ```
pub fn set_inference_parameter<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::InferenceParameter>,
{
self.inference_parameter = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [inference_parameter][crate::model::Generator::inference_parameter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use google_cloud_dialogflow_v2::model::InferenceParameter;
/// let x = Generator::new().set_or_clear_inference_parameter(Some(InferenceParameter::default()/* use setters */));
/// let x = Generator::new().set_or_clear_inference_parameter(None::<InferenceParameter>);
/// ```
pub fn set_or_clear_inference_parameter<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::InferenceParameter>,
{
self.inference_parameter = v.map(|x| x.into());
self
}
/// Sets the value of [trigger_event][crate::model::Generator::trigger_event].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use google_cloud_dialogflow_v2::model::TriggerEvent;
/// let x0 = Generator::new().set_trigger_event(TriggerEvent::EndOfUtterance);
/// let x1 = Generator::new().set_trigger_event(TriggerEvent::ManualCall);
/// let x2 = Generator::new().set_trigger_event(TriggerEvent::CustomerMessage);
/// ```
pub fn set_trigger_event<T: std::convert::Into<crate::model::TriggerEvent>>(
mut self,
v: T,
) -> Self {
self.trigger_event = v.into();
self
}
/// Sets the value of [create_time][crate::model::Generator::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use wkt::Timestamp;
/// let x = Generator::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::Generator::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use wkt::Timestamp;
/// let x = Generator::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = Generator::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [update_time][crate::model::Generator::update_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use wkt::Timestamp;
/// let x = Generator::new().set_update_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_time][crate::model::Generator::update_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use wkt::Timestamp;
/// let x = Generator::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
/// let x = Generator::new().set_or_clear_update_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [tools][crate::model::Generator::tools].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// let x = Generator::new().set_tools(["a", "b", "c"]);
/// ```
pub fn set_tools<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.tools = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [suggestion_deduping_config][crate::model::Generator::suggestion_deduping_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use google_cloud_dialogflow_v2::model::SuggestionDedupingConfig;
/// let x = Generator::new().set_suggestion_deduping_config(SuggestionDedupingConfig::default()/* use setters */);
/// ```
pub fn set_suggestion_deduping_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SuggestionDedupingConfig>,
{
self.suggestion_deduping_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [suggestion_deduping_config][crate::model::Generator::suggestion_deduping_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use google_cloud_dialogflow_v2::model::SuggestionDedupingConfig;
/// let x = Generator::new().set_or_clear_suggestion_deduping_config(Some(SuggestionDedupingConfig::default()/* use setters */));
/// let x = Generator::new().set_or_clear_suggestion_deduping_config(None::<SuggestionDedupingConfig>);
/// ```
pub fn set_or_clear_suggestion_deduping_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SuggestionDedupingConfig>,
{
self.suggestion_deduping_config = v.map(|x| x.into());
self
}
/// Sets the value of [toolset_tools][crate::model::Generator::toolset_tools].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use google_cloud_dialogflow_v2::model::ToolsetTool;
/// let x = Generator::new()
/// .set_toolset_tools([
/// ToolsetTool::default()/* use setters */,
/// ToolsetTool::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_toolset_tools<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ToolsetTool>,
{
use std::iter::Iterator;
self.toolset_tools = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [ces_tool_specs][crate::model::Generator::ces_tool_specs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use google_cloud_dialogflow_v2::model::CesToolSpec;
/// let x = Generator::new()
/// .set_ces_tool_specs([
/// CesToolSpec::default()/* use setters */,
/// CesToolSpec::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_ces_tool_specs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::CesToolSpec>,
{
use std::iter::Iterator;
self.ces_tool_specs = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [ces_app_specs][crate::model::Generator::ces_app_specs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use google_cloud_dialogflow_v2::model::CesAppSpec;
/// let x = Generator::new()
/// .set_ces_app_specs([
/// CesAppSpec::default()/* use setters */,
/// CesAppSpec::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_ces_app_specs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::CesAppSpec>,
{
use std::iter::Iterator;
self.ces_app_specs = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [context][crate::model::Generator::context].
///
/// Note that all the setters affecting `context` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use google_cloud_dialogflow_v2::model::FreeFormContext;
/// let x = Generator::new().set_context(Some(
/// google_cloud_dialogflow_v2::model::generator::Context::FreeFormContext(FreeFormContext::default().into())));
/// ```
pub fn set_context<
T: std::convert::Into<std::option::Option<crate::model::generator::Context>>,
>(
mut self,
v: T,
) -> Self {
self.context = v.into();
self
}
/// The value of [context][crate::model::Generator::context]
/// if it holds a `FreeFormContext`, `None` if the field is not set or
/// holds a different branch.
pub fn free_form_context(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::FreeFormContext>> {
#[allow(unreachable_patterns)]
self.context.as_ref().and_then(|v| match v {
crate::model::generator::Context::FreeFormContext(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [context][crate::model::Generator::context]
/// to hold a `FreeFormContext`.
///
/// Note that all the setters affecting `context` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use google_cloud_dialogflow_v2::model::FreeFormContext;
/// let x = Generator::new().set_free_form_context(FreeFormContext::default()/* use setters */);
/// assert!(x.free_form_context().is_some());
/// assert!(x.agent_coaching_context().is_none());
/// assert!(x.summarization_context().is_none());
/// ```
pub fn set_free_form_context<
T: std::convert::Into<std::boxed::Box<crate::model::FreeFormContext>>,
>(
mut self,
v: T,
) -> Self {
self.context =
std::option::Option::Some(crate::model::generator::Context::FreeFormContext(v.into()));
self
}
/// The value of [context][crate::model::Generator::context]
/// if it holds a `AgentCoachingContext`, `None` if the field is not set or
/// holds a different branch.
pub fn agent_coaching_context(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::AgentCoachingContext>> {
#[allow(unreachable_patterns)]
self.context.as_ref().and_then(|v| match v {
crate::model::generator::Context::AgentCoachingContext(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [context][crate::model::Generator::context]
/// to hold a `AgentCoachingContext`.
///
/// Note that all the setters affecting `context` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use google_cloud_dialogflow_v2::model::AgentCoachingContext;
/// let x = Generator::new().set_agent_coaching_context(AgentCoachingContext::default()/* use setters */);
/// assert!(x.agent_coaching_context().is_some());
/// assert!(x.free_form_context().is_none());
/// assert!(x.summarization_context().is_none());
/// ```
pub fn set_agent_coaching_context<
T: std::convert::Into<std::boxed::Box<crate::model::AgentCoachingContext>>,
>(
mut self,
v: T,
) -> Self {
self.context = std::option::Option::Some(
crate::model::generator::Context::AgentCoachingContext(v.into()),
);
self
}
/// The value of [context][crate::model::Generator::context]
/// if it holds a `SummarizationContext`, `None` if the field is not set or
/// holds a different branch.
pub fn summarization_context(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SummarizationContext>> {
#[allow(unreachable_patterns)]
self.context.as_ref().and_then(|v| match v {
crate::model::generator::Context::SummarizationContext(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [context][crate::model::Generator::context]
/// to hold a `SummarizationContext`.
///
/// Note that all the setters affecting `context` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use google_cloud_dialogflow_v2::model::SummarizationContext;
/// let x = Generator::new().set_summarization_context(SummarizationContext::default()/* use setters */);
/// assert!(x.summarization_context().is_some());
/// assert!(x.free_form_context().is_none());
/// assert!(x.agent_coaching_context().is_none());
/// ```
pub fn set_summarization_context<
T: std::convert::Into<std::boxed::Box<crate::model::SummarizationContext>>,
>(
mut self,
v: T,
) -> Self {
self.context = std::option::Option::Some(
crate::model::generator::Context::SummarizationContext(v.into()),
);
self
}
/// Sets the value of [foundation_model][crate::model::Generator::foundation_model].
///
/// Note that all the setters affecting `foundation_model` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// use google_cloud_dialogflow_v2::model::generator::FoundationModel;
/// let x = Generator::new().set_foundation_model(Some(FoundationModel::PublishedModel("example".to_string())));
/// ```
pub fn set_foundation_model<
T: std::convert::Into<std::option::Option<crate::model::generator::FoundationModel>>,
>(
mut self,
v: T,
) -> Self {
self.foundation_model = v.into();
self
}
/// The value of [foundation_model][crate::model::Generator::foundation_model]
/// if it holds a `PublishedModel`, `None` if the field is not set or
/// holds a different branch.
pub fn published_model(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.foundation_model.as_ref().and_then(|v| match v {
crate::model::generator::FoundationModel::PublishedModel(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [foundation_model][crate::model::Generator::foundation_model]
/// to hold a `PublishedModel`.
///
/// Note that all the setters affecting `foundation_model` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Generator;
/// let x = Generator::new().set_published_model("example");
/// assert!(x.published_model().is_some());
/// ```
pub fn set_published_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.foundation_model = std::option::Option::Some(
crate::model::generator::FoundationModel::PublishedModel(v.into()),
);
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for Generator {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Generator"
}
}
/// Defines additional types related to [Generator].
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
pub mod generator {
#[allow(unused_imports)]
use super::*;
/// Required. Input context of the generator.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Context {
/// Input of free from generator to LLM.
FreeFormContext(std::boxed::Box<crate::model::FreeFormContext>),
/// Input of prebuilt Agent Coaching feature.
AgentCoachingContext(std::boxed::Box<crate::model::AgentCoachingContext>),
/// Input of prebuilt Summarization feature.
SummarizationContext(std::boxed::Box<crate::model::SummarizationContext>),
}
/// The foundation model to use for generating suggestions. If a foundation
/// model isn't specified here, a model specifically tuned for the feature
/// type (and version when applicable) will be used.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum FoundationModel {
/// Optional. The published Large Language Model name.
///
/// * To use the latest model version, specify the model name without version
/// number. Example: `text-bison`
/// * To use a stable model version, specify the version number as well.
/// Example: `text-bison@002`.
PublishedModel(std::string::String),
}
}
/// Suggestion generated using free form generator.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FreeFormSuggestion {
/// Required. Free form suggestion.
pub response: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl FreeFormSuggestion {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [response][crate::model::FreeFormSuggestion::response].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FreeFormSuggestion;
/// let x = FreeFormSuggestion::new().set_response("example");
/// ```
pub fn set_response<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.response = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for FreeFormSuggestion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.FreeFormSuggestion"
}
}
/// Suggested summary of the conversation.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SummarySuggestion {
/// Required. All the parts of generated summary.
pub summary_sections: std::vec::Vec<crate::model::summary_suggestion::SummarySection>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl SummarySuggestion {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [summary_sections][crate::model::SummarySuggestion::summary_sections].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarySuggestion;
/// use google_cloud_dialogflow_v2::model::summary_suggestion::SummarySection;
/// let x = SummarySuggestion::new()
/// .set_summary_sections([
/// SummarySection::default()/* use setters */,
/// SummarySection::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_summary_sections<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::summary_suggestion::SummarySection>,
{
use std::iter::Iterator;
self.summary_sections = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for SummarySuggestion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarySuggestion"
}
}
/// Defines additional types related to [SummarySuggestion].
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
pub mod summary_suggestion {
#[allow(unused_imports)]
use super::*;
/// A component of the generated summary.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SummarySection {
/// Required. Name of the section.
pub section: std::string::String,
/// Required. Summary text for the section.
pub summary: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl SummarySection {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [section][crate::model::summary_suggestion::SummarySection::section].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summary_suggestion::SummarySection;
/// let x = SummarySection::new().set_section("example");
/// ```
pub fn set_section<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.section = v.into();
self
}
/// Sets the value of [summary][crate::model::summary_suggestion::SummarySection::summary].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summary_suggestion::SummarySection;
/// let x = SummarySection::new().set_summary("example");
/// ```
pub fn set_summary<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.summary = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for SummarySection {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarySuggestion.SummarySection"
}
}
}
/// Suggestion for coaching agents.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AgentCoachingSuggestion {
/// Optional. Instructions applicable based on the current context.
pub applicable_instructions: std::vec::Vec<crate::model::AgentCoachingInstruction>,
/// Optional. Suggested actions for the agent to take.
pub agent_action_suggestions:
std::vec::Vec<crate::model::agent_coaching_suggestion::AgentActionSuggestion>,
/// Optional. Sample response for the Agent.
pub sample_responses: std::vec::Vec<crate::model::agent_coaching_suggestion::SampleResponse>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl AgentCoachingSuggestion {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [applicable_instructions][crate::model::AgentCoachingSuggestion::applicable_instructions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingSuggestion;
/// use google_cloud_dialogflow_v2::model::AgentCoachingInstruction;
/// let x = AgentCoachingSuggestion::new()
/// .set_applicable_instructions([
/// AgentCoachingInstruction::default()/* use setters */,
/// AgentCoachingInstruction::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_applicable_instructions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::AgentCoachingInstruction>,
{
use std::iter::Iterator;
self.applicable_instructions = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [agent_action_suggestions][crate::model::AgentCoachingSuggestion::agent_action_suggestions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingSuggestion;
/// use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::AgentActionSuggestion;
/// let x = AgentCoachingSuggestion::new()
/// .set_agent_action_suggestions([
/// AgentActionSuggestion::default()/* use setters */,
/// AgentActionSuggestion::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_agent_action_suggestions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::agent_coaching_suggestion::AgentActionSuggestion>,
{
use std::iter::Iterator;
self.agent_action_suggestions = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [sample_responses][crate::model::AgentCoachingSuggestion::sample_responses].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AgentCoachingSuggestion;
/// use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::SampleResponse;
/// let x = AgentCoachingSuggestion::new()
/// .set_sample_responses([
/// SampleResponse::default()/* use setters */,
/// SampleResponse::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_sample_responses<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::agent_coaching_suggestion::SampleResponse>,
{
use std::iter::Iterator;
self.sample_responses = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for AgentCoachingSuggestion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentCoachingSuggestion"
}
}
/// Defines additional types related to [AgentCoachingSuggestion].
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
pub mod agent_coaching_suggestion {
#[allow(unused_imports)]
use super::*;
/// Sources for the suggestion.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Sources {
/// Output only. Source instruction indexes for the suggestion. This is the
/// index of the applicable_instructions field.
pub instruction_indexes: std::vec::Vec<i32>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl Sources {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [instruction_indexes][crate::model::agent_coaching_suggestion::Sources::instruction_indexes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::Sources;
/// let x = Sources::new().set_instruction_indexes([1, 2, 3]);
/// ```
pub fn set_instruction_indexes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<i32>,
{
use std::iter::Iterator;
self.instruction_indexes = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for Sources {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentCoachingSuggestion.Sources"
}
}
/// Duplication check for the suggestion.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DuplicateCheckResult {
/// Output only. The duplicate suggestions.
pub duplicate_suggestions: std::vec::Vec<
crate::model::agent_coaching_suggestion::duplicate_check_result::DuplicateSuggestion,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl DuplicateCheckResult {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [duplicate_suggestions][crate::model::agent_coaching_suggestion::DuplicateCheckResult::duplicate_suggestions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::DuplicateCheckResult;
/// use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::duplicate_check_result::DuplicateSuggestion;
/// let x = DuplicateCheckResult::new()
/// .set_duplicate_suggestions([
/// DuplicateSuggestion::default()/* use setters */,
/// DuplicateSuggestion::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_duplicate_suggestions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::agent_coaching_suggestion::duplicate_check_result::DuplicateSuggestion>
{
use std::iter::Iterator;
self.duplicate_suggestions = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for DuplicateCheckResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentCoachingSuggestion.DuplicateCheckResult"
}
}
/// Defines additional types related to [DuplicateCheckResult].
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
pub mod duplicate_check_result {
#[allow(unused_imports)]
use super::*;
/// The duplicate suggestion details.
/// Keeping answer_record and sources together as they are identifiers for
/// duplicate suggestions.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DuplicateSuggestion {
/// Output only. The answer record id of the past duplicate suggestion.
pub answer_record: std::string::String,
/// Output only. Sources for the suggestion.
pub sources: std::option::Option<crate::model::agent_coaching_suggestion::Sources>,
/// Output only. The index of the duplicate suggestion in the past
/// suggestion list.
pub suggestion_index: i32,
/// Output only. The similarity score of between the past and current
/// suggestion.
pub similarity_score: f32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl DuplicateSuggestion {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer_record][crate::model::agent_coaching_suggestion::duplicate_check_result::DuplicateSuggestion::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::duplicate_check_result::DuplicateSuggestion;
/// let x = DuplicateSuggestion::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.answer_record = v.into();
self
}
/// Sets the value of [sources][crate::model::agent_coaching_suggestion::duplicate_check_result::DuplicateSuggestion::sources].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::duplicate_check_result::DuplicateSuggestion;
/// use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::Sources;
/// let x = DuplicateSuggestion::new().set_sources(Sources::default()/* use setters */);
/// ```
pub fn set_sources<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::agent_coaching_suggestion::Sources>,
{
self.sources = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [sources][crate::model::agent_coaching_suggestion::duplicate_check_result::DuplicateSuggestion::sources].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::duplicate_check_result::DuplicateSuggestion;
/// use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::Sources;
/// let x = DuplicateSuggestion::new().set_or_clear_sources(Some(Sources::default()/* use setters */));
/// let x = DuplicateSuggestion::new().set_or_clear_sources(None::<Sources>);
/// ```
pub fn set_or_clear_sources<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::agent_coaching_suggestion::Sources>,
{
self.sources = v.map(|x| x.into());
self
}
/// Sets the value of [suggestion_index][crate::model::agent_coaching_suggestion::duplicate_check_result::DuplicateSuggestion::suggestion_index].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::duplicate_check_result::DuplicateSuggestion;
/// let x = DuplicateSuggestion::new().set_suggestion_index(42);
/// ```
pub fn set_suggestion_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.suggestion_index = v.into();
self
}
/// Sets the value of [similarity_score][crate::model::agent_coaching_suggestion::duplicate_check_result::DuplicateSuggestion::similarity_score].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::duplicate_check_result::DuplicateSuggestion;
/// let x = DuplicateSuggestion::new().set_similarity_score(42.0);
/// ```
pub fn set_similarity_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.similarity_score = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for DuplicateSuggestion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentCoachingSuggestion.DuplicateCheckResult.DuplicateSuggestion"
}
}
}
/// Actions suggested for the agent. This is based on applicable instructions.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AgentActionSuggestion {
/// Optional. The suggested action for the agent.
pub agent_action: std::string::String,
/// Output only. Sources for the agent action suggestion.
pub sources: std::option::Option<crate::model::agent_coaching_suggestion::Sources>,
/// Output only. Duplicate check result for the agent action suggestion.
pub duplicate_check_result:
std::option::Option<crate::model::agent_coaching_suggestion::DuplicateCheckResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl AgentActionSuggestion {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [agent_action][crate::model::agent_coaching_suggestion::AgentActionSuggestion::agent_action].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::AgentActionSuggestion;
/// let x = AgentActionSuggestion::new().set_agent_action("example");
/// ```
pub fn set_agent_action<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.agent_action = v.into();
self
}
/// Sets the value of [sources][crate::model::agent_coaching_suggestion::AgentActionSuggestion::sources].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::AgentActionSuggestion;
/// use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::Sources;
/// let x = AgentActionSuggestion::new().set_sources(Sources::default()/* use setters */);
/// ```
pub fn set_sources<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::agent_coaching_suggestion::Sources>,
{
self.sources = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [sources][crate::model::agent_coaching_suggestion::AgentActionSuggestion::sources].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::AgentActionSuggestion;
/// use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::Sources;
/// let x = AgentActionSuggestion::new().set_or_clear_sources(Some(Sources::default()/* use setters */));
/// let x = AgentActionSuggestion::new().set_or_clear_sources(None::<Sources>);
/// ```
pub fn set_or_clear_sources<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::agent_coaching_suggestion::Sources>,
{
self.sources = v.map(|x| x.into());
self
}
/// Sets the value of [duplicate_check_result][crate::model::agent_coaching_suggestion::AgentActionSuggestion::duplicate_check_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::AgentActionSuggestion;
/// use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::DuplicateCheckResult;
/// let x = AgentActionSuggestion::new().set_duplicate_check_result(DuplicateCheckResult::default()/* use setters */);
/// ```
pub fn set_duplicate_check_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::agent_coaching_suggestion::DuplicateCheckResult>,
{
self.duplicate_check_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [duplicate_check_result][crate::model::agent_coaching_suggestion::AgentActionSuggestion::duplicate_check_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::AgentActionSuggestion;
/// use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::DuplicateCheckResult;
/// let x = AgentActionSuggestion::new().set_or_clear_duplicate_check_result(Some(DuplicateCheckResult::default()/* use setters */));
/// let x = AgentActionSuggestion::new().set_or_clear_duplicate_check_result(None::<DuplicateCheckResult>);
/// ```
pub fn set_or_clear_duplicate_check_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::agent_coaching_suggestion::DuplicateCheckResult>,
{
self.duplicate_check_result = v.map(|x| x.into());
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for AgentActionSuggestion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentCoachingSuggestion.AgentActionSuggestion"
}
}
/// Sample response that the agent can use. This could be based on applicable
/// instructions and ingested data from other systems.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SampleResponse {
/// Optional. Sample response for Agent in text.
pub response_text: std::string::String,
/// Output only. Sources for the Sample Response.
pub sources: std::option::Option<crate::model::agent_coaching_suggestion::Sources>,
/// Output only. Duplicate check result for the sample response.
pub duplicate_check_result:
std::option::Option<crate::model::agent_coaching_suggestion::DuplicateCheckResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl SampleResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [response_text][crate::model::agent_coaching_suggestion::SampleResponse::response_text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::SampleResponse;
/// let x = SampleResponse::new().set_response_text("example");
/// ```
pub fn set_response_text<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.response_text = v.into();
self
}
/// Sets the value of [sources][crate::model::agent_coaching_suggestion::SampleResponse::sources].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::SampleResponse;
/// use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::Sources;
/// let x = SampleResponse::new().set_sources(Sources::default()/* use setters */);
/// ```
pub fn set_sources<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::agent_coaching_suggestion::Sources>,
{
self.sources = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [sources][crate::model::agent_coaching_suggestion::SampleResponse::sources].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::SampleResponse;
/// use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::Sources;
/// let x = SampleResponse::new().set_or_clear_sources(Some(Sources::default()/* use setters */));
/// let x = SampleResponse::new().set_or_clear_sources(None::<Sources>);
/// ```
pub fn set_or_clear_sources<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::agent_coaching_suggestion::Sources>,
{
self.sources = v.map(|x| x.into());
self
}
/// Sets the value of [duplicate_check_result][crate::model::agent_coaching_suggestion::SampleResponse::duplicate_check_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::SampleResponse;
/// use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::DuplicateCheckResult;
/// let x = SampleResponse::new().set_duplicate_check_result(DuplicateCheckResult::default()/* use setters */);
/// ```
pub fn set_duplicate_check_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::agent_coaching_suggestion::DuplicateCheckResult>,
{
self.duplicate_check_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [duplicate_check_result][crate::model::agent_coaching_suggestion::SampleResponse::duplicate_check_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::SampleResponse;
/// use google_cloud_dialogflow_v2::model::agent_coaching_suggestion::DuplicateCheckResult;
/// let x = SampleResponse::new().set_or_clear_duplicate_check_result(Some(DuplicateCheckResult::default()/* use setters */));
/// let x = SampleResponse::new().set_or_clear_duplicate_check_result(None::<DuplicateCheckResult>);
/// ```
pub fn set_or_clear_duplicate_check_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::agent_coaching_suggestion::DuplicateCheckResult>,
{
self.duplicate_check_result = v.map(|x| x.into());
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for SampleResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AgentCoachingSuggestion.SampleResponse"
}
}
}
/// Suggestion generated using a Generator.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GeneratorSuggestion {
/// Optional. List of request and response for tool calls executed.
pub tool_call_info: std::vec::Vec<crate::model::generator_suggestion::ToolCallInfo>,
/// The suggestion could be one of the many types
pub suggestion: std::option::Option<crate::model::generator_suggestion::Suggestion>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl GeneratorSuggestion {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [tool_call_info][crate::model::GeneratorSuggestion::tool_call_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorSuggestion;
/// use google_cloud_dialogflow_v2::model::generator_suggestion::ToolCallInfo;
/// let x = GeneratorSuggestion::new()
/// .set_tool_call_info([
/// ToolCallInfo::default()/* use setters */,
/// ToolCallInfo::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_tool_call_info<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::generator_suggestion::ToolCallInfo>,
{
use std::iter::Iterator;
self.tool_call_info = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [suggestion][crate::model::GeneratorSuggestion::suggestion].
///
/// Note that all the setters affecting `suggestion` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorSuggestion;
/// use google_cloud_dialogflow_v2::model::FreeFormSuggestion;
/// let x = GeneratorSuggestion::new().set_suggestion(Some(
/// google_cloud_dialogflow_v2::model::generator_suggestion::Suggestion::FreeFormSuggestion(FreeFormSuggestion::default().into())));
/// ```
pub fn set_suggestion<
T: std::convert::Into<std::option::Option<crate::model::generator_suggestion::Suggestion>>,
>(
mut self,
v: T,
) -> Self {
self.suggestion = v.into();
self
}
/// The value of [suggestion][crate::model::GeneratorSuggestion::suggestion]
/// if it holds a `FreeFormSuggestion`, `None` if the field is not set or
/// holds a different branch.
pub fn free_form_suggestion(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::FreeFormSuggestion>> {
#[allow(unreachable_patterns)]
self.suggestion.as_ref().and_then(|v| match v {
crate::model::generator_suggestion::Suggestion::FreeFormSuggestion(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [suggestion][crate::model::GeneratorSuggestion::suggestion]
/// to hold a `FreeFormSuggestion`.
///
/// Note that all the setters affecting `suggestion` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorSuggestion;
/// use google_cloud_dialogflow_v2::model::FreeFormSuggestion;
/// let x = GeneratorSuggestion::new().set_free_form_suggestion(FreeFormSuggestion::default()/* use setters */);
/// assert!(x.free_form_suggestion().is_some());
/// assert!(x.summary_suggestion().is_none());
/// assert!(x.agent_coaching_suggestion().is_none());
/// ```
pub fn set_free_form_suggestion<
T: std::convert::Into<std::boxed::Box<crate::model::FreeFormSuggestion>>,
>(
mut self,
v: T,
) -> Self {
self.suggestion = std::option::Option::Some(
crate::model::generator_suggestion::Suggestion::FreeFormSuggestion(v.into()),
);
self
}
/// The value of [suggestion][crate::model::GeneratorSuggestion::suggestion]
/// if it holds a `SummarySuggestion`, `None` if the field is not set or
/// holds a different branch.
pub fn summary_suggestion(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SummarySuggestion>> {
#[allow(unreachable_patterns)]
self.suggestion.as_ref().and_then(|v| match v {
crate::model::generator_suggestion::Suggestion::SummarySuggestion(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [suggestion][crate::model::GeneratorSuggestion::suggestion]
/// to hold a `SummarySuggestion`.
///
/// Note that all the setters affecting `suggestion` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorSuggestion;
/// use google_cloud_dialogflow_v2::model::SummarySuggestion;
/// let x = GeneratorSuggestion::new().set_summary_suggestion(SummarySuggestion::default()/* use setters */);
/// assert!(x.summary_suggestion().is_some());
/// assert!(x.free_form_suggestion().is_none());
/// assert!(x.agent_coaching_suggestion().is_none());
/// ```
pub fn set_summary_suggestion<
T: std::convert::Into<std::boxed::Box<crate::model::SummarySuggestion>>,
>(
mut self,
v: T,
) -> Self {
self.suggestion = std::option::Option::Some(
crate::model::generator_suggestion::Suggestion::SummarySuggestion(v.into()),
);
self
}
/// The value of [suggestion][crate::model::GeneratorSuggestion::suggestion]
/// if it holds a `AgentCoachingSuggestion`, `None` if the field is not set or
/// holds a different branch.
pub fn agent_coaching_suggestion(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::AgentCoachingSuggestion>> {
#[allow(unreachable_patterns)]
self.suggestion.as_ref().and_then(|v| match v {
crate::model::generator_suggestion::Suggestion::AgentCoachingSuggestion(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [suggestion][crate::model::GeneratorSuggestion::suggestion]
/// to hold a `AgentCoachingSuggestion`.
///
/// Note that all the setters affecting `suggestion` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorSuggestion;
/// use google_cloud_dialogflow_v2::model::AgentCoachingSuggestion;
/// let x = GeneratorSuggestion::new().set_agent_coaching_suggestion(AgentCoachingSuggestion::default()/* use setters */);
/// assert!(x.agent_coaching_suggestion().is_some());
/// assert!(x.free_form_suggestion().is_none());
/// assert!(x.summary_suggestion().is_none());
/// ```
pub fn set_agent_coaching_suggestion<
T: std::convert::Into<std::boxed::Box<crate::model::AgentCoachingSuggestion>>,
>(
mut self,
v: T,
) -> Self {
self.suggestion = std::option::Option::Some(
crate::model::generator_suggestion::Suggestion::AgentCoachingSuggestion(v.into()),
);
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for GeneratorSuggestion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GeneratorSuggestion"
}
}
/// Defines additional types related to [GeneratorSuggestion].
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
pub mod generator_suggestion {
#[allow(unused_imports)]
use super::*;
/// Request and response for a tool call.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ToolCallInfo {
/// Required. Request for a tool call.
pub tool_call: std::option::Option<crate::model::ToolCall>,
/// Required. Response for a tool call.
pub tool_call_result: std::option::Option<crate::model::ToolCallResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl ToolCallInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [tool_call][crate::model::generator_suggestion::ToolCallInfo::tool_call].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_suggestion::ToolCallInfo;
/// use google_cloud_dialogflow_v2::model::ToolCall;
/// let x = ToolCallInfo::new().set_tool_call(ToolCall::default()/* use setters */);
/// ```
pub fn set_tool_call<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ToolCall>,
{
self.tool_call = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tool_call][crate::model::generator_suggestion::ToolCallInfo::tool_call].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_suggestion::ToolCallInfo;
/// use google_cloud_dialogflow_v2::model::ToolCall;
/// let x = ToolCallInfo::new().set_or_clear_tool_call(Some(ToolCall::default()/* use setters */));
/// let x = ToolCallInfo::new().set_or_clear_tool_call(None::<ToolCall>);
/// ```
pub fn set_or_clear_tool_call<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ToolCall>,
{
self.tool_call = v.map(|x| x.into());
self
}
/// Sets the value of [tool_call_result][crate::model::generator_suggestion::ToolCallInfo::tool_call_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_suggestion::ToolCallInfo;
/// use google_cloud_dialogflow_v2::model::ToolCallResult;
/// let x = ToolCallInfo::new().set_tool_call_result(ToolCallResult::default()/* use setters */);
/// ```
pub fn set_tool_call_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ToolCallResult>,
{
self.tool_call_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tool_call_result][crate::model::generator_suggestion::ToolCallInfo::tool_call_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_suggestion::ToolCallInfo;
/// use google_cloud_dialogflow_v2::model::ToolCallResult;
/// let x = ToolCallInfo::new().set_or_clear_tool_call_result(Some(ToolCallResult::default()/* use setters */));
/// let x = ToolCallInfo::new().set_or_clear_tool_call_result(None::<ToolCallResult>);
/// ```
pub fn set_or_clear_tool_call_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ToolCallResult>,
{
self.tool_call_result = v.map(|x| x.into());
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for ToolCallInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GeneratorSuggestion.ToolCallInfo"
}
}
/// The suggestion could be one of the many types
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Suggestion {
/// Optional. Free form suggestion.
FreeFormSuggestion(std::boxed::Box<crate::model::FreeFormSuggestion>),
/// Optional. Suggested summary.
SummarySuggestion(std::boxed::Box<crate::model::SummarySuggestion>),
/// Optional. Suggestion to coach the agent.
AgentCoachingSuggestion(std::boxed::Box<crate::model::AgentCoachingSuggestion>),
}
}
/// Config for suggestion deduping.
/// NEXT_ID: 3
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestionDedupingConfig {
/// Optional. Whether to enable suggestion deduping.
pub enable_deduping: bool,
/// Optional. The threshold for similarity between two suggestions.
/// Acceptable value is [0.0, 1.0], default to 0.8
pub similarity_threshold: f32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl SuggestionDedupingConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [enable_deduping][crate::model::SuggestionDedupingConfig::enable_deduping].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionDedupingConfig;
/// let x = SuggestionDedupingConfig::new().set_enable_deduping(true);
/// ```
pub fn set_enable_deduping<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_deduping = v.into();
self
}
/// Sets the value of [similarity_threshold][crate::model::SuggestionDedupingConfig::similarity_threshold].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionDedupingConfig;
/// let x = SuggestionDedupingConfig::new().set_similarity_threshold(42.0);
/// ```
pub fn set_similarity_threshold<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.similarity_threshold = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for SuggestionDedupingConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestionDedupingConfig"
}
}
/// Settings for Responsible AI checks.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RaiSettings {
/// Configuration for a set of RAI categories.
pub rai_category_configs: std::vec::Vec<crate::model::rai_settings::RaiCategoryConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl RaiSettings {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [rai_category_configs][crate::model::RaiSettings::rai_category_configs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::RaiSettings;
/// use google_cloud_dialogflow_v2::model::rai_settings::RaiCategoryConfig;
/// let x = RaiSettings::new()
/// .set_rai_category_configs([
/// RaiCategoryConfig::default()/* use setters */,
/// RaiCategoryConfig::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_rai_category_configs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::rai_settings::RaiCategoryConfig>,
{
use std::iter::Iterator;
self.rai_category_configs = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for RaiSettings {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.RaiSettings"
}
}
/// Defines additional types related to [RaiSettings].
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod rai_settings {
#[allow(unused_imports)]
use super::*;
/// Configuration for a specific RAI category.
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RaiCategoryConfig {
/// Optional. The RAI category.
pub category: crate::model::rai_settings::rai_category_config::RaiCategory,
/// Optional. The sensitivity level for this category.
pub sensitivity_level: crate::model::rai_settings::rai_category_config::SensitivityLevel,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl RaiCategoryConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [category][crate::model::rai_settings::RaiCategoryConfig::category].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::rai_settings::RaiCategoryConfig;
/// use google_cloud_dialogflow_v2::model::rai_settings::rai_category_config::RaiCategory;
/// let x0 = RaiCategoryConfig::new().set_category(RaiCategory::DangerousContent);
/// let x1 = RaiCategoryConfig::new().set_category(RaiCategory::SexuallyExplicit);
/// let x2 = RaiCategoryConfig::new().set_category(RaiCategory::Harassment);
/// ```
pub fn set_category<
T: std::convert::Into<crate::model::rai_settings::rai_category_config::RaiCategory>,
>(
mut self,
v: T,
) -> Self {
self.category = v.into();
self
}
/// Sets the value of [sensitivity_level][crate::model::rai_settings::RaiCategoryConfig::sensitivity_level].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::rai_settings::RaiCategoryConfig;
/// use google_cloud_dialogflow_v2::model::rai_settings::rai_category_config::SensitivityLevel;
/// let x0 = RaiCategoryConfig::new().set_sensitivity_level(SensitivityLevel::BlockMost);
/// let x1 = RaiCategoryConfig::new().set_sensitivity_level(SensitivityLevel::BlockSome);
/// let x2 = RaiCategoryConfig::new().set_sensitivity_level(SensitivityLevel::BlockFew);
/// ```
pub fn set_sensitivity_level<
T: std::convert::Into<crate::model::rai_settings::rai_category_config::SensitivityLevel>,
>(
mut self,
v: T,
) -> Self {
self.sensitivity_level = v.into();
self
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl wkt::message::Message for RaiCategoryConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.RaiSettings.RaiCategoryConfig"
}
}
/// Defines additional types related to [RaiCategoryConfig].
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod rai_category_config {
#[allow(unused_imports)]
use super::*;
/// Enum for RAI category.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RaiCategory {
/// Default value.
Unspecified,
/// Dangerous content.
DangerousContent,
/// Sexually explicit content.
SexuallyExplicit,
/// Harassment content.
Harassment,
/// Hate speech content.
HateSpeech,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [RaiCategory::value] or
/// [RaiCategory::name].
UnknownValue(rai_category::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod rai_category {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl RaiCategory {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::DangerousContent => std::option::Option::Some(1),
Self::SexuallyExplicit => std::option::Option::Some(2),
Self::Harassment => std::option::Option::Some(3),
Self::HateSpeech => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("RAI_CATEGORY_UNSPECIFIED"),
Self::DangerousContent => std::option::Option::Some("DANGEROUS_CONTENT"),
Self::SexuallyExplicit => std::option::Option::Some("SEXUALLY_EXPLICIT"),
Self::Harassment => std::option::Option::Some("HARASSMENT"),
Self::HateSpeech => std::option::Option::Some("HATE_SPEECH"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::default::Default for RaiCategory {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::fmt::Display for RaiCategory {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::convert::From<i32> for RaiCategory {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::DangerousContent,
2 => Self::SexuallyExplicit,
3 => Self::Harassment,
4 => Self::HateSpeech,
_ => Self::UnknownValue(rai_category::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::convert::From<&str> for RaiCategory {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"RAI_CATEGORY_UNSPECIFIED" => Self::Unspecified,
"DANGEROUS_CONTENT" => Self::DangerousContent,
"SEXUALLY_EXPLICIT" => Self::SexuallyExplicit,
"HARASSMENT" => Self::Harassment,
"HATE_SPEECH" => Self::HateSpeech,
_ => Self::UnknownValue(rai_category::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl serde::ser::Serialize for RaiCategory {
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::DangerousContent => serializer.serialize_i32(1),
Self::SexuallyExplicit => serializer.serialize_i32(2),
Self::Harassment => serializer.serialize_i32(3),
Self::HateSpeech => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl<'de> serde::de::Deserialize<'de> for RaiCategory {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<RaiCategory>::new(
".google.cloud.dialogflow.v2.RaiSettings.RaiCategoryConfig.RaiCategory",
))
}
}
/// Enum for user-configurable sensitivity levels.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SensitivityLevel {
/// Default value.
/// If unspecified, the default behavior is:
///
/// - DANGEROUS_CONTENT: BLOCK_FEW
/// - SEXUALLY_EXPLICIT: BLOCK_SOME
/// - HARASSMENT: BLOCK_SOME
/// - HATE_SPEECH: BLOCK_SOME
Unspecified,
/// Block most potentially sensitive responses.
BlockMost,
/// Block some potentially sensitive responses.
BlockSome,
/// Block a few potentially sensitive responses.
BlockFew,
/// No filtering for this category.
BlockNone,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [SensitivityLevel::value] or
/// [SensitivityLevel::name].
UnknownValue(sensitivity_level::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
pub mod sensitivity_level {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl SensitivityLevel {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::BlockMost => std::option::Option::Some(1),
Self::BlockSome => std::option::Option::Some(2),
Self::BlockFew => std::option::Option::Some(3),
Self::BlockNone => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SENSITIVITY_LEVEL_UNSPECIFIED"),
Self::BlockMost => std::option::Option::Some("BLOCK_MOST"),
Self::BlockSome => std::option::Option::Some("BLOCK_SOME"),
Self::BlockFew => std::option::Option::Some("BLOCK_FEW"),
Self::BlockNone => std::option::Option::Some("BLOCK_NONE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::default::Default for SensitivityLevel {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::fmt::Display for SensitivityLevel {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::convert::From<i32> for SensitivityLevel {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::BlockMost,
2 => Self::BlockSome,
3 => Self::BlockFew,
4 => Self::BlockNone,
_ => Self::UnknownValue(sensitivity_level::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl std::convert::From<&str> for SensitivityLevel {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SENSITIVITY_LEVEL_UNSPECIFIED" => Self::Unspecified,
"BLOCK_MOST" => Self::BlockMost,
"BLOCK_SOME" => Self::BlockSome,
"BLOCK_FEW" => Self::BlockFew,
"BLOCK_NONE" => Self::BlockNone,
_ => Self::UnknownValue(sensitivity_level::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl serde::ser::Serialize for SensitivityLevel {
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::BlockMost => serializer.serialize_i32(1),
Self::BlockSome => serializer.serialize_i32(2),
Self::BlockFew => serializer.serialize_i32(3),
Self::BlockNone => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(feature = "conversation-profiles", feature = "conversations",))]
impl<'de> serde::de::Deserialize<'de> for SensitivityLevel {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SensitivityLevel>::new(
".google.cloud.dialogflow.v2.RaiSettings.RaiCategoryConfig.SensitivityLevel",
))
}
}
}
}
/// Request of CreateGeneratorEvaluation.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateGeneratorEvaluationRequest {
/// Required. The generator resource name. Format:
/// `projects/<Project ID>/locations/<Location ID>/generators/<Generator ID>`
pub parent: std::string::String,
/// Required. The generator evaluation to be created.
pub generator_evaluation: std::option::Option<crate::model::GeneratorEvaluation>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl CreateGeneratorEvaluationRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateGeneratorEvaluationRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateGeneratorEvaluationRequest;
/// let x = CreateGeneratorEvaluationRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [generator_evaluation][crate::model::CreateGeneratorEvaluationRequest::generator_evaluation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateGeneratorEvaluationRequest;
/// use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// let x = CreateGeneratorEvaluationRequest::new().set_generator_evaluation(GeneratorEvaluation::default()/* use setters */);
/// ```
pub fn set_generator_evaluation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GeneratorEvaluation>,
{
self.generator_evaluation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [generator_evaluation][crate::model::CreateGeneratorEvaluationRequest::generator_evaluation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateGeneratorEvaluationRequest;
/// use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// let x = CreateGeneratorEvaluationRequest::new().set_or_clear_generator_evaluation(Some(GeneratorEvaluation::default()/* use setters */));
/// let x = CreateGeneratorEvaluationRequest::new().set_or_clear_generator_evaluation(None::<GeneratorEvaluation>);
/// ```
pub fn set_or_clear_generator_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GeneratorEvaluation>,
{
self.generator_evaluation = v.map(|x| x.into());
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for CreateGeneratorEvaluationRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateGeneratorEvaluationRequest"
}
}
/// Request of GetGeneratorEvaluation.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetGeneratorEvaluationRequest {
/// Required. The generator evaluation resource name. Format:
/// `projects/<Project ID>/locations/<Location ID>/generators/<Generator
/// ID>/evaluations/<Evaluation ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl GetGeneratorEvaluationRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetGeneratorEvaluationRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetGeneratorEvaluationRequest;
/// let x = GetGeneratorEvaluationRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for GetGeneratorEvaluationRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetGeneratorEvaluationRequest"
}
}
/// Request of ListGeneratorEvaluations.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListGeneratorEvaluationsRequest {
/// Required. The generator resource name. Format:
/// `projects/<Project ID>/locations/<Location ID>/generators/<Generator ID>`
/// Wildcard value `-` is supported on generator_id to list evaluations across
/// all generators under same project.
pub parent: std::string::String,
/// Optional. Maximum number of evaluations to return in a
/// single page. By default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl ListGeneratorEvaluationsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListGeneratorEvaluationsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListGeneratorEvaluationsRequest;
/// let x = ListGeneratorEvaluationsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListGeneratorEvaluationsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListGeneratorEvaluationsRequest;
/// let x = ListGeneratorEvaluationsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListGeneratorEvaluationsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListGeneratorEvaluationsRequest;
/// let x = ListGeneratorEvaluationsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for ListGeneratorEvaluationsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListGeneratorEvaluationsRequest"
}
}
/// Response of ListGeneratorEvaluations.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListGeneratorEvaluationsResponse {
/// The list of evaluations to return.
pub generator_evaluations: std::vec::Vec<crate::model::GeneratorEvaluation>,
/// Token to retrieve the next page of results, or empty if there are no more
/// results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl ListGeneratorEvaluationsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [generator_evaluations][crate::model::ListGeneratorEvaluationsResponse::generator_evaluations].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListGeneratorEvaluationsResponse;
/// use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// let x = ListGeneratorEvaluationsResponse::new()
/// .set_generator_evaluations([
/// GeneratorEvaluation::default()/* use setters */,
/// GeneratorEvaluation::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_generator_evaluations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::GeneratorEvaluation>,
{
use std::iter::Iterator;
self.generator_evaluations = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListGeneratorEvaluationsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListGeneratorEvaluationsResponse;
/// let x = ListGeneratorEvaluationsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for ListGeneratorEvaluationsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListGeneratorEvaluationsResponse"
}
}
#[cfg(feature = "generator-evaluations")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListGeneratorEvaluationsResponse {
type PageItem = crate::model::GeneratorEvaluation;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.generator_evaluations
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Request of DeleteGeneratorEvaluation.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteGeneratorEvaluationRequest {
/// Required. The generator evaluation resource name. Format:
/// `projects/<Project ID>/locations/<Location ID>/generators/<Generator ID>/
/// evaluations/<Evaluation ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl DeleteGeneratorEvaluationRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteGeneratorEvaluationRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteGeneratorEvaluationRequest;
/// let x = DeleteGeneratorEvaluationRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for DeleteGeneratorEvaluationRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteGeneratorEvaluationRequest"
}
}
/// Represents evaluation result of a generator.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GeneratorEvaluation {
/// Output only. Identifier. The resource name of the evaluation. Format:
/// `projects/<Project ID>/locations/<Location ID>/generators/<Generator ID>/
/// evaluations/<Evaluation ID>`
pub name: std::string::String,
/// Optional. The display name of the generator evaluation. At most 64 bytes
/// long.
pub display_name: std::string::String,
/// Required. The configuration of the evaluation task.
pub generator_evaluation_config: std::option::Option<crate::model::GeneratorEvaluationConfig>,
/// Output only. Creation time of this generator evaluation.
pub create_time: std::option::Option<wkt::Timestamp>,
/// Output only. Completion time of this generator evaluation.
pub complete_time: std::option::Option<wkt::Timestamp>,
/// Required. The initial generator that was used when creating this
/// evaluation. This is a copy of the generator read from storage when creating
/// the evaluation.
pub initial_generator: std::option::Option<crate::model::Generator>,
/// Output only. The result status of the evaluation pipeline. Provides the
/// status information including if the evaluation is still in progress,
/// completed or failed with certain error and user actionable message.
pub evaluation_status: std::option::Option<crate::model::EvaluationStatus>,
/// Output only. A read only boolean field reflecting Zone Separation
/// status of the model. The field is an aggregated
/// value of ZS status of its underlying dependencies. See more details in
/// go/zicy-resource-placement#resource-status
pub satisfies_pzs: std::option::Option<bool>,
/// Output only. A read only boolean field reflecting Zone Isolation status
/// of the model. The field is an aggregated value of
/// ZI status of its underlying dependencies. See more details in
/// go/zicy-resource-placement#resource-status
pub satisfies_pzi: std::option::Option<bool>,
/// Metrics details.
pub metrics: std::option::Option<crate::model::generator_evaluation::Metrics>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl GeneratorEvaluation {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GeneratorEvaluation::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// let x = GeneratorEvaluation::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [display_name][crate::model::GeneratorEvaluation::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// let x = GeneratorEvaluation::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [generator_evaluation_config][crate::model::GeneratorEvaluation::generator_evaluation_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// use google_cloud_dialogflow_v2::model::GeneratorEvaluationConfig;
/// let x = GeneratorEvaluation::new().set_generator_evaluation_config(GeneratorEvaluationConfig::default()/* use setters */);
/// ```
pub fn set_generator_evaluation_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GeneratorEvaluationConfig>,
{
self.generator_evaluation_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [generator_evaluation_config][crate::model::GeneratorEvaluation::generator_evaluation_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// use google_cloud_dialogflow_v2::model::GeneratorEvaluationConfig;
/// let x = GeneratorEvaluation::new().set_or_clear_generator_evaluation_config(Some(GeneratorEvaluationConfig::default()/* use setters */));
/// let x = GeneratorEvaluation::new().set_or_clear_generator_evaluation_config(None::<GeneratorEvaluationConfig>);
/// ```
pub fn set_or_clear_generator_evaluation_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GeneratorEvaluationConfig>,
{
self.generator_evaluation_config = v.map(|x| x.into());
self
}
/// Sets the value of [create_time][crate::model::GeneratorEvaluation::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// use wkt::Timestamp;
/// let x = GeneratorEvaluation::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::GeneratorEvaluation::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// use wkt::Timestamp;
/// let x = GeneratorEvaluation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = GeneratorEvaluation::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [complete_time][crate::model::GeneratorEvaluation::complete_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// use wkt::Timestamp;
/// let x = GeneratorEvaluation::new().set_complete_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_complete_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.complete_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [complete_time][crate::model::GeneratorEvaluation::complete_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// use wkt::Timestamp;
/// let x = GeneratorEvaluation::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
/// let x = GeneratorEvaluation::new().set_or_clear_complete_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.complete_time = v.map(|x| x.into());
self
}
/// Sets the value of [initial_generator][crate::model::GeneratorEvaluation::initial_generator].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// use google_cloud_dialogflow_v2::model::Generator;
/// let x = GeneratorEvaluation::new().set_initial_generator(Generator::default()/* use setters */);
/// ```
pub fn set_initial_generator<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Generator>,
{
self.initial_generator = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [initial_generator][crate::model::GeneratorEvaluation::initial_generator].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// use google_cloud_dialogflow_v2::model::Generator;
/// let x = GeneratorEvaluation::new().set_or_clear_initial_generator(Some(Generator::default()/* use setters */));
/// let x = GeneratorEvaluation::new().set_or_clear_initial_generator(None::<Generator>);
/// ```
pub fn set_or_clear_initial_generator<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Generator>,
{
self.initial_generator = v.map(|x| x.into());
self
}
/// Sets the value of [evaluation_status][crate::model::GeneratorEvaluation::evaluation_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// use google_cloud_dialogflow_v2::model::EvaluationStatus;
/// let x = GeneratorEvaluation::new().set_evaluation_status(EvaluationStatus::default()/* use setters */);
/// ```
pub fn set_evaluation_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EvaluationStatus>,
{
self.evaluation_status = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [evaluation_status][crate::model::GeneratorEvaluation::evaluation_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// use google_cloud_dialogflow_v2::model::EvaluationStatus;
/// let x = GeneratorEvaluation::new().set_or_clear_evaluation_status(Some(EvaluationStatus::default()/* use setters */));
/// let x = GeneratorEvaluation::new().set_or_clear_evaluation_status(None::<EvaluationStatus>);
/// ```
pub fn set_or_clear_evaluation_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EvaluationStatus>,
{
self.evaluation_status = v.map(|x| x.into());
self
}
/// Sets the value of [satisfies_pzs][crate::model::GeneratorEvaluation::satisfies_pzs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// let x = GeneratorEvaluation::new().set_satisfies_pzs(true);
/// ```
pub fn set_satisfies_pzs<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzs = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [satisfies_pzs][crate::model::GeneratorEvaluation::satisfies_pzs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// let x = GeneratorEvaluation::new().set_or_clear_satisfies_pzs(Some(false));
/// let x = GeneratorEvaluation::new().set_or_clear_satisfies_pzs(None::<bool>);
/// ```
pub fn set_or_clear_satisfies_pzs<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzs = v.map(|x| x.into());
self
}
/// Sets the value of [satisfies_pzi][crate::model::GeneratorEvaluation::satisfies_pzi].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// let x = GeneratorEvaluation::new().set_satisfies_pzi(true);
/// ```
pub fn set_satisfies_pzi<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzi = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [satisfies_pzi][crate::model::GeneratorEvaluation::satisfies_pzi].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// let x = GeneratorEvaluation::new().set_or_clear_satisfies_pzi(Some(false));
/// let x = GeneratorEvaluation::new().set_or_clear_satisfies_pzi(None::<bool>);
/// ```
pub fn set_or_clear_satisfies_pzi<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzi = v.map(|x| x.into());
self
}
/// Sets the value of [metrics][crate::model::GeneratorEvaluation::metrics].
///
/// Note that all the setters affecting `metrics` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// use google_cloud_dialogflow_v2::model::SummarizationEvaluationMetrics;
/// let x = GeneratorEvaluation::new().set_metrics(Some(
/// google_cloud_dialogflow_v2::model::generator_evaluation::Metrics::SummarizationMetrics(SummarizationEvaluationMetrics::default().into())));
/// ```
pub fn set_metrics<
T: std::convert::Into<std::option::Option<crate::model::generator_evaluation::Metrics>>,
>(
mut self,
v: T,
) -> Self {
self.metrics = v.into();
self
}
/// The value of [metrics][crate::model::GeneratorEvaluation::metrics]
/// if it holds a `SummarizationMetrics`, `None` if the field is not set or
/// holds a different branch.
pub fn summarization_metrics(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SummarizationEvaluationMetrics>> {
#[allow(unreachable_patterns)]
self.metrics.as_ref().and_then(|v| match v {
crate::model::generator_evaluation::Metrics::SummarizationMetrics(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [metrics][crate::model::GeneratorEvaluation::metrics]
/// to hold a `SummarizationMetrics`.
///
/// Note that all the setters affecting `metrics` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluation;
/// use google_cloud_dialogflow_v2::model::SummarizationEvaluationMetrics;
/// let x = GeneratorEvaluation::new().set_summarization_metrics(SummarizationEvaluationMetrics::default()/* use setters */);
/// assert!(x.summarization_metrics().is_some());
/// ```
pub fn set_summarization_metrics<
T: std::convert::Into<std::boxed::Box<crate::model::SummarizationEvaluationMetrics>>,
>(
mut self,
v: T,
) -> Self {
self.metrics = std::option::Option::Some(
crate::model::generator_evaluation::Metrics::SummarizationMetrics(v.into()),
);
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for GeneratorEvaluation {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GeneratorEvaluation"
}
}
/// Defines additional types related to [GeneratorEvaluation].
#[cfg(feature = "generator-evaluations")]
pub mod generator_evaluation {
#[allow(unused_imports)]
use super::*;
/// Metrics details.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Metrics {
/// Output only. Only available when the summarization generator is provided.
SummarizationMetrics(std::boxed::Box<crate::model::SummarizationEvaluationMetrics>),
}
}
/// Evaluation metrics for summarization generator.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SummarizationEvaluationMetrics {
/// Output only. A list of evaluation results per conversation(&summary),
/// metric and section.
pub summarization_evaluation_results: std::vec::Vec<
crate::model::summarization_evaluation_metrics::SummarizationEvaluationResult,
>,
/// Output only. User bucket uri for merged evaluation score and aggregation
/// score csv.
pub summarization_evaluation_merged_results_uri: std::string::String,
/// Output only. A list of aggregated(average) scores per metric section.
pub overall_metrics:
std::vec::Vec<crate::model::summarization_evaluation_metrics::OverallScoresByMetric>,
/// Output only. Overall token per section. This is an aggregated(sum) result
/// of input token of summary acorss all conversations that are selected for
/// summarization evaluation.
pub overall_section_tokens:
std::vec::Vec<crate::model::summarization_evaluation_metrics::SectionToken>,
/// Output only. List of conversation details.
pub conversation_details:
std::vec::Vec<crate::model::summarization_evaluation_metrics::ConversationDetail>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl SummarizationEvaluationMetrics {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [summarization_evaluation_results][crate::model::SummarizationEvaluationMetrics::summarization_evaluation_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarizationEvaluationMetrics;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::SummarizationEvaluationResult;
/// let x = SummarizationEvaluationMetrics::new()
/// .set_summarization_evaluation_results([
/// SummarizationEvaluationResult::default()/* use setters */,
/// SummarizationEvaluationResult::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_summarization_evaluation_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::summarization_evaluation_metrics::SummarizationEvaluationResult,
>,
{
use std::iter::Iterator;
self.summarization_evaluation_results = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [summarization_evaluation_merged_results_uri][crate::model::SummarizationEvaluationMetrics::summarization_evaluation_merged_results_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarizationEvaluationMetrics;
/// let x = SummarizationEvaluationMetrics::new().set_summarization_evaluation_merged_results_uri("example");
/// ```
pub fn set_summarization_evaluation_merged_results_uri<
T: std::convert::Into<std::string::String>,
>(
mut self,
v: T,
) -> Self {
self.summarization_evaluation_merged_results_uri = v.into();
self
}
/// Sets the value of [overall_metrics][crate::model::SummarizationEvaluationMetrics::overall_metrics].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarizationEvaluationMetrics;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::OverallScoresByMetric;
/// let x = SummarizationEvaluationMetrics::new()
/// .set_overall_metrics([
/// OverallScoresByMetric::default()/* use setters */,
/// OverallScoresByMetric::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_overall_metrics<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::summarization_evaluation_metrics::OverallScoresByMetric,
>,
{
use std::iter::Iterator;
self.overall_metrics = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [overall_section_tokens][crate::model::SummarizationEvaluationMetrics::overall_section_tokens].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarizationEvaluationMetrics;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::SectionToken;
/// let x = SummarizationEvaluationMetrics::new()
/// .set_overall_section_tokens([
/// SectionToken::default()/* use setters */,
/// SectionToken::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_overall_section_tokens<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::summarization_evaluation_metrics::SectionToken>,
{
use std::iter::Iterator;
self.overall_section_tokens = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [conversation_details][crate::model::SummarizationEvaluationMetrics::conversation_details].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SummarizationEvaluationMetrics;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::ConversationDetail;
/// let x = SummarizationEvaluationMetrics::new()
/// .set_conversation_details([
/// ConversationDetail::default()/* use setters */,
/// ConversationDetail::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_conversation_details<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::summarization_evaluation_metrics::ConversationDetail>,
{
use std::iter::Iterator;
self.conversation_details = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for SummarizationEvaluationMetrics {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationEvaluationMetrics"
}
}
/// Defines additional types related to [SummarizationEvaluationMetrics].
#[cfg(feature = "generator-evaluations")]
pub mod summarization_evaluation_metrics {
#[allow(unused_imports)]
use super::*;
/// Decomposition details for accuracy.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AccuracyDecomposition {
/// Output only. The breakdown point of the summary.
pub point: std::string::String,
/// Output only. The accuracy reasoning of the breakdown point.
pub accuracy_reasoning: std::string::String,
/// Output only. Whether the breakdown point is accurate or not.
pub is_accurate: std::option::Option<bool>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl AccuracyDecomposition {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [point][crate::model::summarization_evaluation_metrics::AccuracyDecomposition::point].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AccuracyDecomposition;
/// let x = AccuracyDecomposition::new().set_point("example");
/// ```
pub fn set_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.point = v.into();
self
}
/// Sets the value of [accuracy_reasoning][crate::model::summarization_evaluation_metrics::AccuracyDecomposition::accuracy_reasoning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AccuracyDecomposition;
/// let x = AccuracyDecomposition::new().set_accuracy_reasoning("example");
/// ```
pub fn set_accuracy_reasoning<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.accuracy_reasoning = v.into();
self
}
/// Sets the value of [is_accurate][crate::model::summarization_evaluation_metrics::AccuracyDecomposition::is_accurate].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AccuracyDecomposition;
/// let x = AccuracyDecomposition::new().set_is_accurate(true);
/// ```
pub fn set_is_accurate<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.is_accurate = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [is_accurate][crate::model::summarization_evaluation_metrics::AccuracyDecomposition::is_accurate].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AccuracyDecomposition;
/// let x = AccuracyDecomposition::new().set_or_clear_is_accurate(Some(false));
/// let x = AccuracyDecomposition::new().set_or_clear_is_accurate(None::<bool>);
/// ```
pub fn set_or_clear_is_accurate<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.is_accurate = v.map(|x| x.into());
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for AccuracyDecomposition {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationEvaluationMetrics.AccuracyDecomposition"
}
}
/// Decomposition details for adherence.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
#[deprecated]
pub struct AdherenceDecomposition {
/// Output only. The breakdown point of the given instructions.
pub point: std::string::String,
/// Output only. The adherence reasoning of the breakdown point.
pub adherence_reasoning: std::string::String,
/// Output only. Whether the breakdown point is adherent or not.
pub is_adherent: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl AdherenceDecomposition {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [point][crate::model::summarization_evaluation_metrics::AdherenceDecomposition::point].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AdherenceDecomposition;
/// let x = AdherenceDecomposition::new().set_point("example");
/// ```
pub fn set_point<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.point = v.into();
self
}
/// Sets the value of [adherence_reasoning][crate::model::summarization_evaluation_metrics::AdherenceDecomposition::adherence_reasoning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AdherenceDecomposition;
/// let x = AdherenceDecomposition::new().set_adherence_reasoning("example");
/// ```
pub fn set_adherence_reasoning<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.adherence_reasoning = v.into();
self
}
/// Sets the value of [is_adherent][crate::model::summarization_evaluation_metrics::AdherenceDecomposition::is_adherent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AdherenceDecomposition;
/// let x = AdherenceDecomposition::new().set_is_adherent(true);
/// ```
pub fn set_is_adherent<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.is_adherent = v.into();
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for AdherenceDecomposition {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationEvaluationMetrics.AdherenceDecomposition"
}
}
/// Rubric result of the adherence evaluation. A rubric is ued to determine
/// if the summary adheres to all aspects of the given instructions.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AdherenceRubric {
/// Output only. The question generated from instruction that used to
/// evaluate summary.
pub question: std::string::String,
/// Output only. The reasoning of the rubric question is addressed or not.
pub reasoning: std::string::String,
/// Output only. A boolean that indicates whether the rubric question is
/// addressed or not.
pub is_addressed: std::option::Option<bool>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl AdherenceRubric {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [question][crate::model::summarization_evaluation_metrics::AdherenceRubric::question].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AdherenceRubric;
/// let x = AdherenceRubric::new().set_question("example");
/// ```
pub fn set_question<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.question = v.into();
self
}
/// Sets the value of [reasoning][crate::model::summarization_evaluation_metrics::AdherenceRubric::reasoning].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AdherenceRubric;
/// let x = AdherenceRubric::new().set_reasoning("example");
/// ```
pub fn set_reasoning<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.reasoning = v.into();
self
}
/// Sets the value of [is_addressed][crate::model::summarization_evaluation_metrics::AdherenceRubric::is_addressed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AdherenceRubric;
/// let x = AdherenceRubric::new().set_is_addressed(true);
/// ```
pub fn set_is_addressed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.is_addressed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [is_addressed][crate::model::summarization_evaluation_metrics::AdherenceRubric::is_addressed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AdherenceRubric;
/// let x = AdherenceRubric::new().set_or_clear_is_addressed(Some(false));
/// let x = AdherenceRubric::new().set_or_clear_is_addressed(None::<bool>);
/// ```
pub fn set_or_clear_is_addressed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.is_addressed = v.map(|x| x.into());
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for AdherenceRubric {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationEvaluationMetrics.AdherenceRubric"
}
}
/// Rubric details of the completeness evaluation result.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CompletenessRubric {
/// Output only. The question generated from instruction that used to
/// evaluate summary.
pub question: std::string::String,
/// Output only. A boolean that indicates whether the rubric question is
/// addressed or not.
pub is_addressed: std::option::Option<bool>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl CompletenessRubric {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [question][crate::model::summarization_evaluation_metrics::CompletenessRubric::question].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::CompletenessRubric;
/// let x = CompletenessRubric::new().set_question("example");
/// ```
pub fn set_question<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.question = v.into();
self
}
/// Sets the value of [is_addressed][crate::model::summarization_evaluation_metrics::CompletenessRubric::is_addressed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::CompletenessRubric;
/// let x = CompletenessRubric::new().set_is_addressed(true);
/// ```
pub fn set_is_addressed<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.is_addressed = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [is_addressed][crate::model::summarization_evaluation_metrics::CompletenessRubric::is_addressed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::CompletenessRubric;
/// let x = CompletenessRubric::new().set_or_clear_is_addressed(Some(false));
/// let x = CompletenessRubric::new().set_or_clear_is_addressed(None::<bool>);
/// ```
pub fn set_or_clear_is_addressed<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.is_addressed = v.map(|x| x.into());
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for CompletenessRubric {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationEvaluationMetrics.CompletenessRubric"
}
}
/// Decomposition details
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
#[deprecated]
pub struct Decomposition {
/// One of decomposition details.
pub decomposition: std::option::Option<
crate::model::summarization_evaluation_metrics::decomposition::Decomposition,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl Decomposition {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [decomposition][crate::model::summarization_evaluation_metrics::Decomposition::decomposition].
///
/// Note that all the setters affecting `decomposition` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::Decomposition;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AccuracyDecomposition;
/// let x = Decomposition::new().set_decomposition(Some(
/// google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::decomposition::Decomposition::AccuracyDecomposition(AccuracyDecomposition::default().into())));
/// ```
pub fn set_decomposition<T: std::convert::Into<std::option::Option<crate::model::summarization_evaluation_metrics::decomposition::Decomposition>>>(mut self, v: T) -> Self
{
self.decomposition = v.into();
self
}
/// The value of [decomposition][crate::model::summarization_evaluation_metrics::Decomposition::decomposition]
/// if it holds a `AccuracyDecomposition`, `None` if the field is not set or
/// holds a different branch.
pub fn accuracy_decomposition(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::summarization_evaluation_metrics::AccuracyDecomposition>,
> {
#[allow(unreachable_patterns)]
self.decomposition.as_ref().and_then(|v| match v {
crate::model::summarization_evaluation_metrics::decomposition::Decomposition::AccuracyDecomposition(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [decomposition][crate::model::summarization_evaluation_metrics::Decomposition::decomposition]
/// to hold a `AccuracyDecomposition`.
///
/// Note that all the setters affecting `decomposition` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::Decomposition;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AccuracyDecomposition;
/// let x = Decomposition::new().set_accuracy_decomposition(AccuracyDecomposition::default()/* use setters */);
/// assert!(x.accuracy_decomposition().is_some());
/// assert!(x.adherence_decomposition().is_none());
/// ```
pub fn set_accuracy_decomposition<
T: std::convert::Into<
std::boxed::Box<
crate::model::summarization_evaluation_metrics::AccuracyDecomposition,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.decomposition = std::option::Option::Some(
crate::model::summarization_evaluation_metrics::decomposition::Decomposition::AccuracyDecomposition(
v.into()
)
);
self
}
/// The value of [decomposition][crate::model::summarization_evaluation_metrics::Decomposition::decomposition]
/// if it holds a `AdherenceDecomposition`, `None` if the field is not set or
/// holds a different branch.
pub fn adherence_decomposition(
&self,
) -> std::option::Option<
&std::boxed::Box<
crate::model::summarization_evaluation_metrics::AdherenceDecomposition,
>,
> {
#[allow(unreachable_patterns)]
self.decomposition.as_ref().and_then(|v| match v {
crate::model::summarization_evaluation_metrics::decomposition::Decomposition::AdherenceDecomposition(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [decomposition][crate::model::summarization_evaluation_metrics::Decomposition::decomposition]
/// to hold a `AdherenceDecomposition`.
///
/// Note that all the setters affecting `decomposition` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::Decomposition;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AdherenceDecomposition;
/// let x = Decomposition::new().set_adherence_decomposition(AdherenceDecomposition::default()/* use setters */);
/// assert!(x.adherence_decomposition().is_some());
/// assert!(x.accuracy_decomposition().is_none());
/// ```
pub fn set_adherence_decomposition<
T: std::convert::Into<
std::boxed::Box<
crate::model::summarization_evaluation_metrics::AdherenceDecomposition,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.decomposition = std::option::Option::Some(
crate::model::summarization_evaluation_metrics::decomposition::Decomposition::AdherenceDecomposition(
v.into()
)
);
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for Decomposition {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationEvaluationMetrics.Decomposition"
}
}
/// Defines additional types related to [Decomposition].
#[cfg(feature = "generator-evaluations")]
pub mod decomposition {
#[allow(unused_imports)]
use super::*;
/// One of decomposition details.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Decomposition {
/// only available for accuracy metric.
AccuracyDecomposition(
std::boxed::Box<
crate::model::summarization_evaluation_metrics::AccuracyDecomposition,
>,
),
/// only available for adherence metric.
AdherenceDecomposition(
std::boxed::Box<
crate::model::summarization_evaluation_metrics::AdherenceDecomposition,
>,
),
}
}
/// Evaluation result that contains one of accuracy, adherence or completeness
/// evaluation result.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EvaluationResult {
/// One of evaluation result details.
pub result: std::option::Option<
crate::model::summarization_evaluation_metrics::evaluation_result::Result,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl EvaluationResult {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [result][crate::model::summarization_evaluation_metrics::EvaluationResult::result].
///
/// Note that all the setters affecting `result` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::EvaluationResult;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AccuracyDecomposition;
/// let x = EvaluationResult::new().set_result(Some(
/// google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::evaluation_result::Result::AccuracyDecomposition(AccuracyDecomposition::default().into())));
/// ```
pub fn set_result<
T: std::convert::Into<
std::option::Option<
crate::model::summarization_evaluation_metrics::evaluation_result::Result,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.result = v.into();
self
}
/// The value of [result][crate::model::summarization_evaluation_metrics::EvaluationResult::result]
/// if it holds a `AccuracyDecomposition`, `None` if the field is not set or
/// holds a different branch.
pub fn accuracy_decomposition(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::summarization_evaluation_metrics::AccuracyDecomposition>,
> {
#[allow(unreachable_patterns)]
self.result.as_ref().and_then(|v| match v {
crate::model::summarization_evaluation_metrics::evaluation_result::Result::AccuracyDecomposition(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [result][crate::model::summarization_evaluation_metrics::EvaluationResult::result]
/// to hold a `AccuracyDecomposition`.
///
/// Note that all the setters affecting `result` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::EvaluationResult;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AccuracyDecomposition;
/// let x = EvaluationResult::new().set_accuracy_decomposition(AccuracyDecomposition::default()/* use setters */);
/// assert!(x.accuracy_decomposition().is_some());
/// assert!(x.adherence_rubric().is_none());
/// assert!(x.completeness_rubric().is_none());
/// ```
pub fn set_accuracy_decomposition<
T: std::convert::Into<
std::boxed::Box<
crate::model::summarization_evaluation_metrics::AccuracyDecomposition,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.result = std::option::Option::Some(
crate::model::summarization_evaluation_metrics::evaluation_result::Result::AccuracyDecomposition(
v.into()
)
);
self
}
/// The value of [result][crate::model::summarization_evaluation_metrics::EvaluationResult::result]
/// if it holds a `AdherenceRubric`, `None` if the field is not set or
/// holds a different branch.
pub fn adherence_rubric(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::summarization_evaluation_metrics::AdherenceRubric>,
> {
#[allow(unreachable_patterns)]
self.result.as_ref().and_then(|v| match v {
crate::model::summarization_evaluation_metrics::evaluation_result::Result::AdherenceRubric(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [result][crate::model::summarization_evaluation_metrics::EvaluationResult::result]
/// to hold a `AdherenceRubric`.
///
/// Note that all the setters affecting `result` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::EvaluationResult;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::AdherenceRubric;
/// let x = EvaluationResult::new().set_adherence_rubric(AdherenceRubric::default()/* use setters */);
/// assert!(x.adherence_rubric().is_some());
/// assert!(x.accuracy_decomposition().is_none());
/// assert!(x.completeness_rubric().is_none());
/// ```
pub fn set_adherence_rubric<
T: std::convert::Into<
std::boxed::Box<
crate::model::summarization_evaluation_metrics::AdherenceRubric,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.result = std::option::Option::Some(
crate::model::summarization_evaluation_metrics::evaluation_result::Result::AdherenceRubric(
v.into()
)
);
self
}
/// The value of [result][crate::model::summarization_evaluation_metrics::EvaluationResult::result]
/// if it holds a `CompletenessRubric`, `None` if the field is not set or
/// holds a different branch.
pub fn completeness_rubric(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::summarization_evaluation_metrics::CompletenessRubric>,
> {
#[allow(unreachable_patterns)]
self.result.as_ref().and_then(|v| match v {
crate::model::summarization_evaluation_metrics::evaluation_result::Result::CompletenessRubric(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [result][crate::model::summarization_evaluation_metrics::EvaluationResult::result]
/// to hold a `CompletenessRubric`.
///
/// Note that all the setters affecting `result` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::EvaluationResult;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::CompletenessRubric;
/// let x = EvaluationResult::new().set_completeness_rubric(CompletenessRubric::default()/* use setters */);
/// assert!(x.completeness_rubric().is_some());
/// assert!(x.accuracy_decomposition().is_none());
/// assert!(x.adherence_rubric().is_none());
/// ```
pub fn set_completeness_rubric<
T: std::convert::Into<
std::boxed::Box<
crate::model::summarization_evaluation_metrics::CompletenessRubric,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.result = std::option::Option::Some(
crate::model::summarization_evaluation_metrics::evaluation_result::Result::CompletenessRubric(
v.into()
)
);
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for EvaluationResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationEvaluationMetrics.EvaluationResult"
}
}
/// Defines additional types related to [EvaluationResult].
#[cfg(feature = "generator-evaluations")]
pub mod evaluation_result {
#[allow(unused_imports)]
use super::*;
/// One of evaluation result details.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Result {
/// Only available for accuracy metric.
AccuracyDecomposition(
std::boxed::Box<
crate::model::summarization_evaluation_metrics::AccuracyDecomposition,
>,
),
/// Only available for adherence metric.
AdherenceRubric(
std::boxed::Box<crate::model::summarization_evaluation_metrics::AdherenceRubric>,
),
/// Only available for completeness metric.
CompletenessRubric(
std::boxed::Box<crate::model::summarization_evaluation_metrics::CompletenessRubric>,
),
}
}
/// Evaluation result per conversation(&summary), metric and section.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SummarizationEvaluationResult {
/// Output only. conversation session id
#[deprecated]
pub session_id: std::string::String,
/// Output only. metric name, e.g. accuracy, completeness, adherence, etc.
pub metric: std::string::String,
/// Output only. section/task name, e.g. action, situation, etc
pub section: std::string::String,
/// Output only. score calculated from decompositions
pub score: f32,
/// Output only. Summary of this section
pub section_summary: std::string::String,
/// Output only. List of decompostion details
#[deprecated]
pub decompositions:
std::vec::Vec<crate::model::summarization_evaluation_metrics::Decomposition>,
/// Output only. List of evaluation results.
pub evaluation_results:
std::vec::Vec<crate::model::summarization_evaluation_metrics::EvaluationResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl SummarizationEvaluationResult {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [session_id][crate::model::summarization_evaluation_metrics::SummarizationEvaluationResult::session_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::SummarizationEvaluationResult;
/// let x = SummarizationEvaluationResult::new().set_session_id("example");
/// ```
#[deprecated]
pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session_id = v.into();
self
}
/// Sets the value of [metric][crate::model::summarization_evaluation_metrics::SummarizationEvaluationResult::metric].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::SummarizationEvaluationResult;
/// let x = SummarizationEvaluationResult::new().set_metric("example");
/// ```
pub fn set_metric<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.metric = v.into();
self
}
/// Sets the value of [section][crate::model::summarization_evaluation_metrics::SummarizationEvaluationResult::section].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::SummarizationEvaluationResult;
/// let x = SummarizationEvaluationResult::new().set_section("example");
/// ```
pub fn set_section<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.section = v.into();
self
}
/// Sets the value of [score][crate::model::summarization_evaluation_metrics::SummarizationEvaluationResult::score].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::SummarizationEvaluationResult;
/// let x = SummarizationEvaluationResult::new().set_score(42.0);
/// ```
pub fn set_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.score = v.into();
self
}
/// Sets the value of [section_summary][crate::model::summarization_evaluation_metrics::SummarizationEvaluationResult::section_summary].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::SummarizationEvaluationResult;
/// let x = SummarizationEvaluationResult::new().set_section_summary("example");
/// ```
pub fn set_section_summary<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.section_summary = v.into();
self
}
/// Sets the value of [decompositions][crate::model::summarization_evaluation_metrics::SummarizationEvaluationResult::decompositions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::SummarizationEvaluationResult;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::Decomposition;
/// let x = SummarizationEvaluationResult::new()
/// .set_decompositions([
/// Decomposition::default()/* use setters */,
/// Decomposition::default()/* use (different) setters */,
/// ]);
/// ```
#[deprecated]
pub fn set_decompositions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::summarization_evaluation_metrics::Decomposition>,
{
use std::iter::Iterator;
self.decompositions = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [evaluation_results][crate::model::summarization_evaluation_metrics::SummarizationEvaluationResult::evaluation_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::SummarizationEvaluationResult;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::EvaluationResult;
/// let x = SummarizationEvaluationResult::new()
/// .set_evaluation_results([
/// EvaluationResult::default()/* use setters */,
/// EvaluationResult::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_evaluation_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::summarization_evaluation_metrics::EvaluationResult>,
{
use std::iter::Iterator;
self.evaluation_results = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for SummarizationEvaluationResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationEvaluationMetrics.SummarizationEvaluationResult"
}
}
/// Overall performance per metric. This is the aggregated score for each
/// metric across all conversations that are selected for summarization
/// evaluation.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OverallScoresByMetric {
/// Output only. Metric name. e.g. accuracy, adherence, completeness.
pub metric: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl OverallScoresByMetric {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [metric][crate::model::summarization_evaluation_metrics::OverallScoresByMetric::metric].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::OverallScoresByMetric;
/// let x = OverallScoresByMetric::new().set_metric("example");
/// ```
pub fn set_metric<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.metric = v.into();
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for OverallScoresByMetric {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationEvaluationMetrics.OverallScoresByMetric"
}
}
/// A pair of section name and input token count of the input summary section.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SectionToken {
/// Output only. The name of the summary instruction.
pub section: std::string::String,
/// Output only. Token count.
pub token_count: std::option::Option<i64>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl SectionToken {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [section][crate::model::summarization_evaluation_metrics::SectionToken::section].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::SectionToken;
/// let x = SectionToken::new().set_section("example");
/// ```
pub fn set_section<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.section = v.into();
self
}
/// Sets the value of [token_count][crate::model::summarization_evaluation_metrics::SectionToken::token_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::SectionToken;
/// let x = SectionToken::new().set_token_count(42);
/// ```
pub fn set_token_count<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.token_count = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [token_count][crate::model::summarization_evaluation_metrics::SectionToken::token_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::SectionToken;
/// let x = SectionToken::new().set_or_clear_token_count(Some(42));
/// let x = SectionToken::new().set_or_clear_token_count(None::<i32>);
/// ```
pub fn set_or_clear_token_count<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.token_count = v.map(|x| x.into());
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for SectionToken {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationEvaluationMetrics.SectionToken"
}
}
/// Aggregated evaluation result on conversation level. This conatins
/// evaluation results of all the metrics and sections.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConversationDetail {
/// Output only. Conversation transcript that used for summarization
/// evaluation as a reference.
pub message_entries: std::vec::Vec<crate::model::MessageEntry>,
/// Output only. Summary sections that used for summarization evaluation as a
/// reference.
pub summary_sections: std::vec::Vec<crate::model::summary_suggestion::SummarySection>,
/// Output only. List of metric details.
pub metric_details: std::vec::Vec<
crate::model::summarization_evaluation_metrics::conversation_detail::MetricDetail,
>,
/// Output only. Conversation level token count per section. This is an
/// aggregated(sum) result of input token of summary acorss all metrics for a
/// single conversation.
pub section_tokens:
std::vec::Vec<crate::model::summarization_evaluation_metrics::SectionToken>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl ConversationDetail {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [message_entries][crate::model::summarization_evaluation_metrics::ConversationDetail::message_entries].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::ConversationDetail;
/// use google_cloud_dialogflow_v2::model::MessageEntry;
/// let x = ConversationDetail::new()
/// .set_message_entries([
/// MessageEntry::default()/* use setters */,
/// MessageEntry::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_message_entries<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::MessageEntry>,
{
use std::iter::Iterator;
self.message_entries = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [summary_sections][crate::model::summarization_evaluation_metrics::ConversationDetail::summary_sections].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::ConversationDetail;
/// use google_cloud_dialogflow_v2::model::summary_suggestion::SummarySection;
/// let x = ConversationDetail::new()
/// .set_summary_sections([
/// SummarySection::default()/* use setters */,
/// SummarySection::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_summary_sections<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::summary_suggestion::SummarySection>,
{
use std::iter::Iterator;
self.summary_sections = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [metric_details][crate::model::summarization_evaluation_metrics::ConversationDetail::metric_details].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::ConversationDetail;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::conversation_detail::MetricDetail;
/// let x = ConversationDetail::new()
/// .set_metric_details([
/// MetricDetail::default()/* use setters */,
/// MetricDetail::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_metric_details<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::summarization_evaluation_metrics::conversation_detail::MetricDetail>
{
use std::iter::Iterator;
self.metric_details = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [section_tokens][crate::model::summarization_evaluation_metrics::ConversationDetail::section_tokens].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::ConversationDetail;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::SectionToken;
/// let x = ConversationDetail::new()
/// .set_section_tokens([
/// SectionToken::default()/* use setters */,
/// SectionToken::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_section_tokens<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::summarization_evaluation_metrics::SectionToken>,
{
use std::iter::Iterator;
self.section_tokens = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for ConversationDetail {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationEvaluationMetrics.ConversationDetail"
}
}
/// Defines additional types related to [ConversationDetail].
#[cfg(feature = "generator-evaluations")]
pub mod conversation_detail {
#[allow(unused_imports)]
use super::*;
/// Aggregated result on metric level. This conatins the evaluation results
/// of all the sections.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MetricDetail {
/// Output only. Metrics name. e.g. accuracy, adherence, completeness.
pub metric: std::string::String,
/// Output only. Aggregated(average) score on this metric across all
/// sections.
pub score: std::option::Option<f32>,
/// Output only. List of section details.
pub section_details: std::vec::Vec<crate::model::summarization_evaluation_metrics::conversation_detail::metric_detail::SectionDetail>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl MetricDetail {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [metric][crate::model::summarization_evaluation_metrics::conversation_detail::MetricDetail::metric].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::conversation_detail::MetricDetail;
/// let x = MetricDetail::new().set_metric("example");
/// ```
pub fn set_metric<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.metric = v.into();
self
}
/// Sets the value of [score][crate::model::summarization_evaluation_metrics::conversation_detail::MetricDetail::score].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::conversation_detail::MetricDetail;
/// let x = MetricDetail::new().set_score(42.0);
/// ```
pub fn set_score<T>(mut self, v: T) -> Self
where
T: std::convert::Into<f32>,
{
self.score = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [score][crate::model::summarization_evaluation_metrics::conversation_detail::MetricDetail::score].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::conversation_detail::MetricDetail;
/// let x = MetricDetail::new().set_or_clear_score(Some(42.0));
/// let x = MetricDetail::new().set_or_clear_score(None::<f32>);
/// ```
pub fn set_or_clear_score<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<f32>,
{
self.score = v.map(|x| x.into());
self
}
/// Sets the value of [section_details][crate::model::summarization_evaluation_metrics::conversation_detail::MetricDetail::section_details].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::conversation_detail::MetricDetail;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::conversation_detail::metric_detail::SectionDetail;
/// let x = MetricDetail::new()
/// .set_section_details([
/// SectionDetail::default()/* use setters */,
/// SectionDetail::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_section_details<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::summarization_evaluation_metrics::conversation_detail::metric_detail::SectionDetail>
{
use std::iter::Iterator;
self.section_details = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for MetricDetail {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationEvaluationMetrics.ConversationDetail.MetricDetail"
}
}
/// Defines additional types related to [MetricDetail].
#[cfg(feature = "generator-evaluations")]
pub mod metric_detail {
#[allow(unused_imports)]
use super::*;
/// Section level result.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SectionDetail {
/// Output only. The name of the summary instruction.
pub section: std::string::String,
/// Output only. Aggregated(average) score on this section across all
/// evaluation results. Either decompositions or rubrics.
pub score: std::option::Option<f32>,
/// Output only. Summary for this section
pub section_summary: std::string::String,
/// Output only. List of evaluation result. The list only contains one
/// kind of the evaluation result.
pub evaluation_results:
std::vec::Vec<crate::model::summarization_evaluation_metrics::EvaluationResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl SectionDetail {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [section][crate::model::summarization_evaluation_metrics::conversation_detail::metric_detail::SectionDetail::section].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::conversation_detail::metric_detail::SectionDetail;
/// let x = SectionDetail::new().set_section("example");
/// ```
pub fn set_section<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.section = v.into();
self
}
/// Sets the value of [score][crate::model::summarization_evaluation_metrics::conversation_detail::metric_detail::SectionDetail::score].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::conversation_detail::metric_detail::SectionDetail;
/// let x = SectionDetail::new().set_score(42.0);
/// ```
pub fn set_score<T>(mut self, v: T) -> Self
where
T: std::convert::Into<f32>,
{
self.score = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [score][crate::model::summarization_evaluation_metrics::conversation_detail::metric_detail::SectionDetail::score].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::conversation_detail::metric_detail::SectionDetail;
/// let x = SectionDetail::new().set_or_clear_score(Some(42.0));
/// let x = SectionDetail::new().set_or_clear_score(None::<f32>);
/// ```
pub fn set_or_clear_score<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<f32>,
{
self.score = v.map(|x| x.into());
self
}
/// Sets the value of [section_summary][crate::model::summarization_evaluation_metrics::conversation_detail::metric_detail::SectionDetail::section_summary].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::conversation_detail::metric_detail::SectionDetail;
/// let x = SectionDetail::new().set_section_summary("example");
/// ```
pub fn set_section_summary<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.section_summary = v.into();
self
}
/// Sets the value of [evaluation_results][crate::model::summarization_evaluation_metrics::conversation_detail::metric_detail::SectionDetail::evaluation_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::conversation_detail::metric_detail::SectionDetail;
/// use google_cloud_dialogflow_v2::model::summarization_evaluation_metrics::EvaluationResult;
/// let x = SectionDetail::new()
/// .set_evaluation_results([
/// EvaluationResult::default()/* use setters */,
/// EvaluationResult::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_evaluation_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::summarization_evaluation_metrics::EvaluationResult,
>,
{
use std::iter::Iterator;
self.evaluation_results = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for SectionDetail {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SummarizationEvaluationMetrics.ConversationDetail.MetricDetail.SectionDetail"
}
}
}
}
}
/// Generator evaluation input config.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GeneratorEvaluationConfig {
/// Required. The config/source of input data.
pub input_data_config:
std::option::Option<crate::model::generator_evaluation_config::InputDataConfig>,
/// Required. The output Cloud Storage bucket path to store eval files, e.g.
/// per_summary_accuracy_score report. This path is provided by customer and
/// files stored in it are visible to customer, no internal data should be
/// stored in this path.
pub output_gcs_bucket_path: std::string::String,
/// Feature used for evaluation.
pub evaluation_feature_config:
std::option::Option<crate::model::generator_evaluation_config::EvaluationFeatureConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl GeneratorEvaluationConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [input_data_config][crate::model::GeneratorEvaluationConfig::input_data_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluationConfig;
/// use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataConfig;
/// let x = GeneratorEvaluationConfig::new().set_input_data_config(InputDataConfig::default()/* use setters */);
/// ```
pub fn set_input_data_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::generator_evaluation_config::InputDataConfig>,
{
self.input_data_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [input_data_config][crate::model::GeneratorEvaluationConfig::input_data_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluationConfig;
/// use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataConfig;
/// let x = GeneratorEvaluationConfig::new().set_or_clear_input_data_config(Some(InputDataConfig::default()/* use setters */));
/// let x = GeneratorEvaluationConfig::new().set_or_clear_input_data_config(None::<InputDataConfig>);
/// ```
pub fn set_or_clear_input_data_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::generator_evaluation_config::InputDataConfig>,
{
self.input_data_config = v.map(|x| x.into());
self
}
/// Sets the value of [output_gcs_bucket_path][crate::model::GeneratorEvaluationConfig::output_gcs_bucket_path].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluationConfig;
/// let x = GeneratorEvaluationConfig::new().set_output_gcs_bucket_path("example");
/// ```
pub fn set_output_gcs_bucket_path<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.output_gcs_bucket_path = v.into();
self
}
/// Sets the value of [evaluation_feature_config][crate::model::GeneratorEvaluationConfig::evaluation_feature_config].
///
/// Note that all the setters affecting `evaluation_feature_config` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluationConfig;
/// use google_cloud_dialogflow_v2::model::generator_evaluation_config::SummarizationConfig;
/// let x = GeneratorEvaluationConfig::new().set_evaluation_feature_config(Some(
/// google_cloud_dialogflow_v2::model::generator_evaluation_config::EvaluationFeatureConfig::SummarizationConfig(SummarizationConfig::default().into())));
/// ```
pub fn set_evaluation_feature_config<
T: std::convert::Into<
std::option::Option<
crate::model::generator_evaluation_config::EvaluationFeatureConfig,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.evaluation_feature_config = v.into();
self
}
/// The value of [evaluation_feature_config][crate::model::GeneratorEvaluationConfig::evaluation_feature_config]
/// if it holds a `SummarizationConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn summarization_config(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::generator_evaluation_config::SummarizationConfig>,
> {
#[allow(unreachable_patterns)]
self.evaluation_feature_config.as_ref().and_then(|v| match v {
crate::model::generator_evaluation_config::EvaluationFeatureConfig::SummarizationConfig(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [evaluation_feature_config][crate::model::GeneratorEvaluationConfig::evaluation_feature_config]
/// to hold a `SummarizationConfig`.
///
/// Note that all the setters affecting `evaluation_feature_config` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluationConfig;
/// use google_cloud_dialogflow_v2::model::generator_evaluation_config::SummarizationConfig;
/// let x = GeneratorEvaluationConfig::new().set_summarization_config(SummarizationConfig::default()/* use setters */);
/// assert!(x.summarization_config().is_some());
/// ```
pub fn set_summarization_config<
T: std::convert::Into<
std::boxed::Box<crate::model::generator_evaluation_config::SummarizationConfig>,
>,
>(
mut self,
v: T,
) -> Self {
self.evaluation_feature_config = std::option::Option::Some(
crate::model::generator_evaluation_config::EvaluationFeatureConfig::SummarizationConfig(
v.into(),
),
);
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for GeneratorEvaluationConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GeneratorEvaluationConfig"
}
}
/// Defines additional types related to [GeneratorEvaluationConfig].
#[cfg(feature = "generator-evaluations")]
pub mod generator_evaluation_config {
#[allow(unused_imports)]
use super::*;
/// The distinctive configs for Agent Assist conversations as the conversation
/// source.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AgentAssistInputDataConfig {
/// Required. The start of the time range for conversations to be evaluated.
/// Only conversations created at or after this timestamp will be sampled.
pub start_time: std::option::Option<wkt::Timestamp>,
/// Required. The end of the time range for conversations to be evaluated.
/// Only conversations ended at or before this timestamp will be sampled.
pub end_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl AgentAssistInputDataConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [start_time][crate::model::generator_evaluation_config::AgentAssistInputDataConfig::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::AgentAssistInputDataConfig;
/// use wkt::Timestamp;
/// let x = AgentAssistInputDataConfig::new().set_start_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [start_time][crate::model::generator_evaluation_config::AgentAssistInputDataConfig::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::AgentAssistInputDataConfig;
/// use wkt::Timestamp;
/// let x = AgentAssistInputDataConfig::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
/// let x = AgentAssistInputDataConfig::new().set_or_clear_start_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [end_time][crate::model::generator_evaluation_config::AgentAssistInputDataConfig::end_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::AgentAssistInputDataConfig;
/// use wkt::Timestamp;
/// let x = AgentAssistInputDataConfig::new().set_end_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [end_time][crate::model::generator_evaluation_config::AgentAssistInputDataConfig::end_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::AgentAssistInputDataConfig;
/// use wkt::Timestamp;
/// let x = AgentAssistInputDataConfig::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
/// let x = AgentAssistInputDataConfig::new().set_or_clear_end_time(None::<Timestamp>);
/// ```
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
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for AgentAssistInputDataConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GeneratorEvaluationConfig.AgentAssistInputDataConfig"
}
}
/// The distinctive configs for dataset as the conversation source.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DatasetInputDataConfig {
/// Required. The identifier of the dataset to be evaluated.
/// Format:
/// `projects/<ProjectId>/locations/<LocationID>/datasets/<DatasetID>`.
pub dataset: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl DatasetInputDataConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [dataset][crate::model::generator_evaluation_config::DatasetInputDataConfig::dataset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::DatasetInputDataConfig;
/// let x = DatasetInputDataConfig::new().set_dataset("example");
/// ```
pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset = v.into();
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for DatasetInputDataConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GeneratorEvaluationConfig.DatasetInputDataConfig"
}
}
/// Input data config details
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InputDataConfig {
/// Required. The source type of input data.
#[deprecated]
pub input_data_source_type: crate::model::generator_evaluation_config::InputDataSourceType,
/// Optional. The start timestamp to fetch conversation data.
#[deprecated]
pub start_time: std::option::Option<wkt::Timestamp>,
/// Optional. The end timestamp to fetch conversation data.
#[deprecated]
pub end_time: std::option::Option<wkt::Timestamp>,
/// Optional. Desired number of conversation-summary pairs to be evaluated.
pub sample_size: i32,
/// Optional. Whether the summary generation is allowed when the pre-existing
/// qualified summaries are insufficient to cover the sample size.
#[deprecated]
pub is_summary_generation_allowed: bool,
/// Optional. Option to control whether summaries are generated during
/// evaluation.
pub summary_generation_option:
crate::model::generator_evaluation_config::input_data_config::SummaryGenerationOption,
/// The source specific config for the input data.
pub source_specific_config: std::option::Option<
crate::model::generator_evaluation_config::input_data_config::SourceSpecificConfig,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl InputDataConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [input_data_source_type][crate::model::generator_evaluation_config::InputDataConfig::input_data_source_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataConfig;
/// use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataSourceType;
/// let x0 = InputDataConfig::new().set_input_data_source_type(InputDataSourceType::AgentAssistConversations);
/// let x1 = InputDataConfig::new().set_input_data_source_type(InputDataSourceType::InsightsConversations);
/// ```
#[deprecated]
pub fn set_input_data_source_type<
T: std::convert::Into<crate::model::generator_evaluation_config::InputDataSourceType>,
>(
mut self,
v: T,
) -> Self {
self.input_data_source_type = v.into();
self
}
/// Sets the value of [start_time][crate::model::generator_evaluation_config::InputDataConfig::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataConfig;
/// use wkt::Timestamp;
/// let x = InputDataConfig::new().set_start_time(Timestamp::default()/* use setters */);
/// ```
#[deprecated]
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
}
/// Sets or clears the value of [start_time][crate::model::generator_evaluation_config::InputDataConfig::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataConfig;
/// use wkt::Timestamp;
/// let x = InputDataConfig::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
/// let x = InputDataConfig::new().set_or_clear_start_time(None::<Timestamp>);
/// ```
#[deprecated]
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
}
/// Sets the value of [end_time][crate::model::generator_evaluation_config::InputDataConfig::end_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataConfig;
/// use wkt::Timestamp;
/// let x = InputDataConfig::new().set_end_time(Timestamp::default()/* use setters */);
/// ```
#[deprecated]
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
}
/// Sets or clears the value of [end_time][crate::model::generator_evaluation_config::InputDataConfig::end_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataConfig;
/// use wkt::Timestamp;
/// let x = InputDataConfig::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
/// let x = InputDataConfig::new().set_or_clear_end_time(None::<Timestamp>);
/// ```
#[deprecated]
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
}
/// Sets the value of [sample_size][crate::model::generator_evaluation_config::InputDataConfig::sample_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataConfig;
/// let x = InputDataConfig::new().set_sample_size(42);
/// ```
pub fn set_sample_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.sample_size = v.into();
self
}
/// Sets the value of [is_summary_generation_allowed][crate::model::generator_evaluation_config::InputDataConfig::is_summary_generation_allowed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataConfig;
/// let x = InputDataConfig::new().set_is_summary_generation_allowed(true);
/// ```
#[deprecated]
pub fn set_is_summary_generation_allowed<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.is_summary_generation_allowed = v.into();
self
}
/// Sets the value of [summary_generation_option][crate::model::generator_evaluation_config::InputDataConfig::summary_generation_option].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataConfig;
/// use google_cloud_dialogflow_v2::model::generator_evaluation_config::input_data_config::SummaryGenerationOption;
/// let x0 = InputDataConfig::new().set_summary_generation_option(SummaryGenerationOption::AlwaysGenerate);
/// let x1 = InputDataConfig::new().set_summary_generation_option(SummaryGenerationOption::GenerateIfMissing);
/// let x2 = InputDataConfig::new().set_summary_generation_option(SummaryGenerationOption::DoNotGenerate);
/// ```
pub fn set_summary_generation_option<T: std::convert::Into<crate::model::generator_evaluation_config::input_data_config::SummaryGenerationOption>>(mut self, v: T) -> Self{
self.summary_generation_option = v.into();
self
}
/// Sets the value of [source_specific_config][crate::model::generator_evaluation_config::InputDataConfig::source_specific_config].
///
/// Note that all the setters affecting `source_specific_config` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataConfig;
/// use google_cloud_dialogflow_v2::model::generator_evaluation_config::AgentAssistInputDataConfig;
/// let x = InputDataConfig::new().set_source_specific_config(Some(
/// google_cloud_dialogflow_v2::model::generator_evaluation_config::input_data_config::SourceSpecificConfig::AgentAssistInputDataConfig(AgentAssistInputDataConfig::default().into())));
/// ```
pub fn set_source_specific_config<T: std::convert::Into<std::option::Option<crate::model::generator_evaluation_config::input_data_config::SourceSpecificConfig>>>(mut self, v: T) -> Self
{
self.source_specific_config = v.into();
self
}
/// The value of [source_specific_config][crate::model::generator_evaluation_config::InputDataConfig::source_specific_config]
/// if it holds a `AgentAssistInputDataConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn agent_assist_input_data_config(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::generator_evaluation_config::AgentAssistInputDataConfig>,
> {
#[allow(unreachable_patterns)]
self.source_specific_config.as_ref().and_then(|v| match v {
crate::model::generator_evaluation_config::input_data_config::SourceSpecificConfig::AgentAssistInputDataConfig(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source_specific_config][crate::model::generator_evaluation_config::InputDataConfig::source_specific_config]
/// to hold a `AgentAssistInputDataConfig`.
///
/// Note that all the setters affecting `source_specific_config` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataConfig;
/// use google_cloud_dialogflow_v2::model::generator_evaluation_config::AgentAssistInputDataConfig;
/// let x = InputDataConfig::new().set_agent_assist_input_data_config(AgentAssistInputDataConfig::default()/* use setters */);
/// assert!(x.agent_assist_input_data_config().is_some());
/// assert!(x.dataset_input_data_config().is_none());
/// ```
pub fn set_agent_assist_input_data_config<
T: std::convert::Into<
std::boxed::Box<
crate::model::generator_evaluation_config::AgentAssistInputDataConfig,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.source_specific_config = std::option::Option::Some(
crate::model::generator_evaluation_config::input_data_config::SourceSpecificConfig::AgentAssistInputDataConfig(
v.into()
)
);
self
}
/// The value of [source_specific_config][crate::model::generator_evaluation_config::InputDataConfig::source_specific_config]
/// if it holds a `DatasetInputDataConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn dataset_input_data_config(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::generator_evaluation_config::DatasetInputDataConfig>,
> {
#[allow(unreachable_patterns)]
self.source_specific_config.as_ref().and_then(|v| match v {
crate::model::generator_evaluation_config::input_data_config::SourceSpecificConfig::DatasetInputDataConfig(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source_specific_config][crate::model::generator_evaluation_config::InputDataConfig::source_specific_config]
/// to hold a `DatasetInputDataConfig`.
///
/// Note that all the setters affecting `source_specific_config` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::InputDataConfig;
/// use google_cloud_dialogflow_v2::model::generator_evaluation_config::DatasetInputDataConfig;
/// let x = InputDataConfig::new().set_dataset_input_data_config(DatasetInputDataConfig::default()/* use setters */);
/// assert!(x.dataset_input_data_config().is_some());
/// assert!(x.agent_assist_input_data_config().is_none());
/// ```
pub fn set_dataset_input_data_config<
T: std::convert::Into<
std::boxed::Box<
crate::model::generator_evaluation_config::DatasetInputDataConfig,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.source_specific_config = std::option::Option::Some(
crate::model::generator_evaluation_config::input_data_config::SourceSpecificConfig::DatasetInputDataConfig(
v.into()
)
);
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for InputDataConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GeneratorEvaluationConfig.InputDataConfig"
}
}
/// Defines additional types related to [InputDataConfig].
#[cfg(feature = "generator-evaluations")]
pub mod input_data_config {
#[allow(unused_imports)]
use super::*;
/// Summary generation options.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SummaryGenerationOption {
/// Default option will not be used
Unspecified,
/// Always Generate summary for all conversations.
AlwaysGenerate,
/// Gnerate only missing summaries.
GenerateIfMissing,
/// Do not generate new summaries. Only use existing summaries found.
DoNotGenerate,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [SummaryGenerationOption::value] or
/// [SummaryGenerationOption::name].
UnknownValue(summary_generation_option::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "generator-evaluations")]
pub mod summary_generation_option {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "generator-evaluations")]
impl SummaryGenerationOption {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::AlwaysGenerate => std::option::Option::Some(1),
Self::GenerateIfMissing => std::option::Option::Some(2),
Self::DoNotGenerate => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("SUMMARY_GENERATION_OPTION_UNSPECIFIED")
}
Self::AlwaysGenerate => std::option::Option::Some("ALWAYS_GENERATE"),
Self::GenerateIfMissing => std::option::Option::Some("GENERATE_IF_MISSING"),
Self::DoNotGenerate => std::option::Option::Some("DO_NOT_GENERATE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "generator-evaluations")]
impl std::default::Default for SummaryGenerationOption {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "generator-evaluations")]
impl std::fmt::Display for SummaryGenerationOption {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "generator-evaluations")]
impl std::convert::From<i32> for SummaryGenerationOption {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::AlwaysGenerate,
2 => Self::GenerateIfMissing,
3 => Self::DoNotGenerate,
_ => Self::UnknownValue(summary_generation_option::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "generator-evaluations")]
impl std::convert::From<&str> for SummaryGenerationOption {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SUMMARY_GENERATION_OPTION_UNSPECIFIED" => Self::Unspecified,
"ALWAYS_GENERATE" => Self::AlwaysGenerate,
"GENERATE_IF_MISSING" => Self::GenerateIfMissing,
"DO_NOT_GENERATE" => Self::DoNotGenerate,
_ => Self::UnknownValue(summary_generation_option::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "generator-evaluations")]
impl serde::ser::Serialize for SummaryGenerationOption {
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::AlwaysGenerate => serializer.serialize_i32(1),
Self::GenerateIfMissing => serializer.serialize_i32(2),
Self::DoNotGenerate => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "generator-evaluations")]
impl<'de> serde::de::Deserialize<'de> for SummaryGenerationOption {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SummaryGenerationOption>::new(
".google.cloud.dialogflow.v2.GeneratorEvaluationConfig.InputDataConfig.SummaryGenerationOption"))
}
}
/// The source specific config for the input data.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SourceSpecificConfig {
/// The distinctive configs for Agent Assist conversations as the
/// conversation source.
AgentAssistInputDataConfig(
std::boxed::Box<
crate::model::generator_evaluation_config::AgentAssistInputDataConfig,
>,
),
/// The distinctive configs for dataset as the conversation source.
DatasetInputDataConfig(
std::boxed::Box<crate::model::generator_evaluation_config::DatasetInputDataConfig>,
),
}
}
/// Evaluation configs for summarization generator.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SummarizationConfig {
/// Optional. Enable accuracy evaluation.
#[deprecated]
pub enable_accuracy_evaluation: bool,
/// Optional. Version for summarization accuracy. This will determine the
/// prompt and model used at backend.
#[deprecated]
pub accuracy_evaluation_version: std::string::String,
/// Optional. Enable completeness evaluation.
#[deprecated]
pub enable_completeness_evaluation: bool,
/// Optional. Version for summarization completeness. This will determine the
/// prompt and model used at backend.
#[deprecated]
pub completeness_evaluation_version: std::string::String,
/// Optional. Version for summarization evaluation.
pub evaluator_version: std::option::Option<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl SummarizationConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [enable_accuracy_evaluation][crate::model::generator_evaluation_config::SummarizationConfig::enable_accuracy_evaluation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::SummarizationConfig;
/// let x = SummarizationConfig::new().set_enable_accuracy_evaluation(true);
/// ```
#[deprecated]
pub fn set_enable_accuracy_evaluation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_accuracy_evaluation = v.into();
self
}
/// Sets the value of [accuracy_evaluation_version][crate::model::generator_evaluation_config::SummarizationConfig::accuracy_evaluation_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::SummarizationConfig;
/// let x = SummarizationConfig::new().set_accuracy_evaluation_version("example");
/// ```
#[deprecated]
pub fn set_accuracy_evaluation_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.accuracy_evaluation_version = v.into();
self
}
/// Sets the value of [enable_completeness_evaluation][crate::model::generator_evaluation_config::SummarizationConfig::enable_completeness_evaluation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::SummarizationConfig;
/// let x = SummarizationConfig::new().set_enable_completeness_evaluation(true);
/// ```
#[deprecated]
pub fn set_enable_completeness_evaluation<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.enable_completeness_evaluation = v.into();
self
}
/// Sets the value of [completeness_evaluation_version][crate::model::generator_evaluation_config::SummarizationConfig::completeness_evaluation_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::SummarizationConfig;
/// let x = SummarizationConfig::new().set_completeness_evaluation_version("example");
/// ```
#[deprecated]
pub fn set_completeness_evaluation_version<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.completeness_evaluation_version = v.into();
self
}
/// Sets the value of [evaluator_version][crate::model::generator_evaluation_config::SummarizationConfig::evaluator_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::SummarizationConfig;
/// let x = SummarizationConfig::new().set_evaluator_version("example");
/// ```
pub fn set_evaluator_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.evaluator_version = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [evaluator_version][crate::model::generator_evaluation_config::SummarizationConfig::evaluator_version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generator_evaluation_config::SummarizationConfig;
/// let x = SummarizationConfig::new().set_or_clear_evaluator_version(Some("example"));
/// let x = SummarizationConfig::new().set_or_clear_evaluator_version(None::<String>);
/// ```
pub fn set_or_clear_evaluator_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.evaluator_version = v.map(|x| x.into());
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for SummarizationConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GeneratorEvaluationConfig.SummarizationConfig"
}
}
/// Enumeration of input data source type.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum InputDataSourceType {
/// Unspecified InputDataSourceType. Should not be used.
Unspecified,
/// Fetch data from Agent Assist storage. If this source type is chosen,
/// input_data_config.start_time and input_data_config.end_timestamp must be
/// provided.
AgentAssistConversations,
/// Fetch data from Insights storage. If this source type is chosen,
/// input_data_config.start_time and input_data_config.end_timestamp must be
/// provided.
InsightsConversations,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [InputDataSourceType::value] or
/// [InputDataSourceType::name].
UnknownValue(input_data_source_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "generator-evaluations")]
pub mod input_data_source_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "generator-evaluations")]
impl InputDataSourceType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::AgentAssistConversations => std::option::Option::Some(1),
Self::InsightsConversations => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("INPUT_DATA_SOURCE_TYPE_UNSPECIFIED")
}
Self::AgentAssistConversations => {
std::option::Option::Some("AGENT_ASSIST_CONVERSATIONS")
}
Self::InsightsConversations => std::option::Option::Some("INSIGHTS_CONVERSATIONS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "generator-evaluations")]
impl std::default::Default for InputDataSourceType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "generator-evaluations")]
impl std::fmt::Display for InputDataSourceType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "generator-evaluations")]
impl std::convert::From<i32> for InputDataSourceType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::AgentAssistConversations,
2 => Self::InsightsConversations,
_ => Self::UnknownValue(input_data_source_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "generator-evaluations")]
impl std::convert::From<&str> for InputDataSourceType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"INPUT_DATA_SOURCE_TYPE_UNSPECIFIED" => Self::Unspecified,
"AGENT_ASSIST_CONVERSATIONS" => Self::AgentAssistConversations,
"INSIGHTS_CONVERSATIONS" => Self::InsightsConversations,
_ => Self::UnknownValue(input_data_source_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "generator-evaluations")]
impl serde::ser::Serialize for InputDataSourceType {
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::AgentAssistConversations => serializer.serialize_i32(1),
Self::InsightsConversations => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "generator-evaluations")]
impl<'de> serde::de::Deserialize<'de> for InputDataSourceType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<InputDataSourceType>::new(
".google.cloud.dialogflow.v2.GeneratorEvaluationConfig.InputDataSourceType",
))
}
}
/// Feature used for evaluation.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EvaluationFeatureConfig {
/// Evaluation configs for summarization generator.
SummarizationConfig(
std::boxed::Box<crate::model::generator_evaluation_config::SummarizationConfig>,
),
}
}
/// A common evalaution pipeline status.
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EvaluationStatus {
/// Output only. If the value is `false`, it means the evaluation is still in
/// progress. If `true`, the operation is completed, and either `error` or
/// `response` is available.
pub done: std::option::Option<bool>,
/// Output only. The error result of the evaluation in case of failure in
/// evaluation pipeline.
pub pipeline_status: std::option::Option<google_cloud_rpc::model::Status>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl EvaluationStatus {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [done][crate::model::EvaluationStatus::done].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EvaluationStatus;
/// let x = EvaluationStatus::new().set_done(true);
/// ```
pub fn set_done<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.done = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [done][crate::model::EvaluationStatus::done].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EvaluationStatus;
/// let x = EvaluationStatus::new().set_or_clear_done(Some(false));
/// let x = EvaluationStatus::new().set_or_clear_done(None::<bool>);
/// ```
pub fn set_or_clear_done<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.done = v.map(|x| x.into());
self
}
/// Sets the value of [pipeline_status][crate::model::EvaluationStatus::pipeline_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EvaluationStatus;
/// use google_cloud_rpc::model::Status;
/// let x = EvaluationStatus::new().set_pipeline_status(Status::default()/* use setters */);
/// ```
pub fn set_pipeline_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.pipeline_status = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [pipeline_status][crate::model::EvaluationStatus::pipeline_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EvaluationStatus;
/// use google_cloud_rpc::model::Status;
/// let x = EvaluationStatus::new().set_or_clear_pipeline_status(Some(Status::default()/* use setters */));
/// let x = EvaluationStatus::new().set_or_clear_pipeline_status(None::<Status>);
/// ```
pub fn set_or_clear_pipeline_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.pipeline_status = v.map(|x| x.into());
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for EvaluationStatus {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.EvaluationStatus"
}
}
/// Represents a notification sent to Cloud Pub/Sub subscribers for
/// human agent assistant events in a specific conversation.
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HumanAgentAssistantEvent {
/// The conversation this notification refers to.
/// Format: `projects/<Project ID>/conversations/<Conversation ID>`.
pub conversation: std::string::String,
/// The participant that the suggestion is compiled for.
/// Format: `projects/<Project ID>/conversations/<Conversation
/// ID>/participants/<Participant ID>`. It will not be set in legacy workflow.
pub participant: std::string::String,
/// The suggestion results payload that this notification refers to.
pub suggestion_results: std::vec::Vec<crate::model::SuggestionResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl HumanAgentAssistantEvent {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [conversation][crate::model::HumanAgentAssistantEvent::conversation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentAssistantEvent;
/// let x = HumanAgentAssistantEvent::new().set_conversation("example");
/// ```
pub fn set_conversation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.conversation = v.into();
self
}
/// Sets the value of [participant][crate::model::HumanAgentAssistantEvent::participant].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentAssistantEvent;
/// let x = HumanAgentAssistantEvent::new().set_participant("example");
/// ```
pub fn set_participant<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.participant = v.into();
self
}
/// Sets the value of [suggestion_results][crate::model::HumanAgentAssistantEvent::suggestion_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::HumanAgentAssistantEvent;
/// use google_cloud_dialogflow_v2::model::SuggestionResult;
/// let x = HumanAgentAssistantEvent::new()
/// .set_suggestion_results([
/// SuggestionResult::default()/* use setters */,
/// SuggestionResult::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_suggestion_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SuggestionResult>,
{
use std::iter::Iterator;
self.suggestion_results = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl wkt::message::Message for HumanAgentAssistantEvent {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.HumanAgentAssistantEvent"
}
}
/// An intent categorizes an end-user's intention for one conversation turn. For
/// each agent, you define many intents, where your combined intents can handle a
/// complete conversation. When an end-user writes or says something, referred to
/// as an end-user expression or end-user input, Dialogflow matches the end-user
/// input to the best intent in your agent. Matching an intent is also known as
/// intent classification.
///
/// For more information, see the [intent
/// guide](https://cloud.google.com/dialogflow/docs/intents-overview).
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Intent {
/// Optional. The unique identifier of this intent.
/// Required for
/// [Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.UpdateIntent] and
/// [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents]
/// methods.
/// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
///
/// [google.cloud.dialogflow.v2.Intents.BatchUpdateIntents]: crate::client::Intents::batch_update_intents
/// [google.cloud.dialogflow.v2.Intents.UpdateIntent]: crate::client::Intents::update_intent
pub name: std::string::String,
/// Required. The name of this intent.
pub display_name: std::string::String,
/// Optional. Indicates whether webhooks are enabled for the intent.
pub webhook_state: crate::model::intent::WebhookState,
/// Optional. The priority of this intent. Higher numbers represent higher
/// priorities.
///
/// - If the supplied value is unspecified or 0, the service
/// translates the value to 500,000, which corresponds to the
/// `Normal` priority in the console.
/// - If the supplied value is negative, the intent is ignored
/// in runtime detect intent requests.
pub priority: i32,
/// Optional. Indicates whether this is a fallback intent.
pub is_fallback: bool,
/// Optional. Indicates whether Machine Learning is disabled for the intent.
/// Note: If `ml_disabled` setting is set to true, then this intent is not
/// taken into account during inference in `ML ONLY` match mode. Also,
/// auto-markup in the UI is turned off.
pub ml_disabled: bool,
/// Optional. Indicates that a live agent should be brought in to handle the
/// interaction with the user. In most cases, when you set this flag to true,
/// you would also want to set end_interaction to true as well. Default is
/// false.
pub live_agent_handoff: bool,
/// Optional. Indicates that this intent ends an interaction. Some integrations
/// (e.g., Actions on Google or Dialogflow phone gateway) use this information
/// to close interaction with an end user. Default is false.
pub end_interaction: bool,
/// Optional. The list of context names required for this intent to be
/// triggered.
/// Format: `projects/<Project ID>/agent/sessions/-/contexts/<Context ID>`.
pub input_context_names: std::vec::Vec<std::string::String>,
/// Optional. The collection of event names that trigger the intent.
/// If the collection of input contexts is not empty, all of the contexts must
/// be present in the active user session for an event to trigger this intent.
/// Event names are limited to 150 characters.
pub events: std::vec::Vec<std::string::String>,
/// Optional. The collection of examples that the agent is
/// trained on.
pub training_phrases: std::vec::Vec<crate::model::intent::TrainingPhrase>,
/// Optional. The name of the action associated with the intent.
/// Note: The action name must not contain whitespaces.
pub action: std::string::String,
/// Optional. The collection of contexts that are activated when the intent
/// is matched. Context messages in this collection should not set the
/// parameters field. Setting the `lifespan_count` to 0 will reset the context
/// when the intent is matched.
/// Format: `projects/<Project ID>/agent/sessions/-/contexts/<Context ID>`.
pub output_contexts: std::vec::Vec<crate::model::Context>,
/// Optional. Indicates whether to delete all contexts in the current
/// session when this intent is matched.
pub reset_contexts: bool,
/// Optional. The collection of parameters associated with the intent.
pub parameters: std::vec::Vec<crate::model::intent::Parameter>,
/// Optional. The collection of rich messages corresponding to the
/// `Response` field in the Dialogflow console.
pub messages: std::vec::Vec<crate::model::intent::Message>,
/// Optional. The list of platforms for which the first responses will be
/// copied from the messages in PLATFORM_UNSPECIFIED (i.e. default platform).
pub default_response_platforms: std::vec::Vec<crate::model::intent::message::Platform>,
/// Output only.
/// Read-only. The unique identifier of the root intent in the chain of
/// followup intents. It identifies the correct followup intents chain for
/// this intent. We populate this field only in the output.
///
/// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
pub root_followup_intent_name: std::string::String,
/// Read-only after creation. The unique identifier of the parent intent in the
/// chain of followup intents. You can set this field when creating an intent,
/// for example with
/// [CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent] or
/// [BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents],
/// in order to make this intent a followup intent.
///
/// It identifies the parent followup intent.
/// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
///
/// [google.cloud.dialogflow.v2.Intents.BatchUpdateIntents]: crate::client::Intents::batch_update_intents
/// [google.cloud.dialogflow.v2.Intents.CreateIntent]: crate::client::Intents::create_intent
pub parent_followup_intent_name: std::string::String,
/// Output only. Read-only. Information about all followup intents that have
/// this intent as a direct or indirect parent. We populate this field only in
/// the output.
pub followup_intent_info: std::vec::Vec<crate::model::intent::FollowupIntentInfo>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Intent {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::Intent::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// let x = Intent::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [display_name][crate::model::Intent::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// let x = Intent::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [webhook_state][crate::model::Intent::webhook_state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// use google_cloud_dialogflow_v2::model::intent::WebhookState;
/// let x0 = Intent::new().set_webhook_state(WebhookState::Enabled);
/// let x1 = Intent::new().set_webhook_state(WebhookState::EnabledForSlotFilling);
/// ```
pub fn set_webhook_state<T: std::convert::Into<crate::model::intent::WebhookState>>(
mut self,
v: T,
) -> Self {
self.webhook_state = v.into();
self
}
/// Sets the value of [priority][crate::model::Intent::priority].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// let x = Intent::new().set_priority(42);
/// ```
pub fn set_priority<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.priority = v.into();
self
}
/// Sets the value of [is_fallback][crate::model::Intent::is_fallback].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// let x = Intent::new().set_is_fallback(true);
/// ```
pub fn set_is_fallback<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.is_fallback = v.into();
self
}
/// Sets the value of [ml_disabled][crate::model::Intent::ml_disabled].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// let x = Intent::new().set_ml_disabled(true);
/// ```
pub fn set_ml_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.ml_disabled = v.into();
self
}
/// Sets the value of [live_agent_handoff][crate::model::Intent::live_agent_handoff].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// let x = Intent::new().set_live_agent_handoff(true);
/// ```
pub fn set_live_agent_handoff<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.live_agent_handoff = v.into();
self
}
/// Sets the value of [end_interaction][crate::model::Intent::end_interaction].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// let x = Intent::new().set_end_interaction(true);
/// ```
pub fn set_end_interaction<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.end_interaction = v.into();
self
}
/// Sets the value of [input_context_names][crate::model::Intent::input_context_names].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// let x = Intent::new().set_input_context_names(["a", "b", "c"]);
/// ```
pub fn set_input_context_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.input_context_names = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [events][crate::model::Intent::events].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// let x = Intent::new().set_events(["a", "b", "c"]);
/// ```
pub fn set_events<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.events = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [training_phrases][crate::model::Intent::training_phrases].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// use google_cloud_dialogflow_v2::model::intent::TrainingPhrase;
/// let x = Intent::new()
/// .set_training_phrases([
/// TrainingPhrase::default()/* use setters */,
/// TrainingPhrase::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_training_phrases<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::TrainingPhrase>,
{
use std::iter::Iterator;
self.training_phrases = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [action][crate::model::Intent::action].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// let x = Intent::new().set_action("example");
/// ```
pub fn set_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.action = v.into();
self
}
/// Sets the value of [output_contexts][crate::model::Intent::output_contexts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// use google_cloud_dialogflow_v2::model::Context;
/// let x = Intent::new()
/// .set_output_contexts([
/// Context::default()/* use setters */,
/// Context::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_output_contexts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Context>,
{
use std::iter::Iterator;
self.output_contexts = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [reset_contexts][crate::model::Intent::reset_contexts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// let x = Intent::new().set_reset_contexts(true);
/// ```
pub fn set_reset_contexts<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.reset_contexts = v.into();
self
}
/// Sets the value of [parameters][crate::model::Intent::parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// use google_cloud_dialogflow_v2::model::intent::Parameter;
/// let x = Intent::new()
/// .set_parameters([
/// Parameter::default()/* use setters */,
/// Parameter::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_parameters<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::Parameter>,
{
use std::iter::Iterator;
self.parameters = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [messages][crate::model::Intent::messages].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// use google_cloud_dialogflow_v2::model::intent::Message;
/// let x = Intent::new()
/// .set_messages([
/// Message::default()/* use setters */,
/// Message::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_messages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::Message>,
{
use std::iter::Iterator;
self.messages = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [default_response_platforms][crate::model::Intent::default_response_platforms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// use google_cloud_dialogflow_v2::model::intent::message::Platform;
/// let x = Intent::new().set_default_response_platforms([
/// Platform::Facebook,
/// Platform::Slack,
/// Platform::Telegram,
/// ]);
/// ```
pub fn set_default_response_platforms<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::message::Platform>,
{
use std::iter::Iterator;
self.default_response_platforms = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [root_followup_intent_name][crate::model::Intent::root_followup_intent_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// let x = Intent::new().set_root_followup_intent_name("example");
/// ```
pub fn set_root_followup_intent_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.root_followup_intent_name = v.into();
self
}
/// Sets the value of [parent_followup_intent_name][crate::model::Intent::parent_followup_intent_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// let x = Intent::new().set_parent_followup_intent_name("example");
/// ```
pub fn set_parent_followup_intent_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.parent_followup_intent_name = v.into();
self
}
/// Sets the value of [followup_intent_info][crate::model::Intent::followup_intent_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Intent;
/// use google_cloud_dialogflow_v2::model::intent::FollowupIntentInfo;
/// let x = Intent::new()
/// .set_followup_intent_info([
/// FollowupIntentInfo::default()/* use setters */,
/// FollowupIntentInfo::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_followup_intent_info<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::FollowupIntentInfo>,
{
use std::iter::Iterator;
self.followup_intent_info = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Intent {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent"
}
}
/// Defines additional types related to [Intent].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod intent {
#[allow(unused_imports)]
use super::*;
/// Represents an example that the agent is trained on.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TrainingPhrase {
/// Output only. The unique identifier of this training phrase.
pub name: std::string::String,
/// Required. The type of the training phrase.
pub r#type: crate::model::intent::training_phrase::Type,
/// Required. The ordered list of training phrase parts.
/// The parts are concatenated in order to form the training phrase.
///
/// Note: The API does not automatically annotate training phrases like the
/// Dialogflow Console does.
///
/// Note: Do not forget to include whitespace at part boundaries,
/// so the training phrase is well formatted when the parts are concatenated.
///
/// If the training phrase does not need to be annotated with parameters,
/// you just need a single part with only the
/// [Part.text][google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.text]
/// field set.
///
/// If you want to annotate the training phrase, you must create multiple
/// parts, where the fields of each part are populated in one of two ways:
///
/// - `Part.text` is set to a part of the phrase that has no parameters.
/// - `Part.text` is set to a part of the phrase that you want to annotate,
/// and the `entity_type`, `alias`, and `user_defined` fields are all
/// set.
///
/// [google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.text]: crate::model::intent::training_phrase::Part::text
pub parts: std::vec::Vec<crate::model::intent::training_phrase::Part>,
/// Optional. Indicates how many times this example was added to
/// the intent. Each time a developer adds an existing sample by editing an
/// intent or training, this counter is increased.
pub times_added_count: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl TrainingPhrase {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::intent::TrainingPhrase::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::TrainingPhrase;
/// let x = TrainingPhrase::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [r#type][crate::model::intent::TrainingPhrase::type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::TrainingPhrase;
/// use google_cloud_dialogflow_v2::model::intent::training_phrase::Type;
/// let x0 = TrainingPhrase::new().set_type(Type::Example);
/// ```
pub fn set_type<T: std::convert::Into<crate::model::intent::training_phrase::Type>>(
mut self,
v: T,
) -> Self {
self.r#type = v.into();
self
}
/// Sets the value of [parts][crate::model::intent::TrainingPhrase::parts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::TrainingPhrase;
/// use google_cloud_dialogflow_v2::model::intent::training_phrase::Part;
/// let x = TrainingPhrase::new()
/// .set_parts([
/// Part::default()/* use setters */,
/// Part::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_parts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::training_phrase::Part>,
{
use std::iter::Iterator;
self.parts = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [times_added_count][crate::model::intent::TrainingPhrase::times_added_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::TrainingPhrase;
/// let x = TrainingPhrase::new().set_times_added_count(42);
/// ```
pub fn set_times_added_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.times_added_count = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for TrainingPhrase {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.TrainingPhrase"
}
}
/// Defines additional types related to [TrainingPhrase].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod training_phrase {
#[allow(unused_imports)]
use super::*;
/// Represents a part of a training phrase.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Part {
/// Required. The text for this part.
pub text: std::string::String,
/// Optional. The entity type name prefixed with `@`.
/// This field is required for annotated parts of the training phrase.
pub entity_type: std::string::String,
/// Optional. The parameter name for the value extracted from the
/// annotated part of the example.
/// This field is required for annotated parts of the training phrase.
pub alias: std::string::String,
/// Optional. Indicates whether the text was manually annotated.
/// This field is set to true when the Dialogflow Console is used to
/// manually annotate the part. When creating an annotated part with the
/// API, you must set this to true.
pub user_defined: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Part {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [text][crate::model::intent::training_phrase::Part::text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::training_phrase::Part;
/// let x = Part::new().set_text("example");
/// ```
pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.text = v.into();
self
}
/// Sets the value of [entity_type][crate::model::intent::training_phrase::Part::entity_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::training_phrase::Part;
/// let x = Part::new().set_entity_type("example");
/// ```
pub fn set_entity_type<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.entity_type = v.into();
self
}
/// Sets the value of [alias][crate::model::intent::training_phrase::Part::alias].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::training_phrase::Part;
/// let x = Part::new().set_alias("example");
/// ```
pub fn set_alias<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.alias = v.into();
self
}
/// Sets the value of [user_defined][crate::model::intent::training_phrase::Part::user_defined].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::training_phrase::Part;
/// let x = Part::new().set_user_defined(true);
/// ```
pub fn set_user_defined<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.user_defined = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Part {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part"
}
}
/// Represents different types of training phrases.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Type {
/// Not specified. This value should never be used.
Unspecified,
/// Examples do not contain @-prefixed entity type names, but example parts
/// can be annotated with entity types.
Example,
/// Templates are not annotated with entity types, but they can contain
/// @-prefixed entity type names as substrings.
/// Template mode has been deprecated. Example mode is the only supported
/// way to create new training phrases. If you have existing training
/// phrases that you've created in template mode, those will continue to
/// work.
#[deprecated]
Template,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Type::value] or
/// [Type::name].
UnknownValue(r#type::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod r#type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Type {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Example => std::option::Option::Some(1),
Self::Template => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
Self::Example => std::option::Option::Some("EXAMPLE"),
Self::Template => std::option::Option::Some("TEMPLATE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::default::Default for Type {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
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())
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<i32> for Type {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Example,
2 => Self::Template,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<&str> for Type {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TYPE_UNSPECIFIED" => Self::Unspecified,
"EXAMPLE" => Self::Example,
"TEMPLATE" => Self::Template,
_ => Self::UnknownValue(r#type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
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::Example => serializer.serialize_i32(1),
Self::Template => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
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.dialogflow.v2.Intent.TrainingPhrase.Type",
))
}
}
}
/// Represents intent parameters.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Parameter {
/// The unique identifier of this parameter.
pub name: std::string::String,
/// Required. The name of the parameter.
pub display_name: std::string::String,
/// Optional. The definition of the parameter value. It can be:
///
/// - a constant string,
/// - a parameter value defined as `$parameter_name`,
/// - an original parameter value defined as `$parameter_name.original`,
/// - a parameter value from some context defined as
/// `#context_name.parameter_name`.
pub value: std::string::String,
/// Optional. The default value to use when the `value` yields an empty
/// result.
/// Default values can be extracted from contexts by using the following
/// syntax: `#context_name.parameter_name`.
pub default_value: std::string::String,
/// Optional. The name of the entity type, prefixed with `@`, that
/// describes values of the parameter. If the parameter is
/// required, this must be provided.
pub entity_type_display_name: std::string::String,
/// Optional. Indicates whether the parameter is required. That is,
/// whether the intent cannot be completed without collecting the parameter
/// value.
pub mandatory: bool,
/// Optional. The collection of prompts that the agent can present to the
/// user in order to collect a value for the parameter.
pub prompts: std::vec::Vec<std::string::String>,
/// Optional. Indicates whether the parameter represents a list of values.
pub is_list: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Parameter {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::intent::Parameter::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Parameter;
/// let x = Parameter::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [display_name][crate::model::intent::Parameter::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Parameter;
/// let x = Parameter::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [value][crate::model::intent::Parameter::value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Parameter;
/// let x = Parameter::new().set_value("example");
/// ```
pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value = v.into();
self
}
/// Sets the value of [default_value][crate::model::intent::Parameter::default_value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Parameter;
/// let x = Parameter::new().set_default_value("example");
/// ```
pub fn set_default_value<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.default_value = v.into();
self
}
/// Sets the value of [entity_type_display_name][crate::model::intent::Parameter::entity_type_display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Parameter;
/// let x = Parameter::new().set_entity_type_display_name("example");
/// ```
pub fn set_entity_type_display_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.entity_type_display_name = v.into();
self
}
/// Sets the value of [mandatory][crate::model::intent::Parameter::mandatory].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Parameter;
/// let x = Parameter::new().set_mandatory(true);
/// ```
pub fn set_mandatory<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.mandatory = v.into();
self
}
/// Sets the value of [prompts][crate::model::intent::Parameter::prompts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Parameter;
/// let x = Parameter::new().set_prompts(["a", "b", "c"]);
/// ```
pub fn set_prompts<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.prompts = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [is_list][crate::model::intent::Parameter::is_list].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Parameter;
/// let x = Parameter::new().set_is_list(true);
/// ```
pub fn set_is_list<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.is_list = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Parameter {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Parameter"
}
}
/// A rich response message.
/// Corresponds to the intent `Response` field in the Dialogflow console.
/// For more information, see
/// [Rich response
/// messages](https://cloud.google.com/dialogflow/docs/intents-rich-messages).
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Message {
/// Optional. The platform that this message is intended for.
pub platform: crate::model::intent::message::Platform,
/// Required. The rich response message.
pub message: std::option::Option<crate::model::intent::message::Message>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Message {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [platform][crate::model::intent::Message::platform].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::Platform;
/// let x0 = Message::new().set_platform(Platform::Facebook);
/// let x1 = Message::new().set_platform(Platform::Slack);
/// let x2 = Message::new().set_platform(Platform::Telegram);
/// ```
pub fn set_platform<T: std::convert::Into<crate::model::intent::message::Platform>>(
mut self,
v: T,
) -> Self {
self.platform = v.into();
self
}
/// Sets the value of [message][crate::model::intent::Message::message].
///
/// Note that all the setters affecting `message` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::Text;
/// let x = Message::new().set_message(Some(
/// google_cloud_dialogflow_v2::model::intent::message::Message::Text(Text::default().into())));
/// ```
pub fn set_message<
T: std::convert::Into<std::option::Option<crate::model::intent::message::Message>>,
>(
mut self,
v: T,
) -> Self {
self.message = v.into();
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `Text`, `None` if the field is not set or
/// holds a different branch.
pub fn text(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::Text>> {
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::Text(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `Text`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::Text;
/// let x = Message::new().set_text(Text::default()/* use setters */);
/// assert!(x.text().is_some());
/// assert!(x.image().is_none());
/// assert!(x.quick_replies().is_none());
/// assert!(x.card().is_none());
/// assert!(x.payload().is_none());
/// assert!(x.simple_responses().is_none());
/// assert!(x.basic_card().is_none());
/// assert!(x.suggestions().is_none());
/// assert!(x.link_out_suggestion().is_none());
/// assert!(x.list_select().is_none());
/// assert!(x.carousel_select().is_none());
/// assert!(x.browse_carousel_card().is_none());
/// assert!(x.table_card().is_none());
/// assert!(x.media_content().is_none());
/// ```
pub fn set_text<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::Text>>,
>(
mut self,
v: T,
) -> Self {
self.message =
std::option::Option::Some(crate::model::intent::message::Message::Text(v.into()));
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `Image`, `None` if the field is not set or
/// holds a different branch.
pub fn image(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::Image>> {
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::Image(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `Image`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = Message::new().set_image(Image::default()/* use setters */);
/// assert!(x.image().is_some());
/// assert!(x.text().is_none());
/// assert!(x.quick_replies().is_none());
/// assert!(x.card().is_none());
/// assert!(x.payload().is_none());
/// assert!(x.simple_responses().is_none());
/// assert!(x.basic_card().is_none());
/// assert!(x.suggestions().is_none());
/// assert!(x.link_out_suggestion().is_none());
/// assert!(x.list_select().is_none());
/// assert!(x.carousel_select().is_none());
/// assert!(x.browse_carousel_card().is_none());
/// assert!(x.table_card().is_none());
/// assert!(x.media_content().is_none());
/// ```
pub fn set_image<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::Image>>,
>(
mut self,
v: T,
) -> Self {
self.message =
std::option::Option::Some(crate::model::intent::message::Message::Image(v.into()));
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `QuickReplies`, `None` if the field is not set or
/// holds a different branch.
pub fn quick_replies(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::QuickReplies>>
{
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::QuickReplies(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `QuickReplies`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::QuickReplies;
/// let x = Message::new().set_quick_replies(QuickReplies::default()/* use setters */);
/// assert!(x.quick_replies().is_some());
/// assert!(x.text().is_none());
/// assert!(x.image().is_none());
/// assert!(x.card().is_none());
/// assert!(x.payload().is_none());
/// assert!(x.simple_responses().is_none());
/// assert!(x.basic_card().is_none());
/// assert!(x.suggestions().is_none());
/// assert!(x.link_out_suggestion().is_none());
/// assert!(x.list_select().is_none());
/// assert!(x.carousel_select().is_none());
/// assert!(x.browse_carousel_card().is_none());
/// assert!(x.table_card().is_none());
/// assert!(x.media_content().is_none());
/// ```
pub fn set_quick_replies<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::QuickReplies>>,
>(
mut self,
v: T,
) -> Self {
self.message = std::option::Option::Some(
crate::model::intent::message::Message::QuickReplies(v.into()),
);
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `Card`, `None` if the field is not set or
/// holds a different branch.
pub fn card(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::Card>> {
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::Card(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `Card`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::Card;
/// let x = Message::new().set_card(Card::default()/* use setters */);
/// assert!(x.card().is_some());
/// assert!(x.text().is_none());
/// assert!(x.image().is_none());
/// assert!(x.quick_replies().is_none());
/// assert!(x.payload().is_none());
/// assert!(x.simple_responses().is_none());
/// assert!(x.basic_card().is_none());
/// assert!(x.suggestions().is_none());
/// assert!(x.link_out_suggestion().is_none());
/// assert!(x.list_select().is_none());
/// assert!(x.carousel_select().is_none());
/// assert!(x.browse_carousel_card().is_none());
/// assert!(x.table_card().is_none());
/// assert!(x.media_content().is_none());
/// ```
pub fn set_card<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::Card>>,
>(
mut self,
v: T,
) -> Self {
self.message =
std::option::Option::Some(crate::model::intent::message::Message::Card(v.into()));
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `Payload`, `None` if the field is not set or
/// holds a different branch.
pub fn payload(&self) -> std::option::Option<&std::boxed::Box<wkt::Struct>> {
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::Payload(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `Payload`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use wkt::Struct;
/// let x = Message::new().set_payload(Struct::default()/* use setters */);
/// assert!(x.payload().is_some());
/// assert!(x.text().is_none());
/// assert!(x.image().is_none());
/// assert!(x.quick_replies().is_none());
/// assert!(x.card().is_none());
/// assert!(x.simple_responses().is_none());
/// assert!(x.basic_card().is_none());
/// assert!(x.suggestions().is_none());
/// assert!(x.link_out_suggestion().is_none());
/// assert!(x.list_select().is_none());
/// assert!(x.carousel_select().is_none());
/// assert!(x.browse_carousel_card().is_none());
/// assert!(x.table_card().is_none());
/// assert!(x.media_content().is_none());
/// ```
pub fn set_payload<T: std::convert::Into<std::boxed::Box<wkt::Struct>>>(
mut self,
v: T,
) -> Self {
self.message = std::option::Option::Some(
crate::model::intent::message::Message::Payload(v.into()),
);
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `SimpleResponses`, `None` if the field is not set or
/// holds a different branch.
pub fn simple_responses(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::SimpleResponses>>
{
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::SimpleResponses(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `SimpleResponses`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::SimpleResponses;
/// let x = Message::new().set_simple_responses(SimpleResponses::default()/* use setters */);
/// assert!(x.simple_responses().is_some());
/// assert!(x.text().is_none());
/// assert!(x.image().is_none());
/// assert!(x.quick_replies().is_none());
/// assert!(x.card().is_none());
/// assert!(x.payload().is_none());
/// assert!(x.basic_card().is_none());
/// assert!(x.suggestions().is_none());
/// assert!(x.link_out_suggestion().is_none());
/// assert!(x.list_select().is_none());
/// assert!(x.carousel_select().is_none());
/// assert!(x.browse_carousel_card().is_none());
/// assert!(x.table_card().is_none());
/// assert!(x.media_content().is_none());
/// ```
pub fn set_simple_responses<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::SimpleResponses>>,
>(
mut self,
v: T,
) -> Self {
self.message = std::option::Option::Some(
crate::model::intent::message::Message::SimpleResponses(v.into()),
);
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `BasicCard`, `None` if the field is not set or
/// holds a different branch.
pub fn basic_card(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::BasicCard>>
{
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::BasicCard(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `BasicCard`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::BasicCard;
/// let x = Message::new().set_basic_card(BasicCard::default()/* use setters */);
/// assert!(x.basic_card().is_some());
/// assert!(x.text().is_none());
/// assert!(x.image().is_none());
/// assert!(x.quick_replies().is_none());
/// assert!(x.card().is_none());
/// assert!(x.payload().is_none());
/// assert!(x.simple_responses().is_none());
/// assert!(x.suggestions().is_none());
/// assert!(x.link_out_suggestion().is_none());
/// assert!(x.list_select().is_none());
/// assert!(x.carousel_select().is_none());
/// assert!(x.browse_carousel_card().is_none());
/// assert!(x.table_card().is_none());
/// assert!(x.media_content().is_none());
/// ```
pub fn set_basic_card<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::BasicCard>>,
>(
mut self,
v: T,
) -> Self {
self.message = std::option::Option::Some(
crate::model::intent::message::Message::BasicCard(v.into()),
);
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `Suggestions`, `None` if the field is not set or
/// holds a different branch.
pub fn suggestions(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::Suggestions>>
{
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::Suggestions(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `Suggestions`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::Suggestions;
/// let x = Message::new().set_suggestions(Suggestions::default()/* use setters */);
/// assert!(x.suggestions().is_some());
/// assert!(x.text().is_none());
/// assert!(x.image().is_none());
/// assert!(x.quick_replies().is_none());
/// assert!(x.card().is_none());
/// assert!(x.payload().is_none());
/// assert!(x.simple_responses().is_none());
/// assert!(x.basic_card().is_none());
/// assert!(x.link_out_suggestion().is_none());
/// assert!(x.list_select().is_none());
/// assert!(x.carousel_select().is_none());
/// assert!(x.browse_carousel_card().is_none());
/// assert!(x.table_card().is_none());
/// assert!(x.media_content().is_none());
/// ```
pub fn set_suggestions<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::Suggestions>>,
>(
mut self,
v: T,
) -> Self {
self.message = std::option::Option::Some(
crate::model::intent::message::Message::Suggestions(v.into()),
);
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `LinkOutSuggestion`, `None` if the field is not set or
/// holds a different branch.
pub fn link_out_suggestion(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::LinkOutSuggestion>>
{
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::LinkOutSuggestion(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `LinkOutSuggestion`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::LinkOutSuggestion;
/// let x = Message::new().set_link_out_suggestion(LinkOutSuggestion::default()/* use setters */);
/// assert!(x.link_out_suggestion().is_some());
/// assert!(x.text().is_none());
/// assert!(x.image().is_none());
/// assert!(x.quick_replies().is_none());
/// assert!(x.card().is_none());
/// assert!(x.payload().is_none());
/// assert!(x.simple_responses().is_none());
/// assert!(x.basic_card().is_none());
/// assert!(x.suggestions().is_none());
/// assert!(x.list_select().is_none());
/// assert!(x.carousel_select().is_none());
/// assert!(x.browse_carousel_card().is_none());
/// assert!(x.table_card().is_none());
/// assert!(x.media_content().is_none());
/// ```
pub fn set_link_out_suggestion<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::LinkOutSuggestion>>,
>(
mut self,
v: T,
) -> Self {
self.message = std::option::Option::Some(
crate::model::intent::message::Message::LinkOutSuggestion(v.into()),
);
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `ListSelect`, `None` if the field is not set or
/// holds a different branch.
pub fn list_select(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::ListSelect>>
{
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::ListSelect(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `ListSelect`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::ListSelect;
/// let x = Message::new().set_list_select(ListSelect::default()/* use setters */);
/// assert!(x.list_select().is_some());
/// assert!(x.text().is_none());
/// assert!(x.image().is_none());
/// assert!(x.quick_replies().is_none());
/// assert!(x.card().is_none());
/// assert!(x.payload().is_none());
/// assert!(x.simple_responses().is_none());
/// assert!(x.basic_card().is_none());
/// assert!(x.suggestions().is_none());
/// assert!(x.link_out_suggestion().is_none());
/// assert!(x.carousel_select().is_none());
/// assert!(x.browse_carousel_card().is_none());
/// assert!(x.table_card().is_none());
/// assert!(x.media_content().is_none());
/// ```
pub fn set_list_select<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::ListSelect>>,
>(
mut self,
v: T,
) -> Self {
self.message = std::option::Option::Some(
crate::model::intent::message::Message::ListSelect(v.into()),
);
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `CarouselSelect`, `None` if the field is not set or
/// holds a different branch.
pub fn carousel_select(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::CarouselSelect>>
{
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::CarouselSelect(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `CarouselSelect`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::CarouselSelect;
/// let x = Message::new().set_carousel_select(CarouselSelect::default()/* use setters */);
/// assert!(x.carousel_select().is_some());
/// assert!(x.text().is_none());
/// assert!(x.image().is_none());
/// assert!(x.quick_replies().is_none());
/// assert!(x.card().is_none());
/// assert!(x.payload().is_none());
/// assert!(x.simple_responses().is_none());
/// assert!(x.basic_card().is_none());
/// assert!(x.suggestions().is_none());
/// assert!(x.link_out_suggestion().is_none());
/// assert!(x.list_select().is_none());
/// assert!(x.browse_carousel_card().is_none());
/// assert!(x.table_card().is_none());
/// assert!(x.media_content().is_none());
/// ```
pub fn set_carousel_select<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::CarouselSelect>>,
>(
mut self,
v: T,
) -> Self {
self.message = std::option::Option::Some(
crate::model::intent::message::Message::CarouselSelect(v.into()),
);
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `BrowseCarouselCard`, `None` if the field is not set or
/// holds a different branch.
pub fn browse_carousel_card(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::BrowseCarouselCard>>
{
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::BrowseCarouselCard(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `BrowseCarouselCard`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::BrowseCarouselCard;
/// let x = Message::new().set_browse_carousel_card(BrowseCarouselCard::default()/* use setters */);
/// assert!(x.browse_carousel_card().is_some());
/// assert!(x.text().is_none());
/// assert!(x.image().is_none());
/// assert!(x.quick_replies().is_none());
/// assert!(x.card().is_none());
/// assert!(x.payload().is_none());
/// assert!(x.simple_responses().is_none());
/// assert!(x.basic_card().is_none());
/// assert!(x.suggestions().is_none());
/// assert!(x.link_out_suggestion().is_none());
/// assert!(x.list_select().is_none());
/// assert!(x.carousel_select().is_none());
/// assert!(x.table_card().is_none());
/// assert!(x.media_content().is_none());
/// ```
pub fn set_browse_carousel_card<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::BrowseCarouselCard>>,
>(
mut self,
v: T,
) -> Self {
self.message = std::option::Option::Some(
crate::model::intent::message::Message::BrowseCarouselCard(v.into()),
);
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `TableCard`, `None` if the field is not set or
/// holds a different branch.
pub fn table_card(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::TableCard>>
{
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::TableCard(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `TableCard`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::TableCard;
/// let x = Message::new().set_table_card(TableCard::default()/* use setters */);
/// assert!(x.table_card().is_some());
/// assert!(x.text().is_none());
/// assert!(x.image().is_none());
/// assert!(x.quick_replies().is_none());
/// assert!(x.card().is_none());
/// assert!(x.payload().is_none());
/// assert!(x.simple_responses().is_none());
/// assert!(x.basic_card().is_none());
/// assert!(x.suggestions().is_none());
/// assert!(x.link_out_suggestion().is_none());
/// assert!(x.list_select().is_none());
/// assert!(x.carousel_select().is_none());
/// assert!(x.browse_carousel_card().is_none());
/// assert!(x.media_content().is_none());
/// ```
pub fn set_table_card<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::TableCard>>,
>(
mut self,
v: T,
) -> Self {
self.message = std::option::Option::Some(
crate::model::intent::message::Message::TableCard(v.into()),
);
self
}
/// The value of [message][crate::model::intent::Message::message]
/// if it holds a `MediaContent`, `None` if the field is not set or
/// holds a different branch.
pub fn media_content(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::MediaContent>>
{
#[allow(unreachable_patterns)]
self.message.as_ref().and_then(|v| match v {
crate::model::intent::message::Message::MediaContent(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [message][crate::model::intent::Message::message]
/// to hold a `MediaContent`.
///
/// Note that all the setters affecting `message` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::Message;
/// use google_cloud_dialogflow_v2::model::intent::message::MediaContent;
/// let x = Message::new().set_media_content(MediaContent::default()/* use setters */);
/// assert!(x.media_content().is_some());
/// assert!(x.text().is_none());
/// assert!(x.image().is_none());
/// assert!(x.quick_replies().is_none());
/// assert!(x.card().is_none());
/// assert!(x.payload().is_none());
/// assert!(x.simple_responses().is_none());
/// assert!(x.basic_card().is_none());
/// assert!(x.suggestions().is_none());
/// assert!(x.link_out_suggestion().is_none());
/// assert!(x.list_select().is_none());
/// assert!(x.carousel_select().is_none());
/// assert!(x.browse_carousel_card().is_none());
/// assert!(x.table_card().is_none());
/// ```
pub fn set_media_content<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::MediaContent>>,
>(
mut self,
v: T,
) -> Self {
self.message = std::option::Option::Some(
crate::model::intent::message::Message::MediaContent(v.into()),
);
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Message {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message"
}
}
/// Defines additional types related to [Message].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod message {
#[allow(unused_imports)]
use super::*;
/// The text response message.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Text {
/// Optional. The collection of the agent's responses.
pub text: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Text {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [text][crate::model::intent::message::Text::text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::Text;
/// let x = Text::new().set_text(["a", "b", "c"]);
/// ```
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
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Text {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.Text"
}
}
/// The image response message.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Image {
/// Optional. The public URI to an image file.
pub image_uri: std::string::String,
/// Optional. A text description of the image to be used for accessibility,
/// e.g., screen readers.
pub accessibility_text: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Image {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [image_uri][crate::model::intent::message::Image::image_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = Image::new().set_image_uri("example");
/// ```
pub fn set_image_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.image_uri = v.into();
self
}
/// Sets the value of [accessibility_text][crate::model::intent::message::Image::accessibility_text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = Image::new().set_accessibility_text("example");
/// ```
pub fn set_accessibility_text<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.accessibility_text = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Image {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.Image"
}
}
/// The quick replies response message.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QuickReplies {
/// Optional. The title of the collection of quick replies.
pub title: std::string::String,
/// Optional. The collection of quick replies.
pub quick_replies: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl QuickReplies {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [title][crate::model::intent::message::QuickReplies::title].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::QuickReplies;
/// let x = QuickReplies::new().set_title("example");
/// ```
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = v.into();
self
}
/// Sets the value of [quick_replies][crate::model::intent::message::QuickReplies::quick_replies].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::QuickReplies;
/// let x = QuickReplies::new().set_quick_replies(["a", "b", "c"]);
/// ```
pub fn set_quick_replies<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.quick_replies = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for QuickReplies {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.QuickReplies"
}
}
/// The card response message.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Card {
/// Optional. The title of the card.
pub title: std::string::String,
/// Optional. The subtitle of the card.
pub subtitle: std::string::String,
/// Optional. The public URI to an image file for the card.
pub image_uri: std::string::String,
/// Optional. The collection of card buttons.
pub buttons: std::vec::Vec<crate::model::intent::message::card::Button>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Card {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [title][crate::model::intent::message::Card::title].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::Card;
/// let x = Card::new().set_title("example");
/// ```
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = v.into();
self
}
/// Sets the value of [subtitle][crate::model::intent::message::Card::subtitle].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::Card;
/// let x = Card::new().set_subtitle("example");
/// ```
pub fn set_subtitle<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.subtitle = v.into();
self
}
/// Sets the value of [image_uri][crate::model::intent::message::Card::image_uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::Card;
/// let x = Card::new().set_image_uri("example");
/// ```
pub fn set_image_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.image_uri = v.into();
self
}
/// Sets the value of [buttons][crate::model::intent::message::Card::buttons].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::Card;
/// use google_cloud_dialogflow_v2::model::intent::message::card::Button;
/// let x = Card::new()
/// .set_buttons([
/// Button::default()/* use setters */,
/// Button::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_buttons<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::message::card::Button>,
{
use std::iter::Iterator;
self.buttons = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Card {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.Card"
}
}
/// Defines additional types related to [Card].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod card {
#[allow(unused_imports)]
use super::*;
/// Contains information about a button.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Button {
/// Optional. The text to show on the button.
pub text: std::string::String,
/// Optional. The text to send back to the Dialogflow API or a URI to
/// open.
pub postback: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Button {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [text][crate::model::intent::message::card::Button::text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::card::Button;
/// let x = Button::new().set_text("example");
/// ```
pub fn set_text<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.text = v.into();
self
}
/// Sets the value of [postback][crate::model::intent::message::card::Button::postback].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::card::Button;
/// let x = Button::new().set_postback("example");
/// ```
pub fn set_postback<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.postback = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Button {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.Card.Button"
}
}
}
/// The simple response message containing speech or text.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SimpleResponse {
/// One of text_to_speech or ssml must be provided. The plain text of the
/// speech output. Mutually exclusive with ssml.
pub text_to_speech: std::string::String,
/// One of text_to_speech or ssml must be provided. Structured spoken
/// response to the user in the SSML format. Mutually exclusive with
/// text_to_speech.
pub ssml: std::string::String,
/// Optional. The text to display.
pub display_text: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl SimpleResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [text_to_speech][crate::model::intent::message::SimpleResponse::text_to_speech].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::SimpleResponse;
/// let x = SimpleResponse::new().set_text_to_speech("example");
/// ```
pub fn set_text_to_speech<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.text_to_speech = v.into();
self
}
/// Sets the value of [ssml][crate::model::intent::message::SimpleResponse::ssml].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::SimpleResponse;
/// let x = SimpleResponse::new().set_ssml("example");
/// ```
pub fn set_ssml<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.ssml = v.into();
self
}
/// Sets the value of [display_text][crate::model::intent::message::SimpleResponse::display_text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::SimpleResponse;
/// let x = SimpleResponse::new().set_display_text("example");
/// ```
pub fn set_display_text<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.display_text = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for SimpleResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.SimpleResponse"
}
}
/// The collection of simple response candidates.
/// This message in `QueryResult.fulfillment_messages` and
/// `WebhookResponse.fulfillment_messages` should contain only one
/// `SimpleResponse`.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SimpleResponses {
/// Required. The list of simple responses.
pub simple_responses: std::vec::Vec<crate::model::intent::message::SimpleResponse>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl SimpleResponses {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [simple_responses][crate::model::intent::message::SimpleResponses::simple_responses].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::SimpleResponses;
/// use google_cloud_dialogflow_v2::model::intent::message::SimpleResponse;
/// let x = SimpleResponses::new()
/// .set_simple_responses([
/// SimpleResponse::default()/* use setters */,
/// SimpleResponse::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_simple_responses<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::message::SimpleResponse>,
{
use std::iter::Iterator;
self.simple_responses = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for SimpleResponses {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.SimpleResponses"
}
}
/// The basic card message. Useful for displaying information.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BasicCard {
/// Optional. The title of the card.
pub title: std::string::String,
/// Optional. The subtitle of the card.
pub subtitle: std::string::String,
/// Required, unless image is present. The body text of the card.
pub formatted_text: std::string::String,
/// Optional. The image for the card.
pub image: std::option::Option<crate::model::intent::message::Image>,
/// Optional. The collection of card buttons.
pub buttons: std::vec::Vec<crate::model::intent::message::basic_card::Button>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl BasicCard {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [title][crate::model::intent::message::BasicCard::title].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::BasicCard;
/// let x = BasicCard::new().set_title("example");
/// ```
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = v.into();
self
}
/// Sets the value of [subtitle][crate::model::intent::message::BasicCard::subtitle].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::BasicCard;
/// let x = BasicCard::new().set_subtitle("example");
/// ```
pub fn set_subtitle<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.subtitle = v.into();
self
}
/// Sets the value of [formatted_text][crate::model::intent::message::BasicCard::formatted_text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::BasicCard;
/// let x = BasicCard::new().set_formatted_text("example");
/// ```
pub fn set_formatted_text<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.formatted_text = v.into();
self
}
/// Sets the value of [image][crate::model::intent::message::BasicCard::image].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::BasicCard;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = BasicCard::new().set_image(Image::default()/* use setters */);
/// ```
pub fn set_image<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::intent::message::Image>,
{
self.image = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [image][crate::model::intent::message::BasicCard::image].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::BasicCard;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = BasicCard::new().set_or_clear_image(Some(Image::default()/* use setters */));
/// let x = BasicCard::new().set_or_clear_image(None::<Image>);
/// ```
pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::intent::message::Image>,
{
self.image = v.map(|x| x.into());
self
}
/// Sets the value of [buttons][crate::model::intent::message::BasicCard::buttons].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::BasicCard;
/// use google_cloud_dialogflow_v2::model::intent::message::basic_card::Button;
/// let x = BasicCard::new()
/// .set_buttons([
/// Button::default()/* use setters */,
/// Button::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_buttons<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::message::basic_card::Button>,
{
use std::iter::Iterator;
self.buttons = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for BasicCard {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.BasicCard"
}
}
/// Defines additional types related to [BasicCard].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod basic_card {
#[allow(unused_imports)]
use super::*;
/// The button object that appears at the bottom of a card.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Button {
/// Required. The title of the button.
pub title: std::string::String,
/// Required. Action to take when a user taps on the button.
pub open_uri_action: std::option::Option<
crate::model::intent::message::basic_card::button::OpenUriAction,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Button {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [title][crate::model::intent::message::basic_card::Button::title].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::basic_card::Button;
/// let x = Button::new().set_title("example");
/// ```
pub fn set_title<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.title = v.into();
self
}
/// Sets the value of [open_uri_action][crate::model::intent::message::basic_card::Button::open_uri_action].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::basic_card::Button;
/// use google_cloud_dialogflow_v2::model::intent::message::basic_card::button::OpenUriAction;
/// let x = Button::new().set_open_uri_action(OpenUriAction::default()/* use setters */);
/// ```
pub fn set_open_uri_action<T>(mut self, v: T) -> Self
where
T: std::convert::Into<
crate::model::intent::message::basic_card::button::OpenUriAction,
>,
{
self.open_uri_action = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [open_uri_action][crate::model::intent::message::basic_card::Button::open_uri_action].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::basic_card::Button;
/// use google_cloud_dialogflow_v2::model::intent::message::basic_card::button::OpenUriAction;
/// let x = Button::new().set_or_clear_open_uri_action(Some(OpenUriAction::default()/* use setters */));
/// let x = Button::new().set_or_clear_open_uri_action(None::<OpenUriAction>);
/// ```
pub fn set_or_clear_open_uri_action<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<
crate::model::intent::message::basic_card::button::OpenUriAction,
>,
{
self.open_uri_action = v.map(|x| x.into());
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Button {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button"
}
}
/// Defines additional types related to [Button].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod button {
#[allow(unused_imports)]
use super::*;
/// Opens the given URI.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OpenUriAction {
/// Required. The HTTP or HTTPS scheme URI.
pub uri: std::string::String,
pub(crate) _unknown_fields:
serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl OpenUriAction {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [uri][crate::model::intent::message::basic_card::button::OpenUriAction::uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::basic_card::button::OpenUriAction;
/// let x = OpenUriAction::new().set_uri("example");
/// ```
pub fn set_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.uri = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for OpenUriAction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction"
}
}
}
}
/// The suggestion chip message that the user can tap to quickly post a reply
/// to the conversation.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Suggestion {
/// Required. The text shown the in the suggestion chip.
pub title: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Suggestion {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [title][crate::model::intent::message::Suggestion::title].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::Suggestion;
/// let x = Suggestion::new().set_title("example");
/// ```
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Suggestion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.Suggestion"
}
}
/// The collection of suggestions.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Suggestions {
/// Required. The list of suggested replies.
pub suggestions: std::vec::Vec<crate::model::intent::message::Suggestion>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Suggestions {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [suggestions][crate::model::intent::message::Suggestions::suggestions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::Suggestions;
/// use google_cloud_dialogflow_v2::model::intent::message::Suggestion;
/// let x = Suggestions::new()
/// .set_suggestions([
/// Suggestion::default()/* use setters */,
/// Suggestion::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_suggestions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::message::Suggestion>,
{
use std::iter::Iterator;
self.suggestions = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Suggestions {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.Suggestions"
}
}
/// The suggestion chip message that allows the user to jump out to the app
/// or website associated with this agent.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LinkOutSuggestion {
/// Required. The name of the app or site this chip is linking to.
pub destination_name: std::string::String,
/// Required. The URI of the app or site to open when the user taps the
/// suggestion chip.
pub uri: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl LinkOutSuggestion {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [destination_name][crate::model::intent::message::LinkOutSuggestion::destination_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::LinkOutSuggestion;
/// let x = LinkOutSuggestion::new().set_destination_name("example");
/// ```
pub fn set_destination_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.destination_name = v.into();
self
}
/// Sets the value of [uri][crate::model::intent::message::LinkOutSuggestion::uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::LinkOutSuggestion;
/// let x = LinkOutSuggestion::new().set_uri("example");
/// ```
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for LinkOutSuggestion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion"
}
}
/// The card for presenting a list of options to select from.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSelect {
/// Optional. The overall title of the list.
pub title: std::string::String,
/// Required. List items.
pub items: std::vec::Vec<crate::model::intent::message::list_select::Item>,
/// Optional. Subtitle of the list.
pub subtitle: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl ListSelect {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [title][crate::model::intent::message::ListSelect::title].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::ListSelect;
/// let x = ListSelect::new().set_title("example");
/// ```
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = v.into();
self
}
/// Sets the value of [items][crate::model::intent::message::ListSelect::items].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::ListSelect;
/// use google_cloud_dialogflow_v2::model::intent::message::list_select::Item;
/// let x = ListSelect::new()
/// .set_items([
/// Item::default()/* use setters */,
/// Item::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::message::list_select::Item>,
{
use std::iter::Iterator;
self.items = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [subtitle][crate::model::intent::message::ListSelect::subtitle].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::ListSelect;
/// let x = ListSelect::new().set_subtitle("example");
/// ```
pub fn set_subtitle<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.subtitle = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for ListSelect {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.ListSelect"
}
}
/// Defines additional types related to [ListSelect].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod list_select {
#[allow(unused_imports)]
use super::*;
/// An item in the list.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Item {
/// Required. Additional information about this option.
pub info: std::option::Option<crate::model::intent::message::SelectItemInfo>,
/// Required. The title of the list item.
pub title: std::string::String,
/// Optional. The main text describing the item.
pub description: std::string::String,
/// Optional. The image to display.
pub image: std::option::Option<crate::model::intent::message::Image>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Item {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [info][crate::model::intent::message::list_select::Item::info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::list_select::Item;
/// use google_cloud_dialogflow_v2::model::intent::message::SelectItemInfo;
/// let x = Item::new().set_info(SelectItemInfo::default()/* use setters */);
/// ```
pub fn set_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::intent::message::SelectItemInfo>,
{
self.info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [info][crate::model::intent::message::list_select::Item::info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::list_select::Item;
/// use google_cloud_dialogflow_v2::model::intent::message::SelectItemInfo;
/// let x = Item::new().set_or_clear_info(Some(SelectItemInfo::default()/* use setters */));
/// let x = Item::new().set_or_clear_info(None::<SelectItemInfo>);
/// ```
pub fn set_or_clear_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::intent::message::SelectItemInfo>,
{
self.info = v.map(|x| x.into());
self
}
/// Sets the value of [title][crate::model::intent::message::list_select::Item::title].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::list_select::Item;
/// let x = Item::new().set_title("example");
/// ```
pub fn set_title<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.title = v.into();
self
}
/// Sets the value of [description][crate::model::intent::message::list_select::Item::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::list_select::Item;
/// let x = Item::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.description = v.into();
self
}
/// Sets the value of [image][crate::model::intent::message::list_select::Item::image].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::list_select::Item;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = Item::new().set_image(Image::default()/* use setters */);
/// ```
pub fn set_image<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::intent::message::Image>,
{
self.image = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [image][crate::model::intent::message::list_select::Item::image].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::list_select::Item;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = Item::new().set_or_clear_image(Some(Image::default()/* use setters */));
/// let x = Item::new().set_or_clear_image(None::<Image>);
/// ```
pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::intent::message::Image>,
{
self.image = v.map(|x| x.into());
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Item {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item"
}
}
}
/// The card for presenting a carousel of options to select from.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CarouselSelect {
/// Required. Carousel items.
pub items: std::vec::Vec<crate::model::intent::message::carousel_select::Item>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl CarouselSelect {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [items][crate::model::intent::message::CarouselSelect::items].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::CarouselSelect;
/// use google_cloud_dialogflow_v2::model::intent::message::carousel_select::Item;
/// let x = CarouselSelect::new()
/// .set_items([
/// Item::default()/* use setters */,
/// Item::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::message::carousel_select::Item>,
{
use std::iter::Iterator;
self.items = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for CarouselSelect {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.CarouselSelect"
}
}
/// Defines additional types related to [CarouselSelect].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod carousel_select {
#[allow(unused_imports)]
use super::*;
/// An item in the carousel.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Item {
/// Required. Additional info about the option item.
pub info: std::option::Option<crate::model::intent::message::SelectItemInfo>,
/// Required. Title of the carousel item.
pub title: std::string::String,
/// Optional. The body text of the card.
pub description: std::string::String,
/// Optional. The image to display.
pub image: std::option::Option<crate::model::intent::message::Image>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Item {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [info][crate::model::intent::message::carousel_select::Item::info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::carousel_select::Item;
/// use google_cloud_dialogflow_v2::model::intent::message::SelectItemInfo;
/// let x = Item::new().set_info(SelectItemInfo::default()/* use setters */);
/// ```
pub fn set_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::intent::message::SelectItemInfo>,
{
self.info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [info][crate::model::intent::message::carousel_select::Item::info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::carousel_select::Item;
/// use google_cloud_dialogflow_v2::model::intent::message::SelectItemInfo;
/// let x = Item::new().set_or_clear_info(Some(SelectItemInfo::default()/* use setters */));
/// let x = Item::new().set_or_clear_info(None::<SelectItemInfo>);
/// ```
pub fn set_or_clear_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::intent::message::SelectItemInfo>,
{
self.info = v.map(|x| x.into());
self
}
/// Sets the value of [title][crate::model::intent::message::carousel_select::Item::title].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::carousel_select::Item;
/// let x = Item::new().set_title("example");
/// ```
pub fn set_title<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.title = v.into();
self
}
/// Sets the value of [description][crate::model::intent::message::carousel_select::Item::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::carousel_select::Item;
/// let x = Item::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.description = v.into();
self
}
/// Sets the value of [image][crate::model::intent::message::carousel_select::Item::image].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::carousel_select::Item;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = Item::new().set_image(Image::default()/* use setters */);
/// ```
pub fn set_image<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::intent::message::Image>,
{
self.image = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [image][crate::model::intent::message::carousel_select::Item::image].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::carousel_select::Item;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = Item::new().set_or_clear_image(Some(Image::default()/* use setters */));
/// let x = Item::new().set_or_clear_image(None::<Image>);
/// ```
pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::intent::message::Image>,
{
self.image = v.map(|x| x.into());
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Item {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item"
}
}
}
/// Additional info about the select item for when it is triggered in a
/// dialog.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SelectItemInfo {
/// Required. A unique key that will be sent back to the agent if this
/// response is given.
pub key: std::string::String,
/// Optional. A list of synonyms that can also be used to trigger this
/// item in dialog.
pub synonyms: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl SelectItemInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [key][crate::model::intent::message::SelectItemInfo::key].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::SelectItemInfo;
/// let x = SelectItemInfo::new().set_key("example");
/// ```
pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key = v.into();
self
}
/// Sets the value of [synonyms][crate::model::intent::message::SelectItemInfo::synonyms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::SelectItemInfo;
/// let x = SelectItemInfo::new().set_synonyms(["a", "b", "c"]);
/// ```
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
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for SelectItemInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo"
}
}
/// The media content card for Actions on Google.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MediaContent {
/// Optional. What type of media is the content (ie "audio").
pub media_type: crate::model::intent::message::media_content::ResponseMediaType,
/// Required. List of media objects.
pub media_objects:
std::vec::Vec<crate::model::intent::message::media_content::ResponseMediaObject>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl MediaContent {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [media_type][crate::model::intent::message::MediaContent::media_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::MediaContent;
/// use google_cloud_dialogflow_v2::model::intent::message::media_content::ResponseMediaType;
/// let x0 = MediaContent::new().set_media_type(ResponseMediaType::Audio);
/// ```
pub fn set_media_type<
T: std::convert::Into<crate::model::intent::message::media_content::ResponseMediaType>,
>(
mut self,
v: T,
) -> Self {
self.media_type = v.into();
self
}
/// Sets the value of [media_objects][crate::model::intent::message::MediaContent::media_objects].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::MediaContent;
/// use google_cloud_dialogflow_v2::model::intent::message::media_content::ResponseMediaObject;
/// let x = MediaContent::new()
/// .set_media_objects([
/// ResponseMediaObject::default()/* use setters */,
/// ResponseMediaObject::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_media_objects<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::intent::message::media_content::ResponseMediaObject,
>,
{
use std::iter::Iterator;
self.media_objects = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for MediaContent {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.MediaContent"
}
}
/// Defines additional types related to [MediaContent].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod media_content {
#[allow(unused_imports)]
use super::*;
/// Response media object for media content card.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResponseMediaObject {
/// Required. Name of media card.
pub name: std::string::String,
/// Optional. Description of media card.
pub description: std::string::String,
/// Required. Url where the media is stored.
pub content_url: std::string::String,
/// Image to show with the media card.
pub image: std::option::Option<
crate::model::intent::message::media_content::response_media_object::Image,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl ResponseMediaObject {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::intent::message::media_content::ResponseMediaObject::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::media_content::ResponseMediaObject;
/// let x = ResponseMediaObject::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.name = v.into();
self
}
/// Sets the value of [description][crate::model::intent::message::media_content::ResponseMediaObject::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::media_content::ResponseMediaObject;
/// let x = ResponseMediaObject::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.description = v.into();
self
}
/// Sets the value of [content_url][crate::model::intent::message::media_content::ResponseMediaObject::content_url].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::media_content::ResponseMediaObject;
/// let x = ResponseMediaObject::new().set_content_url("example");
/// ```
pub fn set_content_url<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.content_url = v.into();
self
}
/// Sets the value of [image][crate::model::intent::message::media_content::ResponseMediaObject::image].
///
/// Note that all the setters affecting `image` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::media_content::ResponseMediaObject;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = ResponseMediaObject::new().set_image(Some(
/// google_cloud_dialogflow_v2::model::intent::message::media_content::response_media_object::Image::LargeImage(Image::default().into())));
/// ```
pub fn set_image<T: std::convert::Into<std::option::Option<crate::model::intent::message::media_content::response_media_object::Image>>>(mut self, v: T) -> Self
{
self.image = v.into();
self
}
/// The value of [image][crate::model::intent::message::media_content::ResponseMediaObject::image]
/// if it holds a `LargeImage`, `None` if the field is not set or
/// holds a different branch.
pub fn large_image(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::Image>>
{
#[allow(unreachable_patterns)]
self.image.as_ref().and_then(|v| match v {
crate::model::intent::message::media_content::response_media_object::Image::LargeImage(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [image][crate::model::intent::message::media_content::ResponseMediaObject::image]
/// to hold a `LargeImage`.
///
/// Note that all the setters affecting `image` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::media_content::ResponseMediaObject;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = ResponseMediaObject::new().set_large_image(Image::default()/* use setters */);
/// assert!(x.large_image().is_some());
/// assert!(x.icon().is_none());
/// ```
pub fn set_large_image<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::Image>>,
>(
mut self,
v: T,
) -> Self {
self.image = std::option::Option::Some(
crate::model::intent::message::media_content::response_media_object::Image::LargeImage(
v.into()
)
);
self
}
/// The value of [image][crate::model::intent::message::media_content::ResponseMediaObject::image]
/// if it holds a `Icon`, `None` if the field is not set or
/// holds a different branch.
pub fn icon(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::intent::message::Image>>
{
#[allow(unreachable_patterns)]
self.image.as_ref().and_then(|v| match v {
crate::model::intent::message::media_content::response_media_object::Image::Icon(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [image][crate::model::intent::message::media_content::ResponseMediaObject::image]
/// to hold a `Icon`.
///
/// Note that all the setters affecting `image` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::media_content::ResponseMediaObject;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = ResponseMediaObject::new().set_icon(Image::default()/* use setters */);
/// assert!(x.icon().is_some());
/// assert!(x.large_image().is_none());
/// ```
pub fn set_icon<
T: std::convert::Into<std::boxed::Box<crate::model::intent::message::Image>>,
>(
mut self,
v: T,
) -> Self {
self.image = std::option::Option::Some(
crate::model::intent::message::media_content::response_media_object::Image::Icon(
v.into()
)
);
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for ResponseMediaObject {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject"
}
}
/// Defines additional types related to [ResponseMediaObject].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod response_media_object {
#[allow(unused_imports)]
use super::*;
/// Image to show with the media card.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Image {
/// Optional. Image to display above media content.
LargeImage(std::boxed::Box<crate::model::intent::message::Image>),
/// Optional. Icon to display above media content.
Icon(std::boxed::Box<crate::model::intent::message::Image>),
}
}
/// Format of response media type.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ResponseMediaType {
/// Unspecified.
Unspecified,
/// Response media type is audio.
Audio,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ResponseMediaType::value] or
/// [ResponseMediaType::name].
UnknownValue(response_media_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod response_media_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl ResponseMediaType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Audio => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("RESPONSE_MEDIA_TYPE_UNSPECIFIED")
}
Self::Audio => std::option::Option::Some("AUDIO"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::default::Default for ResponseMediaType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::fmt::Display for ResponseMediaType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<i32> for ResponseMediaType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Audio,
_ => Self::UnknownValue(response_media_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<&str> for ResponseMediaType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"RESPONSE_MEDIA_TYPE_UNSPECIFIED" => Self::Unspecified,
"AUDIO" => Self::Audio,
_ => Self::UnknownValue(response_media_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl serde::ser::Serialize for ResponseMediaType {
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::Audio => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for ResponseMediaType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ResponseMediaType>::new(
".google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaType"))
}
}
}
/// Browse Carousel Card for Actions on Google.
/// <https://developers.google.com/actions/assistant/responses#browsing_carousel>
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BrowseCarouselCard {
/// Required. List of items in the Browse Carousel Card. Minimum of two
/// items, maximum of ten.
pub items: std::vec::Vec<
crate::model::intent::message::browse_carousel_card::BrowseCarouselCardItem,
>,
/// Optional. Settings for displaying the image. Applies to every image in
/// [items][google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.items].
///
/// [google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.items]: crate::model::intent::message::BrowseCarouselCard::items
pub image_display_options:
crate::model::intent::message::browse_carousel_card::ImageDisplayOptions,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl BrowseCarouselCard {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [items][crate::model::intent::message::BrowseCarouselCard::items].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::BrowseCarouselCard;
/// use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::BrowseCarouselCardItem;
/// let x = BrowseCarouselCard::new()
/// .set_items([
/// BrowseCarouselCardItem::default()/* use setters */,
/// BrowseCarouselCardItem::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::intent::message::browse_carousel_card::BrowseCarouselCardItem,
>,
{
use std::iter::Iterator;
self.items = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [image_display_options][crate::model::intent::message::BrowseCarouselCard::image_display_options].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::BrowseCarouselCard;
/// use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::ImageDisplayOptions;
/// let x0 = BrowseCarouselCard::new().set_image_display_options(ImageDisplayOptions::Gray);
/// let x1 = BrowseCarouselCard::new().set_image_display_options(ImageDisplayOptions::White);
/// let x2 = BrowseCarouselCard::new().set_image_display_options(ImageDisplayOptions::Cropped);
/// ```
pub fn set_image_display_options<
T: std::convert::Into<
crate::model::intent::message::browse_carousel_card::ImageDisplayOptions,
>,
>(
mut self,
v: T,
) -> Self {
self.image_display_options = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for BrowseCarouselCard {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard"
}
}
/// Defines additional types related to [BrowseCarouselCard].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod browse_carousel_card {
#[allow(unused_imports)]
use super::*;
/// Browsing carousel tile
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BrowseCarouselCardItem {
/// Required. Action to present to the user.
pub open_uri_action: std::option::Option<crate::model::intent::message::browse_carousel_card::browse_carousel_card_item::OpenUrlAction>,
/// Required. Title of the carousel item. Maximum of two lines of text.
pub title: std::string::String,
/// Optional. Description of the carousel item. Maximum of four lines of
/// text.
pub description: std::string::String,
/// Optional. Hero image for the carousel item.
pub image: std::option::Option<crate::model::intent::message::Image>,
/// Optional. Text that appears at the bottom of the Browse Carousel
/// Card. Maximum of one line of text.
pub footer: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl BrowseCarouselCardItem {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [open_uri_action][crate::model::intent::message::browse_carousel_card::BrowseCarouselCardItem::open_uri_action].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::BrowseCarouselCardItem;
/// use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::browse_carousel_card_item::OpenUrlAction;
/// let x = BrowseCarouselCardItem::new().set_open_uri_action(OpenUrlAction::default()/* use setters */);
/// ```
pub fn set_open_uri_action<T>(mut self, v: T) -> Self
where T: std::convert::Into<crate::model::intent::message::browse_carousel_card::browse_carousel_card_item::OpenUrlAction>
{
self.open_uri_action = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [open_uri_action][crate::model::intent::message::browse_carousel_card::BrowseCarouselCardItem::open_uri_action].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::BrowseCarouselCardItem;
/// use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::browse_carousel_card_item::OpenUrlAction;
/// let x = BrowseCarouselCardItem::new().set_or_clear_open_uri_action(Some(OpenUrlAction::default()/* use setters */));
/// let x = BrowseCarouselCardItem::new().set_or_clear_open_uri_action(None::<OpenUrlAction>);
/// ```
pub fn set_or_clear_open_uri_action<T>(mut self, v: std::option::Option<T>) -> Self
where T: std::convert::Into<crate::model::intent::message::browse_carousel_card::browse_carousel_card_item::OpenUrlAction>
{
self.open_uri_action = v.map(|x| x.into());
self
}
/// Sets the value of [title][crate::model::intent::message::browse_carousel_card::BrowseCarouselCardItem::title].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::BrowseCarouselCardItem;
/// let x = BrowseCarouselCardItem::new().set_title("example");
/// ```
pub fn set_title<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.title = v.into();
self
}
/// Sets the value of [description][crate::model::intent::message::browse_carousel_card::BrowseCarouselCardItem::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::BrowseCarouselCardItem;
/// let x = BrowseCarouselCardItem::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.description = v.into();
self
}
/// Sets the value of [image][crate::model::intent::message::browse_carousel_card::BrowseCarouselCardItem::image].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::BrowseCarouselCardItem;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = BrowseCarouselCardItem::new().set_image(Image::default()/* use setters */);
/// ```
pub fn set_image<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::intent::message::Image>,
{
self.image = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [image][crate::model::intent::message::browse_carousel_card::BrowseCarouselCardItem::image].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::BrowseCarouselCardItem;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = BrowseCarouselCardItem::new().set_or_clear_image(Some(Image::default()/* use setters */));
/// let x = BrowseCarouselCardItem::new().set_or_clear_image(None::<Image>);
/// ```
pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::intent::message::Image>,
{
self.image = v.map(|x| x.into());
self
}
/// Sets the value of [footer][crate::model::intent::message::browse_carousel_card::BrowseCarouselCardItem::footer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::BrowseCarouselCardItem;
/// let x = BrowseCarouselCardItem::new().set_footer("example");
/// ```
pub fn set_footer<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.footer = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for BrowseCarouselCardItem {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem"
}
}
/// Defines additional types related to [BrowseCarouselCardItem].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod browse_carousel_card_item {
#[allow(unused_imports)]
use super::*;
/// Actions on Google action to open a given url.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OpenUrlAction {
/// Required. URL
pub url: std::string::String,
/// Optional. Specifies the type of viewer that is used when opening
/// the URL. Defaults to opening via web browser.
pub url_type_hint: crate::model::intent::message::browse_carousel_card::browse_carousel_card_item::open_url_action::UrlTypeHint,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl OpenUrlAction {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [url][crate::model::intent::message::browse_carousel_card::browse_carousel_card_item::OpenUrlAction::url].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::browse_carousel_card_item::OpenUrlAction;
/// let x = OpenUrlAction::new().set_url("example");
/// ```
pub fn set_url<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.url = v.into();
self
}
/// Sets the value of [url_type_hint][crate::model::intent::message::browse_carousel_card::browse_carousel_card_item::OpenUrlAction::url_type_hint].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::browse_carousel_card_item::OpenUrlAction;
/// use google_cloud_dialogflow_v2::model::intent::message::browse_carousel_card::browse_carousel_card_item::open_url_action::UrlTypeHint;
/// let x0 = OpenUrlAction::new().set_url_type_hint(UrlTypeHint::AmpAction);
/// let x1 = OpenUrlAction::new().set_url_type_hint(UrlTypeHint::AmpContent);
/// ```
pub fn set_url_type_hint<T: std::convert::Into<crate::model::intent::message::browse_carousel_card::browse_carousel_card_item::open_url_action::UrlTypeHint>>(mut self, v: T) -> Self{
self.url_type_hint = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for OpenUrlAction {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction"
}
}
/// Defines additional types related to [OpenUrlAction].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod open_url_action {
#[allow(unused_imports)]
use super::*;
/// Type of the URI.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum UrlTypeHint {
/// Unspecified
Unspecified,
/// Url would be an amp action
AmpAction,
/// URL that points directly to AMP content, or to a canonical URL
/// which refers to AMP content via \<link rel="amphtml"\>.
AmpContent,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [UrlTypeHint::value] or
/// [UrlTypeHint::name].
UnknownValue(url_type_hint::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod url_type_hint {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl UrlTypeHint {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::AmpAction => std::option::Option::Some(1),
Self::AmpContent => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("URL_TYPE_HINT_UNSPECIFIED")
}
Self::AmpAction => std::option::Option::Some("AMP_ACTION"),
Self::AmpContent => std::option::Option::Some("AMP_CONTENT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::default::Default for UrlTypeHint {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::fmt::Display for UrlTypeHint {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<i32> for UrlTypeHint {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::AmpAction,
2 => Self::AmpContent,
_ => Self::UnknownValue(url_type_hint::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<&str> for UrlTypeHint {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"URL_TYPE_HINT_UNSPECIFIED" => Self::Unspecified,
"AMP_ACTION" => Self::AmpAction,
"AMP_CONTENT" => Self::AmpContent,
_ => Self::UnknownValue(url_type_hint::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl serde::ser::Serialize for UrlTypeHint {
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::AmpAction => serializer.serialize_i32(1),
Self::AmpContent => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for UrlTypeHint {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<UrlTypeHint>::new(
".google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint"))
}
}
}
}
/// Image display options for Actions on Google. This should be used for
/// when the image's aspect ratio does not match the image container's
/// aspect ratio.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ImageDisplayOptions {
/// Fill the gaps between the image and the image container with gray
/// bars.
Unspecified,
/// Fill the gaps between the image and the image container with gray
/// bars.
Gray,
/// Fill the gaps between the image and the image container with white
/// bars.
White,
/// Image is scaled such that the image width and height match or exceed
/// the container dimensions. This may crop the top and bottom of the
/// image if the scaled image height is greater than the container
/// height, or crop the left and right of the image if the scaled image
/// width is greater than the container width. This is similar to "Zoom
/// Mode" on a widescreen TV when playing a 4:3 video.
Cropped,
/// Pad the gaps between image and image frame with a blurred copy of the
/// same image.
BlurredBackground,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ImageDisplayOptions::value] or
/// [ImageDisplayOptions::name].
UnknownValue(image_display_options::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod image_display_options {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl ImageDisplayOptions {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Gray => std::option::Option::Some(1),
Self::White => std::option::Option::Some(2),
Self::Cropped => std::option::Option::Some(3),
Self::BlurredBackground => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("IMAGE_DISPLAY_OPTIONS_UNSPECIFIED")
}
Self::Gray => std::option::Option::Some("GRAY"),
Self::White => std::option::Option::Some("WHITE"),
Self::Cropped => std::option::Option::Some("CROPPED"),
Self::BlurredBackground => std::option::Option::Some("BLURRED_BACKGROUND"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::default::Default for ImageDisplayOptions {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::fmt::Display for ImageDisplayOptions {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<i32> for ImageDisplayOptions {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Gray,
2 => Self::White,
3 => Self::Cropped,
4 => Self::BlurredBackground,
_ => Self::UnknownValue(image_display_options::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<&str> for ImageDisplayOptions {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"IMAGE_DISPLAY_OPTIONS_UNSPECIFIED" => Self::Unspecified,
"GRAY" => Self::Gray,
"WHITE" => Self::White,
"CROPPED" => Self::Cropped,
"BLURRED_BACKGROUND" => Self::BlurredBackground,
_ => Self::UnknownValue(image_display_options::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl serde::ser::Serialize for ImageDisplayOptions {
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::Gray => serializer.serialize_i32(1),
Self::White => serializer.serialize_i32(2),
Self::Cropped => serializer.serialize_i32(3),
Self::BlurredBackground => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for ImageDisplayOptions {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImageDisplayOptions>::new(
".google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.ImageDisplayOptions"))
}
}
}
/// Table card for Actions on Google.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TableCard {
/// Required. Title of the card.
pub title: std::string::String,
/// Optional. Subtitle to the title.
pub subtitle: std::string::String,
/// Optional. Image which should be displayed on the card.
pub image: std::option::Option<crate::model::intent::message::Image>,
/// Optional. Display properties for the columns in this table.
pub column_properties: std::vec::Vec<crate::model::intent::message::ColumnProperties>,
/// Optional. Rows in this table of data.
pub rows: std::vec::Vec<crate::model::intent::message::TableCardRow>,
/// Optional. List of buttons for the card.
pub buttons: std::vec::Vec<crate::model::intent::message::basic_card::Button>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl TableCard {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [title][crate::model::intent::message::TableCard::title].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::TableCard;
/// let x = TableCard::new().set_title("example");
/// ```
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = v.into();
self
}
/// Sets the value of [subtitle][crate::model::intent::message::TableCard::subtitle].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::TableCard;
/// let x = TableCard::new().set_subtitle("example");
/// ```
pub fn set_subtitle<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.subtitle = v.into();
self
}
/// Sets the value of [image][crate::model::intent::message::TableCard::image].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::TableCard;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = TableCard::new().set_image(Image::default()/* use setters */);
/// ```
pub fn set_image<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::intent::message::Image>,
{
self.image = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [image][crate::model::intent::message::TableCard::image].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::TableCard;
/// use google_cloud_dialogflow_v2::model::intent::message::Image;
/// let x = TableCard::new().set_or_clear_image(Some(Image::default()/* use setters */));
/// let x = TableCard::new().set_or_clear_image(None::<Image>);
/// ```
pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::intent::message::Image>,
{
self.image = v.map(|x| x.into());
self
}
/// Sets the value of [column_properties][crate::model::intent::message::TableCard::column_properties].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::TableCard;
/// use google_cloud_dialogflow_v2::model::intent::message::ColumnProperties;
/// let x = TableCard::new()
/// .set_column_properties([
/// ColumnProperties::default()/* use setters */,
/// ColumnProperties::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_column_properties<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::message::ColumnProperties>,
{
use std::iter::Iterator;
self.column_properties = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [rows][crate::model::intent::message::TableCard::rows].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::TableCard;
/// use google_cloud_dialogflow_v2::model::intent::message::TableCardRow;
/// let x = TableCard::new()
/// .set_rows([
/// TableCardRow::default()/* use setters */,
/// TableCardRow::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_rows<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::message::TableCardRow>,
{
use std::iter::Iterator;
self.rows = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [buttons][crate::model::intent::message::TableCard::buttons].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::TableCard;
/// use google_cloud_dialogflow_v2::model::intent::message::basic_card::Button;
/// let x = TableCard::new()
/// .set_buttons([
/// Button::default()/* use setters */,
/// Button::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_buttons<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::message::basic_card::Button>,
{
use std::iter::Iterator;
self.buttons = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for TableCard {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.TableCard"
}
}
/// Column properties for
/// [TableCard][google.cloud.dialogflow.v2.Intent.Message.TableCard].
///
/// [google.cloud.dialogflow.v2.Intent.Message.TableCard]: crate::model::intent::message::TableCard
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ColumnProperties {
/// Required. Column heading.
pub header: std::string::String,
/// Optional. Defines text alignment for all cells in this column.
pub horizontal_alignment:
crate::model::intent::message::column_properties::HorizontalAlignment,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl ColumnProperties {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [header][crate::model::intent::message::ColumnProperties::header].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::ColumnProperties;
/// let x = ColumnProperties::new().set_header("example");
/// ```
pub fn set_header<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.header = v.into();
self
}
/// Sets the value of [horizontal_alignment][crate::model::intent::message::ColumnProperties::horizontal_alignment].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::ColumnProperties;
/// use google_cloud_dialogflow_v2::model::intent::message::column_properties::HorizontalAlignment;
/// let x0 = ColumnProperties::new().set_horizontal_alignment(HorizontalAlignment::Leading);
/// let x1 = ColumnProperties::new().set_horizontal_alignment(HorizontalAlignment::Center);
/// let x2 = ColumnProperties::new().set_horizontal_alignment(HorizontalAlignment::Trailing);
/// ```
pub fn set_horizontal_alignment<
T: std::convert::Into<
crate::model::intent::message::column_properties::HorizontalAlignment,
>,
>(
mut self,
v: T,
) -> Self {
self.horizontal_alignment = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for ColumnProperties {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.ColumnProperties"
}
}
/// Defines additional types related to [ColumnProperties].
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod column_properties {
#[allow(unused_imports)]
use super::*;
/// Text alignments within a cell.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum HorizontalAlignment {
/// Text is aligned to the leading edge of the column.
Unspecified,
/// Text is aligned to the leading edge of the column.
Leading,
/// Text is centered in the column.
Center,
/// Text is aligned to the trailing edge of the column.
Trailing,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [HorizontalAlignment::value] or
/// [HorizontalAlignment::name].
UnknownValue(horizontal_alignment::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod horizontal_alignment {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl HorizontalAlignment {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Leading => std::option::Option::Some(1),
Self::Center => std::option::Option::Some(2),
Self::Trailing => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("HORIZONTAL_ALIGNMENT_UNSPECIFIED")
}
Self::Leading => std::option::Option::Some("LEADING"),
Self::Center => std::option::Option::Some("CENTER"),
Self::Trailing => std::option::Option::Some("TRAILING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::default::Default for HorizontalAlignment {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::fmt::Display for HorizontalAlignment {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<i32> for HorizontalAlignment {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Leading,
2 => Self::Center,
3 => Self::Trailing,
_ => Self::UnknownValue(horizontal_alignment::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<&str> for HorizontalAlignment {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"HORIZONTAL_ALIGNMENT_UNSPECIFIED" => Self::Unspecified,
"LEADING" => Self::Leading,
"CENTER" => Self::Center,
"TRAILING" => Self::Trailing,
_ => Self::UnknownValue(horizontal_alignment::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl serde::ser::Serialize for HorizontalAlignment {
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::Leading => serializer.serialize_i32(1),
Self::Center => serializer.serialize_i32(2),
Self::Trailing => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for HorizontalAlignment {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<HorizontalAlignment>::new(
".google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.HorizontalAlignment"))
}
}
}
/// Row of [TableCard][google.cloud.dialogflow.v2.Intent.Message.TableCard].
///
/// [google.cloud.dialogflow.v2.Intent.Message.TableCard]: crate::model::intent::message::TableCard
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TableCardRow {
/// Optional. List of cells that make up this row.
pub cells: std::vec::Vec<crate::model::intent::message::TableCardCell>,
/// Optional. Whether to add a visual divider after this row.
pub divider_after: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl TableCardRow {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [cells][crate::model::intent::message::TableCardRow::cells].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::TableCardRow;
/// use google_cloud_dialogflow_v2::model::intent::message::TableCardCell;
/// let x = TableCardRow::new()
/// .set_cells([
/// TableCardCell::default()/* use setters */,
/// TableCardCell::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_cells<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::message::TableCardCell>,
{
use std::iter::Iterator;
self.cells = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [divider_after][crate::model::intent::message::TableCardRow::divider_after].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::TableCardRow;
/// let x = TableCardRow::new().set_divider_after(true);
/// ```
pub fn set_divider_after<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.divider_after = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for TableCardRow {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.TableCardRow"
}
}
/// Cell of
/// [TableCardRow][google.cloud.dialogflow.v2.Intent.Message.TableCardRow].
///
/// [google.cloud.dialogflow.v2.Intent.Message.TableCardRow]: crate::model::intent::message::TableCardRow
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TableCardCell {
/// Required. Text in this cell.
pub text: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl TableCardCell {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [text][crate::model::intent::message::TableCardCell::text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::message::TableCardCell;
/// let x = TableCardCell::new().set_text("example");
/// ```
pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.text = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for TableCardCell {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.Message.TableCardCell"
}
}
/// The rich response message integration platform. See
/// [Integrations](https://cloud.google.com/dialogflow/docs/integrations).
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Platform {
/// Default platform.
Unspecified,
/// Facebook.
Facebook,
/// Slack.
Slack,
/// Telegram.
Telegram,
/// Kik.
Kik,
/// Skype.
Skype,
/// Line.
Line,
/// Viber.
Viber,
/// Google Assistant
/// See [Dialogflow webhook
/// format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json)
ActionsOnGoogle,
/// Google Hangouts.
GoogleHangouts,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Platform::value] or
/// [Platform::name].
UnknownValue(platform::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod platform {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl Platform {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Facebook => std::option::Option::Some(1),
Self::Slack => std::option::Option::Some(2),
Self::Telegram => std::option::Option::Some(3),
Self::Kik => std::option::Option::Some(4),
Self::Skype => std::option::Option::Some(5),
Self::Line => std::option::Option::Some(6),
Self::Viber => std::option::Option::Some(7),
Self::ActionsOnGoogle => std::option::Option::Some(8),
Self::GoogleHangouts => std::option::Option::Some(11),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("PLATFORM_UNSPECIFIED"),
Self::Facebook => std::option::Option::Some("FACEBOOK"),
Self::Slack => std::option::Option::Some("SLACK"),
Self::Telegram => std::option::Option::Some("TELEGRAM"),
Self::Kik => std::option::Option::Some("KIK"),
Self::Skype => std::option::Option::Some("SKYPE"),
Self::Line => std::option::Option::Some("LINE"),
Self::Viber => std::option::Option::Some("VIBER"),
Self::ActionsOnGoogle => std::option::Option::Some("ACTIONS_ON_GOOGLE"),
Self::GoogleHangouts => std::option::Option::Some("GOOGLE_HANGOUTS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::default::Default for Platform {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::fmt::Display for Platform {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<i32> for Platform {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Facebook,
2 => Self::Slack,
3 => Self::Telegram,
4 => Self::Kik,
5 => Self::Skype,
6 => Self::Line,
7 => Self::Viber,
8 => Self::ActionsOnGoogle,
11 => Self::GoogleHangouts,
_ => Self::UnknownValue(platform::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<&str> for Platform {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"PLATFORM_UNSPECIFIED" => Self::Unspecified,
"FACEBOOK" => Self::Facebook,
"SLACK" => Self::Slack,
"TELEGRAM" => Self::Telegram,
"KIK" => Self::Kik,
"SKYPE" => Self::Skype,
"LINE" => Self::Line,
"VIBER" => Self::Viber,
"ACTIONS_ON_GOOGLE" => Self::ActionsOnGoogle,
"GOOGLE_HANGOUTS" => Self::GoogleHangouts,
_ => Self::UnknownValue(platform::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl serde::ser::Serialize for Platform {
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::Facebook => serializer.serialize_i32(1),
Self::Slack => serializer.serialize_i32(2),
Self::Telegram => serializer.serialize_i32(3),
Self::Kik => serializer.serialize_i32(4),
Self::Skype => serializer.serialize_i32(5),
Self::Line => serializer.serialize_i32(6),
Self::Viber => serializer.serialize_i32(7),
Self::ActionsOnGoogle => serializer.serialize_i32(8),
Self::GoogleHangouts => serializer.serialize_i32(11),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for Platform {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Platform>::new(
".google.cloud.dialogflow.v2.Intent.Message.Platform",
))
}
}
/// Required. The rich response message.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Message {
/// The text response.
Text(std::boxed::Box<crate::model::intent::message::Text>),
/// The image response.
Image(std::boxed::Box<crate::model::intent::message::Image>),
/// The quick replies response.
QuickReplies(std::boxed::Box<crate::model::intent::message::QuickReplies>),
/// The card response.
Card(std::boxed::Box<crate::model::intent::message::Card>),
/// A custom platform-specific response.
Payload(std::boxed::Box<wkt::Struct>),
/// The voice and text-only responses for Actions on Google.
SimpleResponses(std::boxed::Box<crate::model::intent::message::SimpleResponses>),
/// The basic card response for Actions on Google.
BasicCard(std::boxed::Box<crate::model::intent::message::BasicCard>),
/// The suggestion chips for Actions on Google.
Suggestions(std::boxed::Box<crate::model::intent::message::Suggestions>),
/// The link out suggestion chip for Actions on Google.
LinkOutSuggestion(std::boxed::Box<crate::model::intent::message::LinkOutSuggestion>),
/// The list card response for Actions on Google.
ListSelect(std::boxed::Box<crate::model::intent::message::ListSelect>),
/// The carousel card response for Actions on Google.
CarouselSelect(std::boxed::Box<crate::model::intent::message::CarouselSelect>),
/// Browse carousel card for Actions on Google.
BrowseCarouselCard(std::boxed::Box<crate::model::intent::message::BrowseCarouselCard>),
/// Table card for Actions on Google.
TableCard(std::boxed::Box<crate::model::intent::message::TableCard>),
/// The media content card for Actions on Google.
MediaContent(std::boxed::Box<crate::model::intent::message::MediaContent>),
}
}
/// Represents a single followup intent in the chain.
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FollowupIntentInfo {
/// The unique identifier of the followup intent.
/// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
pub followup_intent_name: std::string::String,
/// The unique identifier of the followup intent's parent.
/// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
pub parent_followup_intent_name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl FollowupIntentInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [followup_intent_name][crate::model::intent::FollowupIntentInfo::followup_intent_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::FollowupIntentInfo;
/// let x = FollowupIntentInfo::new().set_followup_intent_name("example");
/// ```
pub fn set_followup_intent_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.followup_intent_name = v.into();
self
}
/// Sets the value of [parent_followup_intent_name][crate::model::intent::FollowupIntentInfo::parent_followup_intent_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::intent::FollowupIntentInfo;
/// let x = FollowupIntentInfo::new().set_parent_followup_intent_name("example");
/// ```
pub fn set_parent_followup_intent_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.parent_followup_intent_name = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for FollowupIntentInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Intent.FollowupIntentInfo"
}
}
/// Represents the different states that webhooks can be in.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum WebhookState {
/// Webhook is disabled in the agent and in the intent.
Unspecified,
/// Webhook is enabled in the agent and in the intent.
Enabled,
/// Webhook is enabled in the agent and in the intent. Also, each slot
/// filling prompt is forwarded to the webhook.
EnabledForSlotFilling,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [WebhookState::value] or
/// [WebhookState::name].
UnknownValue(webhook_state::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
pub mod webhook_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl WebhookState {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Enabled => std::option::Option::Some(1),
Self::EnabledForSlotFilling => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("WEBHOOK_STATE_UNSPECIFIED"),
Self::Enabled => std::option::Option::Some("WEBHOOK_STATE_ENABLED"),
Self::EnabledForSlotFilling => {
std::option::Option::Some("WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::default::Default for WebhookState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::fmt::Display for WebhookState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<i32> for WebhookState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Enabled,
2 => Self::EnabledForSlotFilling,
_ => Self::UnknownValue(webhook_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<&str> for WebhookState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"WEBHOOK_STATE_UNSPECIFIED" => Self::Unspecified,
"WEBHOOK_STATE_ENABLED" => Self::Enabled,
"WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING" => Self::EnabledForSlotFilling,
_ => Self::UnknownValue(webhook_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl serde::ser::Serialize for WebhookState {
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::Enabled => serializer.serialize_i32(1),
Self::EnabledForSlotFilling => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "intents",
feature = "participants",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for WebhookState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<WebhookState>::new(
".google.cloud.dialogflow.v2.Intent.WebhookState",
))
}
}
}
/// The request message for
/// [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents].
///
/// [google.cloud.dialogflow.v2.Intents.ListIntents]: crate::client::Intents::list_intents
#[cfg(feature = "intents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListIntentsRequest {
/// Required. The agent to list all intents from.
/// Format: `projects/<Project ID>/agent` or `projects/<Project
/// ID>/locations/<Location ID>/agent`.
///
/// Alternatively, you can specify the environment to list intents for.
/// Format: `projects/<Project ID>/agent/environments/<Environment ID>`
/// or `projects/<Project ID>/locations/<Location
/// ID>/agent/environments/<Environment ID>`.
/// Note: training phrases of the intents will not be returned for non-draft
/// environment.
pub parent: std::string::String,
/// Optional. The language used to access language-specific data.
/// If not specified, the agent's default language is used.
/// For more information, see
/// [Multilingual intent and entity
/// data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
pub language_code: std::string::String,
/// Optional. The resource view to apply to the returned intent.
pub intent_view: crate::model::IntentView,
/// Optional. The maximum number of items to return in a single page. By
/// default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "intents")]
impl ListIntentsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListIntentsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListIntentsRequest;
/// let x = ListIntentsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [language_code][crate::model::ListIntentsRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListIntentsRequest;
/// let x = ListIntentsRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [intent_view][crate::model::ListIntentsRequest::intent_view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListIntentsRequest;
/// use google_cloud_dialogflow_v2::model::IntentView;
/// let x0 = ListIntentsRequest::new().set_intent_view(IntentView::Full);
/// ```
pub fn set_intent_view<T: std::convert::Into<crate::model::IntentView>>(
mut self,
v: T,
) -> Self {
self.intent_view = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListIntentsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListIntentsRequest;
/// let x = ListIntentsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListIntentsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListIntentsRequest;
/// let x = ListIntentsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "intents")]
impl wkt::message::Message for ListIntentsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListIntentsRequest"
}
}
/// The response message for
/// [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents].
///
/// [google.cloud.dialogflow.v2.Intents.ListIntents]: crate::client::Intents::list_intents
#[cfg(feature = "intents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListIntentsResponse {
/// The list of agent intents. There will be a maximum number of items
/// returned based on the page_size field in the request.
pub intents: std::vec::Vec<crate::model::Intent>,
/// Token to retrieve the next page of results, or empty if there are no
/// more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "intents")]
impl ListIntentsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [intents][crate::model::ListIntentsResponse::intents].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListIntentsResponse;
/// use google_cloud_dialogflow_v2::model::Intent;
/// let x = ListIntentsResponse::new()
/// .set_intents([
/// Intent::default()/* use setters */,
/// Intent::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_intents<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Intent>,
{
use std::iter::Iterator;
self.intents = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListIntentsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListIntentsResponse;
/// let x = ListIntentsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "intents")]
impl wkt::message::Message for ListIntentsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListIntentsResponse"
}
}
#[cfg(feature = "intents")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListIntentsResponse {
type PageItem = crate::model::Intent;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.intents
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [Intents.GetIntent][google.cloud.dialogflow.v2.Intents.GetIntent].
///
/// [google.cloud.dialogflow.v2.Intents.GetIntent]: crate::client::Intents::get_intent
#[cfg(feature = "intents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetIntentRequest {
/// Required. The name of the intent.
/// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
pub name: std::string::String,
/// Optional. The language used to access language-specific data.
/// If not specified, the agent's default language is used.
/// For more information, see
/// [Multilingual intent and entity
/// data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
pub language_code: std::string::String,
/// Optional. The resource view to apply to the returned intent.
pub intent_view: crate::model::IntentView,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "intents")]
impl GetIntentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetIntentRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetIntentRequest;
/// let x = GetIntentRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [language_code][crate::model::GetIntentRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetIntentRequest;
/// let x = GetIntentRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [intent_view][crate::model::GetIntentRequest::intent_view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetIntentRequest;
/// use google_cloud_dialogflow_v2::model::IntentView;
/// let x0 = GetIntentRequest::new().set_intent_view(IntentView::Full);
/// ```
pub fn set_intent_view<T: std::convert::Into<crate::model::IntentView>>(
mut self,
v: T,
) -> Self {
self.intent_view = v.into();
self
}
}
#[cfg(feature = "intents")]
impl wkt::message::Message for GetIntentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetIntentRequest"
}
}
/// The request message for
/// [Intents.CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent].
///
/// [google.cloud.dialogflow.v2.Intents.CreateIntent]: crate::client::Intents::create_intent
#[cfg(feature = "intents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateIntentRequest {
/// Required. The agent to create a intent for.
/// Format: `projects/<Project ID>/agent`.
pub parent: std::string::String,
/// Required. The intent to create.
pub intent: std::option::Option<crate::model::Intent>,
/// Optional. The language used to access language-specific data.
/// If not specified, the agent's default language is used.
/// For more information, see
/// [Multilingual intent and entity
/// data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
pub language_code: std::string::String,
/// Optional. The resource view to apply to the returned intent.
pub intent_view: crate::model::IntentView,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "intents")]
impl CreateIntentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateIntentRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateIntentRequest;
/// let x = CreateIntentRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [intent][crate::model::CreateIntentRequest::intent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateIntentRequest;
/// use google_cloud_dialogflow_v2::model::Intent;
/// let x = CreateIntentRequest::new().set_intent(Intent::default()/* use setters */);
/// ```
pub fn set_intent<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Intent>,
{
self.intent = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [intent][crate::model::CreateIntentRequest::intent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateIntentRequest;
/// use google_cloud_dialogflow_v2::model::Intent;
/// let x = CreateIntentRequest::new().set_or_clear_intent(Some(Intent::default()/* use setters */));
/// let x = CreateIntentRequest::new().set_or_clear_intent(None::<Intent>);
/// ```
pub fn set_or_clear_intent<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Intent>,
{
self.intent = v.map(|x| x.into());
self
}
/// Sets the value of [language_code][crate::model::CreateIntentRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateIntentRequest;
/// let x = CreateIntentRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [intent_view][crate::model::CreateIntentRequest::intent_view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateIntentRequest;
/// use google_cloud_dialogflow_v2::model::IntentView;
/// let x0 = CreateIntentRequest::new().set_intent_view(IntentView::Full);
/// ```
pub fn set_intent_view<T: std::convert::Into<crate::model::IntentView>>(
mut self,
v: T,
) -> Self {
self.intent_view = v.into();
self
}
}
#[cfg(feature = "intents")]
impl wkt::message::Message for CreateIntentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateIntentRequest"
}
}
/// The request message for
/// [Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.UpdateIntent].
///
/// [google.cloud.dialogflow.v2.Intents.UpdateIntent]: crate::client::Intents::update_intent
#[cfg(feature = "intents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateIntentRequest {
/// Required. The intent to update.
pub intent: std::option::Option<crate::model::Intent>,
/// Optional. The language used to access language-specific data.
/// If not specified, the agent's default language is used.
/// For more information, see
/// [Multilingual intent and entity
/// data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
pub language_code: std::string::String,
/// Optional. The mask to control which fields get updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
/// Optional. The resource view to apply to the returned intent.
pub intent_view: crate::model::IntentView,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "intents")]
impl UpdateIntentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [intent][crate::model::UpdateIntentRequest::intent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateIntentRequest;
/// use google_cloud_dialogflow_v2::model::Intent;
/// let x = UpdateIntentRequest::new().set_intent(Intent::default()/* use setters */);
/// ```
pub fn set_intent<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Intent>,
{
self.intent = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [intent][crate::model::UpdateIntentRequest::intent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateIntentRequest;
/// use google_cloud_dialogflow_v2::model::Intent;
/// let x = UpdateIntentRequest::new().set_or_clear_intent(Some(Intent::default()/* use setters */));
/// let x = UpdateIntentRequest::new().set_or_clear_intent(None::<Intent>);
/// ```
pub fn set_or_clear_intent<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Intent>,
{
self.intent = v.map(|x| x.into());
self
}
/// Sets the value of [language_code][crate::model::UpdateIntentRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateIntentRequest;
/// let x = UpdateIntentRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [update_mask][crate::model::UpdateIntentRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateIntentRequest;
/// use wkt::FieldMask;
/// let x = UpdateIntentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateIntentRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateIntentRequest;
/// use wkt::FieldMask;
/// let x = UpdateIntentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateIntentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
/// Sets the value of [intent_view][crate::model::UpdateIntentRequest::intent_view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateIntentRequest;
/// use google_cloud_dialogflow_v2::model::IntentView;
/// let x0 = UpdateIntentRequest::new().set_intent_view(IntentView::Full);
/// ```
pub fn set_intent_view<T: std::convert::Into<crate::model::IntentView>>(
mut self,
v: T,
) -> Self {
self.intent_view = v.into();
self
}
}
#[cfg(feature = "intents")]
impl wkt::message::Message for UpdateIntentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateIntentRequest"
}
}
/// The request message for
/// [Intents.DeleteIntent][google.cloud.dialogflow.v2.Intents.DeleteIntent].
///
/// [google.cloud.dialogflow.v2.Intents.DeleteIntent]: crate::client::Intents::delete_intent
#[cfg(feature = "intents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteIntentRequest {
/// Required. The name of the intent to delete. If this intent has direct or
/// indirect followup intents, we also delete them.
/// Format: `projects/<Project ID>/agent/intents/<Intent ID>`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "intents")]
impl DeleteIntentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteIntentRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteIntentRequest;
/// let x = DeleteIntentRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "intents")]
impl wkt::message::Message for DeleteIntentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteIntentRequest"
}
}
#[allow(missing_docs)]
#[cfg(feature = "intents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchUpdateIntentsRequest {
/// Required. The name of the agent to update or create intents in.
/// Format: `projects/<Project ID>/agent`.
pub parent: std::string::String,
/// Optional. The language used to access language-specific data.
/// If not specified, the agent's default language is used.
/// For more information, see
/// [Multilingual intent and entity
/// data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity).
pub language_code: std::string::String,
/// Optional. The mask to control which fields get updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
/// Optional. The resource view to apply to the returned intent.
pub intent_view: crate::model::IntentView,
/// The source of the intent batch.
pub intent_batch: std::option::Option<crate::model::batch_update_intents_request::IntentBatch>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "intents")]
impl BatchUpdateIntentsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::BatchUpdateIntentsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateIntentsRequest;
/// let x = BatchUpdateIntentsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [language_code][crate::model::BatchUpdateIntentsRequest::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateIntentsRequest;
/// let x = BatchUpdateIntentsRequest::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [update_mask][crate::model::BatchUpdateIntentsRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateIntentsRequest;
/// use wkt::FieldMask;
/// let x = BatchUpdateIntentsRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::BatchUpdateIntentsRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateIntentsRequest;
/// use wkt::FieldMask;
/// let x = BatchUpdateIntentsRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = BatchUpdateIntentsRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
/// Sets the value of [intent_view][crate::model::BatchUpdateIntentsRequest::intent_view].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateIntentsRequest;
/// use google_cloud_dialogflow_v2::model::IntentView;
/// let x0 = BatchUpdateIntentsRequest::new().set_intent_view(IntentView::Full);
/// ```
pub fn set_intent_view<T: std::convert::Into<crate::model::IntentView>>(
mut self,
v: T,
) -> Self {
self.intent_view = v.into();
self
}
/// Sets the value of [intent_batch][crate::model::BatchUpdateIntentsRequest::intent_batch].
///
/// Note that all the setters affecting `intent_batch` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateIntentsRequest;
/// use google_cloud_dialogflow_v2::model::batch_update_intents_request::IntentBatch;
/// let x = BatchUpdateIntentsRequest::new().set_intent_batch(Some(IntentBatch::IntentBatchUri("example".to_string())));
/// ```
pub fn set_intent_batch<
T: std::convert::Into<
std::option::Option<crate::model::batch_update_intents_request::IntentBatch>,
>,
>(
mut self,
v: T,
) -> Self {
self.intent_batch = v.into();
self
}
/// The value of [intent_batch][crate::model::BatchUpdateIntentsRequest::intent_batch]
/// if it holds a `IntentBatchUri`, `None` if the field is not set or
/// holds a different branch.
pub fn intent_batch_uri(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.intent_batch.as_ref().and_then(|v| match v {
crate::model::batch_update_intents_request::IntentBatch::IntentBatchUri(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [intent_batch][crate::model::BatchUpdateIntentsRequest::intent_batch]
/// to hold a `IntentBatchUri`.
///
/// Note that all the setters affecting `intent_batch` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateIntentsRequest;
/// let x = BatchUpdateIntentsRequest::new().set_intent_batch_uri("example");
/// assert!(x.intent_batch_uri().is_some());
/// assert!(x.intent_batch_inline().is_none());
/// ```
pub fn set_intent_batch_uri<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.intent_batch = std::option::Option::Some(
crate::model::batch_update_intents_request::IntentBatch::IntentBatchUri(v.into()),
);
self
}
/// The value of [intent_batch][crate::model::BatchUpdateIntentsRequest::intent_batch]
/// if it holds a `IntentBatchInline`, `None` if the field is not set or
/// holds a different branch.
pub fn intent_batch_inline(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::IntentBatch>> {
#[allow(unreachable_patterns)]
self.intent_batch.as_ref().and_then(|v| match v {
crate::model::batch_update_intents_request::IntentBatch::IntentBatchInline(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [intent_batch][crate::model::BatchUpdateIntentsRequest::intent_batch]
/// to hold a `IntentBatchInline`.
///
/// Note that all the setters affecting `intent_batch` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateIntentsRequest;
/// use google_cloud_dialogflow_v2::model::IntentBatch;
/// let x = BatchUpdateIntentsRequest::new().set_intent_batch_inline(IntentBatch::default()/* use setters */);
/// assert!(x.intent_batch_inline().is_some());
/// assert!(x.intent_batch_uri().is_none());
/// ```
pub fn set_intent_batch_inline<
T: std::convert::Into<std::boxed::Box<crate::model::IntentBatch>>,
>(
mut self,
v: T,
) -> Self {
self.intent_batch = std::option::Option::Some(
crate::model::batch_update_intents_request::IntentBatch::IntentBatchInline(v.into()),
);
self
}
}
#[cfg(feature = "intents")]
impl wkt::message::Message for BatchUpdateIntentsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.BatchUpdateIntentsRequest"
}
}
/// Defines additional types related to [BatchUpdateIntentsRequest].
#[cfg(feature = "intents")]
pub mod batch_update_intents_request {
#[allow(unused_imports)]
use super::*;
/// The source of the intent batch.
#[cfg(feature = "intents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum IntentBatch {
/// The URI to a Google Cloud Storage file containing intents to update or
/// create. The file format can either be a serialized proto (of IntentBatch
/// type) or JSON object. Note: The URI must start with "gs://".
IntentBatchUri(std::string::String),
/// The collection of intents to update or create.
IntentBatchInline(std::boxed::Box<crate::model::IntentBatch>),
}
}
/// The response message for
/// [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents].
///
/// [google.cloud.dialogflow.v2.Intents.BatchUpdateIntents]: crate::client::Intents::batch_update_intents
#[cfg(feature = "intents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchUpdateIntentsResponse {
/// The collection of updated or created intents.
pub intents: std::vec::Vec<crate::model::Intent>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "intents")]
impl BatchUpdateIntentsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [intents][crate::model::BatchUpdateIntentsResponse::intents].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchUpdateIntentsResponse;
/// use google_cloud_dialogflow_v2::model::Intent;
/// let x = BatchUpdateIntentsResponse::new()
/// .set_intents([
/// Intent::default()/* use setters */,
/// Intent::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_intents<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Intent>,
{
use std::iter::Iterator;
self.intents = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "intents")]
impl wkt::message::Message for BatchUpdateIntentsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.BatchUpdateIntentsResponse"
}
}
/// The request message for
/// [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2.Intents.BatchDeleteIntents].
///
/// [google.cloud.dialogflow.v2.Intents.BatchDeleteIntents]: crate::client::Intents::batch_delete_intents
#[cfg(feature = "intents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchDeleteIntentsRequest {
/// Required. The name of the agent to delete all entities types for. Format:
/// `projects/<Project ID>/agent`.
pub parent: std::string::String,
/// Required. The collection of intents to delete. Only intent `name` must be
/// filled in.
pub intents: std::vec::Vec<crate::model::Intent>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "intents")]
impl BatchDeleteIntentsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::BatchDeleteIntentsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchDeleteIntentsRequest;
/// let x = BatchDeleteIntentsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [intents][crate::model::BatchDeleteIntentsRequest::intents].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::BatchDeleteIntentsRequest;
/// use google_cloud_dialogflow_v2::model::Intent;
/// let x = BatchDeleteIntentsRequest::new()
/// .set_intents([
/// Intent::default()/* use setters */,
/// Intent::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_intents<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Intent>,
{
use std::iter::Iterator;
self.intents = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "intents")]
impl wkt::message::Message for BatchDeleteIntentsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.BatchDeleteIntentsRequest"
}
}
/// This message is a wrapper around a collection of intents.
#[cfg(feature = "intents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IntentBatch {
/// A collection of intents.
pub intents: std::vec::Vec<crate::model::Intent>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "intents")]
impl IntentBatch {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [intents][crate::model::IntentBatch::intents].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::IntentBatch;
/// use google_cloud_dialogflow_v2::model::Intent;
/// let x = IntentBatch::new()
/// .set_intents([
/// Intent::default()/* use setters */,
/// Intent::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_intents<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Intent>,
{
use std::iter::Iterator;
self.intents = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "intents")]
impl wkt::message::Message for IntentBatch {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.IntentBatch"
}
}
/// A knowledge base represents a collection of knowledge documents that you
/// provide to Dialogflow. Your knowledge documents contain information that may
/// be useful during conversations with end-users. Some Dialogflow features use
/// knowledge bases when looking for a response to an end-user input.
///
/// For more information, see the [knowledge base
/// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases).
///
/// Note: The `projects.agent.knowledgeBases` resource is deprecated;
/// only use `projects.knowledgeBases`.
#[cfg(feature = "knowledge-bases")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KnowledgeBase {
/// The knowledge base resource name.
/// The name must be empty when creating a knowledge base.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/knowledgeBases/<Knowledge Base ID>`.
pub name: std::string::String,
/// Required. The display name of the knowledge base. The name must be 1024
/// bytes or less; otherwise, the creation request fails.
pub display_name: std::string::String,
/// Language which represents the KnowledgeBase. When the KnowledgeBase is
/// created/updated, expect this to be present for non en-us languages. When
/// unspecified, the default language code en-us applies.
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "knowledge-bases")]
impl KnowledgeBase {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::KnowledgeBase::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeBase;
/// let x = KnowledgeBase::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [display_name][crate::model::KnowledgeBase::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeBase;
/// let x = KnowledgeBase::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [language_code][crate::model::KnowledgeBase::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeBase;
/// let x = KnowledgeBase::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
#[cfg(feature = "knowledge-bases")]
impl wkt::message::Message for KnowledgeBase {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.KnowledgeBase"
}
}
/// Request message for
/// [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases].
///
/// [google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases]: crate::client::KnowledgeBases::list_knowledge_bases
#[cfg(feature = "knowledge-bases")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListKnowledgeBasesRequest {
/// Required. The project to list of knowledge bases for.
/// Format: `projects/<Project ID>/locations/<Location ID>`.
pub parent: std::string::String,
/// The maximum number of items to return in a single page. By
/// default 10 and at most 100.
pub page_size: i32,
/// The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
/// The filter expression used to filter knowledge bases returned by the list
/// method. The expression has the following syntax:
///
/// \<field\> \<operator\> \<value\> [AND \<field\> \<operator\> \<value\>] ...
///
/// The following fields and operators are supported:
///
/// * display_name with has(:) operator
/// * language_code with equals(=) operator
///
/// Examples:
///
/// * 'language_code=en-us' matches knowledge bases with en-us language code.
/// * 'display_name:articles' matches knowledge bases whose display name
/// contains "articles".
/// * 'display_name:"Best Articles"' matches knowledge bases whose display
/// name contains "Best Articles".
/// * 'language_code=en-gb AND display_name=articles' matches all knowledge
/// bases whose display name contains "articles" and whose language code is
/// "en-gb".
///
/// Note: An empty filter string (i.e. "") is a no-op and will result in no
/// filtering.
///
/// For more information about filtering, see
/// [API Filtering](https://aip.dev/160).
pub filter: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "knowledge-bases")]
impl ListKnowledgeBasesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListKnowledgeBasesRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListKnowledgeBasesRequest;
/// let x = ListKnowledgeBasesRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListKnowledgeBasesRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListKnowledgeBasesRequest;
/// let x = ListKnowledgeBasesRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListKnowledgeBasesRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListKnowledgeBasesRequest;
/// let x = ListKnowledgeBasesRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
/// Sets the value of [filter][crate::model::ListKnowledgeBasesRequest::filter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListKnowledgeBasesRequest;
/// let x = ListKnowledgeBasesRequest::new().set_filter("example");
/// ```
pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filter = v.into();
self
}
}
#[cfg(feature = "knowledge-bases")]
impl wkt::message::Message for ListKnowledgeBasesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListKnowledgeBasesRequest"
}
}
/// Response message for
/// [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases].
///
/// [google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases]: crate::client::KnowledgeBases::list_knowledge_bases
#[cfg(feature = "knowledge-bases")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListKnowledgeBasesResponse {
/// The list of knowledge bases.
pub knowledge_bases: std::vec::Vec<crate::model::KnowledgeBase>,
/// Token to retrieve the next page of results, or empty if there are no
/// more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "knowledge-bases")]
impl ListKnowledgeBasesResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [knowledge_bases][crate::model::ListKnowledgeBasesResponse::knowledge_bases].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListKnowledgeBasesResponse;
/// use google_cloud_dialogflow_v2::model::KnowledgeBase;
/// let x = ListKnowledgeBasesResponse::new()
/// .set_knowledge_bases([
/// KnowledgeBase::default()/* use setters */,
/// KnowledgeBase::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_knowledge_bases<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::KnowledgeBase>,
{
use std::iter::Iterator;
self.knowledge_bases = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListKnowledgeBasesResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListKnowledgeBasesResponse;
/// let x = ListKnowledgeBasesResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "knowledge-bases")]
impl wkt::message::Message for ListKnowledgeBasesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListKnowledgeBasesResponse"
}
}
#[cfg(feature = "knowledge-bases")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListKnowledgeBasesResponse {
type PageItem = crate::model::KnowledgeBase;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.knowledge_bases
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Request message for
/// [KnowledgeBases.GetKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.GetKnowledgeBase].
///
/// [google.cloud.dialogflow.v2.KnowledgeBases.GetKnowledgeBase]: crate::client::KnowledgeBases::get_knowledge_base
#[cfg(feature = "knowledge-bases")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetKnowledgeBaseRequest {
/// Required. The name of the knowledge base to retrieve.
/// Format `projects/<Project ID>/locations/<Location
/// ID>/knowledgeBases/<Knowledge Base ID>`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "knowledge-bases")]
impl GetKnowledgeBaseRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetKnowledgeBaseRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetKnowledgeBaseRequest;
/// let x = GetKnowledgeBaseRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "knowledge-bases")]
impl wkt::message::Message for GetKnowledgeBaseRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetKnowledgeBaseRequest"
}
}
/// Request message for
/// [KnowledgeBases.CreateKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.CreateKnowledgeBase].
///
/// [google.cloud.dialogflow.v2.KnowledgeBases.CreateKnowledgeBase]: crate::client::KnowledgeBases::create_knowledge_base
#[cfg(feature = "knowledge-bases")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateKnowledgeBaseRequest {
/// Required. The project to create a knowledge base for.
/// Format: `projects/<Project ID>/locations/<Location ID>`.
pub parent: std::string::String,
/// Required. The knowledge base to create.
pub knowledge_base: std::option::Option<crate::model::KnowledgeBase>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "knowledge-bases")]
impl CreateKnowledgeBaseRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateKnowledgeBaseRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateKnowledgeBaseRequest;
/// let x = CreateKnowledgeBaseRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [knowledge_base][crate::model::CreateKnowledgeBaseRequest::knowledge_base].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateKnowledgeBaseRequest;
/// use google_cloud_dialogflow_v2::model::KnowledgeBase;
/// let x = CreateKnowledgeBaseRequest::new().set_knowledge_base(KnowledgeBase::default()/* use setters */);
/// ```
pub fn set_knowledge_base<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::KnowledgeBase>,
{
self.knowledge_base = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [knowledge_base][crate::model::CreateKnowledgeBaseRequest::knowledge_base].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateKnowledgeBaseRequest;
/// use google_cloud_dialogflow_v2::model::KnowledgeBase;
/// let x = CreateKnowledgeBaseRequest::new().set_or_clear_knowledge_base(Some(KnowledgeBase::default()/* use setters */));
/// let x = CreateKnowledgeBaseRequest::new().set_or_clear_knowledge_base(None::<KnowledgeBase>);
/// ```
pub fn set_or_clear_knowledge_base<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::KnowledgeBase>,
{
self.knowledge_base = v.map(|x| x.into());
self
}
}
#[cfg(feature = "knowledge-bases")]
impl wkt::message::Message for CreateKnowledgeBaseRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest"
}
}
/// Request message for
/// [KnowledgeBases.DeleteKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.DeleteKnowledgeBase].
///
/// [google.cloud.dialogflow.v2.KnowledgeBases.DeleteKnowledgeBase]: crate::client::KnowledgeBases::delete_knowledge_base
#[cfg(feature = "knowledge-bases")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteKnowledgeBaseRequest {
/// Required. The name of the knowledge base to delete.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/knowledgeBases/<Knowledge Base ID>`.
pub name: std::string::String,
/// Optional. Force deletes the knowledge base. When set to true, any documents
/// in the knowledge base are also deleted.
pub force: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "knowledge-bases")]
impl DeleteKnowledgeBaseRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteKnowledgeBaseRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteKnowledgeBaseRequest;
/// let x = DeleteKnowledgeBaseRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [force][crate::model::DeleteKnowledgeBaseRequest::force].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteKnowledgeBaseRequest;
/// let x = DeleteKnowledgeBaseRequest::new().set_force(true);
/// ```
pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.force = v.into();
self
}
}
#[cfg(feature = "knowledge-bases")]
impl wkt::message::Message for DeleteKnowledgeBaseRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest"
}
}
/// Request message for
/// [KnowledgeBases.UpdateKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeBase].
///
/// [google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeBase]: crate::client::KnowledgeBases::update_knowledge_base
#[cfg(feature = "knowledge-bases")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateKnowledgeBaseRequest {
/// Required. The knowledge base to update.
pub knowledge_base: std::option::Option<crate::model::KnowledgeBase>,
/// Optional. Not specified means `update all`.
/// Currently, only `display_name` can be updated, an InvalidArgument will be
/// returned for attempting to update other fields.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "knowledge-bases")]
impl UpdateKnowledgeBaseRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [knowledge_base][crate::model::UpdateKnowledgeBaseRequest::knowledge_base].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateKnowledgeBaseRequest;
/// use google_cloud_dialogflow_v2::model::KnowledgeBase;
/// let x = UpdateKnowledgeBaseRequest::new().set_knowledge_base(KnowledgeBase::default()/* use setters */);
/// ```
pub fn set_knowledge_base<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::KnowledgeBase>,
{
self.knowledge_base = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [knowledge_base][crate::model::UpdateKnowledgeBaseRequest::knowledge_base].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateKnowledgeBaseRequest;
/// use google_cloud_dialogflow_v2::model::KnowledgeBase;
/// let x = UpdateKnowledgeBaseRequest::new().set_or_clear_knowledge_base(Some(KnowledgeBase::default()/* use setters */));
/// let x = UpdateKnowledgeBaseRequest::new().set_or_clear_knowledge_base(None::<KnowledgeBase>);
/// ```
pub fn set_or_clear_knowledge_base<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::KnowledgeBase>,
{
self.knowledge_base = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateKnowledgeBaseRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateKnowledgeBaseRequest;
/// use wkt::FieldMask;
/// let x = UpdateKnowledgeBaseRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateKnowledgeBaseRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateKnowledgeBaseRequest;
/// use wkt::FieldMask;
/// let x = UpdateKnowledgeBaseRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateKnowledgeBaseRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "knowledge-bases")]
impl wkt::message::Message for UpdateKnowledgeBaseRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest"
}
}
/// Metadata for a
/// [GeneratorEvaluations.CreateGeneratorEvaluation][google.cloud.dialogflow.v2.GeneratorEvaluations.CreateGeneratorEvaluation]
/// operation.
///
/// [google.cloud.dialogflow.v2.GeneratorEvaluations.CreateGeneratorEvaluation]: crate::client::GeneratorEvaluations::create_generator_evaluation
#[cfg(feature = "generator-evaluations")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GeneratorEvaluationOperationMetadata {
/// Output only. The resource name of the generator evaluation. Format:
/// `projects/<Project ID>/locations/<Location
/// ID>/generators/<Generator ID>/evaluations/<Evaluation ID>`
pub generator_evaluation: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "generator-evaluations")]
impl GeneratorEvaluationOperationMetadata {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [generator_evaluation][crate::model::GeneratorEvaluationOperationMetadata::generator_evaluation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GeneratorEvaluationOperationMetadata;
/// let x = GeneratorEvaluationOperationMetadata::new().set_generator_evaluation("example");
/// ```
pub fn set_generator_evaluation<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.generator_evaluation = v.into();
self
}
}
#[cfg(feature = "generator-evaluations")]
impl wkt::message::Message for GeneratorEvaluationOperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GeneratorEvaluationOperationMetadata"
}
}
/// Represents a conversation participant (human agent, virtual agent, end-user).
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Participant {
/// Optional. The unique identifier of this participant.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
pub name: std::string::String,
/// Immutable. The role this participant plays in the conversation. This field
/// must be set during participant creation and is then immutable.
pub role: crate::model::participant::Role,
/// Optional. Label applied to streams representing this participant in SIPREC
/// XML metadata and SDP. This is used to assign transcriptions from that
/// media stream to this participant. This field can be updated.
pub sip_recording_media_label: std::string::String,
/// Optional. Obfuscated user id that should be associated with the created
/// participant.
///
/// You can specify a user id as follows:
///
/// 1. If you set this field in
/// [CreateParticipantRequest][google.cloud.dialogflow.v2.CreateParticipantRequest.participant]
/// or
/// [UpdateParticipantRequest][google.cloud.dialogflow.v2.UpdateParticipantRequest.participant],
/// Dialogflow adds the obfuscated user id with the participant.
///
/// 1. If you set this field in
/// [AnalyzeContent][google.cloud.dialogflow.v2.AnalyzeContentRequest.participant]
/// or
/// [StreamingAnalyzeContent][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.participant],
/// Dialogflow will update
/// [Participant.obfuscated_external_user_id][google.cloud.dialogflow.v2.Participant.obfuscated_external_user_id].
///
///
/// Dialogflow returns an error if you try to add a user id for a
/// non-[END_USER][google.cloud.dialogflow.v2.Participant.Role.END_USER]
/// participant.
///
/// Dialogflow uses this user id for billing and measurement purposes. For
/// example, Dialogflow determines whether a user in one conversation returned
/// in a later conversation.
///
/// Note:
///
/// * Please never pass raw user ids to Dialogflow. Always obfuscate your user
/// id first.
/// * Dialogflow only accepts a UTF-8 encoded string, e.g., a hex digest of a
/// hash function like SHA-512.
/// * The length of the user id must be <= 256 characters.
///
/// [google.cloud.dialogflow.v2.AnalyzeContentRequest.participant]: crate::model::AnalyzeContentRequest::participant
/// [google.cloud.dialogflow.v2.CreateParticipantRequest.participant]: crate::model::CreateParticipantRequest::participant
/// [google.cloud.dialogflow.v2.Participant.Role.END_USER]: crate::model::participant::Role::EndUser
/// [google.cloud.dialogflow.v2.Participant.obfuscated_external_user_id]: crate::model::Participant::obfuscated_external_user_id
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.participant]: crate::model::StreamingAnalyzeContentRequest::participant
/// [google.cloud.dialogflow.v2.UpdateParticipantRequest.participant]: crate::model::UpdateParticipantRequest::participant
pub obfuscated_external_user_id: std::string::String,
/// Optional. Key-value filters on the metadata of documents returned by
/// article suggestion. If specified, article suggestion only returns suggested
/// documents that match all filters in their
/// [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple
/// values for a metadata key should be concatenated by comma. For example,
/// filters to match all documents that have 'US' or 'CA' in their market
/// metadata values and 'agent' in their user metadata values will be
///
/// ```norust
/// documents_metadata_filters {
/// key: "market"
/// value: "US,CA"
/// }
/// documents_metadata_filters {
/// key: "user"
/// value: "agent"
/// }
/// ```
///
/// [google.cloud.dialogflow.v2.Document.metadata]: crate::model::Document::metadata
pub documents_metadata_filters:
std::collections::HashMap<std::string::String, std::string::String>,
/// Optional. For tracking the utilization of prebuilt Agent Assist integration
/// modules. This field is only inscope for Integration type that include UI
/// Modules, Backend Modules, and Agent Desktop connector, it is out of scope
/// for CCaaS and Direct Integration.
/// For each human agent, prebuilt UI Modules needs to trigger the
/// UpdateParticipant API to update this field. Both
/// [CreateParticipantRequest][google.cloud.dialogflow.v2.CreateParticipantRequest.participant]
/// and
/// [UpdateParticipantRequest][google.cloud.dialogflow.v2.UpdateParticipantRequest.participant]
/// will be supported.
///
/// [google.cloud.dialogflow.v2.CreateParticipantRequest.participant]: crate::model::CreateParticipantRequest::participant
/// [google.cloud.dialogflow.v2.UpdateParticipantRequest.participant]: crate::model::UpdateParticipantRequest::participant
pub agent_desktop_source: crate::model::participant::AgentDesktopSource,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl Participant {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::Participant::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Participant;
/// let x = Participant::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [role][crate::model::Participant::role].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Participant;
/// use google_cloud_dialogflow_v2::model::participant::Role;
/// let x0 = Participant::new().set_role(Role::HumanAgent);
/// let x1 = Participant::new().set_role(Role::AutomatedAgent);
/// let x2 = Participant::new().set_role(Role::EndUser);
/// ```
pub fn set_role<T: std::convert::Into<crate::model::participant::Role>>(
mut self,
v: T,
) -> Self {
self.role = v.into();
self
}
/// Sets the value of [sip_recording_media_label][crate::model::Participant::sip_recording_media_label].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Participant;
/// let x = Participant::new().set_sip_recording_media_label("example");
/// ```
pub fn set_sip_recording_media_label<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.sip_recording_media_label = v.into();
self
}
/// Sets the value of [obfuscated_external_user_id][crate::model::Participant::obfuscated_external_user_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Participant;
/// let x = Participant::new().set_obfuscated_external_user_id("example");
/// ```
pub fn set_obfuscated_external_user_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.obfuscated_external_user_id = v.into();
self
}
/// Sets the value of [documents_metadata_filters][crate::model::Participant::documents_metadata_filters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Participant;
/// let x = Participant::new().set_documents_metadata_filters([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_documents_metadata_filters<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.documents_metadata_filters =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [agent_desktop_source][crate::model::Participant::agent_desktop_source].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Participant;
/// use google_cloud_dialogflow_v2::model::participant::AgentDesktopSource;
/// let x0 = Participant::new().set_agent_desktop_source(AgentDesktopSource::LivePerson);
/// let x1 = Participant::new().set_agent_desktop_source(AgentDesktopSource::GenesysCloud);
/// let x2 = Participant::new().set_agent_desktop_source(AgentDesktopSource::Twilio);
/// ```
pub fn set_agent_desktop_source<
T: std::convert::Into<crate::model::participant::AgentDesktopSource>,
>(
mut self,
v: T,
) -> Self {
self.agent_desktop_source = v.into();
self
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl wkt::message::Message for Participant {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Participant"
}
}
/// Defines additional types related to [Participant].
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
pub mod participant {
#[allow(unused_imports)]
use super::*;
/// Enumeration of the roles a participant can play in a conversation.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Role {
/// Participant role not set.
Unspecified,
/// Participant is a human agent.
HumanAgent,
/// Participant is an automated agent, such as a Dialogflow agent.
AutomatedAgent,
/// Participant is an end user that has called or chatted with
/// Dialogflow services.
EndUser,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Role::value] or
/// [Role::name].
UnknownValue(role::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
pub mod role {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl Role {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::HumanAgent => std::option::Option::Some(1),
Self::AutomatedAgent => std::option::Option::Some(2),
Self::EndUser => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ROLE_UNSPECIFIED"),
Self::HumanAgent => std::option::Option::Some("HUMAN_AGENT"),
Self::AutomatedAgent => std::option::Option::Some("AUTOMATED_AGENT"),
Self::EndUser => std::option::Option::Some("END_USER"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl std::default::Default for Role {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl std::fmt::Display for Role {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl std::convert::From<i32> for Role {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::HumanAgent,
2 => Self::AutomatedAgent,
3 => Self::EndUser,
_ => Self::UnknownValue(role::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl std::convert::From<&str> for Role {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ROLE_UNSPECIFIED" => Self::Unspecified,
"HUMAN_AGENT" => Self::HumanAgent,
"AUTOMATED_AGENT" => Self::AutomatedAgent,
"END_USER" => Self::EndUser,
_ => Self::UnknownValue(role::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl serde::ser::Serialize for Role {
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::HumanAgent => serializer.serialize_i32(1),
Self::AutomatedAgent => serializer.serialize_i32(2),
Self::EndUser => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl<'de> serde::de::Deserialize<'de> for Role {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Role>::new(
".google.cloud.dialogflow.v2.Participant.Role",
))
}
}
/// Enumeration of the Agent Desktop Source when using prebuilt Agent
/// Assist integration modules.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AgentDesktopSource {
/// Agent Desktop Source is not specified.
Unspecified,
/// Agent Desktop Source is Live Person.
LivePerson,
/// Agent Desktop Source is Genesys Cloud.
GenesysCloud,
/// Agent Desktop Source is Twilio.
Twilio,
/// Agent Desktop Source is Salesforce.
Salesforce,
/// UI Modules are in use but the desktop is either not currently released or
/// setting this field to the applicable desktop.
Other,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [AgentDesktopSource::value] or
/// [AgentDesktopSource::name].
UnknownValue(agent_desktop_source::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
pub mod agent_desktop_source {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl AgentDesktopSource {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::LivePerson => std::option::Option::Some(1),
Self::GenesysCloud => std::option::Option::Some(2),
Self::Twilio => std::option::Option::Some(3),
Self::Salesforce => std::option::Option::Some(4),
Self::Other => std::option::Option::Some(8),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("AGENT_DESKTOP_SOURCE_UNSPECIFIED"),
Self::LivePerson => std::option::Option::Some("LIVE_PERSON"),
Self::GenesysCloud => std::option::Option::Some("GENESYS_CLOUD"),
Self::Twilio => std::option::Option::Some("TWILIO"),
Self::Salesforce => std::option::Option::Some("SALESFORCE"),
Self::Other => std::option::Option::Some("OTHER"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl std::default::Default for AgentDesktopSource {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl std::fmt::Display for AgentDesktopSource {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl std::convert::From<i32> for AgentDesktopSource {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::LivePerson,
2 => Self::GenesysCloud,
3 => Self::Twilio,
4 => Self::Salesforce,
8 => Self::Other,
_ => Self::UnknownValue(agent_desktop_source::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl std::convert::From<&str> for AgentDesktopSource {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"AGENT_DESKTOP_SOURCE_UNSPECIFIED" => Self::Unspecified,
"LIVE_PERSON" => Self::LivePerson,
"GENESYS_CLOUD" => Self::GenesysCloud,
"TWILIO" => Self::Twilio,
"SALESFORCE" => Self::Salesforce,
"OTHER" => Self::Other,
_ => Self::UnknownValue(agent_desktop_source::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl serde::ser::Serialize for AgentDesktopSource {
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::LivePerson => serializer.serialize_i32(1),
Self::GenesysCloud => serializer.serialize_i32(2),
Self::Twilio => serializer.serialize_i32(3),
Self::Salesforce => serializer.serialize_i32(4),
Self::Other => serializer.serialize_i32(8),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
))]
impl<'de> serde::de::Deserialize<'de> for AgentDesktopSource {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AgentDesktopSource>::new(
".google.cloud.dialogflow.v2.Participant.AgentDesktopSource",
))
}
}
}
/// Represents a message posted into a conversation.
#[cfg(any(feature = "conversations", feature = "participants",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Message {
/// Optional. The unique identifier of the message.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub name: std::string::String,
/// Required. The message content.
pub content: std::string::String,
/// Optional. The message language.
/// This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
/// language tag. Example: "en-US".
pub language_code: std::string::String,
/// Output only. The participant that sends this message.
pub participant: std::string::String,
/// Output only. The role of the participant.
pub participant_role: crate::model::participant::Role,
/// Output only. The time when the message was created in Contact Center AI.
pub create_time: std::option::Option<wkt::Timestamp>,
/// Optional. The time when the message was sent. For voice messages, this is
/// the time when an utterance started.
pub send_time: std::option::Option<wkt::Timestamp>,
/// Output only. The annotation for the message.
pub message_annotation: std::option::Option<crate::model::MessageAnnotation>,
/// Output only. The sentiment analysis result for the message.
pub sentiment_analysis: std::option::Option<crate::model::SentimentAnalysisResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl Message {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::Message::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Message;
/// let x = Message::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [content][crate::model::Message::content].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Message;
/// let x = Message::new().set_content("example");
/// ```
pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.content = v.into();
self
}
/// Sets the value of [language_code][crate::model::Message::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Message;
/// let x = Message::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [participant][crate::model::Message::participant].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Message;
/// let x = Message::new().set_participant("example");
/// ```
pub fn set_participant<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.participant = v.into();
self
}
/// Sets the value of [participant_role][crate::model::Message::participant_role].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Message;
/// use google_cloud_dialogflow_v2::model::participant::Role;
/// let x0 = Message::new().set_participant_role(Role::HumanAgent);
/// let x1 = Message::new().set_participant_role(Role::AutomatedAgent);
/// let x2 = Message::new().set_participant_role(Role::EndUser);
/// ```
pub fn set_participant_role<T: std::convert::Into<crate::model::participant::Role>>(
mut self,
v: T,
) -> Self {
self.participant_role = v.into();
self
}
/// Sets the value of [create_time][crate::model::Message::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Message;
/// use wkt::Timestamp;
/// let x = Message::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::Message::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Message;
/// use wkt::Timestamp;
/// let x = Message::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = Message::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [send_time][crate::model::Message::send_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Message;
/// use wkt::Timestamp;
/// let x = Message::new().set_send_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_send_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.send_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [send_time][crate::model::Message::send_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Message;
/// use wkt::Timestamp;
/// let x = Message::new().set_or_clear_send_time(Some(Timestamp::default()/* use setters */));
/// let x = Message::new().set_or_clear_send_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_send_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.send_time = v.map(|x| x.into());
self
}
/// Sets the value of [message_annotation][crate::model::Message::message_annotation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Message;
/// use google_cloud_dialogflow_v2::model::MessageAnnotation;
/// let x = Message::new().set_message_annotation(MessageAnnotation::default()/* use setters */);
/// ```
pub fn set_message_annotation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::MessageAnnotation>,
{
self.message_annotation = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [message_annotation][crate::model::Message::message_annotation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Message;
/// use google_cloud_dialogflow_v2::model::MessageAnnotation;
/// let x = Message::new().set_or_clear_message_annotation(Some(MessageAnnotation::default()/* use setters */));
/// let x = Message::new().set_or_clear_message_annotation(None::<MessageAnnotation>);
/// ```
pub fn set_or_clear_message_annotation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::MessageAnnotation>,
{
self.message_annotation = v.map(|x| x.into());
self
}
/// Sets the value of [sentiment_analysis][crate::model::Message::sentiment_analysis].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Message;
/// use google_cloud_dialogflow_v2::model::SentimentAnalysisResult;
/// let x = Message::new().set_sentiment_analysis(SentimentAnalysisResult::default()/* use setters */);
/// ```
pub fn set_sentiment_analysis<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SentimentAnalysisResult>,
{
self.sentiment_analysis = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [sentiment_analysis][crate::model::Message::sentiment_analysis].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Message;
/// use google_cloud_dialogflow_v2::model::SentimentAnalysisResult;
/// let x = Message::new().set_or_clear_sentiment_analysis(Some(SentimentAnalysisResult::default()/* use setters */));
/// let x = Message::new().set_or_clear_sentiment_analysis(None::<SentimentAnalysisResult>);
/// ```
pub fn set_or_clear_sentiment_analysis<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SentimentAnalysisResult>,
{
self.sentiment_analysis = v.map(|x| x.into());
self
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl wkt::message::Message for Message {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Message"
}
}
/// The request message for
/// [Participants.CreateParticipant][google.cloud.dialogflow.v2.Participants.CreateParticipant].
///
/// [google.cloud.dialogflow.v2.Participants.CreateParticipant]: crate::client::Participants::create_participant
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateParticipantRequest {
/// Required. Resource identifier of the conversation adding the participant.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>`.
pub parent: std::string::String,
/// Required. The participant to create.
pub participant: std::option::Option<crate::model::Participant>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl CreateParticipantRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateParticipantRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateParticipantRequest;
/// let x = CreateParticipantRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [participant][crate::model::CreateParticipantRequest::participant].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateParticipantRequest;
/// use google_cloud_dialogflow_v2::model::Participant;
/// let x = CreateParticipantRequest::new().set_participant(Participant::default()/* use setters */);
/// ```
pub fn set_participant<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Participant>,
{
self.participant = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [participant][crate::model::CreateParticipantRequest::participant].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateParticipantRequest;
/// use google_cloud_dialogflow_v2::model::Participant;
/// let x = CreateParticipantRequest::new().set_or_clear_participant(Some(Participant::default()/* use setters */));
/// let x = CreateParticipantRequest::new().set_or_clear_participant(None::<Participant>);
/// ```
pub fn set_or_clear_participant<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Participant>,
{
self.participant = v.map(|x| x.into());
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for CreateParticipantRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateParticipantRequest"
}
}
/// The request message for
/// [Participants.GetParticipant][google.cloud.dialogflow.v2.Participants.GetParticipant].
///
/// [google.cloud.dialogflow.v2.Participants.GetParticipant]: crate::client::Participants::get_participant
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetParticipantRequest {
/// Required. The name of the participant. Format:
/// `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation
/// ID>/participants/<Participant ID>`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl GetParticipantRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetParticipantRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetParticipantRequest;
/// let x = GetParticipantRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for GetParticipantRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetParticipantRequest"
}
}
/// The request message for
/// [Participants.ListParticipants][google.cloud.dialogflow.v2.Participants.ListParticipants].
///
/// [google.cloud.dialogflow.v2.Participants.ListParticipants]: crate::client::Participants::list_participants
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListParticipantsRequest {
/// Required. The conversation to list all participants from.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>`.
pub parent: std::string::String,
/// Optional. The maximum number of items to return in a single page. By
/// default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl ListParticipantsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListParticipantsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListParticipantsRequest;
/// let x = ListParticipantsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListParticipantsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListParticipantsRequest;
/// let x = ListParticipantsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListParticipantsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListParticipantsRequest;
/// let x = ListParticipantsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for ListParticipantsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListParticipantsRequest"
}
}
/// The response message for
/// [Participants.ListParticipants][google.cloud.dialogflow.v2.Participants.ListParticipants].
///
/// [google.cloud.dialogflow.v2.Participants.ListParticipants]: crate::client::Participants::list_participants
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListParticipantsResponse {
/// The list of participants. There is a maximum number of items
/// returned based on the page_size field in the request.
pub participants: std::vec::Vec<crate::model::Participant>,
/// Token to retrieve the next page of results or empty if there are no
/// more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl ListParticipantsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [participants][crate::model::ListParticipantsResponse::participants].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListParticipantsResponse;
/// use google_cloud_dialogflow_v2::model::Participant;
/// let x = ListParticipantsResponse::new()
/// .set_participants([
/// Participant::default()/* use setters */,
/// Participant::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_participants<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Participant>,
{
use std::iter::Iterator;
self.participants = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListParticipantsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListParticipantsResponse;
/// let x = ListParticipantsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for ListParticipantsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListParticipantsResponse"
}
}
#[cfg(feature = "participants")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListParticipantsResponse {
type PageItem = crate::model::Participant;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.participants
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [Participants.UpdateParticipant][google.cloud.dialogflow.v2.Participants.UpdateParticipant].
///
/// [google.cloud.dialogflow.v2.Participants.UpdateParticipant]: crate::client::Participants::update_participant
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateParticipantRequest {
/// Required. The participant to update.
pub participant: std::option::Option<crate::model::Participant>,
/// Required. The mask to specify which fields to update.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl UpdateParticipantRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [participant][crate::model::UpdateParticipantRequest::participant].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateParticipantRequest;
/// use google_cloud_dialogflow_v2::model::Participant;
/// let x = UpdateParticipantRequest::new().set_participant(Participant::default()/* use setters */);
/// ```
pub fn set_participant<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Participant>,
{
self.participant = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [participant][crate::model::UpdateParticipantRequest::participant].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateParticipantRequest;
/// use google_cloud_dialogflow_v2::model::Participant;
/// let x = UpdateParticipantRequest::new().set_or_clear_participant(Some(Participant::default()/* use setters */));
/// let x = UpdateParticipantRequest::new().set_or_clear_participant(None::<Participant>);
/// ```
pub fn set_or_clear_participant<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Participant>,
{
self.participant = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateParticipantRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateParticipantRequest;
/// use wkt::FieldMask;
/// let x = UpdateParticipantRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateParticipantRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateParticipantRequest;
/// use wkt::FieldMask;
/// let x = UpdateParticipantRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateParticipantRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for UpdateParticipantRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateParticipantRequest"
}
}
/// The request message for
/// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent].
///
/// [google.cloud.dialogflow.v2.Participants.AnalyzeContent]: crate::client::Participants::analyze_content
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AnalyzeContentRequest {
/// Required. The name of the participant this text comes from.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
pub participant: std::string::String,
/// Speech synthesis configuration.
/// The speech synthesis settings for a virtual agent that may be configured
/// for the associated conversation profile are not used when calling
/// AnalyzeContent. If this configuration is not supplied, speech synthesis
/// is disabled.
pub reply_audio_config: std::option::Option<crate::model::OutputAudioConfig>,
/// Parameters for a Dialogflow virtual-agent query.
pub query_params: std::option::Option<crate::model::QueryParameters>,
/// Parameters for a human assist query.
pub assist_query_params: std::option::Option<crate::model::AssistQueryParameters>,
/// Additional parameters to be put into Dialogflow CX session parameters. To
/// remove a parameter from the session, clients should explicitly set the
/// parameter value to null.
///
/// Note: this field should only be used if you are connecting to a Dialogflow
/// CX agent.
pub cx_parameters: std::option::Option<wkt::Struct>,
/// A unique identifier for this request. Restricted to 36 ASCII characters.
/// A random UUID is recommended.
/// This request is only idempotent if a `request_id` is provided.
pub request_id: std::string::String,
/// Required. The input content.
pub input: std::option::Option<crate::model::analyze_content_request::Input>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl AnalyzeContentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [participant][crate::model::AnalyzeContentRequest::participant].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// let x = AnalyzeContentRequest::new().set_participant("example");
/// ```
pub fn set_participant<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.participant = v.into();
self
}
/// Sets the value of [reply_audio_config][crate::model::AnalyzeContentRequest::reply_audio_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = AnalyzeContentRequest::new().set_reply_audio_config(OutputAudioConfig::default()/* use setters */);
/// ```
pub fn set_reply_audio_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.reply_audio_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [reply_audio_config][crate::model::AnalyzeContentRequest::reply_audio_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = AnalyzeContentRequest::new().set_or_clear_reply_audio_config(Some(OutputAudioConfig::default()/* use setters */));
/// let x = AnalyzeContentRequest::new().set_or_clear_reply_audio_config(None::<OutputAudioConfig>);
/// ```
pub fn set_or_clear_reply_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.reply_audio_config = v.map(|x| x.into());
self
}
/// Sets the value of [query_params][crate::model::AnalyzeContentRequest::query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::QueryParameters;
/// let x = AnalyzeContentRequest::new().set_query_params(QueryParameters::default()/* use setters */);
/// ```
pub fn set_query_params<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryParameters>,
{
self.query_params = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query_params][crate::model::AnalyzeContentRequest::query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::QueryParameters;
/// let x = AnalyzeContentRequest::new().set_or_clear_query_params(Some(QueryParameters::default()/* use setters */));
/// let x = AnalyzeContentRequest::new().set_or_clear_query_params(None::<QueryParameters>);
/// ```
pub fn set_or_clear_query_params<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryParameters>,
{
self.query_params = v.map(|x| x.into());
self
}
/// Sets the value of [assist_query_params][crate::model::AnalyzeContentRequest::assist_query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::AssistQueryParameters;
/// let x = AnalyzeContentRequest::new().set_assist_query_params(AssistQueryParameters::default()/* use setters */);
/// ```
pub fn set_assist_query_params<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AssistQueryParameters>,
{
self.assist_query_params = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [assist_query_params][crate::model::AnalyzeContentRequest::assist_query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::AssistQueryParameters;
/// let x = AnalyzeContentRequest::new().set_or_clear_assist_query_params(Some(AssistQueryParameters::default()/* use setters */));
/// let x = AnalyzeContentRequest::new().set_or_clear_assist_query_params(None::<AssistQueryParameters>);
/// ```
pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AssistQueryParameters>,
{
self.assist_query_params = v.map(|x| x.into());
self
}
/// Sets the value of [cx_parameters][crate::model::AnalyzeContentRequest::cx_parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// use wkt::Struct;
/// let x = AnalyzeContentRequest::new().set_cx_parameters(Struct::default()/* use setters */);
/// ```
pub fn set_cx_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.cx_parameters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cx_parameters][crate::model::AnalyzeContentRequest::cx_parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// use wkt::Struct;
/// let x = AnalyzeContentRequest::new().set_or_clear_cx_parameters(Some(Struct::default()/* use setters */));
/// let x = AnalyzeContentRequest::new().set_or_clear_cx_parameters(None::<Struct>);
/// ```
pub fn set_or_clear_cx_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.cx_parameters = v.map(|x| x.into());
self
}
/// Sets the value of [request_id][crate::model::AnalyzeContentRequest::request_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// let x = AnalyzeContentRequest::new().set_request_id("example");
/// ```
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
/// Sets the value of [input][crate::model::AnalyzeContentRequest::input].
///
/// Note that all the setters affecting `input` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::TextInput;
/// let x = AnalyzeContentRequest::new().set_input(Some(
/// google_cloud_dialogflow_v2::model::analyze_content_request::Input::TextInput(TextInput::default().into())));
/// ```
pub fn set_input<
T: std::convert::Into<std::option::Option<crate::model::analyze_content_request::Input>>,
>(
mut self,
v: T,
) -> Self {
self.input = v.into();
self
}
/// The value of [input][crate::model::AnalyzeContentRequest::input]
/// if it holds a `TextInput`, `None` if the field is not set or
/// holds a different branch.
pub fn text_input(&self) -> std::option::Option<&std::boxed::Box<crate::model::TextInput>> {
#[allow(unreachable_patterns)]
self.input.as_ref().and_then(|v| match v {
crate::model::analyze_content_request::Input::TextInput(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [input][crate::model::AnalyzeContentRequest::input]
/// to hold a `TextInput`.
///
/// Note that all the setters affecting `input` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::TextInput;
/// let x = AnalyzeContentRequest::new().set_text_input(TextInput::default()/* use setters */);
/// assert!(x.text_input().is_some());
/// assert!(x.audio_input().is_none());
/// assert!(x.event_input().is_none());
/// assert!(x.suggestion_input().is_none());
/// ```
pub fn set_text_input<T: std::convert::Into<std::boxed::Box<crate::model::TextInput>>>(
mut self,
v: T,
) -> Self {
self.input = std::option::Option::Some(
crate::model::analyze_content_request::Input::TextInput(v.into()),
);
self
}
/// The value of [input][crate::model::AnalyzeContentRequest::input]
/// if it holds a `AudioInput`, `None` if the field is not set or
/// holds a different branch.
pub fn audio_input(&self) -> std::option::Option<&std::boxed::Box<crate::model::AudioInput>> {
#[allow(unreachable_patterns)]
self.input.as_ref().and_then(|v| match v {
crate::model::analyze_content_request::Input::AudioInput(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [input][crate::model::AnalyzeContentRequest::input]
/// to hold a `AudioInput`.
///
/// Note that all the setters affecting `input` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::AudioInput;
/// let x = AnalyzeContentRequest::new().set_audio_input(AudioInput::default()/* use setters */);
/// assert!(x.audio_input().is_some());
/// assert!(x.text_input().is_none());
/// assert!(x.event_input().is_none());
/// assert!(x.suggestion_input().is_none());
/// ```
pub fn set_audio_input<T: std::convert::Into<std::boxed::Box<crate::model::AudioInput>>>(
mut self,
v: T,
) -> Self {
self.input = std::option::Option::Some(
crate::model::analyze_content_request::Input::AudioInput(v.into()),
);
self
}
/// The value of [input][crate::model::AnalyzeContentRequest::input]
/// if it holds a `EventInput`, `None` if the field is not set or
/// holds a different branch.
pub fn event_input(&self) -> std::option::Option<&std::boxed::Box<crate::model::EventInput>> {
#[allow(unreachable_patterns)]
self.input.as_ref().and_then(|v| match v {
crate::model::analyze_content_request::Input::EventInput(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [input][crate::model::AnalyzeContentRequest::input]
/// to hold a `EventInput`.
///
/// Note that all the setters affecting `input` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::EventInput;
/// let x = AnalyzeContentRequest::new().set_event_input(EventInput::default()/* use setters */);
/// assert!(x.event_input().is_some());
/// assert!(x.text_input().is_none());
/// assert!(x.audio_input().is_none());
/// assert!(x.suggestion_input().is_none());
/// ```
pub fn set_event_input<T: std::convert::Into<std::boxed::Box<crate::model::EventInput>>>(
mut self,
v: T,
) -> Self {
self.input = std::option::Option::Some(
crate::model::analyze_content_request::Input::EventInput(v.into()),
);
self
}
/// The value of [input][crate::model::AnalyzeContentRequest::input]
/// if it holds a `SuggestionInput`, `None` if the field is not set or
/// holds a different branch.
pub fn suggestion_input(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SuggestionInput>> {
#[allow(unreachable_patterns)]
self.input.as_ref().and_then(|v| match v {
crate::model::analyze_content_request::Input::SuggestionInput(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [input][crate::model::AnalyzeContentRequest::input]
/// to hold a `SuggestionInput`.
///
/// Note that all the setters affecting `input` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::SuggestionInput;
/// let x = AnalyzeContentRequest::new().set_suggestion_input(SuggestionInput::default()/* use setters */);
/// assert!(x.suggestion_input().is_some());
/// assert!(x.text_input().is_none());
/// assert!(x.audio_input().is_none());
/// assert!(x.event_input().is_none());
/// ```
pub fn set_suggestion_input<
T: std::convert::Into<std::boxed::Box<crate::model::SuggestionInput>>,
>(
mut self,
v: T,
) -> Self {
self.input = std::option::Option::Some(
crate::model::analyze_content_request::Input::SuggestionInput(v.into()),
);
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for AnalyzeContentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AnalyzeContentRequest"
}
}
/// Defines additional types related to [AnalyzeContentRequest].
#[cfg(feature = "participants")]
pub mod analyze_content_request {
#[allow(unused_imports)]
use super::*;
/// Required. The input content.
#[cfg(feature = "participants")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Input {
/// The natural language text to be processed.
TextInput(std::boxed::Box<crate::model::TextInput>),
/// The natural language speech audio to be processed.
AudioInput(std::boxed::Box<crate::model::AudioInput>),
/// An input event to send to Dialogflow.
EventInput(std::boxed::Box<crate::model::EventInput>),
/// An input representing the selection of a suggestion.
SuggestionInput(std::boxed::Box<crate::model::SuggestionInput>),
}
}
/// The message in the response that indicates the parameters of DTMF.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DtmfParameters {
/// Indicates whether DTMF input can be handled in the next request.
pub accepts_dtmf_input: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl DtmfParameters {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [accepts_dtmf_input][crate::model::DtmfParameters::accepts_dtmf_input].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DtmfParameters;
/// let x = DtmfParameters::new().set_accepts_dtmf_input(true);
/// ```
pub fn set_accepts_dtmf_input<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.accepts_dtmf_input = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for DtmfParameters {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DtmfParameters"
}
}
/// The response message for
/// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent].
///
/// [google.cloud.dialogflow.v2.Participants.AnalyzeContent]: crate::client::Participants::analyze_content
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AnalyzeContentResponse {
/// The output text content.
/// This field is set if the automated agent responded with text to show to
/// the user.
pub reply_text: std::string::String,
/// The audio data bytes encoded as specified in the request.
/// This field is set if:
///
/// - `reply_audio_config` was specified in the request, or
/// - The automated agent responded with audio to play to the user. In such
/// case, `reply_audio.config` contains settings used to synthesize the
/// speech.
///
/// In some scenarios, multiple output audio fields may be present in the
/// response structure. In these cases, only the top-most-level audio output
/// has content.
pub reply_audio: std::option::Option<crate::model::OutputAudio>,
/// Only set if a Dialogflow automated agent has responded.
/// Note that in [AutomatedAgentReply.DetectIntentResponse][],
/// [Sessions.DetectIntentResponse.output_audio][]
/// and [Sessions.DetectIntentResponse.output_audio_config][]
/// are always empty, use
/// [reply_audio][google.cloud.dialogflow.v2.AnalyzeContentResponse.reply_audio]
/// instead.
///
/// [google.cloud.dialogflow.v2.AnalyzeContentResponse.reply_audio]: crate::model::AnalyzeContentResponse::reply_audio
pub automated_agent_reply: std::option::Option<crate::model::AutomatedAgentReply>,
/// Message analyzed by CCAI.
pub message: std::option::Option<crate::model::Message>,
/// The suggestions for most recent human agent. The order is the same as
/// [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs]
/// of
/// [HumanAgentAssistantConfig.human_agent_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.human_agent_suggestion_config].
///
/// Note that any failure of Agent Assist features will not lead to the overall
/// failure of an AnalyzeContent API call. Instead, the features will
/// fail silently with the error field set in the corresponding
/// SuggestionResult.
///
/// [google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs]: crate::model::human_agent_assistant_config::SuggestionConfig::feature_configs
/// [google.cloud.dialogflow.v2.HumanAgentAssistantConfig.human_agent_suggestion_config]: crate::model::HumanAgentAssistantConfig::human_agent_suggestion_config
pub human_agent_suggestion_results: std::vec::Vec<crate::model::SuggestionResult>,
/// The suggestions for end user. The order is the same as
/// [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs]
/// of
/// [HumanAgentAssistantConfig.end_user_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.end_user_suggestion_config].
///
/// Same as human_agent_suggestion_results, any failure of Agent Assist
/// features will not lead to the overall failure of an AnalyzeContent API
/// call. Instead, the features will fail silently with the error field set in
/// the corresponding SuggestionResult.
///
/// [google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs]: crate::model::human_agent_assistant_config::SuggestionConfig::feature_configs
/// [google.cloud.dialogflow.v2.HumanAgentAssistantConfig.end_user_suggestion_config]: crate::model::HumanAgentAssistantConfig::end_user_suggestion_config
pub end_user_suggestion_results: std::vec::Vec<crate::model::SuggestionResult>,
/// Indicates the parameters of DTMF.
pub dtmf_parameters: std::option::Option<crate::model::DtmfParameters>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl AnalyzeContentResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [reply_text][crate::model::AnalyzeContentResponse::reply_text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentResponse;
/// let x = AnalyzeContentResponse::new().set_reply_text("example");
/// ```
pub fn set_reply_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.reply_text = v.into();
self
}
/// Sets the value of [reply_audio][crate::model::AnalyzeContentResponse::reply_audio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::OutputAudio;
/// let x = AnalyzeContentResponse::new().set_reply_audio(OutputAudio::default()/* use setters */);
/// ```
pub fn set_reply_audio<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::OutputAudio>,
{
self.reply_audio = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [reply_audio][crate::model::AnalyzeContentResponse::reply_audio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::OutputAudio;
/// let x = AnalyzeContentResponse::new().set_or_clear_reply_audio(Some(OutputAudio::default()/* use setters */));
/// let x = AnalyzeContentResponse::new().set_or_clear_reply_audio(None::<OutputAudio>);
/// ```
pub fn set_or_clear_reply_audio<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::OutputAudio>,
{
self.reply_audio = v.map(|x| x.into());
self
}
/// Sets the value of [automated_agent_reply][crate::model::AnalyzeContentResponse::automated_agent_reply].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::AutomatedAgentReply;
/// let x = AnalyzeContentResponse::new().set_automated_agent_reply(AutomatedAgentReply::default()/* use setters */);
/// ```
pub fn set_automated_agent_reply<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AutomatedAgentReply>,
{
self.automated_agent_reply = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [automated_agent_reply][crate::model::AnalyzeContentResponse::automated_agent_reply].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::AutomatedAgentReply;
/// let x = AnalyzeContentResponse::new().set_or_clear_automated_agent_reply(Some(AutomatedAgentReply::default()/* use setters */));
/// let x = AnalyzeContentResponse::new().set_or_clear_automated_agent_reply(None::<AutomatedAgentReply>);
/// ```
pub fn set_or_clear_automated_agent_reply<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AutomatedAgentReply>,
{
self.automated_agent_reply = v.map(|x| x.into());
self
}
/// Sets the value of [message][crate::model::AnalyzeContentResponse::message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::Message;
/// let x = AnalyzeContentResponse::new().set_message(Message::default()/* use setters */);
/// ```
pub fn set_message<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Message>,
{
self.message = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [message][crate::model::AnalyzeContentResponse::message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::Message;
/// let x = AnalyzeContentResponse::new().set_or_clear_message(Some(Message::default()/* use setters */));
/// let x = AnalyzeContentResponse::new().set_or_clear_message(None::<Message>);
/// ```
pub fn set_or_clear_message<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Message>,
{
self.message = v.map(|x| x.into());
self
}
/// Sets the value of [human_agent_suggestion_results][crate::model::AnalyzeContentResponse::human_agent_suggestion_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::SuggestionResult;
/// let x = AnalyzeContentResponse::new()
/// .set_human_agent_suggestion_results([
/// SuggestionResult::default()/* use setters */,
/// SuggestionResult::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_human_agent_suggestion_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SuggestionResult>,
{
use std::iter::Iterator;
self.human_agent_suggestion_results = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [end_user_suggestion_results][crate::model::AnalyzeContentResponse::end_user_suggestion_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::SuggestionResult;
/// let x = AnalyzeContentResponse::new()
/// .set_end_user_suggestion_results([
/// SuggestionResult::default()/* use setters */,
/// SuggestionResult::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_end_user_suggestion_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SuggestionResult>,
{
use std::iter::Iterator;
self.end_user_suggestion_results = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [dtmf_parameters][crate::model::AnalyzeContentResponse::dtmf_parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::DtmfParameters;
/// let x = AnalyzeContentResponse::new().set_dtmf_parameters(DtmfParameters::default()/* use setters */);
/// ```
pub fn set_dtmf_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DtmfParameters>,
{
self.dtmf_parameters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dtmf_parameters][crate::model::AnalyzeContentResponse::dtmf_parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::DtmfParameters;
/// let x = AnalyzeContentResponse::new().set_or_clear_dtmf_parameters(Some(DtmfParameters::default()/* use setters */));
/// let x = AnalyzeContentResponse::new().set_or_clear_dtmf_parameters(None::<DtmfParameters>);
/// ```
pub fn set_or_clear_dtmf_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DtmfParameters>,
{
self.dtmf_parameters = v.map(|x| x.into());
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for AnalyzeContentResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AnalyzeContentResponse"
}
}
/// The top-level message sent by the client to the
/// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent]
/// method.
///
/// Multiple request messages should be sent in order:
///
/// 1. The first message must contain
/// [participant][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.participant],
/// [config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config]
/// and optionally
/// [query_params][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.query_params].
/// If you want to receive an audio response, it should also contain
/// [reply_audio_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.reply_audio_config].
/// The message must not contain
/// [input][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input].
///
/// 1. If
/// [config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config] in
/// the first message
/// was set to
/// [audio_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.audio_config],
/// all subsequent messages must contain
/// [input_audio][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input_audio]
/// to continue with Speech recognition. However, note that:
///
/// * Dialogflow will bill you for the audio so far.
/// * Dialogflow discards all Speech recognition results in favor of the
/// text input.
/// 1. If
/// [StreamingAnalyzeContentRequest.config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config]
/// in the first message was set
/// to
/// [StreamingAnalyzeContentRequest.text_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.text_config],
/// then the second message must contain only
/// [input_text][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input_text].
/// Moreover, you must not send more than two messages.
///
///
/// After you sent all input, you must half-close or abort the request stream.
///
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.audio_config]: crate::model::StreamingAnalyzeContentRequest::config
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config]: crate::model::StreamingAnalyzeContentRequest::config
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input]: crate::model::StreamingAnalyzeContentRequest::input
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input_audio]: crate::model::StreamingAnalyzeContentRequest::input
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input_text]: crate::model::StreamingAnalyzeContentRequest::input
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.participant]: crate::model::StreamingAnalyzeContentRequest::participant
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.query_params]: crate::model::StreamingAnalyzeContentRequest::query_params
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.reply_audio_config]: crate::model::StreamingAnalyzeContentRequest::reply_audio_config
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.text_config]: crate::model::StreamingAnalyzeContentRequest::config
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StreamingAnalyzeContentRequest {
/// Required. The name of the participant this text comes from.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
pub participant: std::string::String,
/// Speech synthesis configuration.
/// The speech synthesis settings for a virtual agent that may be configured
/// for the associated conversation profile are not used when calling
/// StreamingAnalyzeContent. If this configuration is not supplied, speech
/// synthesis is disabled.
pub reply_audio_config: std::option::Option<crate::model::OutputAudioConfig>,
/// Parameters for a Dialogflow virtual-agent query.
pub query_params: std::option::Option<crate::model::QueryParameters>,
/// Parameters for a human assist query.
pub assist_query_params: std::option::Option<crate::model::AssistQueryParameters>,
/// Additional parameters to be put into Dialogflow CX session parameters. To
/// remove a parameter from the session, clients should explicitly set the
/// parameter value to null.
///
/// Note: this field should only be used if you are connecting to a Dialogflow
/// CX agent.
pub cx_parameters: std::option::Option<wkt::Struct>,
/// Optional. Enable full bidirectional streaming. You can keep streaming the
/// audio until timeout, and there's no need to half close the stream to get
/// the response.
///
/// Restrictions:
///
/// - Timeout: 3 mins.
/// - Audio Encoding: only supports
/// [AudioEncoding.AUDIO_ENCODING_LINEAR_16][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_LINEAR_16]
/// and
/// [AudioEncoding.AUDIO_ENCODING_MULAW][google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_MULAW]
/// - Lifecycle: conversation should be in `Assist Stage`, go to
/// [Conversations.CreateConversation][google.cloud.dialogflow.v2.Conversations.CreateConversation]
/// for more information.
///
/// InvalidArgument Error will be returned if the one of restriction checks
/// failed.
///
/// You can find more details in
/// <https://cloud.google.com/agent-assist/docs/extended-streaming>
///
/// [google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_LINEAR_16]: crate::model::AudioEncoding::Linear16
/// [google.cloud.dialogflow.v2.AudioEncoding.AUDIO_ENCODING_MULAW]: crate::model::AudioEncoding::Mulaw
/// [google.cloud.dialogflow.v2.Conversations.CreateConversation]: crate::client::Conversations::create_conversation
pub enable_extended_streaming: bool,
/// Optional. Enable partial responses from Dialogflow CX agent. If this flag
/// is not enabled, response stream still contains only one final response even
/// if some `Fulfillment`s in Dialogflow CX agent have been configured to
/// return partial responses.
pub enable_partial_automated_agent_reply: bool,
/// Optional. If multiple uttereances are detected in the audio stream, process
/// them individually instead of stitching them together to form a single
/// utterance.
pub output_multiple_utterances: bool,
/// If true, `StreamingAnalyzeContentResponse.debugging_info` will get
/// populated.
pub enable_debugging_info: bool,
/// The input config.
pub config: std::option::Option<crate::model::streaming_analyze_content_request::Config>,
/// The input.
pub input: std::option::Option<crate::model::streaming_analyze_content_request::Input>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl StreamingAnalyzeContentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [participant][crate::model::StreamingAnalyzeContentRequest::participant].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// let x = StreamingAnalyzeContentRequest::new().set_participant("example");
/// ```
pub fn set_participant<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.participant = v.into();
self
}
/// Sets the value of [reply_audio_config][crate::model::StreamingAnalyzeContentRequest::reply_audio_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = StreamingAnalyzeContentRequest::new().set_reply_audio_config(OutputAudioConfig::default()/* use setters */);
/// ```
pub fn set_reply_audio_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.reply_audio_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [reply_audio_config][crate::model::StreamingAnalyzeContentRequest::reply_audio_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = StreamingAnalyzeContentRequest::new().set_or_clear_reply_audio_config(Some(OutputAudioConfig::default()/* use setters */));
/// let x = StreamingAnalyzeContentRequest::new().set_or_clear_reply_audio_config(None::<OutputAudioConfig>);
/// ```
pub fn set_or_clear_reply_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.reply_audio_config = v.map(|x| x.into());
self
}
/// Sets the value of [query_params][crate::model::StreamingAnalyzeContentRequest::query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::QueryParameters;
/// let x = StreamingAnalyzeContentRequest::new().set_query_params(QueryParameters::default()/* use setters */);
/// ```
pub fn set_query_params<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryParameters>,
{
self.query_params = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query_params][crate::model::StreamingAnalyzeContentRequest::query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::QueryParameters;
/// let x = StreamingAnalyzeContentRequest::new().set_or_clear_query_params(Some(QueryParameters::default()/* use setters */));
/// let x = StreamingAnalyzeContentRequest::new().set_or_clear_query_params(None::<QueryParameters>);
/// ```
pub fn set_or_clear_query_params<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryParameters>,
{
self.query_params = v.map(|x| x.into());
self
}
/// Sets the value of [assist_query_params][crate::model::StreamingAnalyzeContentRequest::assist_query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::AssistQueryParameters;
/// let x = StreamingAnalyzeContentRequest::new().set_assist_query_params(AssistQueryParameters::default()/* use setters */);
/// ```
pub fn set_assist_query_params<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AssistQueryParameters>,
{
self.assist_query_params = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [assist_query_params][crate::model::StreamingAnalyzeContentRequest::assist_query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::AssistQueryParameters;
/// let x = StreamingAnalyzeContentRequest::new().set_or_clear_assist_query_params(Some(AssistQueryParameters::default()/* use setters */));
/// let x = StreamingAnalyzeContentRequest::new().set_or_clear_assist_query_params(None::<AssistQueryParameters>);
/// ```
pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AssistQueryParameters>,
{
self.assist_query_params = v.map(|x| x.into());
self
}
/// Sets the value of [cx_parameters][crate::model::StreamingAnalyzeContentRequest::cx_parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// use wkt::Struct;
/// let x = StreamingAnalyzeContentRequest::new().set_cx_parameters(Struct::default()/* use setters */);
/// ```
pub fn set_cx_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.cx_parameters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [cx_parameters][crate::model::StreamingAnalyzeContentRequest::cx_parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// use wkt::Struct;
/// let x = StreamingAnalyzeContentRequest::new().set_or_clear_cx_parameters(Some(Struct::default()/* use setters */));
/// let x = StreamingAnalyzeContentRequest::new().set_or_clear_cx_parameters(None::<Struct>);
/// ```
pub fn set_or_clear_cx_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.cx_parameters = v.map(|x| x.into());
self
}
/// Sets the value of [enable_extended_streaming][crate::model::StreamingAnalyzeContentRequest::enable_extended_streaming].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// let x = StreamingAnalyzeContentRequest::new().set_enable_extended_streaming(true);
/// ```
pub fn set_enable_extended_streaming<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_extended_streaming = v.into();
self
}
/// Sets the value of [enable_partial_automated_agent_reply][crate::model::StreamingAnalyzeContentRequest::enable_partial_automated_agent_reply].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// let x = StreamingAnalyzeContentRequest::new().set_enable_partial_automated_agent_reply(true);
/// ```
pub fn set_enable_partial_automated_agent_reply<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.enable_partial_automated_agent_reply = v.into();
self
}
/// Sets the value of [output_multiple_utterances][crate::model::StreamingAnalyzeContentRequest::output_multiple_utterances].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// let x = StreamingAnalyzeContentRequest::new().set_output_multiple_utterances(true);
/// ```
pub fn set_output_multiple_utterances<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.output_multiple_utterances = v.into();
self
}
/// Sets the value of [enable_debugging_info][crate::model::StreamingAnalyzeContentRequest::enable_debugging_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// let x = StreamingAnalyzeContentRequest::new().set_enable_debugging_info(true);
/// ```
pub fn set_enable_debugging_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_debugging_info = v.into();
self
}
/// Sets the value of [config][crate::model::StreamingAnalyzeContentRequest::config].
///
/// Note that all the setters affecting `config` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = StreamingAnalyzeContentRequest::new().set_config(Some(
/// google_cloud_dialogflow_v2::model::streaming_analyze_content_request::Config::AudioConfig(InputAudioConfig::default().into())));
/// ```
pub fn set_config<
T: std::convert::Into<
std::option::Option<crate::model::streaming_analyze_content_request::Config>,
>,
>(
mut self,
v: T,
) -> Self {
self.config = v.into();
self
}
/// The value of [config][crate::model::StreamingAnalyzeContentRequest::config]
/// if it holds a `AudioConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn audio_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::InputAudioConfig>> {
#[allow(unreachable_patterns)]
self.config.as_ref().and_then(|v| match v {
crate::model::streaming_analyze_content_request::Config::AudioConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [config][crate::model::StreamingAnalyzeContentRequest::config]
/// to hold a `AudioConfig`.
///
/// Note that all the setters affecting `config` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = StreamingAnalyzeContentRequest::new().set_audio_config(InputAudioConfig::default()/* use setters */);
/// assert!(x.audio_config().is_some());
/// assert!(x.text_config().is_none());
/// ```
pub fn set_audio_config<
T: std::convert::Into<std::boxed::Box<crate::model::InputAudioConfig>>,
>(
mut self,
v: T,
) -> Self {
self.config = std::option::Option::Some(
crate::model::streaming_analyze_content_request::Config::AudioConfig(v.into()),
);
self
}
/// The value of [config][crate::model::StreamingAnalyzeContentRequest::config]
/// if it holds a `TextConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn text_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::InputTextConfig>> {
#[allow(unreachable_patterns)]
self.config.as_ref().and_then(|v| match v {
crate::model::streaming_analyze_content_request::Config::TextConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [config][crate::model::StreamingAnalyzeContentRequest::config]
/// to hold a `TextConfig`.
///
/// Note that all the setters affecting `config` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::InputTextConfig;
/// let x = StreamingAnalyzeContentRequest::new().set_text_config(InputTextConfig::default()/* use setters */);
/// assert!(x.text_config().is_some());
/// assert!(x.audio_config().is_none());
/// ```
pub fn set_text_config<
T: std::convert::Into<std::boxed::Box<crate::model::InputTextConfig>>,
>(
mut self,
v: T,
) -> Self {
self.config = std::option::Option::Some(
crate::model::streaming_analyze_content_request::Config::TextConfig(v.into()),
);
self
}
/// Sets the value of [input][crate::model::StreamingAnalyzeContentRequest::input].
///
/// Note that all the setters affecting `input` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::streaming_analyze_content_request::Input;
/// let x = StreamingAnalyzeContentRequest::new().set_input(Some(Input::InputAudio(bytes::Bytes::from_static(b"example"))));
/// ```
pub fn set_input<
T: std::convert::Into<
std::option::Option<crate::model::streaming_analyze_content_request::Input>,
>,
>(
mut self,
v: T,
) -> Self {
self.input = v.into();
self
}
/// The value of [input][crate::model::StreamingAnalyzeContentRequest::input]
/// if it holds a `InputAudio`, `None` if the field is not set or
/// holds a different branch.
pub fn input_audio(&self) -> std::option::Option<&::bytes::Bytes> {
#[allow(unreachable_patterns)]
self.input.as_ref().and_then(|v| match v {
crate::model::streaming_analyze_content_request::Input::InputAudio(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [input][crate::model::StreamingAnalyzeContentRequest::input]
/// to hold a `InputAudio`.
///
/// Note that all the setters affecting `input` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// let x = StreamingAnalyzeContentRequest::new().set_input_audio(bytes::Bytes::from_static(b"example"));
/// assert!(x.input_audio().is_some());
/// assert!(x.input_text().is_none());
/// assert!(x.input_dtmf().is_none());
/// ```
pub fn set_input_audio<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.input = std::option::Option::Some(
crate::model::streaming_analyze_content_request::Input::InputAudio(v.into()),
);
self
}
/// The value of [input][crate::model::StreamingAnalyzeContentRequest::input]
/// if it holds a `InputText`, `None` if the field is not set or
/// holds a different branch.
pub fn input_text(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.input.as_ref().and_then(|v| match v {
crate::model::streaming_analyze_content_request::Input::InputText(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [input][crate::model::StreamingAnalyzeContentRequest::input]
/// to hold a `InputText`.
///
/// Note that all the setters affecting `input` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// let x = StreamingAnalyzeContentRequest::new().set_input_text("example");
/// assert!(x.input_text().is_some());
/// assert!(x.input_audio().is_none());
/// assert!(x.input_dtmf().is_none());
/// ```
pub fn set_input_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.input = std::option::Option::Some(
crate::model::streaming_analyze_content_request::Input::InputText(v.into()),
);
self
}
/// The value of [input][crate::model::StreamingAnalyzeContentRequest::input]
/// if it holds a `InputDtmf`, `None` if the field is not set or
/// holds a different branch.
pub fn input_dtmf(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::TelephonyDtmfEvents>> {
#[allow(unreachable_patterns)]
self.input.as_ref().and_then(|v| match v {
crate::model::streaming_analyze_content_request::Input::InputDtmf(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [input][crate::model::StreamingAnalyzeContentRequest::input]
/// to hold a `InputDtmf`.
///
/// Note that all the setters affecting `input` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentRequest;
/// use google_cloud_dialogflow_v2::model::TelephonyDtmfEvents;
/// let x = StreamingAnalyzeContentRequest::new().set_input_dtmf(TelephonyDtmfEvents::default()/* use setters */);
/// assert!(x.input_dtmf().is_some());
/// assert!(x.input_audio().is_none());
/// assert!(x.input_text().is_none());
/// ```
pub fn set_input_dtmf<
T: std::convert::Into<std::boxed::Box<crate::model::TelephonyDtmfEvents>>,
>(
mut self,
v: T,
) -> Self {
self.input = std::option::Option::Some(
crate::model::streaming_analyze_content_request::Input::InputDtmf(v.into()),
);
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for StreamingAnalyzeContentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest"
}
}
/// Defines additional types related to [StreamingAnalyzeContentRequest].
#[cfg(feature = "participants")]
pub mod streaming_analyze_content_request {
#[allow(unused_imports)]
use super::*;
/// The input config.
#[cfg(feature = "participants")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Config {
/// Instructs the speech recognizer how to process the speech audio.
AudioConfig(std::boxed::Box<crate::model::InputAudioConfig>),
/// The natural language text to be processed.
TextConfig(std::boxed::Box<crate::model::InputTextConfig>),
}
/// The input.
#[cfg(feature = "participants")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Input {
/// The input audio content to be recognized. Must be sent if `audio_config`
/// is set in the first message. The complete audio over all streaming
/// messages must not exceed 1 minute.
InputAudio(::bytes::Bytes),
/// The UTF-8 encoded natural language text to be processed. Must be sent if
/// `text_config` is set in the first message. Text length must not exceed
/// 256 bytes for virtual agent interactions. The `input_text` field can be
/// only sent once, and would cancel the speech recognition if any ongoing.
InputText(std::string::String),
/// The DTMF digits used to invoke intent and fill in parameter value.
///
/// This input is ignored if the previous response indicated that DTMF input
/// is not accepted.
InputDtmf(std::boxed::Box<crate::model::TelephonyDtmfEvents>),
}
}
/// The top-level message returned from the `StreamingAnalyzeContent` method.
///
/// Multiple response messages can be returned in order:
///
/// 1. If the input was set to streaming audio, the first one or more messages
/// contain `recognition_result`. Each `recognition_result` represents a more
/// complete transcript of what the user said. The last `recognition_result`
/// has `is_final` set to `true`.
///
/// 1. In virtual agent stage: if `enable_partial_automated_agent_reply` is
/// true, the following N (currently 1 <= N <= 4) messages
/// contain `automated_agent_reply` and optionally `reply_audio`
/// returned by the virtual agent. The first (N-1)
/// `automated_agent_reply`s will have `automated_agent_reply_type` set to
/// `PARTIAL`. The last `automated_agent_reply` has
/// `automated_agent_reply_type` set to `FINAL`.
/// If `enable_partial_automated_agent_reply` is not enabled, response stream
/// only contains the final reply.
///
/// In human assist stage: the following N (N >= 1) messages contain
/// `human_agent_suggestion_results`, `end_user_suggestion_results` or
/// `message`.
///
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StreamingAnalyzeContentResponse {
/// The result of speech recognition.
pub recognition_result: std::option::Option<crate::model::StreamingRecognitionResult>,
/// The output text content.
/// This field is set if an automated agent responded with a text for the user.
pub reply_text: std::string::String,
/// The audio data bytes encoded as specified in the request.
/// This field is set if:
///
/// - The `reply_audio_config` field is specified in the request.
/// - The automated agent, which this output comes from, responded with audio.
/// In such case, the `reply_audio.config` field contains settings used to
/// synthesize the speech.
///
/// In some scenarios, multiple output audio fields may be present in the
/// response structure. In these cases, only the top-most-level audio output
/// has content.
pub reply_audio: std::option::Option<crate::model::OutputAudio>,
/// Note that in [AutomatedAgentReply.DetectIntentResponse][],
/// [Sessions.DetectIntentResponse.output_audio][]
/// and [Sessions.DetectIntentResponse.output_audio_config][]
/// are always empty, use
/// [reply_audio][google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.reply_audio]
/// instead.
///
/// [google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.reply_audio]: crate::model::StreamingAnalyzeContentResponse::reply_audio
pub automated_agent_reply: std::option::Option<crate::model::AutomatedAgentReply>,
/// Message analyzed by CCAI.
pub message: std::option::Option<crate::model::Message>,
/// The suggestions for most recent human agent. The order is the same as
/// [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs]
/// of
/// [HumanAgentAssistantConfig.human_agent_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.human_agent_suggestion_config].
///
/// [google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs]: crate::model::human_agent_assistant_config::SuggestionConfig::feature_configs
/// [google.cloud.dialogflow.v2.HumanAgentAssistantConfig.human_agent_suggestion_config]: crate::model::HumanAgentAssistantConfig::human_agent_suggestion_config
pub human_agent_suggestion_results: std::vec::Vec<crate::model::SuggestionResult>,
/// The suggestions for end user. The order is the same as
/// [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs]
/// of
/// [HumanAgentAssistantConfig.end_user_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.end_user_suggestion_config].
///
/// [google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs]: crate::model::human_agent_assistant_config::SuggestionConfig::feature_configs
/// [google.cloud.dialogflow.v2.HumanAgentAssistantConfig.end_user_suggestion_config]: crate::model::HumanAgentAssistantConfig::end_user_suggestion_config
pub end_user_suggestion_results: std::vec::Vec<crate::model::SuggestionResult>,
/// Indicates the parameters of DTMF.
pub dtmf_parameters: std::option::Option<crate::model::DtmfParameters>,
/// Debugging info that would get populated when
/// `StreamingAnalyzeContentRequest.enable_debugging_info` is set to true.
pub debugging_info: std::option::Option<crate::model::CloudConversationDebuggingInfo>,
/// The name of the actual Cloud speech model used for speech recognition.
pub speech_model: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl StreamingAnalyzeContentResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [recognition_result][crate::model::StreamingAnalyzeContentResponse::recognition_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::StreamingRecognitionResult;
/// let x = StreamingAnalyzeContentResponse::new().set_recognition_result(StreamingRecognitionResult::default()/* use setters */);
/// ```
pub fn set_recognition_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StreamingRecognitionResult>,
{
self.recognition_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [recognition_result][crate::model::StreamingAnalyzeContentResponse::recognition_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::StreamingRecognitionResult;
/// let x = StreamingAnalyzeContentResponse::new().set_or_clear_recognition_result(Some(StreamingRecognitionResult::default()/* use setters */));
/// let x = StreamingAnalyzeContentResponse::new().set_or_clear_recognition_result(None::<StreamingRecognitionResult>);
/// ```
pub fn set_or_clear_recognition_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StreamingRecognitionResult>,
{
self.recognition_result = v.map(|x| x.into());
self
}
/// Sets the value of [reply_text][crate::model::StreamingAnalyzeContentResponse::reply_text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// let x = StreamingAnalyzeContentResponse::new().set_reply_text("example");
/// ```
pub fn set_reply_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.reply_text = v.into();
self
}
/// Sets the value of [reply_audio][crate::model::StreamingAnalyzeContentResponse::reply_audio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::OutputAudio;
/// let x = StreamingAnalyzeContentResponse::new().set_reply_audio(OutputAudio::default()/* use setters */);
/// ```
pub fn set_reply_audio<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::OutputAudio>,
{
self.reply_audio = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [reply_audio][crate::model::StreamingAnalyzeContentResponse::reply_audio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::OutputAudio;
/// let x = StreamingAnalyzeContentResponse::new().set_or_clear_reply_audio(Some(OutputAudio::default()/* use setters */));
/// let x = StreamingAnalyzeContentResponse::new().set_or_clear_reply_audio(None::<OutputAudio>);
/// ```
pub fn set_or_clear_reply_audio<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::OutputAudio>,
{
self.reply_audio = v.map(|x| x.into());
self
}
/// Sets the value of [automated_agent_reply][crate::model::StreamingAnalyzeContentResponse::automated_agent_reply].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::AutomatedAgentReply;
/// let x = StreamingAnalyzeContentResponse::new().set_automated_agent_reply(AutomatedAgentReply::default()/* use setters */);
/// ```
pub fn set_automated_agent_reply<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AutomatedAgentReply>,
{
self.automated_agent_reply = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [automated_agent_reply][crate::model::StreamingAnalyzeContentResponse::automated_agent_reply].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::AutomatedAgentReply;
/// let x = StreamingAnalyzeContentResponse::new().set_or_clear_automated_agent_reply(Some(AutomatedAgentReply::default()/* use setters */));
/// let x = StreamingAnalyzeContentResponse::new().set_or_clear_automated_agent_reply(None::<AutomatedAgentReply>);
/// ```
pub fn set_or_clear_automated_agent_reply<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AutomatedAgentReply>,
{
self.automated_agent_reply = v.map(|x| x.into());
self
}
/// Sets the value of [message][crate::model::StreamingAnalyzeContentResponse::message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::Message;
/// let x = StreamingAnalyzeContentResponse::new().set_message(Message::default()/* use setters */);
/// ```
pub fn set_message<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Message>,
{
self.message = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [message][crate::model::StreamingAnalyzeContentResponse::message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::Message;
/// let x = StreamingAnalyzeContentResponse::new().set_or_clear_message(Some(Message::default()/* use setters */));
/// let x = StreamingAnalyzeContentResponse::new().set_or_clear_message(None::<Message>);
/// ```
pub fn set_or_clear_message<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Message>,
{
self.message = v.map(|x| x.into());
self
}
/// Sets the value of [human_agent_suggestion_results][crate::model::StreamingAnalyzeContentResponse::human_agent_suggestion_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::SuggestionResult;
/// let x = StreamingAnalyzeContentResponse::new()
/// .set_human_agent_suggestion_results([
/// SuggestionResult::default()/* use setters */,
/// SuggestionResult::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_human_agent_suggestion_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SuggestionResult>,
{
use std::iter::Iterator;
self.human_agent_suggestion_results = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [end_user_suggestion_results][crate::model::StreamingAnalyzeContentResponse::end_user_suggestion_results].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::SuggestionResult;
/// let x = StreamingAnalyzeContentResponse::new()
/// .set_end_user_suggestion_results([
/// SuggestionResult::default()/* use setters */,
/// SuggestionResult::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_end_user_suggestion_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SuggestionResult>,
{
use std::iter::Iterator;
self.end_user_suggestion_results = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [dtmf_parameters][crate::model::StreamingAnalyzeContentResponse::dtmf_parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::DtmfParameters;
/// let x = StreamingAnalyzeContentResponse::new().set_dtmf_parameters(DtmfParameters::default()/* use setters */);
/// ```
pub fn set_dtmf_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DtmfParameters>,
{
self.dtmf_parameters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [dtmf_parameters][crate::model::StreamingAnalyzeContentResponse::dtmf_parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::DtmfParameters;
/// let x = StreamingAnalyzeContentResponse::new().set_or_clear_dtmf_parameters(Some(DtmfParameters::default()/* use setters */));
/// let x = StreamingAnalyzeContentResponse::new().set_or_clear_dtmf_parameters(None::<DtmfParameters>);
/// ```
pub fn set_or_clear_dtmf_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DtmfParameters>,
{
self.dtmf_parameters = v.map(|x| x.into());
self
}
/// Sets the value of [debugging_info][crate::model::StreamingAnalyzeContentResponse::debugging_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// let x = StreamingAnalyzeContentResponse::new().set_debugging_info(CloudConversationDebuggingInfo::default()/* use setters */);
/// ```
pub fn set_debugging_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CloudConversationDebuggingInfo>,
{
self.debugging_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [debugging_info][crate::model::StreamingAnalyzeContentResponse::debugging_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// let x = StreamingAnalyzeContentResponse::new().set_or_clear_debugging_info(Some(CloudConversationDebuggingInfo::default()/* use setters */));
/// let x = StreamingAnalyzeContentResponse::new().set_or_clear_debugging_info(None::<CloudConversationDebuggingInfo>);
/// ```
pub fn set_or_clear_debugging_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CloudConversationDebuggingInfo>,
{
self.debugging_info = v.map(|x| x.into());
self
}
/// Sets the value of [speech_model][crate::model::StreamingAnalyzeContentResponse::speech_model].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingAnalyzeContentResponse;
/// let x = StreamingAnalyzeContentResponse::new().set_speech_model("example");
/// ```
pub fn set_speech_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.speech_model = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for StreamingAnalyzeContentResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse"
}
}
/// The request message for
/// [Participants.SuggestArticles][google.cloud.dialogflow.v2.Participants.SuggestArticles].
///
/// [google.cloud.dialogflow.v2.Participants.SuggestArticles]: crate::client::Participants::suggest_articles
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestArticlesRequest {
/// Required. The name of the participant to fetch suggestion for.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
pub parent: std::string::String,
/// Optional. The name of the latest conversation message to compile suggestion
/// for. If empty, it will be the latest message of the conversation.
///
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub latest_message: std::string::String,
/// Optional. Max number of messages prior to and including
/// [latest_message][google.cloud.dialogflow.v2.SuggestArticlesRequest.latest_message]
/// to use as context when compiling the suggestion. By default 20 and at
/// most 50.
///
/// [google.cloud.dialogflow.v2.SuggestArticlesRequest.latest_message]: crate::model::SuggestArticlesRequest::latest_message
pub context_size: i32,
/// Parameters for a human assist query.
pub assist_query_params: std::option::Option<crate::model::AssistQueryParameters>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl SuggestArticlesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::SuggestArticlesRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestArticlesRequest;
/// let x = SuggestArticlesRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [latest_message][crate::model::SuggestArticlesRequest::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestArticlesRequest;
/// let x = SuggestArticlesRequest::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [context_size][crate::model::SuggestArticlesRequest::context_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestArticlesRequest;
/// let x = SuggestArticlesRequest::new().set_context_size(42);
/// ```
pub fn set_context_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.context_size = v.into();
self
}
/// Sets the value of [assist_query_params][crate::model::SuggestArticlesRequest::assist_query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestArticlesRequest;
/// use google_cloud_dialogflow_v2::model::AssistQueryParameters;
/// let x = SuggestArticlesRequest::new().set_assist_query_params(AssistQueryParameters::default()/* use setters */);
/// ```
pub fn set_assist_query_params<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AssistQueryParameters>,
{
self.assist_query_params = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [assist_query_params][crate::model::SuggestArticlesRequest::assist_query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestArticlesRequest;
/// use google_cloud_dialogflow_v2::model::AssistQueryParameters;
/// let x = SuggestArticlesRequest::new().set_or_clear_assist_query_params(Some(AssistQueryParameters::default()/* use setters */));
/// let x = SuggestArticlesRequest::new().set_or_clear_assist_query_params(None::<AssistQueryParameters>);
/// ```
pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AssistQueryParameters>,
{
self.assist_query_params = v.map(|x| x.into());
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for SuggestArticlesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestArticlesRequest"
}
}
/// The response message for
/// [Participants.SuggestArticles][google.cloud.dialogflow.v2.Participants.SuggestArticles].
///
/// [google.cloud.dialogflow.v2.Participants.SuggestArticles]: crate::client::Participants::suggest_articles
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestArticlesResponse {
/// Articles ordered by score in descending order.
pub article_answers: std::vec::Vec<crate::model::ArticleAnswer>,
/// The name of the latest conversation message used to compile
/// suggestion for.
///
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub latest_message: std::string::String,
/// Number of messages prior to and including
/// [latest_message][google.cloud.dialogflow.v2.SuggestArticlesResponse.latest_message]
/// to compile the suggestion. It may be smaller than the
/// [SuggestArticlesRequest.context_size][google.cloud.dialogflow.v2.SuggestArticlesRequest.context_size]
/// field in the request if there aren't that many messages in the
/// conversation.
///
/// [google.cloud.dialogflow.v2.SuggestArticlesRequest.context_size]: crate::model::SuggestArticlesRequest::context_size
/// [google.cloud.dialogflow.v2.SuggestArticlesResponse.latest_message]: crate::model::SuggestArticlesResponse::latest_message
pub context_size: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl SuggestArticlesResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [article_answers][crate::model::SuggestArticlesResponse::article_answers].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestArticlesResponse;
/// use google_cloud_dialogflow_v2::model::ArticleAnswer;
/// let x = SuggestArticlesResponse::new()
/// .set_article_answers([
/// ArticleAnswer::default()/* use setters */,
/// ArticleAnswer::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_article_answers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ArticleAnswer>,
{
use std::iter::Iterator;
self.article_answers = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [latest_message][crate::model::SuggestArticlesResponse::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestArticlesResponse;
/// let x = SuggestArticlesResponse::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [context_size][crate::model::SuggestArticlesResponse::context_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestArticlesResponse;
/// let x = SuggestArticlesResponse::new().set_context_size(42);
/// ```
pub fn set_context_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.context_size = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for SuggestArticlesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestArticlesResponse"
}
}
/// The request message for
/// [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers].
///
/// [google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers]: crate::client::Participants::suggest_faq_answers
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestFaqAnswersRequest {
/// Required. The name of the participant to fetch suggestion for.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
pub parent: std::string::String,
/// Optional. The name of the latest conversation message to compile suggestion
/// for. If empty, it will be the latest message of the conversation.
///
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub latest_message: std::string::String,
/// Optional. Max number of messages prior to and including
/// [latest_message] to use as context when compiling the
/// suggestion. By default 20 and at most 50.
pub context_size: i32,
/// Parameters for a human assist query.
pub assist_query_params: std::option::Option<crate::model::AssistQueryParameters>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl SuggestFaqAnswersRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::SuggestFaqAnswersRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestFaqAnswersRequest;
/// let x = SuggestFaqAnswersRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [latest_message][crate::model::SuggestFaqAnswersRequest::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestFaqAnswersRequest;
/// let x = SuggestFaqAnswersRequest::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [context_size][crate::model::SuggestFaqAnswersRequest::context_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestFaqAnswersRequest;
/// let x = SuggestFaqAnswersRequest::new().set_context_size(42);
/// ```
pub fn set_context_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.context_size = v.into();
self
}
/// Sets the value of [assist_query_params][crate::model::SuggestFaqAnswersRequest::assist_query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestFaqAnswersRequest;
/// use google_cloud_dialogflow_v2::model::AssistQueryParameters;
/// let x = SuggestFaqAnswersRequest::new().set_assist_query_params(AssistQueryParameters::default()/* use setters */);
/// ```
pub fn set_assist_query_params<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AssistQueryParameters>,
{
self.assist_query_params = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [assist_query_params][crate::model::SuggestFaqAnswersRequest::assist_query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestFaqAnswersRequest;
/// use google_cloud_dialogflow_v2::model::AssistQueryParameters;
/// let x = SuggestFaqAnswersRequest::new().set_or_clear_assist_query_params(Some(AssistQueryParameters::default()/* use setters */));
/// let x = SuggestFaqAnswersRequest::new().set_or_clear_assist_query_params(None::<AssistQueryParameters>);
/// ```
pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AssistQueryParameters>,
{
self.assist_query_params = v.map(|x| x.into());
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for SuggestFaqAnswersRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestFaqAnswersRequest"
}
}
/// The request message for
/// [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers].
///
/// [google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers]: crate::client::Participants::suggest_faq_answers
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestFaqAnswersResponse {
/// Answers extracted from FAQ documents.
pub faq_answers: std::vec::Vec<crate::model::FaqAnswer>,
/// The name of the latest conversation message used to compile
/// suggestion for.
///
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub latest_message: std::string::String,
/// Number of messages prior to and including
/// [latest_message][google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.latest_message]
/// to compile the suggestion. It may be smaller than the
/// [SuggestFaqAnswersRequest.context_size][google.cloud.dialogflow.v2.SuggestFaqAnswersRequest.context_size]
/// field in the request if there aren't that many messages in the
/// conversation.
///
/// [google.cloud.dialogflow.v2.SuggestFaqAnswersRequest.context_size]: crate::model::SuggestFaqAnswersRequest::context_size
/// [google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.latest_message]: crate::model::SuggestFaqAnswersResponse::latest_message
pub context_size: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl SuggestFaqAnswersResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [faq_answers][crate::model::SuggestFaqAnswersResponse::faq_answers].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestFaqAnswersResponse;
/// use google_cloud_dialogflow_v2::model::FaqAnswer;
/// let x = SuggestFaqAnswersResponse::new()
/// .set_faq_answers([
/// FaqAnswer::default()/* use setters */,
/// FaqAnswer::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_faq_answers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::FaqAnswer>,
{
use std::iter::Iterator;
self.faq_answers = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [latest_message][crate::model::SuggestFaqAnswersResponse::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestFaqAnswersResponse;
/// let x = SuggestFaqAnswersResponse::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [context_size][crate::model::SuggestFaqAnswersResponse::context_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestFaqAnswersResponse;
/// let x = SuggestFaqAnswersResponse::new().set_context_size(42);
/// ```
pub fn set_context_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.context_size = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for SuggestFaqAnswersResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestFaqAnswersResponse"
}
}
/// The response message for
/// [Conversations.GenerateSuggestions][google.cloud.dialogflow.v2.Conversations.GenerateSuggestions].
///
/// [google.cloud.dialogflow.v2.Conversations.GenerateSuggestions]: crate::client::Conversations::generate_suggestions
#[cfg(any(feature = "conversations", feature = "participants",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerateSuggestionsResponse {
/// The answers generated for the conversation based on context.
pub generator_suggestion_answers:
std::vec::Vec<crate::model::generate_suggestions_response::GeneratorSuggestionAnswer>,
/// The name of the latest conversation message used as context for
/// compiling suggestion.
///
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub latest_message: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl GenerateSuggestionsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [generator_suggestion_answers][crate::model::GenerateSuggestionsResponse::generator_suggestion_answers].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateSuggestionsResponse;
/// use google_cloud_dialogflow_v2::model::generate_suggestions_response::GeneratorSuggestionAnswer;
/// let x = GenerateSuggestionsResponse::new()
/// .set_generator_suggestion_answers([
/// GeneratorSuggestionAnswer::default()/* use setters */,
/// GeneratorSuggestionAnswer::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_generator_suggestion_answers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::generate_suggestions_response::GeneratorSuggestionAnswer,
>,
{
use std::iter::Iterator;
self.generator_suggestion_answers = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [latest_message][crate::model::GenerateSuggestionsResponse::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GenerateSuggestionsResponse;
/// let x = GenerateSuggestionsResponse::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl wkt::message::Message for GenerateSuggestionsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GenerateSuggestionsResponse"
}
}
/// Defines additional types related to [GenerateSuggestionsResponse].
#[cfg(any(feature = "conversations", feature = "participants",))]
pub mod generate_suggestions_response {
#[allow(unused_imports)]
use super::*;
/// A GeneratorSuggestion answer.
#[cfg(any(feature = "conversations", feature = "participants",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GeneratorSuggestionAnswer {
/// Suggestion details.
pub generator_suggestion: std::option::Option<crate::model::GeneratorSuggestion>,
/// The name of the generator used to generate this suggestion. Format:
/// `projects/<Project ID>/locations/<Location ID>/generators/<Generator
/// ID>`.
pub source_generator: std::string::String,
/// Answer record that uniquely identifies the suggestion. This can be used
/// to provide suggestion feedback.
pub answer_record: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl GeneratorSuggestionAnswer {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [generator_suggestion][crate::model::generate_suggestions_response::GeneratorSuggestionAnswer::generator_suggestion].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generate_suggestions_response::GeneratorSuggestionAnswer;
/// use google_cloud_dialogflow_v2::model::GeneratorSuggestion;
/// let x = GeneratorSuggestionAnswer::new().set_generator_suggestion(GeneratorSuggestion::default()/* use setters */);
/// ```
pub fn set_generator_suggestion<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::GeneratorSuggestion>,
{
self.generator_suggestion = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [generator_suggestion][crate::model::generate_suggestions_response::GeneratorSuggestionAnswer::generator_suggestion].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generate_suggestions_response::GeneratorSuggestionAnswer;
/// use google_cloud_dialogflow_v2::model::GeneratorSuggestion;
/// let x = GeneratorSuggestionAnswer::new().set_or_clear_generator_suggestion(Some(GeneratorSuggestion::default()/* use setters */));
/// let x = GeneratorSuggestionAnswer::new().set_or_clear_generator_suggestion(None::<GeneratorSuggestion>);
/// ```
pub fn set_or_clear_generator_suggestion<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::GeneratorSuggestion>,
{
self.generator_suggestion = v.map(|x| x.into());
self
}
/// Sets the value of [source_generator][crate::model::generate_suggestions_response::GeneratorSuggestionAnswer::source_generator].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generate_suggestions_response::GeneratorSuggestionAnswer;
/// let x = GeneratorSuggestionAnswer::new().set_source_generator("example");
/// ```
pub fn set_source_generator<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.source_generator = v.into();
self
}
/// Sets the value of [answer_record][crate::model::generate_suggestions_response::GeneratorSuggestionAnswer::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::generate_suggestions_response::GeneratorSuggestionAnswer;
/// let x = GeneratorSuggestionAnswer::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.answer_record = v.into();
self
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl wkt::message::Message for GeneratorSuggestionAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GenerateSuggestionsResponse.GeneratorSuggestionAnswer"
}
}
}
/// The request message for
/// [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2.Participants.SuggestSmartReplies].
///
/// [google.cloud.dialogflow.v2.Participants.SuggestSmartReplies]: crate::client::Participants::suggest_smart_replies
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestSmartRepliesRequest {
/// Required. The name of the participant to fetch suggestion for.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
pub parent: std::string::String,
/// The current natural language text segment to compile suggestion
/// for. This provides a way for user to get follow up smart reply suggestion
/// after a smart reply selection, without sending a text message.
pub current_text_input: std::option::Option<crate::model::TextInput>,
/// The name of the latest conversation message to compile suggestion
/// for. If empty, it will be the latest message of the conversation.
///
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub latest_message: std::string::String,
/// Max number of messages prior to and including
/// [latest_message] to use as context when compiling the
/// suggestion. By default 20 and at most 50.
pub context_size: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl SuggestSmartRepliesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::SuggestSmartRepliesRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestSmartRepliesRequest;
/// let x = SuggestSmartRepliesRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [current_text_input][crate::model::SuggestSmartRepliesRequest::current_text_input].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestSmartRepliesRequest;
/// use google_cloud_dialogflow_v2::model::TextInput;
/// let x = SuggestSmartRepliesRequest::new().set_current_text_input(TextInput::default()/* use setters */);
/// ```
pub fn set_current_text_input<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TextInput>,
{
self.current_text_input = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [current_text_input][crate::model::SuggestSmartRepliesRequest::current_text_input].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestSmartRepliesRequest;
/// use google_cloud_dialogflow_v2::model::TextInput;
/// let x = SuggestSmartRepliesRequest::new().set_or_clear_current_text_input(Some(TextInput::default()/* use setters */));
/// let x = SuggestSmartRepliesRequest::new().set_or_clear_current_text_input(None::<TextInput>);
/// ```
pub fn set_or_clear_current_text_input<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TextInput>,
{
self.current_text_input = v.map(|x| x.into());
self
}
/// Sets the value of [latest_message][crate::model::SuggestSmartRepliesRequest::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestSmartRepliesRequest;
/// let x = SuggestSmartRepliesRequest::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [context_size][crate::model::SuggestSmartRepliesRequest::context_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestSmartRepliesRequest;
/// let x = SuggestSmartRepliesRequest::new().set_context_size(42);
/// ```
pub fn set_context_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.context_size = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for SuggestSmartRepliesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestSmartRepliesRequest"
}
}
/// The response message for
/// [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2.Participants.SuggestSmartReplies].
///
/// [google.cloud.dialogflow.v2.Participants.SuggestSmartReplies]: crate::client::Participants::suggest_smart_replies
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestSmartRepliesResponse {
/// Output only. Multiple reply options provided by smart reply service. The
/// order is based on the rank of the model prediction.
/// The maximum number of the returned replies is set in SmartReplyConfig.
pub smart_reply_answers: std::vec::Vec<crate::model::SmartReplyAnswer>,
/// The name of the latest conversation message used to compile
/// suggestion for.
///
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub latest_message: std::string::String,
/// Number of messages prior to and including
/// [latest_message][google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.latest_message]
/// to compile the suggestion. It may be smaller than the
/// [SuggestSmartRepliesRequest.context_size][google.cloud.dialogflow.v2.SuggestSmartRepliesRequest.context_size]
/// field in the request if there aren't that many messages in the
/// conversation.
///
/// [google.cloud.dialogflow.v2.SuggestSmartRepliesRequest.context_size]: crate::model::SuggestSmartRepliesRequest::context_size
/// [google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.latest_message]: crate::model::SuggestSmartRepliesResponse::latest_message
pub context_size: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl SuggestSmartRepliesResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [smart_reply_answers][crate::model::SuggestSmartRepliesResponse::smart_reply_answers].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestSmartRepliesResponse;
/// use google_cloud_dialogflow_v2::model::SmartReplyAnswer;
/// let x = SuggestSmartRepliesResponse::new()
/// .set_smart_reply_answers([
/// SmartReplyAnswer::default()/* use setters */,
/// SmartReplyAnswer::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_smart_reply_answers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SmartReplyAnswer>,
{
use std::iter::Iterator;
self.smart_reply_answers = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [latest_message][crate::model::SuggestSmartRepliesResponse::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestSmartRepliesResponse;
/// let x = SuggestSmartRepliesResponse::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [context_size][crate::model::SuggestSmartRepliesResponse::context_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestSmartRepliesResponse;
/// let x = SuggestSmartRepliesResponse::new().set_context_size(42);
/// ```
pub fn set_context_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.context_size = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for SuggestSmartRepliesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestSmartRepliesResponse"
}
}
/// Represents the natural language speech audio to be processed.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AudioInput {
/// Required. Instructs the speech recognizer how to process the speech audio.
pub config: std::option::Option<crate::model::InputAudioConfig>,
/// Required. The natural language speech audio to be processed.
/// A single request can contain up to 2 minutes of speech audio data.
/// The transcribed text cannot contain more than 256 bytes for virtual agent
/// interactions.
pub audio: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl AudioInput {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [config][crate::model::AudioInput::config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AudioInput;
/// use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = AudioInput::new().set_config(InputAudioConfig::default()/* use setters */);
/// ```
pub fn set_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::InputAudioConfig>,
{
self.config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [config][crate::model::AudioInput::config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AudioInput;
/// use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = AudioInput::new().set_or_clear_config(Some(InputAudioConfig::default()/* use setters */));
/// let x = AudioInput::new().set_or_clear_config(None::<InputAudioConfig>);
/// ```
pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::InputAudioConfig>,
{
self.config = v.map(|x| x.into());
self
}
/// Sets the value of [audio][crate::model::AudioInput::audio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AudioInput;
/// let x = AudioInput::new().set_audio(bytes::Bytes::from_static(b"example"));
/// ```
pub fn set_audio<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.audio = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for AudioInput {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AudioInput"
}
}
/// Represents the natural language speech audio to be played to the end user.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OutputAudio {
/// Instructs the speech synthesizer how to generate the speech
/// audio.
pub config: std::option::Option<crate::model::OutputAudioConfig>,
/// The natural language speech audio.
pub audio: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl OutputAudio {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [config][crate::model::OutputAudio::config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::OutputAudio;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = OutputAudio::new().set_config(OutputAudioConfig::default()/* use setters */);
/// ```
pub fn set_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [config][crate::model::OutputAudio::config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::OutputAudio;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = OutputAudio::new().set_or_clear_config(Some(OutputAudioConfig::default()/* use setters */));
/// let x = OutputAudio::new().set_or_clear_config(None::<OutputAudioConfig>);
/// ```
pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.config = v.map(|x| x.into());
self
}
/// Sets the value of [audio][crate::model::OutputAudio::audio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::OutputAudio;
/// let x = OutputAudio::new().set_audio(bytes::Bytes::from_static(b"example"));
/// ```
pub fn set_audio<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.audio = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for OutputAudio {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.OutputAudio"
}
}
/// Represents a response from an automated agent.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AutomatedAgentReply {
/// Response of the Dialogflow
/// [Sessions.DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent]
/// call.
///
/// [google.cloud.dialogflow.v2.Sessions.DetectIntent]: crate::client::Sessions::detect_intent
pub detect_intent_response: std::option::Option<crate::model::DetectIntentResponse>,
/// AutomatedAgentReply type.
pub automated_agent_reply_type: crate::model::automated_agent_reply::AutomatedAgentReplyType,
/// Indicates whether the partial automated agent reply is interruptible when a
/// later reply message arrives. e.g. if the agent specified some music as
/// partial response, it can be cancelled.
pub allow_cancellation: bool,
/// The unique identifier of the current Dialogflow CX conversation page.
/// Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
/// ID>/flows/<Flow ID>/pages/<Page ID>`.
pub cx_current_page: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl AutomatedAgentReply {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [detect_intent_response][crate::model::AutomatedAgentReply::detect_intent_response].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AutomatedAgentReply;
/// use google_cloud_dialogflow_v2::model::DetectIntentResponse;
/// let x = AutomatedAgentReply::new().set_detect_intent_response(DetectIntentResponse::default()/* use setters */);
/// ```
pub fn set_detect_intent_response<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DetectIntentResponse>,
{
self.detect_intent_response = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [detect_intent_response][crate::model::AutomatedAgentReply::detect_intent_response].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AutomatedAgentReply;
/// use google_cloud_dialogflow_v2::model::DetectIntentResponse;
/// let x = AutomatedAgentReply::new().set_or_clear_detect_intent_response(Some(DetectIntentResponse::default()/* use setters */));
/// let x = AutomatedAgentReply::new().set_or_clear_detect_intent_response(None::<DetectIntentResponse>);
/// ```
pub fn set_or_clear_detect_intent_response<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DetectIntentResponse>,
{
self.detect_intent_response = v.map(|x| x.into());
self
}
/// Sets the value of [automated_agent_reply_type][crate::model::AutomatedAgentReply::automated_agent_reply_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AutomatedAgentReply;
/// use google_cloud_dialogflow_v2::model::automated_agent_reply::AutomatedAgentReplyType;
/// let x0 = AutomatedAgentReply::new().set_automated_agent_reply_type(AutomatedAgentReplyType::Partial);
/// let x1 = AutomatedAgentReply::new().set_automated_agent_reply_type(AutomatedAgentReplyType::Final);
/// ```
pub fn set_automated_agent_reply_type<
T: std::convert::Into<crate::model::automated_agent_reply::AutomatedAgentReplyType>,
>(
mut self,
v: T,
) -> Self {
self.automated_agent_reply_type = v.into();
self
}
/// Sets the value of [allow_cancellation][crate::model::AutomatedAgentReply::allow_cancellation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AutomatedAgentReply;
/// let x = AutomatedAgentReply::new().set_allow_cancellation(true);
/// ```
pub fn set_allow_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.allow_cancellation = v.into();
self
}
/// Sets the value of [cx_current_page][crate::model::AutomatedAgentReply::cx_current_page].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AutomatedAgentReply;
/// let x = AutomatedAgentReply::new().set_cx_current_page("example");
/// ```
pub fn set_cx_current_page<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.cx_current_page = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for AutomatedAgentReply {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AutomatedAgentReply"
}
}
/// Defines additional types related to [AutomatedAgentReply].
#[cfg(feature = "participants")]
pub mod automated_agent_reply {
#[allow(unused_imports)]
use super::*;
/// Represents different automated agent reply types.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "participants")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AutomatedAgentReplyType {
/// Not specified. This should never happen.
Unspecified,
/// Partial reply. e.g. Aggregated responses in a `Fulfillment` that enables
/// `return_partial_response` can be returned as partial reply.
/// WARNING: partial reply is not eligible for barge-in.
Partial,
/// Final reply.
Final,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [AutomatedAgentReplyType::value] or
/// [AutomatedAgentReplyType::name].
UnknownValue(automated_agent_reply_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "participants")]
pub mod automated_agent_reply_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "participants")]
impl AutomatedAgentReplyType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Partial => std::option::Option::Some(1),
Self::Final => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED")
}
Self::Partial => std::option::Option::Some("PARTIAL"),
Self::Final => std::option::Option::Some("FINAL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "participants")]
impl std::default::Default for AutomatedAgentReplyType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "participants")]
impl std::fmt::Display for AutomatedAgentReplyType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "participants")]
impl std::convert::From<i32> for AutomatedAgentReplyType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Partial,
2 => Self::Final,
_ => Self::UnknownValue(automated_agent_reply_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "participants")]
impl std::convert::From<&str> for AutomatedAgentReplyType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED" => Self::Unspecified,
"PARTIAL" => Self::Partial,
"FINAL" => Self::Final,
_ => Self::UnknownValue(automated_agent_reply_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "participants")]
impl serde::ser::Serialize for AutomatedAgentReplyType {
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::Partial => serializer.serialize_i32(1),
Self::Final => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "participants")]
impl<'de> serde::de::Deserialize<'de> for AutomatedAgentReplyType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(
wkt::internal::EnumVisitor::<AutomatedAgentReplyType>::new(
".google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType",
),
)
}
}
}
/// Represents article answer.
#[cfg(any(feature = "answer-records", feature = "participants",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ArticleAnswer {
/// The article title.
pub title: std::string::String,
/// The article URI.
pub uri: std::string::String,
/// Article snippets.
pub snippets: std::vec::Vec<std::string::String>,
/// Article match confidence.
/// The system's confidence score that this article is a good match for this
/// conversation, as a value from 0.0 (completely uncertain) to 1.0
/// (completely certain).
pub confidence: f32,
/// A map that contains metadata about the answer and the
/// document from which it originates.
pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
/// The name of answer record, in the format of
/// "projects/\<Project ID\>/locations/\<Location ID\>/answerRecords/\<Answer Record
/// ID\>"
pub answer_record: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "answer-records", feature = "participants",))]
impl ArticleAnswer {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [title][crate::model::ArticleAnswer::title].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ArticleAnswer;
/// let x = ArticleAnswer::new().set_title("example");
/// ```
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = v.into();
self
}
/// Sets the value of [uri][crate::model::ArticleAnswer::uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ArticleAnswer;
/// let x = ArticleAnswer::new().set_uri("example");
/// ```
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
/// Sets the value of [snippets][crate::model::ArticleAnswer::snippets].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ArticleAnswer;
/// let x = ArticleAnswer::new().set_snippets(["a", "b", "c"]);
/// ```
pub fn set_snippets<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.snippets = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [confidence][crate::model::ArticleAnswer::confidence].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ArticleAnswer;
/// let x = ArticleAnswer::new().set_confidence(42.0);
/// ```
pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.confidence = v.into();
self
}
/// Sets the value of [metadata][crate::model::ArticleAnswer::metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ArticleAnswer;
/// let x = ArticleAnswer::new().set_metadata([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
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<std::string::String>,
{
use std::iter::Iterator;
self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [answer_record][crate::model::ArticleAnswer::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ArticleAnswer;
/// let x = ArticleAnswer::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.answer_record = v.into();
self
}
}
#[cfg(any(feature = "answer-records", feature = "participants",))]
impl wkt::message::Message for ArticleAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ArticleAnswer"
}
}
/// Represents answer from "frequently asked questions".
#[cfg(any(feature = "answer-records", feature = "participants",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FaqAnswer {
/// The piece of text from the `source` knowledge base document.
pub answer: std::string::String,
/// The system's confidence score that this Knowledge answer is a good match
/// for this conversational query, range from 0.0 (completely uncertain)
/// to 1.0 (completely certain).
pub confidence: f32,
/// The corresponding FAQ question.
pub question: std::string::String,
/// Indicates which Knowledge Document this answer was extracted
/// from.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/agent/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
pub source: std::string::String,
/// A map that contains metadata about the answer and the
/// document from which it originates.
pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
/// The name of answer record, in the format of
/// "projects/\<Project ID\>/locations/\<Location ID\>/answerRecords/\<Answer Record
/// ID\>"
pub answer_record: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "answer-records", feature = "participants",))]
impl FaqAnswer {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer][crate::model::FaqAnswer::answer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FaqAnswer;
/// let x = FaqAnswer::new().set_answer("example");
/// ```
pub fn set_answer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.answer = v.into();
self
}
/// Sets the value of [confidence][crate::model::FaqAnswer::confidence].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FaqAnswer;
/// let x = FaqAnswer::new().set_confidence(42.0);
/// ```
pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.confidence = v.into();
self
}
/// Sets the value of [question][crate::model::FaqAnswer::question].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FaqAnswer;
/// let x = FaqAnswer::new().set_question("example");
/// ```
pub fn set_question<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.question = v.into();
self
}
/// Sets the value of [source][crate::model::FaqAnswer::source].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FaqAnswer;
/// let x = FaqAnswer::new().set_source("example");
/// ```
pub fn set_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source = v.into();
self
}
/// Sets the value of [metadata][crate::model::FaqAnswer::metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FaqAnswer;
/// let x = FaqAnswer::new().set_metadata([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
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<std::string::String>,
{
use std::iter::Iterator;
self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [answer_record][crate::model::FaqAnswer::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::FaqAnswer;
/// let x = FaqAnswer::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.answer_record = v.into();
self
}
}
#[cfg(any(feature = "answer-records", feature = "participants",))]
impl wkt::message::Message for FaqAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.FaqAnswer"
}
}
/// Represents a smart reply answer.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SmartReplyAnswer {
/// The content of the reply.
pub reply: std::string::String,
/// Smart reply confidence.
/// The system's confidence score that this reply is a good match for
/// this conversation, as a value from 0.0 (completely uncertain) to 1.0
/// (completely certain).
pub confidence: f32,
/// The name of answer record, in the format of
/// "projects/\<Project ID\>/locations/\<Location ID\>/answerRecords/\<Answer Record
/// ID\>"
pub answer_record: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl SmartReplyAnswer {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [reply][crate::model::SmartReplyAnswer::reply].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SmartReplyAnswer;
/// let x = SmartReplyAnswer::new().set_reply("example");
/// ```
pub fn set_reply<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.reply = v.into();
self
}
/// Sets the value of [confidence][crate::model::SmartReplyAnswer::confidence].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SmartReplyAnswer;
/// let x = SmartReplyAnswer::new().set_confidence(42.0);
/// ```
pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.confidence = v.into();
self
}
/// Sets the value of [answer_record][crate::model::SmartReplyAnswer::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SmartReplyAnswer;
/// let x = SmartReplyAnswer::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.answer_record = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for SmartReplyAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SmartReplyAnswer"
}
}
/// Represents an intent suggestion.
#[cfg(feature = "answer-records")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IntentSuggestion {
/// The display name of the intent.
pub display_name: std::string::String,
/// Human readable description for better understanding an intent like its
/// scope, content, result etc. Maximum character limit: 140 characters.
pub description: std::string::String,
/// The name of the intent.
pub intent: std::option::Option<crate::model::intent_suggestion::Intent>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "answer-records")]
impl IntentSuggestion {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [display_name][crate::model::IntentSuggestion::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::IntentSuggestion;
/// let x = IntentSuggestion::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [description][crate::model::IntentSuggestion::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::IntentSuggestion;
/// let x = IntentSuggestion::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
/// Sets the value of [intent][crate::model::IntentSuggestion::intent].
///
/// Note that all the setters affecting `intent` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::IntentSuggestion;
/// use google_cloud_dialogflow_v2::model::intent_suggestion::Intent;
/// let x = IntentSuggestion::new().set_intent(Some(Intent::IntentV2("example".to_string())));
/// ```
pub fn set_intent<
T: std::convert::Into<std::option::Option<crate::model::intent_suggestion::Intent>>,
>(
mut self,
v: T,
) -> Self {
self.intent = v.into();
self
}
/// The value of [intent][crate::model::IntentSuggestion::intent]
/// if it holds a `IntentV2`, `None` if the field is not set or
/// holds a different branch.
pub fn intent_v2(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.intent.as_ref().and_then(|v| match v {
crate::model::intent_suggestion::Intent::IntentV2(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [intent][crate::model::IntentSuggestion::intent]
/// to hold a `IntentV2`.
///
/// Note that all the setters affecting `intent` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::IntentSuggestion;
/// let x = IntentSuggestion::new().set_intent_v2("example");
/// assert!(x.intent_v2().is_some());
/// ```
pub fn set_intent_v2<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.intent =
std::option::Option::Some(crate::model::intent_suggestion::Intent::IntentV2(v.into()));
self
}
}
#[cfg(feature = "answer-records")]
impl wkt::message::Message for IntentSuggestion {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.IntentSuggestion"
}
}
/// Defines additional types related to [IntentSuggestion].
#[cfg(feature = "answer-records")]
pub mod intent_suggestion {
#[allow(unused_imports)]
use super::*;
/// The name of the intent.
#[cfg(feature = "answer-records")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Intent {
/// The unique identifier of this
/// [intent][google.cloud.dialogflow.v2.Intent]. Format: `projects/<Project
/// ID>/locations/<Location ID>/agent/intents/<Intent ID>`.
///
/// [google.cloud.dialogflow.v2.Intent]: crate::model::Intent
IntentV2(std::string::String),
}
}
/// Represents a Dialogflow assist answer.
#[cfg(feature = "answer-records")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DialogflowAssistAnswer {
/// The name of answer record, in the format of
/// "projects/\<Project ID\>/locations/\<Location ID\>/answerRecords/\<Answer Record
/// ID\>"
pub answer_record: std::string::String,
/// Result from DetectIntent for one matched intent.
pub result: std::option::Option<crate::model::dialogflow_assist_answer::Result>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "answer-records")]
impl DialogflowAssistAnswer {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer_record][crate::model::DialogflowAssistAnswer::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DialogflowAssistAnswer;
/// let x = DialogflowAssistAnswer::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.answer_record = v.into();
self
}
/// Sets the value of [result][crate::model::DialogflowAssistAnswer::result].
///
/// Note that all the setters affecting `result` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DialogflowAssistAnswer;
/// use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = DialogflowAssistAnswer::new().set_result(Some(
/// google_cloud_dialogflow_v2::model::dialogflow_assist_answer::Result::QueryResult(QueryResult::default().into())));
/// ```
pub fn set_result<
T: std::convert::Into<std::option::Option<crate::model::dialogflow_assist_answer::Result>>,
>(
mut self,
v: T,
) -> Self {
self.result = v.into();
self
}
/// The value of [result][crate::model::DialogflowAssistAnswer::result]
/// if it holds a `QueryResult`, `None` if the field is not set or
/// holds a different branch.
pub fn query_result(&self) -> std::option::Option<&std::boxed::Box<crate::model::QueryResult>> {
#[allow(unreachable_patterns)]
self.result.as_ref().and_then(|v| match v {
crate::model::dialogflow_assist_answer::Result::QueryResult(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [result][crate::model::DialogflowAssistAnswer::result]
/// to hold a `QueryResult`.
///
/// Note that all the setters affecting `result` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DialogflowAssistAnswer;
/// use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = DialogflowAssistAnswer::new().set_query_result(QueryResult::default()/* use setters */);
/// assert!(x.query_result().is_some());
/// assert!(x.intent_suggestion().is_none());
/// ```
pub fn set_query_result<T: std::convert::Into<std::boxed::Box<crate::model::QueryResult>>>(
mut self,
v: T,
) -> Self {
self.result = std::option::Option::Some(
crate::model::dialogflow_assist_answer::Result::QueryResult(v.into()),
);
self
}
/// The value of [result][crate::model::DialogflowAssistAnswer::result]
/// if it holds a `IntentSuggestion`, `None` if the field is not set or
/// holds a different branch.
pub fn intent_suggestion(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::IntentSuggestion>> {
#[allow(unreachable_patterns)]
self.result.as_ref().and_then(|v| match v {
crate::model::dialogflow_assist_answer::Result::IntentSuggestion(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [result][crate::model::DialogflowAssistAnswer::result]
/// to hold a `IntentSuggestion`.
///
/// Note that all the setters affecting `result` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DialogflowAssistAnswer;
/// use google_cloud_dialogflow_v2::model::IntentSuggestion;
/// let x = DialogflowAssistAnswer::new().set_intent_suggestion(IntentSuggestion::default()/* use setters */);
/// assert!(x.intent_suggestion().is_some());
/// assert!(x.query_result().is_none());
/// ```
pub fn set_intent_suggestion<
T: std::convert::Into<std::boxed::Box<crate::model::IntentSuggestion>>,
>(
mut self,
v: T,
) -> Self {
self.result = std::option::Option::Some(
crate::model::dialogflow_assist_answer::Result::IntentSuggestion(v.into()),
);
self
}
}
#[cfg(feature = "answer-records")]
impl wkt::message::Message for DialogflowAssistAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DialogflowAssistAnswer"
}
}
/// Defines additional types related to [DialogflowAssistAnswer].
#[cfg(feature = "answer-records")]
pub mod dialogflow_assist_answer {
#[allow(unused_imports)]
use super::*;
/// Result from DetectIntent for one matched intent.
#[cfg(feature = "answer-records")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Result {
/// Result from v2 agent.
QueryResult(std::boxed::Box<crate::model::QueryResult>),
/// An intent suggestion generated from conversation.
IntentSuggestion(std::boxed::Box<crate::model::IntentSuggestion>),
}
}
/// One response of different type of suggestion response which is used in
/// the response of
/// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]
/// and
/// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent],
/// as well as
/// [HumanAgentAssistantEvent][google.cloud.dialogflow.v2.HumanAgentAssistantEvent].
///
/// [google.cloud.dialogflow.v2.HumanAgentAssistantEvent]: crate::model::HumanAgentAssistantEvent
/// [google.cloud.dialogflow.v2.Participants.AnalyzeContent]: crate::client::Participants::analyze_content
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestionResult {
/// Different type of suggestion response.
pub suggestion_response:
std::option::Option<crate::model::suggestion_result::SuggestionResponse>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl SuggestionResult {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [suggestion_response][crate::model::SuggestionResult::suggestion_response].
///
/// Note that all the setters affecting `suggestion_response` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionResult;
/// use google_cloud_rpc::model::Status;
/// let x = SuggestionResult::new().set_suggestion_response(Some(
/// google_cloud_dialogflow_v2::model::suggestion_result::SuggestionResponse::Error(Status::default().into())));
/// ```
pub fn set_suggestion_response<
T: std::convert::Into<
std::option::Option<crate::model::suggestion_result::SuggestionResponse>,
>,
>(
mut self,
v: T,
) -> Self {
self.suggestion_response = v.into();
self
}
/// The value of [suggestion_response][crate::model::SuggestionResult::suggestion_response]
/// if it holds a `Error`, `None` if the field is not set or
/// holds a different branch.
pub fn error(&self) -> std::option::Option<&std::boxed::Box<google_cloud_rpc::model::Status>> {
#[allow(unreachable_patterns)]
self.suggestion_response.as_ref().and_then(|v| match v {
crate::model::suggestion_result::SuggestionResponse::Error(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [suggestion_response][crate::model::SuggestionResult::suggestion_response]
/// to hold a `Error`.
///
/// Note that all the setters affecting `suggestion_response` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionResult;
/// use google_cloud_rpc::model::Status;
/// let x = SuggestionResult::new().set_error(Status::default()/* use setters */);
/// assert!(x.error().is_some());
/// assert!(x.suggest_articles_response().is_none());
/// assert!(x.suggest_knowledge_assist_response().is_none());
/// assert!(x.suggest_faq_answers_response().is_none());
/// assert!(x.suggest_smart_replies_response().is_none());
/// assert!(x.generate_suggestions_response().is_none());
/// ```
pub fn set_error<T: std::convert::Into<std::boxed::Box<google_cloud_rpc::model::Status>>>(
mut self,
v: T,
) -> Self {
self.suggestion_response = std::option::Option::Some(
crate::model::suggestion_result::SuggestionResponse::Error(v.into()),
);
self
}
/// The value of [suggestion_response][crate::model::SuggestionResult::suggestion_response]
/// if it holds a `SuggestArticlesResponse`, `None` if the field is not set or
/// holds a different branch.
pub fn suggest_articles_response(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SuggestArticlesResponse>> {
#[allow(unreachable_patterns)]
self.suggestion_response.as_ref().and_then(|v| match v {
crate::model::suggestion_result::SuggestionResponse::SuggestArticlesResponse(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [suggestion_response][crate::model::SuggestionResult::suggestion_response]
/// to hold a `SuggestArticlesResponse`.
///
/// Note that all the setters affecting `suggestion_response` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionResult;
/// use google_cloud_dialogflow_v2::model::SuggestArticlesResponse;
/// let x = SuggestionResult::new().set_suggest_articles_response(SuggestArticlesResponse::default()/* use setters */);
/// assert!(x.suggest_articles_response().is_some());
/// assert!(x.error().is_none());
/// assert!(x.suggest_knowledge_assist_response().is_none());
/// assert!(x.suggest_faq_answers_response().is_none());
/// assert!(x.suggest_smart_replies_response().is_none());
/// assert!(x.generate_suggestions_response().is_none());
/// ```
pub fn set_suggest_articles_response<
T: std::convert::Into<std::boxed::Box<crate::model::SuggestArticlesResponse>>,
>(
mut self,
v: T,
) -> Self {
self.suggestion_response = std::option::Option::Some(
crate::model::suggestion_result::SuggestionResponse::SuggestArticlesResponse(v.into()),
);
self
}
/// The value of [suggestion_response][crate::model::SuggestionResult::suggestion_response]
/// if it holds a `SuggestKnowledgeAssistResponse`, `None` if the field is not set or
/// holds a different branch.
pub fn suggest_knowledge_assist_response(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SuggestKnowledgeAssistResponse>> {
#[allow(unreachable_patterns)]
self.suggestion_response.as_ref().and_then(|v| match v {
crate::model::suggestion_result::SuggestionResponse::SuggestKnowledgeAssistResponse(
v,
) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [suggestion_response][crate::model::SuggestionResult::suggestion_response]
/// to hold a `SuggestKnowledgeAssistResponse`.
///
/// Note that all the setters affecting `suggestion_response` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionResult;
/// use google_cloud_dialogflow_v2::model::SuggestKnowledgeAssistResponse;
/// let x = SuggestionResult::new().set_suggest_knowledge_assist_response(SuggestKnowledgeAssistResponse::default()/* use setters */);
/// assert!(x.suggest_knowledge_assist_response().is_some());
/// assert!(x.error().is_none());
/// assert!(x.suggest_articles_response().is_none());
/// assert!(x.suggest_faq_answers_response().is_none());
/// assert!(x.suggest_smart_replies_response().is_none());
/// assert!(x.generate_suggestions_response().is_none());
/// ```
pub fn set_suggest_knowledge_assist_response<
T: std::convert::Into<std::boxed::Box<crate::model::SuggestKnowledgeAssistResponse>>,
>(
mut self,
v: T,
) -> Self {
self.suggestion_response = std::option::Option::Some(
crate::model::suggestion_result::SuggestionResponse::SuggestKnowledgeAssistResponse(
v.into(),
),
);
self
}
/// The value of [suggestion_response][crate::model::SuggestionResult::suggestion_response]
/// if it holds a `SuggestFaqAnswersResponse`, `None` if the field is not set or
/// holds a different branch.
pub fn suggest_faq_answers_response(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SuggestFaqAnswersResponse>> {
#[allow(unreachable_patterns)]
self.suggestion_response.as_ref().and_then(|v| match v {
crate::model::suggestion_result::SuggestionResponse::SuggestFaqAnswersResponse(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [suggestion_response][crate::model::SuggestionResult::suggestion_response]
/// to hold a `SuggestFaqAnswersResponse`.
///
/// Note that all the setters affecting `suggestion_response` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionResult;
/// use google_cloud_dialogflow_v2::model::SuggestFaqAnswersResponse;
/// let x = SuggestionResult::new().set_suggest_faq_answers_response(SuggestFaqAnswersResponse::default()/* use setters */);
/// assert!(x.suggest_faq_answers_response().is_some());
/// assert!(x.error().is_none());
/// assert!(x.suggest_articles_response().is_none());
/// assert!(x.suggest_knowledge_assist_response().is_none());
/// assert!(x.suggest_smart_replies_response().is_none());
/// assert!(x.generate_suggestions_response().is_none());
/// ```
pub fn set_suggest_faq_answers_response<
T: std::convert::Into<std::boxed::Box<crate::model::SuggestFaqAnswersResponse>>,
>(
mut self,
v: T,
) -> Self {
self.suggestion_response = std::option::Option::Some(
crate::model::suggestion_result::SuggestionResponse::SuggestFaqAnswersResponse(
v.into(),
),
);
self
}
/// The value of [suggestion_response][crate::model::SuggestionResult::suggestion_response]
/// if it holds a `SuggestSmartRepliesResponse`, `None` if the field is not set or
/// holds a different branch.
pub fn suggest_smart_replies_response(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::SuggestSmartRepliesResponse>> {
#[allow(unreachable_patterns)]
self.suggestion_response.as_ref().and_then(|v| match v {
crate::model::suggestion_result::SuggestionResponse::SuggestSmartRepliesResponse(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [suggestion_response][crate::model::SuggestionResult::suggestion_response]
/// to hold a `SuggestSmartRepliesResponse`.
///
/// Note that all the setters affecting `suggestion_response` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionResult;
/// use google_cloud_dialogflow_v2::model::SuggestSmartRepliesResponse;
/// let x = SuggestionResult::new().set_suggest_smart_replies_response(SuggestSmartRepliesResponse::default()/* use setters */);
/// assert!(x.suggest_smart_replies_response().is_some());
/// assert!(x.error().is_none());
/// assert!(x.suggest_articles_response().is_none());
/// assert!(x.suggest_knowledge_assist_response().is_none());
/// assert!(x.suggest_faq_answers_response().is_none());
/// assert!(x.generate_suggestions_response().is_none());
/// ```
pub fn set_suggest_smart_replies_response<
T: std::convert::Into<std::boxed::Box<crate::model::SuggestSmartRepliesResponse>>,
>(
mut self,
v: T,
) -> Self {
self.suggestion_response = std::option::Option::Some(
crate::model::suggestion_result::SuggestionResponse::SuggestSmartRepliesResponse(
v.into(),
),
);
self
}
/// The value of [suggestion_response][crate::model::SuggestionResult::suggestion_response]
/// if it holds a `GenerateSuggestionsResponse`, `None` if the field is not set or
/// holds a different branch.
pub fn generate_suggestions_response(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::GenerateSuggestionsResponse>> {
#[allow(unreachable_patterns)]
self.suggestion_response.as_ref().and_then(|v| match v {
crate::model::suggestion_result::SuggestionResponse::GenerateSuggestionsResponse(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [suggestion_response][crate::model::SuggestionResult::suggestion_response]
/// to hold a `GenerateSuggestionsResponse`.
///
/// Note that all the setters affecting `suggestion_response` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionResult;
/// use google_cloud_dialogflow_v2::model::GenerateSuggestionsResponse;
/// let x = SuggestionResult::new().set_generate_suggestions_response(GenerateSuggestionsResponse::default()/* use setters */);
/// assert!(x.generate_suggestions_response().is_some());
/// assert!(x.error().is_none());
/// assert!(x.suggest_articles_response().is_none());
/// assert!(x.suggest_knowledge_assist_response().is_none());
/// assert!(x.suggest_faq_answers_response().is_none());
/// assert!(x.suggest_smart_replies_response().is_none());
/// ```
pub fn set_generate_suggestions_response<
T: std::convert::Into<std::boxed::Box<crate::model::GenerateSuggestionsResponse>>,
>(
mut self,
v: T,
) -> Self {
self.suggestion_response = std::option::Option::Some(
crate::model::suggestion_result::SuggestionResponse::GenerateSuggestionsResponse(
v.into(),
),
);
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for SuggestionResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestionResult"
}
}
/// Defines additional types related to [SuggestionResult].
#[cfg(feature = "participants")]
pub mod suggestion_result {
#[allow(unused_imports)]
use super::*;
/// Different type of suggestion response.
#[cfg(feature = "participants")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SuggestionResponse {
/// Error status if the request failed.
Error(std::boxed::Box<google_cloud_rpc::model::Status>),
/// SuggestArticlesResponse if request is for ARTICLE_SUGGESTION.
SuggestArticlesResponse(std::boxed::Box<crate::model::SuggestArticlesResponse>),
/// SuggestKnowledgeAssistResponse if request is for KNOWLEDGE_ASSIST.
SuggestKnowledgeAssistResponse(
std::boxed::Box<crate::model::SuggestKnowledgeAssistResponse>,
),
/// SuggestFaqAnswersResponse if request is for FAQ_ANSWER.
SuggestFaqAnswersResponse(std::boxed::Box<crate::model::SuggestFaqAnswersResponse>),
/// SuggestSmartRepliesResponse if request is for SMART_REPLY.
SuggestSmartRepliesResponse(std::boxed::Box<crate::model::SuggestSmartRepliesResponse>),
/// Suggestions generated using generators triggered by customer or agent
/// messages.
GenerateSuggestionsResponse(std::boxed::Box<crate::model::GenerateSuggestionsResponse>),
}
}
/// Defines the language used in the input text.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InputTextConfig {
/// Required. The language of this conversational query. See [Language
/// Support](https://cloud.google.com/dialogflow/docs/reference/language)
/// for a list of the currently supported language codes.
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl InputTextConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [language_code][crate::model::InputTextConfig::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::InputTextConfig;
/// let x = InputTextConfig::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for InputTextConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.InputTextConfig"
}
}
/// Represents a part of a message possibly annotated with an entity. The part
/// can be an entity or purely a part of the message between two entities or
/// message start/end.
#[cfg(any(feature = "conversations", feature = "participants",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AnnotatedMessagePart {
/// A part of a message possibly annotated with an entity.
pub text: std::string::String,
/// The [Dialogflow system entity
/// type](https://cloud.google.com/dialogflow/docs/reference/system-entities)
/// of this message part. If this is empty, Dialogflow could not annotate the
/// phrase part with a system entity.
pub entity_type: std::string::String,
/// The [Dialogflow system entity formatted value
/// ](https://cloud.google.com/dialogflow/docs/reference/system-entities) of
/// this message part. For example for a system entity of type
/// `@sys.unit-currency`, this may contain:
pub formatted_value: std::option::Option<wkt::Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl AnnotatedMessagePart {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [text][crate::model::AnnotatedMessagePart::text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnnotatedMessagePart;
/// let x = AnnotatedMessagePart::new().set_text("example");
/// ```
pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.text = v.into();
self
}
/// Sets the value of [entity_type][crate::model::AnnotatedMessagePart::entity_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnnotatedMessagePart;
/// let x = AnnotatedMessagePart::new().set_entity_type("example");
/// ```
pub fn set_entity_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.entity_type = v.into();
self
}
/// Sets the value of [formatted_value][crate::model::AnnotatedMessagePart::formatted_value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnnotatedMessagePart;
/// use wkt::Value;
/// let x = AnnotatedMessagePart::new().set_formatted_value(Value::default()/* use setters */);
/// ```
pub fn set_formatted_value<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Value>,
{
self.formatted_value = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [formatted_value][crate::model::AnnotatedMessagePart::formatted_value].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AnnotatedMessagePart;
/// use wkt::Value;
/// let x = AnnotatedMessagePart::new().set_or_clear_formatted_value(Some(Value::default()/* use setters */));
/// let x = AnnotatedMessagePart::new().set_or_clear_formatted_value(None::<Value>);
/// ```
pub fn set_or_clear_formatted_value<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Value>,
{
self.formatted_value = v.map(|x| x.into());
self
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl wkt::message::Message for AnnotatedMessagePart {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AnnotatedMessagePart"
}
}
/// Represents the result of annotation for the message.
#[cfg(any(feature = "conversations", feature = "participants",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MessageAnnotation {
/// The collection of annotated message parts ordered by their
/// position in the message. You can recover the annotated message by
/// concatenating [AnnotatedMessagePart.text].
pub parts: std::vec::Vec<crate::model::AnnotatedMessagePart>,
/// Indicates whether the text message contains entities.
pub contain_entities: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl MessageAnnotation {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parts][crate::model::MessageAnnotation::parts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::MessageAnnotation;
/// use google_cloud_dialogflow_v2::model::AnnotatedMessagePart;
/// let x = MessageAnnotation::new()
/// .set_parts([
/// AnnotatedMessagePart::default()/* use setters */,
/// AnnotatedMessagePart::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_parts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::AnnotatedMessagePart>,
{
use std::iter::Iterator;
self.parts = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [contain_entities][crate::model::MessageAnnotation::contain_entities].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::MessageAnnotation;
/// let x = MessageAnnotation::new().set_contain_entities(true);
/// ```
pub fn set_contain_entities<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.contain_entities = v.into();
self
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl wkt::message::Message for MessageAnnotation {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.MessageAnnotation"
}
}
/// Represents the action to take for a tool call that requires confirmation.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestionInput {
/// Required. Format: `projects/<Project ID>/locations/<Location
/// ID>/answerRecords/<Answer Record ID>`
/// The answer record associated with the tool call.
pub answer_record: std::string::String,
/// Optional. Parameters to be used for the tool call. If not provided, the
/// tool will be called without any parameters.
pub parameters: std::option::Option<wkt::Struct>,
/// Optional. The type of action to take with the tool.
pub action: crate::model::suggestion_input::Action,
/// Optional. Time when the current suggest input is sent. For tool calls, this
/// timestamp (along with the answer record) will be included in the
/// corresponding tool call result so that it can be identified.
pub send_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl SuggestionInput {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer_record][crate::model::SuggestionInput::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionInput;
/// let x = SuggestionInput::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.answer_record = v.into();
self
}
/// Sets the value of [parameters][crate::model::SuggestionInput::parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionInput;
/// use wkt::Struct;
/// let x = SuggestionInput::new().set_parameters(Struct::default()/* use setters */);
/// ```
pub fn set_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.parameters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parameters][crate::model::SuggestionInput::parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionInput;
/// use wkt::Struct;
/// let x = SuggestionInput::new().set_or_clear_parameters(Some(Struct::default()/* use setters */));
/// let x = SuggestionInput::new().set_or_clear_parameters(None::<Struct>);
/// ```
pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.parameters = v.map(|x| x.into());
self
}
/// Sets the value of [action][crate::model::SuggestionInput::action].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionInput;
/// use google_cloud_dialogflow_v2::model::suggestion_input::Action;
/// let x0 = SuggestionInput::new().set_action(Action::Cancel);
/// let x1 = SuggestionInput::new().set_action(Action::Revise);
/// let x2 = SuggestionInput::new().set_action(Action::Confirm);
/// ```
pub fn set_action<T: std::convert::Into<crate::model::suggestion_input::Action>>(
mut self,
v: T,
) -> Self {
self.action = v.into();
self
}
/// Sets the value of [send_time][crate::model::SuggestionInput::send_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionInput;
/// use wkt::Timestamp;
/// let x = SuggestionInput::new().set_send_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_send_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.send_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [send_time][crate::model::SuggestionInput::send_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestionInput;
/// use wkt::Timestamp;
/// let x = SuggestionInput::new().set_or_clear_send_time(Some(Timestamp::default()/* use setters */));
/// let x = SuggestionInput::new().set_or_clear_send_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_send_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.send_time = v.map(|x| x.into());
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for SuggestionInput {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestionInput"
}
}
/// Defines additional types related to [SuggestionInput].
#[cfg(feature = "participants")]
pub mod suggestion_input {
#[allow(unused_imports)]
use super::*;
/// Indicate what type of action to take with the tool call.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "participants")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Action {
/// Action not specified.
Unspecified,
/// Indicates the user chooses to not make the tool call. It
/// is only applicable to tool calls that are waiting for user
/// confirmation.
Cancel,
/// Makes the tool call with provided parameters. This action is intended
/// for tool calls that only read but not write data.
Revise,
/// Makes the tool call with provided parameters. This action is intended
/// for tool calls that may write data.
Confirm,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Action::value] or
/// [Action::name].
UnknownValue(action::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "participants")]
pub mod action {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "participants")]
impl Action {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Cancel => std::option::Option::Some(1),
Self::Revise => std::option::Option::Some(2),
Self::Confirm => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ACTION_UNSPECIFIED"),
Self::Cancel => std::option::Option::Some("CANCEL"),
Self::Revise => std::option::Option::Some("REVISE"),
Self::Confirm => std::option::Option::Some("CONFIRM"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "participants")]
impl std::default::Default for Action {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "participants")]
impl std::fmt::Display for Action {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "participants")]
impl std::convert::From<i32> for Action {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Cancel,
2 => Self::Revise,
3 => Self::Confirm,
_ => Self::UnknownValue(action::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "participants")]
impl std::convert::From<&str> for Action {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ACTION_UNSPECIFIED" => Self::Unspecified,
"CANCEL" => Self::Cancel,
"REVISE" => Self::Revise,
"CONFIRM" => Self::Confirm,
_ => Self::UnknownValue(action::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "participants")]
impl serde::ser::Serialize for Action {
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::Cancel => serializer.serialize_i32(1),
Self::Revise => serializer.serialize_i32(2),
Self::Confirm => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "participants")]
impl<'de> serde::de::Deserialize<'de> for Action {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Action>::new(
".google.cloud.dialogflow.v2.SuggestionInput.Action",
))
}
}
}
/// Represents the parameters of human assist query.
#[cfg(any(feature = "conversations", feature = "participants",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AssistQueryParameters {
/// Key-value filters on the metadata of documents returned by article
/// suggestion. If specified, article suggestion only returns suggested
/// documents that match all filters in their
/// [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple
/// values for a metadata key should be concatenated by comma. For example,
/// filters to match all documents that have 'US' or 'CA' in their market
/// metadata values and 'agent' in their user metadata values will be
///
/// ```norust
/// documents_metadata_filters {
/// key: "market"
/// value: "US,CA"
/// }
/// documents_metadata_filters {
/// key: "user"
/// value: "agent"
/// }
/// ```
///
/// [google.cloud.dialogflow.v2.Document.metadata]: crate::model::Document::metadata
pub documents_metadata_filters:
std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl AssistQueryParameters {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [documents_metadata_filters][crate::model::AssistQueryParameters::documents_metadata_filters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::AssistQueryParameters;
/// let x = AssistQueryParameters::new().set_documents_metadata_filters([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_documents_metadata_filters<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.documents_metadata_filters =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl wkt::message::Message for AssistQueryParameters {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.AssistQueryParameters"
}
}
/// The request message for
/// [Participants.SuggestKnowledgeAssist][google.cloud.dialogflow.v2.Participants.SuggestKnowledgeAssist].
///
/// [google.cloud.dialogflow.v2.Participants.SuggestKnowledgeAssist]: crate::client::Participants::suggest_knowledge_assist
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestKnowledgeAssistRequest {
/// Required. The name of the participant to fetch suggestions for.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/participants/<Participant ID>`.
pub parent: std::string::String,
/// Optional. The name of the latest conversation message to compile
/// suggestions for. If empty, it will be the latest message of the
/// conversation. Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub latest_message: std::string::String,
/// Optional. Max number of messages prior to and including
/// [latest_message][google.cloud.dialogflow.v2.SuggestKnowledgeAssistRequest.latest_message]
/// to use as context when compiling the suggestion. The context size is by
/// default 100 and at most 100.
///
/// [google.cloud.dialogflow.v2.SuggestKnowledgeAssistRequest.latest_message]: crate::model::SuggestKnowledgeAssistRequest::latest_message
pub context_size: i32,
/// Optional. The previously suggested query for the given conversation. This
/// helps identify whether the next suggestion we generate is reasonably
/// different from the previous one. This is useful to avoid similar
/// suggestions within the conversation.
pub previous_suggested_query: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl SuggestKnowledgeAssistRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::SuggestKnowledgeAssistRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestKnowledgeAssistRequest;
/// let x = SuggestKnowledgeAssistRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [latest_message][crate::model::SuggestKnowledgeAssistRequest::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestKnowledgeAssistRequest;
/// let x = SuggestKnowledgeAssistRequest::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [context_size][crate::model::SuggestKnowledgeAssistRequest::context_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestKnowledgeAssistRequest;
/// let x = SuggestKnowledgeAssistRequest::new().set_context_size(42);
/// ```
pub fn set_context_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.context_size = v.into();
self
}
/// Sets the value of [previous_suggested_query][crate::model::SuggestKnowledgeAssistRequest::previous_suggested_query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestKnowledgeAssistRequest;
/// let x = SuggestKnowledgeAssistRequest::new().set_previous_suggested_query("example");
/// ```
pub fn set_previous_suggested_query<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.previous_suggested_query = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for SuggestKnowledgeAssistRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestKnowledgeAssistRequest"
}
}
/// The response message for
/// [Participants.SuggestKnowledgeAssist][google.cloud.dialogflow.v2.Participants.SuggestKnowledgeAssist].
///
/// [google.cloud.dialogflow.v2.Participants.SuggestKnowledgeAssist]: crate::client::Participants::suggest_knowledge_assist
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestKnowledgeAssistResponse {
/// Output only. Knowledge Assist suggestion.
pub knowledge_assist_answer: std::option::Option<crate::model::KnowledgeAssistAnswer>,
/// The name of the latest conversation message used to compile suggestion for.
/// Format: `projects/<Project ID>/locations/<Location
/// ID>/conversations/<Conversation ID>/messages/<Message ID>`.
pub latest_message: std::string::String,
/// Number of messages prior to and including
/// [latest_message][google.cloud.dialogflow.v2.SuggestKnowledgeAssistResponse.latest_message]
/// to compile the suggestion. It may be smaller than the
/// [SuggestKnowledgeAssistRequest.context_size][google.cloud.dialogflow.v2.SuggestKnowledgeAssistRequest.context_size]
/// field in the request if there are fewer messages in the conversation.
///
/// [google.cloud.dialogflow.v2.SuggestKnowledgeAssistRequest.context_size]: crate::model::SuggestKnowledgeAssistRequest::context_size
/// [google.cloud.dialogflow.v2.SuggestKnowledgeAssistResponse.latest_message]: crate::model::SuggestKnowledgeAssistResponse::latest_message
pub context_size: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl SuggestKnowledgeAssistResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [knowledge_assist_answer][crate::model::SuggestKnowledgeAssistResponse::knowledge_assist_answer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestKnowledgeAssistResponse;
/// use google_cloud_dialogflow_v2::model::KnowledgeAssistAnswer;
/// let x = SuggestKnowledgeAssistResponse::new().set_knowledge_assist_answer(KnowledgeAssistAnswer::default()/* use setters */);
/// ```
pub fn set_knowledge_assist_answer<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::KnowledgeAssistAnswer>,
{
self.knowledge_assist_answer = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [knowledge_assist_answer][crate::model::SuggestKnowledgeAssistResponse::knowledge_assist_answer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestKnowledgeAssistResponse;
/// use google_cloud_dialogflow_v2::model::KnowledgeAssistAnswer;
/// let x = SuggestKnowledgeAssistResponse::new().set_or_clear_knowledge_assist_answer(Some(KnowledgeAssistAnswer::default()/* use setters */));
/// let x = SuggestKnowledgeAssistResponse::new().set_or_clear_knowledge_assist_answer(None::<KnowledgeAssistAnswer>);
/// ```
pub fn set_or_clear_knowledge_assist_answer<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::KnowledgeAssistAnswer>,
{
self.knowledge_assist_answer = v.map(|x| x.into());
self
}
/// Sets the value of [latest_message][crate::model::SuggestKnowledgeAssistResponse::latest_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestKnowledgeAssistResponse;
/// let x = SuggestKnowledgeAssistResponse::new().set_latest_message("example");
/// ```
pub fn set_latest_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.latest_message = v.into();
self
}
/// Sets the value of [context_size][crate::model::SuggestKnowledgeAssistResponse::context_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SuggestKnowledgeAssistResponse;
/// let x = SuggestKnowledgeAssistResponse::new().set_context_size(42);
/// ```
pub fn set_context_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.context_size = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for SuggestKnowledgeAssistResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SuggestKnowledgeAssistResponse"
}
}
/// Debug information related to ingested context reference.
#[cfg(any(feature = "conversations", feature = "participants",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IngestedContextReferenceDebugInfo {
/// Indicates if the project is allowlisted to use ingested context
/// reference.
pub project_not_allowlisted: bool,
/// The status of context_reference retrieval from database.
pub context_reference_retrieved: bool,
/// Parameters ingested from the context reference.
pub ingested_parameters_debug_info: std::vec::Vec<
crate::model::ingested_context_reference_debug_info::IngestedParameterDebugInfo,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl IngestedContextReferenceDebugInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [project_not_allowlisted][crate::model::IngestedContextReferenceDebugInfo::project_not_allowlisted].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::IngestedContextReferenceDebugInfo;
/// let x = IngestedContextReferenceDebugInfo::new().set_project_not_allowlisted(true);
/// ```
pub fn set_project_not_allowlisted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.project_not_allowlisted = v.into();
self
}
/// Sets the value of [context_reference_retrieved][crate::model::IngestedContextReferenceDebugInfo::context_reference_retrieved].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::IngestedContextReferenceDebugInfo;
/// let x = IngestedContextReferenceDebugInfo::new().set_context_reference_retrieved(true);
/// ```
pub fn set_context_reference_retrieved<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.context_reference_retrieved = v.into();
self
}
/// Sets the value of [ingested_parameters_debug_info][crate::model::IngestedContextReferenceDebugInfo::ingested_parameters_debug_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::IngestedContextReferenceDebugInfo;
/// use google_cloud_dialogflow_v2::model::ingested_context_reference_debug_info::IngestedParameterDebugInfo;
/// let x = IngestedContextReferenceDebugInfo::new()
/// .set_ingested_parameters_debug_info([
/// IngestedParameterDebugInfo::default()/* use setters */,
/// IngestedParameterDebugInfo::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_ingested_parameters_debug_info<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<
crate::model::ingested_context_reference_debug_info::IngestedParameterDebugInfo,
>,
{
use std::iter::Iterator;
self.ingested_parameters_debug_info = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl wkt::message::Message for IngestedContextReferenceDebugInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.IngestedContextReferenceDebugInfo"
}
}
/// Defines additional types related to [IngestedContextReferenceDebugInfo].
#[cfg(any(feature = "conversations", feature = "participants",))]
pub mod ingested_context_reference_debug_info {
#[allow(unused_imports)]
use super::*;
/// Debug information related to ingested parameters from context reference.
#[cfg(any(feature = "conversations", feature = "participants",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct IngestedParameterDebugInfo {
/// The name of the parameter in the context reference.
pub parameter: std::string::String,
/// The ingestion status for this specific parameter.
pub ingestion_status: crate::model::ingested_context_reference_debug_info::ingested_parameter_debug_info::IngestionStatus,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl IngestedParameterDebugInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parameter][crate::model::ingested_context_reference_debug_info::IngestedParameterDebugInfo::parameter].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ingested_context_reference_debug_info::IngestedParameterDebugInfo;
/// let x = IngestedParameterDebugInfo::new().set_parameter("example");
/// ```
pub fn set_parameter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parameter = v.into();
self
}
/// Sets the value of [ingestion_status][crate::model::ingested_context_reference_debug_info::IngestedParameterDebugInfo::ingestion_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ingested_context_reference_debug_info::IngestedParameterDebugInfo;
/// use google_cloud_dialogflow_v2::model::ingested_context_reference_debug_info::ingested_parameter_debug_info::IngestionStatus;
/// let x0 = IngestedParameterDebugInfo::new().set_ingestion_status(IngestionStatus::Succeeded);
/// let x1 = IngestedParameterDebugInfo::new().set_ingestion_status(IngestionStatus::ContextNotAvailable);
/// let x2 = IngestedParameterDebugInfo::new().set_ingestion_status(IngestionStatus::ParseFailed);
/// ```
pub fn set_ingestion_status<T: std::convert::Into<crate::model::ingested_context_reference_debug_info::ingested_parameter_debug_info::IngestionStatus>>(mut self, v: T) -> Self{
self.ingestion_status = v.into();
self
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl wkt::message::Message for IngestedParameterDebugInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.IngestedContextReferenceDebugInfo.IngestedParameterDebugInfo"
}
}
/// Defines additional types related to [IngestedParameterDebugInfo].
#[cfg(any(feature = "conversations", feature = "participants",))]
pub mod ingested_parameter_debug_info {
#[allow(unused_imports)]
use super::*;
/// Enum representing the various states of parameter ingestion.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(feature = "conversations", feature = "participants",))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum IngestionStatus {
/// Default value, indicates that the ingestion status is not specified.
Unspecified,
/// Indicates that the parameter was successfully ingested.
Succeeded,
/// Indicates that the parameter was not available for ingestion.
ContextNotAvailable,
/// Indicates that there was a failure parsing the parameter content.
ParseFailed,
/// Indicates that the context reference had an unexpected number of
/// content entries as Context reference should only have one entry.
InvalidEntry,
/// Indicates that the context reference content was not in the expected
/// format (e.g., JSON).
InvalidFormat,
/// Indicates that the context reference language does not match the
/// conversation language.
LanguageMismatch,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [IngestionStatus::value] or
/// [IngestionStatus::name].
UnknownValue(ingestion_status::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(feature = "conversations", feature = "participants",))]
pub mod ingestion_status {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl IngestionStatus {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Succeeded => std::option::Option::Some(1),
Self::ContextNotAvailable => std::option::Option::Some(2),
Self::ParseFailed => std::option::Option::Some(3),
Self::InvalidEntry => std::option::Option::Some(4),
Self::InvalidFormat => std::option::Option::Some(5),
Self::LanguageMismatch => std::option::Option::Some(6),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("INGESTION_STATUS_UNSPECIFIED"),
Self::Succeeded => std::option::Option::Some("INGESTION_STATUS_SUCCEEDED"),
Self::ContextNotAvailable => {
std::option::Option::Some("INGESTION_STATUS_CONTEXT_NOT_AVAILABLE")
}
Self::ParseFailed => std::option::Option::Some("INGESTION_STATUS_PARSE_FAILED"),
Self::InvalidEntry => {
std::option::Option::Some("INGESTION_STATUS_INVALID_ENTRY")
}
Self::InvalidFormat => {
std::option::Option::Some("INGESTION_STATUS_INVALID_FORMAT")
}
Self::LanguageMismatch => {
std::option::Option::Some("INGESTION_STATUS_LANGUAGE_MISMATCH")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl std::default::Default for IngestionStatus {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl std::fmt::Display for IngestionStatus {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl std::convert::From<i32> for IngestionStatus {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Succeeded,
2 => Self::ContextNotAvailable,
3 => Self::ParseFailed,
4 => Self::InvalidEntry,
5 => Self::InvalidFormat,
6 => Self::LanguageMismatch,
_ => Self::UnknownValue(ingestion_status::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl std::convert::From<&str> for IngestionStatus {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"INGESTION_STATUS_UNSPECIFIED" => Self::Unspecified,
"INGESTION_STATUS_SUCCEEDED" => Self::Succeeded,
"INGESTION_STATUS_CONTEXT_NOT_AVAILABLE" => Self::ContextNotAvailable,
"INGESTION_STATUS_PARSE_FAILED" => Self::ParseFailed,
"INGESTION_STATUS_INVALID_ENTRY" => Self::InvalidEntry,
"INGESTION_STATUS_INVALID_FORMAT" => Self::InvalidFormat,
"INGESTION_STATUS_LANGUAGE_MISMATCH" => Self::LanguageMismatch,
_ => Self::UnknownValue(ingestion_status::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl serde::ser::Serialize for IngestionStatus {
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::Succeeded => serializer.serialize_i32(1),
Self::ContextNotAvailable => serializer.serialize_i32(2),
Self::ParseFailed => serializer.serialize_i32(3),
Self::InvalidEntry => serializer.serialize_i32(4),
Self::InvalidFormat => serializer.serialize_i32(5),
Self::LanguageMismatch => serializer.serialize_i32(6),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl<'de> serde::de::Deserialize<'de> for IngestionStatus {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<IngestionStatus>::new(
".google.cloud.dialogflow.v2.IngestedContextReferenceDebugInfo.IngestedParameterDebugInfo.IngestionStatus"))
}
}
}
}
/// Message to represent the latency of the service.
#[cfg(any(feature = "conversations", feature = "participants",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServiceLatency {
/// A list of internal service latencies.
pub internal_service_latencies:
std::vec::Vec<crate::model::service_latency::InternalServiceLatency>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl ServiceLatency {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [internal_service_latencies][crate::model::ServiceLatency::internal_service_latencies].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ServiceLatency;
/// use google_cloud_dialogflow_v2::model::service_latency::InternalServiceLatency;
/// let x = ServiceLatency::new()
/// .set_internal_service_latencies([
/// InternalServiceLatency::default()/* use setters */,
/// InternalServiceLatency::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_internal_service_latencies<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::service_latency::InternalServiceLatency>,
{
use std::iter::Iterator;
self.internal_service_latencies = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl wkt::message::Message for ServiceLatency {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ServiceLatency"
}
}
/// Defines additional types related to [ServiceLatency].
#[cfg(any(feature = "conversations", feature = "participants",))]
pub mod service_latency {
#[allow(unused_imports)]
use super::*;
/// Message to represent the latency of an internal service.
#[cfg(any(feature = "conversations", feature = "participants",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InternalServiceLatency {
/// The name of the internal service.
pub step: std::string::String,
/// The latency of the internal service in milliseconds.
pub latency_ms: f32,
/// The start time of the internal service.
pub start_time: std::option::Option<wkt::Timestamp>,
/// The completion time of the internal service.
pub complete_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl InternalServiceLatency {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [step][crate::model::service_latency::InternalServiceLatency::step].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::service_latency::InternalServiceLatency;
/// let x = InternalServiceLatency::new().set_step("example");
/// ```
pub fn set_step<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.step = v.into();
self
}
/// Sets the value of [latency_ms][crate::model::service_latency::InternalServiceLatency::latency_ms].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::service_latency::InternalServiceLatency;
/// let x = InternalServiceLatency::new().set_latency_ms(42.0);
/// ```
pub fn set_latency_ms<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.latency_ms = v.into();
self
}
/// Sets the value of [start_time][crate::model::service_latency::InternalServiceLatency::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::service_latency::InternalServiceLatency;
/// use wkt::Timestamp;
/// let x = InternalServiceLatency::new().set_start_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [start_time][crate::model::service_latency::InternalServiceLatency::start_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::service_latency::InternalServiceLatency;
/// use wkt::Timestamp;
/// let x = InternalServiceLatency::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
/// let x = InternalServiceLatency::new().set_or_clear_start_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [complete_time][crate::model::service_latency::InternalServiceLatency::complete_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::service_latency::InternalServiceLatency;
/// use wkt::Timestamp;
/// let x = InternalServiceLatency::new().set_complete_time(Timestamp::default()/* use setters */);
/// ```
pub fn set_complete_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.complete_time = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [complete_time][crate::model::service_latency::InternalServiceLatency::complete_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::service_latency::InternalServiceLatency;
/// use wkt::Timestamp;
/// let x = InternalServiceLatency::new().set_or_clear_complete_time(Some(Timestamp::default()/* use setters */));
/// let x = InternalServiceLatency::new().set_or_clear_complete_time(None::<Timestamp>);
/// ```
pub fn set_or_clear_complete_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.complete_time = v.map(|x| x.into());
self
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl wkt::message::Message for InternalServiceLatency {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ServiceLatency.InternalServiceLatency"
}
}
}
/// Debug information related to Knowledge Assist feature.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KnowledgeAssistDebugInfo {
/// Reason for query generation.
pub query_generation_failure_reason:
crate::model::knowledge_assist_debug_info::QueryGenerationFailureReason,
/// Reason for query categorization.
pub query_categorization_failure_reason:
crate::model::knowledge_assist_debug_info::QueryCategorizationFailureReason,
/// Response reason from datastore which indicates data serving status or
/// answer quality degradation.
pub datastore_response_reason: crate::model::DatastoreResponseReason,
/// Configured behaviors for Knowedge Assist.
pub knowledge_assist_behavior:
std::option::Option<crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior>,
/// Information about parameters ingested for search knowledge.
pub ingested_context_reference_debug_info:
std::option::Option<crate::model::IngestedContextReferenceDebugInfo>,
/// The latency of the service.
pub service_latency: std::option::Option<crate::model::ServiceLatency>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl KnowledgeAssistDebugInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [query_generation_failure_reason][crate::model::KnowledgeAssistDebugInfo::query_generation_failure_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistDebugInfo;
/// use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::QueryGenerationFailureReason;
/// let x0 = KnowledgeAssistDebugInfo::new().set_query_generation_failure_reason(QueryGenerationFailureReason::QueryGenerationOutOfQuota);
/// let x1 = KnowledgeAssistDebugInfo::new().set_query_generation_failure_reason(QueryGenerationFailureReason::QueryGenerationFailed);
/// let x2 = KnowledgeAssistDebugInfo::new().set_query_generation_failure_reason(QueryGenerationFailureReason::QueryGenerationNoQueryGenerated);
/// ```
pub fn set_query_generation_failure_reason<
T: std::convert::Into<crate::model::knowledge_assist_debug_info::QueryGenerationFailureReason>,
>(
mut self,
v: T,
) -> Self {
self.query_generation_failure_reason = v.into();
self
}
/// Sets the value of [query_categorization_failure_reason][crate::model::KnowledgeAssistDebugInfo::query_categorization_failure_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistDebugInfo;
/// use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::QueryCategorizationFailureReason;
/// let x0 = KnowledgeAssistDebugInfo::new().set_query_categorization_failure_reason(QueryCategorizationFailureReason::QueryCategorizationInvalidConfig);
/// let x1 = KnowledgeAssistDebugInfo::new().set_query_categorization_failure_reason(QueryCategorizationFailureReason::QueryCategorizationResultNotFound);
/// let x2 = KnowledgeAssistDebugInfo::new().set_query_categorization_failure_reason(QueryCategorizationFailureReason::QueryCategorizationFailed);
/// ```
pub fn set_query_categorization_failure_reason<
T: std::convert::Into<
crate::model::knowledge_assist_debug_info::QueryCategorizationFailureReason,
>,
>(
mut self,
v: T,
) -> Self {
self.query_categorization_failure_reason = v.into();
self
}
/// Sets the value of [datastore_response_reason][crate::model::KnowledgeAssistDebugInfo::datastore_response_reason].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistDebugInfo;
/// use google_cloud_dialogflow_v2::model::DatastoreResponseReason;
/// let x0 = KnowledgeAssistDebugInfo::new().set_datastore_response_reason(DatastoreResponseReason::None);
/// let x1 = KnowledgeAssistDebugInfo::new().set_datastore_response_reason(DatastoreResponseReason::SearchOutOfQuota);
/// let x2 = KnowledgeAssistDebugInfo::new().set_datastore_response_reason(DatastoreResponseReason::SearchEmptyResults);
/// ```
pub fn set_datastore_response_reason<
T: std::convert::Into<crate::model::DatastoreResponseReason>,
>(
mut self,
v: T,
) -> Self {
self.datastore_response_reason = v.into();
self
}
/// Sets the value of [knowledge_assist_behavior][crate::model::KnowledgeAssistDebugInfo::knowledge_assist_behavior].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistDebugInfo;
/// use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistDebugInfo::new().set_knowledge_assist_behavior(KnowledgeAssistBehavior::default()/* use setters */);
/// ```
pub fn set_knowledge_assist_behavior<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior>,
{
self.knowledge_assist_behavior = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [knowledge_assist_behavior][crate::model::KnowledgeAssistDebugInfo::knowledge_assist_behavior].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistDebugInfo;
/// use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistDebugInfo::new().set_or_clear_knowledge_assist_behavior(Some(KnowledgeAssistBehavior::default()/* use setters */));
/// let x = KnowledgeAssistDebugInfo::new().set_or_clear_knowledge_assist_behavior(None::<KnowledgeAssistBehavior>);
/// ```
pub fn set_or_clear_knowledge_assist_behavior<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior>,
{
self.knowledge_assist_behavior = v.map(|x| x.into());
self
}
/// Sets the value of [ingested_context_reference_debug_info][crate::model::KnowledgeAssistDebugInfo::ingested_context_reference_debug_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistDebugInfo;
/// use google_cloud_dialogflow_v2::model::IngestedContextReferenceDebugInfo;
/// let x = KnowledgeAssistDebugInfo::new().set_ingested_context_reference_debug_info(IngestedContextReferenceDebugInfo::default()/* use setters */);
/// ```
pub fn set_ingested_context_reference_debug_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::IngestedContextReferenceDebugInfo>,
{
self.ingested_context_reference_debug_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [ingested_context_reference_debug_info][crate::model::KnowledgeAssistDebugInfo::ingested_context_reference_debug_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistDebugInfo;
/// use google_cloud_dialogflow_v2::model::IngestedContextReferenceDebugInfo;
/// let x = KnowledgeAssistDebugInfo::new().set_or_clear_ingested_context_reference_debug_info(Some(IngestedContextReferenceDebugInfo::default()/* use setters */));
/// let x = KnowledgeAssistDebugInfo::new().set_or_clear_ingested_context_reference_debug_info(None::<IngestedContextReferenceDebugInfo>);
/// ```
pub fn set_or_clear_ingested_context_reference_debug_info<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::IngestedContextReferenceDebugInfo>,
{
self.ingested_context_reference_debug_info = v.map(|x| x.into());
self
}
/// Sets the value of [service_latency][crate::model::KnowledgeAssistDebugInfo::service_latency].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistDebugInfo;
/// use google_cloud_dialogflow_v2::model::ServiceLatency;
/// let x = KnowledgeAssistDebugInfo::new().set_service_latency(ServiceLatency::default()/* use setters */);
/// ```
pub fn set_service_latency<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ServiceLatency>,
{
self.service_latency = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [service_latency][crate::model::KnowledgeAssistDebugInfo::service_latency].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistDebugInfo;
/// use google_cloud_dialogflow_v2::model::ServiceLatency;
/// let x = KnowledgeAssistDebugInfo::new().set_or_clear_service_latency(Some(ServiceLatency::default()/* use setters */));
/// let x = KnowledgeAssistDebugInfo::new().set_or_clear_service_latency(None::<ServiceLatency>);
/// ```
pub fn set_or_clear_service_latency<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ServiceLatency>,
{
self.service_latency = v.map(|x| x.into());
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for KnowledgeAssistDebugInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.KnowledgeAssistDebugInfo"
}
}
/// Defines additional types related to [KnowledgeAssistDebugInfo].
#[cfg(feature = "participants")]
pub mod knowledge_assist_debug_info {
#[allow(unused_imports)]
use super::*;
/// Configured behaviors for Knowedge Assist.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KnowledgeAssistBehavior {
/// Whether data store agent rewriter was turned off for the request.
pub answer_generation_rewriter_on: bool,
/// Whether end_user_metadata is included in the data store agent call.
pub end_user_metadata_included: bool,
/// Whether customers configured to return query only in the
/// conversation profile.
pub return_query_only: bool,
/// Whether customers configured to use pubsub to deliver.
pub use_pubsub_delivery: bool,
/// Whether customers configured to disable the synchronous delivery of
/// Knowedge Assist response.
pub disable_sync_delivery: bool,
/// Whether previously suggested queries are included in the query generation
/// process.
pub previous_queries_included: bool,
/// Translated message is included in query generation process.
pub use_translated_message: bool,
/// Safety filter is adjusted by user.
pub use_custom_safety_filter_level: bool,
/// Conversation transcript has mixed languages.
pub conversation_transcript_has_mixed_languages: bool,
/// Whether the agent language from the translation generator mismatches the
/// end-user language.
pub query_generation_agent_language_mismatch: bool,
/// Whether the end-user language from the translation generator mismatches
/// the end-user language.
pub query_generation_end_user_language_mismatch: bool,
/// This field indicates whether third party connectors are enabled for the
/// project
pub third_party_connector_allowed: bool,
/// Indicates that the query generation model generated multiple queries.
pub multiple_queries_generated: bool,
/// Indicates that the generated query contains search context.
pub query_contained_search_context: bool,
/// Indicates that invalid items were skipped when parsing the LLM response.
pub invalid_items_query_suggestion_skipped: bool,
/// True if the primary suggested query was redacted and replaced by an
/// additional query.
pub primary_query_redacted_and_replaced: bool,
/// The number of search contexts appended to the query.
pub appended_search_context_count: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl KnowledgeAssistBehavior {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer_generation_rewriter_on][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::answer_generation_rewriter_on].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_answer_generation_rewriter_on(true);
/// ```
pub fn set_answer_generation_rewriter_on<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.answer_generation_rewriter_on = v.into();
self
}
/// Sets the value of [end_user_metadata_included][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::end_user_metadata_included].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_end_user_metadata_included(true);
/// ```
pub fn set_end_user_metadata_included<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.end_user_metadata_included = v.into();
self
}
/// Sets the value of [return_query_only][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::return_query_only].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_return_query_only(true);
/// ```
pub fn set_return_query_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.return_query_only = v.into();
self
}
/// Sets the value of [use_pubsub_delivery][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::use_pubsub_delivery].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_use_pubsub_delivery(true);
/// ```
pub fn set_use_pubsub_delivery<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.use_pubsub_delivery = v.into();
self
}
/// Sets the value of [disable_sync_delivery][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::disable_sync_delivery].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_disable_sync_delivery(true);
/// ```
pub fn set_disable_sync_delivery<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.disable_sync_delivery = v.into();
self
}
/// Sets the value of [previous_queries_included][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::previous_queries_included].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_previous_queries_included(true);
/// ```
pub fn set_previous_queries_included<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.previous_queries_included = v.into();
self
}
/// Sets the value of [use_translated_message][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::use_translated_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_use_translated_message(true);
/// ```
pub fn set_use_translated_message<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.use_translated_message = v.into();
self
}
/// Sets the value of [use_custom_safety_filter_level][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::use_custom_safety_filter_level].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_use_custom_safety_filter_level(true);
/// ```
pub fn set_use_custom_safety_filter_level<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.use_custom_safety_filter_level = v.into();
self
}
/// Sets the value of [conversation_transcript_has_mixed_languages][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::conversation_transcript_has_mixed_languages].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_conversation_transcript_has_mixed_languages(true);
/// ```
pub fn set_conversation_transcript_has_mixed_languages<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.conversation_transcript_has_mixed_languages = v.into();
self
}
/// Sets the value of [query_generation_agent_language_mismatch][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::query_generation_agent_language_mismatch].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_query_generation_agent_language_mismatch(true);
/// ```
pub fn set_query_generation_agent_language_mismatch<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.query_generation_agent_language_mismatch = v.into();
self
}
/// Sets the value of [query_generation_end_user_language_mismatch][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::query_generation_end_user_language_mismatch].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_query_generation_end_user_language_mismatch(true);
/// ```
pub fn set_query_generation_end_user_language_mismatch<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.query_generation_end_user_language_mismatch = v.into();
self
}
/// Sets the value of [third_party_connector_allowed][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::third_party_connector_allowed].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_third_party_connector_allowed(true);
/// ```
pub fn set_third_party_connector_allowed<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.third_party_connector_allowed = v.into();
self
}
/// Sets the value of [multiple_queries_generated][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::multiple_queries_generated].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_multiple_queries_generated(true);
/// ```
pub fn set_multiple_queries_generated<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.multiple_queries_generated = v.into();
self
}
/// Sets the value of [query_contained_search_context][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::query_contained_search_context].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_query_contained_search_context(true);
/// ```
pub fn set_query_contained_search_context<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.query_contained_search_context = v.into();
self
}
/// Sets the value of [invalid_items_query_suggestion_skipped][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::invalid_items_query_suggestion_skipped].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_invalid_items_query_suggestion_skipped(true);
/// ```
pub fn set_invalid_items_query_suggestion_skipped<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.invalid_items_query_suggestion_skipped = v.into();
self
}
/// Sets the value of [primary_query_redacted_and_replaced][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::primary_query_redacted_and_replaced].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_primary_query_redacted_and_replaced(true);
/// ```
pub fn set_primary_query_redacted_and_replaced<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.primary_query_redacted_and_replaced = v.into();
self
}
/// Sets the value of [appended_search_context_count][crate::model::knowledge_assist_debug_info::KnowledgeAssistBehavior::appended_search_context_count].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_debug_info::KnowledgeAssistBehavior;
/// let x = KnowledgeAssistBehavior::new().set_appended_search_context_count(42);
/// ```
pub fn set_appended_search_context_count<T: std::convert::Into<i32>>(
mut self,
v: T,
) -> Self {
self.appended_search_context_count = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for KnowledgeAssistBehavior {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.KnowledgeAssistDebugInfo.KnowledgeAssistBehavior"
}
}
/// Reason for query generation failure.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "participants")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum QueryGenerationFailureReason {
/// Default value.
Unspecified,
/// Query generation is blocked due to out of quota.
QueryGenerationOutOfQuota,
/// Call to Knowedge Assist query generation model fails.
QueryGenerationFailed,
/// Query generation model decides that there is no new topic change or
/// there has been similar queries generated in the previous turns.
QueryGenerationNoQueryGenerated,
/// Knowedge Assist generated query is blocked by RAI (Responsible AI).
QueryGenerationRaiFailed,
/// Query generation is blocked by Knowledge Assist conversation profile
/// level / agent id level filtering.
NotInAllowlist,
/// The generated query is blocked due to redaction.
QueryGenerationQueryRedacted,
/// Query generation failed due to LLM response parse failure.
QueryGenerationLlmResponseParseFailed,
/// The conversation has no messages.
QueryGenerationEmptyConversation,
/// The last message in the conversation is empty.
QueryGenerationEmptyLastMessage,
/// The trigger event condition is not met.
/// This occurs in the following scenarios:
///
/// 1. The trigger_event is CUSTOMER_MESSAGE or UNSPECIFIED, but the last
/// message is not from the customer.
/// 1. The trigger_event is AGENT_MESSAGE, but the last message is not from
/// the agent.
QueryGenerationTriggeringEventConditionNotMet,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [QueryGenerationFailureReason::value] or
/// [QueryGenerationFailureReason::name].
UnknownValue(query_generation_failure_reason::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "participants")]
pub mod query_generation_failure_reason {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "participants")]
impl QueryGenerationFailureReason {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::QueryGenerationOutOfQuota => std::option::Option::Some(1),
Self::QueryGenerationFailed => std::option::Option::Some(2),
Self::QueryGenerationNoQueryGenerated => std::option::Option::Some(3),
Self::QueryGenerationRaiFailed => std::option::Option::Some(4),
Self::NotInAllowlist => std::option::Option::Some(5),
Self::QueryGenerationQueryRedacted => std::option::Option::Some(6),
Self::QueryGenerationLlmResponseParseFailed => std::option::Option::Some(10),
Self::QueryGenerationEmptyConversation => std::option::Option::Some(11),
Self::QueryGenerationEmptyLastMessage => std::option::Option::Some(12),
Self::QueryGenerationTriggeringEventConditionNotMet => {
std::option::Option::Some(13)
}
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("QUERY_GENERATION_FAILURE_REASON_UNSPECIFIED")
}
Self::QueryGenerationOutOfQuota => {
std::option::Option::Some("QUERY_GENERATION_OUT_OF_QUOTA")
}
Self::QueryGenerationFailed => std::option::Option::Some("QUERY_GENERATION_FAILED"),
Self::QueryGenerationNoQueryGenerated => {
std::option::Option::Some("QUERY_GENERATION_NO_QUERY_GENERATED")
}
Self::QueryGenerationRaiFailed => {
std::option::Option::Some("QUERY_GENERATION_RAI_FAILED")
}
Self::NotInAllowlist => std::option::Option::Some("NOT_IN_ALLOWLIST"),
Self::QueryGenerationQueryRedacted => {
std::option::Option::Some("QUERY_GENERATION_QUERY_REDACTED")
}
Self::QueryGenerationLlmResponseParseFailed => {
std::option::Option::Some("QUERY_GENERATION_LLM_RESPONSE_PARSE_FAILED")
}
Self::QueryGenerationEmptyConversation => {
std::option::Option::Some("QUERY_GENERATION_EMPTY_CONVERSATION")
}
Self::QueryGenerationEmptyLastMessage => {
std::option::Option::Some("QUERY_GENERATION_EMPTY_LAST_MESSAGE")
}
Self::QueryGenerationTriggeringEventConditionNotMet => {
std::option::Option::Some("QUERY_GENERATION_TRIGGERING_EVENT_CONDITION_NOT_MET")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "participants")]
impl std::default::Default for QueryGenerationFailureReason {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "participants")]
impl std::fmt::Display for QueryGenerationFailureReason {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "participants")]
impl std::convert::From<i32> for QueryGenerationFailureReason {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::QueryGenerationOutOfQuota,
2 => Self::QueryGenerationFailed,
3 => Self::QueryGenerationNoQueryGenerated,
4 => Self::QueryGenerationRaiFailed,
5 => Self::NotInAllowlist,
6 => Self::QueryGenerationQueryRedacted,
10 => Self::QueryGenerationLlmResponseParseFailed,
11 => Self::QueryGenerationEmptyConversation,
12 => Self::QueryGenerationEmptyLastMessage,
13 => Self::QueryGenerationTriggeringEventConditionNotMet,
_ => Self::UnknownValue(query_generation_failure_reason::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "participants")]
impl std::convert::From<&str> for QueryGenerationFailureReason {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"QUERY_GENERATION_FAILURE_REASON_UNSPECIFIED" => Self::Unspecified,
"QUERY_GENERATION_OUT_OF_QUOTA" => Self::QueryGenerationOutOfQuota,
"QUERY_GENERATION_FAILED" => Self::QueryGenerationFailed,
"QUERY_GENERATION_NO_QUERY_GENERATED" => Self::QueryGenerationNoQueryGenerated,
"QUERY_GENERATION_RAI_FAILED" => Self::QueryGenerationRaiFailed,
"NOT_IN_ALLOWLIST" => Self::NotInAllowlist,
"QUERY_GENERATION_QUERY_REDACTED" => Self::QueryGenerationQueryRedacted,
"QUERY_GENERATION_LLM_RESPONSE_PARSE_FAILED" => {
Self::QueryGenerationLlmResponseParseFailed
}
"QUERY_GENERATION_EMPTY_CONVERSATION" => Self::QueryGenerationEmptyConversation,
"QUERY_GENERATION_EMPTY_LAST_MESSAGE" => Self::QueryGenerationEmptyLastMessage,
"QUERY_GENERATION_TRIGGERING_EVENT_CONDITION_NOT_MET" => {
Self::QueryGenerationTriggeringEventConditionNotMet
}
_ => Self::UnknownValue(query_generation_failure_reason::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "participants")]
impl serde::ser::Serialize for QueryGenerationFailureReason {
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::QueryGenerationOutOfQuota => serializer.serialize_i32(1),
Self::QueryGenerationFailed => serializer.serialize_i32(2),
Self::QueryGenerationNoQueryGenerated => serializer.serialize_i32(3),
Self::QueryGenerationRaiFailed => serializer.serialize_i32(4),
Self::NotInAllowlist => serializer.serialize_i32(5),
Self::QueryGenerationQueryRedacted => serializer.serialize_i32(6),
Self::QueryGenerationLlmResponseParseFailed => serializer.serialize_i32(10),
Self::QueryGenerationEmptyConversation => serializer.serialize_i32(11),
Self::QueryGenerationEmptyLastMessage => serializer.serialize_i32(12),
Self::QueryGenerationTriggeringEventConditionNotMet => serializer.serialize_i32(13),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "participants")]
impl<'de> serde::de::Deserialize<'de> for QueryGenerationFailureReason {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<QueryGenerationFailureReason>::new(
".google.cloud.dialogflow.v2.KnowledgeAssistDebugInfo.QueryGenerationFailureReason"))
}
}
/// Reason for query categorization failure.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "participants")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum QueryCategorizationFailureReason {
/// Default value.
Unspecified,
/// Vertex AI Search config supplied for query categorization is invalid.
QueryCategorizationInvalidConfig,
/// Vertex AI Search result does not contain a query categorization result.
QueryCategorizationResultNotFound,
/// Vertex AI Search call fails.
QueryCategorizationFailed,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [QueryCategorizationFailureReason::value] or
/// [QueryCategorizationFailureReason::name].
UnknownValue(query_categorization_failure_reason::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "participants")]
pub mod query_categorization_failure_reason {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "participants")]
impl QueryCategorizationFailureReason {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::QueryCategorizationInvalidConfig => std::option::Option::Some(1),
Self::QueryCategorizationResultNotFound => std::option::Option::Some(2),
Self::QueryCategorizationFailed => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("QUERY_CATEGORIZATION_FAILURE_REASON_UNSPECIFIED")
}
Self::QueryCategorizationInvalidConfig => {
std::option::Option::Some("QUERY_CATEGORIZATION_INVALID_CONFIG")
}
Self::QueryCategorizationResultNotFound => {
std::option::Option::Some("QUERY_CATEGORIZATION_RESULT_NOT_FOUND")
}
Self::QueryCategorizationFailed => {
std::option::Option::Some("QUERY_CATEGORIZATION_FAILED")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "participants")]
impl std::default::Default for QueryCategorizationFailureReason {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "participants")]
impl std::fmt::Display for QueryCategorizationFailureReason {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "participants")]
impl std::convert::From<i32> for QueryCategorizationFailureReason {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::QueryCategorizationInvalidConfig,
2 => Self::QueryCategorizationResultNotFound,
3 => Self::QueryCategorizationFailed,
_ => Self::UnknownValue(query_categorization_failure_reason::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "participants")]
impl std::convert::From<&str> for QueryCategorizationFailureReason {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"QUERY_CATEGORIZATION_FAILURE_REASON_UNSPECIFIED" => Self::Unspecified,
"QUERY_CATEGORIZATION_INVALID_CONFIG" => Self::QueryCategorizationInvalidConfig,
"QUERY_CATEGORIZATION_RESULT_NOT_FOUND" => Self::QueryCategorizationResultNotFound,
"QUERY_CATEGORIZATION_FAILED" => Self::QueryCategorizationFailed,
_ => Self::UnknownValue(query_categorization_failure_reason::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "participants")]
impl serde::ser::Serialize for QueryCategorizationFailureReason {
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::QueryCategorizationInvalidConfig => serializer.serialize_i32(1),
Self::QueryCategorizationResultNotFound => serializer.serialize_i32(2),
Self::QueryCategorizationFailed => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "participants")]
impl<'de> serde::de::Deserialize<'de> for QueryCategorizationFailureReason {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<QueryCategorizationFailureReason>::new(
".google.cloud.dialogflow.v2.KnowledgeAssistDebugInfo.QueryCategorizationFailureReason"))
}
}
}
/// Represents a Knowledge Assist answer.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KnowledgeAssistAnswer {
/// The query suggested based on the context. Suggestion is made only if it
/// is different from the previous suggestion.
pub suggested_query: std::option::Option<crate::model::knowledge_assist_answer::SuggestedQuery>,
/// The answer generated for the suggested query. Whether or not an answer is
/// generated depends on how confident we are about the generated query.
pub suggested_query_answer:
std::option::Option<crate::model::knowledge_assist_answer::KnowledgeAnswer>,
/// The name of the answer record.
/// Format: `projects/<Project ID>/locations/<location ID>/answer
/// Records/<Answer Record ID>`.
pub answer_record: std::string::String,
/// Debug information related to Knowledge Assist feature.
pub knowledge_assist_debug_info: std::option::Option<crate::model::KnowledgeAssistDebugInfo>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl KnowledgeAssistAnswer {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [suggested_query][crate::model::KnowledgeAssistAnswer::suggested_query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistAnswer;
/// use google_cloud_dialogflow_v2::model::knowledge_assist_answer::SuggestedQuery;
/// let x = KnowledgeAssistAnswer::new().set_suggested_query(SuggestedQuery::default()/* use setters */);
/// ```
pub fn set_suggested_query<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::knowledge_assist_answer::SuggestedQuery>,
{
self.suggested_query = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [suggested_query][crate::model::KnowledgeAssistAnswer::suggested_query].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistAnswer;
/// use google_cloud_dialogflow_v2::model::knowledge_assist_answer::SuggestedQuery;
/// let x = KnowledgeAssistAnswer::new().set_or_clear_suggested_query(Some(SuggestedQuery::default()/* use setters */));
/// let x = KnowledgeAssistAnswer::new().set_or_clear_suggested_query(None::<SuggestedQuery>);
/// ```
pub fn set_or_clear_suggested_query<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::knowledge_assist_answer::SuggestedQuery>,
{
self.suggested_query = v.map(|x| x.into());
self
}
/// Sets the value of [suggested_query_answer][crate::model::KnowledgeAssistAnswer::suggested_query_answer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistAnswer;
/// use google_cloud_dialogflow_v2::model::knowledge_assist_answer::KnowledgeAnswer;
/// let x = KnowledgeAssistAnswer::new().set_suggested_query_answer(KnowledgeAnswer::default()/* use setters */);
/// ```
pub fn set_suggested_query_answer<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::knowledge_assist_answer::KnowledgeAnswer>,
{
self.suggested_query_answer = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [suggested_query_answer][crate::model::KnowledgeAssistAnswer::suggested_query_answer].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistAnswer;
/// use google_cloud_dialogflow_v2::model::knowledge_assist_answer::KnowledgeAnswer;
/// let x = KnowledgeAssistAnswer::new().set_or_clear_suggested_query_answer(Some(KnowledgeAnswer::default()/* use setters */));
/// let x = KnowledgeAssistAnswer::new().set_or_clear_suggested_query_answer(None::<KnowledgeAnswer>);
/// ```
pub fn set_or_clear_suggested_query_answer<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::knowledge_assist_answer::KnowledgeAnswer>,
{
self.suggested_query_answer = v.map(|x| x.into());
self
}
/// Sets the value of [answer_record][crate::model::KnowledgeAssistAnswer::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistAnswer;
/// let x = KnowledgeAssistAnswer::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.answer_record = v.into();
self
}
/// Sets the value of [knowledge_assist_debug_info][crate::model::KnowledgeAssistAnswer::knowledge_assist_debug_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistAnswer;
/// use google_cloud_dialogflow_v2::model::KnowledgeAssistDebugInfo;
/// let x = KnowledgeAssistAnswer::new().set_knowledge_assist_debug_info(KnowledgeAssistDebugInfo::default()/* use setters */);
/// ```
pub fn set_knowledge_assist_debug_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::KnowledgeAssistDebugInfo>,
{
self.knowledge_assist_debug_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [knowledge_assist_debug_info][crate::model::KnowledgeAssistAnswer::knowledge_assist_debug_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::KnowledgeAssistAnswer;
/// use google_cloud_dialogflow_v2::model::KnowledgeAssistDebugInfo;
/// let x = KnowledgeAssistAnswer::new().set_or_clear_knowledge_assist_debug_info(Some(KnowledgeAssistDebugInfo::default()/* use setters */));
/// let x = KnowledgeAssistAnswer::new().set_or_clear_knowledge_assist_debug_info(None::<KnowledgeAssistDebugInfo>);
/// ```
pub fn set_or_clear_knowledge_assist_debug_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::KnowledgeAssistDebugInfo>,
{
self.knowledge_assist_debug_info = v.map(|x| x.into());
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for KnowledgeAssistAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.KnowledgeAssistAnswer"
}
}
/// Defines additional types related to [KnowledgeAssistAnswer].
#[cfg(feature = "participants")]
pub mod knowledge_assist_answer {
#[allow(unused_imports)]
use super::*;
/// Represents a suggested query.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SuggestedQuery {
/// Suggested query text.
pub query_text: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl SuggestedQuery {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [query_text][crate::model::knowledge_assist_answer::SuggestedQuery::query_text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_answer::SuggestedQuery;
/// let x = SuggestedQuery::new().set_query_text("example");
/// ```
pub fn set_query_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query_text = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for SuggestedQuery {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.KnowledgeAssistAnswer.SuggestedQuery"
}
}
/// Represents an answer from Knowledge. Currently supports FAQ and Generative
/// answers.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct KnowledgeAnswer {
/// The piece of text from the `source` that answers this suggested query.
pub answer_text: std::string::String,
/// Source of result.
pub source:
std::option::Option<crate::model::knowledge_assist_answer::knowledge_answer::Source>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl KnowledgeAnswer {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [answer_text][crate::model::knowledge_assist_answer::KnowledgeAnswer::answer_text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_answer::KnowledgeAnswer;
/// let x = KnowledgeAnswer::new().set_answer_text("example");
/// ```
pub fn set_answer_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.answer_text = v.into();
self
}
/// Sets the value of [source][crate::model::knowledge_assist_answer::KnowledgeAnswer::source].
///
/// Note that all the setters affecting `source` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_answer::KnowledgeAnswer;
/// use google_cloud_dialogflow_v2::model::knowledge_assist_answer::knowledge_answer::FaqSource;
/// let x = KnowledgeAnswer::new().set_source(Some(
/// google_cloud_dialogflow_v2::model::knowledge_assist_answer::knowledge_answer::Source::FaqSource(FaqSource::default().into())));
/// ```
pub fn set_source<
T: std::convert::Into<
std::option::Option<
crate::model::knowledge_assist_answer::knowledge_answer::Source,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.source = v.into();
self
}
/// The value of [source][crate::model::knowledge_assist_answer::KnowledgeAnswer::source]
/// if it holds a `FaqSource`, `None` if the field is not set or
/// holds a different branch.
pub fn faq_source(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::knowledge_assist_answer::knowledge_answer::FaqSource>,
> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::knowledge_assist_answer::knowledge_answer::Source::FaqSource(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::knowledge_assist_answer::KnowledgeAnswer::source]
/// to hold a `FaqSource`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_answer::KnowledgeAnswer;
/// use google_cloud_dialogflow_v2::model::knowledge_assist_answer::knowledge_answer::FaqSource;
/// let x = KnowledgeAnswer::new().set_faq_source(FaqSource::default()/* use setters */);
/// assert!(x.faq_source().is_some());
/// assert!(x.generative_source().is_none());
/// ```
pub fn set_faq_source<
T: std::convert::Into<
std::boxed::Box<
crate::model::knowledge_assist_answer::knowledge_answer::FaqSource,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.source = std::option::Option::Some(
crate::model::knowledge_assist_answer::knowledge_answer::Source::FaqSource(
v.into(),
),
);
self
}
/// The value of [source][crate::model::knowledge_assist_answer::KnowledgeAnswer::source]
/// if it holds a `GenerativeSource`, `None` if the field is not set or
/// holds a different branch.
pub fn generative_source(
&self,
) -> std::option::Option<
&std::boxed::Box<
crate::model::knowledge_assist_answer::knowledge_answer::GenerativeSource,
>,
> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::knowledge_assist_answer::knowledge_answer::Source::GenerativeSource(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::knowledge_assist_answer::KnowledgeAnswer::source]
/// to hold a `GenerativeSource`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_answer::KnowledgeAnswer;
/// use google_cloud_dialogflow_v2::model::knowledge_assist_answer::knowledge_answer::GenerativeSource;
/// let x = KnowledgeAnswer::new().set_generative_source(GenerativeSource::default()/* use setters */);
/// assert!(x.generative_source().is_some());
/// assert!(x.faq_source().is_none());
/// ```
pub fn set_generative_source<
T: std::convert::Into<
std::boxed::Box<
crate::model::knowledge_assist_answer::knowledge_answer::GenerativeSource,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.source = std::option::Option::Some(
crate::model::knowledge_assist_answer::knowledge_answer::Source::GenerativeSource(
v.into(),
),
);
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for KnowledgeAnswer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.KnowledgeAssistAnswer.KnowledgeAnswer"
}
}
/// Defines additional types related to [KnowledgeAnswer].
#[cfg(feature = "participants")]
pub mod knowledge_answer {
#[allow(unused_imports)]
use super::*;
/// Details about source of FAQ answer.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FaqSource {
/// The corresponding FAQ question.
pub question: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl FaqSource {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [question][crate::model::knowledge_assist_answer::knowledge_answer::FaqSource::question].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_answer::knowledge_answer::FaqSource;
/// let x = FaqSource::new().set_question("example");
/// ```
pub fn set_question<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.question = v.into();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for FaqSource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.KnowledgeAssistAnswer.KnowledgeAnswer.FaqSource"
}
}
/// Details about source of Generative answer.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GenerativeSource {
/// All snippets used for this Generative Prediction, with their source URI
/// and data.
pub snippets: std::vec::Vec<
crate::model::knowledge_assist_answer::knowledge_answer::generative_source::Snippet,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl GenerativeSource {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [snippets][crate::model::knowledge_assist_answer::knowledge_answer::GenerativeSource::snippets].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_answer::knowledge_answer::GenerativeSource;
/// use google_cloud_dialogflow_v2::model::knowledge_assist_answer::knowledge_answer::generative_source::Snippet;
/// let x = GenerativeSource::new()
/// .set_snippets([
/// Snippet::default()/* use setters */,
/// Snippet::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_snippets<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::knowledge_assist_answer::knowledge_answer::generative_source::Snippet>
{
use std::iter::Iterator;
self.snippets = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for GenerativeSource {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.KnowledgeAssistAnswer.KnowledgeAnswer.GenerativeSource"
}
}
/// Defines additional types related to [GenerativeSource].
#[cfg(feature = "participants")]
pub mod generative_source {
#[allow(unused_imports)]
use super::*;
/// Snippet Source for a Generative Prediction.
#[cfg(feature = "participants")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Snippet {
/// URI the data is sourced from.
pub uri: std::string::String,
/// Text taken from that URI.
pub text: std::string::String,
/// Title of the document.
pub title: std::string::String,
/// Metadata of the document.
pub metadata: std::option::Option<wkt::Struct>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "participants")]
impl Snippet {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [uri][crate::model::knowledge_assist_answer::knowledge_answer::generative_source::Snippet::uri].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_answer::knowledge_answer::generative_source::Snippet;
/// let x = Snippet::new().set_uri("example");
/// ```
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
/// Sets the value of [text][crate::model::knowledge_assist_answer::knowledge_answer::generative_source::Snippet::text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_answer::knowledge_answer::generative_source::Snippet;
/// let x = Snippet::new().set_text("example");
/// ```
pub fn set_text<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.text = v.into();
self
}
/// Sets the value of [title][crate::model::knowledge_assist_answer::knowledge_answer::generative_source::Snippet::title].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_answer::knowledge_answer::generative_source::Snippet;
/// let x = Snippet::new().set_title("example");
/// ```
pub fn set_title<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.title = v.into();
self
}
/// Sets the value of [metadata][crate::model::knowledge_assist_answer::knowledge_answer::generative_source::Snippet::metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_answer::knowledge_answer::generative_source::Snippet;
/// use wkt::Struct;
/// let x = Snippet::new().set_metadata(Struct::default()/* use setters */);
/// ```
pub fn set_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.metadata = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [metadata][crate::model::knowledge_assist_answer::knowledge_answer::generative_source::Snippet::metadata].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::knowledge_assist_answer::knowledge_answer::generative_source::Snippet;
/// use wkt::Struct;
/// let x = Snippet::new().set_or_clear_metadata(Some(Struct::default()/* use setters */));
/// let x = Snippet::new().set_or_clear_metadata(None::<Struct>);
/// ```
pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.metadata = v.map(|x| x.into());
self
}
}
#[cfg(feature = "participants")]
impl wkt::message::Message for Snippet {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.KnowledgeAssistAnswer.KnowledgeAnswer.GenerativeSource.Snippet"
}
}
}
/// Source of result.
#[cfg(feature = "participants")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Source {
/// Populated if the prediction came from FAQ.
FaqSource(
std::boxed::Box<crate::model::knowledge_assist_answer::knowledge_answer::FaqSource>,
),
/// Populated if the prediction was Generative.
GenerativeSource(
std::boxed::Box<
crate::model::knowledge_assist_answer::knowledge_answer::GenerativeSource,
>,
),
}
}
}
/// The request to detect user's intent.
#[cfg(feature = "sessions")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DetectIntentRequest {
/// Required. The name of the session this query is sent to. Format:
/// `projects/<Project ID>/agent/sessions/<Session ID>`, or
/// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
/// ID>/sessions/<Session ID>`. If `Environment ID` is not specified, we assume
/// default 'draft' environment (`Environment ID` might be referred to as
/// environment name at some places). If `User ID` is not specified, we are
/// using "-". It's up to the API caller to choose an appropriate `Session ID`
/// and `User Id`. They can be a random number or some type of user and session
/// identifiers (preferably hashed). The length of the `Session ID` and
/// `User ID` must not exceed 36 characters.
///
/// For more information, see the [API interactions
/// guide](https://cloud.google.com/dialogflow/docs/api-overview).
///
/// Note: Always use agent versions for production traffic.
/// See [Versions and
/// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
pub session: std::string::String,
/// The parameters of this query.
pub query_params: std::option::Option<crate::model::QueryParameters>,
/// Required. The input specification. It can be set to:
///
/// 1. an audio config which instructs the speech recognizer how to process
/// the speech audio,
///
/// 1. a conversational query in the form of text, or
///
/// 1. an event that specifies which intent to trigger.
///
pub query_input: std::option::Option<crate::model::QueryInput>,
/// Instructs the speech synthesizer how to generate the output
/// audio. If this field is not set and agent-level speech synthesizer is not
/// configured, no output audio is generated.
pub output_audio_config: std::option::Option<crate::model::OutputAudioConfig>,
/// Mask for
/// [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config]
/// indicating which settings in this request-level config should override
/// speech synthesizer settings defined at agent-level.
///
/// If unspecified or empty,
/// [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config]
/// replaces the agent-level config in its entirety.
///
/// [google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config]: crate::model::DetectIntentRequest::output_audio_config
pub output_audio_config_mask: std::option::Option<wkt::FieldMask>,
/// The natural language speech audio to be processed. This field
/// should be populated iff `query_input` is set to an input audio config.
/// A single request can contain up to 1 minute of speech audio data.
pub input_audio: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "sessions")]
impl DetectIntentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [session][crate::model::DetectIntentRequest::session].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentRequest;
/// let x = DetectIntentRequest::new().set_session("example");
/// ```
pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session = v.into();
self
}
/// Sets the value of [query_params][crate::model::DetectIntentRequest::query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentRequest;
/// use google_cloud_dialogflow_v2::model::QueryParameters;
/// let x = DetectIntentRequest::new().set_query_params(QueryParameters::default()/* use setters */);
/// ```
pub fn set_query_params<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryParameters>,
{
self.query_params = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query_params][crate::model::DetectIntentRequest::query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentRequest;
/// use google_cloud_dialogflow_v2::model::QueryParameters;
/// let x = DetectIntentRequest::new().set_or_clear_query_params(Some(QueryParameters::default()/* use setters */));
/// let x = DetectIntentRequest::new().set_or_clear_query_params(None::<QueryParameters>);
/// ```
pub fn set_or_clear_query_params<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryParameters>,
{
self.query_params = v.map(|x| x.into());
self
}
/// Sets the value of [query_input][crate::model::DetectIntentRequest::query_input].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentRequest;
/// use google_cloud_dialogflow_v2::model::QueryInput;
/// let x = DetectIntentRequest::new().set_query_input(QueryInput::default()/* use setters */);
/// ```
pub fn set_query_input<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryInput>,
{
self.query_input = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query_input][crate::model::DetectIntentRequest::query_input].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentRequest;
/// use google_cloud_dialogflow_v2::model::QueryInput;
/// let x = DetectIntentRequest::new().set_or_clear_query_input(Some(QueryInput::default()/* use setters */));
/// let x = DetectIntentRequest::new().set_or_clear_query_input(None::<QueryInput>);
/// ```
pub fn set_or_clear_query_input<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryInput>,
{
self.query_input = v.map(|x| x.into());
self
}
/// Sets the value of [output_audio_config][crate::model::DetectIntentRequest::output_audio_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentRequest;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = DetectIntentRequest::new().set_output_audio_config(OutputAudioConfig::default()/* use setters */);
/// ```
pub fn set_output_audio_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.output_audio_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_audio_config][crate::model::DetectIntentRequest::output_audio_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentRequest;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = DetectIntentRequest::new().set_or_clear_output_audio_config(Some(OutputAudioConfig::default()/* use setters */));
/// let x = DetectIntentRequest::new().set_or_clear_output_audio_config(None::<OutputAudioConfig>);
/// ```
pub fn set_or_clear_output_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.output_audio_config = v.map(|x| x.into());
self
}
/// Sets the value of [output_audio_config_mask][crate::model::DetectIntentRequest::output_audio_config_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentRequest;
/// use wkt::FieldMask;
/// let x = DetectIntentRequest::new().set_output_audio_config_mask(FieldMask::default()/* use setters */);
/// ```
pub fn set_output_audio_config_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.output_audio_config_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_audio_config_mask][crate::model::DetectIntentRequest::output_audio_config_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentRequest;
/// use wkt::FieldMask;
/// let x = DetectIntentRequest::new().set_or_clear_output_audio_config_mask(Some(FieldMask::default()/* use setters */));
/// let x = DetectIntentRequest::new().set_or_clear_output_audio_config_mask(None::<FieldMask>);
/// ```
pub fn set_or_clear_output_audio_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.output_audio_config_mask = v.map(|x| x.into());
self
}
/// Sets the value of [input_audio][crate::model::DetectIntentRequest::input_audio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentRequest;
/// let x = DetectIntentRequest::new().set_input_audio(bytes::Bytes::from_static(b"example"));
/// ```
pub fn set_input_audio<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.input_audio = v.into();
self
}
}
#[cfg(feature = "sessions")]
impl wkt::message::Message for DetectIntentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DetectIntentRequest"
}
}
/// The message returned from the [DetectIntent][] method.
#[cfg(any(feature = "participants", feature = "sessions",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DetectIntentResponse {
/// The unique identifier of the response. It can be used to
/// locate a response in the training example set or for reporting issues.
pub response_id: std::string::String,
/// The selected results of the conversational query or event processing.
/// See `alternative_query_results` for additional potential results.
pub query_result: std::option::Option<crate::model::QueryResult>,
/// Specifies the status of the webhook request.
pub webhook_status: std::option::Option<google_cloud_rpc::model::Status>,
/// The audio data bytes encoded as specified in the request.
/// Note: The output audio is generated based on the values of default platform
/// text responses found in the `query_result.fulfillment_messages` field. If
/// multiple default text responses exist, they will be concatenated when
/// generating audio. If no default platform text responses exist, the
/// generated audio content will be empty.
///
/// In some scenarios, multiple output audio fields may be present in the
/// response structure. In these cases, only the top-most-level audio output
/// has content.
pub output_audio: ::bytes::Bytes,
/// The config used by the speech synthesizer to generate the output audio.
pub output_audio_config: std::option::Option<crate::model::OutputAudioConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl DetectIntentResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [response_id][crate::model::DetectIntentResponse::response_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentResponse;
/// let x = DetectIntentResponse::new().set_response_id("example");
/// ```
pub fn set_response_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.response_id = v.into();
self
}
/// Sets the value of [query_result][crate::model::DetectIntentResponse::query_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentResponse;
/// use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = DetectIntentResponse::new().set_query_result(QueryResult::default()/* use setters */);
/// ```
pub fn set_query_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryResult>,
{
self.query_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query_result][crate::model::DetectIntentResponse::query_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentResponse;
/// use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = DetectIntentResponse::new().set_or_clear_query_result(Some(QueryResult::default()/* use setters */));
/// let x = DetectIntentResponse::new().set_or_clear_query_result(None::<QueryResult>);
/// ```
pub fn set_or_clear_query_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryResult>,
{
self.query_result = v.map(|x| x.into());
self
}
/// Sets the value of [webhook_status][crate::model::DetectIntentResponse::webhook_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentResponse;
/// use google_cloud_rpc::model::Status;
/// let x = DetectIntentResponse::new().set_webhook_status(Status::default()/* use setters */);
/// ```
pub fn set_webhook_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.webhook_status = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [webhook_status][crate::model::DetectIntentResponse::webhook_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentResponse;
/// use google_cloud_rpc::model::Status;
/// let x = DetectIntentResponse::new().set_or_clear_webhook_status(Some(Status::default()/* use setters */));
/// let x = DetectIntentResponse::new().set_or_clear_webhook_status(None::<Status>);
/// ```
pub fn set_or_clear_webhook_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.webhook_status = v.map(|x| x.into());
self
}
/// Sets the value of [output_audio][crate::model::DetectIntentResponse::output_audio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentResponse;
/// let x = DetectIntentResponse::new().set_output_audio(bytes::Bytes::from_static(b"example"));
/// ```
pub fn set_output_audio<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.output_audio = v.into();
self
}
/// Sets the value of [output_audio_config][crate::model::DetectIntentResponse::output_audio_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentResponse;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = DetectIntentResponse::new().set_output_audio_config(OutputAudioConfig::default()/* use setters */);
/// ```
pub fn set_output_audio_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.output_audio_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_audio_config][crate::model::DetectIntentResponse::output_audio_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DetectIntentResponse;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = DetectIntentResponse::new().set_or_clear_output_audio_config(Some(OutputAudioConfig::default()/* use setters */));
/// let x = DetectIntentResponse::new().set_or_clear_output_audio_config(None::<OutputAudioConfig>);
/// ```
pub fn set_or_clear_output_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.output_audio_config = v.map(|x| x.into());
self
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl wkt::message::Message for DetectIntentResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DetectIntentResponse"
}
}
/// Represents the parameters of the conversational query.
#[cfg(any(feature = "participants", feature = "sessions",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryParameters {
/// The time zone of this conversational query from the
/// [time zone database](https://www.iana.org/time-zones), e.g.,
/// America/New_York, Europe/Paris. If not provided, the time zone specified in
/// agent settings is used.
pub time_zone: std::string::String,
/// The geo location of this conversational query.
pub geo_location: std::option::Option<google_cloud_type::model::LatLng>,
/// The collection of contexts to be activated before this query is
/// executed.
pub contexts: std::vec::Vec<crate::model::Context>,
/// Specifies whether to delete all contexts in the current session
/// before the new ones are activated.
pub reset_contexts: bool,
/// Additional session entity types to replace or extend developer
/// entity types with. The entity synonyms apply to all languages and persist
/// for the session of this query.
pub session_entity_types: std::vec::Vec<crate::model::SessionEntityType>,
/// This field can be used to pass custom data to your webhook.
/// Arbitrary JSON objects are supported.
/// If supplied, the value is used to populate the
/// `WebhookRequest.original_detect_intent_request.payload`
/// field sent to your webhook.
pub payload: std::option::Option<wkt::Struct>,
/// Configures the type of sentiment analysis to perform. If not
/// provided, sentiment analysis is not performed.
pub sentiment_analysis_request_config:
std::option::Option<crate::model::SentimentAnalysisRequestConfig>,
/// This field can be used to pass HTTP headers for a webhook
/// call. These headers will be sent to webhook along with the headers that
/// have been configured through the Dialogflow web console. The headers
/// defined within this field will overwrite the headers configured through the
/// Dialogflow console if there is a conflict. Header names are
/// case-insensitive. Google's specified headers are not allowed. Including:
/// "Host", "Content-Length", "Connection", "From", "User-Agent",
/// "Accept-Encoding", "If-Modified-Since", "If-None-Match", "X-Forwarded-For",
/// etc.
pub webhook_headers: std::collections::HashMap<std::string::String, std::string::String>,
/// The platform of the virtual agent response messages.
///
/// If not empty, only emits messages from this platform in the response.
/// Valid values are the enum names of
/// [platform][google.cloud.dialogflow.v2.Intent.Message.platform].
///
/// [google.cloud.dialogflow.v2.Intent.Message.platform]: crate::model::intent::Message::platform
pub platform: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl QueryParameters {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [time_zone][crate::model::QueryParameters::time_zone].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryParameters;
/// let x = QueryParameters::new().set_time_zone("example");
/// ```
pub fn set_time_zone<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.time_zone = v.into();
self
}
/// Sets the value of [geo_location][crate::model::QueryParameters::geo_location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryParameters;
/// use google_cloud_type::model::LatLng;
/// let x = QueryParameters::new().set_geo_location(LatLng::default()/* use setters */);
/// ```
pub fn set_geo_location<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_type::model::LatLng>,
{
self.geo_location = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [geo_location][crate::model::QueryParameters::geo_location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryParameters;
/// use google_cloud_type::model::LatLng;
/// let x = QueryParameters::new().set_or_clear_geo_location(Some(LatLng::default()/* use setters */));
/// let x = QueryParameters::new().set_or_clear_geo_location(None::<LatLng>);
/// ```
pub fn set_or_clear_geo_location<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_type::model::LatLng>,
{
self.geo_location = v.map(|x| x.into());
self
}
/// Sets the value of [contexts][crate::model::QueryParameters::contexts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryParameters;
/// use google_cloud_dialogflow_v2::model::Context;
/// let x = QueryParameters::new()
/// .set_contexts([
/// Context::default()/* use setters */,
/// Context::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_contexts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Context>,
{
use std::iter::Iterator;
self.contexts = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [reset_contexts][crate::model::QueryParameters::reset_contexts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryParameters;
/// let x = QueryParameters::new().set_reset_contexts(true);
/// ```
pub fn set_reset_contexts<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.reset_contexts = v.into();
self
}
/// Sets the value of [session_entity_types][crate::model::QueryParameters::session_entity_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryParameters;
/// use google_cloud_dialogflow_v2::model::SessionEntityType;
/// let x = QueryParameters::new()
/// .set_session_entity_types([
/// SessionEntityType::default()/* use setters */,
/// SessionEntityType::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_session_entity_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SessionEntityType>,
{
use std::iter::Iterator;
self.session_entity_types = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [payload][crate::model::QueryParameters::payload].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryParameters;
/// use wkt::Struct;
/// let x = QueryParameters::new().set_payload(Struct::default()/* use setters */);
/// ```
pub fn set_payload<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.payload = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [payload][crate::model::QueryParameters::payload].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryParameters;
/// use wkt::Struct;
/// let x = QueryParameters::new().set_or_clear_payload(Some(Struct::default()/* use setters */));
/// let x = QueryParameters::new().set_or_clear_payload(None::<Struct>);
/// ```
pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.payload = v.map(|x| x.into());
self
}
/// Sets the value of [sentiment_analysis_request_config][crate::model::QueryParameters::sentiment_analysis_request_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryParameters;
/// use google_cloud_dialogflow_v2::model::SentimentAnalysisRequestConfig;
/// let x = QueryParameters::new().set_sentiment_analysis_request_config(SentimentAnalysisRequestConfig::default()/* use setters */);
/// ```
pub fn set_sentiment_analysis_request_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SentimentAnalysisRequestConfig>,
{
self.sentiment_analysis_request_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [sentiment_analysis_request_config][crate::model::QueryParameters::sentiment_analysis_request_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryParameters;
/// use google_cloud_dialogflow_v2::model::SentimentAnalysisRequestConfig;
/// let x = QueryParameters::new().set_or_clear_sentiment_analysis_request_config(Some(SentimentAnalysisRequestConfig::default()/* use setters */));
/// let x = QueryParameters::new().set_or_clear_sentiment_analysis_request_config(None::<SentimentAnalysisRequestConfig>);
/// ```
pub fn set_or_clear_sentiment_analysis_request_config<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::SentimentAnalysisRequestConfig>,
{
self.sentiment_analysis_request_config = v.map(|x| x.into());
self
}
/// Sets the value of [webhook_headers][crate::model::QueryParameters::webhook_headers].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryParameters;
/// let x = QueryParameters::new().set_webhook_headers([
/// ("key0", "abc"),
/// ("key1", "xyz"),
/// ]);
/// ```
pub fn set_webhook_headers<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.webhook_headers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [platform][crate::model::QueryParameters::platform].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryParameters;
/// let x = QueryParameters::new().set_platform("example");
/// ```
pub fn set_platform<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.platform = v.into();
self
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl wkt::message::Message for QueryParameters {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.QueryParameters"
}
}
/// Represents the query input. It can contain either:
///
/// 1. An audio config which instructs the speech recognizer how to process the
/// speech audio.
///
/// 1. A conversational query in the form of text.
///
/// 1. An event that specifies which intent to trigger.
///
#[cfg(feature = "sessions")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryInput {
/// Required. The input specification.
pub input: std::option::Option<crate::model::query_input::Input>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "sessions")]
impl QueryInput {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [input][crate::model::QueryInput::input].
///
/// Note that all the setters affecting `input` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryInput;
/// use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = QueryInput::new().set_input(Some(
/// google_cloud_dialogflow_v2::model::query_input::Input::AudioConfig(InputAudioConfig::default().into())));
/// ```
pub fn set_input<
T: std::convert::Into<std::option::Option<crate::model::query_input::Input>>,
>(
mut self,
v: T,
) -> Self {
self.input = v.into();
self
}
/// The value of [input][crate::model::QueryInput::input]
/// if it holds a `AudioConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn audio_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::InputAudioConfig>> {
#[allow(unreachable_patterns)]
self.input.as_ref().and_then(|v| match v {
crate::model::query_input::Input::AudioConfig(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [input][crate::model::QueryInput::input]
/// to hold a `AudioConfig`.
///
/// Note that all the setters affecting `input` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryInput;
/// use google_cloud_dialogflow_v2::model::InputAudioConfig;
/// let x = QueryInput::new().set_audio_config(InputAudioConfig::default()/* use setters */);
/// assert!(x.audio_config().is_some());
/// assert!(x.text().is_none());
/// assert!(x.event().is_none());
/// ```
pub fn set_audio_config<
T: std::convert::Into<std::boxed::Box<crate::model::InputAudioConfig>>,
>(
mut self,
v: T,
) -> Self {
self.input =
std::option::Option::Some(crate::model::query_input::Input::AudioConfig(v.into()));
self
}
/// The value of [input][crate::model::QueryInput::input]
/// if it holds a `Text`, `None` if the field is not set or
/// holds a different branch.
pub fn text(&self) -> std::option::Option<&std::boxed::Box<crate::model::TextInput>> {
#[allow(unreachable_patterns)]
self.input.as_ref().and_then(|v| match v {
crate::model::query_input::Input::Text(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [input][crate::model::QueryInput::input]
/// to hold a `Text`.
///
/// Note that all the setters affecting `input` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryInput;
/// use google_cloud_dialogflow_v2::model::TextInput;
/// let x = QueryInput::new().set_text(TextInput::default()/* use setters */);
/// assert!(x.text().is_some());
/// assert!(x.audio_config().is_none());
/// assert!(x.event().is_none());
/// ```
pub fn set_text<T: std::convert::Into<std::boxed::Box<crate::model::TextInput>>>(
mut self,
v: T,
) -> Self {
self.input = std::option::Option::Some(crate::model::query_input::Input::Text(v.into()));
self
}
/// The value of [input][crate::model::QueryInput::input]
/// if it holds a `Event`, `None` if the field is not set or
/// holds a different branch.
pub fn event(&self) -> std::option::Option<&std::boxed::Box<crate::model::EventInput>> {
#[allow(unreachable_patterns)]
self.input.as_ref().and_then(|v| match v {
crate::model::query_input::Input::Event(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [input][crate::model::QueryInput::input]
/// to hold a `Event`.
///
/// Note that all the setters affecting `input` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryInput;
/// use google_cloud_dialogflow_v2::model::EventInput;
/// let x = QueryInput::new().set_event(EventInput::default()/* use setters */);
/// assert!(x.event().is_some());
/// assert!(x.audio_config().is_none());
/// assert!(x.text().is_none());
/// ```
pub fn set_event<T: std::convert::Into<std::boxed::Box<crate::model::EventInput>>>(
mut self,
v: T,
) -> Self {
self.input = std::option::Option::Some(crate::model::query_input::Input::Event(v.into()));
self
}
}
#[cfg(feature = "sessions")]
impl wkt::message::Message for QueryInput {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.QueryInput"
}
}
/// Defines additional types related to [QueryInput].
#[cfg(feature = "sessions")]
pub mod query_input {
#[allow(unused_imports)]
use super::*;
/// Required. The input specification.
#[cfg(feature = "sessions")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Input {
/// Instructs the speech recognizer how to process the speech audio.
AudioConfig(std::boxed::Box<crate::model::InputAudioConfig>),
/// The natural language text to be processed. Text length must not exceed
/// 256 character for virtual agent interactions.
Text(std::boxed::Box<crate::model::TextInput>),
/// The event to be processed.
Event(std::boxed::Box<crate::model::EventInput>),
}
}
/// Represents the result of conversational query or event processing.
#[cfg(any(
feature = "answer-records",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryResult {
/// The original conversational query text:
///
/// - If natural language text was provided as input, `query_text` contains
/// a copy of the input.
/// - If natural language speech audio was provided as input, `query_text`
/// contains the speech recognition result. If speech recognizer produced
/// multiple alternatives, a particular one is picked.
/// - If automatic spell correction is enabled, `query_text` will contain the
/// corrected user input.
pub query_text: std::string::String,
/// The language that was triggered during intent detection.
/// See [Language
/// Support](https://cloud.google.com/dialogflow/docs/reference/language)
/// for a list of the currently supported language codes.
pub language_code: std::string::String,
/// The Speech recognition confidence between 0.0 and 1.0. A higher number
/// indicates an estimated greater likelihood that the recognized words are
/// correct. The default of 0.0 is a sentinel value indicating that confidence
/// was not set.
///
/// This field is not guaranteed to be accurate or set. In particular this
/// field isn't set for [StreamingDetectIntent][] since the streaming endpoint
/// has separate confidence estimates per portion of the audio in
/// StreamingRecognitionResult.
pub speech_recognition_confidence: f32,
/// The action name from the matched intent.
pub action: std::string::String,
/// The collection of extracted parameters.
///
/// Depending on your protocol or client library language, this is a
/// map, associative array, symbol table, dictionary, or JSON object
/// composed of a collection of (MapKey, MapValue) pairs:
///
/// * MapKey type: string
/// * MapKey value: parameter name
/// * MapValue type: If parameter's entity type is a composite entity then use
/// map, otherwise, depending on the parameter value type, it could be one of
/// string, number, boolean, null, list or map.
/// * MapValue value: If parameter's entity type is a composite entity then use
/// map from composite entity property names to property values, otherwise,
/// use parameter value.
pub parameters: std::option::Option<wkt::Struct>,
/// This field is set to:
///
/// - `false` if the matched intent has required parameters and not all of
/// the required parameter values have been collected.
/// - `true` if all required parameter values have been collected, or if the
/// matched intent doesn't contain any required parameters.
pub all_required_params_present: bool,
/// Indicates whether the conversational query triggers a cancellation for slot
/// filling. For more information, see the [cancel slot filling
/// documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel).
pub cancels_slot_filling: bool,
/// The text to be pronounced to the user or shown on the screen.
/// Note: This is a legacy field, `fulfillment_messages` should be preferred.
pub fulfillment_text: std::string::String,
/// The collection of rich messages to present to the user.
pub fulfillment_messages: std::vec::Vec<crate::model::intent::Message>,
/// If the query was fulfilled by a webhook call, this field is set to the
/// value of the `source` field returned in the webhook response.
pub webhook_source: std::string::String,
/// If the query was fulfilled by a webhook call, this field is set to the
/// value of the `payload` field returned in the webhook response.
pub webhook_payload: std::option::Option<wkt::Struct>,
/// The collection of output contexts. If applicable,
/// `output_contexts.parameters` contains entries with name
/// `<parameter name>.original` containing the original parameter values
/// before the query.
pub output_contexts: std::vec::Vec<crate::model::Context>,
/// The intent that matched the conversational query. Some, not
/// all fields are filled in this message, including but not limited to:
/// `name`, `display_name`, `end_interaction` and `is_fallback`.
pub intent: std::option::Option<crate::model::Intent>,
/// The intent detection confidence. Values range from 0.0
/// (completely uncertain) to 1.0 (completely certain).
/// This value is for informational purpose only and is only used to
/// help match the best intent within the classification threshold.
/// This value may change for the same end-user expression at any time due to a
/// model retraining or change in implementation.
/// If there are `multiple knowledge_answers` messages, this value is set to
/// the greatest `knowledgeAnswers.match_confidence` value in the list.
pub intent_detection_confidence: f32,
/// Free-form diagnostic information for the associated detect intent request.
/// The fields of this data can change without notice, so you should not write
/// code that depends on its structure.
/// The data may contain:
///
/// - webhook call latency
/// - webhook errors
pub diagnostic_info: std::option::Option<wkt::Struct>,
/// The sentiment analysis result, which depends on the
/// `sentiment_analysis_request_config` specified in the request.
pub sentiment_analysis_result: std::option::Option<crate::model::SentimentAnalysisResult>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "participants",
feature = "sessions",
))]
impl QueryResult {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [query_text][crate::model::QueryResult::query_text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = QueryResult::new().set_query_text("example");
/// ```
pub fn set_query_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.query_text = v.into();
self
}
/// Sets the value of [language_code][crate::model::QueryResult::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = QueryResult::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
/// Sets the value of [speech_recognition_confidence][crate::model::QueryResult::speech_recognition_confidence].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = QueryResult::new().set_speech_recognition_confidence(42.0);
/// ```
pub fn set_speech_recognition_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.speech_recognition_confidence = v.into();
self
}
/// Sets the value of [action][crate::model::QueryResult::action].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = QueryResult::new().set_action("example");
/// ```
pub fn set_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.action = v.into();
self
}
/// Sets the value of [parameters][crate::model::QueryResult::parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// use wkt::Struct;
/// let x = QueryResult::new().set_parameters(Struct::default()/* use setters */);
/// ```
pub fn set_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.parameters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parameters][crate::model::QueryResult::parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// use wkt::Struct;
/// let x = QueryResult::new().set_or_clear_parameters(Some(Struct::default()/* use setters */));
/// let x = QueryResult::new().set_or_clear_parameters(None::<Struct>);
/// ```
pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.parameters = v.map(|x| x.into());
self
}
/// Sets the value of [all_required_params_present][crate::model::QueryResult::all_required_params_present].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = QueryResult::new().set_all_required_params_present(true);
/// ```
pub fn set_all_required_params_present<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.all_required_params_present = v.into();
self
}
/// Sets the value of [cancels_slot_filling][crate::model::QueryResult::cancels_slot_filling].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = QueryResult::new().set_cancels_slot_filling(true);
/// ```
pub fn set_cancels_slot_filling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.cancels_slot_filling = v.into();
self
}
/// Sets the value of [fulfillment_text][crate::model::QueryResult::fulfillment_text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = QueryResult::new().set_fulfillment_text("example");
/// ```
pub fn set_fulfillment_text<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.fulfillment_text = v.into();
self
}
/// Sets the value of [fulfillment_messages][crate::model::QueryResult::fulfillment_messages].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// use google_cloud_dialogflow_v2::model::intent::Message;
/// let x = QueryResult::new()
/// .set_fulfillment_messages([
/// Message::default()/* use setters */,
/// Message::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_fulfillment_messages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::Message>,
{
use std::iter::Iterator;
self.fulfillment_messages = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [webhook_source][crate::model::QueryResult::webhook_source].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = QueryResult::new().set_webhook_source("example");
/// ```
pub fn set_webhook_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.webhook_source = v.into();
self
}
/// Sets the value of [webhook_payload][crate::model::QueryResult::webhook_payload].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// use wkt::Struct;
/// let x = QueryResult::new().set_webhook_payload(Struct::default()/* use setters */);
/// ```
pub fn set_webhook_payload<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.webhook_payload = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [webhook_payload][crate::model::QueryResult::webhook_payload].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// use wkt::Struct;
/// let x = QueryResult::new().set_or_clear_webhook_payload(Some(Struct::default()/* use setters */));
/// let x = QueryResult::new().set_or_clear_webhook_payload(None::<Struct>);
/// ```
pub fn set_or_clear_webhook_payload<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.webhook_payload = v.map(|x| x.into());
self
}
/// Sets the value of [output_contexts][crate::model::QueryResult::output_contexts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// use google_cloud_dialogflow_v2::model::Context;
/// let x = QueryResult::new()
/// .set_output_contexts([
/// Context::default()/* use setters */,
/// Context::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_output_contexts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Context>,
{
use std::iter::Iterator;
self.output_contexts = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [intent][crate::model::QueryResult::intent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// use google_cloud_dialogflow_v2::model::Intent;
/// let x = QueryResult::new().set_intent(Intent::default()/* use setters */);
/// ```
pub fn set_intent<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Intent>,
{
self.intent = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [intent][crate::model::QueryResult::intent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// use google_cloud_dialogflow_v2::model::Intent;
/// let x = QueryResult::new().set_or_clear_intent(Some(Intent::default()/* use setters */));
/// let x = QueryResult::new().set_or_clear_intent(None::<Intent>);
/// ```
pub fn set_or_clear_intent<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Intent>,
{
self.intent = v.map(|x| x.into());
self
}
/// Sets the value of [intent_detection_confidence][crate::model::QueryResult::intent_detection_confidence].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = QueryResult::new().set_intent_detection_confidence(42.0);
/// ```
pub fn set_intent_detection_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.intent_detection_confidence = v.into();
self
}
/// Sets the value of [diagnostic_info][crate::model::QueryResult::diagnostic_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// use wkt::Struct;
/// let x = QueryResult::new().set_diagnostic_info(Struct::default()/* use setters */);
/// ```
pub fn set_diagnostic_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.diagnostic_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [diagnostic_info][crate::model::QueryResult::diagnostic_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// use wkt::Struct;
/// let x = QueryResult::new().set_or_clear_diagnostic_info(Some(Struct::default()/* use setters */));
/// let x = QueryResult::new().set_or_clear_diagnostic_info(None::<Struct>);
/// ```
pub fn set_or_clear_diagnostic_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.diagnostic_info = v.map(|x| x.into());
self
}
/// Sets the value of [sentiment_analysis_result][crate::model::QueryResult::sentiment_analysis_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// use google_cloud_dialogflow_v2::model::SentimentAnalysisResult;
/// let x = QueryResult::new().set_sentiment_analysis_result(SentimentAnalysisResult::default()/* use setters */);
/// ```
pub fn set_sentiment_analysis_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SentimentAnalysisResult>,
{
self.sentiment_analysis_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [sentiment_analysis_result][crate::model::QueryResult::sentiment_analysis_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::QueryResult;
/// use google_cloud_dialogflow_v2::model::SentimentAnalysisResult;
/// let x = QueryResult::new().set_or_clear_sentiment_analysis_result(Some(SentimentAnalysisResult::default()/* use setters */));
/// let x = QueryResult::new().set_or_clear_sentiment_analysis_result(None::<SentimentAnalysisResult>);
/// ```
pub fn set_or_clear_sentiment_analysis_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SentimentAnalysisResult>,
{
self.sentiment_analysis_result = v.map(|x| x.into());
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for QueryResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.QueryResult"
}
}
/// The top-level message sent by the client to the
/// [StreamingDetectIntent][] method.
///
/// Multiple request messages should be sent in order:
///
/// 1. The first message must contain
/// [session][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.session],
/// [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input]
/// plus optionally
/// [query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params].
/// If the client wants to receive an audio response, it should also contain
/// [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config].
/// The message must not contain
/// [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio].
///
/// 1. If
/// [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input]
/// was set to
/// [query_input.audio_config][google.cloud.dialogflow.v2.InputAudioConfig],
/// all subsequent messages must contain
/// [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio]
/// to continue with Speech recognition. If you decide to rather detect an
/// intent from text input after you already started Speech recognition,
/// please send a message with
/// [query_input.text][google.cloud.dialogflow.v2.QueryInput.text].
///
/// However, note that:
///
/// * Dialogflow will bill you for the audio duration so far.
/// * Dialogflow discards all Speech recognition results in favor of the
/// input text.
/// * Dialogflow will use the language code from the first message.
///
/// After you sent all input, you must half-close or abort the request stream.
///
/// [google.cloud.dialogflow.v2.InputAudioConfig]: crate::model::InputAudioConfig
/// [google.cloud.dialogflow.v2.QueryInput.text]: crate::model::QueryInput::input
/// [google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio]: crate::model::StreamingDetectIntentRequest::input_audio
/// [google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config]: crate::model::StreamingDetectIntentRequest::output_audio_config
/// [google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input]: crate::model::StreamingDetectIntentRequest::query_input
/// [google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]: crate::model::StreamingDetectIntentRequest::query_params
/// [google.cloud.dialogflow.v2.StreamingDetectIntentRequest.session]: crate::model::StreamingDetectIntentRequest::session
#[cfg(feature = "sessions")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StreamingDetectIntentRequest {
/// Required. The name of the session the query is sent to.
/// Format of the session name:
/// `projects/<Project ID>/agent/sessions/<Session ID>`, or
/// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
/// ID>/sessions/<Session ID>`. If `Environment ID` is not specified, we assume
/// default 'draft' environment. If `User ID` is not specified, we are using
/// "-". It's up to the API caller to choose an appropriate `Session ID` and
/// `User Id`. They can be a random number or some type of user and session
/// identifiers (preferably hashed). The length of the `Session ID` and
/// `User ID` must not exceed 36 characters.
///
/// For more information, see the [API interactions
/// guide](https://cloud.google.com/dialogflow/docs/api-overview).
///
/// Note: Always use agent versions for production traffic.
/// See [Versions and
/// environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
pub session: std::string::String,
/// The parameters of this query.
pub query_params: std::option::Option<crate::model::QueryParameters>,
/// Required. The input specification. It can be set to:
///
/// 1. an audio config which instructs the speech recognizer how to process
/// the speech audio,
///
/// 1. a conversational query in the form of text, or
///
/// 1. an event that specifies which intent to trigger.
///
pub query_input: std::option::Option<crate::model::QueryInput>,
/// Please use
/// [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2.InputAudioConfig.single_utterance]
/// instead. If `false` (default), recognition does not cease until the client
/// closes the stream. If `true`, the recognizer will detect a single spoken
/// utterance in input audio. Recognition ceases when it detects the audio's
/// voice has stopped or paused. In this case, once a detected intent is
/// received, the client should close the stream and start a new request with a
/// new stream as needed. This setting is ignored when `query_input` is a piece
/// of text or an event.
///
/// [google.cloud.dialogflow.v2.InputAudioConfig.single_utterance]: crate::model::InputAudioConfig::single_utterance
#[deprecated]
pub single_utterance: bool,
/// Instructs the speech synthesizer how to generate the output
/// audio. If this field is not set and agent-level speech synthesizer is not
/// configured, no output audio is generated.
pub output_audio_config: std::option::Option<crate::model::OutputAudioConfig>,
/// Mask for
/// [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config]
/// indicating which settings in this request-level config should override
/// speech synthesizer settings defined at agent-level.
///
/// If unspecified or empty,
/// [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config]
/// replaces the agent-level config in its entirety.
///
/// [google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config]: crate::model::StreamingDetectIntentRequest::output_audio_config
pub output_audio_config_mask: std::option::Option<wkt::FieldMask>,
/// The input audio content to be recognized. Must be sent if
/// `query_input` was set to a streaming input audio config. The complete audio
/// over all streaming messages must not exceed 1 minute.
pub input_audio: ::bytes::Bytes,
/// if true, `StreamingDetectIntentResponse.debugging_info` will get populated.
pub enable_debugging_info: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "sessions")]
impl StreamingDetectIntentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [session][crate::model::StreamingDetectIntentRequest::session].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentRequest;
/// let x = StreamingDetectIntentRequest::new().set_session("example");
/// ```
pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session = v.into();
self
}
/// Sets the value of [query_params][crate::model::StreamingDetectIntentRequest::query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentRequest;
/// use google_cloud_dialogflow_v2::model::QueryParameters;
/// let x = StreamingDetectIntentRequest::new().set_query_params(QueryParameters::default()/* use setters */);
/// ```
pub fn set_query_params<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryParameters>,
{
self.query_params = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query_params][crate::model::StreamingDetectIntentRequest::query_params].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentRequest;
/// use google_cloud_dialogflow_v2::model::QueryParameters;
/// let x = StreamingDetectIntentRequest::new().set_or_clear_query_params(Some(QueryParameters::default()/* use setters */));
/// let x = StreamingDetectIntentRequest::new().set_or_clear_query_params(None::<QueryParameters>);
/// ```
pub fn set_or_clear_query_params<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryParameters>,
{
self.query_params = v.map(|x| x.into());
self
}
/// Sets the value of [query_input][crate::model::StreamingDetectIntentRequest::query_input].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentRequest;
/// use google_cloud_dialogflow_v2::model::QueryInput;
/// let x = StreamingDetectIntentRequest::new().set_query_input(QueryInput::default()/* use setters */);
/// ```
pub fn set_query_input<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryInput>,
{
self.query_input = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query_input][crate::model::StreamingDetectIntentRequest::query_input].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentRequest;
/// use google_cloud_dialogflow_v2::model::QueryInput;
/// let x = StreamingDetectIntentRequest::new().set_or_clear_query_input(Some(QueryInput::default()/* use setters */));
/// let x = StreamingDetectIntentRequest::new().set_or_clear_query_input(None::<QueryInput>);
/// ```
pub fn set_or_clear_query_input<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryInput>,
{
self.query_input = v.map(|x| x.into());
self
}
/// Sets the value of [single_utterance][crate::model::StreamingDetectIntentRequest::single_utterance].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentRequest;
/// let x = StreamingDetectIntentRequest::new().set_single_utterance(true);
/// ```
#[deprecated]
pub fn set_single_utterance<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.single_utterance = v.into();
self
}
/// Sets the value of [output_audio_config][crate::model::StreamingDetectIntentRequest::output_audio_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentRequest;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = StreamingDetectIntentRequest::new().set_output_audio_config(OutputAudioConfig::default()/* use setters */);
/// ```
pub fn set_output_audio_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.output_audio_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_audio_config][crate::model::StreamingDetectIntentRequest::output_audio_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentRequest;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = StreamingDetectIntentRequest::new().set_or_clear_output_audio_config(Some(OutputAudioConfig::default()/* use setters */));
/// let x = StreamingDetectIntentRequest::new().set_or_clear_output_audio_config(None::<OutputAudioConfig>);
/// ```
pub fn set_or_clear_output_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.output_audio_config = v.map(|x| x.into());
self
}
/// Sets the value of [output_audio_config_mask][crate::model::StreamingDetectIntentRequest::output_audio_config_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentRequest;
/// use wkt::FieldMask;
/// let x = StreamingDetectIntentRequest::new().set_output_audio_config_mask(FieldMask::default()/* use setters */);
/// ```
pub fn set_output_audio_config_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.output_audio_config_mask = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_audio_config_mask][crate::model::StreamingDetectIntentRequest::output_audio_config_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentRequest;
/// use wkt::FieldMask;
/// let x = StreamingDetectIntentRequest::new().set_or_clear_output_audio_config_mask(Some(FieldMask::default()/* use setters */));
/// let x = StreamingDetectIntentRequest::new().set_or_clear_output_audio_config_mask(None::<FieldMask>);
/// ```
pub fn set_or_clear_output_audio_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.output_audio_config_mask = v.map(|x| x.into());
self
}
/// Sets the value of [input_audio][crate::model::StreamingDetectIntentRequest::input_audio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentRequest;
/// let x = StreamingDetectIntentRequest::new().set_input_audio(bytes::Bytes::from_static(b"example"));
/// ```
pub fn set_input_audio<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.input_audio = v.into();
self
}
/// Sets the value of [enable_debugging_info][crate::model::StreamingDetectIntentRequest::enable_debugging_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentRequest;
/// let x = StreamingDetectIntentRequest::new().set_enable_debugging_info(true);
/// ```
pub fn set_enable_debugging_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_debugging_info = v.into();
self
}
}
#[cfg(feature = "sessions")]
impl wkt::message::Message for StreamingDetectIntentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.StreamingDetectIntentRequest"
}
}
/// Cloud conversation info for easier debugging.
/// It will get populated in `StreamingDetectIntentResponse` or
/// `StreamingAnalyzeContentResponse` when the flag `enable_debugging_info` is
/// set to true in corresponding requests.
#[cfg(any(feature = "participants", feature = "sessions",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CloudConversationDebuggingInfo {
/// Number of input audio data chunks in streaming requests.
pub audio_data_chunks: i32,
/// Time offset of the end of speech utterance relative to the
/// beginning of the first audio chunk.
pub result_end_time_offset: std::option::Option<wkt::Duration>,
/// Duration of first audio chunk.
pub first_audio_duration: std::option::Option<wkt::Duration>,
/// Whether client used single utterance mode.
pub single_utterance: bool,
/// Time offsets of the speech partial results relative to the beginning of
/// the stream.
pub speech_partial_results_end_times: std::vec::Vec<wkt::Duration>,
/// Time offsets of the speech final results (is_final=true) relative to the
/// beginning of the stream.
pub speech_final_results_end_times: std::vec::Vec<wkt::Duration>,
/// Total number of partial responses.
pub partial_responses: i32,
/// Time offset of Speaker ID stream close time relative to the Speech stream
/// close time in milliseconds. Only meaningful for conversations involving
/// passive verification.
pub speaker_id_passive_latency_ms_offset: i32,
/// Whether a barge-in event is triggered in this request.
pub bargein_event_triggered: bool,
/// Whether speech uses single utterance mode.
pub speech_single_utterance: bool,
/// Time offsets of the DTMF partial results relative to the beginning of
/// the stream.
pub dtmf_partial_results_times: std::vec::Vec<wkt::Duration>,
/// Time offsets of the DTMF final results relative to the beginning of
/// the stream.
pub dtmf_final_results_times: std::vec::Vec<wkt::Duration>,
/// Time offset of the end-of-single-utterance signal relative to the
/// beginning of the stream.
pub single_utterance_end_time_offset: std::option::Option<wkt::Duration>,
/// No speech timeout settings for the stream.
pub no_speech_timeout: std::option::Option<wkt::Duration>,
/// Speech endpointing timeout settings for the stream.
pub endpointing_timeout: std::option::Option<wkt::Duration>,
/// Whether the streaming terminates with an injected text query.
pub is_input_text: bool,
/// Client half close time in terms of input audio duration.
pub client_half_close_time_offset: std::option::Option<wkt::Duration>,
/// Client half close time in terms of API streaming duration.
pub client_half_close_streaming_time_offset: std::option::Option<wkt::Duration>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl CloudConversationDebuggingInfo {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [audio_data_chunks][crate::model::CloudConversationDebuggingInfo::audio_data_chunks].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// let x = CloudConversationDebuggingInfo::new().set_audio_data_chunks(42);
/// ```
pub fn set_audio_data_chunks<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.audio_data_chunks = v.into();
self
}
/// Sets the value of [result_end_time_offset][crate::model::CloudConversationDebuggingInfo::result_end_time_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_result_end_time_offset(Duration::default()/* use setters */);
/// ```
pub fn set_result_end_time_offset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.result_end_time_offset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [result_end_time_offset][crate::model::CloudConversationDebuggingInfo::result_end_time_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_result_end_time_offset(Some(Duration::default()/* use setters */));
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_result_end_time_offset(None::<Duration>);
/// ```
pub fn set_or_clear_result_end_time_offset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.result_end_time_offset = v.map(|x| x.into());
self
}
/// Sets the value of [first_audio_duration][crate::model::CloudConversationDebuggingInfo::first_audio_duration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_first_audio_duration(Duration::default()/* use setters */);
/// ```
pub fn set_first_audio_duration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.first_audio_duration = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [first_audio_duration][crate::model::CloudConversationDebuggingInfo::first_audio_duration].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_first_audio_duration(Some(Duration::default()/* use setters */));
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_first_audio_duration(None::<Duration>);
/// ```
pub fn set_or_clear_first_audio_duration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.first_audio_duration = v.map(|x| x.into());
self
}
/// Sets the value of [single_utterance][crate::model::CloudConversationDebuggingInfo::single_utterance].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// let x = CloudConversationDebuggingInfo::new().set_single_utterance(true);
/// ```
pub fn set_single_utterance<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.single_utterance = v.into();
self
}
/// Sets the value of [speech_partial_results_end_times][crate::model::CloudConversationDebuggingInfo::speech_partial_results_end_times].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new()
/// .set_speech_partial_results_end_times([
/// Duration::default()/* use setters */,
/// Duration::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_speech_partial_results_end_times<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Duration>,
{
use std::iter::Iterator;
self.speech_partial_results_end_times = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [speech_final_results_end_times][crate::model::CloudConversationDebuggingInfo::speech_final_results_end_times].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new()
/// .set_speech_final_results_end_times([
/// Duration::default()/* use setters */,
/// Duration::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_speech_final_results_end_times<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Duration>,
{
use std::iter::Iterator;
self.speech_final_results_end_times = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [partial_responses][crate::model::CloudConversationDebuggingInfo::partial_responses].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// let x = CloudConversationDebuggingInfo::new().set_partial_responses(42);
/// ```
pub fn set_partial_responses<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.partial_responses = v.into();
self
}
/// Sets the value of [speaker_id_passive_latency_ms_offset][crate::model::CloudConversationDebuggingInfo::speaker_id_passive_latency_ms_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// let x = CloudConversationDebuggingInfo::new().set_speaker_id_passive_latency_ms_offset(42);
/// ```
pub fn set_speaker_id_passive_latency_ms_offset<T: std::convert::Into<i32>>(
mut self,
v: T,
) -> Self {
self.speaker_id_passive_latency_ms_offset = v.into();
self
}
/// Sets the value of [bargein_event_triggered][crate::model::CloudConversationDebuggingInfo::bargein_event_triggered].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// let x = CloudConversationDebuggingInfo::new().set_bargein_event_triggered(true);
/// ```
pub fn set_bargein_event_triggered<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.bargein_event_triggered = v.into();
self
}
/// Sets the value of [speech_single_utterance][crate::model::CloudConversationDebuggingInfo::speech_single_utterance].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// let x = CloudConversationDebuggingInfo::new().set_speech_single_utterance(true);
/// ```
pub fn set_speech_single_utterance<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.speech_single_utterance = v.into();
self
}
/// Sets the value of [dtmf_partial_results_times][crate::model::CloudConversationDebuggingInfo::dtmf_partial_results_times].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new()
/// .set_dtmf_partial_results_times([
/// Duration::default()/* use setters */,
/// Duration::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_dtmf_partial_results_times<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Duration>,
{
use std::iter::Iterator;
self.dtmf_partial_results_times = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [dtmf_final_results_times][crate::model::CloudConversationDebuggingInfo::dtmf_final_results_times].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new()
/// .set_dtmf_final_results_times([
/// Duration::default()/* use setters */,
/// Duration::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_dtmf_final_results_times<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Duration>,
{
use std::iter::Iterator;
self.dtmf_final_results_times = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [single_utterance_end_time_offset][crate::model::CloudConversationDebuggingInfo::single_utterance_end_time_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_single_utterance_end_time_offset(Duration::default()/* use setters */);
/// ```
pub fn set_single_utterance_end_time_offset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.single_utterance_end_time_offset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [single_utterance_end_time_offset][crate::model::CloudConversationDebuggingInfo::single_utterance_end_time_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_single_utterance_end_time_offset(Some(Duration::default()/* use setters */));
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_single_utterance_end_time_offset(None::<Duration>);
/// ```
pub fn set_or_clear_single_utterance_end_time_offset<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.single_utterance_end_time_offset = v.map(|x| x.into());
self
}
/// Sets the value of [no_speech_timeout][crate::model::CloudConversationDebuggingInfo::no_speech_timeout].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_no_speech_timeout(Duration::default()/* use setters */);
/// ```
pub fn set_no_speech_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.no_speech_timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [no_speech_timeout][crate::model::CloudConversationDebuggingInfo::no_speech_timeout].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_no_speech_timeout(Some(Duration::default()/* use setters */));
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_no_speech_timeout(None::<Duration>);
/// ```
pub fn set_or_clear_no_speech_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.no_speech_timeout = v.map(|x| x.into());
self
}
/// Sets the value of [endpointing_timeout][crate::model::CloudConversationDebuggingInfo::endpointing_timeout].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_endpointing_timeout(Duration::default()/* use setters */);
/// ```
pub fn set_endpointing_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.endpointing_timeout = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [endpointing_timeout][crate::model::CloudConversationDebuggingInfo::endpointing_timeout].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_endpointing_timeout(Some(Duration::default()/* use setters */));
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_endpointing_timeout(None::<Duration>);
/// ```
pub fn set_or_clear_endpointing_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.endpointing_timeout = v.map(|x| x.into());
self
}
/// Sets the value of [is_input_text][crate::model::CloudConversationDebuggingInfo::is_input_text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// let x = CloudConversationDebuggingInfo::new().set_is_input_text(true);
/// ```
pub fn set_is_input_text<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.is_input_text = v.into();
self
}
/// Sets the value of [client_half_close_time_offset][crate::model::CloudConversationDebuggingInfo::client_half_close_time_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_client_half_close_time_offset(Duration::default()/* use setters */);
/// ```
pub fn set_client_half_close_time_offset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.client_half_close_time_offset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [client_half_close_time_offset][crate::model::CloudConversationDebuggingInfo::client_half_close_time_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_client_half_close_time_offset(Some(Duration::default()/* use setters */));
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_client_half_close_time_offset(None::<Duration>);
/// ```
pub fn set_or_clear_client_half_close_time_offset<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.client_half_close_time_offset = v.map(|x| x.into());
self
}
/// Sets the value of [client_half_close_streaming_time_offset][crate::model::CloudConversationDebuggingInfo::client_half_close_streaming_time_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_client_half_close_streaming_time_offset(Duration::default()/* use setters */);
/// ```
pub fn set_client_half_close_streaming_time_offset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.client_half_close_streaming_time_offset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [client_half_close_streaming_time_offset][crate::model::CloudConversationDebuggingInfo::client_half_close_streaming_time_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// use wkt::Duration;
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_client_half_close_streaming_time_offset(Some(Duration::default()/* use setters */));
/// let x = CloudConversationDebuggingInfo::new().set_or_clear_client_half_close_streaming_time_offset(None::<Duration>);
/// ```
pub fn set_or_clear_client_half_close_streaming_time_offset<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.client_half_close_streaming_time_offset = v.map(|x| x.into());
self
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl wkt::message::Message for CloudConversationDebuggingInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CloudConversationDebuggingInfo"
}
}
/// The top-level message returned from the
/// [StreamingDetectIntent][] method.
///
/// Multiple response messages can be returned in order:
///
/// 1. If the
/// [StreamingDetectIntentRequest.input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio]
/// field was
/// set, the `recognition_result` field is populated for one
/// or more messages.
/// See the
/// [StreamingRecognitionResult][google.cloud.dialogflow.v2.StreamingRecognitionResult]
/// message for details about the result message sequence.
///
/// 1. The next message contains `response_id`, `query_result`
/// and optionally `webhook_status` if a WebHook was called.
///
///
/// [google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio]: crate::model::StreamingDetectIntentRequest::input_audio
/// [google.cloud.dialogflow.v2.StreamingRecognitionResult]: crate::model::StreamingRecognitionResult
#[cfg(feature = "sessions")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StreamingDetectIntentResponse {
/// The unique identifier of the response. It can be used to
/// locate a response in the training example set or for reporting issues.
pub response_id: std::string::String,
/// The result of speech recognition.
pub recognition_result: std::option::Option<crate::model::StreamingRecognitionResult>,
/// The result of the conversational query or event processing.
pub query_result: std::option::Option<crate::model::QueryResult>,
/// Specifies the status of the webhook request.
pub webhook_status: std::option::Option<google_cloud_rpc::model::Status>,
/// The audio data bytes encoded as specified in the request.
/// Note: The output audio is generated based on the values of default platform
/// text responses found in the `query_result.fulfillment_messages` field. If
/// multiple default text responses exist, they will be concatenated when
/// generating audio. If no default platform text responses exist, the
/// generated audio content will be empty.
///
/// In some scenarios, multiple output audio fields may be present in the
/// response structure. In these cases, only the top-most-level audio output
/// has content.
pub output_audio: ::bytes::Bytes,
/// The config used by the speech synthesizer to generate the output audio.
pub output_audio_config: std::option::Option<crate::model::OutputAudioConfig>,
/// Debugging info that would get populated when
/// [StreamingDetectIntentRequest.enable_debugging_info][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.enable_debugging_info]
/// is set to true.
///
/// [google.cloud.dialogflow.v2.StreamingDetectIntentRequest.enable_debugging_info]: crate::model::StreamingDetectIntentRequest::enable_debugging_info
pub debugging_info: std::option::Option<crate::model::CloudConversationDebuggingInfo>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "sessions")]
impl StreamingDetectIntentResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [response_id][crate::model::StreamingDetectIntentResponse::response_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentResponse;
/// let x = StreamingDetectIntentResponse::new().set_response_id("example");
/// ```
pub fn set_response_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.response_id = v.into();
self
}
/// Sets the value of [recognition_result][crate::model::StreamingDetectIntentResponse::recognition_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentResponse;
/// use google_cloud_dialogflow_v2::model::StreamingRecognitionResult;
/// let x = StreamingDetectIntentResponse::new().set_recognition_result(StreamingRecognitionResult::default()/* use setters */);
/// ```
pub fn set_recognition_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StreamingRecognitionResult>,
{
self.recognition_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [recognition_result][crate::model::StreamingDetectIntentResponse::recognition_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentResponse;
/// use google_cloud_dialogflow_v2::model::StreamingRecognitionResult;
/// let x = StreamingDetectIntentResponse::new().set_or_clear_recognition_result(Some(StreamingRecognitionResult::default()/* use setters */));
/// let x = StreamingDetectIntentResponse::new().set_or_clear_recognition_result(None::<StreamingRecognitionResult>);
/// ```
pub fn set_or_clear_recognition_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StreamingRecognitionResult>,
{
self.recognition_result = v.map(|x| x.into());
self
}
/// Sets the value of [query_result][crate::model::StreamingDetectIntentResponse::query_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentResponse;
/// use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = StreamingDetectIntentResponse::new().set_query_result(QueryResult::default()/* use setters */);
/// ```
pub fn set_query_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryResult>,
{
self.query_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query_result][crate::model::StreamingDetectIntentResponse::query_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentResponse;
/// use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = StreamingDetectIntentResponse::new().set_or_clear_query_result(Some(QueryResult::default()/* use setters */));
/// let x = StreamingDetectIntentResponse::new().set_or_clear_query_result(None::<QueryResult>);
/// ```
pub fn set_or_clear_query_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryResult>,
{
self.query_result = v.map(|x| x.into());
self
}
/// Sets the value of [webhook_status][crate::model::StreamingDetectIntentResponse::webhook_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentResponse;
/// use google_cloud_rpc::model::Status;
/// let x = StreamingDetectIntentResponse::new().set_webhook_status(Status::default()/* use setters */);
/// ```
pub fn set_webhook_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.webhook_status = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [webhook_status][crate::model::StreamingDetectIntentResponse::webhook_status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentResponse;
/// use google_cloud_rpc::model::Status;
/// let x = StreamingDetectIntentResponse::new().set_or_clear_webhook_status(Some(Status::default()/* use setters */));
/// let x = StreamingDetectIntentResponse::new().set_or_clear_webhook_status(None::<Status>);
/// ```
pub fn set_or_clear_webhook_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.webhook_status = v.map(|x| x.into());
self
}
/// Sets the value of [output_audio][crate::model::StreamingDetectIntentResponse::output_audio].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentResponse;
/// let x = StreamingDetectIntentResponse::new().set_output_audio(bytes::Bytes::from_static(b"example"));
/// ```
pub fn set_output_audio<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.output_audio = v.into();
self
}
/// Sets the value of [output_audio_config][crate::model::StreamingDetectIntentResponse::output_audio_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentResponse;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = StreamingDetectIntentResponse::new().set_output_audio_config(OutputAudioConfig::default()/* use setters */);
/// ```
pub fn set_output_audio_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.output_audio_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_audio_config][crate::model::StreamingDetectIntentResponse::output_audio_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentResponse;
/// use google_cloud_dialogflow_v2::model::OutputAudioConfig;
/// let x = StreamingDetectIntentResponse::new().set_or_clear_output_audio_config(Some(OutputAudioConfig::default()/* use setters */));
/// let x = StreamingDetectIntentResponse::new().set_or_clear_output_audio_config(None::<OutputAudioConfig>);
/// ```
pub fn set_or_clear_output_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::OutputAudioConfig>,
{
self.output_audio_config = v.map(|x| x.into());
self
}
/// Sets the value of [debugging_info][crate::model::StreamingDetectIntentResponse::debugging_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentResponse;
/// use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// let x = StreamingDetectIntentResponse::new().set_debugging_info(CloudConversationDebuggingInfo::default()/* use setters */);
/// ```
pub fn set_debugging_info<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CloudConversationDebuggingInfo>,
{
self.debugging_info = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [debugging_info][crate::model::StreamingDetectIntentResponse::debugging_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingDetectIntentResponse;
/// use google_cloud_dialogflow_v2::model::CloudConversationDebuggingInfo;
/// let x = StreamingDetectIntentResponse::new().set_or_clear_debugging_info(Some(CloudConversationDebuggingInfo::default()/* use setters */));
/// let x = StreamingDetectIntentResponse::new().set_or_clear_debugging_info(None::<CloudConversationDebuggingInfo>);
/// ```
pub fn set_or_clear_debugging_info<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CloudConversationDebuggingInfo>,
{
self.debugging_info = v.map(|x| x.into());
self
}
}
#[cfg(feature = "sessions")]
impl wkt::message::Message for StreamingDetectIntentResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.StreamingDetectIntentResponse"
}
}
/// Contains a speech recognition result corresponding to a portion of the audio
/// that is currently being processed or an indication that this is the end
/// of the single requested utterance.
///
/// While end-user audio is being processed, Dialogflow sends a series of
/// results. Each result may contain a `transcript` value. A transcript
/// represents a portion of the utterance. While the recognizer is processing
/// audio, transcript values may be interim values or finalized values.
/// Once a transcript is finalized, the `is_final` value is set to true and
/// processing continues for the next transcript.
///
/// If `StreamingDetectIntentRequest.query_input.audio_config.single_utterance`
/// was true, and the recognizer has completed processing audio,
/// the `message_type` value is set to `END_OF_SINGLE_UTTERANCE and the
/// following (last) result contains the last finalized transcript.
///
/// The complete end-user utterance is determined by concatenating the
/// finalized transcript values received for the series of results.
///
/// In the following example, single utterance is enabled. In the case where
/// single utterance is not enabled, result 7 would not occur.
///
/// ```norust
/// Num | transcript | message_type | is_final
/// --- | ----------------------- | ----------------------- | --------
/// 1 | "tube" | TRANSCRIPT | false
/// 2 | "to be a" | TRANSCRIPT | false
/// 3 | "to be" | TRANSCRIPT | false
/// 4 | "to be or not to be" | TRANSCRIPT | true
/// 5 | "that's" | TRANSCRIPT | false
/// 6 | "that is | TRANSCRIPT | false
/// 7 | unset | END_OF_SINGLE_UTTERANCE | unset
/// 8 | " that is the question" | TRANSCRIPT | true
/// ```
///
/// Concatenating the finalized transcripts with `is_final` set to true,
/// the complete utterance becomes "to be or not to be that is the question".
#[cfg(any(feature = "participants", feature = "sessions",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StreamingRecognitionResult {
/// Type of the result message.
pub message_type: crate::model::streaming_recognition_result::MessageType,
/// Transcript text representing the words that the user spoke.
/// Populated if and only if `message_type` = `TRANSCRIPT`.
pub transcript: std::string::String,
/// If `false`, the `StreamingRecognitionResult` represents an
/// interim result that may change. If `true`, the recognizer will not return
/// any further hypotheses about this piece of the audio. May only be populated
/// for `message_type` = `TRANSCRIPT`.
pub is_final: bool,
/// The Speech confidence between 0.0 and 1.0 for the current portion of audio.
/// A higher number indicates an estimated greater likelihood that the
/// recognized words are correct. The default of 0.0 is a sentinel value
/// indicating that confidence was not set.
///
/// This field is typically only provided if `is_final` is true and you should
/// not rely on it being accurate or even set.
pub confidence: f32,
/// Word-specific information for the words recognized by Speech in
/// [transcript][google.cloud.dialogflow.v2.StreamingRecognitionResult.transcript].
/// Populated if and only if `message_type` = `TRANSCRIPT` and
/// [InputAudioConfig.enable_word_info] is set.
///
/// [google.cloud.dialogflow.v2.StreamingRecognitionResult.transcript]: crate::model::StreamingRecognitionResult::transcript
pub speech_word_info: std::vec::Vec<crate::model::SpeechWordInfo>,
/// Time offset of the end of this Speech recognition result relative to the
/// beginning of the audio. Only populated for `message_type` = `TRANSCRIPT`.
pub speech_end_offset: std::option::Option<wkt::Duration>,
/// Detected language code for the transcript.
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl StreamingRecognitionResult {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [message_type][crate::model::StreamingRecognitionResult::message_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingRecognitionResult;
/// use google_cloud_dialogflow_v2::model::streaming_recognition_result::MessageType;
/// let x0 = StreamingRecognitionResult::new().set_message_type(MessageType::Transcript);
/// let x1 = StreamingRecognitionResult::new().set_message_type(MessageType::EndOfSingleUtterance);
/// ```
pub fn set_message_type<
T: std::convert::Into<crate::model::streaming_recognition_result::MessageType>,
>(
mut self,
v: T,
) -> Self {
self.message_type = v.into();
self
}
/// Sets the value of [transcript][crate::model::StreamingRecognitionResult::transcript].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingRecognitionResult;
/// let x = StreamingRecognitionResult::new().set_transcript("example");
/// ```
pub fn set_transcript<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.transcript = v.into();
self
}
/// Sets the value of [is_final][crate::model::StreamingRecognitionResult::is_final].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingRecognitionResult;
/// let x = StreamingRecognitionResult::new().set_is_final(true);
/// ```
pub fn set_is_final<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.is_final = v.into();
self
}
/// Sets the value of [confidence][crate::model::StreamingRecognitionResult::confidence].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingRecognitionResult;
/// let x = StreamingRecognitionResult::new().set_confidence(42.0);
/// ```
pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.confidence = v.into();
self
}
/// Sets the value of [speech_word_info][crate::model::StreamingRecognitionResult::speech_word_info].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingRecognitionResult;
/// use google_cloud_dialogflow_v2::model::SpeechWordInfo;
/// let x = StreamingRecognitionResult::new()
/// .set_speech_word_info([
/// SpeechWordInfo::default()/* use setters */,
/// SpeechWordInfo::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_speech_word_info<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SpeechWordInfo>,
{
use std::iter::Iterator;
self.speech_word_info = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [speech_end_offset][crate::model::StreamingRecognitionResult::speech_end_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingRecognitionResult;
/// use wkt::Duration;
/// let x = StreamingRecognitionResult::new().set_speech_end_offset(Duration::default()/* use setters */);
/// ```
pub fn set_speech_end_offset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.speech_end_offset = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [speech_end_offset][crate::model::StreamingRecognitionResult::speech_end_offset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingRecognitionResult;
/// use wkt::Duration;
/// let x = StreamingRecognitionResult::new().set_or_clear_speech_end_offset(Some(Duration::default()/* use setters */));
/// let x = StreamingRecognitionResult::new().set_or_clear_speech_end_offset(None::<Duration>);
/// ```
pub fn set_or_clear_speech_end_offset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.speech_end_offset = v.map(|x| x.into());
self
}
/// Sets the value of [language_code][crate::model::StreamingRecognitionResult::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::StreamingRecognitionResult;
/// let x = StreamingRecognitionResult::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl wkt::message::Message for StreamingRecognitionResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.StreamingRecognitionResult"
}
}
/// Defines additional types related to [StreamingRecognitionResult].
#[cfg(any(feature = "participants", feature = "sessions",))]
pub mod streaming_recognition_result {
#[allow(unused_imports)]
use super::*;
/// Type of the response message.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(feature = "participants", feature = "sessions",))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MessageType {
/// Not specified. Should never be used.
Unspecified,
/// Message contains a (possibly partial) transcript.
Transcript,
/// This event indicates that the server has detected the end of the user's
/// speech utterance and expects no additional inputs.
/// Therefore, the server will not process additional audio (although it may
/// subsequently return additional results). The client should stop sending
/// additional audio data, half-close the gRPC connection, and wait for any
/// additional results until the server closes the gRPC connection. This
/// message is only sent if `single_utterance` was set to `true`, and is not
/// used otherwise.
EndOfSingleUtterance,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [MessageType::value] or
/// [MessageType::name].
UnknownValue(message_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(feature = "participants", feature = "sessions",))]
pub mod message_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl MessageType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Transcript => std::option::Option::Some(1),
Self::EndOfSingleUtterance => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MESSAGE_TYPE_UNSPECIFIED"),
Self::Transcript => std::option::Option::Some("TRANSCRIPT"),
Self::EndOfSingleUtterance => std::option::Option::Some("END_OF_SINGLE_UTTERANCE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl std::default::Default for MessageType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl std::fmt::Display for MessageType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl std::convert::From<i32> for MessageType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Transcript,
2 => Self::EndOfSingleUtterance,
_ => Self::UnknownValue(message_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl std::convert::From<&str> for MessageType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MESSAGE_TYPE_UNSPECIFIED" => Self::Unspecified,
"TRANSCRIPT" => Self::Transcript,
"END_OF_SINGLE_UTTERANCE" => Self::EndOfSingleUtterance,
_ => Self::UnknownValue(message_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl serde::ser::Serialize for MessageType {
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::Transcript => serializer.serialize_i32(1),
Self::EndOfSingleUtterance => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl<'de> serde::de::Deserialize<'de> for MessageType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<MessageType>::new(
".google.cloud.dialogflow.v2.StreamingRecognitionResult.MessageType",
))
}
}
}
/// Auxiliary proto messages.
///
/// Represents the natural language text to be processed.
#[cfg(any(
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TextInput {
/// Required. The UTF-8 encoded natural language text to be processed.
/// Text length must not exceed 256 characters for virtual agent interactions.
pub text: std::string::String,
/// Required. The language of this conversational query. See [Language
/// Support](https://cloud.google.com/dialogflow/docs/reference/language)
/// for a list of the currently supported language codes. Note that queries in
/// the same session do not necessarily need to specify the same language.
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl TextInput {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [text][crate::model::TextInput::text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::TextInput;
/// let x = TextInput::new().set_text("example");
/// ```
pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.text = v.into();
self
}
/// Sets the value of [language_code][crate::model::TextInput::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::TextInput;
/// let x = TextInput::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for TextInput {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.TextInput"
}
}
/// Events allow for matching intents by event name instead of the natural
/// language input. For instance, input `<event: { name: "welcome_event",
/// parameters: { name: "Sam" } }>` can trigger a personalized welcome response.
/// The parameter `name` may be used by the agent in the response:
/// `"Hello #welcome_event.name! What can I do for you today?"`.
#[cfg(any(feature = "participants", feature = "sessions",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EventInput {
/// Required. The unique identifier of the event.
pub name: std::string::String,
/// The collection of parameters associated with the event.
///
/// Depending on your protocol or client library language, this is a
/// map, associative array, symbol table, dictionary, or JSON object
/// composed of a collection of (MapKey, MapValue) pairs:
///
/// * MapKey type: string
/// * MapKey value: parameter name
/// * MapValue type: If parameter's entity type is a composite entity then use
/// map, otherwise, depending on the parameter value type, it could be one of
/// string, number, boolean, null, list or map.
/// * MapValue value: If parameter's entity type is a composite entity then use
/// map from composite entity property names to property values, otherwise,
/// use parameter value.
pub parameters: std::option::Option<wkt::Struct>,
/// Required. The language of this query. See [Language
/// Support](https://cloud.google.com/dialogflow/docs/reference/language)
/// for a list of the currently supported language codes. Note that queries in
/// the same session do not necessarily need to specify the same language.
///
/// This field is ignored when used in the context of a
/// [WebhookResponse.followup_event_input][google.cloud.dialogflow.v2.WebhookResponse.followup_event_input]
/// field, because the language was already defined in the originating detect
/// intent request.
///
/// [google.cloud.dialogflow.v2.WebhookResponse.followup_event_input]: crate::model::WebhookResponse::followup_event_input
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl EventInput {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::EventInput::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EventInput;
/// let x = EventInput::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [parameters][crate::model::EventInput::parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EventInput;
/// use wkt::Struct;
/// let x = EventInput::new().set_parameters(Struct::default()/* use setters */);
/// ```
pub fn set_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.parameters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [parameters][crate::model::EventInput::parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EventInput;
/// use wkt::Struct;
/// let x = EventInput::new().set_or_clear_parameters(Some(Struct::default()/* use setters */));
/// let x = EventInput::new().set_or_clear_parameters(None::<Struct>);
/// ```
pub fn set_or_clear_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.parameters = v.map(|x| x.into());
self
}
/// Sets the value of [language_code][crate::model::EventInput::language_code].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::EventInput;
/// let x = EventInput::new().set_language_code("example");
/// ```
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl wkt::message::Message for EventInput {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.EventInput"
}
}
/// Configures the types of sentiment analysis to perform.
#[cfg(any(feature = "participants", feature = "sessions",))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SentimentAnalysisRequestConfig {
/// Instructs the service to perform sentiment analysis on
/// `query_text`. If not provided, sentiment analysis is not performed on
/// `query_text`.
pub analyze_query_text_sentiment: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl SentimentAnalysisRequestConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [analyze_query_text_sentiment][crate::model::SentimentAnalysisRequestConfig::analyze_query_text_sentiment].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SentimentAnalysisRequestConfig;
/// let x = SentimentAnalysisRequestConfig::new().set_analyze_query_text_sentiment(true);
/// ```
pub fn set_analyze_query_text_sentiment<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.analyze_query_text_sentiment = v.into();
self
}
}
#[cfg(any(feature = "participants", feature = "sessions",))]
impl wkt::message::Message for SentimentAnalysisRequestConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig"
}
}
/// The result of sentiment analysis. Sentiment analysis inspects user input
/// and identifies the prevailing subjective opinion, especially to determine a
/// user's attitude as positive, negative, or neutral.
/// For [DetectIntent][], it needs to be configured in
/// [DetectIntentRequest.query_params][google.cloud.dialogflow.v2.DetectIntentRequest.query_params].
/// For [StreamingDetectIntent][], it needs to be configured in
/// [StreamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params].
/// And for
/// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]
/// and
/// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent],
/// it needs to be configured in
/// [ConversationProfile.human_agent_assistant_config][google.cloud.dialogflow.v2.ConversationProfile.human_agent_assistant_config]
///
/// [google.cloud.dialogflow.v2.ConversationProfile.human_agent_assistant_config]: crate::model::ConversationProfile::human_agent_assistant_config
/// [google.cloud.dialogflow.v2.DetectIntentRequest.query_params]: crate::model::DetectIntentRequest::query_params
/// [google.cloud.dialogflow.v2.Participants.AnalyzeContent]: crate::client::Participants::analyze_content
/// [google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]: crate::model::StreamingDetectIntentRequest::query_params
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SentimentAnalysisResult {
/// The sentiment analysis result for `query_text`.
pub query_text_sentiment: std::option::Option<crate::model::Sentiment>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl SentimentAnalysisResult {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [query_text_sentiment][crate::model::SentimentAnalysisResult::query_text_sentiment].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SentimentAnalysisResult;
/// use google_cloud_dialogflow_v2::model::Sentiment;
/// let x = SentimentAnalysisResult::new().set_query_text_sentiment(Sentiment::default()/* use setters */);
/// ```
pub fn set_query_text_sentiment<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Sentiment>,
{
self.query_text_sentiment = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query_text_sentiment][crate::model::SentimentAnalysisResult::query_text_sentiment].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SentimentAnalysisResult;
/// use google_cloud_dialogflow_v2::model::Sentiment;
/// let x = SentimentAnalysisResult::new().set_or_clear_query_text_sentiment(Some(Sentiment::default()/* use setters */));
/// let x = SentimentAnalysisResult::new().set_or_clear_query_text_sentiment(None::<Sentiment>);
/// ```
pub fn set_or_clear_query_text_sentiment<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Sentiment>,
{
self.query_text_sentiment = v.map(|x| x.into());
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for SentimentAnalysisResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SentimentAnalysisResult"
}
}
/// The sentiment, such as positive/negative feeling or association, for a unit
/// of analysis, such as the query text. See:
/// <https://cloud.google.com/natural-language/docs/basics#interpreting_sentiment_analysis_values>
/// for how to interpret the result.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Sentiment {
/// Sentiment score between -1.0 (negative sentiment) and 1.0 (positive
/// sentiment).
pub score: f32,
/// A non-negative number in the [0, +inf) range, which represents the absolute
/// magnitude of sentiment, regardless of score (positive or negative).
pub magnitude: f32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl Sentiment {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [score][crate::model::Sentiment::score].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Sentiment;
/// let x = Sentiment::new().set_score(42.0);
/// ```
pub fn set_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.score = v.into();
self
}
/// Sets the value of [magnitude][crate::model::Sentiment::magnitude].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Sentiment;
/// let x = Sentiment::new().set_magnitude(42.0);
/// ```
pub fn set_magnitude<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.magnitude = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl wkt::message::Message for Sentiment {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Sentiment"
}
}
/// A session represents a conversation between a Dialogflow agent and an
/// end-user. You can create special entities, called session entities, during a
/// session. Session entities can extend or replace custom entity types and only
/// exist during the session that they were created for. All session data,
/// including session entities, is stored by Dialogflow for 20 minutes.
///
/// For more information, see the [session entity
/// guide](https://cloud.google.com/dialogflow/docs/entities-session).
#[cfg(any(
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SessionEntityType {
/// Required. The unique identifier of this session entity type. Format:
/// `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
/// Display Name>`, or `projects/<Project ID>/agent/environments/<Environment
/// ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display
/// Name>`.
/// If `Environment ID` is not specified, we assume default 'draft'
/// environment. If `User ID` is not specified, we assume default '-' user.
///
/// `<Entity Type Display Name>` must be the display name of an existing entity
/// type in the same agent that will be overridden or supplemented.
pub name: std::string::String,
/// Required. Indicates whether the additional data should override or
/// supplement the custom entity type definition.
pub entity_override_mode: crate::model::session_entity_type::EntityOverrideMode,
/// Required. The collection of entities associated with this session entity
/// type.
pub entities: std::vec::Vec<crate::model::entity_type::Entity>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl SessionEntityType {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::SessionEntityType::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SessionEntityType;
/// let x = SessionEntityType::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [entity_override_mode][crate::model::SessionEntityType::entity_override_mode].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SessionEntityType;
/// use google_cloud_dialogflow_v2::model::session_entity_type::EntityOverrideMode;
/// let x0 = SessionEntityType::new().set_entity_override_mode(EntityOverrideMode::Override);
/// let x1 = SessionEntityType::new().set_entity_override_mode(EntityOverrideMode::Supplement);
/// ```
pub fn set_entity_override_mode<
T: std::convert::Into<crate::model::session_entity_type::EntityOverrideMode>,
>(
mut self,
v: T,
) -> Self {
self.entity_override_mode = v.into();
self
}
/// Sets the value of [entities][crate::model::SessionEntityType::entities].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SessionEntityType;
/// use google_cloud_dialogflow_v2::model::entity_type::Entity;
/// let x = SessionEntityType::new()
/// .set_entities([
/// Entity::default()/* use setters */,
/// Entity::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_entities<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::entity_type::Entity>,
{
use std::iter::Iterator;
self.entities = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl wkt::message::Message for SessionEntityType {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SessionEntityType"
}
}
/// Defines additional types related to [SessionEntityType].
#[cfg(any(
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
pub mod session_entity_type {
#[allow(unused_imports)]
use super::*;
/// The types of modifications for a session entity type.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EntityOverrideMode {
/// Not specified. This value should be never used.
Unspecified,
/// The collection of session entities overrides the collection of entities
/// in the corresponding custom entity type.
Override,
/// The collection of session entities extends the collection of entities in
/// the corresponding custom entity type.
///
/// Note: Even in this override mode calls to `ListSessionEntityTypes`,
/// `GetSessionEntityType`, `CreateSessionEntityType` and
/// `UpdateSessionEntityType` only return the additional entities added in
/// this session entity type. If you want to get the supplemented list,
/// please call
/// [EntityTypes.GetEntityType][google.cloud.dialogflow.v2.EntityTypes.GetEntityType]
/// on the custom entity type and merge.
///
/// [google.cloud.dialogflow.v2.EntityTypes.GetEntityType]: crate::client::EntityTypes::get_entity_type
Supplement,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [EntityOverrideMode::value] or
/// [EntityOverrideMode::name].
UnknownValue(entity_override_mode::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
pub mod entity_override_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl EntityOverrideMode {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Override => std::option::Option::Some(1),
Self::Supplement => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("ENTITY_OVERRIDE_MODE_UNSPECIFIED"),
Self::Override => std::option::Option::Some("ENTITY_OVERRIDE_MODE_OVERRIDE"),
Self::Supplement => std::option::Option::Some("ENTITY_OVERRIDE_MODE_SUPPLEMENT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl std::default::Default for EntityOverrideMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl std::fmt::Display for EntityOverrideMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl std::convert::From<i32> for EntityOverrideMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Override,
2 => Self::Supplement,
_ => Self::UnknownValue(entity_override_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl std::convert::From<&str> for EntityOverrideMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ENTITY_OVERRIDE_MODE_UNSPECIFIED" => Self::Unspecified,
"ENTITY_OVERRIDE_MODE_OVERRIDE" => Self::Override,
"ENTITY_OVERRIDE_MODE_SUPPLEMENT" => Self::Supplement,
_ => Self::UnknownValue(entity_override_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl serde::ser::Serialize for EntityOverrideMode {
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::Override => serializer.serialize_i32(1),
Self::Supplement => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for EntityOverrideMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<EntityOverrideMode>::new(
".google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode",
))
}
}
}
/// The request message for
/// [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes].
///
/// [google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]: crate::client::SessionEntityTypes::list_session_entity_types
#[cfg(feature = "session-entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSessionEntityTypesRequest {
/// Required. The session to list all session entity types from.
/// Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
/// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/
/// sessions/<Session ID>`.
/// If `Environment ID` is not specified, we assume default 'draft'
/// environment. If `User ID` is not specified, we assume default '-' user.
pub parent: std::string::String,
/// Optional. The maximum number of items to return in a single page. By
/// default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "session-entity-types")]
impl ListSessionEntityTypesRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListSessionEntityTypesRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListSessionEntityTypesRequest;
/// let x = ListSessionEntityTypesRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListSessionEntityTypesRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListSessionEntityTypesRequest;
/// let x = ListSessionEntityTypesRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListSessionEntityTypesRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListSessionEntityTypesRequest;
/// let x = ListSessionEntityTypesRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "session-entity-types")]
impl wkt::message::Message for ListSessionEntityTypesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListSessionEntityTypesRequest"
}
}
/// The response message for
/// [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes].
///
/// [google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]: crate::client::SessionEntityTypes::list_session_entity_types
#[cfg(feature = "session-entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSessionEntityTypesResponse {
/// The list of session entity types. There will be a maximum number of items
/// returned based on the page_size field in the request.
pub session_entity_types: std::vec::Vec<crate::model::SessionEntityType>,
/// Token to retrieve the next page of results, or empty if there are no
/// more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "session-entity-types")]
impl ListSessionEntityTypesResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [session_entity_types][crate::model::ListSessionEntityTypesResponse::session_entity_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListSessionEntityTypesResponse;
/// use google_cloud_dialogflow_v2::model::SessionEntityType;
/// let x = ListSessionEntityTypesResponse::new()
/// .set_session_entity_types([
/// SessionEntityType::default()/* use setters */,
/// SessionEntityType::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_session_entity_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SessionEntityType>,
{
use std::iter::Iterator;
self.session_entity_types = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListSessionEntityTypesResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListSessionEntityTypesResponse;
/// let x = ListSessionEntityTypesResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "session-entity-types")]
impl wkt::message::Message for ListSessionEntityTypesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListSessionEntityTypesResponse"
}
}
#[cfg(feature = "session-entity-types")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListSessionEntityTypesResponse {
type PageItem = crate::model::SessionEntityType;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.session_entity_types
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType].
///
/// [google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType]: crate::client::SessionEntityTypes::get_session_entity_type
#[cfg(feature = "session-entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetSessionEntityTypeRequest {
/// Required. The name of the session entity type. Format:
/// `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
/// Display Name>` or `projects/<Project ID>/agent/environments/<Environment
/// ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display
/// Name>`.
/// If `Environment ID` is not specified, we assume default 'draft'
/// environment. If `User ID` is not specified, we assume default '-' user.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "session-entity-types")]
impl GetSessionEntityTypeRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetSessionEntityTypeRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetSessionEntityTypeRequest;
/// let x = GetSessionEntityTypeRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "session-entity-types")]
impl wkt::message::Message for GetSessionEntityTypeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetSessionEntityTypeRequest"
}
}
/// The request message for
/// [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType].
///
/// [google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType]: crate::client::SessionEntityTypes::create_session_entity_type
#[cfg(feature = "session-entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateSessionEntityTypeRequest {
/// Required. The session to create a session entity type for.
/// Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
/// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/
/// sessions/<Session ID>`.
/// If `Environment ID` is not specified, we assume default 'draft'
/// environment. If `User ID` is not specified, we assume default '-' user.
pub parent: std::string::String,
/// Required. The session entity type to create.
pub session_entity_type: std::option::Option<crate::model::SessionEntityType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "session-entity-types")]
impl CreateSessionEntityTypeRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateSessionEntityTypeRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateSessionEntityTypeRequest;
/// let x = CreateSessionEntityTypeRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [session_entity_type][crate::model::CreateSessionEntityTypeRequest::session_entity_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateSessionEntityTypeRequest;
/// use google_cloud_dialogflow_v2::model::SessionEntityType;
/// let x = CreateSessionEntityTypeRequest::new().set_session_entity_type(SessionEntityType::default()/* use setters */);
/// ```
pub fn set_session_entity_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SessionEntityType>,
{
self.session_entity_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [session_entity_type][crate::model::CreateSessionEntityTypeRequest::session_entity_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateSessionEntityTypeRequest;
/// use google_cloud_dialogflow_v2::model::SessionEntityType;
/// let x = CreateSessionEntityTypeRequest::new().set_or_clear_session_entity_type(Some(SessionEntityType::default()/* use setters */));
/// let x = CreateSessionEntityTypeRequest::new().set_or_clear_session_entity_type(None::<SessionEntityType>);
/// ```
pub fn set_or_clear_session_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SessionEntityType>,
{
self.session_entity_type = v.map(|x| x.into());
self
}
}
#[cfg(feature = "session-entity-types")]
impl wkt::message::Message for CreateSessionEntityTypeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest"
}
}
/// The request message for
/// [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType].
///
/// [google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType]: crate::client::SessionEntityTypes::update_session_entity_type
#[cfg(feature = "session-entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateSessionEntityTypeRequest {
/// Required. The session entity type to update.
pub session_entity_type: std::option::Option<crate::model::SessionEntityType>,
/// Optional. The mask to control which fields get updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "session-entity-types")]
impl UpdateSessionEntityTypeRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [session_entity_type][crate::model::UpdateSessionEntityTypeRequest::session_entity_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateSessionEntityTypeRequest;
/// use google_cloud_dialogflow_v2::model::SessionEntityType;
/// let x = UpdateSessionEntityTypeRequest::new().set_session_entity_type(SessionEntityType::default()/* use setters */);
/// ```
pub fn set_session_entity_type<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SessionEntityType>,
{
self.session_entity_type = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [session_entity_type][crate::model::UpdateSessionEntityTypeRequest::session_entity_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateSessionEntityTypeRequest;
/// use google_cloud_dialogflow_v2::model::SessionEntityType;
/// let x = UpdateSessionEntityTypeRequest::new().set_or_clear_session_entity_type(Some(SessionEntityType::default()/* use setters */));
/// let x = UpdateSessionEntityTypeRequest::new().set_or_clear_session_entity_type(None::<SessionEntityType>);
/// ```
pub fn set_or_clear_session_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SessionEntityType>,
{
self.session_entity_type = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateSessionEntityTypeRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateSessionEntityTypeRequest;
/// use wkt::FieldMask;
/// let x = UpdateSessionEntityTypeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateSessionEntityTypeRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateSessionEntityTypeRequest;
/// use wkt::FieldMask;
/// let x = UpdateSessionEntityTypeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateSessionEntityTypeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "session-entity-types")]
impl wkt::message::Message for UpdateSessionEntityTypeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest"
}
}
/// The request message for
/// [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType].
///
/// [google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType]: crate::client::SessionEntityTypes::delete_session_entity_type
#[cfg(feature = "session-entity-types")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteSessionEntityTypeRequest {
/// Required. The name of the entity type to delete. Format:
/// `projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type
/// Display Name>` or `projects/<Project ID>/agent/environments/<Environment
/// ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display
/// Name>`.
/// If `Environment ID` is not specified, we assume default 'draft'
/// environment. If `User ID` is not specified, we assume default '-' user.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "session-entity-types")]
impl DeleteSessionEntityTypeRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteSessionEntityTypeRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteSessionEntityTypeRequest;
/// let x = DeleteSessionEntityTypeRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "session-entity-types")]
impl wkt::message::Message for DeleteSessionEntityTypeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest"
}
}
/// The request message for
/// [SipTrunks.CreateSipTrunk][google.cloud.dialogflow.v2.SipTrunks.CreateSipTrunk].
///
/// [google.cloud.dialogflow.v2.SipTrunks.CreateSipTrunk]: crate::client::SipTrunks::create_sip_trunk
#[cfg(feature = "sip-trunks")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateSipTrunkRequest {
/// Required. The location to create a SIP trunk for.
/// Format: `projects/<Project ID>/locations/<Location ID>`.
pub parent: std::string::String,
/// Required. The SIP trunk to create.
pub sip_trunk: std::option::Option<crate::model::SipTrunk>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "sip-trunks")]
impl CreateSipTrunkRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateSipTrunkRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateSipTrunkRequest;
/// let x = CreateSipTrunkRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [sip_trunk][crate::model::CreateSipTrunkRequest::sip_trunk].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateSipTrunkRequest;
/// use google_cloud_dialogflow_v2::model::SipTrunk;
/// let x = CreateSipTrunkRequest::new().set_sip_trunk(SipTrunk::default()/* use setters */);
/// ```
pub fn set_sip_trunk<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SipTrunk>,
{
self.sip_trunk = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [sip_trunk][crate::model::CreateSipTrunkRequest::sip_trunk].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateSipTrunkRequest;
/// use google_cloud_dialogflow_v2::model::SipTrunk;
/// let x = CreateSipTrunkRequest::new().set_or_clear_sip_trunk(Some(SipTrunk::default()/* use setters */));
/// let x = CreateSipTrunkRequest::new().set_or_clear_sip_trunk(None::<SipTrunk>);
/// ```
pub fn set_or_clear_sip_trunk<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SipTrunk>,
{
self.sip_trunk = v.map(|x| x.into());
self
}
}
#[cfg(feature = "sip-trunks")]
impl wkt::message::Message for CreateSipTrunkRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateSipTrunkRequest"
}
}
/// The request message for
/// [SipTrunks.DeleteSipTrunk][google.cloud.dialogflow.v2.SipTrunks.DeleteSipTrunk].
///
/// [google.cloud.dialogflow.v2.SipTrunks.DeleteSipTrunk]: crate::client::SipTrunks::delete_sip_trunk
#[cfg(feature = "sip-trunks")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteSipTrunkRequest {
/// Required. The name of the SIP trunk to delete.
/// Format: `projects/<Project ID>/locations/<Location ID>/sipTrunks/<SipTrunk
/// ID>`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "sip-trunks")]
impl DeleteSipTrunkRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteSipTrunkRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteSipTrunkRequest;
/// let x = DeleteSipTrunkRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "sip-trunks")]
impl wkt::message::Message for DeleteSipTrunkRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteSipTrunkRequest"
}
}
/// The request message for
/// [SipTrunks.ListSipTrunks][google.cloud.dialogflow.v2.SipTrunks.ListSipTrunks].
///
/// [google.cloud.dialogflow.v2.SipTrunks.ListSipTrunks]: crate::client::SipTrunks::list_sip_trunks
#[cfg(feature = "sip-trunks")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSipTrunksRequest {
/// Required. The location to list SIP trunks from.
/// Format: `projects/<Project ID>/locations/<Location ID>`.
pub parent: std::string::String,
/// Optional. The maximum number of items to return in a single page. By
/// default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "sip-trunks")]
impl ListSipTrunksRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListSipTrunksRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListSipTrunksRequest;
/// let x = ListSipTrunksRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListSipTrunksRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListSipTrunksRequest;
/// let x = ListSipTrunksRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListSipTrunksRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListSipTrunksRequest;
/// let x = ListSipTrunksRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "sip-trunks")]
impl wkt::message::Message for ListSipTrunksRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListSipTrunksRequest"
}
}
/// The response message for
/// [SipTrunks.ListSipTrunks][google.cloud.dialogflow.v2.SipTrunks.ListSipTrunks].
///
/// [google.cloud.dialogflow.v2.SipTrunks.ListSipTrunks]: crate::client::SipTrunks::list_sip_trunks
#[cfg(feature = "sip-trunks")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListSipTrunksResponse {
/// The list of SIP trunks.
pub sip_trunks: std::vec::Vec<crate::model::SipTrunk>,
/// Token to retrieve the next page of results, or empty if there are no
/// more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "sip-trunks")]
impl ListSipTrunksResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [sip_trunks][crate::model::ListSipTrunksResponse::sip_trunks].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListSipTrunksResponse;
/// use google_cloud_dialogflow_v2::model::SipTrunk;
/// let x = ListSipTrunksResponse::new()
/// .set_sip_trunks([
/// SipTrunk::default()/* use setters */,
/// SipTrunk::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_sip_trunks<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SipTrunk>,
{
use std::iter::Iterator;
self.sip_trunks = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListSipTrunksResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListSipTrunksResponse;
/// let x = ListSipTrunksResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "sip-trunks")]
impl wkt::message::Message for ListSipTrunksResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListSipTrunksResponse"
}
}
#[cfg(feature = "sip-trunks")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListSipTrunksResponse {
type PageItem = crate::model::SipTrunk;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.sip_trunks
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [SipTrunks.GetSipTrunk][google.cloud.dialogflow.v2.SipTrunks.GetSipTrunk].
///
/// [google.cloud.dialogflow.v2.SipTrunks.GetSipTrunk]: crate::client::SipTrunks::get_sip_trunk
#[cfg(feature = "sip-trunks")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetSipTrunkRequest {
/// Required. The name of the SIP trunk to delete.
/// Format: `projects/<Project ID>/locations/<Location ID>/sipTrunks/<SipTrunk
/// ID>`.
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "sip-trunks")]
impl GetSipTrunkRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetSipTrunkRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetSipTrunkRequest;
/// let x = GetSipTrunkRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "sip-trunks")]
impl wkt::message::Message for GetSipTrunkRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetSipTrunkRequest"
}
}
/// The request message for
/// [SipTrunks.UpdateSipTrunk][google.cloud.dialogflow.v2.SipTrunks.UpdateSipTrunk].
///
/// [google.cloud.dialogflow.v2.SipTrunks.UpdateSipTrunk]: crate::client::SipTrunks::update_sip_trunk
#[cfg(feature = "sip-trunks")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateSipTrunkRequest {
/// Required. The SipTrunk to update.
pub sip_trunk: std::option::Option<crate::model::SipTrunk>,
/// Optional. The mask to control which fields get updated. If the mask is not
/// present, all fields will be updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "sip-trunks")]
impl UpdateSipTrunkRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [sip_trunk][crate::model::UpdateSipTrunkRequest::sip_trunk].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateSipTrunkRequest;
/// use google_cloud_dialogflow_v2::model::SipTrunk;
/// let x = UpdateSipTrunkRequest::new().set_sip_trunk(SipTrunk::default()/* use setters */);
/// ```
pub fn set_sip_trunk<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SipTrunk>,
{
self.sip_trunk = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [sip_trunk][crate::model::UpdateSipTrunkRequest::sip_trunk].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateSipTrunkRequest;
/// use google_cloud_dialogflow_v2::model::SipTrunk;
/// let x = UpdateSipTrunkRequest::new().set_or_clear_sip_trunk(Some(SipTrunk::default()/* use setters */));
/// let x = UpdateSipTrunkRequest::new().set_or_clear_sip_trunk(None::<SipTrunk>);
/// ```
pub fn set_or_clear_sip_trunk<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SipTrunk>,
{
self.sip_trunk = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateSipTrunkRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateSipTrunkRequest;
/// use wkt::FieldMask;
/// let x = UpdateSipTrunkRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateSipTrunkRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateSipTrunkRequest;
/// use wkt::FieldMask;
/// let x = UpdateSipTrunkRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateSipTrunkRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "sip-trunks")]
impl wkt::message::Message for UpdateSipTrunkRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateSipTrunkRequest"
}
}
/// SipTrunk is the resource that represents a SIP trunk to connect to Google
/// Telephony platform SIP trunking service.
#[cfg(feature = "sip-trunks")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SipTrunk {
/// Identifier. The unique identifier of the SIP trunk.
/// Format: `projects/<Project ID>/locations/<Location ID>/sipTrunks/<SipTrunk
/// ID>`.
pub name: std::string::String,
/// Required. The expected hostnames in the peer certificate from partner that
/// is used for TLS authentication.
pub expected_hostname: std::vec::Vec<std::string::String>,
/// Output only. Connections of the SIP trunk.
pub connections: std::vec::Vec<crate::model::Connection>,
/// Optional. Human readable alias for this trunk.
pub display_name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "sip-trunks")]
impl SipTrunk {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::SipTrunk::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SipTrunk;
/// let x = SipTrunk::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [expected_hostname][crate::model::SipTrunk::expected_hostname].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SipTrunk;
/// let x = SipTrunk::new().set_expected_hostname(["a", "b", "c"]);
/// ```
pub fn set_expected_hostname<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.expected_hostname = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [connections][crate::model::SipTrunk::connections].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SipTrunk;
/// use google_cloud_dialogflow_v2::model::Connection;
/// let x = SipTrunk::new()
/// .set_connections([
/// Connection::default()/* use setters */,
/// Connection::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_connections<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Connection>,
{
use std::iter::Iterator;
self.connections = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [display_name][crate::model::SipTrunk::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::SipTrunk;
/// let x = SipTrunk::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
}
#[cfg(feature = "sip-trunks")]
impl wkt::message::Message for SipTrunk {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.SipTrunk"
}
}
/// Represents a connection for SIP Trunk.
#[cfg(feature = "sip-trunks")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Connection {
/// Output only. The unique identifier of the SIP Trunk connection.
pub connection_id: std::string::String,
/// Output only. State of the connection.
pub state: crate::model::connection::State,
/// Output only. When the connection status changed.
pub update_time: std::option::Option<wkt::Timestamp>,
/// Output only. The error details for the connection. Only populated when
/// authentication errors occur.
pub error_details: std::option::Option<crate::model::connection::ErrorDetails>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "sip-trunks")]
impl Connection {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [connection_id][crate::model::Connection::connection_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Connection;
/// let x = Connection::new().set_connection_id("example");
/// ```
pub fn set_connection_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.connection_id = v.into();
self
}
/// Sets the value of [state][crate::model::Connection::state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Connection;
/// use google_cloud_dialogflow_v2::model::connection::State;
/// let x0 = Connection::new().set_state(State::Connected);
/// let x1 = Connection::new().set_state(State::Disconnected);
/// let x2 = Connection::new().set_state(State::AuthenticationFailed);
/// ```
pub fn set_state<T: std::convert::Into<crate::model::connection::State>>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
/// Sets the value of [update_time][crate::model::Connection::update_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Connection;
/// use wkt::Timestamp;
/// let x = Connection::new().set_update_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_time][crate::model::Connection::update_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Connection;
/// use wkt::Timestamp;
/// let x = Connection::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
/// let x = Connection::new().set_or_clear_update_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [error_details][crate::model::Connection::error_details].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Connection;
/// use google_cloud_dialogflow_v2::model::connection::ErrorDetails;
/// let x = Connection::new().set_error_details(ErrorDetails::default()/* use setters */);
/// ```
pub fn set_error_details<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::connection::ErrorDetails>,
{
self.error_details = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [error_details][crate::model::Connection::error_details].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Connection;
/// use google_cloud_dialogflow_v2::model::connection::ErrorDetails;
/// let x = Connection::new().set_or_clear_error_details(Some(ErrorDetails::default()/* use setters */));
/// let x = Connection::new().set_or_clear_error_details(None::<ErrorDetails>);
/// ```
pub fn set_or_clear_error_details<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::connection::ErrorDetails>,
{
self.error_details = v.map(|x| x.into());
self
}
}
#[cfg(feature = "sip-trunks")]
impl wkt::message::Message for Connection {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Connection"
}
}
/// Defines additional types related to [Connection].
#[cfg(feature = "sip-trunks")]
pub mod connection {
#[allow(unused_imports)]
use super::*;
/// The error details of Sip Trunk connection authentication.
#[cfg(feature = "sip-trunks")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ErrorDetails {
/// Output only. The status of the certificate authentication.
pub certificate_state: std::option::Option<crate::model::connection::CertificateState>,
/// The error message provided from SIP trunking auth service
pub error_message: std::option::Option<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "sip-trunks")]
impl ErrorDetails {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [certificate_state][crate::model::connection::ErrorDetails::certificate_state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::connection::ErrorDetails;
/// use google_cloud_dialogflow_v2::model::connection::CertificateState;
/// let x0 = ErrorDetails::new().set_certificate_state(CertificateState::CertificateValid);
/// let x1 = ErrorDetails::new().set_certificate_state(CertificateState::CertificateInvalid);
/// let x2 = ErrorDetails::new().set_certificate_state(CertificateState::CertificateExpired);
/// ```
pub fn set_certificate_state<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::connection::CertificateState>,
{
self.certificate_state = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [certificate_state][crate::model::connection::ErrorDetails::certificate_state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::connection::ErrorDetails;
/// use google_cloud_dialogflow_v2::model::connection::CertificateState;
/// let x0 = ErrorDetails::new().set_or_clear_certificate_state(Some(CertificateState::CertificateValid));
/// let x1 = ErrorDetails::new().set_or_clear_certificate_state(Some(CertificateState::CertificateInvalid));
/// let x2 = ErrorDetails::new().set_or_clear_certificate_state(Some(CertificateState::CertificateExpired));
/// let x_none = ErrorDetails::new().set_or_clear_certificate_state(None::<CertificateState>);
/// ```
pub fn set_or_clear_certificate_state<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::connection::CertificateState>,
{
self.certificate_state = v.map(|x| x.into());
self
}
/// Sets the value of [error_message][crate::model::connection::ErrorDetails::error_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::connection::ErrorDetails;
/// let x = ErrorDetails::new().set_error_message("example");
/// ```
pub fn set_error_message<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.error_message = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [error_message][crate::model::connection::ErrorDetails::error_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::connection::ErrorDetails;
/// let x = ErrorDetails::new().set_or_clear_error_message(Some("example"));
/// let x = ErrorDetails::new().set_or_clear_error_message(None::<String>);
/// ```
pub fn set_or_clear_error_message<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.error_message = v.map(|x| x.into());
self
}
}
#[cfg(feature = "sip-trunks")]
impl wkt::message::Message for ErrorDetails {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Connection.ErrorDetails"
}
}
/// The state of Sip Trunk connection.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "sip-trunks")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
/// SIP Trunk connection state is Not specified.
Unspecified,
/// SIP Trunk connection is connected.
Connected,
/// SIP Trunk connection is disconnected.
Disconnected,
/// SIP Trunk connection has authentication error.
AuthenticationFailed,
/// SIP Trunk connection is keepalive.
Keepalive,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [State::value] or
/// [State::name].
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "sip-trunks")]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "sip-trunks")]
impl State {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Connected => std::option::Option::Some(1),
Self::Disconnected => std::option::Option::Some(2),
Self::AuthenticationFailed => std::option::Option::Some(3),
Self::Keepalive => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Connected => std::option::Option::Some("CONNECTED"),
Self::Disconnected => std::option::Option::Some("DISCONNECTED"),
Self::AuthenticationFailed => std::option::Option::Some("AUTHENTICATION_FAILED"),
Self::Keepalive => std::option::Option::Some("KEEPALIVE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "sip-trunks")]
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "sip-trunks")]
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())
}
}
#[cfg(feature = "sip-trunks")]
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Connected,
2 => Self::Disconnected,
3 => Self::AuthenticationFailed,
4 => Self::Keepalive,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "sip-trunks")]
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"CONNECTED" => Self::Connected,
"DISCONNECTED" => Self::Disconnected,
"AUTHENTICATION_FAILED" => Self::AuthenticationFailed,
"KEEPALIVE" => Self::Keepalive,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "sip-trunks")]
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::Connected => serializer.serialize_i32(1),
Self::Disconnected => serializer.serialize_i32(2),
Self::AuthenticationFailed => serializer.serialize_i32(3),
Self::Keepalive => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "sip-trunks")]
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.dialogflow.v2.Connection.State",
))
}
}
/// The state of Sip Trunk certificate authentication.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "sip-trunks")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum CertificateState {
/// Certificate state is not specified.
Unspecified,
/// Certificate is valid.
CertificateValid,
/// Catch all for any error not specified.
CertificateInvalid,
/// Certificate leaf node has expired.
CertificateExpired,
/// There is no hostname defined to authenticate in SipTrunkingServer.
CertificateHostnameNotFound,
/// No path found from the leaf certificate to any root.
CertificateUnauthenticated,
/// Trust store does not exist.
CertificateTrustStoreNotFound,
/// Hostname has invalid format.
CertificateHostnameInvalidFormat,
/// Certificate has exhausted its quota.
CertificateQuotaExceeded,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [CertificateState::value] or
/// [CertificateState::name].
UnknownValue(certificate_state::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "sip-trunks")]
pub mod certificate_state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "sip-trunks")]
impl CertificateState {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::CertificateValid => std::option::Option::Some(1),
Self::CertificateInvalid => std::option::Option::Some(2),
Self::CertificateExpired => std::option::Option::Some(3),
Self::CertificateHostnameNotFound => std::option::Option::Some(4),
Self::CertificateUnauthenticated => std::option::Option::Some(5),
Self::CertificateTrustStoreNotFound => std::option::Option::Some(6),
Self::CertificateHostnameInvalidFormat => std::option::Option::Some(7),
Self::CertificateQuotaExceeded => std::option::Option::Some(8),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CERTIFICATE_STATE_UNSPECIFIED"),
Self::CertificateValid => std::option::Option::Some("CERTIFICATE_VALID"),
Self::CertificateInvalid => std::option::Option::Some("CERTIFICATE_INVALID"),
Self::CertificateExpired => std::option::Option::Some("CERTIFICATE_EXPIRED"),
Self::CertificateHostnameNotFound => {
std::option::Option::Some("CERTIFICATE_HOSTNAME_NOT_FOUND")
}
Self::CertificateUnauthenticated => {
std::option::Option::Some("CERTIFICATE_UNAUTHENTICATED")
}
Self::CertificateTrustStoreNotFound => {
std::option::Option::Some("CERTIFICATE_TRUST_STORE_NOT_FOUND")
}
Self::CertificateHostnameInvalidFormat => {
std::option::Option::Some("CERTIFICATE_HOSTNAME_INVALID_FORMAT")
}
Self::CertificateQuotaExceeded => {
std::option::Option::Some("CERTIFICATE_QUOTA_EXCEEDED")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "sip-trunks")]
impl std::default::Default for CertificateState {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "sip-trunks")]
impl std::fmt::Display for CertificateState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "sip-trunks")]
impl std::convert::From<i32> for CertificateState {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::CertificateValid,
2 => Self::CertificateInvalid,
3 => Self::CertificateExpired,
4 => Self::CertificateHostnameNotFound,
5 => Self::CertificateUnauthenticated,
6 => Self::CertificateTrustStoreNotFound,
7 => Self::CertificateHostnameInvalidFormat,
8 => Self::CertificateQuotaExceeded,
_ => Self::UnknownValue(certificate_state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "sip-trunks")]
impl std::convert::From<&str> for CertificateState {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CERTIFICATE_STATE_UNSPECIFIED" => Self::Unspecified,
"CERTIFICATE_VALID" => Self::CertificateValid,
"CERTIFICATE_INVALID" => Self::CertificateInvalid,
"CERTIFICATE_EXPIRED" => Self::CertificateExpired,
"CERTIFICATE_HOSTNAME_NOT_FOUND" => Self::CertificateHostnameNotFound,
"CERTIFICATE_UNAUTHENTICATED" => Self::CertificateUnauthenticated,
"CERTIFICATE_TRUST_STORE_NOT_FOUND" => Self::CertificateTrustStoreNotFound,
"CERTIFICATE_HOSTNAME_INVALID_FORMAT" => Self::CertificateHostnameInvalidFormat,
"CERTIFICATE_QUOTA_EXCEEDED" => Self::CertificateQuotaExceeded,
_ => Self::UnknownValue(certificate_state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "sip-trunks")]
impl serde::ser::Serialize for CertificateState {
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::CertificateValid => serializer.serialize_i32(1),
Self::CertificateInvalid => serializer.serialize_i32(2),
Self::CertificateExpired => serializer.serialize_i32(3),
Self::CertificateHostnameNotFound => serializer.serialize_i32(4),
Self::CertificateUnauthenticated => serializer.serialize_i32(5),
Self::CertificateTrustStoreNotFound => serializer.serialize_i32(6),
Self::CertificateHostnameInvalidFormat => serializer.serialize_i32(7),
Self::CertificateQuotaExceeded => serializer.serialize_i32(8),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "sip-trunks")]
impl<'de> serde::de::Deserialize<'de> for CertificateState {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<CertificateState>::new(
".google.cloud.dialogflow.v2.Connection.CertificateState",
))
}
}
}
/// Request message of CreateTool.
#[cfg(feature = "tools")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateToolRequest {
/// Required. The project/location to create tool for. Format:
/// `projects/<Project ID>/locations/<Location ID>`
pub parent: std::string::String,
/// Required. The tool to create.
pub tool: std::option::Option<crate::model::Tool>,
/// Optional. The ID to use for the tool, which will become the final
/// component of the tool's resource name.
///
/// The tool ID must be compliant with the regression formula
/// `[a-zA-Z][a-zA-Z0-9_-]*` with the characters length in range of [3,64].
/// If the field is not provide, an Id will be auto-generated.
/// If the field is provided, the caller is responsible for
///
/// 1. the uniqueness of the ID, otherwise the request will be rejected.
/// 1. the consistency for whether to use custom ID or not under a project to
/// better ensure uniqueness.
pub tool_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "tools")]
impl CreateToolRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateToolRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateToolRequest;
/// let x = CreateToolRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [tool][crate::model::CreateToolRequest::tool].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateToolRequest;
/// use google_cloud_dialogflow_v2::model::Tool;
/// let x = CreateToolRequest::new().set_tool(Tool::default()/* use setters */);
/// ```
pub fn set_tool<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Tool>,
{
self.tool = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tool][crate::model::CreateToolRequest::tool].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateToolRequest;
/// use google_cloud_dialogflow_v2::model::Tool;
/// let x = CreateToolRequest::new().set_or_clear_tool(Some(Tool::default()/* use setters */));
/// let x = CreateToolRequest::new().set_or_clear_tool(None::<Tool>);
/// ```
pub fn set_or_clear_tool<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Tool>,
{
self.tool = v.map(|x| x.into());
self
}
/// Sets the value of [tool_id][crate::model::CreateToolRequest::tool_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateToolRequest;
/// let x = CreateToolRequest::new().set_tool_id("example");
/// ```
pub fn set_tool_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.tool_id = v.into();
self
}
}
#[cfg(feature = "tools")]
impl wkt::message::Message for CreateToolRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateToolRequest"
}
}
/// Request message of GetTool.
#[cfg(feature = "tools")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetToolRequest {
/// Required. The tool resource name to retrieve. Format:
/// `projects/<Project ID>/locations/<Location ID>/tools/<Tool ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "tools")]
impl GetToolRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetToolRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetToolRequest;
/// let x = GetToolRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "tools")]
impl wkt::message::Message for GetToolRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetToolRequest"
}
}
/// Request message of ListTools.
#[cfg(feature = "tools")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListToolsRequest {
/// Required. The project/location to list tools for. Format:
/// `projects/<Project ID>/locations/<Location ID>`
pub parent: std::string::String,
/// Optional. Maximum number of conversation models to return in a single page.
/// Default to 10.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "tools")]
impl ListToolsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListToolsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListToolsRequest;
/// let x = ListToolsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListToolsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListToolsRequest;
/// let x = ListToolsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListToolsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListToolsRequest;
/// let x = ListToolsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "tools")]
impl wkt::message::Message for ListToolsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListToolsRequest"
}
}
/// Response of ListTools.
#[cfg(feature = "tools")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListToolsResponse {
/// List of tools retrieved.
pub tools: std::vec::Vec<crate::model::Tool>,
/// Token to retrieve the next page of results, or empty if there are no more
/// results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "tools")]
impl ListToolsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [tools][crate::model::ListToolsResponse::tools].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListToolsResponse;
/// use google_cloud_dialogflow_v2::model::Tool;
/// let x = ListToolsResponse::new()
/// .set_tools([
/// Tool::default()/* use setters */,
/// Tool::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_tools<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Tool>,
{
use std::iter::Iterator;
self.tools = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListToolsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListToolsResponse;
/// let x = ListToolsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "tools")]
impl wkt::message::Message for ListToolsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListToolsResponse"
}
}
#[cfg(feature = "tools")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListToolsResponse {
type PageItem = crate::model::Tool;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.tools
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// Request of DeleteTool.
#[cfg(feature = "tools")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteToolRequest {
/// Required. The tool resource name to delete. Format:
/// `projects/<Project ID>/locations/<Location ID>/tools/<Tool ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "tools")]
impl DeleteToolRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteToolRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteToolRequest;
/// let x = DeleteToolRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "tools")]
impl wkt::message::Message for DeleteToolRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteToolRequest"
}
}
/// Request of UpdateTool.
#[cfg(feature = "tools")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateToolRequest {
/// Required. The tool to update.
/// The name field of tool is to identify the tool to
/// update.
pub tool: std::option::Option<crate::model::Tool>,
/// Optional. The list of fields to update.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "tools")]
impl UpdateToolRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [tool][crate::model::UpdateToolRequest::tool].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateToolRequest;
/// use google_cloud_dialogflow_v2::model::Tool;
/// let x = UpdateToolRequest::new().set_tool(Tool::default()/* use setters */);
/// ```
pub fn set_tool<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Tool>,
{
self.tool = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tool][crate::model::UpdateToolRequest::tool].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateToolRequest;
/// use google_cloud_dialogflow_v2::model::Tool;
/// let x = UpdateToolRequest::new().set_or_clear_tool(Some(Tool::default()/* use setters */));
/// let x = UpdateToolRequest::new().set_or_clear_tool(None::<Tool>);
/// ```
pub fn set_or_clear_tool<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Tool>,
{
self.tool = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateToolRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateToolRequest;
/// use wkt::FieldMask;
/// let x = UpdateToolRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateToolRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateToolRequest;
/// use wkt::FieldMask;
/// let x = UpdateToolRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateToolRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "tools")]
impl wkt::message::Message for UpdateToolRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateToolRequest"
}
}
/// Represents a tool.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Tool {
/// Output only. Identifier. The resource name of the tool. Format:
/// `projects/<Project ID>/locations/<Location ID>/tools/<Tool ID>`.
pub name: std::string::String,
/// Required. A human readable short name of the tool, which should be unique
/// within the project. It should only contain letters, numbers, and
/// underscores, and it will be used by LLM to identify the tool.
pub tool_key: std::string::String,
/// Optional. A human readable short name of the tool, to be shown on the UI.
pub display_name: std::string::String,
/// Optional. A human readable description of the tool.
pub description: std::string::String,
/// Optional. Confirmation requirement for the actions. Each key is an action
/// name in the action_schemas. If an action's confirmation requirement is
/// unspecified (either the key is not present, or its value is
/// CONFIRMATION_REQUIREMENT_UNSPECIFIED), the requirement is inferred from the
/// action's method_type - confirmation is not required if and only if
/// method_type is GET.
pub action_confirmation_requirement:
std::collections::HashMap<std::string::String, crate::model::tool::ConfirmationRequirement>,
/// Output only. Creation time of this tool.
pub create_time: std::option::Option<wkt::Timestamp>,
/// Output only. Update time of this tool.
pub update_time: std::option::Option<wkt::Timestamp>,
/// Output only. A read only boolean field reflecting Zone Separation
/// status of the tool. If the field is absent, it means the status is unknown.
pub satisfies_pzs: std::option::Option<bool>,
/// Output only. A read only boolean field reflecting Zone Isolation status
/// of the tool. If the field is absent, it means the status is unknown.
pub satisfies_pzi: std::option::Option<bool>,
/// Specification of the Tool.
pub specification: std::option::Option<crate::model::tool::Specification>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl Tool {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::Tool::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// let x = Tool::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [tool_key][crate::model::Tool::tool_key].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// let x = Tool::new().set_tool_key("example");
/// ```
pub fn set_tool_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.tool_key = v.into();
self
}
/// Sets the value of [display_name][crate::model::Tool::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// let x = Tool::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [description][crate::model::Tool::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// let x = Tool::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
/// Sets the value of [action_confirmation_requirement][crate::model::Tool::action_confirmation_requirement].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// use google_cloud_dialogflow_v2::model::tool::ConfirmationRequirement;
/// let x = Tool::new().set_action_confirmation_requirement([
/// ("key0", ConfirmationRequirement::Required),
/// ("key1", ConfirmationRequirement::NotRequired),
/// ]);
/// ```
pub fn set_action_confirmation_requirement<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::tool::ConfirmationRequirement>,
{
use std::iter::Iterator;
self.action_confirmation_requirement =
v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
/// Sets the value of [create_time][crate::model::Tool::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// use wkt::Timestamp;
/// let x = Tool::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::Tool::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// use wkt::Timestamp;
/// let x = Tool::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = Tool::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [update_time][crate::model::Tool::update_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// use wkt::Timestamp;
/// let x = Tool::new().set_update_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_time][crate::model::Tool::update_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// use wkt::Timestamp;
/// let x = Tool::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
/// let x = Tool::new().set_or_clear_update_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [satisfies_pzs][crate::model::Tool::satisfies_pzs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// let x = Tool::new().set_satisfies_pzs(true);
/// ```
pub fn set_satisfies_pzs<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzs = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [satisfies_pzs][crate::model::Tool::satisfies_pzs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// let x = Tool::new().set_or_clear_satisfies_pzs(Some(false));
/// let x = Tool::new().set_or_clear_satisfies_pzs(None::<bool>);
/// ```
pub fn set_or_clear_satisfies_pzs<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzs = v.map(|x| x.into());
self
}
/// Sets the value of [satisfies_pzi][crate::model::Tool::satisfies_pzi].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// let x = Tool::new().set_satisfies_pzi(true);
/// ```
pub fn set_satisfies_pzi<T>(mut self, v: T) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzi = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [satisfies_pzi][crate::model::Tool::satisfies_pzi].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// let x = Tool::new().set_or_clear_satisfies_pzi(Some(false));
/// let x = Tool::new().set_or_clear_satisfies_pzi(None::<bool>);
/// ```
pub fn set_or_clear_satisfies_pzi<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<bool>,
{
self.satisfies_pzi = v.map(|x| x.into());
self
}
/// Sets the value of [specification][crate::model::Tool::specification].
///
/// Note that all the setters affecting `specification` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// use google_cloud_dialogflow_v2::model::tool::FunctionTool;
/// let x = Tool::new().set_specification(Some(
/// google_cloud_dialogflow_v2::model::tool::Specification::FunctionSpec(FunctionTool::default().into())));
/// ```
pub fn set_specification<
T: std::convert::Into<std::option::Option<crate::model::tool::Specification>>,
>(
mut self,
v: T,
) -> Self {
self.specification = v.into();
self
}
/// The value of [specification][crate::model::Tool::specification]
/// if it holds a `ExtensionSpec`, `None` if the field is not set or
/// holds a different branch.
#[deprecated]
pub fn extension_spec(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::tool::ExtensionTool>> {
#[allow(unreachable_patterns)]
self.specification.as_ref().and_then(|v| match v {
crate::model::tool::Specification::ExtensionSpec(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [specification][crate::model::Tool::specification]
/// to hold a `ExtensionSpec`.
///
/// Note that all the setters affecting `specification` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// use google_cloud_dialogflow_v2::model::tool::ExtensionTool;
/// let x = Tool::new().set_extension_spec(ExtensionTool::default()/* use setters */);
/// assert!(x.extension_spec().is_some());
/// assert!(x.function_spec().is_none());
/// assert!(x.connector_spec().is_none());
/// assert!(x.open_api_spec().is_none());
/// ```
#[deprecated]
pub fn set_extension_spec<
T: std::convert::Into<std::boxed::Box<crate::model::tool::ExtensionTool>>,
>(
mut self,
v: T,
) -> Self {
self.specification =
std::option::Option::Some(crate::model::tool::Specification::ExtensionSpec(v.into()));
self
}
/// The value of [specification][crate::model::Tool::specification]
/// if it holds a `FunctionSpec`, `None` if the field is not set or
/// holds a different branch.
pub fn function_spec(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::tool::FunctionTool>> {
#[allow(unreachable_patterns)]
self.specification.as_ref().and_then(|v| match v {
crate::model::tool::Specification::FunctionSpec(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [specification][crate::model::Tool::specification]
/// to hold a `FunctionSpec`.
///
/// Note that all the setters affecting `specification` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// use google_cloud_dialogflow_v2::model::tool::FunctionTool;
/// let x = Tool::new().set_function_spec(FunctionTool::default()/* use setters */);
/// assert!(x.function_spec().is_some());
/// assert!(x.extension_spec().is_none());
/// assert!(x.connector_spec().is_none());
/// assert!(x.open_api_spec().is_none());
/// ```
pub fn set_function_spec<
T: std::convert::Into<std::boxed::Box<crate::model::tool::FunctionTool>>,
>(
mut self,
v: T,
) -> Self {
self.specification =
std::option::Option::Some(crate::model::tool::Specification::FunctionSpec(v.into()));
self
}
/// The value of [specification][crate::model::Tool::specification]
/// if it holds a `ConnectorSpec`, `None` if the field is not set or
/// holds a different branch.
pub fn connector_spec(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::tool::ConnectorTool>> {
#[allow(unreachable_patterns)]
self.specification.as_ref().and_then(|v| match v {
crate::model::tool::Specification::ConnectorSpec(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [specification][crate::model::Tool::specification]
/// to hold a `ConnectorSpec`.
///
/// Note that all the setters affecting `specification` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// use google_cloud_dialogflow_v2::model::tool::ConnectorTool;
/// let x = Tool::new().set_connector_spec(ConnectorTool::default()/* use setters */);
/// assert!(x.connector_spec().is_some());
/// assert!(x.extension_spec().is_none());
/// assert!(x.function_spec().is_none());
/// assert!(x.open_api_spec().is_none());
/// ```
pub fn set_connector_spec<
T: std::convert::Into<std::boxed::Box<crate::model::tool::ConnectorTool>>,
>(
mut self,
v: T,
) -> Self {
self.specification =
std::option::Option::Some(crate::model::tool::Specification::ConnectorSpec(v.into()));
self
}
/// The value of [specification][crate::model::Tool::specification]
/// if it holds a `OpenApiSpec`, `None` if the field is not set or
/// holds a different branch.
pub fn open_api_spec(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::tool::OpenApiTool>> {
#[allow(unreachable_patterns)]
self.specification.as_ref().and_then(|v| match v {
crate::model::tool::Specification::OpenApiSpec(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [specification][crate::model::Tool::specification]
/// to hold a `OpenApiSpec`.
///
/// Note that all the setters affecting `specification` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Tool;
/// use google_cloud_dialogflow_v2::model::tool::OpenApiTool;
/// let x = Tool::new().set_open_api_spec(OpenApiTool::default()/* use setters */);
/// assert!(x.open_api_spec().is_some());
/// assert!(x.extension_spec().is_none());
/// assert!(x.function_spec().is_none());
/// assert!(x.connector_spec().is_none());
/// ```
pub fn set_open_api_spec<
T: std::convert::Into<std::boxed::Box<crate::model::tool::OpenApiTool>>,
>(
mut self,
v: T,
) -> Self {
self.specification =
std::option::Option::Some(crate::model::tool::Specification::OpenApiSpec(v.into()));
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for Tool {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool"
}
}
/// Defines additional types related to [Tool].
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod tool {
#[allow(unused_imports)]
use super::*;
/// An ExtensionTool is a way to use Vertex Extensions as a tool.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExtensionTool {
/// Required. The full name of the referenced vertex extension.
/// Format:
/// `projects/{project}/locations/{location}/extensions/{extension}`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl ExtensionTool {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::tool::ExtensionTool::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::ExtensionTool;
/// let x = ExtensionTool::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for ExtensionTool {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.ExtensionTool"
}
}
/// A Function tool describes the functions to be invoked on the client side.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FunctionTool {
/// Optional. The JSON schema is encapsulated in a
/// [google.protobuf.Struct][google.protobuf.Struct] to describe the input of
/// the function. This input is a JSON object that contains the function's
/// parameters as properties of the object.
///
/// [google.protobuf.Struct]: wkt::Struct
pub input_schema: std::option::Option<wkt::Struct>,
/// Optional. The JSON schema is encapsulated in a
/// [google.protobuf.Struct][google.protobuf.Struct] to describe the output
/// of the function. This output is a JSON object that contains the
/// function's parameters as properties of the object.
///
/// [google.protobuf.Struct]: wkt::Struct
pub output_schema: std::option::Option<wkt::Struct>,
/// Optional. The method type of the function. If not specified, the default
/// value is GET.
pub method_type: crate::model::tool::MethodType,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl FunctionTool {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [input_schema][crate::model::tool::FunctionTool::input_schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::FunctionTool;
/// use wkt::Struct;
/// let x = FunctionTool::new().set_input_schema(Struct::default()/* use setters */);
/// ```
pub fn set_input_schema<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.input_schema = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [input_schema][crate::model::tool::FunctionTool::input_schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::FunctionTool;
/// use wkt::Struct;
/// let x = FunctionTool::new().set_or_clear_input_schema(Some(Struct::default()/* use setters */));
/// let x = FunctionTool::new().set_or_clear_input_schema(None::<Struct>);
/// ```
pub fn set_or_clear_input_schema<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.input_schema = v.map(|x| x.into());
self
}
/// Sets the value of [output_schema][crate::model::tool::FunctionTool::output_schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::FunctionTool;
/// use wkt::Struct;
/// let x = FunctionTool::new().set_output_schema(Struct::default()/* use setters */);
/// ```
pub fn set_output_schema<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.output_schema = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [output_schema][crate::model::tool::FunctionTool::output_schema].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::FunctionTool;
/// use wkt::Struct;
/// let x = FunctionTool::new().set_or_clear_output_schema(Some(Struct::default()/* use setters */));
/// let x = FunctionTool::new().set_or_clear_output_schema(None::<Struct>);
/// ```
pub fn set_or_clear_output_schema<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.output_schema = v.map(|x| x.into());
self
}
/// Sets the value of [method_type][crate::model::tool::FunctionTool::method_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::FunctionTool;
/// use google_cloud_dialogflow_v2::model::tool::MethodType;
/// let x0 = FunctionTool::new().set_method_type(MethodType::Get);
/// let x1 = FunctionTool::new().set_method_type(MethodType::Post);
/// let x2 = FunctionTool::new().set_method_type(MethodType::Put);
/// ```
pub fn set_method_type<T: std::convert::Into<crate::model::tool::MethodType>>(
mut self,
v: T,
) -> Self {
self.method_type = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for FunctionTool {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.FunctionTool"
}
}
/// An OpenAPI tool is a way to provide the Tool specifications in the Open API
/// schema format.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OpenApiTool {
/// Optional. Authentication information required by the API.
pub authentication: std::option::Option<crate::model::tool::Authentication>,
/// Optional. TLS configuration for the HTTPS verification.
pub tls_config: std::option::Option<crate::model::tool::TLSConfig>,
/// Optional. Service Directory configuration.
pub service_directory_config:
std::option::Option<crate::model::tool::ServiceDirectoryConfig>,
/// Schema representation.
pub schema: std::option::Option<crate::model::tool::open_api_tool::Schema>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl OpenApiTool {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [authentication][crate::model::tool::OpenApiTool::authentication].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::OpenApiTool;
/// use google_cloud_dialogflow_v2::model::tool::Authentication;
/// let x = OpenApiTool::new().set_authentication(Authentication::default()/* use setters */);
/// ```
pub fn set_authentication<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::tool::Authentication>,
{
self.authentication = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [authentication][crate::model::tool::OpenApiTool::authentication].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::OpenApiTool;
/// use google_cloud_dialogflow_v2::model::tool::Authentication;
/// let x = OpenApiTool::new().set_or_clear_authentication(Some(Authentication::default()/* use setters */));
/// let x = OpenApiTool::new().set_or_clear_authentication(None::<Authentication>);
/// ```
pub fn set_or_clear_authentication<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::tool::Authentication>,
{
self.authentication = v.map(|x| x.into());
self
}
/// Sets the value of [tls_config][crate::model::tool::OpenApiTool::tls_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::OpenApiTool;
/// use google_cloud_dialogflow_v2::model::tool::TLSConfig;
/// let x = OpenApiTool::new().set_tls_config(TLSConfig::default()/* use setters */);
/// ```
pub fn set_tls_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::tool::TLSConfig>,
{
self.tls_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [tls_config][crate::model::tool::OpenApiTool::tls_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::OpenApiTool;
/// use google_cloud_dialogflow_v2::model::tool::TLSConfig;
/// let x = OpenApiTool::new().set_or_clear_tls_config(Some(TLSConfig::default()/* use setters */));
/// let x = OpenApiTool::new().set_or_clear_tls_config(None::<TLSConfig>);
/// ```
pub fn set_or_clear_tls_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::tool::TLSConfig>,
{
self.tls_config = v.map(|x| x.into());
self
}
/// Sets the value of [service_directory_config][crate::model::tool::OpenApiTool::service_directory_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::OpenApiTool;
/// use google_cloud_dialogflow_v2::model::tool::ServiceDirectoryConfig;
/// let x = OpenApiTool::new().set_service_directory_config(ServiceDirectoryConfig::default()/* use setters */);
/// ```
pub fn set_service_directory_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::tool::ServiceDirectoryConfig>,
{
self.service_directory_config = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [service_directory_config][crate::model::tool::OpenApiTool::service_directory_config].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::OpenApiTool;
/// use google_cloud_dialogflow_v2::model::tool::ServiceDirectoryConfig;
/// let x = OpenApiTool::new().set_or_clear_service_directory_config(Some(ServiceDirectoryConfig::default()/* use setters */));
/// let x = OpenApiTool::new().set_or_clear_service_directory_config(None::<ServiceDirectoryConfig>);
/// ```
pub fn set_or_clear_service_directory_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::tool::ServiceDirectoryConfig>,
{
self.service_directory_config = v.map(|x| x.into());
self
}
/// Sets the value of [schema][crate::model::tool::OpenApiTool::schema].
///
/// Note that all the setters affecting `schema` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::OpenApiTool;
/// use google_cloud_dialogflow_v2::model::tool::open_api_tool::Schema;
/// let x = OpenApiTool::new().set_schema(Some(Schema::TextSchema("example".to_string())));
/// ```
pub fn set_schema<
T: std::convert::Into<std::option::Option<crate::model::tool::open_api_tool::Schema>>,
>(
mut self,
v: T,
) -> Self {
self.schema = v.into();
self
}
/// The value of [schema][crate::model::tool::OpenApiTool::schema]
/// if it holds a `TextSchema`, `None` if the field is not set or
/// holds a different branch.
pub fn text_schema(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.schema.as_ref().and_then(|v| match v {
crate::model::tool::open_api_tool::Schema::TextSchema(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [schema][crate::model::tool::OpenApiTool::schema]
/// to hold a `TextSchema`.
///
/// Note that all the setters affecting `schema` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::OpenApiTool;
/// let x = OpenApiTool::new().set_text_schema("example");
/// assert!(x.text_schema().is_some());
/// ```
pub fn set_text_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.schema = std::option::Option::Some(
crate::model::tool::open_api_tool::Schema::TextSchema(v.into()),
);
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for OpenApiTool {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.OpenApiTool"
}
}
/// Defines additional types related to [OpenApiTool].
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod open_api_tool {
#[allow(unused_imports)]
use super::*;
/// Schema representation.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Schema {
/// Required. The OpenAPI schema specified as a text.
TextSchema(std::string::String),
}
}
/// A ConnectorTool enabling using Integration Connectors Connections as tools.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ConnectorTool {
/// Required. The full resource name of the referenced Integration Connectors
/// Connection. Format: 'projects/*/locations/*/connections/*'
pub name: std::string::String,
/// Required. Actions for the tool to use.
pub actions: std::vec::Vec<crate::model::tool::connector_tool::Action>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl ConnectorTool {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::tool::ConnectorTool::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::ConnectorTool;
/// let x = ConnectorTool::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [actions][crate::model::tool::ConnectorTool::actions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::ConnectorTool;
/// use google_cloud_dialogflow_v2::model::tool::connector_tool::Action;
/// let x = ConnectorTool::new()
/// .set_actions([
/// Action::default()/* use setters */,
/// Action::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_actions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::tool::connector_tool::Action>,
{
use std::iter::Iterator;
self.actions = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for ConnectorTool {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.ConnectorTool"
}
}
/// Defines additional types related to [ConnectorTool].
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod connector_tool {
#[allow(unused_imports)]
use super::*;
/// Configuration of a Connection operation for the tool to use.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Action {
/// Optional. Entity fields to use as inputs for the operation.
/// If no fields are specified, all fields of the Entity will be used.
pub input_fields: std::vec::Vec<std::string::String>,
/// Optional. Entity fields to return from the operation.
/// If no fields are specified, all fields of the Entity will be returned.
pub output_fields: std::vec::Vec<std::string::String>,
/// Required. Specification for an action to configure for the tool to use.
pub action_spec:
std::option::Option<crate::model::tool::connector_tool::action::ActionSpec>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl Action {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [input_fields][crate::model::tool::connector_tool::Action::input_fields].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::connector_tool::Action;
/// let x = Action::new().set_input_fields(["a", "b", "c"]);
/// ```
pub fn set_input_fields<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_fields = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [output_fields][crate::model::tool::connector_tool::Action::output_fields].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::connector_tool::Action;
/// let x = Action::new().set_output_fields(["a", "b", "c"]);
/// ```
pub fn set_output_fields<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.output_fields = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [action_spec][crate::model::tool::connector_tool::Action::action_spec].
///
/// Note that all the setters affecting `action_spec` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::connector_tool::Action;
/// use google_cloud_dialogflow_v2::model::tool::connector_tool::action::ActionSpec;
/// let x = Action::new().set_action_spec(Some(ActionSpec::ConnectionActionId("example".to_string())));
/// ```
pub fn set_action_spec<
T: std::convert::Into<
std::option::Option<crate::model::tool::connector_tool::action::ActionSpec>,
>,
>(
mut self,
v: T,
) -> Self {
self.action_spec = v.into();
self
}
/// The value of [action_spec][crate::model::tool::connector_tool::Action::action_spec]
/// if it holds a `ConnectionActionId`, `None` if the field is not set or
/// holds a different branch.
pub fn connection_action_id(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.action_spec.as_ref().and_then(|v| match v {
crate::model::tool::connector_tool::action::ActionSpec::ConnectionActionId(
v,
) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [action_spec][crate::model::tool::connector_tool::Action::action_spec]
/// to hold a `ConnectionActionId`.
///
/// Note that all the setters affecting `action_spec` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::connector_tool::Action;
/// let x = Action::new().set_connection_action_id("example");
/// assert!(x.connection_action_id().is_some());
/// assert!(x.entity_operation().is_none());
/// ```
pub fn set_connection_action_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.action_spec = std::option::Option::Some(
crate::model::tool::connector_tool::action::ActionSpec::ConnectionActionId(
v.into(),
),
);
self
}
/// The value of [action_spec][crate::model::tool::connector_tool::Action::action_spec]
/// if it holds a `EntityOperation`, `None` if the field is not set or
/// holds a different branch.
pub fn entity_operation(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::tool::connector_tool::action::EntityOperation>,
> {
#[allow(unreachable_patterns)]
self.action_spec.as_ref().and_then(|v| match v {
crate::model::tool::connector_tool::action::ActionSpec::EntityOperation(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [action_spec][crate::model::tool::connector_tool::Action::action_spec]
/// to hold a `EntityOperation`.
///
/// Note that all the setters affecting `action_spec` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::connector_tool::Action;
/// use google_cloud_dialogflow_v2::model::tool::connector_tool::action::EntityOperation;
/// let x = Action::new().set_entity_operation(EntityOperation::default()/* use setters */);
/// assert!(x.entity_operation().is_some());
/// assert!(x.connection_action_id().is_none());
/// ```
pub fn set_entity_operation<
T: std::convert::Into<
std::boxed::Box<
crate::model::tool::connector_tool::action::EntityOperation,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.action_spec = std::option::Option::Some(
crate::model::tool::connector_tool::action::ActionSpec::EntityOperation(
v.into(),
),
);
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for Action {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.ConnectorTool.Action"
}
}
/// Defines additional types related to [Action].
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod action {
#[allow(unused_imports)]
use super::*;
/// Entity CRUD operation specification.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EntityOperation {
/// Required. ID of the entity.
pub entity_id: std::string::String,
/// Required. Operation to perform on the entity.
pub operation:
crate::model::tool::connector_tool::action::entity_operation::OperationType,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl EntityOperation {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [entity_id][crate::model::tool::connector_tool::action::EntityOperation::entity_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::connector_tool::action::EntityOperation;
/// let x = EntityOperation::new().set_entity_id("example");
/// ```
pub fn set_entity_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.entity_id = v.into();
self
}
/// Sets the value of [operation][crate::model::tool::connector_tool::action::EntityOperation::operation].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::connector_tool::action::EntityOperation;
/// use google_cloud_dialogflow_v2::model::tool::connector_tool::action::entity_operation::OperationType;
/// let x0 = EntityOperation::new().set_operation(OperationType::List);
/// let x1 = EntityOperation::new().set_operation(OperationType::Get);
/// let x2 = EntityOperation::new().set_operation(OperationType::Create);
/// ```
pub fn set_operation<T: std::convert::Into<crate::model::tool::connector_tool::action::entity_operation::OperationType>>(mut self, v: T) -> Self{
self.operation = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for EntityOperation {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.ConnectorTool.Action.EntityOperation"
}
}
/// Defines additional types related to [EntityOperation].
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod entity_operation {
#[allow(unused_imports)]
use super::*;
/// The operation to perform on the entity.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum OperationType {
/// Operation type unspecified. Invalid, ConnectorTool create/update
/// will fail.
Unspecified,
/// List operation.
List,
/// Get operation.
Get,
/// Create operation.
Create,
/// Update operation.
Update,
/// Delete operation.
Delete,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [OperationType::value] or
/// [OperationType::name].
UnknownValue(operation_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod operation_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl OperationType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::List => std::option::Option::Some(1),
Self::Get => std::option::Option::Some(2),
Self::Create => std::option::Option::Some(3),
Self::Update => std::option::Option::Some(4),
Self::Delete => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("OPERATION_TYPE_UNSPECIFIED")
}
Self::List => std::option::Option::Some("LIST"),
Self::Get => std::option::Option::Some("GET"),
Self::Create => std::option::Option::Some("CREATE"),
Self::Update => std::option::Option::Some("UPDATE"),
Self::Delete => std::option::Option::Some("DELETE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::default::Default for OperationType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::fmt::Display for OperationType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::convert::From<i32> for OperationType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::List,
2 => Self::Get,
3 => Self::Create,
4 => Self::Update,
5 => Self::Delete,
_ => Self::UnknownValue(operation_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::convert::From<&str> for OperationType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
"LIST" => Self::List,
"GET" => Self::Get,
"CREATE" => Self::Create,
"UPDATE" => Self::Update,
"DELETE" => Self::Delete,
_ => Self::UnknownValue(operation_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl serde::ser::Serialize for OperationType {
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::List => serializer.serialize_i32(1),
Self::Get => serializer.serialize_i32(2),
Self::Create => serializer.serialize_i32(3),
Self::Update => serializer.serialize_i32(4),
Self::Delete => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl<'de> serde::de::Deserialize<'de> for OperationType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
".google.cloud.dialogflow.v2.Tool.ConnectorTool.Action.EntityOperation.OperationType"))
}
}
}
/// Required. Specification for an action to configure for the tool to use.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ActionSpec {
/// ID of a Connection action for the tool to use.
ConnectionActionId(std::string::String),
/// Entity operation configuration for the tool to use.
EntityOperation(
std::boxed::Box<crate::model::tool::connector_tool::action::EntityOperation>,
),
}
}
}
/// Authentication information required for API calls
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Authentication {
/// The auth configuration.
pub auth_config: std::option::Option<crate::model::tool::authentication::AuthConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl Authentication {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [auth_config][crate::model::tool::Authentication::auth_config].
///
/// Note that all the setters affecting `auth_config` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::Authentication;
/// use google_cloud_dialogflow_v2::model::tool::authentication::ApiKeyConfig;
/// let x = Authentication::new().set_auth_config(Some(
/// google_cloud_dialogflow_v2::model::tool::authentication::AuthConfig::ApiKeyConfig(ApiKeyConfig::default().into())));
/// ```
pub fn set_auth_config<
T: std::convert::Into<std::option::Option<crate::model::tool::authentication::AuthConfig>>,
>(
mut self,
v: T,
) -> Self {
self.auth_config = v.into();
self
}
/// The value of [auth_config][crate::model::tool::Authentication::auth_config]
/// if it holds a `ApiKeyConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn api_key_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::tool::authentication::ApiKeyConfig>>
{
#[allow(unreachable_patterns)]
self.auth_config.as_ref().and_then(|v| match v {
crate::model::tool::authentication::AuthConfig::ApiKeyConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [auth_config][crate::model::tool::Authentication::auth_config]
/// to hold a `ApiKeyConfig`.
///
/// Note that all the setters affecting `auth_config` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::Authentication;
/// use google_cloud_dialogflow_v2::model::tool::authentication::ApiKeyConfig;
/// let x = Authentication::new().set_api_key_config(ApiKeyConfig::default()/* use setters */);
/// assert!(x.api_key_config().is_some());
/// assert!(x.oauth_config().is_none());
/// assert!(x.service_agent_auth_config().is_none());
/// assert!(x.bearer_token_config().is_none());
/// ```
pub fn set_api_key_config<
T: std::convert::Into<std::boxed::Box<crate::model::tool::authentication::ApiKeyConfig>>,
>(
mut self,
v: T,
) -> Self {
self.auth_config = std::option::Option::Some(
crate::model::tool::authentication::AuthConfig::ApiKeyConfig(v.into()),
);
self
}
/// The value of [auth_config][crate::model::tool::Authentication::auth_config]
/// if it holds a `OauthConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn oauth_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::tool::authentication::OAuthConfig>>
{
#[allow(unreachable_patterns)]
self.auth_config.as_ref().and_then(|v| match v {
crate::model::tool::authentication::AuthConfig::OauthConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [auth_config][crate::model::tool::Authentication::auth_config]
/// to hold a `OauthConfig`.
///
/// Note that all the setters affecting `auth_config` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::Authentication;
/// use google_cloud_dialogflow_v2::model::tool::authentication::OAuthConfig;
/// let x = Authentication::new().set_oauth_config(OAuthConfig::default()/* use setters */);
/// assert!(x.oauth_config().is_some());
/// assert!(x.api_key_config().is_none());
/// assert!(x.service_agent_auth_config().is_none());
/// assert!(x.bearer_token_config().is_none());
/// ```
pub fn set_oauth_config<
T: std::convert::Into<std::boxed::Box<crate::model::tool::authentication::OAuthConfig>>,
>(
mut self,
v: T,
) -> Self {
self.auth_config = std::option::Option::Some(
crate::model::tool::authentication::AuthConfig::OauthConfig(v.into()),
);
self
}
/// The value of [auth_config][crate::model::tool::Authentication::auth_config]
/// if it holds a `ServiceAgentAuthConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn service_agent_auth_config(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::tool::authentication::ServiceAgentAuthConfig>,
> {
#[allow(unreachable_patterns)]
self.auth_config.as_ref().and_then(|v| match v {
crate::model::tool::authentication::AuthConfig::ServiceAgentAuthConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [auth_config][crate::model::tool::Authentication::auth_config]
/// to hold a `ServiceAgentAuthConfig`.
///
/// Note that all the setters affecting `auth_config` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::Authentication;
/// use google_cloud_dialogflow_v2::model::tool::authentication::ServiceAgentAuthConfig;
/// let x = Authentication::new().set_service_agent_auth_config(ServiceAgentAuthConfig::default()/* use setters */);
/// assert!(x.service_agent_auth_config().is_some());
/// assert!(x.api_key_config().is_none());
/// assert!(x.oauth_config().is_none());
/// assert!(x.bearer_token_config().is_none());
/// ```
pub fn set_service_agent_auth_config<
T: std::convert::Into<
std::boxed::Box<crate::model::tool::authentication::ServiceAgentAuthConfig>,
>,
>(
mut self,
v: T,
) -> Self {
self.auth_config = std::option::Option::Some(
crate::model::tool::authentication::AuthConfig::ServiceAgentAuthConfig(v.into()),
);
self
}
/// The value of [auth_config][crate::model::tool::Authentication::auth_config]
/// if it holds a `BearerTokenConfig`, `None` if the field is not set or
/// holds a different branch.
pub fn bearer_token_config(
&self,
) -> std::option::Option<
&std::boxed::Box<crate::model::tool::authentication::BearerTokenConfig>,
> {
#[allow(unreachable_patterns)]
self.auth_config.as_ref().and_then(|v| match v {
crate::model::tool::authentication::AuthConfig::BearerTokenConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
/// Sets the value of [auth_config][crate::model::tool::Authentication::auth_config]
/// to hold a `BearerTokenConfig`.
///
/// Note that all the setters affecting `auth_config` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::Authentication;
/// use google_cloud_dialogflow_v2::model::tool::authentication::BearerTokenConfig;
/// let x = Authentication::new().set_bearer_token_config(BearerTokenConfig::default()/* use setters */);
/// assert!(x.bearer_token_config().is_some());
/// assert!(x.api_key_config().is_none());
/// assert!(x.oauth_config().is_none());
/// assert!(x.service_agent_auth_config().is_none());
/// ```
pub fn set_bearer_token_config<
T: std::convert::Into<
std::boxed::Box<crate::model::tool::authentication::BearerTokenConfig>,
>,
>(
mut self,
v: T,
) -> Self {
self.auth_config = std::option::Option::Some(
crate::model::tool::authentication::AuthConfig::BearerTokenConfig(v.into()),
);
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for Authentication {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.Authentication"
}
}
/// Defines additional types related to [Authentication].
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod authentication {
#[allow(unused_imports)]
use super::*;
/// Config for authentication with API key.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ApiKeyConfig {
/// Required. The parameter name or the header name of the API key.
/// E.g., If the API request is "<https://example.com/act?X-Api-Key=>\<API
/// KEY\>", "X-Api-Key" would be the parameter name.
pub key_name: std::string::String,
/// Optional. The API key. If the `secret_version_for_api_key` field is
/// set, this field will be ignored.
pub api_key: std::string::String,
/// Optional. The name of the SecretManager secret version resource storing
/// the API key. If this field is set, the `api_key` field will be ignored.
/// Format: `projects/{project}/secrets/{secret}/versions/{version}`
pub secret_version_for_api_key: std::string::String,
/// Required. Key location in the request.
pub request_location: crate::model::tool::authentication::RequestLocation,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl ApiKeyConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [key_name][crate::model::tool::authentication::ApiKeyConfig::key_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::authentication::ApiKeyConfig;
/// let x = ApiKeyConfig::new().set_key_name("example");
/// ```
pub fn set_key_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.key_name = v.into();
self
}
/// Sets the value of [api_key][crate::model::tool::authentication::ApiKeyConfig::api_key].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::authentication::ApiKeyConfig;
/// let x = ApiKeyConfig::new().set_api_key("example");
/// ```
pub fn set_api_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.api_key = v.into();
self
}
/// Sets the value of [secret_version_for_api_key][crate::model::tool::authentication::ApiKeyConfig::secret_version_for_api_key].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::authentication::ApiKeyConfig;
/// let x = ApiKeyConfig::new().set_secret_version_for_api_key("example");
/// ```
pub fn set_secret_version_for_api_key<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.secret_version_for_api_key = v.into();
self
}
/// Sets the value of [request_location][crate::model::tool::authentication::ApiKeyConfig::request_location].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::authentication::ApiKeyConfig;
/// use google_cloud_dialogflow_v2::model::tool::authentication::RequestLocation;
/// let x0 = ApiKeyConfig::new().set_request_location(RequestLocation::Header);
/// let x1 = ApiKeyConfig::new().set_request_location(RequestLocation::QueryString);
/// ```
pub fn set_request_location<
T: std::convert::Into<crate::model::tool::authentication::RequestLocation>,
>(
mut self,
v: T,
) -> Self {
self.request_location = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for ApiKeyConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.Authentication.ApiKeyConfig"
}
}
/// Config for authentication with OAuth.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OAuthConfig {
/// Required. OAuth grant types.
pub oauth_grant_type: crate::model::tool::authentication::o_auth_config::OauthGrantType,
/// Required. The client ID from the OAuth provider.
pub client_id: std::string::String,
/// Optional. The client secret from the OAuth provider. If the
/// `secret_version_for_client_secret` field is set, this field will be
/// ignored.
pub client_secret: std::string::String,
/// Optional. The name of the SecretManager secret version resource storing
/// the client secret. If this field is set, the `client_secret` field will
/// be ignored. Format:
/// `projects/{project}/secrets/{secret}/versions/{version}`
pub secret_version_for_client_secret: std::string::String,
/// Required. The token endpoint in the OAuth provider to exchange for an
/// access token.
pub token_endpoint: std::string::String,
/// Optional. The OAuth scopes to grant.
pub scopes: std::vec::Vec<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl OAuthConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [oauth_grant_type][crate::model::tool::authentication::OAuthConfig::oauth_grant_type].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::authentication::OAuthConfig;
/// use google_cloud_dialogflow_v2::model::tool::authentication::o_auth_config::OauthGrantType;
/// let x0 = OAuthConfig::new().set_oauth_grant_type(OauthGrantType::ClientCredential);
/// ```
pub fn set_oauth_grant_type<
T: std::convert::Into<
crate::model::tool::authentication::o_auth_config::OauthGrantType,
>,
>(
mut self,
v: T,
) -> Self {
self.oauth_grant_type = v.into();
self
}
/// Sets the value of [client_id][crate::model::tool::authentication::OAuthConfig::client_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::authentication::OAuthConfig;
/// let x = OAuthConfig::new().set_client_id("example");
/// ```
pub fn set_client_id<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.client_id = v.into();
self
}
/// Sets the value of [client_secret][crate::model::tool::authentication::OAuthConfig::client_secret].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::authentication::OAuthConfig;
/// let x = OAuthConfig::new().set_client_secret("example");
/// ```
pub fn set_client_secret<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.client_secret = v.into();
self
}
/// Sets the value of [secret_version_for_client_secret][crate::model::tool::authentication::OAuthConfig::secret_version_for_client_secret].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::authentication::OAuthConfig;
/// let x = OAuthConfig::new().set_secret_version_for_client_secret("example");
/// ```
pub fn set_secret_version_for_client_secret<
T: std::convert::Into<std::string::String>,
>(
mut self,
v: T,
) -> Self {
self.secret_version_for_client_secret = v.into();
self
}
/// Sets the value of [token_endpoint][crate::model::tool::authentication::OAuthConfig::token_endpoint].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::authentication::OAuthConfig;
/// let x = OAuthConfig::new().set_token_endpoint("example");
/// ```
pub fn set_token_endpoint<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.token_endpoint = v.into();
self
}
/// Sets the value of [scopes][crate::model::tool::authentication::OAuthConfig::scopes].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::authentication::OAuthConfig;
/// let x = OAuthConfig::new().set_scopes(["a", "b", "c"]);
/// ```
pub fn set_scopes<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.scopes = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for OAuthConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.Authentication.OAuthConfig"
}
}
/// Defines additional types related to [OAuthConfig].
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod o_auth_config {
#[allow(unused_imports)]
use super::*;
/// OAuth grant types. Only [client credential
/// grant](https://oauth.net/2/grant-types/client-credentials) is
/// supported.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum OauthGrantType {
/// Default value. This value is unused.
Unspecified,
/// Represents the [client credential
/// flow](https://oauth.net/2/grant-types/client-credentials).
ClientCredential,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [OauthGrantType::value] or
/// [OauthGrantType::name].
UnknownValue(oauth_grant_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod oauth_grant_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl OauthGrantType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ClientCredential => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("OAUTH_GRANT_TYPE_UNSPECIFIED")
}
Self::ClientCredential => std::option::Option::Some("CLIENT_CREDENTIAL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::default::Default for OauthGrantType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::fmt::Display for OauthGrantType {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::convert::From<i32> for OauthGrantType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ClientCredential,
_ => Self::UnknownValue(oauth_grant_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::convert::From<&str> for OauthGrantType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"OAUTH_GRANT_TYPE_UNSPECIFIED" => Self::Unspecified,
"CLIENT_CREDENTIAL" => Self::ClientCredential,
_ => Self::UnknownValue(oauth_grant_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl serde::ser::Serialize for OauthGrantType {
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::ClientCredential => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl<'de> serde::de::Deserialize<'de> for OauthGrantType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<OauthGrantType>::new(
".google.cloud.dialogflow.v2.Tool.Authentication.OAuthConfig.OauthGrantType"))
}
}
}
/// Config for auth using [Dialogflow service
/// agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent).
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServiceAgentAuthConfig {
/// Optional. Indicate the auth token type generated from the [Diglogflow
/// service
/// agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent).
/// The generated token is sent in the Authorization header.
pub service_agent_auth:
crate::model::tool::authentication::service_agent_auth_config::ServiceAgentAuth,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl ServiceAgentAuthConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [service_agent_auth][crate::model::tool::authentication::ServiceAgentAuthConfig::service_agent_auth].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::authentication::ServiceAgentAuthConfig;
/// use google_cloud_dialogflow_v2::model::tool::authentication::service_agent_auth_config::ServiceAgentAuth;
/// let x0 = ServiceAgentAuthConfig::new().set_service_agent_auth(ServiceAgentAuth::IdToken);
/// let x1 = ServiceAgentAuthConfig::new().set_service_agent_auth(ServiceAgentAuth::AccessToken);
/// ```
pub fn set_service_agent_auth<T: std::convert::Into<crate::model::tool::authentication::service_agent_auth_config::ServiceAgentAuth>>(mut self, v: T) -> Self{
self.service_agent_auth = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for ServiceAgentAuthConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.Authentication.ServiceAgentAuthConfig"
}
}
/// Defines additional types related to [ServiceAgentAuthConfig].
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod service_agent_auth_config {
#[allow(unused_imports)]
use super::*;
/// Indicate the auth token type generated from the [Diaglogflow service
/// agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent).
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ServiceAgentAuth {
/// Service agent auth type unspecified. Default to ID_TOKEN.
Unspecified,
/// Use [ID
/// token](https://cloud.google.com/docs/authentication/token-types#id)
/// generated from service agent. This can be used to access Cloud
/// Function and Cloud Run after you grant Invoker role to
/// `service-<PROJECT-NUMBER>@gcp-sa-dialogflow.iam.gserviceaccount.com`.
IdToken,
/// Use [access
/// token](https://cloud.google.com/docs/authentication/token-types#access)
/// generated from service agent. This can be used to access other Google
/// Cloud APIs after you grant required roles to
/// `service-<PROJECT-NUMBER>@gcp-sa-dialogflow.iam.gserviceaccount.com`.
AccessToken,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ServiceAgentAuth::value] or
/// [ServiceAgentAuth::name].
UnknownValue(service_agent_auth::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod service_agent_auth {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl ServiceAgentAuth {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::IdToken => std::option::Option::Some(1),
Self::AccessToken => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("SERVICE_AGENT_AUTH_UNSPECIFIED")
}
Self::IdToken => std::option::Option::Some("ID_TOKEN"),
Self::AccessToken => std::option::Option::Some("ACCESS_TOKEN"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::default::Default for ServiceAgentAuth {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::fmt::Display for ServiceAgentAuth {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::convert::From<i32> for ServiceAgentAuth {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::IdToken,
2 => Self::AccessToken,
_ => Self::UnknownValue(service_agent_auth::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::convert::From<&str> for ServiceAgentAuth {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SERVICE_AGENT_AUTH_UNSPECIFIED" => Self::Unspecified,
"ID_TOKEN" => Self::IdToken,
"ACCESS_TOKEN" => Self::AccessToken,
_ => Self::UnknownValue(service_agent_auth::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl serde::ser::Serialize for ServiceAgentAuth {
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::IdToken => serializer.serialize_i32(1),
Self::AccessToken => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl<'de> serde::de::Deserialize<'de> for ServiceAgentAuth {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServiceAgentAuth>::new(
".google.cloud.dialogflow.v2.Tool.Authentication.ServiceAgentAuthConfig.ServiceAgentAuth"))
}
}
}
/// Config for authentication using bearer token.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BearerTokenConfig {
/// Optional. The text token appended to the text `Bearer` to the request
/// Authorization header.
/// [Session parameters
/// reference](https://cloud.google.com/dialogflow/cx/docs/concept/parameter#session-ref)
/// can be used to pass the token dynamically, e.g.
/// `$session.params.parameter-id`.
pub token: std::string::String,
/// Optional. The name of the SecretManager secret version resource storing
/// the Bearer token. If this field is set, the `token` field will be
/// ignored. Format:
/// `projects/{project}/secrets/{secret}/versions/{version}`
pub secret_version_for_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl BearerTokenConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [token][crate::model::tool::authentication::BearerTokenConfig::token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::authentication::BearerTokenConfig;
/// let x = BearerTokenConfig::new().set_token("example");
/// ```
pub fn set_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.token = v.into();
self
}
/// Sets the value of [secret_version_for_token][crate::model::tool::authentication::BearerTokenConfig::secret_version_for_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::authentication::BearerTokenConfig;
/// let x = BearerTokenConfig::new().set_secret_version_for_token("example");
/// ```
pub fn set_secret_version_for_token<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.secret_version_for_token = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for BearerTokenConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.Authentication.BearerTokenConfig"
}
}
/// The location of the API key in the request.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RequestLocation {
/// Default value. This value is unused.
Unspecified,
/// Represents the key in http header.
Header,
/// Represents the key in query string.
QueryString,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [RequestLocation::value] or
/// [RequestLocation::name].
UnknownValue(request_location::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod request_location {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl RequestLocation {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Header => std::option::Option::Some(1),
Self::QueryString => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("REQUEST_LOCATION_UNSPECIFIED"),
Self::Header => std::option::Option::Some("HEADER"),
Self::QueryString => std::option::Option::Some("QUERY_STRING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::default::Default for RequestLocation {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::fmt::Display for RequestLocation {
fn fmt(
&self,
f: &mut std::fmt::Formatter<'_>,
) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::convert::From<i32> for RequestLocation {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Header,
2 => Self::QueryString,
_ => Self::UnknownValue(request_location::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::convert::From<&str> for RequestLocation {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"REQUEST_LOCATION_UNSPECIFIED" => Self::Unspecified,
"HEADER" => Self::Header,
"QUERY_STRING" => Self::QueryString,
_ => Self::UnknownValue(request_location::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl serde::ser::Serialize for RequestLocation {
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::Header => serializer.serialize_i32(1),
Self::QueryString => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl<'de> serde::de::Deserialize<'de> for RequestLocation {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<RequestLocation>::new(
".google.cloud.dialogflow.v2.Tool.Authentication.RequestLocation",
))
}
}
/// The auth configuration.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AuthConfig {
/// Config for API key auth.
ApiKeyConfig(std::boxed::Box<crate::model::tool::authentication::ApiKeyConfig>),
/// Config for OAuth.
OauthConfig(std::boxed::Box<crate::model::tool::authentication::OAuthConfig>),
/// Config for [Diglogflow service
/// agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent)
/// auth.
ServiceAgentAuthConfig(
std::boxed::Box<crate::model::tool::authentication::ServiceAgentAuthConfig>,
),
/// Config for bearer token auth.
BearerTokenConfig(
std::boxed::Box<crate::model::tool::authentication::BearerTokenConfig>,
),
}
}
/// The TLS configuration.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TLSConfig {
/// Required. Specifies a list of allowed custom CA certificates for HTTPS
/// verification.
pub ca_certs: std::vec::Vec<crate::model::tool::tls_config::CACert>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl TLSConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [ca_certs][crate::model::tool::TLSConfig::ca_certs].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::TLSConfig;
/// use google_cloud_dialogflow_v2::model::tool::tls_config::CACert;
/// let x = TLSConfig::new()
/// .set_ca_certs([
/// CACert::default()/* use setters */,
/// CACert::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_ca_certs<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::tool::tls_config::CACert>,
{
use std::iter::Iterator;
self.ca_certs = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for TLSConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.TLSConfig"
}
}
/// Defines additional types related to [TLSConfig].
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod tls_config {
#[allow(unused_imports)]
use super::*;
/// The CA certificate.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CACert {
/// Required. The name of the allowed custom CA certificates. This
/// can be used to disambiguate the custom CA certificates.
pub display_name: std::string::String,
/// Required. The allowed custom CA certificates (in DER format) for
/// HTTPS verification. This overrides the default SSL trust store. If this
/// is empty or unspecified, Dialogflow will use Google's default trust
/// store to verify certificates. N.B. Make sure the HTTPS server
/// certificates are signed with "subject alt name". For instance a
/// certificate can be self-signed using the following command,
///
/// ```norust
/// openssl x509 -req -days 200 -in example.com.csr \
/// -signkey example.com.key \
/// -out example.com.crt \
/// -extfile <(printf "\nsubjectAltName='DNS:www.example.com'")
/// ```
pub cert: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl CACert {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [display_name][crate::model::tool::tls_config::CACert::display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::tls_config::CACert;
/// let x = CACert::new().set_display_name("example");
/// ```
pub fn set_display_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.display_name = v.into();
self
}
/// Sets the value of [cert][crate::model::tool::tls_config::CACert::cert].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::tls_config::CACert;
/// let x = CACert::new().set_cert(bytes::Bytes::from_static(b"example"));
/// ```
pub fn set_cert<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.cert = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for CACert {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.TLSConfig.CACert"
}
}
}
/// Configuration for tools using Service Directory.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServiceDirectoryConfig {
/// Required. The name of [Service
/// Directory](https://cloud.google.com/service-directory) service.
/// Format:
/// `projects/<ProjectID>/locations/<LocationID>/namespaces/<NamespaceID>/services/<ServiceID>`.
/// `LocationID` of the service directory must be the same as the location
/// of the tool.
pub service: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl ServiceDirectoryConfig {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [service][crate::model::tool::ServiceDirectoryConfig::service].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool::ServiceDirectoryConfig;
/// let x = ServiceDirectoryConfig::new().set_service("example");
/// ```
pub fn set_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.service = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl wkt::message::Message for ServiceDirectoryConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Tool.ServiceDirectoryConfig"
}
}
/// Types of confirmation requirement.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ConfirmationRequirement {
/// Unspecified. Whether the action requires confirmation is inferred from
/// method_type.
Unspecified,
/// Conformation is required.
Required,
/// Conformation is not required.
NotRequired,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [ConfirmationRequirement::value] or
/// [ConfirmationRequirement::name].
UnknownValue(confirmation_requirement::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod confirmation_requirement {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl ConfirmationRequirement {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Required => std::option::Option::Some(1),
Self::NotRequired => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("CONFIRMATION_REQUIREMENT_UNSPECIFIED")
}
Self::Required => std::option::Option::Some("REQUIRED"),
Self::NotRequired => std::option::Option::Some("NOT_REQUIRED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::default::Default for ConfirmationRequirement {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::fmt::Display for ConfirmationRequirement {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::convert::From<i32> for ConfirmationRequirement {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Required,
2 => Self::NotRequired,
_ => Self::UnknownValue(confirmation_requirement::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::convert::From<&str> for ConfirmationRequirement {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CONFIRMATION_REQUIREMENT_UNSPECIFIED" => Self::Unspecified,
"REQUIRED" => Self::Required,
"NOT_REQUIRED" => Self::NotRequired,
_ => Self::UnknownValue(confirmation_requirement::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl serde::ser::Serialize for ConfirmationRequirement {
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::Required => serializer.serialize_i32(1),
Self::NotRequired => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl<'de> serde::de::Deserialize<'de> for ConfirmationRequirement {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(
wkt::internal::EnumVisitor::<ConfirmationRequirement>::new(
".google.cloud.dialogflow.v2.Tool.ConfirmationRequirement",
),
)
}
}
/// The method type of the tool.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MethodType {
/// Unspecified.
Unspecified,
/// GET method.
Get,
/// POST method.
Post,
/// PUT method.
Put,
/// DELETE method.
Delete,
/// PATCH method.
Patch,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [MethodType::value] or
/// [MethodType::name].
UnknownValue(method_type::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
pub mod method_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl MethodType {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Get => std::option::Option::Some(1),
Self::Post => std::option::Option::Some(2),
Self::Put => std::option::Option::Some(3),
Self::Delete => std::option::Option::Some(4),
Self::Patch => std::option::Option::Some(5),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("METHOD_TYPE_UNSPECIFIED"),
Self::Get => std::option::Option::Some("GET"),
Self::Post => std::option::Option::Some("POST"),
Self::Put => std::option::Option::Some("PUT"),
Self::Delete => std::option::Option::Some("DELETE"),
Self::Patch => std::option::Option::Some("PATCH"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::default::Default for MethodType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::fmt::Display for MethodType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::convert::From<i32> for MethodType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Get,
2 => Self::Post,
3 => Self::Put,
4 => Self::Delete,
5 => Self::Patch,
_ => Self::UnknownValue(method_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl std::convert::From<&str> for MethodType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"METHOD_TYPE_UNSPECIFIED" => Self::Unspecified,
"GET" => Self::Get,
"POST" => Self::Post,
"PUT" => Self::Put,
"DELETE" => Self::Delete,
"PATCH" => Self::Patch,
_ => Self::UnknownValue(method_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl serde::ser::Serialize for MethodType {
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::Get => serializer.serialize_i32(1),
Self::Post => serializer.serialize_i32(2),
Self::Put => serializer.serialize_i32(3),
Self::Delete => serializer.serialize_i32(4),
Self::Patch => serializer.serialize_i32(5),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
impl<'de> serde::de::Deserialize<'de> for MethodType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<MethodType>::new(
".google.cloud.dialogflow.v2.Tool.MethodType",
))
}
}
/// Specification of the Tool.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "tools",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Specification {
/// Vertex extension tool specification.
#[deprecated]
ExtensionSpec(std::boxed::Box<crate::model::tool::ExtensionTool>),
/// Client side executed function specification.
FunctionSpec(std::boxed::Box<crate::model::tool::FunctionTool>),
/// Integration connectors tool specification.
ConnectorSpec(std::boxed::Box<crate::model::tool::ConnectorTool>),
/// OpenAPI tool.
OpenApiSpec(std::boxed::Box<crate::model::tool::OpenApiTool>),
}
}
/// Represents a call of a specific tool's action with the specified inputs.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ToolCall {
/// Optional. A human readable short name of the tool, to be shown on the UI.
pub tool_display_name: std::string::String,
/// Optional. A human readable description of the tool.
pub tool_display_details: std::string::String,
/// Optional. The name of the tool's action associated with this call.
pub action: std::string::String,
/// Optional. The action's input parameters.
pub input_parameters: std::option::Option<wkt::Struct>,
/// Output only. Create time of the tool call.
pub create_time: std::option::Option<wkt::Timestamp>,
/// Optional. The answer record associated with this tool call.
pub answer_record: std::string::String,
/// Output only. State of the tool call.
pub state: crate::model::tool_call::State,
/// Specifies the source of this tool call.
pub source: std::option::Option<crate::model::tool_call::Source>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl ToolCall {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [tool_display_name][crate::model::ToolCall::tool_display_name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// let x = ToolCall::new().set_tool_display_name("example");
/// ```
pub fn set_tool_display_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.tool_display_name = v.into();
self
}
/// Sets the value of [tool_display_details][crate::model::ToolCall::tool_display_details].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// let x = ToolCall::new().set_tool_display_details("example");
/// ```
pub fn set_tool_display_details<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.tool_display_details = v.into();
self
}
/// Sets the value of [action][crate::model::ToolCall::action].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// let x = ToolCall::new().set_action("example");
/// ```
pub fn set_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.action = v.into();
self
}
/// Sets the value of [input_parameters][crate::model::ToolCall::input_parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// use wkt::Struct;
/// let x = ToolCall::new().set_input_parameters(Struct::default()/* use setters */);
/// ```
pub fn set_input_parameters<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.input_parameters = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [input_parameters][crate::model::ToolCall::input_parameters].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// use wkt::Struct;
/// let x = ToolCall::new().set_or_clear_input_parameters(Some(Struct::default()/* use setters */));
/// let x = ToolCall::new().set_or_clear_input_parameters(None::<Struct>);
/// ```
pub fn set_or_clear_input_parameters<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.input_parameters = v.map(|x| x.into());
self
}
/// Sets the value of [create_time][crate::model::ToolCall::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// use wkt::Timestamp;
/// let x = ToolCall::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::ToolCall::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// use wkt::Timestamp;
/// let x = ToolCall::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = ToolCall::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [answer_record][crate::model::ToolCall::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// let x = ToolCall::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.answer_record = v.into();
self
}
/// Sets the value of [state][crate::model::ToolCall::state].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// use google_cloud_dialogflow_v2::model::tool_call::State;
/// let x0 = ToolCall::new().set_state(State::Triggered);
/// let x1 = ToolCall::new().set_state(State::NeedsConfirmation);
/// ```
pub fn set_state<T: std::convert::Into<crate::model::tool_call::State>>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
/// Sets the value of [source][crate::model::ToolCall::source].
///
/// Note that all the setters affecting `source` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// use google_cloud_dialogflow_v2::model::tool_call::Source;
/// let x = ToolCall::new().set_source(Some(Source::Tool("example".to_string())));
/// ```
pub fn set_source<
T: std::convert::Into<std::option::Option<crate::model::tool_call::Source>>,
>(
mut self,
v: T,
) -> Self {
self.source = v.into();
self
}
/// The value of [source][crate::model::ToolCall::source]
/// if it holds a `Tool`, `None` if the field is not set or
/// holds a different branch.
pub fn tool(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::tool_call::Source::Tool(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::ToolCall::source]
/// to hold a `Tool`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// let x = ToolCall::new().set_tool("example");
/// assert!(x.tool().is_some());
/// assert!(x.ces_tool().is_none());
/// assert!(x.ces_toolset().is_none());
/// assert!(x.ces_app().is_none());
/// ```
pub fn set_tool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source = std::option::Option::Some(crate::model::tool_call::Source::Tool(v.into()));
self
}
/// The value of [source][crate::model::ToolCall::source]
/// if it holds a `CesTool`, `None` if the field is not set or
/// holds a different branch.
pub fn ces_tool(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::tool_call::Source::CesTool(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::ToolCall::source]
/// to hold a `CesTool`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// let x = ToolCall::new().set_ces_tool("example");
/// assert!(x.ces_tool().is_some());
/// assert!(x.tool().is_none());
/// assert!(x.ces_toolset().is_none());
/// assert!(x.ces_app().is_none());
/// ```
pub fn set_ces_tool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source = std::option::Option::Some(crate::model::tool_call::Source::CesTool(v.into()));
self
}
/// The value of [source][crate::model::ToolCall::source]
/// if it holds a `CesToolset`, `None` if the field is not set or
/// holds a different branch.
pub fn ces_toolset(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::tool_call::Source::CesToolset(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::ToolCall::source]
/// to hold a `CesToolset`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// let x = ToolCall::new().set_ces_toolset("example");
/// assert!(x.ces_toolset().is_some());
/// assert!(x.tool().is_none());
/// assert!(x.ces_tool().is_none());
/// assert!(x.ces_app().is_none());
/// ```
pub fn set_ces_toolset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source =
std::option::Option::Some(crate::model::tool_call::Source::CesToolset(v.into()));
self
}
/// The value of [source][crate::model::ToolCall::source]
/// if it holds a `CesApp`, `None` if the field is not set or
/// holds a different branch.
pub fn ces_app(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::tool_call::Source::CesApp(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::ToolCall::source]
/// to hold a `CesApp`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCall;
/// let x = ToolCall::new().set_ces_app("example");
/// assert!(x.ces_app().is_some());
/// assert!(x.tool().is_none());
/// assert!(x.ces_tool().is_none());
/// assert!(x.ces_toolset().is_none());
/// ```
pub fn set_ces_app<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source = std::option::Option::Some(crate::model::tool_call::Source::CesApp(v.into()));
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for ToolCall {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ToolCall"
}
}
/// Defines additional types related to [ToolCall].
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
pub mod tool_call {
#[allow(unused_imports)]
use super::*;
/// Tool call states.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
/// Default value.
Unspecified,
/// The tool call has been triggered.
Triggered,
/// The tool call requires confirmation from a human.
NeedsConfirmation,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [State::value] or
/// [State::name].
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl State {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Triggered => std::option::Option::Some(1),
Self::NeedsConfirmation => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Triggered => std::option::Option::Some("TRIGGERED"),
Self::NeedsConfirmation => std::option::Option::Some("NEEDS_CONFIRMATION"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
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())
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Triggered,
2 => Self::NeedsConfirmation,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"TRIGGERED" => Self::Triggered,
"NEEDS_CONFIRMATION" => Self::NeedsConfirmation,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
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::Triggered => serializer.serialize_i32(1),
Self::NeedsConfirmation => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
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.dialogflow.v2.ToolCall.State",
))
}
}
/// Specifies the source of this tool call.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Source {
/// Optional. The [tool][google.cloud.dialogflow.v2.Tool] associated with
/// this call. Format:
/// `projects/<ProjectID>/locations/<LocationID>/tools/<ToolID>`.
///
/// [google.cloud.dialogflow.v2.Tool]: crate::model::Tool
Tool(std::string::String),
/// Optional. CES tool name for this call.
/// Format:
/// `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>/tools/<ToolID>`.
CesTool(std::string::String),
/// Optional. CES toolset name for this call.
/// Format:
/// `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>/toolsets/ToolsetID>`.
CesToolset(std::string::String),
/// Optional. CES app name for this call.
/// Format:
/// `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>`.
CesApp(std::string::String),
}
}
/// The result of calling a tool's action.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ToolCallResult {
/// Optional. The name of the tool's action associated with this call.
pub action: std::string::String,
/// Output only. Create time of the tool call result.
pub create_time: std::option::Option<wkt::Timestamp>,
/// Optional. The answer record associated with this tool call result.
pub answer_record: std::string::String,
/// Specifies the source of this tool call.
pub source: std::option::Option<crate::model::tool_call_result::Source>,
/// The tool call's result.
pub result: std::option::Option<crate::model::tool_call_result::Result>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl ToolCallResult {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [action][crate::model::ToolCallResult::action].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCallResult;
/// let x = ToolCallResult::new().set_action("example");
/// ```
pub fn set_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.action = v.into();
self
}
/// Sets the value of [create_time][crate::model::ToolCallResult::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCallResult;
/// use wkt::Timestamp;
/// let x = ToolCallResult::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::ToolCallResult::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCallResult;
/// use wkt::Timestamp;
/// let x = ToolCallResult::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = ToolCallResult::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [answer_record][crate::model::ToolCallResult::answer_record].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCallResult;
/// let x = ToolCallResult::new().set_answer_record("example");
/// ```
pub fn set_answer_record<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.answer_record = v.into();
self
}
/// Sets the value of [source][crate::model::ToolCallResult::source].
///
/// Note that all the setters affecting `source` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCallResult;
/// use google_cloud_dialogflow_v2::model::tool_call_result::Source;
/// let x = ToolCallResult::new().set_source(Some(Source::Tool("example".to_string())));
/// ```
pub fn set_source<
T: std::convert::Into<std::option::Option<crate::model::tool_call_result::Source>>,
>(
mut self,
v: T,
) -> Self {
self.source = v.into();
self
}
/// The value of [source][crate::model::ToolCallResult::source]
/// if it holds a `Tool`, `None` if the field is not set or
/// holds a different branch.
pub fn tool(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::tool_call_result::Source::Tool(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::ToolCallResult::source]
/// to hold a `Tool`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCallResult;
/// let x = ToolCallResult::new().set_tool("example");
/// assert!(x.tool().is_some());
/// assert!(x.ces_toolset().is_none());
/// assert!(x.ces_tool().is_none());
/// assert!(x.ces_app().is_none());
/// ```
pub fn set_tool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source =
std::option::Option::Some(crate::model::tool_call_result::Source::Tool(v.into()));
self
}
/// The value of [source][crate::model::ToolCallResult::source]
/// if it holds a `CesToolset`, `None` if the field is not set or
/// holds a different branch.
pub fn ces_toolset(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::tool_call_result::Source::CesToolset(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::ToolCallResult::source]
/// to hold a `CesToolset`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCallResult;
/// let x = ToolCallResult::new().set_ces_toolset("example");
/// assert!(x.ces_toolset().is_some());
/// assert!(x.tool().is_none());
/// assert!(x.ces_tool().is_none());
/// assert!(x.ces_app().is_none());
/// ```
pub fn set_ces_toolset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source =
std::option::Option::Some(crate::model::tool_call_result::Source::CesToolset(v.into()));
self
}
/// The value of [source][crate::model::ToolCallResult::source]
/// if it holds a `CesTool`, `None` if the field is not set or
/// holds a different branch.
pub fn ces_tool(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::tool_call_result::Source::CesTool(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::ToolCallResult::source]
/// to hold a `CesTool`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCallResult;
/// let x = ToolCallResult::new().set_ces_tool("example");
/// assert!(x.ces_tool().is_some());
/// assert!(x.tool().is_none());
/// assert!(x.ces_toolset().is_none());
/// assert!(x.ces_app().is_none());
/// ```
pub fn set_ces_tool<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source =
std::option::Option::Some(crate::model::tool_call_result::Source::CesTool(v.into()));
self
}
/// The value of [source][crate::model::ToolCallResult::source]
/// if it holds a `CesApp`, `None` if the field is not set or
/// holds a different branch.
pub fn ces_app(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.source.as_ref().and_then(|v| match v {
crate::model::tool_call_result::Source::CesApp(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [source][crate::model::ToolCallResult::source]
/// to hold a `CesApp`.
///
/// Note that all the setters affecting `source` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCallResult;
/// let x = ToolCallResult::new().set_ces_app("example");
/// assert!(x.ces_app().is_some());
/// assert!(x.tool().is_none());
/// assert!(x.ces_toolset().is_none());
/// assert!(x.ces_tool().is_none());
/// ```
pub fn set_ces_app<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source =
std::option::Option::Some(crate::model::tool_call_result::Source::CesApp(v.into()));
self
}
/// Sets the value of [result][crate::model::ToolCallResult::result].
///
/// Note that all the setters affecting `result` are mutually
/// exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCallResult;
/// use google_cloud_dialogflow_v2::model::tool_call_result::Result;
/// let x = ToolCallResult::new().set_result(Some(Result::RawContent(bytes::Bytes::from_static(b"example"))));
/// ```
pub fn set_result<
T: std::convert::Into<std::option::Option<crate::model::tool_call_result::Result>>,
>(
mut self,
v: T,
) -> Self {
self.result = v.into();
self
}
/// The value of [result][crate::model::ToolCallResult::result]
/// if it holds a `Error`, `None` if the field is not set or
/// holds a different branch.
pub fn error(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::tool_call_result::Error>> {
#[allow(unreachable_patterns)]
self.result.as_ref().and_then(|v| match v {
crate::model::tool_call_result::Result::Error(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [result][crate::model::ToolCallResult::result]
/// to hold a `Error`.
///
/// Note that all the setters affecting `result` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCallResult;
/// use google_cloud_dialogflow_v2::model::tool_call_result::Error;
/// let x = ToolCallResult::new().set_error(Error::default()/* use setters */);
/// assert!(x.error().is_some());
/// assert!(x.raw_content().is_none());
/// assert!(x.content().is_none());
/// ```
pub fn set_error<
T: std::convert::Into<std::boxed::Box<crate::model::tool_call_result::Error>>,
>(
mut self,
v: T,
) -> Self {
self.result =
std::option::Option::Some(crate::model::tool_call_result::Result::Error(v.into()));
self
}
/// The value of [result][crate::model::ToolCallResult::result]
/// if it holds a `RawContent`, `None` if the field is not set or
/// holds a different branch.
pub fn raw_content(&self) -> std::option::Option<&::bytes::Bytes> {
#[allow(unreachable_patterns)]
self.result.as_ref().and_then(|v| match v {
crate::model::tool_call_result::Result::RawContent(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [result][crate::model::ToolCallResult::result]
/// to hold a `RawContent`.
///
/// Note that all the setters affecting `result` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCallResult;
/// let x = ToolCallResult::new().set_raw_content(bytes::Bytes::from_static(b"example"));
/// assert!(x.raw_content().is_some());
/// assert!(x.error().is_none());
/// assert!(x.content().is_none());
/// ```
pub fn set_raw_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.result =
std::option::Option::Some(crate::model::tool_call_result::Result::RawContent(v.into()));
self
}
/// The value of [result][crate::model::ToolCallResult::result]
/// if it holds a `Content`, `None` if the field is not set or
/// holds a different branch.
pub fn content(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.result.as_ref().and_then(|v| match v {
crate::model::tool_call_result::Result::Content(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
/// Sets the value of [result][crate::model::ToolCallResult::result]
/// to hold a `Content`.
///
/// Note that all the setters affecting `result` are
/// mutually exclusive.
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolCallResult;
/// let x = ToolCallResult::new().set_content("example");
/// assert!(x.content().is_some());
/// assert!(x.error().is_none());
/// assert!(x.raw_content().is_none());
/// ```
pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.result =
std::option::Option::Some(crate::model::tool_call_result::Result::Content(v.into()));
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for ToolCallResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ToolCallResult"
}
}
/// Defines additional types related to [ToolCallResult].
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
pub mod tool_call_result {
#[allow(unused_imports)]
use super::*;
/// An error produced by the tool call.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Error {
/// Optional. The error message of the function.
pub message: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl Error {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [message][crate::model::tool_call_result::Error::message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::tool_call_result::Error;
/// let x = Error::new().set_message("example");
/// ```
pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.message = v.into();
self
}
}
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
impl wkt::message::Message for Error {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ToolCallResult.Error"
}
}
/// Specifies the source of this tool call.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Source {
/// Optional. The [tool][google.cloud.dialogflow.v2.Tool] associated with
/// this call. Format:
/// `projects/<ProjectID>/locations/<LocationID>/tools/<ToolID>`.
///
/// [google.cloud.dialogflow.v2.Tool]: crate::model::Tool
Tool(std::string::String),
/// Optional. CES toolset name for this call.
/// Format:
/// `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>/toolsets/ToolsetID>`.
CesToolset(std::string::String),
/// Optional. CES tool name for this call.
/// Format:
/// `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>/tools/<ToolID>`.
CesTool(std::string::String),
/// Optional. CES app name for this call.
/// Format:
/// `projects/<ProjectID>/locations/<LocationID>/apps/<AppID>`.
CesApp(std::string::String),
}
/// The tool call's result.
#[cfg(any(
feature = "answer-records",
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
feature = "participants",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Result {
/// The tool call's error.
Error(std::boxed::Box<crate::model::tool_call_result::Error>),
/// Only populated if the response content is not utf-8 encoded.
/// (by definition byte fields are base64 encoded).
RawContent(::bytes::Bytes),
/// Only populated if the response content is utf-8 encoded.
Content(std::string::String),
}
}
/// A tool that is created from a toolset.
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ToolsetTool {
/// Required. The name of the toolset to retrieve the schema for.
/// Format:
/// `projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
pub toolset: std::string::String,
/// Optional. The operationId field of the OpenAPI endpoint. The operationId
/// must be present in the toolset's definition.
pub operation_id: std::string::String,
/// Optional. Indicates whether the tool requires human confirmation.
pub confirmation_requirement: crate::model::tool::ConfirmationRequirement,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl ToolsetTool {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [toolset][crate::model::ToolsetTool::toolset].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolsetTool;
/// let x = ToolsetTool::new().set_toolset("example");
/// ```
pub fn set_toolset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.toolset = v.into();
self
}
/// Sets the value of [operation_id][crate::model::ToolsetTool::operation_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolsetTool;
/// let x = ToolsetTool::new().set_operation_id("example");
/// ```
pub fn set_operation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.operation_id = v.into();
self
}
/// Sets the value of [confirmation_requirement][crate::model::ToolsetTool::confirmation_requirement].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ToolsetTool;
/// use google_cloud_dialogflow_v2::model::tool::ConfirmationRequirement;
/// let x0 = ToolsetTool::new().set_confirmation_requirement(ConfirmationRequirement::Required);
/// let x1 = ToolsetTool::new().set_confirmation_requirement(ConfirmationRequirement::NotRequired);
/// ```
pub fn set_confirmation_requirement<
T: std::convert::Into<crate::model::tool::ConfirmationRequirement>,
>(
mut self,
v: T,
) -> Self {
self.confirmation_requirement = v.into();
self
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl wkt::message::Message for ToolsetTool {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ToolsetTool"
}
}
/// Represents a single validation error.
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ValidationError {
/// The severity of the error.
pub severity: crate::model::validation_error::Severity,
/// The names of the entries that the error is associated with.
/// Format:
///
/// - `projects/<Project ID>/agent`, if the error is associated with the entire
/// agent.
/// - `projects/<Project ID>/agent/intents/<Intent ID>`, if the error is
/// associated with certain intents.
/// - `projects/<Project ID>/agent/intents/<Intent
/// Id>/trainingPhrases/<Training Phrase ID>`, if the error is associated with
/// certain intent training phrases.
/// - `projects/<Project ID>/agent/intents/<Intent Id>/parameters/<Parameter
/// ID>`, if the error is associated with certain intent parameters.
/// - `projects/<Project ID>/agent/entities/<Entity ID>`, if the error is
/// associated with certain entities.
pub entries: std::vec::Vec<std::string::String>,
/// The detailed error message.
pub error_message: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl ValidationError {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [severity][crate::model::ValidationError::severity].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ValidationError;
/// use google_cloud_dialogflow_v2::model::validation_error::Severity;
/// let x0 = ValidationError::new().set_severity(Severity::Info);
/// let x1 = ValidationError::new().set_severity(Severity::Warning);
/// let x2 = ValidationError::new().set_severity(Severity::Error);
/// ```
pub fn set_severity<T: std::convert::Into<crate::model::validation_error::Severity>>(
mut self,
v: T,
) -> Self {
self.severity = v.into();
self
}
/// Sets the value of [entries][crate::model::ValidationError::entries].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ValidationError;
/// let x = ValidationError::new().set_entries(["a", "b", "c"]);
/// ```
pub fn set_entries<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.entries = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [error_message][crate::model::ValidationError::error_message].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ValidationError;
/// let x = ValidationError::new().set_error_message("example");
/// ```
pub fn set_error_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.error_message = v.into();
self
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for ValidationError {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ValidationError"
}
}
/// Defines additional types related to [ValidationError].
#[cfg(feature = "agents")]
pub mod validation_error {
#[allow(unused_imports)]
use super::*;
/// Represents a level of severity.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "agents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Severity {
/// Not specified. This value should never be used.
Unspecified,
/// The agent doesn't follow Dialogflow best practices.
Info,
/// The agent may not behave as expected.
Warning,
/// The agent may experience partial failures.
Error,
/// The agent may completely fail.
Critical,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [Severity::value] or
/// [Severity::name].
UnknownValue(severity::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "agents")]
pub mod severity {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "agents")]
impl Severity {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Info => std::option::Option::Some(1),
Self::Warning => std::option::Option::Some(2),
Self::Error => std::option::Option::Some(3),
Self::Critical => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
Self::Info => std::option::Option::Some("INFO"),
Self::Warning => std::option::Option::Some("WARNING"),
Self::Error => std::option::Option::Some("ERROR"),
Self::Critical => std::option::Option::Some("CRITICAL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "agents")]
impl std::default::Default for Severity {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "agents")]
impl std::fmt::Display for Severity {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "agents")]
impl std::convert::From<i32> for Severity {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Info,
2 => Self::Warning,
3 => Self::Error,
4 => Self::Critical,
_ => Self::UnknownValue(severity::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "agents")]
impl std::convert::From<&str> for Severity {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SEVERITY_UNSPECIFIED" => Self::Unspecified,
"INFO" => Self::Info,
"WARNING" => Self::Warning,
"ERROR" => Self::Error,
"CRITICAL" => Self::Critical,
_ => Self::UnknownValue(severity::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "agents")]
impl serde::ser::Serialize for Severity {
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::Info => serializer.serialize_i32(1),
Self::Warning => serializer.serialize_i32(2),
Self::Error => serializer.serialize_i32(3),
Self::Critical => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "agents")]
impl<'de> serde::de::Deserialize<'de> for Severity {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
".google.cloud.dialogflow.v2.ValidationError.Severity",
))
}
}
}
/// Represents the output of agent validation.
#[cfg(feature = "agents")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ValidationResult {
/// Contains all validation errors.
pub validation_errors: std::vec::Vec<crate::model::ValidationError>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "agents")]
impl ValidationResult {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [validation_errors][crate::model::ValidationResult::validation_errors].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ValidationResult;
/// use google_cloud_dialogflow_v2::model::ValidationError;
/// let x = ValidationResult::new()
/// .set_validation_errors([
/// ValidationError::default()/* use setters */,
/// ValidationError::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_validation_errors<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ValidationError>,
{
use std::iter::Iterator;
self.validation_errors = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(feature = "agents")]
impl wkt::message::Message for ValidationResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ValidationResult"
}
}
/// You can create multiple versions of your agent and publish them to separate
/// environments.
///
/// When you edit an agent, you are editing the draft agent. At any point, you
/// can save the draft agent as an agent version, which is an immutable snapshot
/// of your agent.
///
/// When you save the draft agent, it is published to the default environment.
/// When you create agent versions, you can publish them to custom environments.
/// You can create a variety of custom environments for:
///
/// - testing
/// - development
/// - production
/// - etc.
///
/// For more information, see the [versions and environments
/// guide](https://cloud.google.com/dialogflow/docs/agents-versions).
#[cfg(feature = "versions")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Version {
/// Output only. The unique identifier of this agent version.
/// Supported formats:
///
/// - `projects/<Project ID>/agent/versions/<Version ID>`
/// - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version
/// ID>`
pub name: std::string::String,
/// Optional. The developer-provided description of this version.
pub description: std::string::String,
/// Output only. The sequential number of this version. This field is read-only
/// which means it cannot be set by create and update methods.
pub version_number: i32,
/// Output only. The creation time of this version. This field is read-only,
/// i.e., it cannot be set by create and update methods.
pub create_time: std::option::Option<wkt::Timestamp>,
/// Output only. The status of this version. This field is read-only and cannot
/// be set by create and update methods.
pub status: crate::model::version::VersionStatus,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "versions")]
impl Version {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::Version::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Version;
/// let x = Version::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
/// Sets the value of [description][crate::model::Version::description].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Version;
/// let x = Version::new().set_description("example");
/// ```
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
/// Sets the value of [version_number][crate::model::Version::version_number].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Version;
/// let x = Version::new().set_version_number(42);
/// ```
pub fn set_version_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.version_number = v.into();
self
}
/// Sets the value of [create_time][crate::model::Version::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Version;
/// use wkt::Timestamp;
/// let x = Version::new().set_create_time(Timestamp::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [create_time][crate::model::Version::create_time].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Version;
/// use wkt::Timestamp;
/// let x = Version::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
/// let x = Version::new().set_or_clear_create_time(None::<Timestamp>);
/// ```
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
}
/// Sets the value of [status][crate::model::Version::status].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::Version;
/// use google_cloud_dialogflow_v2::model::version::VersionStatus;
/// let x0 = Version::new().set_status(VersionStatus::InProgress);
/// let x1 = Version::new().set_status(VersionStatus::Ready);
/// let x2 = Version::new().set_status(VersionStatus::Failed);
/// ```
pub fn set_status<T: std::convert::Into<crate::model::version::VersionStatus>>(
mut self,
v: T,
) -> Self {
self.status = v.into();
self
}
}
#[cfg(feature = "versions")]
impl wkt::message::Message for Version {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.Version"
}
}
/// Defines additional types related to [Version].
#[cfg(feature = "versions")]
pub mod version {
#[allow(unused_imports)]
use super::*;
/// The status of a version.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "versions")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum VersionStatus {
/// Not specified. This value is not used.
Unspecified,
/// Version is not ready to serve (e.g. training is in progress).
InProgress,
/// Version is ready to serve.
Ready,
/// Version training failed.
Failed,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [VersionStatus::value] or
/// [VersionStatus::name].
UnknownValue(version_status::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "versions")]
pub mod version_status {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "versions")]
impl VersionStatus {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::InProgress => std::option::Option::Some(1),
Self::Ready => std::option::Option::Some(2),
Self::Failed => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("VERSION_STATUS_UNSPECIFIED"),
Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
Self::Ready => std::option::Option::Some("READY"),
Self::Failed => std::option::Option::Some("FAILED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "versions")]
impl std::default::Default for VersionStatus {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "versions")]
impl std::fmt::Display for VersionStatus {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "versions")]
impl std::convert::From<i32> for VersionStatus {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::InProgress,
2 => Self::Ready,
3 => Self::Failed,
_ => Self::UnknownValue(version_status::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "versions")]
impl std::convert::From<&str> for VersionStatus {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"VERSION_STATUS_UNSPECIFIED" => Self::Unspecified,
"IN_PROGRESS" => Self::InProgress,
"READY" => Self::Ready,
"FAILED" => Self::Failed,
_ => Self::UnknownValue(version_status::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "versions")]
impl serde::ser::Serialize for VersionStatus {
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::InProgress => serializer.serialize_i32(1),
Self::Ready => serializer.serialize_i32(2),
Self::Failed => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "versions")]
impl<'de> serde::de::Deserialize<'de> for VersionStatus {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<VersionStatus>::new(
".google.cloud.dialogflow.v2.Version.VersionStatus",
))
}
}
}
/// The request message for
/// [Versions.ListVersions][google.cloud.dialogflow.v2.Versions.ListVersions].
///
/// [google.cloud.dialogflow.v2.Versions.ListVersions]: crate::client::Versions::list_versions
#[cfg(feature = "versions")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListVersionsRequest {
/// Required. The agent to list all versions from.
/// Supported formats:
///
/// - `projects/<Project ID>/agent`
/// - `projects/<Project ID>/locations/<Location ID>/agent`
pub parent: std::string::String,
/// Optional. The maximum number of items to return in a single page. By
/// default 100 and at most 1000.
pub page_size: i32,
/// Optional. The next_page_token value returned from a previous list request.
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "versions")]
impl ListVersionsRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::ListVersionsRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListVersionsRequest;
/// let x = ListVersionsRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [page_size][crate::model::ListVersionsRequest::page_size].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListVersionsRequest;
/// let x = ListVersionsRequest::new().set_page_size(42);
/// ```
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
/// Sets the value of [page_token][crate::model::ListVersionsRequest::page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListVersionsRequest;
/// let x = ListVersionsRequest::new().set_page_token("example");
/// ```
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
#[cfg(feature = "versions")]
impl wkt::message::Message for ListVersionsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListVersionsRequest"
}
}
/// The response message for
/// [Versions.ListVersions][google.cloud.dialogflow.v2.Versions.ListVersions].
///
/// [google.cloud.dialogflow.v2.Versions.ListVersions]: crate::client::Versions::list_versions
#[cfg(feature = "versions")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListVersionsResponse {
/// The list of agent versions. There will be a maximum number of items
/// returned based on the page_size field in the request.
pub versions: std::vec::Vec<crate::model::Version>,
/// Token to retrieve the next page of results, or empty if there are no
/// more results in the list.
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "versions")]
impl ListVersionsResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [versions][crate::model::ListVersionsResponse::versions].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListVersionsResponse;
/// use google_cloud_dialogflow_v2::model::Version;
/// let x = ListVersionsResponse::new()
/// .set_versions([
/// Version::default()/* use setters */,
/// Version::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_versions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Version>,
{
use std::iter::Iterator;
self.versions = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [next_page_token][crate::model::ListVersionsResponse::next_page_token].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::ListVersionsResponse;
/// let x = ListVersionsResponse::new().set_next_page_token("example");
/// ```
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
}
}
#[cfg(feature = "versions")]
impl wkt::message::Message for ListVersionsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.ListVersionsResponse"
}
}
#[cfg(feature = "versions")]
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListVersionsResponse {
type PageItem = crate::model::Version;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.versions
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
/// The request message for
/// [Versions.GetVersion][google.cloud.dialogflow.v2.Versions.GetVersion].
///
/// [google.cloud.dialogflow.v2.Versions.GetVersion]: crate::client::Versions::get_version
#[cfg(feature = "versions")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetVersionRequest {
/// Required. The name of the version.
/// Supported formats:
///
/// - `projects/<Project ID>/agent/versions/<Version ID>`
/// - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version
/// ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "versions")]
impl GetVersionRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::GetVersionRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::GetVersionRequest;
/// let x = GetVersionRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "versions")]
impl wkt::message::Message for GetVersionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.GetVersionRequest"
}
}
/// The request message for
/// [Versions.CreateVersion][google.cloud.dialogflow.v2.Versions.CreateVersion].
///
/// [google.cloud.dialogflow.v2.Versions.CreateVersion]: crate::client::Versions::create_version
#[cfg(feature = "versions")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateVersionRequest {
/// Required. The agent to create a version for.
/// Supported formats:
///
/// - `projects/<Project ID>/agent`
/// - `projects/<Project ID>/locations/<Location ID>/agent`
pub parent: std::string::String,
/// Required. The version to create.
pub version: std::option::Option<crate::model::Version>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "versions")]
impl CreateVersionRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [parent][crate::model::CreateVersionRequest::parent].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateVersionRequest;
/// let x = CreateVersionRequest::new().set_parent("example");
/// ```
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
/// Sets the value of [version][crate::model::CreateVersionRequest::version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateVersionRequest;
/// use google_cloud_dialogflow_v2::model::Version;
/// let x = CreateVersionRequest::new().set_version(Version::default()/* use setters */);
/// ```
pub fn set_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.version = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [version][crate::model::CreateVersionRequest::version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::CreateVersionRequest;
/// use google_cloud_dialogflow_v2::model::Version;
/// let x = CreateVersionRequest::new().set_or_clear_version(Some(Version::default()/* use setters */));
/// let x = CreateVersionRequest::new().set_or_clear_version(None::<Version>);
/// ```
pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.version = v.map(|x| x.into());
self
}
}
#[cfg(feature = "versions")]
impl wkt::message::Message for CreateVersionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.CreateVersionRequest"
}
}
/// The request message for
/// [Versions.UpdateVersion][google.cloud.dialogflow.v2.Versions.UpdateVersion].
///
/// [google.cloud.dialogflow.v2.Versions.UpdateVersion]: crate::client::Versions::update_version
#[cfg(feature = "versions")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateVersionRequest {
/// Required. The version to update.
/// Supported formats:
///
/// - `projects/<Project ID>/agent/versions/<Version ID>`
/// - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version
/// ID>`
pub version: std::option::Option<crate::model::Version>,
/// Required. The mask to control which fields get updated.
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "versions")]
impl UpdateVersionRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [version][crate::model::UpdateVersionRequest::version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateVersionRequest;
/// use google_cloud_dialogflow_v2::model::Version;
/// let x = UpdateVersionRequest::new().set_version(Version::default()/* use setters */);
/// ```
pub fn set_version<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.version = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [version][crate::model::UpdateVersionRequest::version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateVersionRequest;
/// use google_cloud_dialogflow_v2::model::Version;
/// let x = UpdateVersionRequest::new().set_or_clear_version(Some(Version::default()/* use setters */));
/// let x = UpdateVersionRequest::new().set_or_clear_version(None::<Version>);
/// ```
pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Version>,
{
self.version = v.map(|x| x.into());
self
}
/// Sets the value of [update_mask][crate::model::UpdateVersionRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateVersionRequest;
/// use wkt::FieldMask;
/// let x = UpdateVersionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
/// ```
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
}
/// Sets or clears the value of [update_mask][crate::model::UpdateVersionRequest::update_mask].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::UpdateVersionRequest;
/// use wkt::FieldMask;
/// let x = UpdateVersionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
/// let x = UpdateVersionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
/// ```
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
}
}
#[cfg(feature = "versions")]
impl wkt::message::Message for UpdateVersionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.UpdateVersionRequest"
}
}
/// The request message for
/// [Versions.DeleteVersion][google.cloud.dialogflow.v2.Versions.DeleteVersion].
///
/// [google.cloud.dialogflow.v2.Versions.DeleteVersion]: crate::client::Versions::delete_version
#[cfg(feature = "versions")]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteVersionRequest {
/// Required. The name of the version to delete.
/// Supported formats:
///
/// - `projects/<Project ID>/agent/versions/<Version ID>`
/// - `projects/<Project ID>/locations/<Location ID>/agent/versions/<Version
/// ID>`
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(feature = "versions")]
impl DeleteVersionRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [name][crate::model::DeleteVersionRequest::name].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::DeleteVersionRequest;
/// let x = DeleteVersionRequest::new().set_name("example");
/// ```
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
#[cfg(feature = "versions")]
impl wkt::message::Message for DeleteVersionRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.DeleteVersionRequest"
}
}
/// The request message for a webhook call.
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct WebhookRequest {
/// The unique identifier of detectIntent request session.
/// Can be used to identify end-user inside webhook implementation.
/// Format: `projects/<Project ID>/agent/sessions/<Session ID>`, or
/// `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
/// ID>/sessions/<Session ID>`.
pub session: std::string::String,
/// The unique identifier of the response. Contains the same value as
/// `[Streaming]DetectIntentResponse.response_id`.
pub response_id: std::string::String,
/// The result of the conversational query or event processing. Contains the
/// same value as `[Streaming]DetectIntentResponse.query_result`.
pub query_result: std::option::Option<crate::model::QueryResult>,
/// Optional. The contents of the original request that was passed to
/// `[Streaming]DetectIntent` call.
pub original_detect_intent_request:
std::option::Option<crate::model::OriginalDetectIntentRequest>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl WebhookRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [session][crate::model::WebhookRequest::session].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookRequest;
/// let x = WebhookRequest::new().set_session("example");
/// ```
pub fn set_session<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.session = v.into();
self
}
/// Sets the value of [response_id][crate::model::WebhookRequest::response_id].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookRequest;
/// let x = WebhookRequest::new().set_response_id("example");
/// ```
pub fn set_response_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.response_id = v.into();
self
}
/// Sets the value of [query_result][crate::model::WebhookRequest::query_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookRequest;
/// use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = WebhookRequest::new().set_query_result(QueryResult::default()/* use setters */);
/// ```
pub fn set_query_result<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::QueryResult>,
{
self.query_result = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [query_result][crate::model::WebhookRequest::query_result].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookRequest;
/// use google_cloud_dialogflow_v2::model::QueryResult;
/// let x = WebhookRequest::new().set_or_clear_query_result(Some(QueryResult::default()/* use setters */));
/// let x = WebhookRequest::new().set_or_clear_query_result(None::<QueryResult>);
/// ```
pub fn set_or_clear_query_result<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::QueryResult>,
{
self.query_result = v.map(|x| x.into());
self
}
/// Sets the value of [original_detect_intent_request][crate::model::WebhookRequest::original_detect_intent_request].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookRequest;
/// use google_cloud_dialogflow_v2::model::OriginalDetectIntentRequest;
/// let x = WebhookRequest::new().set_original_detect_intent_request(OriginalDetectIntentRequest::default()/* use setters */);
/// ```
pub fn set_original_detect_intent_request<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::OriginalDetectIntentRequest>,
{
self.original_detect_intent_request = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [original_detect_intent_request][crate::model::WebhookRequest::original_detect_intent_request].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookRequest;
/// use google_cloud_dialogflow_v2::model::OriginalDetectIntentRequest;
/// let x = WebhookRequest::new().set_or_clear_original_detect_intent_request(Some(OriginalDetectIntentRequest::default()/* use setters */));
/// let x = WebhookRequest::new().set_or_clear_original_detect_intent_request(None::<OriginalDetectIntentRequest>);
/// ```
pub fn set_or_clear_original_detect_intent_request<T>(
mut self,
v: std::option::Option<T>,
) -> Self
where
T: std::convert::Into<crate::model::OriginalDetectIntentRequest>,
{
self.original_detect_intent_request = v.map(|x| x.into());
self
}
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl wkt::message::Message for WebhookRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.WebhookRequest"
}
}
/// The response message for a webhook call.
///
/// This response is validated by the Dialogflow server. If validation fails,
/// an error will be returned in the
/// [QueryResult.diagnostic_info][google.cloud.dialogflow.v2.QueryResult.diagnostic_info]
/// field. Setting JSON fields to an empty value with the wrong type is a common
/// error. To avoid this error:
///
/// - Use `""` for empty strings
/// - Use `{}` or `null` for empty objects
/// - Use `[]` or `null` for empty arrays
///
/// For more information, see the
/// [Protocol Buffers Language
/// Guide](https://developers.google.com/protocol-buffers/docs/proto3#json).
///
/// [google.cloud.dialogflow.v2.QueryResult.diagnostic_info]: crate::model::QueryResult::diagnostic_info
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct WebhookResponse {
/// Optional. The text response message intended for the end-user.
/// It is recommended to use `fulfillment_messages.text.text[0]` instead.
/// When provided, Dialogflow uses this field to populate
/// [QueryResult.fulfillment_text][google.cloud.dialogflow.v2.QueryResult.fulfillment_text]
/// sent to the integration or API caller.
///
/// [google.cloud.dialogflow.v2.QueryResult.fulfillment_text]: crate::model::QueryResult::fulfillment_text
pub fulfillment_text: std::string::String,
/// Optional. The rich response messages intended for the end-user.
/// When provided, Dialogflow uses this field to populate
/// [QueryResult.fulfillment_messages][google.cloud.dialogflow.v2.QueryResult.fulfillment_messages]
/// sent to the integration or API caller.
///
/// [google.cloud.dialogflow.v2.QueryResult.fulfillment_messages]: crate::model::QueryResult::fulfillment_messages
pub fulfillment_messages: std::vec::Vec<crate::model::intent::Message>,
/// Optional. A custom field used to identify the webhook source.
/// Arbitrary strings are supported.
/// When provided, Dialogflow uses this field to populate
/// [QueryResult.webhook_source][google.cloud.dialogflow.v2.QueryResult.webhook_source]
/// sent to the integration or API caller.
///
/// [google.cloud.dialogflow.v2.QueryResult.webhook_source]: crate::model::QueryResult::webhook_source
pub source: std::string::String,
/// Optional. This field can be used to pass custom data from your webhook to
/// the integration or API caller. Arbitrary JSON objects are supported. When
/// provided, Dialogflow uses this field to populate
/// [QueryResult.webhook_payload][google.cloud.dialogflow.v2.QueryResult.webhook_payload]
/// sent to the integration or API caller. This field is also used by the
/// [Google Assistant
/// integration](https://cloud.google.com/dialogflow/docs/integrations/aog)
/// for rich response messages.
/// See the format definition at [Google Assistant Dialogflow webhook
/// format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json)
///
/// [google.cloud.dialogflow.v2.QueryResult.webhook_payload]: crate::model::QueryResult::webhook_payload
pub payload: std::option::Option<wkt::Struct>,
/// Optional. The collection of output contexts that will overwrite currently
/// active contexts for the session and reset their lifespans.
/// When provided, Dialogflow uses this field to populate
/// [QueryResult.output_contexts][google.cloud.dialogflow.v2.QueryResult.output_contexts]
/// sent to the integration or API caller.
///
/// [google.cloud.dialogflow.v2.QueryResult.output_contexts]: crate::model::QueryResult::output_contexts
pub output_contexts: std::vec::Vec<crate::model::Context>,
/// Optional. Invokes the supplied events.
/// When this field is set, Dialogflow ignores the `fulfillment_text`,
/// `fulfillment_messages`, and `payload` fields.
pub followup_event_input: std::option::Option<crate::model::EventInput>,
/// Optional. Additional session entity types to replace or extend developer
/// entity types with. The entity synonyms apply to all languages and persist
/// for the session. Setting this data from a webhook overwrites
/// the session entity types that have been set using `detectIntent`,
/// `streamingDetectIntent` or
/// [SessionEntityType][google.cloud.dialogflow.v2.SessionEntityType]
/// management methods.
///
/// [google.cloud.dialogflow.v2.SessionEntityType]: crate::model::SessionEntityType
pub session_entity_types: std::vec::Vec<crate::model::SessionEntityType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl WebhookResponse {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [fulfillment_text][crate::model::WebhookResponse::fulfillment_text].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookResponse;
/// let x = WebhookResponse::new().set_fulfillment_text("example");
/// ```
pub fn set_fulfillment_text<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.fulfillment_text = v.into();
self
}
/// Sets the value of [fulfillment_messages][crate::model::WebhookResponse::fulfillment_messages].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookResponse;
/// use google_cloud_dialogflow_v2::model::intent::Message;
/// let x = WebhookResponse::new()
/// .set_fulfillment_messages([
/// Message::default()/* use setters */,
/// Message::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_fulfillment_messages<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::intent::Message>,
{
use std::iter::Iterator;
self.fulfillment_messages = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [source][crate::model::WebhookResponse::source].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookResponse;
/// let x = WebhookResponse::new().set_source("example");
/// ```
pub fn set_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source = v.into();
self
}
/// Sets the value of [payload][crate::model::WebhookResponse::payload].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookResponse;
/// use wkt::Struct;
/// let x = WebhookResponse::new().set_payload(Struct::default()/* use setters */);
/// ```
pub fn set_payload<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.payload = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [payload][crate::model::WebhookResponse::payload].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookResponse;
/// use wkt::Struct;
/// let x = WebhookResponse::new().set_or_clear_payload(Some(Struct::default()/* use setters */));
/// let x = WebhookResponse::new().set_or_clear_payload(None::<Struct>);
/// ```
pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.payload = v.map(|x| x.into());
self
}
/// Sets the value of [output_contexts][crate::model::WebhookResponse::output_contexts].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookResponse;
/// use google_cloud_dialogflow_v2::model::Context;
/// let x = WebhookResponse::new()
/// .set_output_contexts([
/// Context::default()/* use setters */,
/// Context::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_output_contexts<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Context>,
{
use std::iter::Iterator;
self.output_contexts = v.into_iter().map(|i| i.into()).collect();
self
}
/// Sets the value of [followup_event_input][crate::model::WebhookResponse::followup_event_input].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookResponse;
/// use google_cloud_dialogflow_v2::model::EventInput;
/// let x = WebhookResponse::new().set_followup_event_input(EventInput::default()/* use setters */);
/// ```
pub fn set_followup_event_input<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::EventInput>,
{
self.followup_event_input = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [followup_event_input][crate::model::WebhookResponse::followup_event_input].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookResponse;
/// use google_cloud_dialogflow_v2::model::EventInput;
/// let x = WebhookResponse::new().set_or_clear_followup_event_input(Some(EventInput::default()/* use setters */));
/// let x = WebhookResponse::new().set_or_clear_followup_event_input(None::<EventInput>);
/// ```
pub fn set_or_clear_followup_event_input<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::EventInput>,
{
self.followup_event_input = v.map(|x| x.into());
self
}
/// Sets the value of [session_entity_types][crate::model::WebhookResponse::session_entity_types].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::WebhookResponse;
/// use google_cloud_dialogflow_v2::model::SessionEntityType;
/// let x = WebhookResponse::new()
/// .set_session_entity_types([
/// SessionEntityType::default()/* use setters */,
/// SessionEntityType::default()/* use (different) setters */,
/// ]);
/// ```
pub fn set_session_entity_types<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SessionEntityType>,
{
use std::iter::Iterator;
self.session_entity_types = v.into_iter().map(|i| i.into()).collect();
self
}
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl wkt::message::Message for WebhookResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.WebhookResponse"
}
}
/// Represents the contents of the original request that was passed to
/// the `[Streaming]DetectIntent` call.
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OriginalDetectIntentRequest {
/// The source of this request, e.g., `google`, `facebook`, `slack`. It is set
/// by Dialogflow-owned servers.
pub source: std::string::String,
/// Optional. The version of the protocol used for this request.
/// This field is AoG-specific.
pub version: std::string::String,
/// Optional. This field is set to the value of the `QueryParameters.payload`
/// field passed in the request. Some integrations that query a Dialogflow
/// agent may provide additional information in the payload.
///
/// In particular, for the Dialogflow Phone Gateway integration, this field has
/// the form:
///
/// Note: The caller ID field (`caller_id`) will be redacted for Trial
/// Edition agents and populated with the caller ID in [E.164
/// format](https://en.wikipedia.org/wiki/E.164) for Essentials Edition agents.
pub payload: std::option::Option<wkt::Struct>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl OriginalDetectIntentRequest {
/// Creates a new default instance.
pub fn new() -> Self {
std::default::Default::default()
}
/// Sets the value of [source][crate::model::OriginalDetectIntentRequest::source].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::OriginalDetectIntentRequest;
/// let x = OriginalDetectIntentRequest::new().set_source("example");
/// ```
pub fn set_source<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.source = v.into();
self
}
/// Sets the value of [version][crate::model::OriginalDetectIntentRequest::version].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::OriginalDetectIntentRequest;
/// let x = OriginalDetectIntentRequest::new().set_version("example");
/// ```
pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.version = v.into();
self
}
/// Sets the value of [payload][crate::model::OriginalDetectIntentRequest::payload].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::OriginalDetectIntentRequest;
/// use wkt::Struct;
/// let x = OriginalDetectIntentRequest::new().set_payload(Struct::default()/* use setters */);
/// ```
pub fn set_payload<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.payload = std::option::Option::Some(v.into());
self
}
/// Sets or clears the value of [payload][crate::model::OriginalDetectIntentRequest::payload].
///
/// # Example
/// ```ignore,no_run
/// # use google_cloud_dialogflow_v2::model::OriginalDetectIntentRequest;
/// use wkt::Struct;
/// let x = OriginalDetectIntentRequest::new().set_or_clear_payload(Some(Struct::default()/* use setters */));
/// let x = OriginalDetectIntentRequest::new().set_or_clear_payload(None::<Struct>);
/// ```
pub fn set_or_clear_payload<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Struct>,
{
self.payload = v.map(|x| x.into());
self
}
}
#[cfg(all(
feature = "agents",
feature = "answer-records",
feature = "contexts",
feature = "conversation-datasets",
feature = "conversation-models",
feature = "conversation-profiles",
feature = "conversations",
feature = "documents",
feature = "encryption-spec-service",
feature = "entity-types",
feature = "environments",
feature = "fulfillments",
feature = "generator-evaluations",
feature = "generators",
feature = "intents",
feature = "knowledge-bases",
feature = "participants",
feature = "session-entity-types",
feature = "sessions",
feature = "sip-trunks",
feature = "tools",
feature = "versions",
))]
impl wkt::message::Message for OriginalDetectIntentRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.dialogflow.v2.OriginalDetectIntentRequest"
}
}
/// [DTMF](https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling)
/// digit in Telephony Gateway.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "participants")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TelephonyDtmf {
/// Not specified. This value may be used to indicate an absent digit.
Unspecified,
/// Number: '1'.
DtmfOne,
/// Number: '2'.
DtmfTwo,
/// Number: '3'.
DtmfThree,
/// Number: '4'.
DtmfFour,
/// Number: '5'.
DtmfFive,
/// Number: '6'.
DtmfSix,
/// Number: '7'.
DtmfSeven,
/// Number: '8'.
DtmfEight,
/// Number: '9'.
DtmfNine,
/// Number: '0'.
DtmfZero,
/// Letter: 'A'.
DtmfA,
/// Letter: 'B'.
DtmfB,
/// Letter: 'C'.
DtmfC,
/// Letter: 'D'.
DtmfD,
/// Asterisk/star: '*'.
DtmfStar,
/// Pound/diamond/hash/square/gate/octothorpe: '#'.
DtmfPound,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [TelephonyDtmf::value] or
/// [TelephonyDtmf::name].
UnknownValue(telephony_dtmf::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "participants")]
pub mod telephony_dtmf {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "participants")]
impl TelephonyDtmf {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::DtmfOne => std::option::Option::Some(1),
Self::DtmfTwo => std::option::Option::Some(2),
Self::DtmfThree => std::option::Option::Some(3),
Self::DtmfFour => std::option::Option::Some(4),
Self::DtmfFive => std::option::Option::Some(5),
Self::DtmfSix => std::option::Option::Some(6),
Self::DtmfSeven => std::option::Option::Some(7),
Self::DtmfEight => std::option::Option::Some(8),
Self::DtmfNine => std::option::Option::Some(9),
Self::DtmfZero => std::option::Option::Some(10),
Self::DtmfA => std::option::Option::Some(11),
Self::DtmfB => std::option::Option::Some(12),
Self::DtmfC => std::option::Option::Some(13),
Self::DtmfD => std::option::Option::Some(14),
Self::DtmfStar => std::option::Option::Some(15),
Self::DtmfPound => std::option::Option::Some(16),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TELEPHONY_DTMF_UNSPECIFIED"),
Self::DtmfOne => std::option::Option::Some("DTMF_ONE"),
Self::DtmfTwo => std::option::Option::Some("DTMF_TWO"),
Self::DtmfThree => std::option::Option::Some("DTMF_THREE"),
Self::DtmfFour => std::option::Option::Some("DTMF_FOUR"),
Self::DtmfFive => std::option::Option::Some("DTMF_FIVE"),
Self::DtmfSix => std::option::Option::Some("DTMF_SIX"),
Self::DtmfSeven => std::option::Option::Some("DTMF_SEVEN"),
Self::DtmfEight => std::option::Option::Some("DTMF_EIGHT"),
Self::DtmfNine => std::option::Option::Some("DTMF_NINE"),
Self::DtmfZero => std::option::Option::Some("DTMF_ZERO"),
Self::DtmfA => std::option::Option::Some("DTMF_A"),
Self::DtmfB => std::option::Option::Some("DTMF_B"),
Self::DtmfC => std::option::Option::Some("DTMF_C"),
Self::DtmfD => std::option::Option::Some("DTMF_D"),
Self::DtmfStar => std::option::Option::Some("DTMF_STAR"),
Self::DtmfPound => std::option::Option::Some("DTMF_POUND"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "participants")]
impl std::default::Default for TelephonyDtmf {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "participants")]
impl std::fmt::Display for TelephonyDtmf {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "participants")]
impl std::convert::From<i32> for TelephonyDtmf {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::DtmfOne,
2 => Self::DtmfTwo,
3 => Self::DtmfThree,
4 => Self::DtmfFour,
5 => Self::DtmfFive,
6 => Self::DtmfSix,
7 => Self::DtmfSeven,
8 => Self::DtmfEight,
9 => Self::DtmfNine,
10 => Self::DtmfZero,
11 => Self::DtmfA,
12 => Self::DtmfB,
13 => Self::DtmfC,
14 => Self::DtmfD,
15 => Self::DtmfStar,
16 => Self::DtmfPound,
_ => Self::UnknownValue(telephony_dtmf::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "participants")]
impl std::convert::From<&str> for TelephonyDtmf {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TELEPHONY_DTMF_UNSPECIFIED" => Self::Unspecified,
"DTMF_ONE" => Self::DtmfOne,
"DTMF_TWO" => Self::DtmfTwo,
"DTMF_THREE" => Self::DtmfThree,
"DTMF_FOUR" => Self::DtmfFour,
"DTMF_FIVE" => Self::DtmfFive,
"DTMF_SIX" => Self::DtmfSix,
"DTMF_SEVEN" => Self::DtmfSeven,
"DTMF_EIGHT" => Self::DtmfEight,
"DTMF_NINE" => Self::DtmfNine,
"DTMF_ZERO" => Self::DtmfZero,
"DTMF_A" => Self::DtmfA,
"DTMF_B" => Self::DtmfB,
"DTMF_C" => Self::DtmfC,
"DTMF_D" => Self::DtmfD,
"DTMF_STAR" => Self::DtmfStar,
"DTMF_POUND" => Self::DtmfPound,
_ => Self::UnknownValue(telephony_dtmf::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "participants")]
impl serde::ser::Serialize for TelephonyDtmf {
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::DtmfOne => serializer.serialize_i32(1),
Self::DtmfTwo => serializer.serialize_i32(2),
Self::DtmfThree => serializer.serialize_i32(3),
Self::DtmfFour => serializer.serialize_i32(4),
Self::DtmfFive => serializer.serialize_i32(5),
Self::DtmfSix => serializer.serialize_i32(6),
Self::DtmfSeven => serializer.serialize_i32(7),
Self::DtmfEight => serializer.serialize_i32(8),
Self::DtmfNine => serializer.serialize_i32(9),
Self::DtmfZero => serializer.serialize_i32(10),
Self::DtmfA => serializer.serialize_i32(11),
Self::DtmfB => serializer.serialize_i32(12),
Self::DtmfC => serializer.serialize_i32(13),
Self::DtmfD => serializer.serialize_i32(14),
Self::DtmfStar => serializer.serialize_i32(15),
Self::DtmfPound => serializer.serialize_i32(16),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "participants")]
impl<'de> serde::de::Deserialize<'de> for TelephonyDtmf {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TelephonyDtmf>::new(
".google.cloud.dialogflow.v2.TelephonyDtmf",
))
}
}
/// Audio encoding of the audio content sent in the conversational query request.
/// Refer to the
/// [Cloud Speech API
/// documentation](https://cloud.google.com/speech-to-text/docs/basics) for more
/// details.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AudioEncoding {
/// Not specified.
Unspecified,
/// Uncompressed 16-bit signed little-endian samples (Linear PCM).
Linear16,
/// [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio
/// Codec) is the recommended encoding because it is lossless (therefore
/// recognition is not compromised) and requires only about half the
/// bandwidth of `LINEAR16`. `FLAC` stream encoding supports 16-bit and
/// 24-bit samples, however, not all fields in `STREAMINFO` are supported.
Flac,
/// 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.
Mulaw,
/// Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000.
Amr,
/// Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000.
AmrWb,
/// Opus encoded audio frames in Ogg container
/// ([OggOpus](https://wiki.xiph.org/OggOpus)).
/// `sample_rate_hertz` must be 16000.
OggOpus,
/// Although the use of lossy encodings is not recommended, if a very low
/// bitrate encoding is required, `OGG_OPUS` is highly preferred over
/// Speex encoding. The [Speex](https://speex.org/) encoding supported by
/// Dialogflow API has a header byte in each block, as in MIME type
/// `audio/x-speex-with-header-byte`.
/// It is a variant of the RTP Speex encoding defined in
/// [RFC 5574](https://tools.ietf.org/html/rfc5574).
/// The stream is a sequence of blocks, one block per RTP packet. Each block
/// starts with a byte containing the length of the block, in bytes, followed
/// by one or more frames of Speex data, padded to an integral number of
/// bytes (octets) as specified in RFC 5574. In other words, each RTP header
/// is replaced with a single byte containing the block length. Only Speex
/// wideband is supported. `sample_rate_hertz` must be 16000.
SpeexWithHeaderByte,
/// 8-bit samples that compand 13-bit audio samples using G.711 PCMU/a-law.
Alaw,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [AudioEncoding::value] or
/// [AudioEncoding::name].
UnknownValue(audio_encoding::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
pub mod audio_encoding {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl AudioEncoding {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Linear16 => std::option::Option::Some(1),
Self::Flac => std::option::Option::Some(2),
Self::Mulaw => std::option::Option::Some(3),
Self::Amr => std::option::Option::Some(4),
Self::AmrWb => std::option::Option::Some(5),
Self::OggOpus => std::option::Option::Some(6),
Self::SpeexWithHeaderByte => std::option::Option::Some(7),
Self::Alaw => std::option::Option::Some(8),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("AUDIO_ENCODING_UNSPECIFIED"),
Self::Linear16 => std::option::Option::Some("AUDIO_ENCODING_LINEAR_16"),
Self::Flac => std::option::Option::Some("AUDIO_ENCODING_FLAC"),
Self::Mulaw => std::option::Option::Some("AUDIO_ENCODING_MULAW"),
Self::Amr => std::option::Option::Some("AUDIO_ENCODING_AMR"),
Self::AmrWb => std::option::Option::Some("AUDIO_ENCODING_AMR_WB"),
Self::OggOpus => std::option::Option::Some("AUDIO_ENCODING_OGG_OPUS"),
Self::SpeexWithHeaderByte => {
std::option::Option::Some("AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE")
}
Self::Alaw => std::option::Option::Some("AUDIO_ENCODING_ALAW"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl std::default::Default for AudioEncoding {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl std::fmt::Display for AudioEncoding {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<i32> for AudioEncoding {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Linear16,
2 => Self::Flac,
3 => Self::Mulaw,
4 => Self::Amr,
5 => Self::AmrWb,
6 => Self::OggOpus,
7 => Self::SpeexWithHeaderByte,
8 => Self::Alaw,
_ => Self::UnknownValue(audio_encoding::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<&str> for AudioEncoding {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"AUDIO_ENCODING_UNSPECIFIED" => Self::Unspecified,
"AUDIO_ENCODING_LINEAR_16" => Self::Linear16,
"AUDIO_ENCODING_FLAC" => Self::Flac,
"AUDIO_ENCODING_MULAW" => Self::Mulaw,
"AUDIO_ENCODING_AMR" => Self::Amr,
"AUDIO_ENCODING_AMR_WB" => Self::AmrWb,
"AUDIO_ENCODING_OGG_OPUS" => Self::OggOpus,
"AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE" => Self::SpeexWithHeaderByte,
"AUDIO_ENCODING_ALAW" => Self::Alaw,
_ => Self::UnknownValue(audio_encoding::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl serde::ser::Serialize for AudioEncoding {
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::Linear16 => serializer.serialize_i32(1),
Self::Flac => serializer.serialize_i32(2),
Self::Mulaw => serializer.serialize_i32(3),
Self::Amr => serializer.serialize_i32(4),
Self::AmrWb => serializer.serialize_i32(5),
Self::OggOpus => serializer.serialize_i32(6),
Self::SpeexWithHeaderByte => serializer.serialize_i32(7),
Self::Alaw => serializer.serialize_i32(8),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for AudioEncoding {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<AudioEncoding>::new(
".google.cloud.dialogflow.v2.AudioEncoding",
))
}
}
/// Variant of the specified [Speech
/// model][google.cloud.dialogflow.v2.InputAudioConfig.model] to use.
///
/// See the [Cloud Speech
/// documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models)
/// for which models have different variants. For example, the "phone_call" model
/// has both a standard and an enhanced variant. When you use an enhanced model,
/// you will generally receive higher quality results than for a standard model.
///
/// [google.cloud.dialogflow.v2.InputAudioConfig.model]: crate::model::InputAudioConfig::model
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SpeechModelVariant {
/// No model variant specified. In this case Dialogflow defaults to
/// USE_BEST_AVAILABLE.
Unspecified,
/// Use the best available variant of the [Speech model][model] that the caller
/// is eligible for.
///
/// Please see the [Dialogflow
/// docs](https://cloud.google.com/dialogflow/docs/data-logging) for
/// how to make your project eligible for enhanced models.
UseBestAvailable,
/// Use standard model variant even if an enhanced model is available. See the
/// [Cloud Speech
/// documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models)
/// for details about enhanced models.
UseStandard,
/// Use an enhanced model variant:
///
/// * If an enhanced variant does not exist for the given
/// [model][google.cloud.dialogflow.v2.InputAudioConfig.model] and request
/// language, Dialogflow falls back to the standard variant.
///
/// The [Cloud Speech
/// documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models)
/// describes which models have enhanced variants.
///
/// * If the API caller isn't eligible for enhanced models, Dialogflow returns
/// an error. Please see the [Dialogflow
/// docs](https://cloud.google.com/dialogflow/docs/data-logging)
/// for how to make your project eligible.
///
///
/// [google.cloud.dialogflow.v2.InputAudioConfig.model]: crate::model::InputAudioConfig::model
UseEnhanced,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [SpeechModelVariant::value] or
/// [SpeechModelVariant::name].
UnknownValue(speech_model_variant::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
pub mod speech_model_variant {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl SpeechModelVariant {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::UseBestAvailable => std::option::Option::Some(1),
Self::UseStandard => std::option::Option::Some(2),
Self::UseEnhanced => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SPEECH_MODEL_VARIANT_UNSPECIFIED"),
Self::UseBestAvailable => std::option::Option::Some("USE_BEST_AVAILABLE"),
Self::UseStandard => std::option::Option::Some("USE_STANDARD"),
Self::UseEnhanced => std::option::Option::Some("USE_ENHANCED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl std::default::Default for SpeechModelVariant {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl std::fmt::Display for SpeechModelVariant {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<i32> for SpeechModelVariant {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::UseBestAvailable,
2 => Self::UseStandard,
3 => Self::UseEnhanced,
_ => Self::UnknownValue(speech_model_variant::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<&str> for SpeechModelVariant {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SPEECH_MODEL_VARIANT_UNSPECIFIED" => Self::Unspecified,
"USE_BEST_AVAILABLE" => Self::UseBestAvailable,
"USE_STANDARD" => Self::UseStandard,
"USE_ENHANCED" => Self::UseEnhanced,
_ => Self::UnknownValue(speech_model_variant::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl serde::ser::Serialize for SpeechModelVariant {
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::UseBestAvailable => serializer.serialize_i32(1),
Self::UseStandard => serializer.serialize_i32(2),
Self::UseEnhanced => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "participants",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for SpeechModelVariant {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SpeechModelVariant>::new(
".google.cloud.dialogflow.v2.SpeechModelVariant",
))
}
}
/// Gender of the voice as described in
/// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice).
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SsmlVoiceGender {
/// An unspecified gender, which means that the client doesn't care which
/// gender the selected voice will have.
Unspecified,
/// A male voice.
Male,
/// A female voice.
Female,
/// A gender-neutral voice.
Neutral,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [SsmlVoiceGender::value] or
/// [SsmlVoiceGender::name].
UnknownValue(ssml_voice_gender::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
pub mod ssml_voice_gender {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl SsmlVoiceGender {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Male => std::option::Option::Some(1),
Self::Female => std::option::Option::Some(2),
Self::Neutral => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SSML_VOICE_GENDER_UNSPECIFIED"),
Self::Male => std::option::Option::Some("SSML_VOICE_GENDER_MALE"),
Self::Female => std::option::Option::Some("SSML_VOICE_GENDER_FEMALE"),
Self::Neutral => std::option::Option::Some("SSML_VOICE_GENDER_NEUTRAL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl std::default::Default for SsmlVoiceGender {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl std::fmt::Display for SsmlVoiceGender {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<i32> for SsmlVoiceGender {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Male,
2 => Self::Female,
3 => Self::Neutral,
_ => Self::UnknownValue(ssml_voice_gender::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<&str> for SsmlVoiceGender {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SSML_VOICE_GENDER_UNSPECIFIED" => Self::Unspecified,
"SSML_VOICE_GENDER_MALE" => Self::Male,
"SSML_VOICE_GENDER_FEMALE" => Self::Female,
"SSML_VOICE_GENDER_NEUTRAL" => Self::Neutral,
_ => Self::UnknownValue(ssml_voice_gender::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl serde::ser::Serialize for SsmlVoiceGender {
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::Male => serializer.serialize_i32(1),
Self::Female => serializer.serialize_i32(2),
Self::Neutral => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversation-profiles",
feature = "conversations",
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for SsmlVoiceGender {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SsmlVoiceGender>::new(
".google.cloud.dialogflow.v2.SsmlVoiceGender",
))
}
}
/// Audio encoding of the output audio format in Text-To-Speech.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "environments",
feature = "participants",
feature = "sessions",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum OutputAudioEncoding {
/// Not specified.
Unspecified,
/// Uncompressed 16-bit signed little-endian samples (Linear PCM).
/// Audio content returned as LINEAR16 also contains a WAV header.
Linear16,
/// MP3 audio at 32kbps.
Mp3,
/// MP3 audio at 64kbps.
Mp364Kbps,
/// Opus encoded audio wrapped in an ogg container. The result will be a
/// file which can be played natively on Android, and in browsers (at least
/// Chrome and Firefox). The quality of the encoding is considerably higher
/// than MP3 while using approximately the same bitrate.
OggOpus,
/// 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.
Mulaw,
/// 8-bit samples that compand 13-bit audio samples using G.711 PCMU/a-law.
Alaw,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [OutputAudioEncoding::value] or
/// [OutputAudioEncoding::name].
UnknownValue(output_audio_encoding::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "environments",
feature = "participants",
feature = "sessions",
))]
pub mod output_audio_encoding {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl OutputAudioEncoding {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Linear16 => std::option::Option::Some(1),
Self::Mp3 => std::option::Option::Some(2),
Self::Mp364Kbps => std::option::Option::Some(4),
Self::OggOpus => std::option::Option::Some(3),
Self::Mulaw => std::option::Option::Some(5),
Self::Alaw => std::option::Option::Some(6),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("OUTPUT_AUDIO_ENCODING_UNSPECIFIED"),
Self::Linear16 => std::option::Option::Some("OUTPUT_AUDIO_ENCODING_LINEAR_16"),
Self::Mp3 => std::option::Option::Some("OUTPUT_AUDIO_ENCODING_MP3"),
Self::Mp364Kbps => std::option::Option::Some("OUTPUT_AUDIO_ENCODING_MP3_64_KBPS"),
Self::OggOpus => std::option::Option::Some("OUTPUT_AUDIO_ENCODING_OGG_OPUS"),
Self::Mulaw => std::option::Option::Some("OUTPUT_AUDIO_ENCODING_MULAW"),
Self::Alaw => std::option::Option::Some("OUTPUT_AUDIO_ENCODING_ALAW"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl std::default::Default for OutputAudioEncoding {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl std::fmt::Display for OutputAudioEncoding {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<i32> for OutputAudioEncoding {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Linear16,
2 => Self::Mp3,
3 => Self::OggOpus,
4 => Self::Mp364Kbps,
5 => Self::Mulaw,
6 => Self::Alaw,
_ => Self::UnknownValue(output_audio_encoding::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl std::convert::From<&str> for OutputAudioEncoding {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"OUTPUT_AUDIO_ENCODING_UNSPECIFIED" => Self::Unspecified,
"OUTPUT_AUDIO_ENCODING_LINEAR_16" => Self::Linear16,
"OUTPUT_AUDIO_ENCODING_MP3" => Self::Mp3,
"OUTPUT_AUDIO_ENCODING_MP3_64_KBPS" => Self::Mp364Kbps,
"OUTPUT_AUDIO_ENCODING_OGG_OPUS" => Self::OggOpus,
"OUTPUT_AUDIO_ENCODING_MULAW" => Self::Mulaw,
"OUTPUT_AUDIO_ENCODING_ALAW" => Self::Alaw,
_ => Self::UnknownValue(output_audio_encoding::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl serde::ser::Serialize for OutputAudioEncoding {
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::Linear16 => serializer.serialize_i32(1),
Self::Mp3 => serializer.serialize_i32(2),
Self::Mp364Kbps => serializer.serialize_i32(4),
Self::OggOpus => serializer.serialize_i32(3),
Self::Mulaw => serializer.serialize_i32(5),
Self::Alaw => serializer.serialize_i32(6),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "environments",
feature = "participants",
feature = "sessions",
))]
impl<'de> serde::de::Deserialize<'de> for OutputAudioEncoding {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<OutputAudioEncoding>::new(
".google.cloud.dialogflow.v2.OutputAudioEncoding",
))
}
}
/// The event that triggers the generator and LLM execution.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TriggerEvent {
/// Default value for TriggerEvent.
Unspecified,
/// Triggers when each chat message or voice utterance ends.
EndOfUtterance,
/// Triggers on the conversation manually by API calls, such as
/// Conversations.GenerateStatelessSuggestion and
/// Conversations.GenerateSuggestions.
ManualCall,
/// Triggers after each customer message only.
CustomerMessage,
/// Triggers after each agent message only.
AgentMessage,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [TriggerEvent::value] or
/// [TriggerEvent::name].
UnknownValue(trigger_event::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
pub mod trigger_event {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl TriggerEvent {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::EndOfUtterance => std::option::Option::Some(1),
Self::ManualCall => std::option::Option::Some(2),
Self::CustomerMessage => std::option::Option::Some(3),
Self::AgentMessage => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TRIGGER_EVENT_UNSPECIFIED"),
Self::EndOfUtterance => std::option::Option::Some("END_OF_UTTERANCE"),
Self::ManualCall => std::option::Option::Some("MANUAL_CALL"),
Self::CustomerMessage => std::option::Option::Some("CUSTOMER_MESSAGE"),
Self::AgentMessage => std::option::Option::Some("AGENT_MESSAGE"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl std::default::Default for TriggerEvent {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl std::fmt::Display for TriggerEvent {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl std::convert::From<i32> for TriggerEvent {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::EndOfUtterance,
2 => Self::ManualCall,
3 => Self::CustomerMessage,
4 => Self::AgentMessage,
_ => Self::UnknownValue(trigger_event::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl std::convert::From<&str> for TriggerEvent {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TRIGGER_EVENT_UNSPECIFIED" => Self::Unspecified,
"END_OF_UTTERANCE" => Self::EndOfUtterance,
"MANUAL_CALL" => Self::ManualCall,
"CUSTOMER_MESSAGE" => Self::CustomerMessage,
"AGENT_MESSAGE" => Self::AgentMessage,
_ => Self::UnknownValue(trigger_event::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl serde::ser::Serialize for TriggerEvent {
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::EndOfUtterance => serializer.serialize_i32(1),
Self::ManualCall => serializer.serialize_i32(2),
Self::CustomerMessage => serializer.serialize_i32(3),
Self::AgentMessage => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(
feature = "conversations",
feature = "generator-evaluations",
feature = "generators",
))]
impl<'de> serde::de::Deserialize<'de> for TriggerEvent {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TriggerEvent>::new(
".google.cloud.dialogflow.v2.TriggerEvent",
))
}
}
/// Represents the options for views of an intent.
/// An intent can be a sizable object. Therefore, we provide a resource view that
/// does not return training phrases in the response by default.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(feature = "intents")]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum IntentView {
/// Training phrases field is not populated in the response.
Unspecified,
/// All fields are populated.
Full,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [IntentView::value] or
/// [IntentView::name].
UnknownValue(intent_view::UnknownValue),
}
#[doc(hidden)]
#[cfg(feature = "intents")]
pub mod intent_view {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(feature = "intents")]
impl IntentView {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Full => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("INTENT_VIEW_UNSPECIFIED"),
Self::Full => std::option::Option::Some("INTENT_VIEW_FULL"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(feature = "intents")]
impl std::default::Default for IntentView {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(feature = "intents")]
impl std::fmt::Display for IntentView {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(feature = "intents")]
impl std::convert::From<i32> for IntentView {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Full,
_ => Self::UnknownValue(intent_view::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(feature = "intents")]
impl std::convert::From<&str> for IntentView {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"INTENT_VIEW_UNSPECIFIED" => Self::Unspecified,
"INTENT_VIEW_FULL" => Self::Full,
_ => Self::UnknownValue(intent_view::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(feature = "intents")]
impl serde::ser::Serialize for IntentView {
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::Full => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(feature = "intents")]
impl<'de> serde::de::Deserialize<'de> for IntentView {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<IntentView>::new(
".google.cloud.dialogflow.v2.IntentView",
))
}
}
/// Response reason from datastore which indicates data serving status or
/// answer quality degradation.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[cfg(any(feature = "conversations", feature = "participants",))]
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DatastoreResponseReason {
/// Default value.
Unspecified,
/// No specific response reason from datastore.
None,
/// Search is blocked due to out of quota.
SearchOutOfQuota,
/// Search returns empty results.
SearchEmptyResults,
/// Generative AI is disabled.
AnswerGenerationGenAiDisabled,
/// Answer generation is blocked due to out of quota.
AnswerGenerationOutOfQuota,
/// Answer generation encounters an error.
AnswerGenerationError,
/// Answer generation does not have enough information to generate answer.
AnswerGenerationNotEnoughInfo,
/// Answer generation is blocked by RAI (Responsible AI) failure.
AnswerGenerationRaiFailed,
/// Answer generation is not grounded on reliable sources.
AnswerGenerationNotGrounded,
/// If set, the enum was initialized with an unknown value.
///
/// Applications can examine the value using [DatastoreResponseReason::value] or
/// [DatastoreResponseReason::name].
UnknownValue(datastore_response_reason::UnknownValue),
}
#[doc(hidden)]
#[cfg(any(feature = "conversations", feature = "participants",))]
pub mod datastore_response_reason {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl DatastoreResponseReason {
/// Gets the enum value.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the string representation of enums.
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::None => std::option::Option::Some(1),
Self::SearchOutOfQuota => std::option::Option::Some(2),
Self::SearchEmptyResults => std::option::Option::Some(3),
Self::AnswerGenerationGenAiDisabled => std::option::Option::Some(4),
Self::AnswerGenerationOutOfQuota => std::option::Option::Some(5),
Self::AnswerGenerationError => std::option::Option::Some(6),
Self::AnswerGenerationNotEnoughInfo => std::option::Option::Some(7),
Self::AnswerGenerationRaiFailed => std::option::Option::Some(8),
Self::AnswerGenerationNotGrounded => std::option::Option::Some(9),
Self::UnknownValue(u) => u.0.value(),
}
}
/// Gets the enum value as a string.
///
/// Returns `None` if the enum contains an unknown value deserialized from
/// the integer representation of enums.
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DATASTORE_RESPONSE_REASON_UNSPECIFIED"),
Self::None => std::option::Option::Some("NONE"),
Self::SearchOutOfQuota => std::option::Option::Some("SEARCH_OUT_OF_QUOTA"),
Self::SearchEmptyResults => std::option::Option::Some("SEARCH_EMPTY_RESULTS"),
Self::AnswerGenerationGenAiDisabled => {
std::option::Option::Some("ANSWER_GENERATION_GEN_AI_DISABLED")
}
Self::AnswerGenerationOutOfQuota => {
std::option::Option::Some("ANSWER_GENERATION_OUT_OF_QUOTA")
}
Self::AnswerGenerationError => std::option::Option::Some("ANSWER_GENERATION_ERROR"),
Self::AnswerGenerationNotEnoughInfo => {
std::option::Option::Some("ANSWER_GENERATION_NOT_ENOUGH_INFO")
}
Self::AnswerGenerationRaiFailed => {
std::option::Option::Some("ANSWER_GENERATION_RAI_FAILED")
}
Self::AnswerGenerationNotGrounded => {
std::option::Option::Some("ANSWER_GENERATION_NOT_GROUNDED")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl std::default::Default for DatastoreResponseReason {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl std::fmt::Display for DatastoreResponseReason {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl std::convert::From<i32> for DatastoreResponseReason {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::None,
2 => Self::SearchOutOfQuota,
3 => Self::SearchEmptyResults,
4 => Self::AnswerGenerationGenAiDisabled,
5 => Self::AnswerGenerationOutOfQuota,
6 => Self::AnswerGenerationError,
7 => Self::AnswerGenerationNotEnoughInfo,
8 => Self::AnswerGenerationRaiFailed,
9 => Self::AnswerGenerationNotGrounded,
_ => Self::UnknownValue(datastore_response_reason::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl std::convert::From<&str> for DatastoreResponseReason {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DATASTORE_RESPONSE_REASON_UNSPECIFIED" => Self::Unspecified,
"NONE" => Self::None,
"SEARCH_OUT_OF_QUOTA" => Self::SearchOutOfQuota,
"SEARCH_EMPTY_RESULTS" => Self::SearchEmptyResults,
"ANSWER_GENERATION_GEN_AI_DISABLED" => Self::AnswerGenerationGenAiDisabled,
"ANSWER_GENERATION_OUT_OF_QUOTA" => Self::AnswerGenerationOutOfQuota,
"ANSWER_GENERATION_ERROR" => Self::AnswerGenerationError,
"ANSWER_GENERATION_NOT_ENOUGH_INFO" => Self::AnswerGenerationNotEnoughInfo,
"ANSWER_GENERATION_RAI_FAILED" => Self::AnswerGenerationRaiFailed,
"ANSWER_GENERATION_NOT_GROUNDED" => Self::AnswerGenerationNotGrounded,
_ => Self::UnknownValue(datastore_response_reason::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl serde::ser::Serialize for DatastoreResponseReason {
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::None => serializer.serialize_i32(1),
Self::SearchOutOfQuota => serializer.serialize_i32(2),
Self::SearchEmptyResults => serializer.serialize_i32(3),
Self::AnswerGenerationGenAiDisabled => serializer.serialize_i32(4),
Self::AnswerGenerationOutOfQuota => serializer.serialize_i32(5),
Self::AnswerGenerationError => serializer.serialize_i32(6),
Self::AnswerGenerationNotEnoughInfo => serializer.serialize_i32(7),
Self::AnswerGenerationRaiFailed => serializer.serialize_i32(8),
Self::AnswerGenerationNotGrounded => serializer.serialize_i32(9),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
#[cfg(any(feature = "conversations", feature = "participants",))]
impl<'de> serde::de::Deserialize<'de> for DatastoreResponseReason {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DatastoreResponseReason>::new(
".google.cloud.dialogflow.v2.DatastoreResponseReason",
))
}
}