Skip to main content

google_cloud_texttospeech_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_longrunning;
25extern crate google_cloud_lro;
26extern crate serde;
27extern crate serde_json;
28extern crate serde_with;
29extern crate std;
30extern crate tracing;
31extern crate wkt;
32
33mod debug;
34mod deserialize;
35mod serialize;
36
37/// The top-level message sent by the client for the `ListVoices` method.
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct ListVoicesRequest {
41    /// Optional. Recommended.
42    /// [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
43    /// If not specified, the API will return all supported voices.
44    /// If specified, the ListVoices call will only return voices that can be used
45    /// to synthesize this language_code. For example, if you specify `"en-NZ"`,
46    /// all `"en-NZ"` voices will be returned. If you specify `"no"`, both
47    /// `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be
48    /// returned.
49    pub language_code: std::string::String,
50
51    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
52}
53
54impl ListVoicesRequest {
55    /// Creates a new default instance.
56    pub fn new() -> Self {
57        std::default::Default::default()
58    }
59
60    /// Sets the value of [language_code][crate::model::ListVoicesRequest::language_code].
61    ///
62    /// # Example
63    /// ```ignore,no_run
64    /// # use google_cloud_texttospeech_v1::model::ListVoicesRequest;
65    /// let x = ListVoicesRequest::new().set_language_code("example");
66    /// ```
67    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
68        self.language_code = v.into();
69        self
70    }
71}
72
73impl wkt::message::Message for ListVoicesRequest {
74    fn typename() -> &'static str {
75        "type.googleapis.com/google.cloud.texttospeech.v1.ListVoicesRequest"
76    }
77}
78
79/// The message returned to the client by the `ListVoices` method.
80#[derive(Clone, Default, PartialEq)]
81#[non_exhaustive]
82pub struct ListVoicesResponse {
83    /// The list of voices.
84    pub voices: std::vec::Vec<crate::model::Voice>,
85
86    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
87}
88
89impl ListVoicesResponse {
90    /// Creates a new default instance.
91    pub fn new() -> Self {
92        std::default::Default::default()
93    }
94
95    /// Sets the value of [voices][crate::model::ListVoicesResponse::voices].
96    ///
97    /// # Example
98    /// ```ignore,no_run
99    /// # use google_cloud_texttospeech_v1::model::ListVoicesResponse;
100    /// use google_cloud_texttospeech_v1::model::Voice;
101    /// let x = ListVoicesResponse::new()
102    ///     .set_voices([
103    ///         Voice::default()/* use setters */,
104    ///         Voice::default()/* use (different) setters */,
105    ///     ]);
106    /// ```
107    pub fn set_voices<T, V>(mut self, v: T) -> Self
108    where
109        T: std::iter::IntoIterator<Item = V>,
110        V: std::convert::Into<crate::model::Voice>,
111    {
112        use std::iter::Iterator;
113        self.voices = v.into_iter().map(|i| i.into()).collect();
114        self
115    }
116}
117
118impl wkt::message::Message for ListVoicesResponse {
119    fn typename() -> &'static str {
120        "type.googleapis.com/google.cloud.texttospeech.v1.ListVoicesResponse"
121    }
122}
123
124/// Description of a voice supported by the TTS service.
125#[derive(Clone, Default, PartialEq)]
126#[non_exhaustive]
127pub struct Voice {
128    /// The languages that this voice supports, expressed as
129    /// [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g.
130    /// "en-US", "es-419", "cmn-tw").
131    pub language_codes: std::vec::Vec<std::string::String>,
132
133    /// The name of this voice.  Each distinct voice has a unique name.
134    pub name: std::string::String,
135
136    /// The gender of this voice.
137    pub ssml_gender: crate::model::SsmlVoiceGender,
138
139    /// The natural sample rate (in hertz) for this voice.
140    pub natural_sample_rate_hertz: i32,
141
142    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
143}
144
145impl Voice {
146    /// Creates a new default instance.
147    pub fn new() -> Self {
148        std::default::Default::default()
149    }
150
151    /// Sets the value of [language_codes][crate::model::Voice::language_codes].
152    ///
153    /// # Example
154    /// ```ignore,no_run
155    /// # use google_cloud_texttospeech_v1::model::Voice;
156    /// let x = Voice::new().set_language_codes(["a", "b", "c"]);
157    /// ```
158    pub fn set_language_codes<T, V>(mut self, v: T) -> Self
159    where
160        T: std::iter::IntoIterator<Item = V>,
161        V: std::convert::Into<std::string::String>,
162    {
163        use std::iter::Iterator;
164        self.language_codes = v.into_iter().map(|i| i.into()).collect();
165        self
166    }
167
168    /// Sets the value of [name][crate::model::Voice::name].
169    ///
170    /// # Example
171    /// ```ignore,no_run
172    /// # use google_cloud_texttospeech_v1::model::Voice;
173    /// let x = Voice::new().set_name("example");
174    /// ```
175    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
176        self.name = v.into();
177        self
178    }
179
180    /// Sets the value of [ssml_gender][crate::model::Voice::ssml_gender].
181    ///
182    /// # Example
183    /// ```ignore,no_run
184    /// # use google_cloud_texttospeech_v1::model::Voice;
185    /// use google_cloud_texttospeech_v1::model::SsmlVoiceGender;
186    /// let x0 = Voice::new().set_ssml_gender(SsmlVoiceGender::Male);
187    /// let x1 = Voice::new().set_ssml_gender(SsmlVoiceGender::Female);
188    /// let x2 = Voice::new().set_ssml_gender(SsmlVoiceGender::Neutral);
189    /// ```
190    pub fn set_ssml_gender<T: std::convert::Into<crate::model::SsmlVoiceGender>>(
191        mut self,
192        v: T,
193    ) -> Self {
194        self.ssml_gender = v.into();
195        self
196    }
197
198    /// Sets the value of [natural_sample_rate_hertz][crate::model::Voice::natural_sample_rate_hertz].
199    ///
200    /// # Example
201    /// ```ignore,no_run
202    /// # use google_cloud_texttospeech_v1::model::Voice;
203    /// let x = Voice::new().set_natural_sample_rate_hertz(42);
204    /// ```
205    pub fn set_natural_sample_rate_hertz<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
206        self.natural_sample_rate_hertz = v.into();
207        self
208    }
209}
210
211impl wkt::message::Message for Voice {
212    fn typename() -> &'static str {
213        "type.googleapis.com/google.cloud.texttospeech.v1.Voice"
214    }
215}
216
217/// Used for advanced voice options.
218#[derive(Clone, Default, PartialEq)]
219#[non_exhaustive]
220pub struct AdvancedVoiceOptions {
221    /// Only for Journey voices. If false, the synthesis is context aware
222    /// and has a higher latency.
223    pub low_latency_journey_synthesis: std::option::Option<bool>,
224
225    /// Optional. Input only. Deprecated, use safety_settings instead.
226    /// If true, relaxes safety filters for Gemini TTS.
227    #[deprecated]
228    pub relax_safety_filters: bool,
229
230    /// Optional. Input only. This applies to Gemini TTS only. If set, the category
231    /// specified in the safety setting will be blocked if the harm probability is
232    /// above the threshold. Otherwise, the safety filter will be disabled by
233    /// default.
234    pub safety_settings: std::option::Option<crate::model::advanced_voice_options::SafetySettings>,
235
236    /// Optional. If true, textnorm will be applied to text input. This feature is
237    /// enabled by default. Only applies for Gemini TTS.
238    pub enable_textnorm: std::option::Option<bool>,
239
240    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
241}
242
243impl AdvancedVoiceOptions {
244    /// Creates a new default instance.
245    pub fn new() -> Self {
246        std::default::Default::default()
247    }
248
249    /// Sets the value of [low_latency_journey_synthesis][crate::model::AdvancedVoiceOptions::low_latency_journey_synthesis].
250    ///
251    /// # Example
252    /// ```ignore,no_run
253    /// # use google_cloud_texttospeech_v1::model::AdvancedVoiceOptions;
254    /// let x = AdvancedVoiceOptions::new().set_low_latency_journey_synthesis(true);
255    /// ```
256    pub fn set_low_latency_journey_synthesis<T>(mut self, v: T) -> Self
257    where
258        T: std::convert::Into<bool>,
259    {
260        self.low_latency_journey_synthesis = std::option::Option::Some(v.into());
261        self
262    }
263
264    /// Sets or clears the value of [low_latency_journey_synthesis][crate::model::AdvancedVoiceOptions::low_latency_journey_synthesis].
265    ///
266    /// # Example
267    /// ```ignore,no_run
268    /// # use google_cloud_texttospeech_v1::model::AdvancedVoiceOptions;
269    /// let x = AdvancedVoiceOptions::new().set_or_clear_low_latency_journey_synthesis(Some(false));
270    /// let x = AdvancedVoiceOptions::new().set_or_clear_low_latency_journey_synthesis(None::<bool>);
271    /// ```
272    pub fn set_or_clear_low_latency_journey_synthesis<T>(
273        mut self,
274        v: std::option::Option<T>,
275    ) -> Self
276    where
277        T: std::convert::Into<bool>,
278    {
279        self.low_latency_journey_synthesis = v.map(|x| x.into());
280        self
281    }
282
283    /// Sets the value of [relax_safety_filters][crate::model::AdvancedVoiceOptions::relax_safety_filters].
284    ///
285    /// # Example
286    /// ```ignore,no_run
287    /// # use google_cloud_texttospeech_v1::model::AdvancedVoiceOptions;
288    /// let x = AdvancedVoiceOptions::new().set_relax_safety_filters(true);
289    /// ```
290    #[deprecated]
291    pub fn set_relax_safety_filters<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
292        self.relax_safety_filters = v.into();
293        self
294    }
295
296    /// Sets the value of [safety_settings][crate::model::AdvancedVoiceOptions::safety_settings].
297    ///
298    /// # Example
299    /// ```ignore,no_run
300    /// # use google_cloud_texttospeech_v1::model::AdvancedVoiceOptions;
301    /// use google_cloud_texttospeech_v1::model::advanced_voice_options::SafetySettings;
302    /// let x = AdvancedVoiceOptions::new().set_safety_settings(SafetySettings::default()/* use setters */);
303    /// ```
304    pub fn set_safety_settings<T>(mut self, v: T) -> Self
305    where
306        T: std::convert::Into<crate::model::advanced_voice_options::SafetySettings>,
307    {
308        self.safety_settings = std::option::Option::Some(v.into());
309        self
310    }
311
312    /// Sets or clears the value of [safety_settings][crate::model::AdvancedVoiceOptions::safety_settings].
313    ///
314    /// # Example
315    /// ```ignore,no_run
316    /// # use google_cloud_texttospeech_v1::model::AdvancedVoiceOptions;
317    /// use google_cloud_texttospeech_v1::model::advanced_voice_options::SafetySettings;
318    /// let x = AdvancedVoiceOptions::new().set_or_clear_safety_settings(Some(SafetySettings::default()/* use setters */));
319    /// let x = AdvancedVoiceOptions::new().set_or_clear_safety_settings(None::<SafetySettings>);
320    /// ```
321    pub fn set_or_clear_safety_settings<T>(mut self, v: std::option::Option<T>) -> Self
322    where
323        T: std::convert::Into<crate::model::advanced_voice_options::SafetySettings>,
324    {
325        self.safety_settings = v.map(|x| x.into());
326        self
327    }
328
329    /// Sets the value of [enable_textnorm][crate::model::AdvancedVoiceOptions::enable_textnorm].
330    ///
331    /// # Example
332    /// ```ignore,no_run
333    /// # use google_cloud_texttospeech_v1::model::AdvancedVoiceOptions;
334    /// let x = AdvancedVoiceOptions::new().set_enable_textnorm(true);
335    /// ```
336    pub fn set_enable_textnorm<T>(mut self, v: T) -> Self
337    where
338        T: std::convert::Into<bool>,
339    {
340        self.enable_textnorm = std::option::Option::Some(v.into());
341        self
342    }
343
344    /// Sets or clears the value of [enable_textnorm][crate::model::AdvancedVoiceOptions::enable_textnorm].
345    ///
346    /// # Example
347    /// ```ignore,no_run
348    /// # use google_cloud_texttospeech_v1::model::AdvancedVoiceOptions;
349    /// let x = AdvancedVoiceOptions::new().set_or_clear_enable_textnorm(Some(false));
350    /// let x = AdvancedVoiceOptions::new().set_or_clear_enable_textnorm(None::<bool>);
351    /// ```
352    pub fn set_or_clear_enable_textnorm<T>(mut self, v: std::option::Option<T>) -> Self
353    where
354        T: std::convert::Into<bool>,
355    {
356        self.enable_textnorm = v.map(|x| x.into());
357        self
358    }
359}
360
361impl wkt::message::Message for AdvancedVoiceOptions {
362    fn typename() -> &'static str {
363        "type.googleapis.com/google.cloud.texttospeech.v1.AdvancedVoiceOptions"
364    }
365}
366
367/// Defines additional types related to [AdvancedVoiceOptions].
368pub mod advanced_voice_options {
369    #[allow(unused_imports)]
370    use super::*;
371
372    /// Safety setting for a single harm category.
373    #[derive(Clone, Default, PartialEq)]
374    #[non_exhaustive]
375    pub struct SafetySetting {
376        /// The harm category to apply the safety setting to.
377        pub category: crate::model::advanced_voice_options::HarmCategory,
378
379        /// The harm block threshold for the safety setting.
380        pub threshold: crate::model::advanced_voice_options::HarmBlockThreshold,
381
382        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
383    }
384
385    impl SafetySetting {
386        /// Creates a new default instance.
387        pub fn new() -> Self {
388            std::default::Default::default()
389        }
390
391        /// Sets the value of [category][crate::model::advanced_voice_options::SafetySetting::category].
392        ///
393        /// # Example
394        /// ```ignore,no_run
395        /// # use google_cloud_texttospeech_v1::model::advanced_voice_options::SafetySetting;
396        /// use google_cloud_texttospeech_v1::model::advanced_voice_options::HarmCategory;
397        /// let x0 = SafetySetting::new().set_category(HarmCategory::HateSpeech);
398        /// let x1 = SafetySetting::new().set_category(HarmCategory::DangerousContent);
399        /// let x2 = SafetySetting::new().set_category(HarmCategory::Harassment);
400        /// ```
401        pub fn set_category<
402            T: std::convert::Into<crate::model::advanced_voice_options::HarmCategory>,
403        >(
404            mut self,
405            v: T,
406        ) -> Self {
407            self.category = v.into();
408            self
409        }
410
411        /// Sets the value of [threshold][crate::model::advanced_voice_options::SafetySetting::threshold].
412        ///
413        /// # Example
414        /// ```ignore,no_run
415        /// # use google_cloud_texttospeech_v1::model::advanced_voice_options::SafetySetting;
416        /// use google_cloud_texttospeech_v1::model::advanced_voice_options::HarmBlockThreshold;
417        /// let x0 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockLowAndAbove);
418        /// let x1 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockMediumAndAbove);
419        /// let x2 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockOnlyHigh);
420        /// ```
421        pub fn set_threshold<
422            T: std::convert::Into<crate::model::advanced_voice_options::HarmBlockThreshold>,
423        >(
424            mut self,
425            v: T,
426        ) -> Self {
427            self.threshold = v.into();
428            self
429        }
430    }
431
432    impl wkt::message::Message for SafetySetting {
433        fn typename() -> &'static str {
434            "type.googleapis.com/google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySetting"
435        }
436    }
437
438    /// Safety settings for the request.
439    #[derive(Clone, Default, PartialEq)]
440    #[non_exhaustive]
441    pub struct SafetySettings {
442        /// The safety settings for the request.
443        pub settings: std::vec::Vec<crate::model::advanced_voice_options::SafetySetting>,
444
445        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
446    }
447
448    impl SafetySettings {
449        /// Creates a new default instance.
450        pub fn new() -> Self {
451            std::default::Default::default()
452        }
453
454        /// Sets the value of [settings][crate::model::advanced_voice_options::SafetySettings::settings].
455        ///
456        /// # Example
457        /// ```ignore,no_run
458        /// # use google_cloud_texttospeech_v1::model::advanced_voice_options::SafetySettings;
459        /// use google_cloud_texttospeech_v1::model::advanced_voice_options::SafetySetting;
460        /// let x = SafetySettings::new()
461        ///     .set_settings([
462        ///         SafetySetting::default()/* use setters */,
463        ///         SafetySetting::default()/* use (different) setters */,
464        ///     ]);
465        /// ```
466        pub fn set_settings<T, V>(mut self, v: T) -> Self
467        where
468            T: std::iter::IntoIterator<Item = V>,
469            V: std::convert::Into<crate::model::advanced_voice_options::SafetySetting>,
470        {
471            use std::iter::Iterator;
472            self.settings = v.into_iter().map(|i| i.into()).collect();
473            self
474        }
475    }
476
477    impl wkt::message::Message for SafetySettings {
478        fn typename() -> &'static str {
479            "type.googleapis.com/google.cloud.texttospeech.v1.AdvancedVoiceOptions.SafetySettings"
480        }
481    }
482
483    /// Harm categories that will block the content.
484    ///
485    /// # Working with unknown values
486    ///
487    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
488    /// additional enum variants at any time. Adding new variants is not considered
489    /// a breaking change. Applications should write their code in anticipation of:
490    ///
491    /// - New values appearing in future releases of the client library, **and**
492    /// - New values received dynamically, without application changes.
493    ///
494    /// Please consult the [Working with enums] section in the user guide for some
495    /// guidelines.
496    ///
497    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
498    #[derive(Clone, Debug, PartialEq)]
499    #[non_exhaustive]
500    pub enum HarmCategory {
501        /// Default value. This value is unused.
502        Unspecified,
503        /// Content that promotes violence or incites hatred against individuals or
504        /// groups based on certain attributes.
505        HateSpeech,
506        /// Content that promotes, facilitates, or enables dangerous activities.
507        DangerousContent,
508        /// Abusive, threatening, or content intended to bully, torment, or ridicule.
509        Harassment,
510        /// Content that contains sexually explicit material.
511        SexuallyExplicit,
512        /// If set, the enum was initialized with an unknown value.
513        ///
514        /// Applications can examine the value using [HarmCategory::value] or
515        /// [HarmCategory::name].
516        UnknownValue(harm_category::UnknownValue),
517    }
518
519    #[doc(hidden)]
520    pub mod harm_category {
521        #[allow(unused_imports)]
522        use super::*;
523        #[derive(Clone, Debug, PartialEq)]
524        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
525    }
526
527    impl HarmCategory {
528        /// Gets the enum value.
529        ///
530        /// Returns `None` if the enum contains an unknown value deserialized from
531        /// the string representation of enums.
532        pub fn value(&self) -> std::option::Option<i32> {
533            match self {
534                Self::Unspecified => std::option::Option::Some(0),
535                Self::HateSpeech => std::option::Option::Some(1),
536                Self::DangerousContent => std::option::Option::Some(2),
537                Self::Harassment => std::option::Option::Some(3),
538                Self::SexuallyExplicit => std::option::Option::Some(4),
539                Self::UnknownValue(u) => u.0.value(),
540            }
541        }
542
543        /// Gets the enum value as a string.
544        ///
545        /// Returns `None` if the enum contains an unknown value deserialized from
546        /// the integer representation of enums.
547        pub fn name(&self) -> std::option::Option<&str> {
548            match self {
549                Self::Unspecified => std::option::Option::Some("HARM_CATEGORY_UNSPECIFIED"),
550                Self::HateSpeech => std::option::Option::Some("HARM_CATEGORY_HATE_SPEECH"),
551                Self::DangerousContent => {
552                    std::option::Option::Some("HARM_CATEGORY_DANGEROUS_CONTENT")
553                }
554                Self::Harassment => std::option::Option::Some("HARM_CATEGORY_HARASSMENT"),
555                Self::SexuallyExplicit => {
556                    std::option::Option::Some("HARM_CATEGORY_SEXUALLY_EXPLICIT")
557                }
558                Self::UnknownValue(u) => u.0.name(),
559            }
560        }
561    }
562
563    impl std::default::Default for HarmCategory {
564        fn default() -> Self {
565            use std::convert::From;
566            Self::from(0)
567        }
568    }
569
570    impl std::fmt::Display for HarmCategory {
571        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
572            wkt::internal::display_enum(f, self.name(), self.value())
573        }
574    }
575
576    impl std::convert::From<i32> for HarmCategory {
577        fn from(value: i32) -> Self {
578            match value {
579                0 => Self::Unspecified,
580                1 => Self::HateSpeech,
581                2 => Self::DangerousContent,
582                3 => Self::Harassment,
583                4 => Self::SexuallyExplicit,
584                _ => Self::UnknownValue(harm_category::UnknownValue(
585                    wkt::internal::UnknownEnumValue::Integer(value),
586                )),
587            }
588        }
589    }
590
591    impl std::convert::From<&str> for HarmCategory {
592        fn from(value: &str) -> Self {
593            use std::string::ToString;
594            match value {
595                "HARM_CATEGORY_UNSPECIFIED" => Self::Unspecified,
596                "HARM_CATEGORY_HATE_SPEECH" => Self::HateSpeech,
597                "HARM_CATEGORY_DANGEROUS_CONTENT" => Self::DangerousContent,
598                "HARM_CATEGORY_HARASSMENT" => Self::Harassment,
599                "HARM_CATEGORY_SEXUALLY_EXPLICIT" => Self::SexuallyExplicit,
600                _ => Self::UnknownValue(harm_category::UnknownValue(
601                    wkt::internal::UnknownEnumValue::String(value.to_string()),
602                )),
603            }
604        }
605    }
606
607    impl serde::ser::Serialize for HarmCategory {
608        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
609        where
610            S: serde::Serializer,
611        {
612            match self {
613                Self::Unspecified => serializer.serialize_i32(0),
614                Self::HateSpeech => serializer.serialize_i32(1),
615                Self::DangerousContent => serializer.serialize_i32(2),
616                Self::Harassment => serializer.serialize_i32(3),
617                Self::SexuallyExplicit => serializer.serialize_i32(4),
618                Self::UnknownValue(u) => u.0.serialize(serializer),
619            }
620        }
621    }
622
623    impl<'de> serde::de::Deserialize<'de> for HarmCategory {
624        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
625        where
626            D: serde::Deserializer<'de>,
627        {
628            deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmCategory>::new(
629                ".google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmCategory",
630            ))
631        }
632    }
633
634    /// Harm block thresholds for the safety settings.
635    ///
636    /// # Working with unknown values
637    ///
638    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
639    /// additional enum variants at any time. Adding new variants is not considered
640    /// a breaking change. Applications should write their code in anticipation of:
641    ///
642    /// - New values appearing in future releases of the client library, **and**
643    /// - New values received dynamically, without application changes.
644    ///
645    /// Please consult the [Working with enums] section in the user guide for some
646    /// guidelines.
647    ///
648    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
649    #[derive(Clone, Debug, PartialEq)]
650    #[non_exhaustive]
651    pub enum HarmBlockThreshold {
652        /// The harm block threshold is unspecified.
653        Unspecified,
654        /// Block content with a low harm probability or higher.
655        BlockLowAndAbove,
656        /// Block content with a medium harm probability or higher.
657        BlockMediumAndAbove,
658        /// Block content with a high harm probability.
659        BlockOnlyHigh,
660        /// Do not block any content, regardless of its harm probability.
661        BlockNone,
662        /// Turn off the safety filter entirely.
663        Off,
664        /// If set, the enum was initialized with an unknown value.
665        ///
666        /// Applications can examine the value using [HarmBlockThreshold::value] or
667        /// [HarmBlockThreshold::name].
668        UnknownValue(harm_block_threshold::UnknownValue),
669    }
670
671    #[doc(hidden)]
672    pub mod harm_block_threshold {
673        #[allow(unused_imports)]
674        use super::*;
675        #[derive(Clone, Debug, PartialEq)]
676        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
677    }
678
679    impl HarmBlockThreshold {
680        /// Gets the enum value.
681        ///
682        /// Returns `None` if the enum contains an unknown value deserialized from
683        /// the string representation of enums.
684        pub fn value(&self) -> std::option::Option<i32> {
685            match self {
686                Self::Unspecified => std::option::Option::Some(0),
687                Self::BlockLowAndAbove => std::option::Option::Some(1),
688                Self::BlockMediumAndAbove => std::option::Option::Some(2),
689                Self::BlockOnlyHigh => std::option::Option::Some(3),
690                Self::BlockNone => std::option::Option::Some(4),
691                Self::Off => std::option::Option::Some(5),
692                Self::UnknownValue(u) => u.0.value(),
693            }
694        }
695
696        /// Gets the enum value as a string.
697        ///
698        /// Returns `None` if the enum contains an unknown value deserialized from
699        /// the integer representation of enums.
700        pub fn name(&self) -> std::option::Option<&str> {
701            match self {
702                Self::Unspecified => std::option::Option::Some("HARM_BLOCK_THRESHOLD_UNSPECIFIED"),
703                Self::BlockLowAndAbove => std::option::Option::Some("BLOCK_LOW_AND_ABOVE"),
704                Self::BlockMediumAndAbove => std::option::Option::Some("BLOCK_MEDIUM_AND_ABOVE"),
705                Self::BlockOnlyHigh => std::option::Option::Some("BLOCK_ONLY_HIGH"),
706                Self::BlockNone => std::option::Option::Some("BLOCK_NONE"),
707                Self::Off => std::option::Option::Some("OFF"),
708                Self::UnknownValue(u) => u.0.name(),
709            }
710        }
711    }
712
713    impl std::default::Default for HarmBlockThreshold {
714        fn default() -> Self {
715            use std::convert::From;
716            Self::from(0)
717        }
718    }
719
720    impl std::fmt::Display for HarmBlockThreshold {
721        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
722            wkt::internal::display_enum(f, self.name(), self.value())
723        }
724    }
725
726    impl std::convert::From<i32> for HarmBlockThreshold {
727        fn from(value: i32) -> Self {
728            match value {
729                0 => Self::Unspecified,
730                1 => Self::BlockLowAndAbove,
731                2 => Self::BlockMediumAndAbove,
732                3 => Self::BlockOnlyHigh,
733                4 => Self::BlockNone,
734                5 => Self::Off,
735                _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
736                    wkt::internal::UnknownEnumValue::Integer(value),
737                )),
738            }
739        }
740    }
741
742    impl std::convert::From<&str> for HarmBlockThreshold {
743        fn from(value: &str) -> Self {
744            use std::string::ToString;
745            match value {
746                "HARM_BLOCK_THRESHOLD_UNSPECIFIED" => Self::Unspecified,
747                "BLOCK_LOW_AND_ABOVE" => Self::BlockLowAndAbove,
748                "BLOCK_MEDIUM_AND_ABOVE" => Self::BlockMediumAndAbove,
749                "BLOCK_ONLY_HIGH" => Self::BlockOnlyHigh,
750                "BLOCK_NONE" => Self::BlockNone,
751                "OFF" => Self::Off,
752                _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
753                    wkt::internal::UnknownEnumValue::String(value.to_string()),
754                )),
755            }
756        }
757    }
758
759    impl serde::ser::Serialize for HarmBlockThreshold {
760        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
761        where
762            S: serde::Serializer,
763        {
764            match self {
765                Self::Unspecified => serializer.serialize_i32(0),
766                Self::BlockLowAndAbove => serializer.serialize_i32(1),
767                Self::BlockMediumAndAbove => serializer.serialize_i32(2),
768                Self::BlockOnlyHigh => serializer.serialize_i32(3),
769                Self::BlockNone => serializer.serialize_i32(4),
770                Self::Off => serializer.serialize_i32(5),
771                Self::UnknownValue(u) => u.0.serialize(serializer),
772            }
773        }
774    }
775
776    impl<'de> serde::de::Deserialize<'de> for HarmBlockThreshold {
777        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
778        where
779            D: serde::Deserializer<'de>,
780        {
781            deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockThreshold>::new(
782                ".google.cloud.texttospeech.v1.AdvancedVoiceOptions.HarmBlockThreshold",
783            ))
784        }
785    }
786}
787
788/// The top-level message sent by the client for the `SynthesizeSpeech` method.
789#[derive(Clone, Default, PartialEq)]
790#[non_exhaustive]
791pub struct SynthesizeSpeechRequest {
792    /// Required. The Synthesizer requires either plain text or SSML as input.
793    pub input: std::option::Option<crate::model::SynthesisInput>,
794
795    /// Required. The desired voice of the synthesized audio.
796    pub voice: std::option::Option<crate::model::VoiceSelectionParams>,
797
798    /// Required. The configuration of the synthesized audio.
799    pub audio_config: std::option::Option<crate::model::AudioConfig>,
800
801    /// Optional. Advanced voice options.
802    pub advanced_voice_options: std::option::Option<crate::model::AdvancedVoiceOptions>,
803
804    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
805}
806
807impl SynthesizeSpeechRequest {
808    /// Creates a new default instance.
809    pub fn new() -> Self {
810        std::default::Default::default()
811    }
812
813    /// Sets the value of [input][crate::model::SynthesizeSpeechRequest::input].
814    ///
815    /// # Example
816    /// ```ignore,no_run
817    /// # use google_cloud_texttospeech_v1::model::SynthesizeSpeechRequest;
818    /// use google_cloud_texttospeech_v1::model::SynthesisInput;
819    /// let x = SynthesizeSpeechRequest::new().set_input(SynthesisInput::default()/* use setters */);
820    /// ```
821    pub fn set_input<T>(mut self, v: T) -> Self
822    where
823        T: std::convert::Into<crate::model::SynthesisInput>,
824    {
825        self.input = std::option::Option::Some(v.into());
826        self
827    }
828
829    /// Sets or clears the value of [input][crate::model::SynthesizeSpeechRequest::input].
830    ///
831    /// # Example
832    /// ```ignore,no_run
833    /// # use google_cloud_texttospeech_v1::model::SynthesizeSpeechRequest;
834    /// use google_cloud_texttospeech_v1::model::SynthesisInput;
835    /// let x = SynthesizeSpeechRequest::new().set_or_clear_input(Some(SynthesisInput::default()/* use setters */));
836    /// let x = SynthesizeSpeechRequest::new().set_or_clear_input(None::<SynthesisInput>);
837    /// ```
838    pub fn set_or_clear_input<T>(mut self, v: std::option::Option<T>) -> Self
839    where
840        T: std::convert::Into<crate::model::SynthesisInput>,
841    {
842        self.input = v.map(|x| x.into());
843        self
844    }
845
846    /// Sets the value of [voice][crate::model::SynthesizeSpeechRequest::voice].
847    ///
848    /// # Example
849    /// ```ignore,no_run
850    /// # use google_cloud_texttospeech_v1::model::SynthesizeSpeechRequest;
851    /// use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
852    /// let x = SynthesizeSpeechRequest::new().set_voice(VoiceSelectionParams::default()/* use setters */);
853    /// ```
854    pub fn set_voice<T>(mut self, v: T) -> Self
855    where
856        T: std::convert::Into<crate::model::VoiceSelectionParams>,
857    {
858        self.voice = std::option::Option::Some(v.into());
859        self
860    }
861
862    /// Sets or clears the value of [voice][crate::model::SynthesizeSpeechRequest::voice].
863    ///
864    /// # Example
865    /// ```ignore,no_run
866    /// # use google_cloud_texttospeech_v1::model::SynthesizeSpeechRequest;
867    /// use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
868    /// let x = SynthesizeSpeechRequest::new().set_or_clear_voice(Some(VoiceSelectionParams::default()/* use setters */));
869    /// let x = SynthesizeSpeechRequest::new().set_or_clear_voice(None::<VoiceSelectionParams>);
870    /// ```
871    pub fn set_or_clear_voice<T>(mut self, v: std::option::Option<T>) -> Self
872    where
873        T: std::convert::Into<crate::model::VoiceSelectionParams>,
874    {
875        self.voice = v.map(|x| x.into());
876        self
877    }
878
879    /// Sets the value of [audio_config][crate::model::SynthesizeSpeechRequest::audio_config].
880    ///
881    /// # Example
882    /// ```ignore,no_run
883    /// # use google_cloud_texttospeech_v1::model::SynthesizeSpeechRequest;
884    /// use google_cloud_texttospeech_v1::model::AudioConfig;
885    /// let x = SynthesizeSpeechRequest::new().set_audio_config(AudioConfig::default()/* use setters */);
886    /// ```
887    pub fn set_audio_config<T>(mut self, v: T) -> Self
888    where
889        T: std::convert::Into<crate::model::AudioConfig>,
890    {
891        self.audio_config = std::option::Option::Some(v.into());
892        self
893    }
894
895    /// Sets or clears the value of [audio_config][crate::model::SynthesizeSpeechRequest::audio_config].
896    ///
897    /// # Example
898    /// ```ignore,no_run
899    /// # use google_cloud_texttospeech_v1::model::SynthesizeSpeechRequest;
900    /// use google_cloud_texttospeech_v1::model::AudioConfig;
901    /// let x = SynthesizeSpeechRequest::new().set_or_clear_audio_config(Some(AudioConfig::default()/* use setters */));
902    /// let x = SynthesizeSpeechRequest::new().set_or_clear_audio_config(None::<AudioConfig>);
903    /// ```
904    pub fn set_or_clear_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
905    where
906        T: std::convert::Into<crate::model::AudioConfig>,
907    {
908        self.audio_config = v.map(|x| x.into());
909        self
910    }
911
912    /// Sets the value of [advanced_voice_options][crate::model::SynthesizeSpeechRequest::advanced_voice_options].
913    ///
914    /// # Example
915    /// ```ignore,no_run
916    /// # use google_cloud_texttospeech_v1::model::SynthesizeSpeechRequest;
917    /// use google_cloud_texttospeech_v1::model::AdvancedVoiceOptions;
918    /// let x = SynthesizeSpeechRequest::new().set_advanced_voice_options(AdvancedVoiceOptions::default()/* use setters */);
919    /// ```
920    pub fn set_advanced_voice_options<T>(mut self, v: T) -> Self
921    where
922        T: std::convert::Into<crate::model::AdvancedVoiceOptions>,
923    {
924        self.advanced_voice_options = std::option::Option::Some(v.into());
925        self
926    }
927
928    /// Sets or clears the value of [advanced_voice_options][crate::model::SynthesizeSpeechRequest::advanced_voice_options].
929    ///
930    /// # Example
931    /// ```ignore,no_run
932    /// # use google_cloud_texttospeech_v1::model::SynthesizeSpeechRequest;
933    /// use google_cloud_texttospeech_v1::model::AdvancedVoiceOptions;
934    /// let x = SynthesizeSpeechRequest::new().set_or_clear_advanced_voice_options(Some(AdvancedVoiceOptions::default()/* use setters */));
935    /// let x = SynthesizeSpeechRequest::new().set_or_clear_advanced_voice_options(None::<AdvancedVoiceOptions>);
936    /// ```
937    pub fn set_or_clear_advanced_voice_options<T>(mut self, v: std::option::Option<T>) -> Self
938    where
939        T: std::convert::Into<crate::model::AdvancedVoiceOptions>,
940    {
941        self.advanced_voice_options = v.map(|x| x.into());
942        self
943    }
944}
945
946impl wkt::message::Message for SynthesizeSpeechRequest {
947    fn typename() -> &'static str {
948        "type.googleapis.com/google.cloud.texttospeech.v1.SynthesizeSpeechRequest"
949    }
950}
951
952/// Pronunciation customization for a phrase.
953#[derive(Clone, Default, PartialEq)]
954#[non_exhaustive]
955pub struct CustomPronunciationParams {
956    /// The phrase to which the customization is applied.
957    /// The phrase can be multiple words, such as proper nouns, but shouldn't span
958    /// the length of the sentence.
959    pub phrase: std::option::Option<std::string::String>,
960
961    /// The phonetic encoding of the phrase.
962    pub phonetic_encoding:
963        std::option::Option<crate::model::custom_pronunciation_params::PhoneticEncoding>,
964
965    /// The pronunciation of the phrase. This must be in the phonetic encoding
966    /// specified above.
967    pub pronunciation: std::option::Option<std::string::String>,
968
969    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
970}
971
972impl CustomPronunciationParams {
973    /// Creates a new default instance.
974    pub fn new() -> Self {
975        std::default::Default::default()
976    }
977
978    /// Sets the value of [phrase][crate::model::CustomPronunciationParams::phrase].
979    ///
980    /// # Example
981    /// ```ignore,no_run
982    /// # use google_cloud_texttospeech_v1::model::CustomPronunciationParams;
983    /// let x = CustomPronunciationParams::new().set_phrase("example");
984    /// ```
985    pub fn set_phrase<T>(mut self, v: T) -> Self
986    where
987        T: std::convert::Into<std::string::String>,
988    {
989        self.phrase = std::option::Option::Some(v.into());
990        self
991    }
992
993    /// Sets or clears the value of [phrase][crate::model::CustomPronunciationParams::phrase].
994    ///
995    /// # Example
996    /// ```ignore,no_run
997    /// # use google_cloud_texttospeech_v1::model::CustomPronunciationParams;
998    /// let x = CustomPronunciationParams::new().set_or_clear_phrase(Some("example"));
999    /// let x = CustomPronunciationParams::new().set_or_clear_phrase(None::<String>);
1000    /// ```
1001    pub fn set_or_clear_phrase<T>(mut self, v: std::option::Option<T>) -> Self
1002    where
1003        T: std::convert::Into<std::string::String>,
1004    {
1005        self.phrase = v.map(|x| x.into());
1006        self
1007    }
1008
1009    /// Sets the value of [phonetic_encoding][crate::model::CustomPronunciationParams::phonetic_encoding].
1010    ///
1011    /// # Example
1012    /// ```ignore,no_run
1013    /// # use google_cloud_texttospeech_v1::model::CustomPronunciationParams;
1014    /// use google_cloud_texttospeech_v1::model::custom_pronunciation_params::PhoneticEncoding;
1015    /// let x0 = CustomPronunciationParams::new().set_phonetic_encoding(PhoneticEncoding::Ipa);
1016    /// let x1 = CustomPronunciationParams::new().set_phonetic_encoding(PhoneticEncoding::XSampa);
1017    /// let x2 = CustomPronunciationParams::new().set_phonetic_encoding(PhoneticEncoding::JapaneseYomigana);
1018    /// ```
1019    pub fn set_phonetic_encoding<T>(mut self, v: T) -> Self
1020    where
1021        T: std::convert::Into<crate::model::custom_pronunciation_params::PhoneticEncoding>,
1022    {
1023        self.phonetic_encoding = std::option::Option::Some(v.into());
1024        self
1025    }
1026
1027    /// Sets or clears the value of [phonetic_encoding][crate::model::CustomPronunciationParams::phonetic_encoding].
1028    ///
1029    /// # Example
1030    /// ```ignore,no_run
1031    /// # use google_cloud_texttospeech_v1::model::CustomPronunciationParams;
1032    /// use google_cloud_texttospeech_v1::model::custom_pronunciation_params::PhoneticEncoding;
1033    /// let x0 = CustomPronunciationParams::new().set_or_clear_phonetic_encoding(Some(PhoneticEncoding::Ipa));
1034    /// let x1 = CustomPronunciationParams::new().set_or_clear_phonetic_encoding(Some(PhoneticEncoding::XSampa));
1035    /// let x2 = CustomPronunciationParams::new().set_or_clear_phonetic_encoding(Some(PhoneticEncoding::JapaneseYomigana));
1036    /// let x_none = CustomPronunciationParams::new().set_or_clear_phonetic_encoding(None::<PhoneticEncoding>);
1037    /// ```
1038    pub fn set_or_clear_phonetic_encoding<T>(mut self, v: std::option::Option<T>) -> Self
1039    where
1040        T: std::convert::Into<crate::model::custom_pronunciation_params::PhoneticEncoding>,
1041    {
1042        self.phonetic_encoding = v.map(|x| x.into());
1043        self
1044    }
1045
1046    /// Sets the value of [pronunciation][crate::model::CustomPronunciationParams::pronunciation].
1047    ///
1048    /// # Example
1049    /// ```ignore,no_run
1050    /// # use google_cloud_texttospeech_v1::model::CustomPronunciationParams;
1051    /// let x = CustomPronunciationParams::new().set_pronunciation("example");
1052    /// ```
1053    pub fn set_pronunciation<T>(mut self, v: T) -> Self
1054    where
1055        T: std::convert::Into<std::string::String>,
1056    {
1057        self.pronunciation = std::option::Option::Some(v.into());
1058        self
1059    }
1060
1061    /// Sets or clears the value of [pronunciation][crate::model::CustomPronunciationParams::pronunciation].
1062    ///
1063    /// # Example
1064    /// ```ignore,no_run
1065    /// # use google_cloud_texttospeech_v1::model::CustomPronunciationParams;
1066    /// let x = CustomPronunciationParams::new().set_or_clear_pronunciation(Some("example"));
1067    /// let x = CustomPronunciationParams::new().set_or_clear_pronunciation(None::<String>);
1068    /// ```
1069    pub fn set_or_clear_pronunciation<T>(mut self, v: std::option::Option<T>) -> Self
1070    where
1071        T: std::convert::Into<std::string::String>,
1072    {
1073        self.pronunciation = v.map(|x| x.into());
1074        self
1075    }
1076}
1077
1078impl wkt::message::Message for CustomPronunciationParams {
1079    fn typename() -> &'static str {
1080        "type.googleapis.com/google.cloud.texttospeech.v1.CustomPronunciationParams"
1081    }
1082}
1083
1084/// Defines additional types related to [CustomPronunciationParams].
1085pub mod custom_pronunciation_params {
1086    #[allow(unused_imports)]
1087    use super::*;
1088
1089    /// The phonetic encoding of the phrase.
1090    ///
1091    /// # Working with unknown values
1092    ///
1093    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1094    /// additional enum variants at any time. Adding new variants is not considered
1095    /// a breaking change. Applications should write their code in anticipation of:
1096    ///
1097    /// - New values appearing in future releases of the client library, **and**
1098    /// - New values received dynamically, without application changes.
1099    ///
1100    /// Please consult the [Working with enums] section in the user guide for some
1101    /// guidelines.
1102    ///
1103    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1104    #[derive(Clone, Debug, PartialEq)]
1105    #[non_exhaustive]
1106    pub enum PhoneticEncoding {
1107        /// Not specified.
1108        Unspecified,
1109        /// IPA, such as apple -> ˈæpəl.
1110        /// <https://en.wikipedia.org/wiki/International_Phonetic_Alphabet>
1111        Ipa,
1112        /// X-SAMPA, such as apple -> "{p@l".
1113        /// <https://en.wikipedia.org/wiki/X-SAMPA>
1114        XSampa,
1115        /// For reading-to-pron conversion to work well, the `pronunciation` field
1116        /// should only contain Kanji, Hiragana, and Katakana.
1117        ///
1118        /// The pronunciation can also contain pitch accents.
1119        /// The start of a pitch phrase is specified with `^` and the down-pitch
1120        /// position is specified with `!`, for example:
1121        ///
1122        /// ```norust
1123        /// phrase:端  pronunciation:^はし
1124        /// phrase:箸  pronunciation:^は!し
1125        /// phrase:橋  pronunciation:^はし!
1126        /// ```
1127        ///
1128        /// We currently only support the Tokyo dialect, which allows at most one
1129        /// down-pitch per phrase (i.e. at most one `!` between `^`).
1130        JapaneseYomigana,
1131        /// Used to specify pronunciations for Mandarin words. See
1132        /// <https://en.wikipedia.org/wiki/Pinyin>.
1133        ///
1134        /// For example: 朝阳, the pronunciation is "chao2 yang2". The number
1135        /// represents the tone, and there is a space between syllables. Neutral
1136        /// tones are represented by 5, for example 孩子 "hai2 zi5".
1137        Pinyin,
1138        /// If set, the enum was initialized with an unknown value.
1139        ///
1140        /// Applications can examine the value using [PhoneticEncoding::value] or
1141        /// [PhoneticEncoding::name].
1142        UnknownValue(phonetic_encoding::UnknownValue),
1143    }
1144
1145    #[doc(hidden)]
1146    pub mod phonetic_encoding {
1147        #[allow(unused_imports)]
1148        use super::*;
1149        #[derive(Clone, Debug, PartialEq)]
1150        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1151    }
1152
1153    impl PhoneticEncoding {
1154        /// Gets the enum value.
1155        ///
1156        /// Returns `None` if the enum contains an unknown value deserialized from
1157        /// the string representation of enums.
1158        pub fn value(&self) -> std::option::Option<i32> {
1159            match self {
1160                Self::Unspecified => std::option::Option::Some(0),
1161                Self::Ipa => std::option::Option::Some(1),
1162                Self::XSampa => std::option::Option::Some(2),
1163                Self::JapaneseYomigana => std::option::Option::Some(3),
1164                Self::Pinyin => std::option::Option::Some(4),
1165                Self::UnknownValue(u) => u.0.value(),
1166            }
1167        }
1168
1169        /// Gets the enum value as a string.
1170        ///
1171        /// Returns `None` if the enum contains an unknown value deserialized from
1172        /// the integer representation of enums.
1173        pub fn name(&self) -> std::option::Option<&str> {
1174            match self {
1175                Self::Unspecified => std::option::Option::Some("PHONETIC_ENCODING_UNSPECIFIED"),
1176                Self::Ipa => std::option::Option::Some("PHONETIC_ENCODING_IPA"),
1177                Self::XSampa => std::option::Option::Some("PHONETIC_ENCODING_X_SAMPA"),
1178                Self::JapaneseYomigana => {
1179                    std::option::Option::Some("PHONETIC_ENCODING_JAPANESE_YOMIGANA")
1180                }
1181                Self::Pinyin => std::option::Option::Some("PHONETIC_ENCODING_PINYIN"),
1182                Self::UnknownValue(u) => u.0.name(),
1183            }
1184        }
1185    }
1186
1187    impl std::default::Default for PhoneticEncoding {
1188        fn default() -> Self {
1189            use std::convert::From;
1190            Self::from(0)
1191        }
1192    }
1193
1194    impl std::fmt::Display for PhoneticEncoding {
1195        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1196            wkt::internal::display_enum(f, self.name(), self.value())
1197        }
1198    }
1199
1200    impl std::convert::From<i32> for PhoneticEncoding {
1201        fn from(value: i32) -> Self {
1202            match value {
1203                0 => Self::Unspecified,
1204                1 => Self::Ipa,
1205                2 => Self::XSampa,
1206                3 => Self::JapaneseYomigana,
1207                4 => Self::Pinyin,
1208                _ => Self::UnknownValue(phonetic_encoding::UnknownValue(
1209                    wkt::internal::UnknownEnumValue::Integer(value),
1210                )),
1211            }
1212        }
1213    }
1214
1215    impl std::convert::From<&str> for PhoneticEncoding {
1216        fn from(value: &str) -> Self {
1217            use std::string::ToString;
1218            match value {
1219                "PHONETIC_ENCODING_UNSPECIFIED" => Self::Unspecified,
1220                "PHONETIC_ENCODING_IPA" => Self::Ipa,
1221                "PHONETIC_ENCODING_X_SAMPA" => Self::XSampa,
1222                "PHONETIC_ENCODING_JAPANESE_YOMIGANA" => Self::JapaneseYomigana,
1223                "PHONETIC_ENCODING_PINYIN" => Self::Pinyin,
1224                _ => Self::UnknownValue(phonetic_encoding::UnknownValue(
1225                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1226                )),
1227            }
1228        }
1229    }
1230
1231    impl serde::ser::Serialize for PhoneticEncoding {
1232        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1233        where
1234            S: serde::Serializer,
1235        {
1236            match self {
1237                Self::Unspecified => serializer.serialize_i32(0),
1238                Self::Ipa => serializer.serialize_i32(1),
1239                Self::XSampa => serializer.serialize_i32(2),
1240                Self::JapaneseYomigana => serializer.serialize_i32(3),
1241                Self::Pinyin => serializer.serialize_i32(4),
1242                Self::UnknownValue(u) => u.0.serialize(serializer),
1243            }
1244        }
1245    }
1246
1247    impl<'de> serde::de::Deserialize<'de> for PhoneticEncoding {
1248        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1249        where
1250            D: serde::Deserializer<'de>,
1251        {
1252            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PhoneticEncoding>::new(
1253                ".google.cloud.texttospeech.v1.CustomPronunciationParams.PhoneticEncoding",
1254            ))
1255        }
1256    }
1257}
1258
1259/// A collection of pronunciation customizations.
1260#[derive(Clone, Default, PartialEq)]
1261#[non_exhaustive]
1262pub struct CustomPronunciations {
1263    /// The pronunciation customizations are applied.
1264    pub pronunciations: std::vec::Vec<crate::model::CustomPronunciationParams>,
1265
1266    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1267}
1268
1269impl CustomPronunciations {
1270    /// Creates a new default instance.
1271    pub fn new() -> Self {
1272        std::default::Default::default()
1273    }
1274
1275    /// Sets the value of [pronunciations][crate::model::CustomPronunciations::pronunciations].
1276    ///
1277    /// # Example
1278    /// ```ignore,no_run
1279    /// # use google_cloud_texttospeech_v1::model::CustomPronunciations;
1280    /// use google_cloud_texttospeech_v1::model::CustomPronunciationParams;
1281    /// let x = CustomPronunciations::new()
1282    ///     .set_pronunciations([
1283    ///         CustomPronunciationParams::default()/* use setters */,
1284    ///         CustomPronunciationParams::default()/* use (different) setters */,
1285    ///     ]);
1286    /// ```
1287    pub fn set_pronunciations<T, V>(mut self, v: T) -> Self
1288    where
1289        T: std::iter::IntoIterator<Item = V>,
1290        V: std::convert::Into<crate::model::CustomPronunciationParams>,
1291    {
1292        use std::iter::Iterator;
1293        self.pronunciations = v.into_iter().map(|i| i.into()).collect();
1294        self
1295    }
1296}
1297
1298impl wkt::message::Message for CustomPronunciations {
1299    fn typename() -> &'static str {
1300        "type.googleapis.com/google.cloud.texttospeech.v1.CustomPronunciations"
1301    }
1302}
1303
1304/// A collection of turns for multi-speaker synthesis.
1305#[derive(Clone, Default, PartialEq)]
1306#[non_exhaustive]
1307pub struct MultiSpeakerMarkup {
1308    /// Required. Speaker turns.
1309    pub turns: std::vec::Vec<crate::model::multi_speaker_markup::Turn>,
1310
1311    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1312}
1313
1314impl MultiSpeakerMarkup {
1315    /// Creates a new default instance.
1316    pub fn new() -> Self {
1317        std::default::Default::default()
1318    }
1319
1320    /// Sets the value of [turns][crate::model::MultiSpeakerMarkup::turns].
1321    ///
1322    /// # Example
1323    /// ```ignore,no_run
1324    /// # use google_cloud_texttospeech_v1::model::MultiSpeakerMarkup;
1325    /// use google_cloud_texttospeech_v1::model::multi_speaker_markup::Turn;
1326    /// let x = MultiSpeakerMarkup::new()
1327    ///     .set_turns([
1328    ///         Turn::default()/* use setters */,
1329    ///         Turn::default()/* use (different) setters */,
1330    ///     ]);
1331    /// ```
1332    pub fn set_turns<T, V>(mut self, v: T) -> Self
1333    where
1334        T: std::iter::IntoIterator<Item = V>,
1335        V: std::convert::Into<crate::model::multi_speaker_markup::Turn>,
1336    {
1337        use std::iter::Iterator;
1338        self.turns = v.into_iter().map(|i| i.into()).collect();
1339        self
1340    }
1341}
1342
1343impl wkt::message::Message for MultiSpeakerMarkup {
1344    fn typename() -> &'static str {
1345        "type.googleapis.com/google.cloud.texttospeech.v1.MultiSpeakerMarkup"
1346    }
1347}
1348
1349/// Defines additional types related to [MultiSpeakerMarkup].
1350pub mod multi_speaker_markup {
1351    #[allow(unused_imports)]
1352    use super::*;
1353
1354    /// A multi-speaker turn.
1355    #[derive(Clone, Default, PartialEq)]
1356    #[non_exhaustive]
1357    pub struct Turn {
1358        /// Required. The speaker of the turn, for example, 'O' or 'Q'. Please refer
1359        /// to documentation for available speakers.
1360        pub speaker: std::string::String,
1361
1362        /// Required. The text to speak.
1363        pub text: std::string::String,
1364
1365        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1366    }
1367
1368    impl Turn {
1369        /// Creates a new default instance.
1370        pub fn new() -> Self {
1371            std::default::Default::default()
1372        }
1373
1374        /// Sets the value of [speaker][crate::model::multi_speaker_markup::Turn::speaker].
1375        ///
1376        /// # Example
1377        /// ```ignore,no_run
1378        /// # use google_cloud_texttospeech_v1::model::multi_speaker_markup::Turn;
1379        /// let x = Turn::new().set_speaker("example");
1380        /// ```
1381        pub fn set_speaker<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1382            self.speaker = v.into();
1383            self
1384        }
1385
1386        /// Sets the value of [text][crate::model::multi_speaker_markup::Turn::text].
1387        ///
1388        /// # Example
1389        /// ```ignore,no_run
1390        /// # use google_cloud_texttospeech_v1::model::multi_speaker_markup::Turn;
1391        /// let x = Turn::new().set_text("example");
1392        /// ```
1393        pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1394            self.text = v.into();
1395            self
1396        }
1397    }
1398
1399    impl wkt::message::Message for Turn {
1400        fn typename() -> &'static str {
1401            "type.googleapis.com/google.cloud.texttospeech.v1.MultiSpeakerMarkup.Turn"
1402        }
1403    }
1404}
1405
1406/// Configuration for a single speaker in a Gemini TTS multi-speaker setup.
1407/// Enables dialogue between two speakers.
1408#[derive(Clone, Default, PartialEq)]
1409#[non_exhaustive]
1410pub struct MultispeakerPrebuiltVoice {
1411    /// Required. The speaker alias of the voice. This is the user-chosen speaker
1412    /// name that is used in the multispeaker text input, such as "Speaker1".
1413    pub speaker_alias: std::string::String,
1414
1415    /// Required. The speaker ID of the voice. See
1416    /// <https://cloud.google.com/text-to-speech/docs/gemini-tts#voice_options>
1417    /// for available values.
1418    pub speaker_id: std::string::String,
1419
1420    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1421}
1422
1423impl MultispeakerPrebuiltVoice {
1424    /// Creates a new default instance.
1425    pub fn new() -> Self {
1426        std::default::Default::default()
1427    }
1428
1429    /// Sets the value of [speaker_alias][crate::model::MultispeakerPrebuiltVoice::speaker_alias].
1430    ///
1431    /// # Example
1432    /// ```ignore,no_run
1433    /// # use google_cloud_texttospeech_v1::model::MultispeakerPrebuiltVoice;
1434    /// let x = MultispeakerPrebuiltVoice::new().set_speaker_alias("example");
1435    /// ```
1436    pub fn set_speaker_alias<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1437        self.speaker_alias = v.into();
1438        self
1439    }
1440
1441    /// Sets the value of [speaker_id][crate::model::MultispeakerPrebuiltVoice::speaker_id].
1442    ///
1443    /// # Example
1444    /// ```ignore,no_run
1445    /// # use google_cloud_texttospeech_v1::model::MultispeakerPrebuiltVoice;
1446    /// let x = MultispeakerPrebuiltVoice::new().set_speaker_id("example");
1447    /// ```
1448    pub fn set_speaker_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1449        self.speaker_id = v.into();
1450        self
1451    }
1452}
1453
1454impl wkt::message::Message for MultispeakerPrebuiltVoice {
1455    fn typename() -> &'static str {
1456        "type.googleapis.com/google.cloud.texttospeech.v1.MultispeakerPrebuiltVoice"
1457    }
1458}
1459
1460/// Configuration for a multi-speaker text-to-speech setup. Enables the use of up
1461/// to two distinct voices in a single synthesis request.
1462#[derive(Clone, Default, PartialEq)]
1463#[non_exhaustive]
1464pub struct MultiSpeakerVoiceConfig {
1465    /// Required. A list of configurations for the voices of the speakers. Exactly
1466    /// two speaker voice configurations must be provided.
1467    pub speaker_voice_configs: std::vec::Vec<crate::model::MultispeakerPrebuiltVoice>,
1468
1469    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1470}
1471
1472impl MultiSpeakerVoiceConfig {
1473    /// Creates a new default instance.
1474    pub fn new() -> Self {
1475        std::default::Default::default()
1476    }
1477
1478    /// Sets the value of [speaker_voice_configs][crate::model::MultiSpeakerVoiceConfig::speaker_voice_configs].
1479    ///
1480    /// # Example
1481    /// ```ignore,no_run
1482    /// # use google_cloud_texttospeech_v1::model::MultiSpeakerVoiceConfig;
1483    /// use google_cloud_texttospeech_v1::model::MultispeakerPrebuiltVoice;
1484    /// let x = MultiSpeakerVoiceConfig::new()
1485    ///     .set_speaker_voice_configs([
1486    ///         MultispeakerPrebuiltVoice::default()/* use setters */,
1487    ///         MultispeakerPrebuiltVoice::default()/* use (different) setters */,
1488    ///     ]);
1489    /// ```
1490    pub fn set_speaker_voice_configs<T, V>(mut self, v: T) -> Self
1491    where
1492        T: std::iter::IntoIterator<Item = V>,
1493        V: std::convert::Into<crate::model::MultispeakerPrebuiltVoice>,
1494    {
1495        use std::iter::Iterator;
1496        self.speaker_voice_configs = v.into_iter().map(|i| i.into()).collect();
1497        self
1498    }
1499}
1500
1501impl wkt::message::Message for MultiSpeakerVoiceConfig {
1502    fn typename() -> &'static str {
1503        "type.googleapis.com/google.cloud.texttospeech.v1.MultiSpeakerVoiceConfig"
1504    }
1505}
1506
1507/// Contains text input to be synthesized. Either `text` or `ssml` must be
1508/// supplied. Supplying both or neither returns
1509/// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. The
1510/// input size is limited to 5000 bytes.
1511#[derive(Clone, Default, PartialEq)]
1512#[non_exhaustive]
1513pub struct SynthesisInput {
1514    /// This system instruction is supported only for controllable/promptable voice
1515    /// models. If this system instruction is used, we pass the unedited text to
1516    /// Gemini-TTS. Otherwise, a default system instruction is used. AI Studio
1517    /// calls this system instruction, Style Instructions.
1518    pub prompt: std::option::Option<std::string::String>,
1519
1520    /// Optional. The pronunciation customizations are applied to the input. If
1521    /// this is set, the input is synthesized using the given pronunciation
1522    /// customizations.
1523    ///
1524    /// The initial support is for en-us, with plans to expand to other locales in
1525    /// the future. Instant Clone voices aren't supported.
1526    ///
1527    /// In order to customize the pronunciation of a phrase, there must be an exact
1528    /// match of the phrase in the input types. If using SSML, the phrase must not
1529    /// be inside a phoneme tag.
1530    pub custom_pronunciations: std::option::Option<crate::model::CustomPronunciations>,
1531
1532    /// The input source, which is either plain text or SSML.
1533    pub input_source: std::option::Option<crate::model::synthesis_input::InputSource>,
1534
1535    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1536}
1537
1538impl SynthesisInput {
1539    /// Creates a new default instance.
1540    pub fn new() -> Self {
1541        std::default::Default::default()
1542    }
1543
1544    /// Sets the value of [prompt][crate::model::SynthesisInput::prompt].
1545    ///
1546    /// # Example
1547    /// ```ignore,no_run
1548    /// # use google_cloud_texttospeech_v1::model::SynthesisInput;
1549    /// let x = SynthesisInput::new().set_prompt("example");
1550    /// ```
1551    pub fn set_prompt<T>(mut self, v: T) -> Self
1552    where
1553        T: std::convert::Into<std::string::String>,
1554    {
1555        self.prompt = std::option::Option::Some(v.into());
1556        self
1557    }
1558
1559    /// Sets or clears the value of [prompt][crate::model::SynthesisInput::prompt].
1560    ///
1561    /// # Example
1562    /// ```ignore,no_run
1563    /// # use google_cloud_texttospeech_v1::model::SynthesisInput;
1564    /// let x = SynthesisInput::new().set_or_clear_prompt(Some("example"));
1565    /// let x = SynthesisInput::new().set_or_clear_prompt(None::<String>);
1566    /// ```
1567    pub fn set_or_clear_prompt<T>(mut self, v: std::option::Option<T>) -> Self
1568    where
1569        T: std::convert::Into<std::string::String>,
1570    {
1571        self.prompt = v.map(|x| x.into());
1572        self
1573    }
1574
1575    /// Sets the value of [custom_pronunciations][crate::model::SynthesisInput::custom_pronunciations].
1576    ///
1577    /// # Example
1578    /// ```ignore,no_run
1579    /// # use google_cloud_texttospeech_v1::model::SynthesisInput;
1580    /// use google_cloud_texttospeech_v1::model::CustomPronunciations;
1581    /// let x = SynthesisInput::new().set_custom_pronunciations(CustomPronunciations::default()/* use setters */);
1582    /// ```
1583    pub fn set_custom_pronunciations<T>(mut self, v: T) -> Self
1584    where
1585        T: std::convert::Into<crate::model::CustomPronunciations>,
1586    {
1587        self.custom_pronunciations = std::option::Option::Some(v.into());
1588        self
1589    }
1590
1591    /// Sets or clears the value of [custom_pronunciations][crate::model::SynthesisInput::custom_pronunciations].
1592    ///
1593    /// # Example
1594    /// ```ignore,no_run
1595    /// # use google_cloud_texttospeech_v1::model::SynthesisInput;
1596    /// use google_cloud_texttospeech_v1::model::CustomPronunciations;
1597    /// let x = SynthesisInput::new().set_or_clear_custom_pronunciations(Some(CustomPronunciations::default()/* use setters */));
1598    /// let x = SynthesisInput::new().set_or_clear_custom_pronunciations(None::<CustomPronunciations>);
1599    /// ```
1600    pub fn set_or_clear_custom_pronunciations<T>(mut self, v: std::option::Option<T>) -> Self
1601    where
1602        T: std::convert::Into<crate::model::CustomPronunciations>,
1603    {
1604        self.custom_pronunciations = v.map(|x| x.into());
1605        self
1606    }
1607
1608    /// Sets the value of [input_source][crate::model::SynthesisInput::input_source].
1609    ///
1610    /// Note that all the setters affecting `input_source` are mutually
1611    /// exclusive.
1612    ///
1613    /// # Example
1614    /// ```ignore,no_run
1615    /// # use google_cloud_texttospeech_v1::model::SynthesisInput;
1616    /// use google_cloud_texttospeech_v1::model::synthesis_input::InputSource;
1617    /// let x = SynthesisInput::new().set_input_source(Some(InputSource::Text("example".to_string())));
1618    /// ```
1619    pub fn set_input_source<
1620        T: std::convert::Into<std::option::Option<crate::model::synthesis_input::InputSource>>,
1621    >(
1622        mut self,
1623        v: T,
1624    ) -> Self {
1625        self.input_source = v.into();
1626        self
1627    }
1628
1629    /// The value of [input_source][crate::model::SynthesisInput::input_source]
1630    /// if it holds a `Text`, `None` if the field is not set or
1631    /// holds a different branch.
1632    pub fn text(&self) -> std::option::Option<&std::string::String> {
1633        #[allow(unreachable_patterns)]
1634        self.input_source.as_ref().and_then(|v| match v {
1635            crate::model::synthesis_input::InputSource::Text(v) => std::option::Option::Some(v),
1636            _ => std::option::Option::None,
1637        })
1638    }
1639
1640    /// Sets the value of [input_source][crate::model::SynthesisInput::input_source]
1641    /// to hold a `Text`.
1642    ///
1643    /// Note that all the setters affecting `input_source` are
1644    /// mutually exclusive.
1645    ///
1646    /// # Example
1647    /// ```ignore,no_run
1648    /// # use google_cloud_texttospeech_v1::model::SynthesisInput;
1649    /// let x = SynthesisInput::new().set_text("example");
1650    /// assert!(x.text().is_some());
1651    /// assert!(x.markup().is_none());
1652    /// assert!(x.ssml().is_none());
1653    /// assert!(x.multi_speaker_markup().is_none());
1654    /// ```
1655    pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1656        self.input_source =
1657            std::option::Option::Some(crate::model::synthesis_input::InputSource::Text(v.into()));
1658        self
1659    }
1660
1661    /// The value of [input_source][crate::model::SynthesisInput::input_source]
1662    /// if it holds a `Markup`, `None` if the field is not set or
1663    /// holds a different branch.
1664    pub fn markup(&self) -> std::option::Option<&std::string::String> {
1665        #[allow(unreachable_patterns)]
1666        self.input_source.as_ref().and_then(|v| match v {
1667            crate::model::synthesis_input::InputSource::Markup(v) => std::option::Option::Some(v),
1668            _ => std::option::Option::None,
1669        })
1670    }
1671
1672    /// Sets the value of [input_source][crate::model::SynthesisInput::input_source]
1673    /// to hold a `Markup`.
1674    ///
1675    /// Note that all the setters affecting `input_source` are
1676    /// mutually exclusive.
1677    ///
1678    /// # Example
1679    /// ```ignore,no_run
1680    /// # use google_cloud_texttospeech_v1::model::SynthesisInput;
1681    /// let x = SynthesisInput::new().set_markup("example");
1682    /// assert!(x.markup().is_some());
1683    /// assert!(x.text().is_none());
1684    /// assert!(x.ssml().is_none());
1685    /// assert!(x.multi_speaker_markup().is_none());
1686    /// ```
1687    pub fn set_markup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1688        self.input_source =
1689            std::option::Option::Some(crate::model::synthesis_input::InputSource::Markup(v.into()));
1690        self
1691    }
1692
1693    /// The value of [input_source][crate::model::SynthesisInput::input_source]
1694    /// if it holds a `Ssml`, `None` if the field is not set or
1695    /// holds a different branch.
1696    pub fn ssml(&self) -> std::option::Option<&std::string::String> {
1697        #[allow(unreachable_patterns)]
1698        self.input_source.as_ref().and_then(|v| match v {
1699            crate::model::synthesis_input::InputSource::Ssml(v) => std::option::Option::Some(v),
1700            _ => std::option::Option::None,
1701        })
1702    }
1703
1704    /// Sets the value of [input_source][crate::model::SynthesisInput::input_source]
1705    /// to hold a `Ssml`.
1706    ///
1707    /// Note that all the setters affecting `input_source` are
1708    /// mutually exclusive.
1709    ///
1710    /// # Example
1711    /// ```ignore,no_run
1712    /// # use google_cloud_texttospeech_v1::model::SynthesisInput;
1713    /// let x = SynthesisInput::new().set_ssml("example");
1714    /// assert!(x.ssml().is_some());
1715    /// assert!(x.text().is_none());
1716    /// assert!(x.markup().is_none());
1717    /// assert!(x.multi_speaker_markup().is_none());
1718    /// ```
1719    pub fn set_ssml<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1720        self.input_source =
1721            std::option::Option::Some(crate::model::synthesis_input::InputSource::Ssml(v.into()));
1722        self
1723    }
1724
1725    /// The value of [input_source][crate::model::SynthesisInput::input_source]
1726    /// if it holds a `MultiSpeakerMarkup`, `None` if the field is not set or
1727    /// holds a different branch.
1728    pub fn multi_speaker_markup(
1729        &self,
1730    ) -> std::option::Option<&std::boxed::Box<crate::model::MultiSpeakerMarkup>> {
1731        #[allow(unreachable_patterns)]
1732        self.input_source.as_ref().and_then(|v| match v {
1733            crate::model::synthesis_input::InputSource::MultiSpeakerMarkup(v) => {
1734                std::option::Option::Some(v)
1735            }
1736            _ => std::option::Option::None,
1737        })
1738    }
1739
1740    /// Sets the value of [input_source][crate::model::SynthesisInput::input_source]
1741    /// to hold a `MultiSpeakerMarkup`.
1742    ///
1743    /// Note that all the setters affecting `input_source` are
1744    /// mutually exclusive.
1745    ///
1746    /// # Example
1747    /// ```ignore,no_run
1748    /// # use google_cloud_texttospeech_v1::model::SynthesisInput;
1749    /// use google_cloud_texttospeech_v1::model::MultiSpeakerMarkup;
1750    /// let x = SynthesisInput::new().set_multi_speaker_markup(MultiSpeakerMarkup::default()/* use setters */);
1751    /// assert!(x.multi_speaker_markup().is_some());
1752    /// assert!(x.text().is_none());
1753    /// assert!(x.markup().is_none());
1754    /// assert!(x.ssml().is_none());
1755    /// ```
1756    pub fn set_multi_speaker_markup<
1757        T: std::convert::Into<std::boxed::Box<crate::model::MultiSpeakerMarkup>>,
1758    >(
1759        mut self,
1760        v: T,
1761    ) -> Self {
1762        self.input_source = std::option::Option::Some(
1763            crate::model::synthesis_input::InputSource::MultiSpeakerMarkup(v.into()),
1764        );
1765        self
1766    }
1767}
1768
1769impl wkt::message::Message for SynthesisInput {
1770    fn typename() -> &'static str {
1771        "type.googleapis.com/google.cloud.texttospeech.v1.SynthesisInput"
1772    }
1773}
1774
1775/// Defines additional types related to [SynthesisInput].
1776pub mod synthesis_input {
1777    #[allow(unused_imports)]
1778    use super::*;
1779
1780    /// The input source, which is either plain text or SSML.
1781    #[derive(Clone, Debug, PartialEq)]
1782    #[non_exhaustive]
1783    pub enum InputSource {
1784        /// The raw text to be synthesized.
1785        Text(std::string::String),
1786        /// Markup for Chirp 3: HD voices specifically. This field may not be used
1787        /// with any other voices.
1788        Markup(std::string::String),
1789        /// The SSML document to be synthesized. The SSML document must be valid
1790        /// and well-formed. Otherwise the RPC will fail and return
1791        /// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For
1792        /// more information, see
1793        /// [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
1794        Ssml(std::string::String),
1795        /// The multi-speaker input to be synthesized. Only applicable for
1796        /// multi-speaker synthesis.
1797        MultiSpeakerMarkup(std::boxed::Box<crate::model::MultiSpeakerMarkup>),
1798    }
1799}
1800
1801/// Description of which voice to use for a synthesis request.
1802#[derive(Clone, Default, PartialEq)]
1803#[non_exhaustive]
1804pub struct VoiceSelectionParams {
1805    /// Required. The language (and potentially also the region) of the voice
1806    /// expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
1807    /// language tag, e.g. "en-US". This should not include a script tag (e.g. use
1808    /// "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred
1809    /// from the input provided in the SynthesisInput.  The TTS service
1810    /// will use this parameter to help choose an appropriate voice.  Note that
1811    /// the TTS service may choose a voice with a slightly different language code
1812    /// than the one selected; it may substitute a different region
1813    /// (e.g. using en-US rather than en-CA if there isn't a Canadian voice
1814    /// available), or even a different language, e.g. using "nb" (Norwegian
1815    /// Bokmal) instead of "no" (Norwegian)".
1816    pub language_code: std::string::String,
1817
1818    /// The name of the voice. If both the name and the gender are not set,
1819    /// the service will choose a voice based on the other parameters such as
1820    /// language_code.
1821    pub name: std::string::String,
1822
1823    /// The preferred gender of the voice. If not set, the service will
1824    /// choose a voice based on the other parameters such as language_code and
1825    /// name. Note that this is only a preference, not requirement; if a
1826    /// voice of the appropriate gender is not available, the synthesizer should
1827    /// substitute a voice with a different gender rather than failing the request.
1828    pub ssml_gender: crate::model::SsmlVoiceGender,
1829
1830    /// The configuration for a custom voice. If [CustomVoiceParams.model] is set,
1831    /// the service will choose the custom voice matching the specified
1832    /// configuration.
1833    pub custom_voice: std::option::Option<crate::model::CustomVoiceParams>,
1834
1835    /// Optional. The configuration for a voice clone. If
1836    /// [VoiceCloneParams.voice_clone_key] is set, the service chooses the voice
1837    /// clone matching the specified configuration.
1838    pub voice_clone: std::option::Option<crate::model::VoiceCloneParams>,
1839
1840    /// Optional. The name of the model. If set, the service will choose the model
1841    /// matching the specified configuration.
1842    pub model_name: std::string::String,
1843
1844    /// Optional. The configuration for a Gemini multi-speaker text-to-speech
1845    /// setup. Enables the use of two distinct voices in a single synthesis
1846    /// request.
1847    pub multi_speaker_voice_config: std::option::Option<crate::model::MultiSpeakerVoiceConfig>,
1848
1849    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1850}
1851
1852impl VoiceSelectionParams {
1853    /// Creates a new default instance.
1854    pub fn new() -> Self {
1855        std::default::Default::default()
1856    }
1857
1858    /// Sets the value of [language_code][crate::model::VoiceSelectionParams::language_code].
1859    ///
1860    /// # Example
1861    /// ```ignore,no_run
1862    /// # use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
1863    /// let x = VoiceSelectionParams::new().set_language_code("example");
1864    /// ```
1865    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1866        self.language_code = v.into();
1867        self
1868    }
1869
1870    /// Sets the value of [name][crate::model::VoiceSelectionParams::name].
1871    ///
1872    /// # Example
1873    /// ```ignore,no_run
1874    /// # use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
1875    /// let x = VoiceSelectionParams::new().set_name("example");
1876    /// ```
1877    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1878        self.name = v.into();
1879        self
1880    }
1881
1882    /// Sets the value of [ssml_gender][crate::model::VoiceSelectionParams::ssml_gender].
1883    ///
1884    /// # Example
1885    /// ```ignore,no_run
1886    /// # use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
1887    /// use google_cloud_texttospeech_v1::model::SsmlVoiceGender;
1888    /// let x0 = VoiceSelectionParams::new().set_ssml_gender(SsmlVoiceGender::Male);
1889    /// let x1 = VoiceSelectionParams::new().set_ssml_gender(SsmlVoiceGender::Female);
1890    /// let x2 = VoiceSelectionParams::new().set_ssml_gender(SsmlVoiceGender::Neutral);
1891    /// ```
1892    pub fn set_ssml_gender<T: std::convert::Into<crate::model::SsmlVoiceGender>>(
1893        mut self,
1894        v: T,
1895    ) -> Self {
1896        self.ssml_gender = v.into();
1897        self
1898    }
1899
1900    /// Sets the value of [custom_voice][crate::model::VoiceSelectionParams::custom_voice].
1901    ///
1902    /// # Example
1903    /// ```ignore,no_run
1904    /// # use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
1905    /// use google_cloud_texttospeech_v1::model::CustomVoiceParams;
1906    /// let x = VoiceSelectionParams::new().set_custom_voice(CustomVoiceParams::default()/* use setters */);
1907    /// ```
1908    pub fn set_custom_voice<T>(mut self, v: T) -> Self
1909    where
1910        T: std::convert::Into<crate::model::CustomVoiceParams>,
1911    {
1912        self.custom_voice = std::option::Option::Some(v.into());
1913        self
1914    }
1915
1916    /// Sets or clears the value of [custom_voice][crate::model::VoiceSelectionParams::custom_voice].
1917    ///
1918    /// # Example
1919    /// ```ignore,no_run
1920    /// # use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
1921    /// use google_cloud_texttospeech_v1::model::CustomVoiceParams;
1922    /// let x = VoiceSelectionParams::new().set_or_clear_custom_voice(Some(CustomVoiceParams::default()/* use setters */));
1923    /// let x = VoiceSelectionParams::new().set_or_clear_custom_voice(None::<CustomVoiceParams>);
1924    /// ```
1925    pub fn set_or_clear_custom_voice<T>(mut self, v: std::option::Option<T>) -> Self
1926    where
1927        T: std::convert::Into<crate::model::CustomVoiceParams>,
1928    {
1929        self.custom_voice = v.map(|x| x.into());
1930        self
1931    }
1932
1933    /// Sets the value of [voice_clone][crate::model::VoiceSelectionParams::voice_clone].
1934    ///
1935    /// # Example
1936    /// ```ignore,no_run
1937    /// # use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
1938    /// use google_cloud_texttospeech_v1::model::VoiceCloneParams;
1939    /// let x = VoiceSelectionParams::new().set_voice_clone(VoiceCloneParams::default()/* use setters */);
1940    /// ```
1941    pub fn set_voice_clone<T>(mut self, v: T) -> Self
1942    where
1943        T: std::convert::Into<crate::model::VoiceCloneParams>,
1944    {
1945        self.voice_clone = std::option::Option::Some(v.into());
1946        self
1947    }
1948
1949    /// Sets or clears the value of [voice_clone][crate::model::VoiceSelectionParams::voice_clone].
1950    ///
1951    /// # Example
1952    /// ```ignore,no_run
1953    /// # use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
1954    /// use google_cloud_texttospeech_v1::model::VoiceCloneParams;
1955    /// let x = VoiceSelectionParams::new().set_or_clear_voice_clone(Some(VoiceCloneParams::default()/* use setters */));
1956    /// let x = VoiceSelectionParams::new().set_or_clear_voice_clone(None::<VoiceCloneParams>);
1957    /// ```
1958    pub fn set_or_clear_voice_clone<T>(mut self, v: std::option::Option<T>) -> Self
1959    where
1960        T: std::convert::Into<crate::model::VoiceCloneParams>,
1961    {
1962        self.voice_clone = v.map(|x| x.into());
1963        self
1964    }
1965
1966    /// Sets the value of [model_name][crate::model::VoiceSelectionParams::model_name].
1967    ///
1968    /// # Example
1969    /// ```ignore,no_run
1970    /// # use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
1971    /// let x = VoiceSelectionParams::new().set_model_name("example");
1972    /// ```
1973    pub fn set_model_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1974        self.model_name = v.into();
1975        self
1976    }
1977
1978    /// Sets the value of [multi_speaker_voice_config][crate::model::VoiceSelectionParams::multi_speaker_voice_config].
1979    ///
1980    /// # Example
1981    /// ```ignore,no_run
1982    /// # use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
1983    /// use google_cloud_texttospeech_v1::model::MultiSpeakerVoiceConfig;
1984    /// let x = VoiceSelectionParams::new().set_multi_speaker_voice_config(MultiSpeakerVoiceConfig::default()/* use setters */);
1985    /// ```
1986    pub fn set_multi_speaker_voice_config<T>(mut self, v: T) -> Self
1987    where
1988        T: std::convert::Into<crate::model::MultiSpeakerVoiceConfig>,
1989    {
1990        self.multi_speaker_voice_config = std::option::Option::Some(v.into());
1991        self
1992    }
1993
1994    /// Sets or clears the value of [multi_speaker_voice_config][crate::model::VoiceSelectionParams::multi_speaker_voice_config].
1995    ///
1996    /// # Example
1997    /// ```ignore,no_run
1998    /// # use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
1999    /// use google_cloud_texttospeech_v1::model::MultiSpeakerVoiceConfig;
2000    /// let x = VoiceSelectionParams::new().set_or_clear_multi_speaker_voice_config(Some(MultiSpeakerVoiceConfig::default()/* use setters */));
2001    /// let x = VoiceSelectionParams::new().set_or_clear_multi_speaker_voice_config(None::<MultiSpeakerVoiceConfig>);
2002    /// ```
2003    pub fn set_or_clear_multi_speaker_voice_config<T>(mut self, v: std::option::Option<T>) -> Self
2004    where
2005        T: std::convert::Into<crate::model::MultiSpeakerVoiceConfig>,
2006    {
2007        self.multi_speaker_voice_config = v.map(|x| x.into());
2008        self
2009    }
2010}
2011
2012impl wkt::message::Message for VoiceSelectionParams {
2013    fn typename() -> &'static str {
2014        "type.googleapis.com/google.cloud.texttospeech.v1.VoiceSelectionParams"
2015    }
2016}
2017
2018/// Description of audio data to be synthesized.
2019#[derive(Clone, Default, PartialEq)]
2020#[non_exhaustive]
2021pub struct AudioConfig {
2022    /// Required. The format of the audio byte stream.
2023    pub audio_encoding: crate::model::AudioEncoding,
2024
2025    /// Optional. Input only. Speaking rate/speed, in the range [0.25, 2.0]. 1.0 is
2026    /// the normal native speed supported by the specific voice. 2.0 is twice as
2027    /// fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0
2028    /// speed. Any other values < 0.25 or > 2.0 will return an error.
2029    pub speaking_rate: f64,
2030
2031    /// Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means
2032    /// increase 20 semitones from the original pitch. -20 means decrease 20
2033    /// semitones from the original pitch.
2034    pub pitch: f64,
2035
2036    /// Optional. Input only. Volume gain (in dB) of the normal native volume
2037    /// supported by the specific voice, in the range [-96.0, 16.0]. If unset, or
2038    /// set to a value of 0.0 (dB), will play at normal native signal amplitude. A
2039    /// value of -6.0 (dB) will play at approximately half the amplitude of the
2040    /// normal native signal amplitude. A value of +6.0 (dB) will play at
2041    /// approximately twice the amplitude of the normal native signal amplitude.
2042    /// Strongly recommend not to exceed +10 (dB) as there's usually no effective
2043    /// increase in loudness for any value greater than that.
2044    pub volume_gain_db: f64,
2045
2046    /// Optional. The synthesis sample rate (in hertz) for this audio. When this is
2047    /// specified in SynthesizeSpeechRequest, if this is different from the voice's
2048    /// natural sample rate, then the synthesizer will honor this request by
2049    /// converting to the desired sample rate (which might result in worse audio
2050    /// quality), unless the specified sample rate is not supported for the
2051    /// encoding chosen, in which case it will fail the request and return
2052    /// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
2053    pub sample_rate_hertz: i32,
2054
2055    /// Optional. Input only. An identifier which selects 'audio effects' profiles
2056    /// that are applied on (post synthesized) text to speech. Effects are applied
2057    /// on top of each other in the order they are given. See
2058    /// [audio
2059    /// profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for
2060    /// current supported profile ids.
2061    pub effects_profile_id: std::vec::Vec<std::string::String>,
2062
2063    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2064}
2065
2066impl AudioConfig {
2067    /// Creates a new default instance.
2068    pub fn new() -> Self {
2069        std::default::Default::default()
2070    }
2071
2072    /// Sets the value of [audio_encoding][crate::model::AudioConfig::audio_encoding].
2073    ///
2074    /// # Example
2075    /// ```ignore,no_run
2076    /// # use google_cloud_texttospeech_v1::model::AudioConfig;
2077    /// use google_cloud_texttospeech_v1::model::AudioEncoding;
2078    /// let x0 = AudioConfig::new().set_audio_encoding(AudioEncoding::Linear16);
2079    /// let x1 = AudioConfig::new().set_audio_encoding(AudioEncoding::Mp3);
2080    /// let x2 = AudioConfig::new().set_audio_encoding(AudioEncoding::OggOpus);
2081    /// ```
2082    pub fn set_audio_encoding<T: std::convert::Into<crate::model::AudioEncoding>>(
2083        mut self,
2084        v: T,
2085    ) -> Self {
2086        self.audio_encoding = v.into();
2087        self
2088    }
2089
2090    /// Sets the value of [speaking_rate][crate::model::AudioConfig::speaking_rate].
2091    ///
2092    /// # Example
2093    /// ```ignore,no_run
2094    /// # use google_cloud_texttospeech_v1::model::AudioConfig;
2095    /// let x = AudioConfig::new().set_speaking_rate(42.0);
2096    /// ```
2097    pub fn set_speaking_rate<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2098        self.speaking_rate = v.into();
2099        self
2100    }
2101
2102    /// Sets the value of [pitch][crate::model::AudioConfig::pitch].
2103    ///
2104    /// # Example
2105    /// ```ignore,no_run
2106    /// # use google_cloud_texttospeech_v1::model::AudioConfig;
2107    /// let x = AudioConfig::new().set_pitch(42.0);
2108    /// ```
2109    pub fn set_pitch<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2110        self.pitch = v.into();
2111        self
2112    }
2113
2114    /// Sets the value of [volume_gain_db][crate::model::AudioConfig::volume_gain_db].
2115    ///
2116    /// # Example
2117    /// ```ignore,no_run
2118    /// # use google_cloud_texttospeech_v1::model::AudioConfig;
2119    /// let x = AudioConfig::new().set_volume_gain_db(42.0);
2120    /// ```
2121    pub fn set_volume_gain_db<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2122        self.volume_gain_db = v.into();
2123        self
2124    }
2125
2126    /// Sets the value of [sample_rate_hertz][crate::model::AudioConfig::sample_rate_hertz].
2127    ///
2128    /// # Example
2129    /// ```ignore,no_run
2130    /// # use google_cloud_texttospeech_v1::model::AudioConfig;
2131    /// let x = AudioConfig::new().set_sample_rate_hertz(42);
2132    /// ```
2133    pub fn set_sample_rate_hertz<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2134        self.sample_rate_hertz = v.into();
2135        self
2136    }
2137
2138    /// Sets the value of [effects_profile_id][crate::model::AudioConfig::effects_profile_id].
2139    ///
2140    /// # Example
2141    /// ```ignore,no_run
2142    /// # use google_cloud_texttospeech_v1::model::AudioConfig;
2143    /// let x = AudioConfig::new().set_effects_profile_id(["a", "b", "c"]);
2144    /// ```
2145    pub fn set_effects_profile_id<T, V>(mut self, v: T) -> Self
2146    where
2147        T: std::iter::IntoIterator<Item = V>,
2148        V: std::convert::Into<std::string::String>,
2149    {
2150        use std::iter::Iterator;
2151        self.effects_profile_id = v.into_iter().map(|i| i.into()).collect();
2152        self
2153    }
2154}
2155
2156impl wkt::message::Message for AudioConfig {
2157    fn typename() -> &'static str {
2158        "type.googleapis.com/google.cloud.texttospeech.v1.AudioConfig"
2159    }
2160}
2161
2162/// Description of the custom voice to be synthesized.
2163#[derive(Clone, Default, PartialEq)]
2164#[non_exhaustive]
2165pub struct CustomVoiceParams {
2166    /// Required. The name of the AutoML model that synthesizes the custom voice.
2167    pub model: std::string::String,
2168
2169    /// Optional. Deprecated. The usage of the synthesized audio to be reported.
2170    #[deprecated]
2171    pub reported_usage: crate::model::custom_voice_params::ReportedUsage,
2172
2173    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2174}
2175
2176impl CustomVoiceParams {
2177    /// Creates a new default instance.
2178    pub fn new() -> Self {
2179        std::default::Default::default()
2180    }
2181
2182    /// Sets the value of [model][crate::model::CustomVoiceParams::model].
2183    ///
2184    /// # Example
2185    /// ```ignore,no_run
2186    /// # use google_cloud_texttospeech_v1::model::CustomVoiceParams;
2187    /// let x = CustomVoiceParams::new().set_model("example");
2188    /// ```
2189    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2190        self.model = v.into();
2191        self
2192    }
2193
2194    /// Sets the value of [reported_usage][crate::model::CustomVoiceParams::reported_usage].
2195    ///
2196    /// # Example
2197    /// ```ignore,no_run
2198    /// # use google_cloud_texttospeech_v1::model::CustomVoiceParams;
2199    /// use google_cloud_texttospeech_v1::model::custom_voice_params::ReportedUsage;
2200    /// let x0 = CustomVoiceParams::new().set_reported_usage(ReportedUsage::Realtime);
2201    /// let x1 = CustomVoiceParams::new().set_reported_usage(ReportedUsage::Offline);
2202    /// ```
2203    #[deprecated]
2204    pub fn set_reported_usage<
2205        T: std::convert::Into<crate::model::custom_voice_params::ReportedUsage>,
2206    >(
2207        mut self,
2208        v: T,
2209    ) -> Self {
2210        self.reported_usage = v.into();
2211        self
2212    }
2213}
2214
2215impl wkt::message::Message for CustomVoiceParams {
2216    fn typename() -> &'static str {
2217        "type.googleapis.com/google.cloud.texttospeech.v1.CustomVoiceParams"
2218    }
2219}
2220
2221/// Defines additional types related to [CustomVoiceParams].
2222pub mod custom_voice_params {
2223    #[allow(unused_imports)]
2224    use super::*;
2225
2226    /// Deprecated. The usage of the synthesized audio. Usage does not affect
2227    /// billing.
2228    ///
2229    /// # Working with unknown values
2230    ///
2231    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2232    /// additional enum variants at any time. Adding new variants is not considered
2233    /// a breaking change. Applications should write their code in anticipation of:
2234    ///
2235    /// - New values appearing in future releases of the client library, **and**
2236    /// - New values received dynamically, without application changes.
2237    ///
2238    /// Please consult the [Working with enums] section in the user guide for some
2239    /// guidelines.
2240    ///
2241    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2242    #[derive(Clone, Debug, PartialEq)]
2243    #[non_exhaustive]
2244    pub enum ReportedUsage {
2245        /// Request with reported usage unspecified will be rejected.
2246        Unspecified,
2247        /// For scenarios where the synthesized audio is not downloadable and can
2248        /// only be used once. For example, real-time request in IVR system.
2249        Realtime,
2250        /// For scenarios where the synthesized audio is downloadable and can be
2251        /// reused. For example, the synthesized audio is downloaded, stored in
2252        /// customer service system and played repeatedly.
2253        Offline,
2254        /// If set, the enum was initialized with an unknown value.
2255        ///
2256        /// Applications can examine the value using [ReportedUsage::value] or
2257        /// [ReportedUsage::name].
2258        UnknownValue(reported_usage::UnknownValue),
2259    }
2260
2261    #[doc(hidden)]
2262    pub mod reported_usage {
2263        #[allow(unused_imports)]
2264        use super::*;
2265        #[derive(Clone, Debug, PartialEq)]
2266        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2267    }
2268
2269    impl ReportedUsage {
2270        /// Gets the enum value.
2271        ///
2272        /// Returns `None` if the enum contains an unknown value deserialized from
2273        /// the string representation of enums.
2274        pub fn value(&self) -> std::option::Option<i32> {
2275            match self {
2276                Self::Unspecified => std::option::Option::Some(0),
2277                Self::Realtime => std::option::Option::Some(1),
2278                Self::Offline => std::option::Option::Some(2),
2279                Self::UnknownValue(u) => u.0.value(),
2280            }
2281        }
2282
2283        /// Gets the enum value as a string.
2284        ///
2285        /// Returns `None` if the enum contains an unknown value deserialized from
2286        /// the integer representation of enums.
2287        pub fn name(&self) -> std::option::Option<&str> {
2288            match self {
2289                Self::Unspecified => std::option::Option::Some("REPORTED_USAGE_UNSPECIFIED"),
2290                Self::Realtime => std::option::Option::Some("REALTIME"),
2291                Self::Offline => std::option::Option::Some("OFFLINE"),
2292                Self::UnknownValue(u) => u.0.name(),
2293            }
2294        }
2295    }
2296
2297    impl std::default::Default for ReportedUsage {
2298        fn default() -> Self {
2299            use std::convert::From;
2300            Self::from(0)
2301        }
2302    }
2303
2304    impl std::fmt::Display for ReportedUsage {
2305        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2306            wkt::internal::display_enum(f, self.name(), self.value())
2307        }
2308    }
2309
2310    impl std::convert::From<i32> for ReportedUsage {
2311        fn from(value: i32) -> Self {
2312            match value {
2313                0 => Self::Unspecified,
2314                1 => Self::Realtime,
2315                2 => Self::Offline,
2316                _ => Self::UnknownValue(reported_usage::UnknownValue(
2317                    wkt::internal::UnknownEnumValue::Integer(value),
2318                )),
2319            }
2320        }
2321    }
2322
2323    impl std::convert::From<&str> for ReportedUsage {
2324        fn from(value: &str) -> Self {
2325            use std::string::ToString;
2326            match value {
2327                "REPORTED_USAGE_UNSPECIFIED" => Self::Unspecified,
2328                "REALTIME" => Self::Realtime,
2329                "OFFLINE" => Self::Offline,
2330                _ => Self::UnknownValue(reported_usage::UnknownValue(
2331                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2332                )),
2333            }
2334        }
2335    }
2336
2337    impl serde::ser::Serialize for ReportedUsage {
2338        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2339        where
2340            S: serde::Serializer,
2341        {
2342            match self {
2343                Self::Unspecified => serializer.serialize_i32(0),
2344                Self::Realtime => serializer.serialize_i32(1),
2345                Self::Offline => serializer.serialize_i32(2),
2346                Self::UnknownValue(u) => u.0.serialize(serializer),
2347            }
2348        }
2349    }
2350
2351    impl<'de> serde::de::Deserialize<'de> for ReportedUsage {
2352        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2353        where
2354            D: serde::Deserializer<'de>,
2355        {
2356            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReportedUsage>::new(
2357                ".google.cloud.texttospeech.v1.CustomVoiceParams.ReportedUsage",
2358            ))
2359        }
2360    }
2361}
2362
2363/// The configuration of Voice Clone feature.
2364#[derive(Clone, Default, PartialEq)]
2365#[non_exhaustive]
2366pub struct VoiceCloneParams {
2367    /// Required. Created by GenerateVoiceCloningKey.
2368    pub voice_cloning_key: std::string::String,
2369
2370    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2371}
2372
2373impl VoiceCloneParams {
2374    /// Creates a new default instance.
2375    pub fn new() -> Self {
2376        std::default::Default::default()
2377    }
2378
2379    /// Sets the value of [voice_cloning_key][crate::model::VoiceCloneParams::voice_cloning_key].
2380    ///
2381    /// # Example
2382    /// ```ignore,no_run
2383    /// # use google_cloud_texttospeech_v1::model::VoiceCloneParams;
2384    /// let x = VoiceCloneParams::new().set_voice_cloning_key("example");
2385    /// ```
2386    pub fn set_voice_cloning_key<T: std::convert::Into<std::string::String>>(
2387        mut self,
2388        v: T,
2389    ) -> Self {
2390        self.voice_cloning_key = v.into();
2391        self
2392    }
2393}
2394
2395impl wkt::message::Message for VoiceCloneParams {
2396    fn typename() -> &'static str {
2397        "type.googleapis.com/google.cloud.texttospeech.v1.VoiceCloneParams"
2398    }
2399}
2400
2401/// The message returned to the client by the `SynthesizeSpeech` method.
2402#[derive(Clone, Default, PartialEq)]
2403#[non_exhaustive]
2404pub struct SynthesizeSpeechResponse {
2405    /// The audio data bytes encoded as specified in the request, including the
2406    /// header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS).
2407    /// For LINEAR16 audio, we include the WAV header. Note: as
2408    /// with all bytes fields, protobuffers use a pure binary representation,
2409    /// whereas JSON representations use base64.
2410    pub audio_content: ::bytes::Bytes,
2411
2412    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2413}
2414
2415impl SynthesizeSpeechResponse {
2416    /// Creates a new default instance.
2417    pub fn new() -> Self {
2418        std::default::Default::default()
2419    }
2420
2421    /// Sets the value of [audio_content][crate::model::SynthesizeSpeechResponse::audio_content].
2422    ///
2423    /// # Example
2424    /// ```ignore,no_run
2425    /// # use google_cloud_texttospeech_v1::model::SynthesizeSpeechResponse;
2426    /// let x = SynthesizeSpeechResponse::new().set_audio_content(bytes::Bytes::from_static(b"example"));
2427    /// ```
2428    pub fn set_audio_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
2429        self.audio_content = v.into();
2430        self
2431    }
2432}
2433
2434impl wkt::message::Message for SynthesizeSpeechResponse {
2435    fn typename() -> &'static str {
2436        "type.googleapis.com/google.cloud.texttospeech.v1.SynthesizeSpeechResponse"
2437    }
2438}
2439
2440/// Description of the desired output audio data.
2441#[derive(Clone, Default, PartialEq)]
2442#[non_exhaustive]
2443pub struct StreamingAudioConfig {
2444    /// Required. The format of the audio byte stream.
2445    /// Streaming supports PCM, ALAW, MULAW and OGG_OPUS. All other encodings
2446    /// return an error.
2447    pub audio_encoding: crate::model::AudioEncoding,
2448
2449    /// Optional. The synthesis sample rate (in hertz) for this audio.
2450    pub sample_rate_hertz: i32,
2451
2452    /// Optional. Input only. Speaking rate/speed, in the range [0.25, 2.0]. 1.0 is
2453    /// the normal native speed supported by the specific voice. 2.0 is twice as
2454    /// fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0
2455    /// speed. Any other values < 0.25 or > 2.0 will return an error.
2456    pub speaking_rate: f64,
2457
2458    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2459}
2460
2461impl StreamingAudioConfig {
2462    /// Creates a new default instance.
2463    pub fn new() -> Self {
2464        std::default::Default::default()
2465    }
2466
2467    /// Sets the value of [audio_encoding][crate::model::StreamingAudioConfig::audio_encoding].
2468    ///
2469    /// # Example
2470    /// ```ignore,no_run
2471    /// # use google_cloud_texttospeech_v1::model::StreamingAudioConfig;
2472    /// use google_cloud_texttospeech_v1::model::AudioEncoding;
2473    /// let x0 = StreamingAudioConfig::new().set_audio_encoding(AudioEncoding::Linear16);
2474    /// let x1 = StreamingAudioConfig::new().set_audio_encoding(AudioEncoding::Mp3);
2475    /// let x2 = StreamingAudioConfig::new().set_audio_encoding(AudioEncoding::OggOpus);
2476    /// ```
2477    pub fn set_audio_encoding<T: std::convert::Into<crate::model::AudioEncoding>>(
2478        mut self,
2479        v: T,
2480    ) -> Self {
2481        self.audio_encoding = v.into();
2482        self
2483    }
2484
2485    /// Sets the value of [sample_rate_hertz][crate::model::StreamingAudioConfig::sample_rate_hertz].
2486    ///
2487    /// # Example
2488    /// ```ignore,no_run
2489    /// # use google_cloud_texttospeech_v1::model::StreamingAudioConfig;
2490    /// let x = StreamingAudioConfig::new().set_sample_rate_hertz(42);
2491    /// ```
2492    pub fn set_sample_rate_hertz<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2493        self.sample_rate_hertz = v.into();
2494        self
2495    }
2496
2497    /// Sets the value of [speaking_rate][crate::model::StreamingAudioConfig::speaking_rate].
2498    ///
2499    /// # Example
2500    /// ```ignore,no_run
2501    /// # use google_cloud_texttospeech_v1::model::StreamingAudioConfig;
2502    /// let x = StreamingAudioConfig::new().set_speaking_rate(42.0);
2503    /// ```
2504    pub fn set_speaking_rate<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2505        self.speaking_rate = v.into();
2506        self
2507    }
2508}
2509
2510impl wkt::message::Message for StreamingAudioConfig {
2511    fn typename() -> &'static str {
2512        "type.googleapis.com/google.cloud.texttospeech.v1.StreamingAudioConfig"
2513    }
2514}
2515
2516/// Provides configuration information for the StreamingSynthesize request.
2517#[derive(Clone, Default, PartialEq)]
2518#[non_exhaustive]
2519pub struct StreamingSynthesizeConfig {
2520    /// Required. The desired voice of the synthesized audio.
2521    pub voice: std::option::Option<crate::model::VoiceSelectionParams>,
2522
2523    /// Optional. The configuration of the synthesized audio.
2524    pub streaming_audio_config: std::option::Option<crate::model::StreamingAudioConfig>,
2525
2526    /// Optional. The pronunciation customizations are applied to the input. If
2527    /// this is set, the input is synthesized using the given pronunciation
2528    /// customizations.
2529    ///
2530    /// The initial support is for en-us, with plans to expand to other locales in
2531    /// the future. Instant Clone voices aren't supported.
2532    ///
2533    /// In order to customize the pronunciation of a phrase, there must be an exact
2534    /// match of the phrase in the input types. If using SSML, the phrase must not
2535    /// be inside a phoneme tag.
2536    pub custom_pronunciations: std::option::Option<crate::model::CustomPronunciations>,
2537
2538    /// Optional. Advanced voice options.
2539    pub advanced_voice_options: std::option::Option<crate::model::AdvancedVoiceOptions>,
2540
2541    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2542}
2543
2544impl StreamingSynthesizeConfig {
2545    /// Creates a new default instance.
2546    pub fn new() -> Self {
2547        std::default::Default::default()
2548    }
2549
2550    /// Sets the value of [voice][crate::model::StreamingSynthesizeConfig::voice].
2551    ///
2552    /// # Example
2553    /// ```ignore,no_run
2554    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesizeConfig;
2555    /// use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
2556    /// let x = StreamingSynthesizeConfig::new().set_voice(VoiceSelectionParams::default()/* use setters */);
2557    /// ```
2558    pub fn set_voice<T>(mut self, v: T) -> Self
2559    where
2560        T: std::convert::Into<crate::model::VoiceSelectionParams>,
2561    {
2562        self.voice = std::option::Option::Some(v.into());
2563        self
2564    }
2565
2566    /// Sets or clears the value of [voice][crate::model::StreamingSynthesizeConfig::voice].
2567    ///
2568    /// # Example
2569    /// ```ignore,no_run
2570    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesizeConfig;
2571    /// use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
2572    /// let x = StreamingSynthesizeConfig::new().set_or_clear_voice(Some(VoiceSelectionParams::default()/* use setters */));
2573    /// let x = StreamingSynthesizeConfig::new().set_or_clear_voice(None::<VoiceSelectionParams>);
2574    /// ```
2575    pub fn set_or_clear_voice<T>(mut self, v: std::option::Option<T>) -> Self
2576    where
2577        T: std::convert::Into<crate::model::VoiceSelectionParams>,
2578    {
2579        self.voice = v.map(|x| x.into());
2580        self
2581    }
2582
2583    /// Sets the value of [streaming_audio_config][crate::model::StreamingSynthesizeConfig::streaming_audio_config].
2584    ///
2585    /// # Example
2586    /// ```ignore,no_run
2587    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesizeConfig;
2588    /// use google_cloud_texttospeech_v1::model::StreamingAudioConfig;
2589    /// let x = StreamingSynthesizeConfig::new().set_streaming_audio_config(StreamingAudioConfig::default()/* use setters */);
2590    /// ```
2591    pub fn set_streaming_audio_config<T>(mut self, v: T) -> Self
2592    where
2593        T: std::convert::Into<crate::model::StreamingAudioConfig>,
2594    {
2595        self.streaming_audio_config = std::option::Option::Some(v.into());
2596        self
2597    }
2598
2599    /// Sets or clears the value of [streaming_audio_config][crate::model::StreamingSynthesizeConfig::streaming_audio_config].
2600    ///
2601    /// # Example
2602    /// ```ignore,no_run
2603    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesizeConfig;
2604    /// use google_cloud_texttospeech_v1::model::StreamingAudioConfig;
2605    /// let x = StreamingSynthesizeConfig::new().set_or_clear_streaming_audio_config(Some(StreamingAudioConfig::default()/* use setters */));
2606    /// let x = StreamingSynthesizeConfig::new().set_or_clear_streaming_audio_config(None::<StreamingAudioConfig>);
2607    /// ```
2608    pub fn set_or_clear_streaming_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
2609    where
2610        T: std::convert::Into<crate::model::StreamingAudioConfig>,
2611    {
2612        self.streaming_audio_config = v.map(|x| x.into());
2613        self
2614    }
2615
2616    /// Sets the value of [custom_pronunciations][crate::model::StreamingSynthesizeConfig::custom_pronunciations].
2617    ///
2618    /// # Example
2619    /// ```ignore,no_run
2620    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesizeConfig;
2621    /// use google_cloud_texttospeech_v1::model::CustomPronunciations;
2622    /// let x = StreamingSynthesizeConfig::new().set_custom_pronunciations(CustomPronunciations::default()/* use setters */);
2623    /// ```
2624    pub fn set_custom_pronunciations<T>(mut self, v: T) -> Self
2625    where
2626        T: std::convert::Into<crate::model::CustomPronunciations>,
2627    {
2628        self.custom_pronunciations = std::option::Option::Some(v.into());
2629        self
2630    }
2631
2632    /// Sets or clears the value of [custom_pronunciations][crate::model::StreamingSynthesizeConfig::custom_pronunciations].
2633    ///
2634    /// # Example
2635    /// ```ignore,no_run
2636    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesizeConfig;
2637    /// use google_cloud_texttospeech_v1::model::CustomPronunciations;
2638    /// let x = StreamingSynthesizeConfig::new().set_or_clear_custom_pronunciations(Some(CustomPronunciations::default()/* use setters */));
2639    /// let x = StreamingSynthesizeConfig::new().set_or_clear_custom_pronunciations(None::<CustomPronunciations>);
2640    /// ```
2641    pub fn set_or_clear_custom_pronunciations<T>(mut self, v: std::option::Option<T>) -> Self
2642    where
2643        T: std::convert::Into<crate::model::CustomPronunciations>,
2644    {
2645        self.custom_pronunciations = v.map(|x| x.into());
2646        self
2647    }
2648
2649    /// Sets the value of [advanced_voice_options][crate::model::StreamingSynthesizeConfig::advanced_voice_options].
2650    ///
2651    /// # Example
2652    /// ```ignore,no_run
2653    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesizeConfig;
2654    /// use google_cloud_texttospeech_v1::model::AdvancedVoiceOptions;
2655    /// let x = StreamingSynthesizeConfig::new().set_advanced_voice_options(AdvancedVoiceOptions::default()/* use setters */);
2656    /// ```
2657    pub fn set_advanced_voice_options<T>(mut self, v: T) -> Self
2658    where
2659        T: std::convert::Into<crate::model::AdvancedVoiceOptions>,
2660    {
2661        self.advanced_voice_options = std::option::Option::Some(v.into());
2662        self
2663    }
2664
2665    /// Sets or clears the value of [advanced_voice_options][crate::model::StreamingSynthesizeConfig::advanced_voice_options].
2666    ///
2667    /// # Example
2668    /// ```ignore,no_run
2669    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesizeConfig;
2670    /// use google_cloud_texttospeech_v1::model::AdvancedVoiceOptions;
2671    /// let x = StreamingSynthesizeConfig::new().set_or_clear_advanced_voice_options(Some(AdvancedVoiceOptions::default()/* use setters */));
2672    /// let x = StreamingSynthesizeConfig::new().set_or_clear_advanced_voice_options(None::<AdvancedVoiceOptions>);
2673    /// ```
2674    pub fn set_or_clear_advanced_voice_options<T>(mut self, v: std::option::Option<T>) -> Self
2675    where
2676        T: std::convert::Into<crate::model::AdvancedVoiceOptions>,
2677    {
2678        self.advanced_voice_options = v.map(|x| x.into());
2679        self
2680    }
2681}
2682
2683impl wkt::message::Message for StreamingSynthesizeConfig {
2684    fn typename() -> &'static str {
2685        "type.googleapis.com/google.cloud.texttospeech.v1.StreamingSynthesizeConfig"
2686    }
2687}
2688
2689/// Input to be synthesized.
2690#[derive(Clone, Default, PartialEq)]
2691#[non_exhaustive]
2692pub struct StreamingSynthesisInput {
2693    /// This is system instruction supported only for controllable voice models.
2694    pub prompt: std::option::Option<std::string::String>,
2695
2696    #[allow(missing_docs)]
2697    pub input_source: std::option::Option<crate::model::streaming_synthesis_input::InputSource>,
2698
2699    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2700}
2701
2702impl StreamingSynthesisInput {
2703    /// Creates a new default instance.
2704    pub fn new() -> Self {
2705        std::default::Default::default()
2706    }
2707
2708    /// Sets the value of [prompt][crate::model::StreamingSynthesisInput::prompt].
2709    ///
2710    /// # Example
2711    /// ```ignore,no_run
2712    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesisInput;
2713    /// let x = StreamingSynthesisInput::new().set_prompt("example");
2714    /// ```
2715    pub fn set_prompt<T>(mut self, v: T) -> Self
2716    where
2717        T: std::convert::Into<std::string::String>,
2718    {
2719        self.prompt = std::option::Option::Some(v.into());
2720        self
2721    }
2722
2723    /// Sets or clears the value of [prompt][crate::model::StreamingSynthesisInput::prompt].
2724    ///
2725    /// # Example
2726    /// ```ignore,no_run
2727    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesisInput;
2728    /// let x = StreamingSynthesisInput::new().set_or_clear_prompt(Some("example"));
2729    /// let x = StreamingSynthesisInput::new().set_or_clear_prompt(None::<String>);
2730    /// ```
2731    pub fn set_or_clear_prompt<T>(mut self, v: std::option::Option<T>) -> Self
2732    where
2733        T: std::convert::Into<std::string::String>,
2734    {
2735        self.prompt = v.map(|x| x.into());
2736        self
2737    }
2738
2739    /// Sets the value of [input_source][crate::model::StreamingSynthesisInput::input_source].
2740    ///
2741    /// Note that all the setters affecting `input_source` are mutually
2742    /// exclusive.
2743    ///
2744    /// # Example
2745    /// ```ignore,no_run
2746    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesisInput;
2747    /// use google_cloud_texttospeech_v1::model::streaming_synthesis_input::InputSource;
2748    /// let x = StreamingSynthesisInput::new().set_input_source(Some(InputSource::Text("example".to_string())));
2749    /// ```
2750    pub fn set_input_source<
2751        T: std::convert::Into<
2752                std::option::Option<crate::model::streaming_synthesis_input::InputSource>,
2753            >,
2754    >(
2755        mut self,
2756        v: T,
2757    ) -> Self {
2758        self.input_source = v.into();
2759        self
2760    }
2761
2762    /// The value of [input_source][crate::model::StreamingSynthesisInput::input_source]
2763    /// if it holds a `Text`, `None` if the field is not set or
2764    /// holds a different branch.
2765    pub fn text(&self) -> std::option::Option<&std::string::String> {
2766        #[allow(unreachable_patterns)]
2767        self.input_source.as_ref().and_then(|v| match v {
2768            crate::model::streaming_synthesis_input::InputSource::Text(v) => {
2769                std::option::Option::Some(v)
2770            }
2771            _ => std::option::Option::None,
2772        })
2773    }
2774
2775    /// Sets the value of [input_source][crate::model::StreamingSynthesisInput::input_source]
2776    /// to hold a `Text`.
2777    ///
2778    /// Note that all the setters affecting `input_source` are
2779    /// mutually exclusive.
2780    ///
2781    /// # Example
2782    /// ```ignore,no_run
2783    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesisInput;
2784    /// let x = StreamingSynthesisInput::new().set_text("example");
2785    /// assert!(x.text().is_some());
2786    /// assert!(x.markup().is_none());
2787    /// assert!(x.multi_speaker_markup().is_none());
2788    /// ```
2789    pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2790        self.input_source = std::option::Option::Some(
2791            crate::model::streaming_synthesis_input::InputSource::Text(v.into()),
2792        );
2793        self
2794    }
2795
2796    /// The value of [input_source][crate::model::StreamingSynthesisInput::input_source]
2797    /// if it holds a `Markup`, `None` if the field is not set or
2798    /// holds a different branch.
2799    pub fn markup(&self) -> std::option::Option<&std::string::String> {
2800        #[allow(unreachable_patterns)]
2801        self.input_source.as_ref().and_then(|v| match v {
2802            crate::model::streaming_synthesis_input::InputSource::Markup(v) => {
2803                std::option::Option::Some(v)
2804            }
2805            _ => std::option::Option::None,
2806        })
2807    }
2808
2809    /// Sets the value of [input_source][crate::model::StreamingSynthesisInput::input_source]
2810    /// to hold a `Markup`.
2811    ///
2812    /// Note that all the setters affecting `input_source` are
2813    /// mutually exclusive.
2814    ///
2815    /// # Example
2816    /// ```ignore,no_run
2817    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesisInput;
2818    /// let x = StreamingSynthesisInput::new().set_markup("example");
2819    /// assert!(x.markup().is_some());
2820    /// assert!(x.text().is_none());
2821    /// assert!(x.multi_speaker_markup().is_none());
2822    /// ```
2823    pub fn set_markup<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2824        self.input_source = std::option::Option::Some(
2825            crate::model::streaming_synthesis_input::InputSource::Markup(v.into()),
2826        );
2827        self
2828    }
2829
2830    /// The value of [input_source][crate::model::StreamingSynthesisInput::input_source]
2831    /// if it holds a `MultiSpeakerMarkup`, `None` if the field is not set or
2832    /// holds a different branch.
2833    pub fn multi_speaker_markup(
2834        &self,
2835    ) -> std::option::Option<&std::boxed::Box<crate::model::MultiSpeakerMarkup>> {
2836        #[allow(unreachable_patterns)]
2837        self.input_source.as_ref().and_then(|v| match v {
2838            crate::model::streaming_synthesis_input::InputSource::MultiSpeakerMarkup(v) => {
2839                std::option::Option::Some(v)
2840            }
2841            _ => std::option::Option::None,
2842        })
2843    }
2844
2845    /// Sets the value of [input_source][crate::model::StreamingSynthesisInput::input_source]
2846    /// to hold a `MultiSpeakerMarkup`.
2847    ///
2848    /// Note that all the setters affecting `input_source` are
2849    /// mutually exclusive.
2850    ///
2851    /// # Example
2852    /// ```ignore,no_run
2853    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesisInput;
2854    /// use google_cloud_texttospeech_v1::model::MultiSpeakerMarkup;
2855    /// let x = StreamingSynthesisInput::new().set_multi_speaker_markup(MultiSpeakerMarkup::default()/* use setters */);
2856    /// assert!(x.multi_speaker_markup().is_some());
2857    /// assert!(x.text().is_none());
2858    /// assert!(x.markup().is_none());
2859    /// ```
2860    pub fn set_multi_speaker_markup<
2861        T: std::convert::Into<std::boxed::Box<crate::model::MultiSpeakerMarkup>>,
2862    >(
2863        mut self,
2864        v: T,
2865    ) -> Self {
2866        self.input_source = std::option::Option::Some(
2867            crate::model::streaming_synthesis_input::InputSource::MultiSpeakerMarkup(v.into()),
2868        );
2869        self
2870    }
2871}
2872
2873impl wkt::message::Message for StreamingSynthesisInput {
2874    fn typename() -> &'static str {
2875        "type.googleapis.com/google.cloud.texttospeech.v1.StreamingSynthesisInput"
2876    }
2877}
2878
2879/// Defines additional types related to [StreamingSynthesisInput].
2880pub mod streaming_synthesis_input {
2881    #[allow(unused_imports)]
2882    use super::*;
2883
2884    #[allow(missing_docs)]
2885    #[derive(Clone, Debug, PartialEq)]
2886    #[non_exhaustive]
2887    pub enum InputSource {
2888        /// The raw text to be synthesized. It is recommended that each input
2889        /// contains complete, terminating sentences, which results in better prosody
2890        /// in the output audio.
2891        Text(std::string::String),
2892        /// Markup for Chirp 3: HD voices specifically. This field may not be used
2893        /// with any other voices.
2894        Markup(std::string::String),
2895        /// Multi-speaker markup for Gemini TTS. This field may not
2896        /// be used with any other voices.
2897        MultiSpeakerMarkup(std::boxed::Box<crate::model::MultiSpeakerMarkup>),
2898    }
2899}
2900
2901/// Request message for the `StreamingSynthesize` method. Multiple
2902/// `StreamingSynthesizeRequest` messages are sent in one call.
2903/// The first message must contain a `streaming_config` that
2904/// fully specifies the request configuration and must not contain `input`. All
2905/// subsequent messages must only have `input` set.
2906#[derive(Clone, Default, PartialEq)]
2907#[non_exhaustive]
2908pub struct StreamingSynthesizeRequest {
2909    /// The request to be sent, either a StreamingSynthesizeConfig or
2910    /// StreamingSynthesisInput.
2911    pub streaming_request:
2912        std::option::Option<crate::model::streaming_synthesize_request::StreamingRequest>,
2913
2914    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2915}
2916
2917impl StreamingSynthesizeRequest {
2918    /// Creates a new default instance.
2919    pub fn new() -> Self {
2920        std::default::Default::default()
2921    }
2922
2923    /// Sets the value of [streaming_request][crate::model::StreamingSynthesizeRequest::streaming_request].
2924    ///
2925    /// Note that all the setters affecting `streaming_request` are mutually
2926    /// exclusive.
2927    ///
2928    /// # Example
2929    /// ```ignore,no_run
2930    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesizeRequest;
2931    /// use google_cloud_texttospeech_v1::model::StreamingSynthesizeConfig;
2932    /// let x = StreamingSynthesizeRequest::new().set_streaming_request(Some(
2933    ///     google_cloud_texttospeech_v1::model::streaming_synthesize_request::StreamingRequest::StreamingConfig(StreamingSynthesizeConfig::default().into())));
2934    /// ```
2935    pub fn set_streaming_request<
2936        T: std::convert::Into<
2937                std::option::Option<crate::model::streaming_synthesize_request::StreamingRequest>,
2938            >,
2939    >(
2940        mut self,
2941        v: T,
2942    ) -> Self {
2943        self.streaming_request = v.into();
2944        self
2945    }
2946
2947    /// The value of [streaming_request][crate::model::StreamingSynthesizeRequest::streaming_request]
2948    /// if it holds a `StreamingConfig`, `None` if the field is not set or
2949    /// holds a different branch.
2950    pub fn streaming_config(
2951        &self,
2952    ) -> std::option::Option<&std::boxed::Box<crate::model::StreamingSynthesizeConfig>> {
2953        #[allow(unreachable_patterns)]
2954        self.streaming_request.as_ref().and_then(|v| match v {
2955            crate::model::streaming_synthesize_request::StreamingRequest::StreamingConfig(v) => {
2956                std::option::Option::Some(v)
2957            }
2958            _ => std::option::Option::None,
2959        })
2960    }
2961
2962    /// Sets the value of [streaming_request][crate::model::StreamingSynthesizeRequest::streaming_request]
2963    /// to hold a `StreamingConfig`.
2964    ///
2965    /// Note that all the setters affecting `streaming_request` are
2966    /// mutually exclusive.
2967    ///
2968    /// # Example
2969    /// ```ignore,no_run
2970    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesizeRequest;
2971    /// use google_cloud_texttospeech_v1::model::StreamingSynthesizeConfig;
2972    /// let x = StreamingSynthesizeRequest::new().set_streaming_config(StreamingSynthesizeConfig::default()/* use setters */);
2973    /// assert!(x.streaming_config().is_some());
2974    /// assert!(x.input().is_none());
2975    /// ```
2976    pub fn set_streaming_config<
2977        T: std::convert::Into<std::boxed::Box<crate::model::StreamingSynthesizeConfig>>,
2978    >(
2979        mut self,
2980        v: T,
2981    ) -> Self {
2982        self.streaming_request = std::option::Option::Some(
2983            crate::model::streaming_synthesize_request::StreamingRequest::StreamingConfig(v.into()),
2984        );
2985        self
2986    }
2987
2988    /// The value of [streaming_request][crate::model::StreamingSynthesizeRequest::streaming_request]
2989    /// if it holds a `Input`, `None` if the field is not set or
2990    /// holds a different branch.
2991    pub fn input(
2992        &self,
2993    ) -> std::option::Option<&std::boxed::Box<crate::model::StreamingSynthesisInput>> {
2994        #[allow(unreachable_patterns)]
2995        self.streaming_request.as_ref().and_then(|v| match v {
2996            crate::model::streaming_synthesize_request::StreamingRequest::Input(v) => {
2997                std::option::Option::Some(v)
2998            }
2999            _ => std::option::Option::None,
3000        })
3001    }
3002
3003    /// Sets the value of [streaming_request][crate::model::StreamingSynthesizeRequest::streaming_request]
3004    /// to hold a `Input`.
3005    ///
3006    /// Note that all the setters affecting `streaming_request` are
3007    /// mutually exclusive.
3008    ///
3009    /// # Example
3010    /// ```ignore,no_run
3011    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesizeRequest;
3012    /// use google_cloud_texttospeech_v1::model::StreamingSynthesisInput;
3013    /// let x = StreamingSynthesizeRequest::new().set_input(StreamingSynthesisInput::default()/* use setters */);
3014    /// assert!(x.input().is_some());
3015    /// assert!(x.streaming_config().is_none());
3016    /// ```
3017    pub fn set_input<
3018        T: std::convert::Into<std::boxed::Box<crate::model::StreamingSynthesisInput>>,
3019    >(
3020        mut self,
3021        v: T,
3022    ) -> Self {
3023        self.streaming_request = std::option::Option::Some(
3024            crate::model::streaming_synthesize_request::StreamingRequest::Input(v.into()),
3025        );
3026        self
3027    }
3028}
3029
3030impl wkt::message::Message for StreamingSynthesizeRequest {
3031    fn typename() -> &'static str {
3032        "type.googleapis.com/google.cloud.texttospeech.v1.StreamingSynthesizeRequest"
3033    }
3034}
3035
3036/// Defines additional types related to [StreamingSynthesizeRequest].
3037pub mod streaming_synthesize_request {
3038    #[allow(unused_imports)]
3039    use super::*;
3040
3041    /// The request to be sent, either a StreamingSynthesizeConfig or
3042    /// StreamingSynthesisInput.
3043    #[derive(Clone, Debug, PartialEq)]
3044    #[non_exhaustive]
3045    pub enum StreamingRequest {
3046        /// StreamingSynthesizeConfig to be used in this streaming attempt. Only
3047        /// specified in the first message sent in a `StreamingSynthesize` call.
3048        StreamingConfig(std::boxed::Box<crate::model::StreamingSynthesizeConfig>),
3049        /// Input to synthesize. Specified in all messages but the first in a
3050        /// `StreamingSynthesize` call.
3051        Input(std::boxed::Box<crate::model::StreamingSynthesisInput>),
3052    }
3053}
3054
3055/// `StreamingSynthesizeResponse` is the only message returned to the
3056/// client by `StreamingSynthesize` method. A series of zero or more
3057/// `StreamingSynthesizeResponse` messages are streamed back to the client.
3058#[derive(Clone, Default, PartialEq)]
3059#[non_exhaustive]
3060pub struct StreamingSynthesizeResponse {
3061    /// The audio data bytes encoded as specified in the request. This is
3062    /// headerless LINEAR16 audio with a sample rate of 24000.
3063    pub audio_content: ::bytes::Bytes,
3064
3065    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3066}
3067
3068impl StreamingSynthesizeResponse {
3069    /// Creates a new default instance.
3070    pub fn new() -> Self {
3071        std::default::Default::default()
3072    }
3073
3074    /// Sets the value of [audio_content][crate::model::StreamingSynthesizeResponse::audio_content].
3075    ///
3076    /// # Example
3077    /// ```ignore,no_run
3078    /// # use google_cloud_texttospeech_v1::model::StreamingSynthesizeResponse;
3079    /// let x = StreamingSynthesizeResponse::new().set_audio_content(bytes::Bytes::from_static(b"example"));
3080    /// ```
3081    pub fn set_audio_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
3082        self.audio_content = v.into();
3083        self
3084    }
3085}
3086
3087impl wkt::message::Message for StreamingSynthesizeResponse {
3088    fn typename() -> &'static str {
3089        "type.googleapis.com/google.cloud.texttospeech.v1.StreamingSynthesizeResponse"
3090    }
3091}
3092
3093/// The top-level message sent by the client for the
3094/// `SynthesizeLongAudio` method.
3095#[derive(Clone, Default, PartialEq)]
3096#[non_exhaustive]
3097pub struct SynthesizeLongAudioRequest {
3098    /// The resource states of the request in the form of
3099    /// `projects/*/locations/*`.
3100    pub parent: std::string::String,
3101
3102    /// Required. The Synthesizer requires either plain text or SSML as input.
3103    pub input: std::option::Option<crate::model::SynthesisInput>,
3104
3105    /// Required. The configuration of the synthesized audio.
3106    pub audio_config: std::option::Option<crate::model::AudioConfig>,
3107
3108    /// Required. Specifies a Cloud Storage URI for the synthesis results. Must be
3109    /// specified in the format: `gs://bucket_name/object_name`, and the bucket
3110    /// must already exist.
3111    pub output_gcs_uri: std::string::String,
3112
3113    /// Required. The desired voice of the synthesized audio.
3114    pub voice: std::option::Option<crate::model::VoiceSelectionParams>,
3115
3116    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3117}
3118
3119impl SynthesizeLongAudioRequest {
3120    /// Creates a new default instance.
3121    pub fn new() -> Self {
3122        std::default::Default::default()
3123    }
3124
3125    /// Sets the value of [parent][crate::model::SynthesizeLongAudioRequest::parent].
3126    ///
3127    /// # Example
3128    /// ```ignore,no_run
3129    /// # use google_cloud_texttospeech_v1::model::SynthesizeLongAudioRequest;
3130    /// let x = SynthesizeLongAudioRequest::new().set_parent("example");
3131    /// ```
3132    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3133        self.parent = v.into();
3134        self
3135    }
3136
3137    /// Sets the value of [input][crate::model::SynthesizeLongAudioRequest::input].
3138    ///
3139    /// # Example
3140    /// ```ignore,no_run
3141    /// # use google_cloud_texttospeech_v1::model::SynthesizeLongAudioRequest;
3142    /// use google_cloud_texttospeech_v1::model::SynthesisInput;
3143    /// let x = SynthesizeLongAudioRequest::new().set_input(SynthesisInput::default()/* use setters */);
3144    /// ```
3145    pub fn set_input<T>(mut self, v: T) -> Self
3146    where
3147        T: std::convert::Into<crate::model::SynthesisInput>,
3148    {
3149        self.input = std::option::Option::Some(v.into());
3150        self
3151    }
3152
3153    /// Sets or clears the value of [input][crate::model::SynthesizeLongAudioRequest::input].
3154    ///
3155    /// # Example
3156    /// ```ignore,no_run
3157    /// # use google_cloud_texttospeech_v1::model::SynthesizeLongAudioRequest;
3158    /// use google_cloud_texttospeech_v1::model::SynthesisInput;
3159    /// let x = SynthesizeLongAudioRequest::new().set_or_clear_input(Some(SynthesisInput::default()/* use setters */));
3160    /// let x = SynthesizeLongAudioRequest::new().set_or_clear_input(None::<SynthesisInput>);
3161    /// ```
3162    pub fn set_or_clear_input<T>(mut self, v: std::option::Option<T>) -> Self
3163    where
3164        T: std::convert::Into<crate::model::SynthesisInput>,
3165    {
3166        self.input = v.map(|x| x.into());
3167        self
3168    }
3169
3170    /// Sets the value of [audio_config][crate::model::SynthesizeLongAudioRequest::audio_config].
3171    ///
3172    /// # Example
3173    /// ```ignore,no_run
3174    /// # use google_cloud_texttospeech_v1::model::SynthesizeLongAudioRequest;
3175    /// use google_cloud_texttospeech_v1::model::AudioConfig;
3176    /// let x = SynthesizeLongAudioRequest::new().set_audio_config(AudioConfig::default()/* use setters */);
3177    /// ```
3178    pub fn set_audio_config<T>(mut self, v: T) -> Self
3179    where
3180        T: std::convert::Into<crate::model::AudioConfig>,
3181    {
3182        self.audio_config = std::option::Option::Some(v.into());
3183        self
3184    }
3185
3186    /// Sets or clears the value of [audio_config][crate::model::SynthesizeLongAudioRequest::audio_config].
3187    ///
3188    /// # Example
3189    /// ```ignore,no_run
3190    /// # use google_cloud_texttospeech_v1::model::SynthesizeLongAudioRequest;
3191    /// use google_cloud_texttospeech_v1::model::AudioConfig;
3192    /// let x = SynthesizeLongAudioRequest::new().set_or_clear_audio_config(Some(AudioConfig::default()/* use setters */));
3193    /// let x = SynthesizeLongAudioRequest::new().set_or_clear_audio_config(None::<AudioConfig>);
3194    /// ```
3195    pub fn set_or_clear_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
3196    where
3197        T: std::convert::Into<crate::model::AudioConfig>,
3198    {
3199        self.audio_config = v.map(|x| x.into());
3200        self
3201    }
3202
3203    /// Sets the value of [output_gcs_uri][crate::model::SynthesizeLongAudioRequest::output_gcs_uri].
3204    ///
3205    /// # Example
3206    /// ```ignore,no_run
3207    /// # use google_cloud_texttospeech_v1::model::SynthesizeLongAudioRequest;
3208    /// let x = SynthesizeLongAudioRequest::new().set_output_gcs_uri("example");
3209    /// ```
3210    pub fn set_output_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3211        self.output_gcs_uri = v.into();
3212        self
3213    }
3214
3215    /// Sets the value of [voice][crate::model::SynthesizeLongAudioRequest::voice].
3216    ///
3217    /// # Example
3218    /// ```ignore,no_run
3219    /// # use google_cloud_texttospeech_v1::model::SynthesizeLongAudioRequest;
3220    /// use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
3221    /// let x = SynthesizeLongAudioRequest::new().set_voice(VoiceSelectionParams::default()/* use setters */);
3222    /// ```
3223    pub fn set_voice<T>(mut self, v: T) -> Self
3224    where
3225        T: std::convert::Into<crate::model::VoiceSelectionParams>,
3226    {
3227        self.voice = std::option::Option::Some(v.into());
3228        self
3229    }
3230
3231    /// Sets or clears the value of [voice][crate::model::SynthesizeLongAudioRequest::voice].
3232    ///
3233    /// # Example
3234    /// ```ignore,no_run
3235    /// # use google_cloud_texttospeech_v1::model::SynthesizeLongAudioRequest;
3236    /// use google_cloud_texttospeech_v1::model::VoiceSelectionParams;
3237    /// let x = SynthesizeLongAudioRequest::new().set_or_clear_voice(Some(VoiceSelectionParams::default()/* use setters */));
3238    /// let x = SynthesizeLongAudioRequest::new().set_or_clear_voice(None::<VoiceSelectionParams>);
3239    /// ```
3240    pub fn set_or_clear_voice<T>(mut self, v: std::option::Option<T>) -> Self
3241    where
3242        T: std::convert::Into<crate::model::VoiceSelectionParams>,
3243    {
3244        self.voice = v.map(|x| x.into());
3245        self
3246    }
3247}
3248
3249impl wkt::message::Message for SynthesizeLongAudioRequest {
3250    fn typename() -> &'static str {
3251        "type.googleapis.com/google.cloud.texttospeech.v1.SynthesizeLongAudioRequest"
3252    }
3253}
3254
3255/// The message returned to the client by the `SynthesizeLongAudio` method.
3256#[derive(Clone, Default, PartialEq)]
3257#[non_exhaustive]
3258pub struct SynthesizeLongAudioResponse {
3259    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3260}
3261
3262impl SynthesizeLongAudioResponse {
3263    /// Creates a new default instance.
3264    pub fn new() -> Self {
3265        std::default::Default::default()
3266    }
3267}
3268
3269impl wkt::message::Message for SynthesizeLongAudioResponse {
3270    fn typename() -> &'static str {
3271        "type.googleapis.com/google.cloud.texttospeech.v1.SynthesizeLongAudioResponse"
3272    }
3273}
3274
3275/// Metadata for response returned by the `SynthesizeLongAudio` method.
3276#[derive(Clone, Default, PartialEq)]
3277#[non_exhaustive]
3278pub struct SynthesizeLongAudioMetadata {
3279    /// Time when the request was received.
3280    pub start_time: std::option::Option<wkt::Timestamp>,
3281
3282    /// Deprecated. Do not use.
3283    #[deprecated]
3284    pub last_update_time: std::option::Option<wkt::Timestamp>,
3285
3286    /// The progress of the most recent processing update in percentage, ie. 70.0%.
3287    pub progress_percentage: f64,
3288
3289    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3290}
3291
3292impl SynthesizeLongAudioMetadata {
3293    /// Creates a new default instance.
3294    pub fn new() -> Self {
3295        std::default::Default::default()
3296    }
3297
3298    /// Sets the value of [start_time][crate::model::SynthesizeLongAudioMetadata::start_time].
3299    ///
3300    /// # Example
3301    /// ```ignore,no_run
3302    /// # use google_cloud_texttospeech_v1::model::SynthesizeLongAudioMetadata;
3303    /// use wkt::Timestamp;
3304    /// let x = SynthesizeLongAudioMetadata::new().set_start_time(Timestamp::default()/* use setters */);
3305    /// ```
3306    pub fn set_start_time<T>(mut self, v: T) -> Self
3307    where
3308        T: std::convert::Into<wkt::Timestamp>,
3309    {
3310        self.start_time = std::option::Option::Some(v.into());
3311        self
3312    }
3313
3314    /// Sets or clears the value of [start_time][crate::model::SynthesizeLongAudioMetadata::start_time].
3315    ///
3316    /// # Example
3317    /// ```ignore,no_run
3318    /// # use google_cloud_texttospeech_v1::model::SynthesizeLongAudioMetadata;
3319    /// use wkt::Timestamp;
3320    /// let x = SynthesizeLongAudioMetadata::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3321    /// let x = SynthesizeLongAudioMetadata::new().set_or_clear_start_time(None::<Timestamp>);
3322    /// ```
3323    pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3324    where
3325        T: std::convert::Into<wkt::Timestamp>,
3326    {
3327        self.start_time = v.map(|x| x.into());
3328        self
3329    }
3330
3331    /// Sets the value of [last_update_time][crate::model::SynthesizeLongAudioMetadata::last_update_time].
3332    ///
3333    /// # Example
3334    /// ```ignore,no_run
3335    /// # use google_cloud_texttospeech_v1::model::SynthesizeLongAudioMetadata;
3336    /// use wkt::Timestamp;
3337    /// let x = SynthesizeLongAudioMetadata::new().set_last_update_time(Timestamp::default()/* use setters */);
3338    /// ```
3339    #[deprecated]
3340    pub fn set_last_update_time<T>(mut self, v: T) -> Self
3341    where
3342        T: std::convert::Into<wkt::Timestamp>,
3343    {
3344        self.last_update_time = std::option::Option::Some(v.into());
3345        self
3346    }
3347
3348    /// Sets or clears the value of [last_update_time][crate::model::SynthesizeLongAudioMetadata::last_update_time].
3349    ///
3350    /// # Example
3351    /// ```ignore,no_run
3352    /// # use google_cloud_texttospeech_v1::model::SynthesizeLongAudioMetadata;
3353    /// use wkt::Timestamp;
3354    /// let x = SynthesizeLongAudioMetadata::new().set_or_clear_last_update_time(Some(Timestamp::default()/* use setters */));
3355    /// let x = SynthesizeLongAudioMetadata::new().set_or_clear_last_update_time(None::<Timestamp>);
3356    /// ```
3357    #[deprecated]
3358    pub fn set_or_clear_last_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3359    where
3360        T: std::convert::Into<wkt::Timestamp>,
3361    {
3362        self.last_update_time = v.map(|x| x.into());
3363        self
3364    }
3365
3366    /// Sets the value of [progress_percentage][crate::model::SynthesizeLongAudioMetadata::progress_percentage].
3367    ///
3368    /// # Example
3369    /// ```ignore,no_run
3370    /// # use google_cloud_texttospeech_v1::model::SynthesizeLongAudioMetadata;
3371    /// let x = SynthesizeLongAudioMetadata::new().set_progress_percentage(42.0);
3372    /// ```
3373    pub fn set_progress_percentage<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3374        self.progress_percentage = v.into();
3375        self
3376    }
3377}
3378
3379impl wkt::message::Message for SynthesizeLongAudioMetadata {
3380    fn typename() -> &'static str {
3381        "type.googleapis.com/google.cloud.texttospeech.v1.SynthesizeLongAudioMetadata"
3382    }
3383}
3384
3385/// Gender of the voice as described in
3386/// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice).
3387///
3388/// # Working with unknown values
3389///
3390/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3391/// additional enum variants at any time. Adding new variants is not considered
3392/// a breaking change. Applications should write their code in anticipation of:
3393///
3394/// - New values appearing in future releases of the client library, **and**
3395/// - New values received dynamically, without application changes.
3396///
3397/// Please consult the [Working with enums] section in the user guide for some
3398/// guidelines.
3399///
3400/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3401#[derive(Clone, Debug, PartialEq)]
3402#[non_exhaustive]
3403pub enum SsmlVoiceGender {
3404    /// An unspecified gender.
3405    /// In VoiceSelectionParams, this means that the client doesn't care which
3406    /// gender the selected voice will have. In the Voice field of
3407    /// ListVoicesResponse, this may mean that the voice doesn't fit any of the
3408    /// other categories in this enum, or that the gender of the voice isn't known.
3409    Unspecified,
3410    /// A male voice.
3411    Male,
3412    /// A female voice.
3413    Female,
3414    /// A gender-neutral voice. This voice is not yet supported.
3415    Neutral,
3416    /// If set, the enum was initialized with an unknown value.
3417    ///
3418    /// Applications can examine the value using [SsmlVoiceGender::value] or
3419    /// [SsmlVoiceGender::name].
3420    UnknownValue(ssml_voice_gender::UnknownValue),
3421}
3422
3423#[doc(hidden)]
3424pub mod ssml_voice_gender {
3425    #[allow(unused_imports)]
3426    use super::*;
3427    #[derive(Clone, Debug, PartialEq)]
3428    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3429}
3430
3431impl SsmlVoiceGender {
3432    /// Gets the enum value.
3433    ///
3434    /// Returns `None` if the enum contains an unknown value deserialized from
3435    /// the string representation of enums.
3436    pub fn value(&self) -> std::option::Option<i32> {
3437        match self {
3438            Self::Unspecified => std::option::Option::Some(0),
3439            Self::Male => std::option::Option::Some(1),
3440            Self::Female => std::option::Option::Some(2),
3441            Self::Neutral => std::option::Option::Some(3),
3442            Self::UnknownValue(u) => u.0.value(),
3443        }
3444    }
3445
3446    /// Gets the enum value as a string.
3447    ///
3448    /// Returns `None` if the enum contains an unknown value deserialized from
3449    /// the integer representation of enums.
3450    pub fn name(&self) -> std::option::Option<&str> {
3451        match self {
3452            Self::Unspecified => std::option::Option::Some("SSML_VOICE_GENDER_UNSPECIFIED"),
3453            Self::Male => std::option::Option::Some("MALE"),
3454            Self::Female => std::option::Option::Some("FEMALE"),
3455            Self::Neutral => std::option::Option::Some("NEUTRAL"),
3456            Self::UnknownValue(u) => u.0.name(),
3457        }
3458    }
3459}
3460
3461impl std::default::Default for SsmlVoiceGender {
3462    fn default() -> Self {
3463        use std::convert::From;
3464        Self::from(0)
3465    }
3466}
3467
3468impl std::fmt::Display for SsmlVoiceGender {
3469    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3470        wkt::internal::display_enum(f, self.name(), self.value())
3471    }
3472}
3473
3474impl std::convert::From<i32> for SsmlVoiceGender {
3475    fn from(value: i32) -> Self {
3476        match value {
3477            0 => Self::Unspecified,
3478            1 => Self::Male,
3479            2 => Self::Female,
3480            3 => Self::Neutral,
3481            _ => Self::UnknownValue(ssml_voice_gender::UnknownValue(
3482                wkt::internal::UnknownEnumValue::Integer(value),
3483            )),
3484        }
3485    }
3486}
3487
3488impl std::convert::From<&str> for SsmlVoiceGender {
3489    fn from(value: &str) -> Self {
3490        use std::string::ToString;
3491        match value {
3492            "SSML_VOICE_GENDER_UNSPECIFIED" => Self::Unspecified,
3493            "MALE" => Self::Male,
3494            "FEMALE" => Self::Female,
3495            "NEUTRAL" => Self::Neutral,
3496            _ => Self::UnknownValue(ssml_voice_gender::UnknownValue(
3497                wkt::internal::UnknownEnumValue::String(value.to_string()),
3498            )),
3499        }
3500    }
3501}
3502
3503impl serde::ser::Serialize for SsmlVoiceGender {
3504    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3505    where
3506        S: serde::Serializer,
3507    {
3508        match self {
3509            Self::Unspecified => serializer.serialize_i32(0),
3510            Self::Male => serializer.serialize_i32(1),
3511            Self::Female => serializer.serialize_i32(2),
3512            Self::Neutral => serializer.serialize_i32(3),
3513            Self::UnknownValue(u) => u.0.serialize(serializer),
3514        }
3515    }
3516}
3517
3518impl<'de> serde::de::Deserialize<'de> for SsmlVoiceGender {
3519    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3520    where
3521        D: serde::Deserializer<'de>,
3522    {
3523        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SsmlVoiceGender>::new(
3524            ".google.cloud.texttospeech.v1.SsmlVoiceGender",
3525        ))
3526    }
3527}
3528
3529/// Configuration to set up audio encoder. The encoding determines the output
3530/// audio format that we'd like.
3531///
3532/// # Working with unknown values
3533///
3534/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3535/// additional enum variants at any time. Adding new variants is not considered
3536/// a breaking change. Applications should write their code in anticipation of:
3537///
3538/// - New values appearing in future releases of the client library, **and**
3539/// - New values received dynamically, without application changes.
3540///
3541/// Please consult the [Working with enums] section in the user guide for some
3542/// guidelines.
3543///
3544/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3545#[derive(Clone, Debug, PartialEq)]
3546#[non_exhaustive]
3547pub enum AudioEncoding {
3548    /// Not specified. Only used by GenerateVoiceCloningKey. Otherwise, will return
3549    /// result
3550    /// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
3551    Unspecified,
3552    /// Uncompressed 16-bit signed little-endian samples (Linear PCM).
3553    /// Audio content returned as LINEAR16 also contains a WAV header.
3554    Linear16,
3555    /// MP3 audio at 32kbps.
3556    Mp3,
3557    /// Opus encoded audio wrapped in an ogg container. The result is a
3558    /// file which can be played natively on Android, and in browsers (at least
3559    /// Chrome and Firefox). The quality of the encoding is considerably higher
3560    /// than MP3 while using approximately the same bitrate.
3561    OggOpus,
3562    /// 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law.
3563    /// Audio content returned as MULAW also contains a WAV header.
3564    Mulaw,
3565    /// 8-bit samples that compand 14-bit audio samples using G.711 PCMU/A-law.
3566    /// Audio content returned as ALAW also contains a WAV header.
3567    Alaw,
3568    /// Uncompressed 16-bit signed little-endian samples (Linear PCM).
3569    /// Note that as opposed to LINEAR16, audio won't be wrapped in a WAV (or
3570    /// any other) header.
3571    Pcm,
3572    /// M4A audio.
3573    M4A,
3574    /// If set, the enum was initialized with an unknown value.
3575    ///
3576    /// Applications can examine the value using [AudioEncoding::value] or
3577    /// [AudioEncoding::name].
3578    UnknownValue(audio_encoding::UnknownValue),
3579}
3580
3581#[doc(hidden)]
3582pub mod audio_encoding {
3583    #[allow(unused_imports)]
3584    use super::*;
3585    #[derive(Clone, Debug, PartialEq)]
3586    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3587}
3588
3589impl AudioEncoding {
3590    /// Gets the enum value.
3591    ///
3592    /// Returns `None` if the enum contains an unknown value deserialized from
3593    /// the string representation of enums.
3594    pub fn value(&self) -> std::option::Option<i32> {
3595        match self {
3596            Self::Unspecified => std::option::Option::Some(0),
3597            Self::Linear16 => std::option::Option::Some(1),
3598            Self::Mp3 => std::option::Option::Some(2),
3599            Self::OggOpus => std::option::Option::Some(3),
3600            Self::Mulaw => std::option::Option::Some(5),
3601            Self::Alaw => std::option::Option::Some(6),
3602            Self::Pcm => std::option::Option::Some(7),
3603            Self::M4A => std::option::Option::Some(8),
3604            Self::UnknownValue(u) => u.0.value(),
3605        }
3606    }
3607
3608    /// Gets the enum value as a string.
3609    ///
3610    /// Returns `None` if the enum contains an unknown value deserialized from
3611    /// the integer representation of enums.
3612    pub fn name(&self) -> std::option::Option<&str> {
3613        match self {
3614            Self::Unspecified => std::option::Option::Some("AUDIO_ENCODING_UNSPECIFIED"),
3615            Self::Linear16 => std::option::Option::Some("LINEAR16"),
3616            Self::Mp3 => std::option::Option::Some("MP3"),
3617            Self::OggOpus => std::option::Option::Some("OGG_OPUS"),
3618            Self::Mulaw => std::option::Option::Some("MULAW"),
3619            Self::Alaw => std::option::Option::Some("ALAW"),
3620            Self::Pcm => std::option::Option::Some("PCM"),
3621            Self::M4A => std::option::Option::Some("M4A"),
3622            Self::UnknownValue(u) => u.0.name(),
3623        }
3624    }
3625}
3626
3627impl std::default::Default for AudioEncoding {
3628    fn default() -> Self {
3629        use std::convert::From;
3630        Self::from(0)
3631    }
3632}
3633
3634impl std::fmt::Display for AudioEncoding {
3635    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3636        wkt::internal::display_enum(f, self.name(), self.value())
3637    }
3638}
3639
3640impl std::convert::From<i32> for AudioEncoding {
3641    fn from(value: i32) -> Self {
3642        match value {
3643            0 => Self::Unspecified,
3644            1 => Self::Linear16,
3645            2 => Self::Mp3,
3646            3 => Self::OggOpus,
3647            5 => Self::Mulaw,
3648            6 => Self::Alaw,
3649            7 => Self::Pcm,
3650            8 => Self::M4A,
3651            _ => Self::UnknownValue(audio_encoding::UnknownValue(
3652                wkt::internal::UnknownEnumValue::Integer(value),
3653            )),
3654        }
3655    }
3656}
3657
3658impl std::convert::From<&str> for AudioEncoding {
3659    fn from(value: &str) -> Self {
3660        use std::string::ToString;
3661        match value {
3662            "AUDIO_ENCODING_UNSPECIFIED" => Self::Unspecified,
3663            "LINEAR16" => Self::Linear16,
3664            "MP3" => Self::Mp3,
3665            "OGG_OPUS" => Self::OggOpus,
3666            "MULAW" => Self::Mulaw,
3667            "ALAW" => Self::Alaw,
3668            "PCM" => Self::Pcm,
3669            "M4A" => Self::M4A,
3670            _ => Self::UnknownValue(audio_encoding::UnknownValue(
3671                wkt::internal::UnknownEnumValue::String(value.to_string()),
3672            )),
3673        }
3674    }
3675}
3676
3677impl serde::ser::Serialize for AudioEncoding {
3678    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3679    where
3680        S: serde::Serializer,
3681    {
3682        match self {
3683            Self::Unspecified => serializer.serialize_i32(0),
3684            Self::Linear16 => serializer.serialize_i32(1),
3685            Self::Mp3 => serializer.serialize_i32(2),
3686            Self::OggOpus => serializer.serialize_i32(3),
3687            Self::Mulaw => serializer.serialize_i32(5),
3688            Self::Alaw => serializer.serialize_i32(6),
3689            Self::Pcm => serializer.serialize_i32(7),
3690            Self::M4A => serializer.serialize_i32(8),
3691            Self::UnknownValue(u) => u.0.serialize(serializer),
3692        }
3693    }
3694}
3695
3696impl<'de> serde::de::Deserialize<'de> for AudioEncoding {
3697    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3698    where
3699        D: serde::Deserializer<'de>,
3700    {
3701        deserializer.deserialize_any(wkt::internal::EnumVisitor::<AudioEncoding>::new(
3702            ".google.cloud.texttospeech.v1.AudioEncoding",
3703        ))
3704    }
3705}