#![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 serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateRecognizerRequest {
pub recognizer: std::option::Option<crate::model::Recognizer>,
pub validate_only: bool,
pub recognizer_id: std::string::String,
pub parent: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateRecognizerRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_recognizer<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Recognizer>,
{
self.recognizer = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_recognizer<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Recognizer>,
{
self.recognizer = v.map(|x| x.into());
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
pub fn set_recognizer_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.recognizer_id = v.into();
self
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
}
impl wkt::message::Message for CreateRecognizerRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.CreateRecognizerRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OperationMetadata {
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub resource: std::string::String,
pub method: std::string::String,
pub kms_key_name: std::string::String,
pub kms_key_version_name: std::string::String,
pub progress_percent: i32,
pub request: std::option::Option<crate::model::operation_metadata::Request>,
pub metadata: std::option::Option<crate::model::operation_metadata::Metadata>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl OperationMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.resource = v.into();
self
}
pub fn set_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.method = v.into();
self
}
pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kms_key_name = v.into();
self
}
pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.kms_key_version_name = v.into();
self
}
pub fn set_progress_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.progress_percent = v.into();
self
}
pub fn set_request<
T: std::convert::Into<std::option::Option<crate::model::operation_metadata::Request>>,
>(
mut self,
v: T,
) -> Self {
self.request = v.into();
self
}
pub fn batch_recognize_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::BatchRecognizeRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::BatchRecognizeRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_batch_recognize_request<
T: std::convert::Into<std::boxed::Box<crate::model::BatchRecognizeRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::BatchRecognizeRequest(v.into()),
);
self
}
pub fn create_recognizer_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::CreateRecognizerRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::CreateRecognizerRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_create_recognizer_request<
T: std::convert::Into<std::boxed::Box<crate::model::CreateRecognizerRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::CreateRecognizerRequest(v.into()),
);
self
}
pub fn update_recognizer_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::UpdateRecognizerRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::UpdateRecognizerRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_update_recognizer_request<
T: std::convert::Into<std::boxed::Box<crate::model::UpdateRecognizerRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::UpdateRecognizerRequest(v.into()),
);
self
}
pub fn delete_recognizer_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::DeleteRecognizerRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::DeleteRecognizerRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_delete_recognizer_request<
T: std::convert::Into<std::boxed::Box<crate::model::DeleteRecognizerRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::DeleteRecognizerRequest(v.into()),
);
self
}
pub fn undelete_recognizer_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::UndeleteRecognizerRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::UndeleteRecognizerRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_undelete_recognizer_request<
T: std::convert::Into<std::boxed::Box<crate::model::UndeleteRecognizerRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::UndeleteRecognizerRequest(v.into()),
);
self
}
pub fn create_custom_class_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::CreateCustomClassRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::CreateCustomClassRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_create_custom_class_request<
T: std::convert::Into<std::boxed::Box<crate::model::CreateCustomClassRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::CreateCustomClassRequest(v.into()),
);
self
}
pub fn update_custom_class_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::UpdateCustomClassRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::UpdateCustomClassRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_update_custom_class_request<
T: std::convert::Into<std::boxed::Box<crate::model::UpdateCustomClassRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::UpdateCustomClassRequest(v.into()),
);
self
}
pub fn delete_custom_class_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::DeleteCustomClassRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::DeleteCustomClassRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_delete_custom_class_request<
T: std::convert::Into<std::boxed::Box<crate::model::DeleteCustomClassRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::DeleteCustomClassRequest(v.into()),
);
self
}
pub fn undelete_custom_class_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::UndeleteCustomClassRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::UndeleteCustomClassRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_undelete_custom_class_request<
T: std::convert::Into<std::boxed::Box<crate::model::UndeleteCustomClassRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::UndeleteCustomClassRequest(v.into()),
);
self
}
pub fn create_phrase_set_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::CreatePhraseSetRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::CreatePhraseSetRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_create_phrase_set_request<
T: std::convert::Into<std::boxed::Box<crate::model::CreatePhraseSetRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::CreatePhraseSetRequest(v.into()),
);
self
}
pub fn update_phrase_set_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::UpdatePhraseSetRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::UpdatePhraseSetRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_update_phrase_set_request<
T: std::convert::Into<std::boxed::Box<crate::model::UpdatePhraseSetRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::UpdatePhraseSetRequest(v.into()),
);
self
}
pub fn delete_phrase_set_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::DeletePhraseSetRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::DeletePhraseSetRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_delete_phrase_set_request<
T: std::convert::Into<std::boxed::Box<crate::model::DeletePhraseSetRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::DeletePhraseSetRequest(v.into()),
);
self
}
pub fn undelete_phrase_set_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::UndeletePhraseSetRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::UndeletePhraseSetRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_undelete_phrase_set_request<
T: std::convert::Into<std::boxed::Box<crate::model::UndeletePhraseSetRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::UndeletePhraseSetRequest(v.into()),
);
self
}
#[deprecated]
pub fn update_config_request(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::UpdateConfigRequest>> {
#[allow(unreachable_patterns)]
self.request.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Request::UpdateConfigRequest(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
#[deprecated]
pub fn set_update_config_request<
T: std::convert::Into<std::boxed::Box<crate::model::UpdateConfigRequest>>,
>(
mut self,
v: T,
) -> Self {
self.request = std::option::Option::Some(
crate::model::operation_metadata::Request::UpdateConfigRequest(v.into()),
);
self
}
pub fn set_metadata<
T: std::convert::Into<std::option::Option<crate::model::operation_metadata::Metadata>>,
>(
mut self,
v: T,
) -> Self {
self.metadata = v.into();
self
}
pub fn batch_recognize_metadata(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::BatchRecognizeMetadata>> {
#[allow(unreachable_patterns)]
self.metadata.as_ref().and_then(|v| match v {
crate::model::operation_metadata::Metadata::BatchRecognizeMetadata(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_batch_recognize_metadata<
T: std::convert::Into<std::boxed::Box<crate::model::BatchRecognizeMetadata>>,
>(
mut self,
v: T,
) -> Self {
self.metadata = std::option::Option::Some(
crate::model::operation_metadata::Metadata::BatchRecognizeMetadata(v.into()),
);
self
}
}
impl wkt::message::Message for OperationMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.OperationMetadata"
}
}
pub mod operation_metadata {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Request {
BatchRecognizeRequest(std::boxed::Box<crate::model::BatchRecognizeRequest>),
CreateRecognizerRequest(std::boxed::Box<crate::model::CreateRecognizerRequest>),
UpdateRecognizerRequest(std::boxed::Box<crate::model::UpdateRecognizerRequest>),
DeleteRecognizerRequest(std::boxed::Box<crate::model::DeleteRecognizerRequest>),
UndeleteRecognizerRequest(std::boxed::Box<crate::model::UndeleteRecognizerRequest>),
CreateCustomClassRequest(std::boxed::Box<crate::model::CreateCustomClassRequest>),
UpdateCustomClassRequest(std::boxed::Box<crate::model::UpdateCustomClassRequest>),
DeleteCustomClassRequest(std::boxed::Box<crate::model::DeleteCustomClassRequest>),
UndeleteCustomClassRequest(std::boxed::Box<crate::model::UndeleteCustomClassRequest>),
CreatePhraseSetRequest(std::boxed::Box<crate::model::CreatePhraseSetRequest>),
UpdatePhraseSetRequest(std::boxed::Box<crate::model::UpdatePhraseSetRequest>),
DeletePhraseSetRequest(std::boxed::Box<crate::model::DeletePhraseSetRequest>),
UndeletePhraseSetRequest(std::boxed::Box<crate::model::UndeletePhraseSetRequest>),
#[deprecated]
UpdateConfigRequest(std::boxed::Box<crate::model::UpdateConfigRequest>),
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Metadata {
BatchRecognizeMetadata(std::boxed::Box<crate::model::BatchRecognizeMetadata>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRecognizersRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub show_deleted: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListRecognizersRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.show_deleted = v.into();
self
}
}
impl wkt::message::Message for ListRecognizersRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.ListRecognizersRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRecognizersResponse {
pub recognizers: std::vec::Vec<crate::model::Recognizer>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListRecognizersResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_recognizers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Recognizer>,
{
use std::iter::Iterator;
self.recognizers = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListRecognizersResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.ListRecognizersResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListRecognizersResponse {
type PageItem = crate::model::Recognizer;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.recognizers
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRecognizerRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetRecognizerRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetRecognizerRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.GetRecognizerRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateRecognizerRequest {
pub recognizer: std::option::Option<crate::model::Recognizer>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub validate_only: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateRecognizerRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_recognizer<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Recognizer>,
{
self.recognizer = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_recognizer<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Recognizer>,
{
self.recognizer = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
}
impl wkt::message::Message for UpdateRecognizerRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.UpdateRecognizerRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteRecognizerRequest {
pub name: std::string::String,
pub validate_only: bool,
pub allow_missing: bool,
pub etag: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteRecognizerRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.allow_missing = v.into();
self
}
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
}
impl wkt::message::Message for DeleteRecognizerRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.DeleteRecognizerRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeleteRecognizerRequest {
pub name: std::string::String,
pub validate_only: bool,
pub etag: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UndeleteRecognizerRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
}
impl wkt::message::Message for UndeleteRecognizerRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.UndeleteRecognizerRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Recognizer {
pub name: std::string::String,
pub uid: std::string::String,
pub display_name: std::string::String,
#[deprecated]
pub model: std::string::String,
#[deprecated]
pub language_codes: std::vec::Vec<std::string::String>,
pub default_recognition_config: std::option::Option<crate::model::RecognitionConfig>,
pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
pub state: crate::model::recognizer::State,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub delete_time: std::option::Option<wkt::Timestamp>,
pub expire_time: std::option::Option<wkt::Timestamp>,
pub etag: std::string::String,
pub reconciling: bool,
pub kms_key_name: std::string::String,
pub kms_key_version_name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Recognizer {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uid = v.into();
self
}
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
#[deprecated]
pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.model = v.into();
self
}
#[deprecated]
pub fn set_language_codes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.language_codes = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_default_recognition_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RecognitionConfig>,
{
self.default_recognition_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_default_recognition_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RecognitionConfig>,
{
self.default_recognition_config = v.map(|x| x.into());
self
}
pub fn set_annotations<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.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_state<T: std::convert::Into<crate::model::recognizer::State>>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_delete_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.delete_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.delete_time = v.map(|x| x.into());
self
}
pub fn set_expire_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.expire_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.expire_time = v.map(|x| x.into());
self
}
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.reconciling = v.into();
self
}
pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kms_key_name = v.into();
self
}
pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.kms_key_version_name = v.into();
self
}
}
impl wkt::message::Message for Recognizer {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.Recognizer"
}
}
pub mod recognizer {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Active,
Deleted,
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl State {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Active => std::option::Option::Some(2),
Self::Deleted => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Active => std::option::Option::Some("ACTIVE"),
Self::Deleted => std::option::Option::Some("DELETED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for State {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
2 => Self::Active,
4 => Self::Deleted,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"ACTIVE" => Self::Active,
"DELETED" => Self::Deleted,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for State {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Active => serializer.serialize_i32(2),
Self::Deleted => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for State {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
".google.cloud.speech.v2.Recognizer.State",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AutoDetectDecodingConfig {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AutoDetectDecodingConfig {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for AutoDetectDecodingConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.AutoDetectDecodingConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ExplicitDecodingConfig {
pub encoding: crate::model::explicit_decoding_config::AudioEncoding,
pub sample_rate_hertz: i32,
pub audio_channel_count: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ExplicitDecodingConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_encoding<
T: std::convert::Into<crate::model::explicit_decoding_config::AudioEncoding>,
>(
mut self,
v: T,
) -> Self {
self.encoding = v.into();
self
}
pub fn set_sample_rate_hertz<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.sample_rate_hertz = v.into();
self
}
pub fn set_audio_channel_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.audio_channel_count = v.into();
self
}
}
impl wkt::message::Message for ExplicitDecodingConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.ExplicitDecodingConfig"
}
}
pub mod explicit_decoding_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AudioEncoding {
Unspecified,
Linear16,
Mulaw,
Alaw,
Amr,
AmrWb,
Flac,
Mp3,
OggOpus,
WebmOpus,
Mp4Aac,
M4AAac,
MovAac,
UnknownValue(audio_encoding::UnknownValue),
}
#[doc(hidden)]
pub mod audio_encoding {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl AudioEncoding {
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::Mulaw => std::option::Option::Some(2),
Self::Alaw => std::option::Option::Some(3),
Self::Amr => std::option::Option::Some(4),
Self::AmrWb => std::option::Option::Some(5),
Self::Flac => std::option::Option::Some(6),
Self::Mp3 => std::option::Option::Some(7),
Self::OggOpus => std::option::Option::Some(8),
Self::WebmOpus => std::option::Option::Some(9),
Self::Mp4Aac => std::option::Option::Some(10),
Self::M4AAac => std::option::Option::Some(11),
Self::MovAac => std::option::Option::Some(12),
Self::UnknownValue(u) => u.0.value(),
}
}
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("LINEAR16"),
Self::Mulaw => std::option::Option::Some("MULAW"),
Self::Alaw => std::option::Option::Some("ALAW"),
Self::Amr => std::option::Option::Some("AMR"),
Self::AmrWb => std::option::Option::Some("AMR_WB"),
Self::Flac => std::option::Option::Some("FLAC"),
Self::Mp3 => std::option::Option::Some("MP3"),
Self::OggOpus => std::option::Option::Some("OGG_OPUS"),
Self::WebmOpus => std::option::Option::Some("WEBM_OPUS"),
Self::Mp4Aac => std::option::Option::Some("MP4_AAC"),
Self::M4AAac => std::option::Option::Some("M4A_AAC"),
Self::MovAac => std::option::Option::Some("MOV_AAC"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for AudioEncoding {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
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())
}
}
impl std::convert::From<i32> for AudioEncoding {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Linear16,
2 => Self::Mulaw,
3 => Self::Alaw,
4 => Self::Amr,
5 => Self::AmrWb,
6 => Self::Flac,
7 => Self::Mp3,
8 => Self::OggOpus,
9 => Self::WebmOpus,
10 => Self::Mp4Aac,
11 => Self::M4AAac,
12 => Self::MovAac,
_ => Self::UnknownValue(audio_encoding::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for AudioEncoding {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"AUDIO_ENCODING_UNSPECIFIED" => Self::Unspecified,
"LINEAR16" => Self::Linear16,
"MULAW" => Self::Mulaw,
"ALAW" => Self::Alaw,
"AMR" => Self::Amr,
"AMR_WB" => Self::AmrWb,
"FLAC" => Self::Flac,
"MP3" => Self::Mp3,
"OGG_OPUS" => Self::OggOpus,
"WEBM_OPUS" => Self::WebmOpus,
"MP4_AAC" => Self::Mp4Aac,
"M4A_AAC" => Self::M4AAac,
"MOV_AAC" => Self::MovAac,
_ => Self::UnknownValue(audio_encoding::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
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::Mulaw => serializer.serialize_i32(2),
Self::Alaw => serializer.serialize_i32(3),
Self::Amr => serializer.serialize_i32(4),
Self::AmrWb => serializer.serialize_i32(5),
Self::Flac => serializer.serialize_i32(6),
Self::Mp3 => serializer.serialize_i32(7),
Self::OggOpus => serializer.serialize_i32(8),
Self::WebmOpus => serializer.serialize_i32(9),
Self::Mp4Aac => serializer.serialize_i32(10),
Self::M4AAac => serializer.serialize_i32(11),
Self::MovAac => serializer.serialize_i32(12),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
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.speech.v2.ExplicitDecodingConfig.AudioEncoding",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SpeakerDiarizationConfig {
pub min_speaker_count: i32,
pub max_speaker_count: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SpeakerDiarizationConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_min_speaker_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.min_speaker_count = v.into();
self
}
pub fn set_max_speaker_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_speaker_count = v.into();
self
}
}
impl wkt::message::Message for SpeakerDiarizationConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.SpeakerDiarizationConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CustomPromptConfig {
pub custom_prompt: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CustomPromptConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_custom_prompt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.custom_prompt = v.into();
self
}
}
impl wkt::message::Message for CustomPromptConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.CustomPromptConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RecognitionFeatures {
pub profanity_filter: bool,
pub enable_word_time_offsets: bool,
pub enable_word_confidence: bool,
pub enable_automatic_punctuation: bool,
pub enable_spoken_punctuation: bool,
pub enable_spoken_emojis: bool,
pub multi_channel_mode: crate::model::recognition_features::MultiChannelMode,
pub diarization_config: std::option::Option<crate::model::SpeakerDiarizationConfig>,
pub max_alternatives: i32,
pub custom_prompt_config: std::option::Option<crate::model::CustomPromptConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RecognitionFeatures {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_profanity_filter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.profanity_filter = v.into();
self
}
pub fn set_enable_word_time_offsets<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_word_time_offsets = v.into();
self
}
pub fn set_enable_word_confidence<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_word_confidence = v.into();
self
}
pub fn set_enable_automatic_punctuation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_automatic_punctuation = v.into();
self
}
pub fn set_enable_spoken_punctuation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_spoken_punctuation = v.into();
self
}
pub fn set_enable_spoken_emojis<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_spoken_emojis = v.into();
self
}
pub fn set_multi_channel_mode<
T: std::convert::Into<crate::model::recognition_features::MultiChannelMode>,
>(
mut self,
v: T,
) -> Self {
self.multi_channel_mode = v.into();
self
}
pub fn set_diarization_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SpeakerDiarizationConfig>,
{
self.diarization_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_diarization_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SpeakerDiarizationConfig>,
{
self.diarization_config = v.map(|x| x.into());
self
}
pub fn set_max_alternatives<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.max_alternatives = v.into();
self
}
pub fn set_custom_prompt_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CustomPromptConfig>,
{
self.custom_prompt_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_custom_prompt_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CustomPromptConfig>,
{
self.custom_prompt_config = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for RecognitionFeatures {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.RecognitionFeatures"
}
}
pub mod recognition_features {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum MultiChannelMode {
Unspecified,
SeparateRecognitionPerChannel,
UnknownValue(multi_channel_mode::UnknownValue),
}
#[doc(hidden)]
pub mod multi_channel_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl MultiChannelMode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::SeparateRecognitionPerChannel => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MULTI_CHANNEL_MODE_UNSPECIFIED"),
Self::SeparateRecognitionPerChannel => {
std::option::Option::Some("SEPARATE_RECOGNITION_PER_CHANNEL")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for MultiChannelMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for MultiChannelMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for MultiChannelMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::SeparateRecognitionPerChannel,
_ => Self::UnknownValue(multi_channel_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for MultiChannelMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MULTI_CHANNEL_MODE_UNSPECIFIED" => Self::Unspecified,
"SEPARATE_RECOGNITION_PER_CHANNEL" => Self::SeparateRecognitionPerChannel,
_ => Self::UnknownValue(multi_channel_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for MultiChannelMode {
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::SeparateRecognitionPerChannel => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for MultiChannelMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<MultiChannelMode>::new(
".google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TranscriptNormalization {
pub entries: std::vec::Vec<crate::model::transcript_normalization::Entry>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TranscriptNormalization {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_entries<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::transcript_normalization::Entry>,
{
use std::iter::Iterator;
self.entries = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for TranscriptNormalization {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.TranscriptNormalization"
}
}
pub mod transcript_normalization {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Entry {
pub search: std::string::String,
pub replace: std::string::String,
pub case_sensitive: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Entry {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_search<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.search = v.into();
self
}
pub fn set_replace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.replace = v.into();
self
}
pub fn set_case_sensitive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.case_sensitive = v.into();
self
}
}
impl wkt::message::Message for Entry {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.TranscriptNormalization.Entry"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TranslationConfig {
pub target_language: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TranslationConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_target_language<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.target_language = v.into();
self
}
}
impl wkt::message::Message for TranslationConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.TranslationConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SpeechAdaptation {
pub phrase_sets: std::vec::Vec<crate::model::speech_adaptation::AdaptationPhraseSet>,
pub custom_classes: std::vec::Vec<crate::model::CustomClass>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SpeechAdaptation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_phrase_sets<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::speech_adaptation::AdaptationPhraseSet>,
{
use std::iter::Iterator;
self.phrase_sets = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_custom_classes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::CustomClass>,
{
use std::iter::Iterator;
self.custom_classes = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for SpeechAdaptation {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.SpeechAdaptation"
}
}
pub mod speech_adaptation {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AdaptationPhraseSet {
pub value:
std::option::Option<crate::model::speech_adaptation::adaptation_phrase_set::Value>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AdaptationPhraseSet {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_value<
T: std::convert::Into<
std::option::Option<
crate::model::speech_adaptation::adaptation_phrase_set::Value,
>,
>,
>(
mut self,
v: T,
) -> Self {
self.value = v.into();
self
}
pub fn phrase_set(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.value.as_ref().and_then(|v| match v {
crate::model::speech_adaptation::adaptation_phrase_set::Value::PhraseSet(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_phrase_set<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value = std::option::Option::Some(
crate::model::speech_adaptation::adaptation_phrase_set::Value::PhraseSet(v.into()),
);
self
}
pub fn inline_phrase_set(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::PhraseSet>> {
#[allow(unreachable_patterns)]
self.value.as_ref().and_then(|v| match v {
crate::model::speech_adaptation::adaptation_phrase_set::Value::InlinePhraseSet(
v,
) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_inline_phrase_set<
T: std::convert::Into<std::boxed::Box<crate::model::PhraseSet>>,
>(
mut self,
v: T,
) -> Self {
self.value = std::option::Option::Some(
crate::model::speech_adaptation::adaptation_phrase_set::Value::InlinePhraseSet(
v.into(),
),
);
self
}
}
impl wkt::message::Message for AdaptationPhraseSet {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet"
}
}
pub mod adaptation_phrase_set {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Value {
PhraseSet(std::string::String),
InlinePhraseSet(std::boxed::Box<crate::model::PhraseSet>),
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DenoiserConfig {
pub denoise_audio: bool,
pub snr_threshold: f32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DenoiserConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_denoise_audio<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.denoise_audio = v.into();
self
}
pub fn set_snr_threshold<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.snr_threshold = v.into();
self
}
}
impl wkt::message::Message for DenoiserConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.DenoiserConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RecognitionConfig {
pub model: std::string::String,
pub language_codes: std::vec::Vec<std::string::String>,
pub features: std::option::Option<crate::model::RecognitionFeatures>,
pub adaptation: std::option::Option<crate::model::SpeechAdaptation>,
pub transcript_normalization: std::option::Option<crate::model::TranscriptNormalization>,
pub translation_config: std::option::Option<crate::model::TranslationConfig>,
pub denoiser_config: std::option::Option<crate::model::DenoiserConfig>,
pub decoding_config: std::option::Option<crate::model::recognition_config::DecodingConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RecognitionConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.model = v.into();
self
}
pub fn set_language_codes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.language_codes = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_features<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RecognitionFeatures>,
{
self.features = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RecognitionFeatures>,
{
self.features = v.map(|x| x.into());
self
}
pub fn set_adaptation<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SpeechAdaptation>,
{
self.adaptation = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_adaptation<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SpeechAdaptation>,
{
self.adaptation = v.map(|x| x.into());
self
}
pub fn set_transcript_normalization<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TranscriptNormalization>,
{
self.transcript_normalization = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_transcript_normalization<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TranscriptNormalization>,
{
self.transcript_normalization = v.map(|x| x.into());
self
}
pub fn set_translation_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::TranslationConfig>,
{
self.translation_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_translation_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::TranslationConfig>,
{
self.translation_config = v.map(|x| x.into());
self
}
pub fn set_denoiser_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::DenoiserConfig>,
{
self.denoiser_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_denoiser_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::DenoiserConfig>,
{
self.denoiser_config = v.map(|x| x.into());
self
}
pub fn set_decoding_config<
T: std::convert::Into<std::option::Option<crate::model::recognition_config::DecodingConfig>>,
>(
mut self,
v: T,
) -> Self {
self.decoding_config = v.into();
self
}
pub fn auto_decoding_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::AutoDetectDecodingConfig>> {
#[allow(unreachable_patterns)]
self.decoding_config.as_ref().and_then(|v| match v {
crate::model::recognition_config::DecodingConfig::AutoDecodingConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_auto_decoding_config<
T: std::convert::Into<std::boxed::Box<crate::model::AutoDetectDecodingConfig>>,
>(
mut self,
v: T,
) -> Self {
self.decoding_config = std::option::Option::Some(
crate::model::recognition_config::DecodingConfig::AutoDecodingConfig(v.into()),
);
self
}
pub fn explicit_decoding_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::ExplicitDecodingConfig>> {
#[allow(unreachable_patterns)]
self.decoding_config.as_ref().and_then(|v| match v {
crate::model::recognition_config::DecodingConfig::ExplicitDecodingConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_explicit_decoding_config<
T: std::convert::Into<std::boxed::Box<crate::model::ExplicitDecodingConfig>>,
>(
mut self,
v: T,
) -> Self {
self.decoding_config = std::option::Option::Some(
crate::model::recognition_config::DecodingConfig::ExplicitDecodingConfig(v.into()),
);
self
}
}
impl wkt::message::Message for RecognitionConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.RecognitionConfig"
}
}
pub mod recognition_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DecodingConfig {
AutoDecodingConfig(std::boxed::Box<crate::model::AutoDetectDecodingConfig>),
ExplicitDecodingConfig(std::boxed::Box<crate::model::ExplicitDecodingConfig>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RecognizeRequest {
pub recognizer: std::string::String,
pub config: std::option::Option<crate::model::RecognitionConfig>,
pub config_mask: std::option::Option<wkt::FieldMask>,
pub audio_source: std::option::Option<crate::model::recognize_request::AudioSource>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RecognizeRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_recognizer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.recognizer = v.into();
self
}
pub fn set_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RecognitionConfig>,
{
self.config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RecognitionConfig>,
{
self.config = v.map(|x| x.into());
self
}
pub fn set_config_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.config_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.config_mask = v.map(|x| x.into());
self
}
pub fn set_audio_source<
T: std::convert::Into<std::option::Option<crate::model::recognize_request::AudioSource>>,
>(
mut self,
v: T,
) -> Self {
self.audio_source = v.into();
self
}
pub fn content(&self) -> std::option::Option<&::bytes::Bytes> {
#[allow(unreachable_patterns)]
self.audio_source.as_ref().and_then(|v| match v {
crate::model::recognize_request::AudioSource::Content(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.audio_source = std::option::Option::Some(
crate::model::recognize_request::AudioSource::Content(v.into()),
);
self
}
pub fn uri(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.audio_source.as_ref().and_then(|v| match v {
crate::model::recognize_request::AudioSource::Uri(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.audio_source =
std::option::Option::Some(crate::model::recognize_request::AudioSource::Uri(v.into()));
self
}
}
impl wkt::message::Message for RecognizeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.RecognizeRequest"
}
}
pub mod recognize_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AudioSource {
Content(::bytes::Bytes),
Uri(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RecognitionResponseMetadata {
pub request_id: std::string::String,
pub total_billed_duration: std::option::Option<wkt::Duration>,
pub prompt: std::option::Option<std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RecognitionResponseMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
pub fn set_total_billed_duration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.total_billed_duration = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_total_billed_duration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.total_billed_duration = v.map(|x| x.into());
self
}
pub fn set_prompt<T>(mut self, v: T) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.prompt = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_prompt<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<std::string::String>,
{
self.prompt = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for RecognitionResponseMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.RecognitionResponseMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SpeechRecognitionAlternative {
pub transcript: std::string::String,
pub confidence: f32,
pub words: std::vec::Vec<crate::model::WordInfo>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SpeechRecognitionAlternative {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_transcript<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.transcript = v.into();
self
}
pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.confidence = v.into();
self
}
pub fn set_words<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::WordInfo>,
{
use std::iter::Iterator;
self.words = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for SpeechRecognitionAlternative {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.SpeechRecognitionAlternative"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct WordInfo {
pub start_offset: std::option::Option<wkt::Duration>,
pub end_offset: std::option::Option<wkt::Duration>,
pub word: std::string::String,
pub confidence: f32,
pub speaker_label: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl WordInfo {
pub fn new() -> Self {
std::default::Default::default()
}
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
}
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
}
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
}
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
}
pub fn set_word<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.word = v.into();
self
}
pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.confidence = v.into();
self
}
pub fn set_speaker_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.speaker_label = v.into();
self
}
}
impl wkt::message::Message for WordInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.WordInfo"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SpeechRecognitionResult {
pub alternatives: std::vec::Vec<crate::model::SpeechRecognitionAlternative>,
pub channel_tag: i32,
pub result_end_offset: std::option::Option<wkt::Duration>,
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SpeechRecognitionResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_alternatives<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SpeechRecognitionAlternative>,
{
use std::iter::Iterator;
self.alternatives = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_channel_tag<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.channel_tag = v.into();
self
}
pub fn set_result_end_offset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.result_end_offset = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_result_end_offset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.result_end_offset = v.map(|x| x.into());
self
}
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
impl wkt::message::Message for SpeechRecognitionResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.SpeechRecognitionResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RecognizeResponse {
pub results: std::vec::Vec<crate::model::SpeechRecognitionResult>,
pub metadata: std::option::Option<crate::model::RecognitionResponseMetadata>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RecognizeResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SpeechRecognitionResult>,
{
use std::iter::Iterator;
self.results = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
{
self.metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
{
self.metadata = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for RecognizeResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.RecognizeResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StreamingRecognitionFeatures {
pub enable_voice_activity_events: bool,
pub interim_results: bool,
pub voice_activity_timeout:
std::option::Option<crate::model::streaming_recognition_features::VoiceActivityTimeout>,
pub endpointing_sensitivity:
crate::model::streaming_recognition_features::EndpointingSensitivity,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StreamingRecognitionFeatures {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_enable_voice_activity_events<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.enable_voice_activity_events = v.into();
self
}
pub fn set_interim_results<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.interim_results = v.into();
self
}
pub fn set_voice_activity_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::streaming_recognition_features::VoiceActivityTimeout>,
{
self.voice_activity_timeout = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_voice_activity_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::streaming_recognition_features::VoiceActivityTimeout>,
{
self.voice_activity_timeout = v.map(|x| x.into());
self
}
pub fn set_endpointing_sensitivity<
T: std::convert::Into<crate::model::streaming_recognition_features::EndpointingSensitivity>,
>(
mut self,
v: T,
) -> Self {
self.endpointing_sensitivity = v.into();
self
}
}
impl wkt::message::Message for StreamingRecognitionFeatures {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.StreamingRecognitionFeatures"
}
}
pub mod streaming_recognition_features {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VoiceActivityTimeout {
pub speech_start_timeout: std::option::Option<wkt::Duration>,
pub speech_end_timeout: std::option::Option<wkt::Duration>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl VoiceActivityTimeout {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_speech_start_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.speech_start_timeout = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_speech_start_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.speech_start_timeout = v.map(|x| x.into());
self
}
pub fn set_speech_end_timeout<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.speech_end_timeout = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_speech_end_timeout<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.speech_end_timeout = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for VoiceActivityTimeout {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum EndpointingSensitivity {
Unspecified,
Standard,
Supershort,
Short,
UnknownValue(endpointing_sensitivity::UnknownValue),
}
#[doc(hidden)]
pub mod endpointing_sensitivity {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl EndpointingSensitivity {
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::Supershort => std::option::Option::Some(2),
Self::Short => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => {
std::option::Option::Some("ENDPOINTING_SENSITIVITY_UNSPECIFIED")
}
Self::Standard => std::option::Option::Some("ENDPOINTING_SENSITIVITY_STANDARD"),
Self::Supershort => std::option::Option::Some("ENDPOINTING_SENSITIVITY_SUPERSHORT"),
Self::Short => std::option::Option::Some("ENDPOINTING_SENSITIVITY_SHORT"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for EndpointingSensitivity {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for EndpointingSensitivity {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for EndpointingSensitivity {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Standard,
2 => Self::Supershort,
3 => Self::Short,
_ => Self::UnknownValue(endpointing_sensitivity::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for EndpointingSensitivity {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"ENDPOINTING_SENSITIVITY_UNSPECIFIED" => Self::Unspecified,
"ENDPOINTING_SENSITIVITY_STANDARD" => Self::Standard,
"ENDPOINTING_SENSITIVITY_SUPERSHORT" => Self::Supershort,
"ENDPOINTING_SENSITIVITY_SHORT" => Self::Short,
_ => Self::UnknownValue(endpointing_sensitivity::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for EndpointingSensitivity {
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::Supershort => serializer.serialize_i32(2),
Self::Short => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for EndpointingSensitivity {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<EndpointingSensitivity>::new(
".google.cloud.speech.v2.StreamingRecognitionFeatures.EndpointingSensitivity",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StreamingRecognitionConfig {
pub config: std::option::Option<crate::model::RecognitionConfig>,
pub config_mask: std::option::Option<wkt::FieldMask>,
pub streaming_features: std::option::Option<crate::model::StreamingRecognitionFeatures>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StreamingRecognitionConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RecognitionConfig>,
{
self.config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RecognitionConfig>,
{
self.config = v.map(|x| x.into());
self
}
pub fn set_config_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.config_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.config_mask = v.map(|x| x.into());
self
}
pub fn set_streaming_features<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::StreamingRecognitionFeatures>,
{
self.streaming_features = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_streaming_features<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::StreamingRecognitionFeatures>,
{
self.streaming_features = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for StreamingRecognitionConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.StreamingRecognitionConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StreamingRecognizeRequest {
pub recognizer: std::string::String,
pub streaming_request:
std::option::Option<crate::model::streaming_recognize_request::StreamingRequest>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StreamingRecognizeRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_recognizer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.recognizer = v.into();
self
}
pub fn set_streaming_request<
T: std::convert::Into<
std::option::Option<crate::model::streaming_recognize_request::StreamingRequest>,
>,
>(
mut self,
v: T,
) -> Self {
self.streaming_request = v.into();
self
}
pub fn streaming_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::StreamingRecognitionConfig>> {
#[allow(unreachable_patterns)]
self.streaming_request.as_ref().and_then(|v| match v {
crate::model::streaming_recognize_request::StreamingRequest::StreamingConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_streaming_config<
T: std::convert::Into<std::boxed::Box<crate::model::StreamingRecognitionConfig>>,
>(
mut self,
v: T,
) -> Self {
self.streaming_request = std::option::Option::Some(
crate::model::streaming_recognize_request::StreamingRequest::StreamingConfig(v.into()),
);
self
}
pub fn audio(&self) -> std::option::Option<&::bytes::Bytes> {
#[allow(unreachable_patterns)]
self.streaming_request.as_ref().and_then(|v| match v {
crate::model::streaming_recognize_request::StreamingRequest::Audio(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_audio<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.streaming_request = std::option::Option::Some(
crate::model::streaming_recognize_request::StreamingRequest::Audio(v.into()),
);
self
}
}
impl wkt::message::Message for StreamingRecognizeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.StreamingRecognizeRequest"
}
}
pub mod streaming_recognize_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum StreamingRequest {
StreamingConfig(std::boxed::Box<crate::model::StreamingRecognitionConfig>),
Audio(::bytes::Bytes),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchRecognizeRequest {
pub recognizer: std::string::String,
pub config: std::option::Option<crate::model::RecognitionConfig>,
pub config_mask: std::option::Option<wkt::FieldMask>,
pub files: std::vec::Vec<crate::model::BatchRecognizeFileMetadata>,
pub recognition_output_config: std::option::Option<crate::model::RecognitionOutputConfig>,
pub processing_strategy: crate::model::batch_recognize_request::ProcessingStrategy,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchRecognizeRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_recognizer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.recognizer = v.into();
self
}
pub fn set_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RecognitionConfig>,
{
self.config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RecognitionConfig>,
{
self.config = v.map(|x| x.into());
self
}
pub fn set_config_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.config_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.config_mask = v.map(|x| x.into());
self
}
pub fn set_files<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::BatchRecognizeFileMetadata>,
{
use std::iter::Iterator;
self.files = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_recognition_output_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RecognitionOutputConfig>,
{
self.recognition_output_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_recognition_output_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RecognitionOutputConfig>,
{
self.recognition_output_config = v.map(|x| x.into());
self
}
pub fn set_processing_strategy<
T: std::convert::Into<crate::model::batch_recognize_request::ProcessingStrategy>,
>(
mut self,
v: T,
) -> Self {
self.processing_strategy = v.into();
self
}
}
impl wkt::message::Message for BatchRecognizeRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.BatchRecognizeRequest"
}
}
pub mod batch_recognize_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ProcessingStrategy {
Unspecified,
DynamicBatching,
UnknownValue(processing_strategy::UnknownValue),
}
#[doc(hidden)]
pub mod processing_strategy {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ProcessingStrategy {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::DynamicBatching => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("PROCESSING_STRATEGY_UNSPECIFIED"),
Self::DynamicBatching => std::option::Option::Some("DYNAMIC_BATCHING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ProcessingStrategy {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ProcessingStrategy {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ProcessingStrategy {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::DynamicBatching,
_ => Self::UnknownValue(processing_strategy::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ProcessingStrategy {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"PROCESSING_STRATEGY_UNSPECIFIED" => Self::Unspecified,
"DYNAMIC_BATCHING" => Self::DynamicBatching,
_ => Self::UnknownValue(processing_strategy::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ProcessingStrategy {
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::DynamicBatching => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ProcessingStrategy {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProcessingStrategy>::new(
".google.cloud.speech.v2.BatchRecognizeRequest.ProcessingStrategy",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GcsOutputConfig {
pub uri: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GcsOutputConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
}
impl wkt::message::Message for GcsOutputConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.GcsOutputConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InlineOutputConfig {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl InlineOutputConfig {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for InlineOutputConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.InlineOutputConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct NativeOutputFileFormatConfig {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl NativeOutputFileFormatConfig {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for NativeOutputFileFormatConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.NativeOutputFileFormatConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct VttOutputFileFormatConfig {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl VttOutputFileFormatConfig {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for VttOutputFileFormatConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.VttOutputFileFormatConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SrtOutputFileFormatConfig {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SrtOutputFileFormatConfig {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for SrtOutputFileFormatConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.SrtOutputFileFormatConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct OutputFormatConfig {
pub native: std::option::Option<crate::model::NativeOutputFileFormatConfig>,
pub vtt: std::option::Option<crate::model::VttOutputFileFormatConfig>,
pub srt: std::option::Option<crate::model::SrtOutputFileFormatConfig>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl OutputFormatConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_native<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::NativeOutputFileFormatConfig>,
{
self.native = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_native<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::NativeOutputFileFormatConfig>,
{
self.native = v.map(|x| x.into());
self
}
pub fn set_vtt<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::VttOutputFileFormatConfig>,
{
self.vtt = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_vtt<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::VttOutputFileFormatConfig>,
{
self.vtt = v.map(|x| x.into());
self
}
pub fn set_srt<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::SrtOutputFileFormatConfig>,
{
self.srt = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_srt<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::SrtOutputFileFormatConfig>,
{
self.srt = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for OutputFormatConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.OutputFormatConfig"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RecognitionOutputConfig {
pub output_format_config: std::option::Option<crate::model::OutputFormatConfig>,
pub output: std::option::Option<crate::model::recognition_output_config::Output>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RecognitionOutputConfig {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_output_format_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::OutputFormatConfig>,
{
self.output_format_config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_output_format_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::OutputFormatConfig>,
{
self.output_format_config = v.map(|x| x.into());
self
}
pub fn set_output<
T: std::convert::Into<std::option::Option<crate::model::recognition_output_config::Output>>,
>(
mut self,
v: T,
) -> Self {
self.output = v.into();
self
}
pub fn gcs_output_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::GcsOutputConfig>> {
#[allow(unreachable_patterns)]
self.output.as_ref().and_then(|v| match v {
crate::model::recognition_output_config::Output::GcsOutputConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_gcs_output_config<
T: std::convert::Into<std::boxed::Box<crate::model::GcsOutputConfig>>,
>(
mut self,
v: T,
) -> Self {
self.output = std::option::Option::Some(
crate::model::recognition_output_config::Output::GcsOutputConfig(v.into()),
);
self
}
pub fn inline_response_config(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::InlineOutputConfig>> {
#[allow(unreachable_patterns)]
self.output.as_ref().and_then(|v| match v {
crate::model::recognition_output_config::Output::InlineResponseConfig(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_inline_response_config<
T: std::convert::Into<std::boxed::Box<crate::model::InlineOutputConfig>>,
>(
mut self,
v: T,
) -> Self {
self.output = std::option::Option::Some(
crate::model::recognition_output_config::Output::InlineResponseConfig(v.into()),
);
self
}
}
impl wkt::message::Message for RecognitionOutputConfig {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.RecognitionOutputConfig"
}
}
pub mod recognition_output_config {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Output {
GcsOutputConfig(std::boxed::Box<crate::model::GcsOutputConfig>),
InlineResponseConfig(std::boxed::Box<crate::model::InlineOutputConfig>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchRecognizeResponse {
pub results:
std::collections::HashMap<std::string::String, crate::model::BatchRecognizeFileResult>,
pub total_billed_duration: std::option::Option<wkt::Duration>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchRecognizeResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_results<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<crate::model::BatchRecognizeFileResult>,
{
use std::iter::Iterator;
self.results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_total_billed_duration<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.total_billed_duration = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_total_billed_duration<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.total_billed_duration = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for BatchRecognizeResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.BatchRecognizeResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchRecognizeResults {
pub results: std::vec::Vec<crate::model::SpeechRecognitionResult>,
pub metadata: std::option::Option<crate::model::RecognitionResponseMetadata>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchRecognizeResults {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SpeechRecognitionResult>,
{
use std::iter::Iterator;
self.results = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
{
self.metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
{
self.metadata = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for BatchRecognizeResults {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.BatchRecognizeResults"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CloudStorageResult {
pub uri: std::string::String,
pub vtt_format_uri: std::string::String,
pub srt_format_uri: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CloudStorageResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
pub fn set_vtt_format_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.vtt_format_uri = v.into();
self
}
pub fn set_srt_format_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.srt_format_uri = v.into();
self
}
}
impl wkt::message::Message for CloudStorageResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.CloudStorageResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InlineResult {
pub transcript: std::option::Option<crate::model::BatchRecognizeResults>,
pub vtt_captions: std::string::String,
pub srt_captions: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl InlineResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_transcript<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::BatchRecognizeResults>,
{
self.transcript = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_transcript<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::BatchRecognizeResults>,
{
self.transcript = v.map(|x| x.into());
self
}
pub fn set_vtt_captions<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.vtt_captions = v.into();
self
}
pub fn set_srt_captions<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.srt_captions = v.into();
self
}
}
impl wkt::message::Message for InlineResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.InlineResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchRecognizeFileResult {
pub error: std::option::Option<google_cloud_rpc::model::Status>,
pub metadata: std::option::Option<crate::model::RecognitionResponseMetadata>,
#[deprecated]
pub uri: std::string::String,
#[deprecated]
pub transcript: std::option::Option<crate::model::BatchRecognizeResults>,
pub result: std::option::Option<crate::model::batch_recognize_file_result::Result>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchRecognizeFileResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_error<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.error = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.error = v.map(|x| x.into());
self
}
pub fn set_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
{
self.metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
{
self.metadata = v.map(|x| x.into());
self
}
#[deprecated]
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
#[deprecated]
pub fn set_transcript<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::BatchRecognizeResults>,
{
self.transcript = std::option::Option::Some(v.into());
self
}
#[deprecated]
pub fn set_or_clear_transcript<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::BatchRecognizeResults>,
{
self.transcript = v.map(|x| x.into());
self
}
pub fn set_result<
T: std::convert::Into<std::option::Option<crate::model::batch_recognize_file_result::Result>>,
>(
mut self,
v: T,
) -> Self {
self.result = v.into();
self
}
pub fn cloud_storage_result(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::CloudStorageResult>> {
#[allow(unreachable_patterns)]
self.result.as_ref().and_then(|v| match v {
crate::model::batch_recognize_file_result::Result::CloudStorageResult(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_cloud_storage_result<
T: std::convert::Into<std::boxed::Box<crate::model::CloudStorageResult>>,
>(
mut self,
v: T,
) -> Self {
self.result = std::option::Option::Some(
crate::model::batch_recognize_file_result::Result::CloudStorageResult(v.into()),
);
self
}
pub fn inline_result(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::InlineResult>> {
#[allow(unreachable_patterns)]
self.result.as_ref().and_then(|v| match v {
crate::model::batch_recognize_file_result::Result::InlineResult(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_inline_result<T: std::convert::Into<std::boxed::Box<crate::model::InlineResult>>>(
mut self,
v: T,
) -> Self {
self.result = std::option::Option::Some(
crate::model::batch_recognize_file_result::Result::InlineResult(v.into()),
);
self
}
}
impl wkt::message::Message for BatchRecognizeFileResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.BatchRecognizeFileResult"
}
}
pub mod batch_recognize_file_result {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Result {
CloudStorageResult(std::boxed::Box<crate::model::CloudStorageResult>),
InlineResult(std::boxed::Box<crate::model::InlineResult>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchRecognizeTranscriptionMetadata {
pub progress_percent: i32,
pub error: std::option::Option<google_cloud_rpc::model::Status>,
pub uri: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchRecognizeTranscriptionMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_progress_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.progress_percent = v.into();
self
}
pub fn set_error<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.error = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_rpc::model::Status>,
{
self.error = v.map(|x| x.into());
self
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
}
impl wkt::message::Message for BatchRecognizeTranscriptionMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchRecognizeMetadata {
pub transcription_metadata: std::collections::HashMap<
std::string::String,
crate::model::BatchRecognizeTranscriptionMetadata,
>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchRecognizeMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_transcription_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<crate::model::BatchRecognizeTranscriptionMetadata>,
{
use std::iter::Iterator;
self.transcription_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for BatchRecognizeMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.BatchRecognizeMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BatchRecognizeFileMetadata {
pub config: std::option::Option<crate::model::RecognitionConfig>,
pub config_mask: std::option::Option<wkt::FieldMask>,
pub audio_source: std::option::Option<crate::model::batch_recognize_file_metadata::AudioSource>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BatchRecognizeFileMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RecognitionConfig>,
{
self.config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RecognitionConfig>,
{
self.config = v.map(|x| x.into());
self
}
pub fn set_config_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.config_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.config_mask = v.map(|x| x.into());
self
}
pub fn set_audio_source<
T: std::convert::Into<
std::option::Option<crate::model::batch_recognize_file_metadata::AudioSource>,
>,
>(
mut self,
v: T,
) -> Self {
self.audio_source = v.into();
self
}
pub fn uri(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.audio_source.as_ref().and_then(|v| match v {
crate::model::batch_recognize_file_metadata::AudioSource::Uri(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.audio_source = std::option::Option::Some(
crate::model::batch_recognize_file_metadata::AudioSource::Uri(v.into()),
);
self
}
}
impl wkt::message::Message for BatchRecognizeFileMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.BatchRecognizeFileMetadata"
}
}
pub mod batch_recognize_file_metadata {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum AudioSource {
Uri(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StreamingRecognitionResult {
pub alternatives: std::vec::Vec<crate::model::SpeechRecognitionAlternative>,
pub is_final: bool,
pub stability: f32,
pub result_end_offset: std::option::Option<wkt::Duration>,
pub channel_tag: i32,
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StreamingRecognitionResult {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_alternatives<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SpeechRecognitionAlternative>,
{
use std::iter::Iterator;
self.alternatives = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_is_final<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.is_final = v.into();
self
}
pub fn set_stability<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.stability = v.into();
self
}
pub fn set_result_end_offset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.result_end_offset = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_result_end_offset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.result_end_offset = v.map(|x| x.into());
self
}
pub fn set_channel_tag<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.channel_tag = v.into();
self
}
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
impl wkt::message::Message for StreamingRecognitionResult {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.StreamingRecognitionResult"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct StreamingRecognizeResponse {
pub results: std::vec::Vec<crate::model::StreamingRecognitionResult>,
pub speech_event_type: crate::model::streaming_recognize_response::SpeechEventType,
pub speech_event_offset: std::option::Option<wkt::Duration>,
pub metadata: std::option::Option<crate::model::RecognitionResponseMetadata>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl StreamingRecognizeResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_results<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::StreamingRecognitionResult>,
{
use std::iter::Iterator;
self.results = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_speech_event_type<
T: std::convert::Into<crate::model::streaming_recognize_response::SpeechEventType>,
>(
mut self,
v: T,
) -> Self {
self.speech_event_type = v.into();
self
}
pub fn set_speech_event_offset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.speech_event_offset = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_speech_event_offset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.speech_event_offset = v.map(|x| x.into());
self
}
pub fn set_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
{
self.metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
{
self.metadata = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for StreamingRecognizeResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.StreamingRecognizeResponse"
}
}
pub mod streaming_recognize_response {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum SpeechEventType {
Unspecified,
EndOfSingleUtterance,
SpeechActivityBegin,
SpeechActivityEnd,
UnknownValue(speech_event_type::UnknownValue),
}
#[doc(hidden)]
pub mod speech_event_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl SpeechEventType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::EndOfSingleUtterance => std::option::Option::Some(1),
Self::SpeechActivityBegin => std::option::Option::Some(2),
Self::SpeechActivityEnd => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("SPEECH_EVENT_TYPE_UNSPECIFIED"),
Self::EndOfSingleUtterance => std::option::Option::Some("END_OF_SINGLE_UTTERANCE"),
Self::SpeechActivityBegin => std::option::Option::Some("SPEECH_ACTIVITY_BEGIN"),
Self::SpeechActivityEnd => std::option::Option::Some("SPEECH_ACTIVITY_END"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for SpeechEventType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for SpeechEventType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for SpeechEventType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::EndOfSingleUtterance,
2 => Self::SpeechActivityBegin,
3 => Self::SpeechActivityEnd,
_ => Self::UnknownValue(speech_event_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for SpeechEventType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"SPEECH_EVENT_TYPE_UNSPECIFIED" => Self::Unspecified,
"END_OF_SINGLE_UTTERANCE" => Self::EndOfSingleUtterance,
"SPEECH_ACTIVITY_BEGIN" => Self::SpeechActivityBegin,
"SPEECH_ACTIVITY_END" => Self::SpeechActivityEnd,
_ => Self::UnknownValue(speech_event_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for SpeechEventType {
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::EndOfSingleUtterance => serializer.serialize_i32(1),
Self::SpeechActivityBegin => serializer.serialize_i32(2),
Self::SpeechActivityEnd => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for SpeechEventType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<SpeechEventType>::new(
".google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Config {
pub name: std::string::String,
pub kms_key_name: std::string::String,
pub update_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Config {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kms_key_name = v.into();
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Config {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.Config"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetConfigRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetConfigRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.GetConfigRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateConfigRequest {
pub config: std::option::Option<crate::model::Config>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateConfigRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_config<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Config>,
{
self.config = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Config>,
{
self.config = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateConfigRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.UpdateConfigRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CustomClass {
pub name: std::string::String,
pub uid: std::string::String,
pub display_name: std::string::String,
pub items: std::vec::Vec<crate::model::custom_class::ClassItem>,
pub state: crate::model::custom_class::State,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub delete_time: std::option::Option<wkt::Timestamp>,
pub expire_time: std::option::Option<wkt::Timestamp>,
pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
pub etag: std::string::String,
pub reconciling: bool,
pub kms_key_name: std::string::String,
pub kms_key_version_name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CustomClass {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uid = v.into();
self
}
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
pub fn set_items<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::custom_class::ClassItem>,
{
use std::iter::Iterator;
self.items = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_state<T: std::convert::Into<crate::model::custom_class::State>>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_delete_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.delete_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.delete_time = v.map(|x| x.into());
self
}
pub fn set_expire_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.expire_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.expire_time = v.map(|x| x.into());
self
}
pub fn set_annotations<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.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.reconciling = v.into();
self
}
pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kms_key_name = v.into();
self
}
pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.kms_key_version_name = v.into();
self
}
}
impl wkt::message::Message for CustomClass {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.CustomClass"
}
}
pub mod custom_class {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ClassItem {
pub value: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ClassItem {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value = v.into();
self
}
}
impl wkt::message::Message for ClassItem {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.CustomClass.ClassItem"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Active,
Deleted,
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl State {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Active => std::option::Option::Some(2),
Self::Deleted => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Active => std::option::Option::Some("ACTIVE"),
Self::Deleted => std::option::Option::Some("DELETED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for State {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
2 => Self::Active,
4 => Self::Deleted,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"ACTIVE" => Self::Active,
"DELETED" => Self::Deleted,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for State {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Active => serializer.serialize_i32(2),
Self::Deleted => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for State {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
".google.cloud.speech.v2.CustomClass.State",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PhraseSet {
pub name: std::string::String,
pub uid: std::string::String,
pub phrases: std::vec::Vec<crate::model::phrase_set::Phrase>,
pub boost: f32,
pub display_name: std::string::String,
pub state: crate::model::phrase_set::State,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub delete_time: std::option::Option<wkt::Timestamp>,
pub expire_time: std::option::Option<wkt::Timestamp>,
pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
pub etag: std::string::String,
pub reconciling: bool,
pub kms_key_name: std::string::String,
pub kms_key_version_name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PhraseSet {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uid = v.into();
self
}
pub fn set_phrases<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::phrase_set::Phrase>,
{
use std::iter::Iterator;
self.phrases = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.boost = v.into();
self
}
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
pub fn set_state<T: std::convert::Into<crate::model::phrase_set::State>>(
mut self,
v: T,
) -> Self {
self.state = v.into();
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_delete_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.delete_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.delete_time = v.map(|x| x.into());
self
}
pub fn set_expire_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.expire_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.expire_time = v.map(|x| x.into());
self
}
pub fn set_annotations<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.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.reconciling = v.into();
self
}
pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kms_key_name = v.into();
self
}
pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.kms_key_version_name = v.into();
self
}
}
impl wkt::message::Message for PhraseSet {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.PhraseSet"
}
}
pub mod phrase_set {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Phrase {
pub value: std::string::String,
pub boost: f32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Phrase {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value = v.into();
self
}
pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.boost = v.into();
self
}
}
impl wkt::message::Message for Phrase {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.PhraseSet.Phrase"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Active,
Deleted,
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl State {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Active => std::option::Option::Some(2),
Self::Deleted => std::option::Option::Some(4),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Active => std::option::Option::Some("ACTIVE"),
Self::Deleted => std::option::Option::Some("DELETED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for State {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
2 => Self::Active,
4 => Self::Deleted,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"ACTIVE" => Self::Active,
"DELETED" => Self::Deleted,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for State {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Active => serializer.serialize_i32(2),
Self::Deleted => serializer.serialize_i32(4),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for State {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
".google.cloud.speech.v2.PhraseSet.State",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateCustomClassRequest {
pub custom_class: std::option::Option<crate::model::CustomClass>,
pub validate_only: bool,
pub custom_class_id: std::string::String,
pub parent: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateCustomClassRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_custom_class<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CustomClass>,
{
self.custom_class = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_custom_class<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CustomClass>,
{
self.custom_class = v.map(|x| x.into());
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
pub fn set_custom_class_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.custom_class_id = v.into();
self
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
}
impl wkt::message::Message for CreateCustomClassRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.CreateCustomClassRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListCustomClassesRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub show_deleted: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListCustomClassesRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.show_deleted = v.into();
self
}
}
impl wkt::message::Message for ListCustomClassesRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.ListCustomClassesRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListCustomClassesResponse {
pub custom_classes: std::vec::Vec<crate::model::CustomClass>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListCustomClassesResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_custom_classes<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::CustomClass>,
{
use std::iter::Iterator;
self.custom_classes = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListCustomClassesResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.ListCustomClassesResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListCustomClassesResponse {
type PageItem = crate::model::CustomClass;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.custom_classes
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetCustomClassRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetCustomClassRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetCustomClassRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.GetCustomClassRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateCustomClassRequest {
pub custom_class: std::option::Option<crate::model::CustomClass>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub validate_only: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateCustomClassRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_custom_class<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::CustomClass>,
{
self.custom_class = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_custom_class<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::CustomClass>,
{
self.custom_class = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
}
impl wkt::message::Message for UpdateCustomClassRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.UpdateCustomClassRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteCustomClassRequest {
pub name: std::string::String,
pub validate_only: bool,
pub allow_missing: bool,
pub etag: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteCustomClassRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.allow_missing = v.into();
self
}
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
}
impl wkt::message::Message for DeleteCustomClassRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.DeleteCustomClassRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeleteCustomClassRequest {
pub name: std::string::String,
pub validate_only: bool,
pub etag: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UndeleteCustomClassRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
}
impl wkt::message::Message for UndeleteCustomClassRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.UndeleteCustomClassRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreatePhraseSetRequest {
pub phrase_set: std::option::Option<crate::model::PhraseSet>,
pub validate_only: bool,
pub phrase_set_id: std::string::String,
pub parent: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreatePhraseSetRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_phrase_set<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PhraseSet>,
{
self.phrase_set = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_phrase_set<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PhraseSet>,
{
self.phrase_set = v.map(|x| x.into());
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
pub fn set_phrase_set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.phrase_set_id = v.into();
self
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
}
impl wkt::message::Message for CreatePhraseSetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.CreatePhraseSetRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListPhraseSetsRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub show_deleted: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListPhraseSetsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.show_deleted = v.into();
self
}
}
impl wkt::message::Message for ListPhraseSetsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.ListPhraseSetsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListPhraseSetsResponse {
pub phrase_sets: std::vec::Vec<crate::model::PhraseSet>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListPhraseSetsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_phrase_sets<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::PhraseSet>,
{
use std::iter::Iterator;
self.phrase_sets = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListPhraseSetsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.ListPhraseSetsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListPhraseSetsResponse {
type PageItem = crate::model::PhraseSet;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.phrase_sets
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetPhraseSetRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetPhraseSetRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetPhraseSetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.GetPhraseSetRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdatePhraseSetRequest {
pub phrase_set: std::option::Option<crate::model::PhraseSet>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub validate_only: bool,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdatePhraseSetRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_phrase_set<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::PhraseSet>,
{
self.phrase_set = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_phrase_set<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::PhraseSet>,
{
self.phrase_set = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
}
impl wkt::message::Message for UpdatePhraseSetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.UpdatePhraseSetRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeletePhraseSetRequest {
pub name: std::string::String,
pub validate_only: bool,
pub allow_missing: bool,
pub etag: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeletePhraseSetRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.allow_missing = v.into();
self
}
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
}
impl wkt::message::Message for DeletePhraseSetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.DeletePhraseSetRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeletePhraseSetRequest {
pub name: std::string::String,
pub validate_only: bool,
pub etag: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UndeletePhraseSetRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.validate_only = v.into();
self
}
pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.etag = v.into();
self
}
}
impl wkt::message::Message for UndeletePhraseSetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.UndeletePhraseSetRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ModelFeature {
pub feature: std::string::String,
pub release_state: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ModelFeature {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_feature<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.feature = v.into();
self
}
pub fn set_release_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.release_state = v.into();
self
}
}
impl wkt::message::Message for ModelFeature {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.ModelFeature"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ModelFeatures {
pub model_feature: std::vec::Vec<crate::model::ModelFeature>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ModelFeatures {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_model_feature<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ModelFeature>,
{
use std::iter::Iterator;
self.model_feature = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ModelFeatures {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.ModelFeatures"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ModelMetadata {
pub model_features: std::collections::HashMap<std::string::String, crate::model::ModelFeatures>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ModelMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_model_features<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::ModelFeatures>,
{
use std::iter::Iterator;
self.model_features = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for ModelMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.ModelMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LanguageMetadata {
pub models: std::collections::HashMap<std::string::String, crate::model::ModelMetadata>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LanguageMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_models<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::ModelMetadata>,
{
use std::iter::Iterator;
self.models = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for LanguageMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.LanguageMetadata"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AccessMetadata {
pub constraint_type: crate::model::access_metadata::ConstraintType,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl AccessMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_constraint_type<
T: std::convert::Into<crate::model::access_metadata::ConstraintType>,
>(
mut self,
v: T,
) -> Self {
self.constraint_type = v.into();
self
}
}
impl wkt::message::Message for AccessMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.AccessMetadata"
}
}
pub mod access_metadata {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ConstraintType {
Unspecified,
ResourceLocationsOrgPolicyCreateConstraint,
UnknownValue(constraint_type::UnknownValue),
}
#[doc(hidden)]
pub mod constraint_type {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl ConstraintType {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::ResourceLocationsOrgPolicyCreateConstraint => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CONSTRAINT_TYPE_UNSPECIFIED"),
Self::ResourceLocationsOrgPolicyCreateConstraint => {
std::option::Option::Some("RESOURCE_LOCATIONS_ORG_POLICY_CREATE_CONSTRAINT")
}
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for ConstraintType {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for ConstraintType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for ConstraintType {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::ResourceLocationsOrgPolicyCreateConstraint,
_ => Self::UnknownValue(constraint_type::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for ConstraintType {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CONSTRAINT_TYPE_UNSPECIFIED" => Self::Unspecified,
"RESOURCE_LOCATIONS_ORG_POLICY_CREATE_CONSTRAINT" => {
Self::ResourceLocationsOrgPolicyCreateConstraint
}
_ => Self::UnknownValue(constraint_type::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for ConstraintType {
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::ResourceLocationsOrgPolicyCreateConstraint => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for ConstraintType {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConstraintType>::new(
".google.cloud.speech.v2.AccessMetadata.ConstraintType",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LocationsMetadata {
pub languages: std::option::Option<crate::model::LanguageMetadata>,
pub access_metadata: std::option::Option<crate::model::AccessMetadata>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LocationsMetadata {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_languages<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::LanguageMetadata>,
{
self.languages = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_languages<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::LanguageMetadata>,
{
self.languages = v.map(|x| x.into());
self
}
pub fn set_access_metadata<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::AccessMetadata>,
{
self.access_metadata = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_access_metadata<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::AccessMetadata>,
{
self.access_metadata = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for LocationsMetadata {
fn typename() -> &'static str {
"type.googleapis.com/google.cloud.speech.v2.LocationsMetadata"
}
}