google_cloud_speech_v2/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate lazy_static;
25extern crate location;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
29extern crate rpc;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Request message for the
42/// [CreateRecognizer][google.cloud.speech.v2.Speech.CreateRecognizer] method.
43///
44/// [google.cloud.speech.v2.Speech.CreateRecognizer]: crate::client::Speech::create_recognizer
45#[derive(Clone, Default, PartialEq)]
46#[non_exhaustive]
47pub struct CreateRecognizerRequest {
48    /// Required. The Recognizer to create.
49    pub recognizer: std::option::Option<crate::model::Recognizer>,
50
51    /// If set, validate the request and preview the Recognizer, but do not
52    /// actually create it.
53    pub validate_only: bool,
54
55    /// The ID to use for the Recognizer, which will become the final component of
56    /// the Recognizer's resource name.
57    ///
58    /// This value should be 4-63 characters, and valid characters
59    /// are /[a-z][0-9]-/.
60    pub recognizer_id: std::string::String,
61
62    /// Required. The project and location where this Recognizer will be created.
63    /// The expected format is `projects/{project}/locations/{location}`.
64    pub parent: std::string::String,
65
66    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
67}
68
69impl CreateRecognizerRequest {
70    pub fn new() -> Self {
71        std::default::Default::default()
72    }
73
74    /// Sets the value of [recognizer][crate::model::CreateRecognizerRequest::recognizer].
75    ///
76    /// # Example
77    /// ```ignore,no_run
78    /// # use google_cloud_speech_v2::model::CreateRecognizerRequest;
79    /// use google_cloud_speech_v2::model::Recognizer;
80    /// let x = CreateRecognizerRequest::new().set_recognizer(Recognizer::default()/* use setters */);
81    /// ```
82    pub fn set_recognizer<T>(mut self, v: T) -> Self
83    where
84        T: std::convert::Into<crate::model::Recognizer>,
85    {
86        self.recognizer = std::option::Option::Some(v.into());
87        self
88    }
89
90    /// Sets or clears the value of [recognizer][crate::model::CreateRecognizerRequest::recognizer].
91    ///
92    /// # Example
93    /// ```ignore,no_run
94    /// # use google_cloud_speech_v2::model::CreateRecognizerRequest;
95    /// use google_cloud_speech_v2::model::Recognizer;
96    /// let x = CreateRecognizerRequest::new().set_or_clear_recognizer(Some(Recognizer::default()/* use setters */));
97    /// let x = CreateRecognizerRequest::new().set_or_clear_recognizer(None::<Recognizer>);
98    /// ```
99    pub fn set_or_clear_recognizer<T>(mut self, v: std::option::Option<T>) -> Self
100    where
101        T: std::convert::Into<crate::model::Recognizer>,
102    {
103        self.recognizer = v.map(|x| x.into());
104        self
105    }
106
107    /// Sets the value of [validate_only][crate::model::CreateRecognizerRequest::validate_only].
108    ///
109    /// # Example
110    /// ```ignore,no_run
111    /// # use google_cloud_speech_v2::model::CreateRecognizerRequest;
112    /// let x = CreateRecognizerRequest::new().set_validate_only(true);
113    /// ```
114    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
115        self.validate_only = v.into();
116        self
117    }
118
119    /// Sets the value of [recognizer_id][crate::model::CreateRecognizerRequest::recognizer_id].
120    ///
121    /// # Example
122    /// ```ignore,no_run
123    /// # use google_cloud_speech_v2::model::CreateRecognizerRequest;
124    /// let x = CreateRecognizerRequest::new().set_recognizer_id("example");
125    /// ```
126    pub fn set_recognizer_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
127        self.recognizer_id = v.into();
128        self
129    }
130
131    /// Sets the value of [parent][crate::model::CreateRecognizerRequest::parent].
132    ///
133    /// # Example
134    /// ```ignore,no_run
135    /// # use google_cloud_speech_v2::model::CreateRecognizerRequest;
136    /// let x = CreateRecognizerRequest::new().set_parent("example");
137    /// ```
138    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
139        self.parent = v.into();
140        self
141    }
142}
143
144impl wkt::message::Message for CreateRecognizerRequest {
145    fn typename() -> &'static str {
146        "type.googleapis.com/google.cloud.speech.v2.CreateRecognizerRequest"
147    }
148}
149
150/// Represents the metadata of a long-running operation.
151#[derive(Clone, Default, PartialEq)]
152#[non_exhaustive]
153pub struct OperationMetadata {
154    /// The time the operation was created.
155    pub create_time: std::option::Option<wkt::Timestamp>,
156
157    /// The time the operation was last updated.
158    pub update_time: std::option::Option<wkt::Timestamp>,
159
160    /// The resource path for the target of the operation.
161    pub resource: std::string::String,
162
163    /// The method that triggered the operation.
164    pub method: std::string::String,
165
166    /// The [KMS key
167    /// name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
168    /// the content of the Operation is encrypted. The expected format is
169    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
170    pub kms_key_name: std::string::String,
171
172    /// The [KMS key version
173    /// name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
174    /// with which content of the Operation is encrypted. The expected format is
175    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
176    pub kms_key_version_name: std::string::String,
177
178    /// The percent progress of the Operation. Values can range from 0-100. If the
179    /// value is 100, then the operation is finished.
180    pub progress_percent: i32,
181
182    /// The request that spawned the Operation.
183    pub request: std::option::Option<crate::model::operation_metadata::Request>,
184
185    /// Specific metadata per RPC.
186    pub metadata: std::option::Option<crate::model::operation_metadata::Metadata>,
187
188    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
189}
190
191impl OperationMetadata {
192    pub fn new() -> Self {
193        std::default::Default::default()
194    }
195
196    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
197    ///
198    /// # Example
199    /// ```ignore,no_run
200    /// # use google_cloud_speech_v2::model::OperationMetadata;
201    /// use wkt::Timestamp;
202    /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
203    /// ```
204    pub fn set_create_time<T>(mut self, v: T) -> Self
205    where
206        T: std::convert::Into<wkt::Timestamp>,
207    {
208        self.create_time = std::option::Option::Some(v.into());
209        self
210    }
211
212    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
213    ///
214    /// # Example
215    /// ```ignore,no_run
216    /// # use google_cloud_speech_v2::model::OperationMetadata;
217    /// use wkt::Timestamp;
218    /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
219    /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
220    /// ```
221    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
222    where
223        T: std::convert::Into<wkt::Timestamp>,
224    {
225        self.create_time = v.map(|x| x.into());
226        self
227    }
228
229    /// Sets the value of [update_time][crate::model::OperationMetadata::update_time].
230    ///
231    /// # Example
232    /// ```ignore,no_run
233    /// # use google_cloud_speech_v2::model::OperationMetadata;
234    /// use wkt::Timestamp;
235    /// let x = OperationMetadata::new().set_update_time(Timestamp::default()/* use setters */);
236    /// ```
237    pub fn set_update_time<T>(mut self, v: T) -> Self
238    where
239        T: std::convert::Into<wkt::Timestamp>,
240    {
241        self.update_time = std::option::Option::Some(v.into());
242        self
243    }
244
245    /// Sets or clears the value of [update_time][crate::model::OperationMetadata::update_time].
246    ///
247    /// # Example
248    /// ```ignore,no_run
249    /// # use google_cloud_speech_v2::model::OperationMetadata;
250    /// use wkt::Timestamp;
251    /// let x = OperationMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
252    /// let x = OperationMetadata::new().set_or_clear_update_time(None::<Timestamp>);
253    /// ```
254    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
255    where
256        T: std::convert::Into<wkt::Timestamp>,
257    {
258        self.update_time = v.map(|x| x.into());
259        self
260    }
261
262    /// Sets the value of [resource][crate::model::OperationMetadata::resource].
263    ///
264    /// # Example
265    /// ```ignore,no_run
266    /// # use google_cloud_speech_v2::model::OperationMetadata;
267    /// let x = OperationMetadata::new().set_resource("example");
268    /// ```
269    pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
270        self.resource = v.into();
271        self
272    }
273
274    /// Sets the value of [method][crate::model::OperationMetadata::method].
275    ///
276    /// # Example
277    /// ```ignore,no_run
278    /// # use google_cloud_speech_v2::model::OperationMetadata;
279    /// let x = OperationMetadata::new().set_method("example");
280    /// ```
281    pub fn set_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
282        self.method = v.into();
283        self
284    }
285
286    /// Sets the value of [kms_key_name][crate::model::OperationMetadata::kms_key_name].
287    ///
288    /// # Example
289    /// ```ignore,no_run
290    /// # use google_cloud_speech_v2::model::OperationMetadata;
291    /// let x = OperationMetadata::new().set_kms_key_name("example");
292    /// ```
293    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
294        self.kms_key_name = v.into();
295        self
296    }
297
298    /// Sets the value of [kms_key_version_name][crate::model::OperationMetadata::kms_key_version_name].
299    ///
300    /// # Example
301    /// ```ignore,no_run
302    /// # use google_cloud_speech_v2::model::OperationMetadata;
303    /// let x = OperationMetadata::new().set_kms_key_version_name("example");
304    /// ```
305    pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
306        mut self,
307        v: T,
308    ) -> Self {
309        self.kms_key_version_name = v.into();
310        self
311    }
312
313    /// Sets the value of [progress_percent][crate::model::OperationMetadata::progress_percent].
314    ///
315    /// # Example
316    /// ```ignore,no_run
317    /// # use google_cloud_speech_v2::model::OperationMetadata;
318    /// let x = OperationMetadata::new().set_progress_percent(42);
319    /// ```
320    pub fn set_progress_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
321        self.progress_percent = v.into();
322        self
323    }
324
325    /// Sets the value of [request][crate::model::OperationMetadata::request].
326    ///
327    /// Note that all the setters affecting `request` are mutually
328    /// exclusive.
329    ///
330    /// # Example
331    /// ```ignore,no_run
332    /// # use google_cloud_speech_v2::model::OperationMetadata;
333    /// use google_cloud_speech_v2::model::BatchRecognizeRequest;
334    /// let x = OperationMetadata::new().set_request(Some(
335    ///     google_cloud_speech_v2::model::operation_metadata::Request::BatchRecognizeRequest(BatchRecognizeRequest::default().into())));
336    /// ```
337    pub fn set_request<
338        T: std::convert::Into<std::option::Option<crate::model::operation_metadata::Request>>,
339    >(
340        mut self,
341        v: T,
342    ) -> Self {
343        self.request = v.into();
344        self
345    }
346
347    /// The value of [request][crate::model::OperationMetadata::request]
348    /// if it holds a `BatchRecognizeRequest`, `None` if the field is not set or
349    /// holds a different branch.
350    pub fn batch_recognize_request(
351        &self,
352    ) -> std::option::Option<&std::boxed::Box<crate::model::BatchRecognizeRequest>> {
353        #[allow(unreachable_patterns)]
354        self.request.as_ref().and_then(|v| match v {
355            crate::model::operation_metadata::Request::BatchRecognizeRequest(v) => {
356                std::option::Option::Some(v)
357            }
358            _ => std::option::Option::None,
359        })
360    }
361
362    /// Sets the value of [request][crate::model::OperationMetadata::request]
363    /// to hold a `BatchRecognizeRequest`.
364    ///
365    /// Note that all the setters affecting `request` are
366    /// mutually exclusive.
367    ///
368    /// # Example
369    /// ```ignore,no_run
370    /// # use google_cloud_speech_v2::model::OperationMetadata;
371    /// use google_cloud_speech_v2::model::BatchRecognizeRequest;
372    /// let x = OperationMetadata::new().set_batch_recognize_request(BatchRecognizeRequest::default()/* use setters */);
373    /// assert!(x.batch_recognize_request().is_some());
374    /// assert!(x.create_recognizer_request().is_none());
375    /// assert!(x.update_recognizer_request().is_none());
376    /// assert!(x.delete_recognizer_request().is_none());
377    /// assert!(x.undelete_recognizer_request().is_none());
378    /// assert!(x.create_custom_class_request().is_none());
379    /// assert!(x.update_custom_class_request().is_none());
380    /// assert!(x.delete_custom_class_request().is_none());
381    /// assert!(x.undelete_custom_class_request().is_none());
382    /// assert!(x.create_phrase_set_request().is_none());
383    /// assert!(x.update_phrase_set_request().is_none());
384    /// assert!(x.delete_phrase_set_request().is_none());
385    /// assert!(x.undelete_phrase_set_request().is_none());
386    /// assert!(x.update_config_request().is_none());
387    /// ```
388    pub fn set_batch_recognize_request<
389        T: std::convert::Into<std::boxed::Box<crate::model::BatchRecognizeRequest>>,
390    >(
391        mut self,
392        v: T,
393    ) -> Self {
394        self.request = std::option::Option::Some(
395            crate::model::operation_metadata::Request::BatchRecognizeRequest(v.into()),
396        );
397        self
398    }
399
400    /// The value of [request][crate::model::OperationMetadata::request]
401    /// if it holds a `CreateRecognizerRequest`, `None` if the field is not set or
402    /// holds a different branch.
403    pub fn create_recognizer_request(
404        &self,
405    ) -> std::option::Option<&std::boxed::Box<crate::model::CreateRecognizerRequest>> {
406        #[allow(unreachable_patterns)]
407        self.request.as_ref().and_then(|v| match v {
408            crate::model::operation_metadata::Request::CreateRecognizerRequest(v) => {
409                std::option::Option::Some(v)
410            }
411            _ => std::option::Option::None,
412        })
413    }
414
415    /// Sets the value of [request][crate::model::OperationMetadata::request]
416    /// to hold a `CreateRecognizerRequest`.
417    ///
418    /// Note that all the setters affecting `request` are
419    /// mutually exclusive.
420    ///
421    /// # Example
422    /// ```ignore,no_run
423    /// # use google_cloud_speech_v2::model::OperationMetadata;
424    /// use google_cloud_speech_v2::model::CreateRecognizerRequest;
425    /// let x = OperationMetadata::new().set_create_recognizer_request(CreateRecognizerRequest::default()/* use setters */);
426    /// assert!(x.create_recognizer_request().is_some());
427    /// assert!(x.batch_recognize_request().is_none());
428    /// assert!(x.update_recognizer_request().is_none());
429    /// assert!(x.delete_recognizer_request().is_none());
430    /// assert!(x.undelete_recognizer_request().is_none());
431    /// assert!(x.create_custom_class_request().is_none());
432    /// assert!(x.update_custom_class_request().is_none());
433    /// assert!(x.delete_custom_class_request().is_none());
434    /// assert!(x.undelete_custom_class_request().is_none());
435    /// assert!(x.create_phrase_set_request().is_none());
436    /// assert!(x.update_phrase_set_request().is_none());
437    /// assert!(x.delete_phrase_set_request().is_none());
438    /// assert!(x.undelete_phrase_set_request().is_none());
439    /// assert!(x.update_config_request().is_none());
440    /// ```
441    pub fn set_create_recognizer_request<
442        T: std::convert::Into<std::boxed::Box<crate::model::CreateRecognizerRequest>>,
443    >(
444        mut self,
445        v: T,
446    ) -> Self {
447        self.request = std::option::Option::Some(
448            crate::model::operation_metadata::Request::CreateRecognizerRequest(v.into()),
449        );
450        self
451    }
452
453    /// The value of [request][crate::model::OperationMetadata::request]
454    /// if it holds a `UpdateRecognizerRequest`, `None` if the field is not set or
455    /// holds a different branch.
456    pub fn update_recognizer_request(
457        &self,
458    ) -> std::option::Option<&std::boxed::Box<crate::model::UpdateRecognizerRequest>> {
459        #[allow(unreachable_patterns)]
460        self.request.as_ref().and_then(|v| match v {
461            crate::model::operation_metadata::Request::UpdateRecognizerRequest(v) => {
462                std::option::Option::Some(v)
463            }
464            _ => std::option::Option::None,
465        })
466    }
467
468    /// Sets the value of [request][crate::model::OperationMetadata::request]
469    /// to hold a `UpdateRecognizerRequest`.
470    ///
471    /// Note that all the setters affecting `request` are
472    /// mutually exclusive.
473    ///
474    /// # Example
475    /// ```ignore,no_run
476    /// # use google_cloud_speech_v2::model::OperationMetadata;
477    /// use google_cloud_speech_v2::model::UpdateRecognizerRequest;
478    /// let x = OperationMetadata::new().set_update_recognizer_request(UpdateRecognizerRequest::default()/* use setters */);
479    /// assert!(x.update_recognizer_request().is_some());
480    /// assert!(x.batch_recognize_request().is_none());
481    /// assert!(x.create_recognizer_request().is_none());
482    /// assert!(x.delete_recognizer_request().is_none());
483    /// assert!(x.undelete_recognizer_request().is_none());
484    /// assert!(x.create_custom_class_request().is_none());
485    /// assert!(x.update_custom_class_request().is_none());
486    /// assert!(x.delete_custom_class_request().is_none());
487    /// assert!(x.undelete_custom_class_request().is_none());
488    /// assert!(x.create_phrase_set_request().is_none());
489    /// assert!(x.update_phrase_set_request().is_none());
490    /// assert!(x.delete_phrase_set_request().is_none());
491    /// assert!(x.undelete_phrase_set_request().is_none());
492    /// assert!(x.update_config_request().is_none());
493    /// ```
494    pub fn set_update_recognizer_request<
495        T: std::convert::Into<std::boxed::Box<crate::model::UpdateRecognizerRequest>>,
496    >(
497        mut self,
498        v: T,
499    ) -> Self {
500        self.request = std::option::Option::Some(
501            crate::model::operation_metadata::Request::UpdateRecognizerRequest(v.into()),
502        );
503        self
504    }
505
506    /// The value of [request][crate::model::OperationMetadata::request]
507    /// if it holds a `DeleteRecognizerRequest`, `None` if the field is not set or
508    /// holds a different branch.
509    pub fn delete_recognizer_request(
510        &self,
511    ) -> std::option::Option<&std::boxed::Box<crate::model::DeleteRecognizerRequest>> {
512        #[allow(unreachable_patterns)]
513        self.request.as_ref().and_then(|v| match v {
514            crate::model::operation_metadata::Request::DeleteRecognizerRequest(v) => {
515                std::option::Option::Some(v)
516            }
517            _ => std::option::Option::None,
518        })
519    }
520
521    /// Sets the value of [request][crate::model::OperationMetadata::request]
522    /// to hold a `DeleteRecognizerRequest`.
523    ///
524    /// Note that all the setters affecting `request` are
525    /// mutually exclusive.
526    ///
527    /// # Example
528    /// ```ignore,no_run
529    /// # use google_cloud_speech_v2::model::OperationMetadata;
530    /// use google_cloud_speech_v2::model::DeleteRecognizerRequest;
531    /// let x = OperationMetadata::new().set_delete_recognizer_request(DeleteRecognizerRequest::default()/* use setters */);
532    /// assert!(x.delete_recognizer_request().is_some());
533    /// assert!(x.batch_recognize_request().is_none());
534    /// assert!(x.create_recognizer_request().is_none());
535    /// assert!(x.update_recognizer_request().is_none());
536    /// assert!(x.undelete_recognizer_request().is_none());
537    /// assert!(x.create_custom_class_request().is_none());
538    /// assert!(x.update_custom_class_request().is_none());
539    /// assert!(x.delete_custom_class_request().is_none());
540    /// assert!(x.undelete_custom_class_request().is_none());
541    /// assert!(x.create_phrase_set_request().is_none());
542    /// assert!(x.update_phrase_set_request().is_none());
543    /// assert!(x.delete_phrase_set_request().is_none());
544    /// assert!(x.undelete_phrase_set_request().is_none());
545    /// assert!(x.update_config_request().is_none());
546    /// ```
547    pub fn set_delete_recognizer_request<
548        T: std::convert::Into<std::boxed::Box<crate::model::DeleteRecognizerRequest>>,
549    >(
550        mut self,
551        v: T,
552    ) -> Self {
553        self.request = std::option::Option::Some(
554            crate::model::operation_metadata::Request::DeleteRecognizerRequest(v.into()),
555        );
556        self
557    }
558
559    /// The value of [request][crate::model::OperationMetadata::request]
560    /// if it holds a `UndeleteRecognizerRequest`, `None` if the field is not set or
561    /// holds a different branch.
562    pub fn undelete_recognizer_request(
563        &self,
564    ) -> std::option::Option<&std::boxed::Box<crate::model::UndeleteRecognizerRequest>> {
565        #[allow(unreachable_patterns)]
566        self.request.as_ref().and_then(|v| match v {
567            crate::model::operation_metadata::Request::UndeleteRecognizerRequest(v) => {
568                std::option::Option::Some(v)
569            }
570            _ => std::option::Option::None,
571        })
572    }
573
574    /// Sets the value of [request][crate::model::OperationMetadata::request]
575    /// to hold a `UndeleteRecognizerRequest`.
576    ///
577    /// Note that all the setters affecting `request` are
578    /// mutually exclusive.
579    ///
580    /// # Example
581    /// ```ignore,no_run
582    /// # use google_cloud_speech_v2::model::OperationMetadata;
583    /// use google_cloud_speech_v2::model::UndeleteRecognizerRequest;
584    /// let x = OperationMetadata::new().set_undelete_recognizer_request(UndeleteRecognizerRequest::default()/* use setters */);
585    /// assert!(x.undelete_recognizer_request().is_some());
586    /// assert!(x.batch_recognize_request().is_none());
587    /// assert!(x.create_recognizer_request().is_none());
588    /// assert!(x.update_recognizer_request().is_none());
589    /// assert!(x.delete_recognizer_request().is_none());
590    /// assert!(x.create_custom_class_request().is_none());
591    /// assert!(x.update_custom_class_request().is_none());
592    /// assert!(x.delete_custom_class_request().is_none());
593    /// assert!(x.undelete_custom_class_request().is_none());
594    /// assert!(x.create_phrase_set_request().is_none());
595    /// assert!(x.update_phrase_set_request().is_none());
596    /// assert!(x.delete_phrase_set_request().is_none());
597    /// assert!(x.undelete_phrase_set_request().is_none());
598    /// assert!(x.update_config_request().is_none());
599    /// ```
600    pub fn set_undelete_recognizer_request<
601        T: std::convert::Into<std::boxed::Box<crate::model::UndeleteRecognizerRequest>>,
602    >(
603        mut self,
604        v: T,
605    ) -> Self {
606        self.request = std::option::Option::Some(
607            crate::model::operation_metadata::Request::UndeleteRecognizerRequest(v.into()),
608        );
609        self
610    }
611
612    /// The value of [request][crate::model::OperationMetadata::request]
613    /// if it holds a `CreateCustomClassRequest`, `None` if the field is not set or
614    /// holds a different branch.
615    pub fn create_custom_class_request(
616        &self,
617    ) -> std::option::Option<&std::boxed::Box<crate::model::CreateCustomClassRequest>> {
618        #[allow(unreachable_patterns)]
619        self.request.as_ref().and_then(|v| match v {
620            crate::model::operation_metadata::Request::CreateCustomClassRequest(v) => {
621                std::option::Option::Some(v)
622            }
623            _ => std::option::Option::None,
624        })
625    }
626
627    /// Sets the value of [request][crate::model::OperationMetadata::request]
628    /// to hold a `CreateCustomClassRequest`.
629    ///
630    /// Note that all the setters affecting `request` are
631    /// mutually exclusive.
632    ///
633    /// # Example
634    /// ```ignore,no_run
635    /// # use google_cloud_speech_v2::model::OperationMetadata;
636    /// use google_cloud_speech_v2::model::CreateCustomClassRequest;
637    /// let x = OperationMetadata::new().set_create_custom_class_request(CreateCustomClassRequest::default()/* use setters */);
638    /// assert!(x.create_custom_class_request().is_some());
639    /// assert!(x.batch_recognize_request().is_none());
640    /// assert!(x.create_recognizer_request().is_none());
641    /// assert!(x.update_recognizer_request().is_none());
642    /// assert!(x.delete_recognizer_request().is_none());
643    /// assert!(x.undelete_recognizer_request().is_none());
644    /// assert!(x.update_custom_class_request().is_none());
645    /// assert!(x.delete_custom_class_request().is_none());
646    /// assert!(x.undelete_custom_class_request().is_none());
647    /// assert!(x.create_phrase_set_request().is_none());
648    /// assert!(x.update_phrase_set_request().is_none());
649    /// assert!(x.delete_phrase_set_request().is_none());
650    /// assert!(x.undelete_phrase_set_request().is_none());
651    /// assert!(x.update_config_request().is_none());
652    /// ```
653    pub fn set_create_custom_class_request<
654        T: std::convert::Into<std::boxed::Box<crate::model::CreateCustomClassRequest>>,
655    >(
656        mut self,
657        v: T,
658    ) -> Self {
659        self.request = std::option::Option::Some(
660            crate::model::operation_metadata::Request::CreateCustomClassRequest(v.into()),
661        );
662        self
663    }
664
665    /// The value of [request][crate::model::OperationMetadata::request]
666    /// if it holds a `UpdateCustomClassRequest`, `None` if the field is not set or
667    /// holds a different branch.
668    pub fn update_custom_class_request(
669        &self,
670    ) -> std::option::Option<&std::boxed::Box<crate::model::UpdateCustomClassRequest>> {
671        #[allow(unreachable_patterns)]
672        self.request.as_ref().and_then(|v| match v {
673            crate::model::operation_metadata::Request::UpdateCustomClassRequest(v) => {
674                std::option::Option::Some(v)
675            }
676            _ => std::option::Option::None,
677        })
678    }
679
680    /// Sets the value of [request][crate::model::OperationMetadata::request]
681    /// to hold a `UpdateCustomClassRequest`.
682    ///
683    /// Note that all the setters affecting `request` are
684    /// mutually exclusive.
685    ///
686    /// # Example
687    /// ```ignore,no_run
688    /// # use google_cloud_speech_v2::model::OperationMetadata;
689    /// use google_cloud_speech_v2::model::UpdateCustomClassRequest;
690    /// let x = OperationMetadata::new().set_update_custom_class_request(UpdateCustomClassRequest::default()/* use setters */);
691    /// assert!(x.update_custom_class_request().is_some());
692    /// assert!(x.batch_recognize_request().is_none());
693    /// assert!(x.create_recognizer_request().is_none());
694    /// assert!(x.update_recognizer_request().is_none());
695    /// assert!(x.delete_recognizer_request().is_none());
696    /// assert!(x.undelete_recognizer_request().is_none());
697    /// assert!(x.create_custom_class_request().is_none());
698    /// assert!(x.delete_custom_class_request().is_none());
699    /// assert!(x.undelete_custom_class_request().is_none());
700    /// assert!(x.create_phrase_set_request().is_none());
701    /// assert!(x.update_phrase_set_request().is_none());
702    /// assert!(x.delete_phrase_set_request().is_none());
703    /// assert!(x.undelete_phrase_set_request().is_none());
704    /// assert!(x.update_config_request().is_none());
705    /// ```
706    pub fn set_update_custom_class_request<
707        T: std::convert::Into<std::boxed::Box<crate::model::UpdateCustomClassRequest>>,
708    >(
709        mut self,
710        v: T,
711    ) -> Self {
712        self.request = std::option::Option::Some(
713            crate::model::operation_metadata::Request::UpdateCustomClassRequest(v.into()),
714        );
715        self
716    }
717
718    /// The value of [request][crate::model::OperationMetadata::request]
719    /// if it holds a `DeleteCustomClassRequest`, `None` if the field is not set or
720    /// holds a different branch.
721    pub fn delete_custom_class_request(
722        &self,
723    ) -> std::option::Option<&std::boxed::Box<crate::model::DeleteCustomClassRequest>> {
724        #[allow(unreachable_patterns)]
725        self.request.as_ref().and_then(|v| match v {
726            crate::model::operation_metadata::Request::DeleteCustomClassRequest(v) => {
727                std::option::Option::Some(v)
728            }
729            _ => std::option::Option::None,
730        })
731    }
732
733    /// Sets the value of [request][crate::model::OperationMetadata::request]
734    /// to hold a `DeleteCustomClassRequest`.
735    ///
736    /// Note that all the setters affecting `request` are
737    /// mutually exclusive.
738    ///
739    /// # Example
740    /// ```ignore,no_run
741    /// # use google_cloud_speech_v2::model::OperationMetadata;
742    /// use google_cloud_speech_v2::model::DeleteCustomClassRequest;
743    /// let x = OperationMetadata::new().set_delete_custom_class_request(DeleteCustomClassRequest::default()/* use setters */);
744    /// assert!(x.delete_custom_class_request().is_some());
745    /// assert!(x.batch_recognize_request().is_none());
746    /// assert!(x.create_recognizer_request().is_none());
747    /// assert!(x.update_recognizer_request().is_none());
748    /// assert!(x.delete_recognizer_request().is_none());
749    /// assert!(x.undelete_recognizer_request().is_none());
750    /// assert!(x.create_custom_class_request().is_none());
751    /// assert!(x.update_custom_class_request().is_none());
752    /// assert!(x.undelete_custom_class_request().is_none());
753    /// assert!(x.create_phrase_set_request().is_none());
754    /// assert!(x.update_phrase_set_request().is_none());
755    /// assert!(x.delete_phrase_set_request().is_none());
756    /// assert!(x.undelete_phrase_set_request().is_none());
757    /// assert!(x.update_config_request().is_none());
758    /// ```
759    pub fn set_delete_custom_class_request<
760        T: std::convert::Into<std::boxed::Box<crate::model::DeleteCustomClassRequest>>,
761    >(
762        mut self,
763        v: T,
764    ) -> Self {
765        self.request = std::option::Option::Some(
766            crate::model::operation_metadata::Request::DeleteCustomClassRequest(v.into()),
767        );
768        self
769    }
770
771    /// The value of [request][crate::model::OperationMetadata::request]
772    /// if it holds a `UndeleteCustomClassRequest`, `None` if the field is not set or
773    /// holds a different branch.
774    pub fn undelete_custom_class_request(
775        &self,
776    ) -> std::option::Option<&std::boxed::Box<crate::model::UndeleteCustomClassRequest>> {
777        #[allow(unreachable_patterns)]
778        self.request.as_ref().and_then(|v| match v {
779            crate::model::operation_metadata::Request::UndeleteCustomClassRequest(v) => {
780                std::option::Option::Some(v)
781            }
782            _ => std::option::Option::None,
783        })
784    }
785
786    /// Sets the value of [request][crate::model::OperationMetadata::request]
787    /// to hold a `UndeleteCustomClassRequest`.
788    ///
789    /// Note that all the setters affecting `request` are
790    /// mutually exclusive.
791    ///
792    /// # Example
793    /// ```ignore,no_run
794    /// # use google_cloud_speech_v2::model::OperationMetadata;
795    /// use google_cloud_speech_v2::model::UndeleteCustomClassRequest;
796    /// let x = OperationMetadata::new().set_undelete_custom_class_request(UndeleteCustomClassRequest::default()/* use setters */);
797    /// assert!(x.undelete_custom_class_request().is_some());
798    /// assert!(x.batch_recognize_request().is_none());
799    /// assert!(x.create_recognizer_request().is_none());
800    /// assert!(x.update_recognizer_request().is_none());
801    /// assert!(x.delete_recognizer_request().is_none());
802    /// assert!(x.undelete_recognizer_request().is_none());
803    /// assert!(x.create_custom_class_request().is_none());
804    /// assert!(x.update_custom_class_request().is_none());
805    /// assert!(x.delete_custom_class_request().is_none());
806    /// assert!(x.create_phrase_set_request().is_none());
807    /// assert!(x.update_phrase_set_request().is_none());
808    /// assert!(x.delete_phrase_set_request().is_none());
809    /// assert!(x.undelete_phrase_set_request().is_none());
810    /// assert!(x.update_config_request().is_none());
811    /// ```
812    pub fn set_undelete_custom_class_request<
813        T: std::convert::Into<std::boxed::Box<crate::model::UndeleteCustomClassRequest>>,
814    >(
815        mut self,
816        v: T,
817    ) -> Self {
818        self.request = std::option::Option::Some(
819            crate::model::operation_metadata::Request::UndeleteCustomClassRequest(v.into()),
820        );
821        self
822    }
823
824    /// The value of [request][crate::model::OperationMetadata::request]
825    /// if it holds a `CreatePhraseSetRequest`, `None` if the field is not set or
826    /// holds a different branch.
827    pub fn create_phrase_set_request(
828        &self,
829    ) -> std::option::Option<&std::boxed::Box<crate::model::CreatePhraseSetRequest>> {
830        #[allow(unreachable_patterns)]
831        self.request.as_ref().and_then(|v| match v {
832            crate::model::operation_metadata::Request::CreatePhraseSetRequest(v) => {
833                std::option::Option::Some(v)
834            }
835            _ => std::option::Option::None,
836        })
837    }
838
839    /// Sets the value of [request][crate::model::OperationMetadata::request]
840    /// to hold a `CreatePhraseSetRequest`.
841    ///
842    /// Note that all the setters affecting `request` are
843    /// mutually exclusive.
844    ///
845    /// # Example
846    /// ```ignore,no_run
847    /// # use google_cloud_speech_v2::model::OperationMetadata;
848    /// use google_cloud_speech_v2::model::CreatePhraseSetRequest;
849    /// let x = OperationMetadata::new().set_create_phrase_set_request(CreatePhraseSetRequest::default()/* use setters */);
850    /// assert!(x.create_phrase_set_request().is_some());
851    /// assert!(x.batch_recognize_request().is_none());
852    /// assert!(x.create_recognizer_request().is_none());
853    /// assert!(x.update_recognizer_request().is_none());
854    /// assert!(x.delete_recognizer_request().is_none());
855    /// assert!(x.undelete_recognizer_request().is_none());
856    /// assert!(x.create_custom_class_request().is_none());
857    /// assert!(x.update_custom_class_request().is_none());
858    /// assert!(x.delete_custom_class_request().is_none());
859    /// assert!(x.undelete_custom_class_request().is_none());
860    /// assert!(x.update_phrase_set_request().is_none());
861    /// assert!(x.delete_phrase_set_request().is_none());
862    /// assert!(x.undelete_phrase_set_request().is_none());
863    /// assert!(x.update_config_request().is_none());
864    /// ```
865    pub fn set_create_phrase_set_request<
866        T: std::convert::Into<std::boxed::Box<crate::model::CreatePhraseSetRequest>>,
867    >(
868        mut self,
869        v: T,
870    ) -> Self {
871        self.request = std::option::Option::Some(
872            crate::model::operation_metadata::Request::CreatePhraseSetRequest(v.into()),
873        );
874        self
875    }
876
877    /// The value of [request][crate::model::OperationMetadata::request]
878    /// if it holds a `UpdatePhraseSetRequest`, `None` if the field is not set or
879    /// holds a different branch.
880    pub fn update_phrase_set_request(
881        &self,
882    ) -> std::option::Option<&std::boxed::Box<crate::model::UpdatePhraseSetRequest>> {
883        #[allow(unreachable_patterns)]
884        self.request.as_ref().and_then(|v| match v {
885            crate::model::operation_metadata::Request::UpdatePhraseSetRequest(v) => {
886                std::option::Option::Some(v)
887            }
888            _ => std::option::Option::None,
889        })
890    }
891
892    /// Sets the value of [request][crate::model::OperationMetadata::request]
893    /// to hold a `UpdatePhraseSetRequest`.
894    ///
895    /// Note that all the setters affecting `request` are
896    /// mutually exclusive.
897    ///
898    /// # Example
899    /// ```ignore,no_run
900    /// # use google_cloud_speech_v2::model::OperationMetadata;
901    /// use google_cloud_speech_v2::model::UpdatePhraseSetRequest;
902    /// let x = OperationMetadata::new().set_update_phrase_set_request(UpdatePhraseSetRequest::default()/* use setters */);
903    /// assert!(x.update_phrase_set_request().is_some());
904    /// assert!(x.batch_recognize_request().is_none());
905    /// assert!(x.create_recognizer_request().is_none());
906    /// assert!(x.update_recognizer_request().is_none());
907    /// assert!(x.delete_recognizer_request().is_none());
908    /// assert!(x.undelete_recognizer_request().is_none());
909    /// assert!(x.create_custom_class_request().is_none());
910    /// assert!(x.update_custom_class_request().is_none());
911    /// assert!(x.delete_custom_class_request().is_none());
912    /// assert!(x.undelete_custom_class_request().is_none());
913    /// assert!(x.create_phrase_set_request().is_none());
914    /// assert!(x.delete_phrase_set_request().is_none());
915    /// assert!(x.undelete_phrase_set_request().is_none());
916    /// assert!(x.update_config_request().is_none());
917    /// ```
918    pub fn set_update_phrase_set_request<
919        T: std::convert::Into<std::boxed::Box<crate::model::UpdatePhraseSetRequest>>,
920    >(
921        mut self,
922        v: T,
923    ) -> Self {
924        self.request = std::option::Option::Some(
925            crate::model::operation_metadata::Request::UpdatePhraseSetRequest(v.into()),
926        );
927        self
928    }
929
930    /// The value of [request][crate::model::OperationMetadata::request]
931    /// if it holds a `DeletePhraseSetRequest`, `None` if the field is not set or
932    /// holds a different branch.
933    pub fn delete_phrase_set_request(
934        &self,
935    ) -> std::option::Option<&std::boxed::Box<crate::model::DeletePhraseSetRequest>> {
936        #[allow(unreachable_patterns)]
937        self.request.as_ref().and_then(|v| match v {
938            crate::model::operation_metadata::Request::DeletePhraseSetRequest(v) => {
939                std::option::Option::Some(v)
940            }
941            _ => std::option::Option::None,
942        })
943    }
944
945    /// Sets the value of [request][crate::model::OperationMetadata::request]
946    /// to hold a `DeletePhraseSetRequest`.
947    ///
948    /// Note that all the setters affecting `request` are
949    /// mutually exclusive.
950    ///
951    /// # Example
952    /// ```ignore,no_run
953    /// # use google_cloud_speech_v2::model::OperationMetadata;
954    /// use google_cloud_speech_v2::model::DeletePhraseSetRequest;
955    /// let x = OperationMetadata::new().set_delete_phrase_set_request(DeletePhraseSetRequest::default()/* use setters */);
956    /// assert!(x.delete_phrase_set_request().is_some());
957    /// assert!(x.batch_recognize_request().is_none());
958    /// assert!(x.create_recognizer_request().is_none());
959    /// assert!(x.update_recognizer_request().is_none());
960    /// assert!(x.delete_recognizer_request().is_none());
961    /// assert!(x.undelete_recognizer_request().is_none());
962    /// assert!(x.create_custom_class_request().is_none());
963    /// assert!(x.update_custom_class_request().is_none());
964    /// assert!(x.delete_custom_class_request().is_none());
965    /// assert!(x.undelete_custom_class_request().is_none());
966    /// assert!(x.create_phrase_set_request().is_none());
967    /// assert!(x.update_phrase_set_request().is_none());
968    /// assert!(x.undelete_phrase_set_request().is_none());
969    /// assert!(x.update_config_request().is_none());
970    /// ```
971    pub fn set_delete_phrase_set_request<
972        T: std::convert::Into<std::boxed::Box<crate::model::DeletePhraseSetRequest>>,
973    >(
974        mut self,
975        v: T,
976    ) -> Self {
977        self.request = std::option::Option::Some(
978            crate::model::operation_metadata::Request::DeletePhraseSetRequest(v.into()),
979        );
980        self
981    }
982
983    /// The value of [request][crate::model::OperationMetadata::request]
984    /// if it holds a `UndeletePhraseSetRequest`, `None` if the field is not set or
985    /// holds a different branch.
986    pub fn undelete_phrase_set_request(
987        &self,
988    ) -> std::option::Option<&std::boxed::Box<crate::model::UndeletePhraseSetRequest>> {
989        #[allow(unreachable_patterns)]
990        self.request.as_ref().and_then(|v| match v {
991            crate::model::operation_metadata::Request::UndeletePhraseSetRequest(v) => {
992                std::option::Option::Some(v)
993            }
994            _ => std::option::Option::None,
995        })
996    }
997
998    /// Sets the value of [request][crate::model::OperationMetadata::request]
999    /// to hold a `UndeletePhraseSetRequest`.
1000    ///
1001    /// Note that all the setters affecting `request` are
1002    /// mutually exclusive.
1003    ///
1004    /// # Example
1005    /// ```ignore,no_run
1006    /// # use google_cloud_speech_v2::model::OperationMetadata;
1007    /// use google_cloud_speech_v2::model::UndeletePhraseSetRequest;
1008    /// let x = OperationMetadata::new().set_undelete_phrase_set_request(UndeletePhraseSetRequest::default()/* use setters */);
1009    /// assert!(x.undelete_phrase_set_request().is_some());
1010    /// assert!(x.batch_recognize_request().is_none());
1011    /// assert!(x.create_recognizer_request().is_none());
1012    /// assert!(x.update_recognizer_request().is_none());
1013    /// assert!(x.delete_recognizer_request().is_none());
1014    /// assert!(x.undelete_recognizer_request().is_none());
1015    /// assert!(x.create_custom_class_request().is_none());
1016    /// assert!(x.update_custom_class_request().is_none());
1017    /// assert!(x.delete_custom_class_request().is_none());
1018    /// assert!(x.undelete_custom_class_request().is_none());
1019    /// assert!(x.create_phrase_set_request().is_none());
1020    /// assert!(x.update_phrase_set_request().is_none());
1021    /// assert!(x.delete_phrase_set_request().is_none());
1022    /// assert!(x.update_config_request().is_none());
1023    /// ```
1024    pub fn set_undelete_phrase_set_request<
1025        T: std::convert::Into<std::boxed::Box<crate::model::UndeletePhraseSetRequest>>,
1026    >(
1027        mut self,
1028        v: T,
1029    ) -> Self {
1030        self.request = std::option::Option::Some(
1031            crate::model::operation_metadata::Request::UndeletePhraseSetRequest(v.into()),
1032        );
1033        self
1034    }
1035
1036    /// The value of [request][crate::model::OperationMetadata::request]
1037    /// if it holds a `UpdateConfigRequest`, `None` if the field is not set or
1038    /// holds a different branch.
1039    #[deprecated]
1040    pub fn update_config_request(
1041        &self,
1042    ) -> std::option::Option<&std::boxed::Box<crate::model::UpdateConfigRequest>> {
1043        #[allow(unreachable_patterns)]
1044        self.request.as_ref().and_then(|v| match v {
1045            crate::model::operation_metadata::Request::UpdateConfigRequest(v) => {
1046                std::option::Option::Some(v)
1047            }
1048            _ => std::option::Option::None,
1049        })
1050    }
1051
1052    /// Sets the value of [request][crate::model::OperationMetadata::request]
1053    /// to hold a `UpdateConfigRequest`.
1054    ///
1055    /// Note that all the setters affecting `request` are
1056    /// mutually exclusive.
1057    ///
1058    /// # Example
1059    /// ```ignore,no_run
1060    /// # use google_cloud_speech_v2::model::OperationMetadata;
1061    /// use google_cloud_speech_v2::model::UpdateConfigRequest;
1062    /// let x = OperationMetadata::new().set_update_config_request(UpdateConfigRequest::default()/* use setters */);
1063    /// assert!(x.update_config_request().is_some());
1064    /// assert!(x.batch_recognize_request().is_none());
1065    /// assert!(x.create_recognizer_request().is_none());
1066    /// assert!(x.update_recognizer_request().is_none());
1067    /// assert!(x.delete_recognizer_request().is_none());
1068    /// assert!(x.undelete_recognizer_request().is_none());
1069    /// assert!(x.create_custom_class_request().is_none());
1070    /// assert!(x.update_custom_class_request().is_none());
1071    /// assert!(x.delete_custom_class_request().is_none());
1072    /// assert!(x.undelete_custom_class_request().is_none());
1073    /// assert!(x.create_phrase_set_request().is_none());
1074    /// assert!(x.update_phrase_set_request().is_none());
1075    /// assert!(x.delete_phrase_set_request().is_none());
1076    /// assert!(x.undelete_phrase_set_request().is_none());
1077    /// ```
1078    #[deprecated]
1079    pub fn set_update_config_request<
1080        T: std::convert::Into<std::boxed::Box<crate::model::UpdateConfigRequest>>,
1081    >(
1082        mut self,
1083        v: T,
1084    ) -> Self {
1085        self.request = std::option::Option::Some(
1086            crate::model::operation_metadata::Request::UpdateConfigRequest(v.into()),
1087        );
1088        self
1089    }
1090
1091    /// Sets the value of [metadata][crate::model::OperationMetadata::metadata].
1092    ///
1093    /// Note that all the setters affecting `metadata` are mutually
1094    /// exclusive.
1095    ///
1096    /// # Example
1097    /// ```ignore,no_run
1098    /// # use google_cloud_speech_v2::model::OperationMetadata;
1099    /// use google_cloud_speech_v2::model::BatchRecognizeMetadata;
1100    /// let x = OperationMetadata::new().set_metadata(Some(
1101    ///     google_cloud_speech_v2::model::operation_metadata::Metadata::BatchRecognizeMetadata(BatchRecognizeMetadata::default().into())));
1102    /// ```
1103    pub fn set_metadata<
1104        T: std::convert::Into<std::option::Option<crate::model::operation_metadata::Metadata>>,
1105    >(
1106        mut self,
1107        v: T,
1108    ) -> Self {
1109        self.metadata = v.into();
1110        self
1111    }
1112
1113    /// The value of [metadata][crate::model::OperationMetadata::metadata]
1114    /// if it holds a `BatchRecognizeMetadata`, `None` if the field is not set or
1115    /// holds a different branch.
1116    pub fn batch_recognize_metadata(
1117        &self,
1118    ) -> std::option::Option<&std::boxed::Box<crate::model::BatchRecognizeMetadata>> {
1119        #[allow(unreachable_patterns)]
1120        self.metadata.as_ref().and_then(|v| match v {
1121            crate::model::operation_metadata::Metadata::BatchRecognizeMetadata(v) => {
1122                std::option::Option::Some(v)
1123            }
1124            _ => std::option::Option::None,
1125        })
1126    }
1127
1128    /// Sets the value of [metadata][crate::model::OperationMetadata::metadata]
1129    /// to hold a `BatchRecognizeMetadata`.
1130    ///
1131    /// Note that all the setters affecting `metadata` are
1132    /// mutually exclusive.
1133    ///
1134    /// # Example
1135    /// ```ignore,no_run
1136    /// # use google_cloud_speech_v2::model::OperationMetadata;
1137    /// use google_cloud_speech_v2::model::BatchRecognizeMetadata;
1138    /// let x = OperationMetadata::new().set_batch_recognize_metadata(BatchRecognizeMetadata::default()/* use setters */);
1139    /// assert!(x.batch_recognize_metadata().is_some());
1140    /// ```
1141    pub fn set_batch_recognize_metadata<
1142        T: std::convert::Into<std::boxed::Box<crate::model::BatchRecognizeMetadata>>,
1143    >(
1144        mut self,
1145        v: T,
1146    ) -> Self {
1147        self.metadata = std::option::Option::Some(
1148            crate::model::operation_metadata::Metadata::BatchRecognizeMetadata(v.into()),
1149        );
1150        self
1151    }
1152}
1153
1154impl wkt::message::Message for OperationMetadata {
1155    fn typename() -> &'static str {
1156        "type.googleapis.com/google.cloud.speech.v2.OperationMetadata"
1157    }
1158}
1159
1160/// Defines additional types related to [OperationMetadata].
1161pub mod operation_metadata {
1162    #[allow(unused_imports)]
1163    use super::*;
1164
1165    /// The request that spawned the Operation.
1166    #[derive(Clone, Debug, PartialEq)]
1167    #[non_exhaustive]
1168    pub enum Request {
1169        /// The BatchRecognizeRequest that spawned the Operation.
1170        BatchRecognizeRequest(std::boxed::Box<crate::model::BatchRecognizeRequest>),
1171        /// The CreateRecognizerRequest that spawned the Operation.
1172        CreateRecognizerRequest(std::boxed::Box<crate::model::CreateRecognizerRequest>),
1173        /// The UpdateRecognizerRequest that spawned the Operation.
1174        UpdateRecognizerRequest(std::boxed::Box<crate::model::UpdateRecognizerRequest>),
1175        /// The DeleteRecognizerRequest that spawned the Operation.
1176        DeleteRecognizerRequest(std::boxed::Box<crate::model::DeleteRecognizerRequest>),
1177        /// The UndeleteRecognizerRequest that spawned the Operation.
1178        UndeleteRecognizerRequest(std::boxed::Box<crate::model::UndeleteRecognizerRequest>),
1179        /// The CreateCustomClassRequest that spawned the Operation.
1180        CreateCustomClassRequest(std::boxed::Box<crate::model::CreateCustomClassRequest>),
1181        /// The UpdateCustomClassRequest that spawned the Operation.
1182        UpdateCustomClassRequest(std::boxed::Box<crate::model::UpdateCustomClassRequest>),
1183        /// The DeleteCustomClassRequest that spawned the Operation.
1184        DeleteCustomClassRequest(std::boxed::Box<crate::model::DeleteCustomClassRequest>),
1185        /// The UndeleteCustomClassRequest that spawned the Operation.
1186        UndeleteCustomClassRequest(std::boxed::Box<crate::model::UndeleteCustomClassRequest>),
1187        /// The CreatePhraseSetRequest that spawned the Operation.
1188        CreatePhraseSetRequest(std::boxed::Box<crate::model::CreatePhraseSetRequest>),
1189        /// The UpdatePhraseSetRequest that spawned the Operation.
1190        UpdatePhraseSetRequest(std::boxed::Box<crate::model::UpdatePhraseSetRequest>),
1191        /// The DeletePhraseSetRequest that spawned the Operation.
1192        DeletePhraseSetRequest(std::boxed::Box<crate::model::DeletePhraseSetRequest>),
1193        /// The UndeletePhraseSetRequest that spawned the Operation.
1194        UndeletePhraseSetRequest(std::boxed::Box<crate::model::UndeletePhraseSetRequest>),
1195        /// The UpdateConfigRequest that spawned the Operation.
1196        #[deprecated]
1197        UpdateConfigRequest(std::boxed::Box<crate::model::UpdateConfigRequest>),
1198    }
1199
1200    /// Specific metadata per RPC.
1201    #[derive(Clone, Debug, PartialEq)]
1202    #[non_exhaustive]
1203    pub enum Metadata {
1204        /// Metadata specific to the BatchRecognize method.
1205        BatchRecognizeMetadata(std::boxed::Box<crate::model::BatchRecognizeMetadata>),
1206    }
1207}
1208
1209/// Request message for the
1210/// [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] method.
1211///
1212/// [google.cloud.speech.v2.Speech.ListRecognizers]: crate::client::Speech::list_recognizers
1213#[derive(Clone, Default, PartialEq)]
1214#[non_exhaustive]
1215pub struct ListRecognizersRequest {
1216    /// Required. The project and location of Recognizers to list. The expected
1217    /// format is `projects/{project}/locations/{location}`.
1218    pub parent: std::string::String,
1219
1220    /// The maximum number of Recognizers to return. The service may return fewer
1221    /// than this value. If unspecified, at most 5 Recognizers will be returned.
1222    /// The maximum value is 100; values above 100 will be coerced to 100.
1223    pub page_size: i32,
1224
1225    /// A page token, received from a previous
1226    /// [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] call.
1227    /// Provide this to retrieve the subsequent page.
1228    ///
1229    /// When paginating, all other parameters provided to
1230    /// [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] must match
1231    /// the call that provided the page token.
1232    ///
1233    /// [google.cloud.speech.v2.Speech.ListRecognizers]: crate::client::Speech::list_recognizers
1234    pub page_token: std::string::String,
1235
1236    /// Whether, or not, to show resources that have been deleted.
1237    pub show_deleted: bool,
1238
1239    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1240}
1241
1242impl ListRecognizersRequest {
1243    pub fn new() -> Self {
1244        std::default::Default::default()
1245    }
1246
1247    /// Sets the value of [parent][crate::model::ListRecognizersRequest::parent].
1248    ///
1249    /// # Example
1250    /// ```ignore,no_run
1251    /// # use google_cloud_speech_v2::model::ListRecognizersRequest;
1252    /// let x = ListRecognizersRequest::new().set_parent("example");
1253    /// ```
1254    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1255        self.parent = v.into();
1256        self
1257    }
1258
1259    /// Sets the value of [page_size][crate::model::ListRecognizersRequest::page_size].
1260    ///
1261    /// # Example
1262    /// ```ignore,no_run
1263    /// # use google_cloud_speech_v2::model::ListRecognizersRequest;
1264    /// let x = ListRecognizersRequest::new().set_page_size(42);
1265    /// ```
1266    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1267        self.page_size = v.into();
1268        self
1269    }
1270
1271    /// Sets the value of [page_token][crate::model::ListRecognizersRequest::page_token].
1272    ///
1273    /// # Example
1274    /// ```ignore,no_run
1275    /// # use google_cloud_speech_v2::model::ListRecognizersRequest;
1276    /// let x = ListRecognizersRequest::new().set_page_token("example");
1277    /// ```
1278    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1279        self.page_token = v.into();
1280        self
1281    }
1282
1283    /// Sets the value of [show_deleted][crate::model::ListRecognizersRequest::show_deleted].
1284    ///
1285    /// # Example
1286    /// ```ignore,no_run
1287    /// # use google_cloud_speech_v2::model::ListRecognizersRequest;
1288    /// let x = ListRecognizersRequest::new().set_show_deleted(true);
1289    /// ```
1290    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1291        self.show_deleted = v.into();
1292        self
1293    }
1294}
1295
1296impl wkt::message::Message for ListRecognizersRequest {
1297    fn typename() -> &'static str {
1298        "type.googleapis.com/google.cloud.speech.v2.ListRecognizersRequest"
1299    }
1300}
1301
1302/// Response message for the
1303/// [ListRecognizers][google.cloud.speech.v2.Speech.ListRecognizers] method.
1304///
1305/// [google.cloud.speech.v2.Speech.ListRecognizers]: crate::client::Speech::list_recognizers
1306#[derive(Clone, Default, PartialEq)]
1307#[non_exhaustive]
1308pub struct ListRecognizersResponse {
1309    /// The list of requested Recognizers.
1310    pub recognizers: std::vec::Vec<crate::model::Recognizer>,
1311
1312    /// A token, which can be sent as
1313    /// [page_token][google.cloud.speech.v2.ListRecognizersRequest.page_token] to
1314    /// retrieve the next page. If this field is omitted, there are no subsequent
1315    /// pages. This token expires after 72 hours.
1316    ///
1317    /// [google.cloud.speech.v2.ListRecognizersRequest.page_token]: crate::model::ListRecognizersRequest::page_token
1318    pub next_page_token: std::string::String,
1319
1320    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1321}
1322
1323impl ListRecognizersResponse {
1324    pub fn new() -> Self {
1325        std::default::Default::default()
1326    }
1327
1328    /// Sets the value of [recognizers][crate::model::ListRecognizersResponse::recognizers].
1329    ///
1330    /// # Example
1331    /// ```ignore,no_run
1332    /// # use google_cloud_speech_v2::model::ListRecognizersResponse;
1333    /// use google_cloud_speech_v2::model::Recognizer;
1334    /// let x = ListRecognizersResponse::new()
1335    ///     .set_recognizers([
1336    ///         Recognizer::default()/* use setters */,
1337    ///         Recognizer::default()/* use (different) setters */,
1338    ///     ]);
1339    /// ```
1340    pub fn set_recognizers<T, V>(mut self, v: T) -> Self
1341    where
1342        T: std::iter::IntoIterator<Item = V>,
1343        V: std::convert::Into<crate::model::Recognizer>,
1344    {
1345        use std::iter::Iterator;
1346        self.recognizers = v.into_iter().map(|i| i.into()).collect();
1347        self
1348    }
1349
1350    /// Sets the value of [next_page_token][crate::model::ListRecognizersResponse::next_page_token].
1351    ///
1352    /// # Example
1353    /// ```ignore,no_run
1354    /// # use google_cloud_speech_v2::model::ListRecognizersResponse;
1355    /// let x = ListRecognizersResponse::new().set_next_page_token("example");
1356    /// ```
1357    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1358        self.next_page_token = v.into();
1359        self
1360    }
1361}
1362
1363impl wkt::message::Message for ListRecognizersResponse {
1364    fn typename() -> &'static str {
1365        "type.googleapis.com/google.cloud.speech.v2.ListRecognizersResponse"
1366    }
1367}
1368
1369#[doc(hidden)]
1370impl gax::paginator::internal::PageableResponse for ListRecognizersResponse {
1371    type PageItem = crate::model::Recognizer;
1372
1373    fn items(self) -> std::vec::Vec<Self::PageItem> {
1374        self.recognizers
1375    }
1376
1377    fn next_page_token(&self) -> std::string::String {
1378        use std::clone::Clone;
1379        self.next_page_token.clone()
1380    }
1381}
1382
1383/// Request message for the
1384/// [GetRecognizer][google.cloud.speech.v2.Speech.GetRecognizer] method.
1385///
1386/// [google.cloud.speech.v2.Speech.GetRecognizer]: crate::client::Speech::get_recognizer
1387#[derive(Clone, Default, PartialEq)]
1388#[non_exhaustive]
1389pub struct GetRecognizerRequest {
1390    /// Required. The name of the Recognizer to retrieve. The expected format is
1391    /// `projects/{project}/locations/{location}/recognizers/{recognizer}`.
1392    pub name: std::string::String,
1393
1394    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1395}
1396
1397impl GetRecognizerRequest {
1398    pub fn new() -> Self {
1399        std::default::Default::default()
1400    }
1401
1402    /// Sets the value of [name][crate::model::GetRecognizerRequest::name].
1403    ///
1404    /// # Example
1405    /// ```ignore,no_run
1406    /// # use google_cloud_speech_v2::model::GetRecognizerRequest;
1407    /// let x = GetRecognizerRequest::new().set_name("example");
1408    /// ```
1409    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1410        self.name = v.into();
1411        self
1412    }
1413}
1414
1415impl wkt::message::Message for GetRecognizerRequest {
1416    fn typename() -> &'static str {
1417        "type.googleapis.com/google.cloud.speech.v2.GetRecognizerRequest"
1418    }
1419}
1420
1421/// Request message for the
1422/// [UpdateRecognizer][google.cloud.speech.v2.Speech.UpdateRecognizer] method.
1423///
1424/// [google.cloud.speech.v2.Speech.UpdateRecognizer]: crate::client::Speech::update_recognizer
1425#[derive(Clone, Default, PartialEq)]
1426#[non_exhaustive]
1427pub struct UpdateRecognizerRequest {
1428    /// Required. The Recognizer to update.
1429    ///
1430    /// The Recognizer's `name` field is used to identify the Recognizer to update.
1431    /// Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
1432    pub recognizer: std::option::Option<crate::model::Recognizer>,
1433
1434    /// The list of fields to update. If empty, all non-default valued fields are
1435    /// considered for update. Use `*` to update the entire Recognizer resource.
1436    pub update_mask: std::option::Option<wkt::FieldMask>,
1437
1438    /// If set, validate the request and preview the updated Recognizer, but do not
1439    /// actually update it.
1440    pub validate_only: bool,
1441
1442    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1443}
1444
1445impl UpdateRecognizerRequest {
1446    pub fn new() -> Self {
1447        std::default::Default::default()
1448    }
1449
1450    /// Sets the value of [recognizer][crate::model::UpdateRecognizerRequest::recognizer].
1451    ///
1452    /// # Example
1453    /// ```ignore,no_run
1454    /// # use google_cloud_speech_v2::model::UpdateRecognizerRequest;
1455    /// use google_cloud_speech_v2::model::Recognizer;
1456    /// let x = UpdateRecognizerRequest::new().set_recognizer(Recognizer::default()/* use setters */);
1457    /// ```
1458    pub fn set_recognizer<T>(mut self, v: T) -> Self
1459    where
1460        T: std::convert::Into<crate::model::Recognizer>,
1461    {
1462        self.recognizer = std::option::Option::Some(v.into());
1463        self
1464    }
1465
1466    /// Sets or clears the value of [recognizer][crate::model::UpdateRecognizerRequest::recognizer].
1467    ///
1468    /// # Example
1469    /// ```ignore,no_run
1470    /// # use google_cloud_speech_v2::model::UpdateRecognizerRequest;
1471    /// use google_cloud_speech_v2::model::Recognizer;
1472    /// let x = UpdateRecognizerRequest::new().set_or_clear_recognizer(Some(Recognizer::default()/* use setters */));
1473    /// let x = UpdateRecognizerRequest::new().set_or_clear_recognizer(None::<Recognizer>);
1474    /// ```
1475    pub fn set_or_clear_recognizer<T>(mut self, v: std::option::Option<T>) -> Self
1476    where
1477        T: std::convert::Into<crate::model::Recognizer>,
1478    {
1479        self.recognizer = v.map(|x| x.into());
1480        self
1481    }
1482
1483    /// Sets the value of [update_mask][crate::model::UpdateRecognizerRequest::update_mask].
1484    ///
1485    /// # Example
1486    /// ```ignore,no_run
1487    /// # use google_cloud_speech_v2::model::UpdateRecognizerRequest;
1488    /// use wkt::FieldMask;
1489    /// let x = UpdateRecognizerRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1490    /// ```
1491    pub fn set_update_mask<T>(mut self, v: T) -> Self
1492    where
1493        T: std::convert::Into<wkt::FieldMask>,
1494    {
1495        self.update_mask = std::option::Option::Some(v.into());
1496        self
1497    }
1498
1499    /// Sets or clears the value of [update_mask][crate::model::UpdateRecognizerRequest::update_mask].
1500    ///
1501    /// # Example
1502    /// ```ignore,no_run
1503    /// # use google_cloud_speech_v2::model::UpdateRecognizerRequest;
1504    /// use wkt::FieldMask;
1505    /// let x = UpdateRecognizerRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1506    /// let x = UpdateRecognizerRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1507    /// ```
1508    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1509    where
1510        T: std::convert::Into<wkt::FieldMask>,
1511    {
1512        self.update_mask = v.map(|x| x.into());
1513        self
1514    }
1515
1516    /// Sets the value of [validate_only][crate::model::UpdateRecognizerRequest::validate_only].
1517    ///
1518    /// # Example
1519    /// ```ignore,no_run
1520    /// # use google_cloud_speech_v2::model::UpdateRecognizerRequest;
1521    /// let x = UpdateRecognizerRequest::new().set_validate_only(true);
1522    /// ```
1523    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1524        self.validate_only = v.into();
1525        self
1526    }
1527}
1528
1529impl wkt::message::Message for UpdateRecognizerRequest {
1530    fn typename() -> &'static str {
1531        "type.googleapis.com/google.cloud.speech.v2.UpdateRecognizerRequest"
1532    }
1533}
1534
1535/// Request message for the
1536/// [DeleteRecognizer][google.cloud.speech.v2.Speech.DeleteRecognizer] method.
1537///
1538/// [google.cloud.speech.v2.Speech.DeleteRecognizer]: crate::client::Speech::delete_recognizer
1539#[derive(Clone, Default, PartialEq)]
1540#[non_exhaustive]
1541pub struct DeleteRecognizerRequest {
1542    /// Required. The name of the Recognizer to delete.
1543    /// Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
1544    pub name: std::string::String,
1545
1546    /// If set, validate the request and preview the deleted Recognizer, but do not
1547    /// actually delete it.
1548    pub validate_only: bool,
1549
1550    /// If set to true, and the Recognizer is not found, the request will succeed
1551    /// and  be a no-op (no Operation is recorded in this case).
1552    pub allow_missing: bool,
1553
1554    /// This checksum is computed by the server based on the value of other
1555    /// fields. This may be sent on update, undelete, and delete requests to ensure
1556    /// the client has an up-to-date value before proceeding.
1557    pub etag: std::string::String,
1558
1559    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1560}
1561
1562impl DeleteRecognizerRequest {
1563    pub fn new() -> Self {
1564        std::default::Default::default()
1565    }
1566
1567    /// Sets the value of [name][crate::model::DeleteRecognizerRequest::name].
1568    ///
1569    /// # Example
1570    /// ```ignore,no_run
1571    /// # use google_cloud_speech_v2::model::DeleteRecognizerRequest;
1572    /// let x = DeleteRecognizerRequest::new().set_name("example");
1573    /// ```
1574    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1575        self.name = v.into();
1576        self
1577    }
1578
1579    /// Sets the value of [validate_only][crate::model::DeleteRecognizerRequest::validate_only].
1580    ///
1581    /// # Example
1582    /// ```ignore,no_run
1583    /// # use google_cloud_speech_v2::model::DeleteRecognizerRequest;
1584    /// let x = DeleteRecognizerRequest::new().set_validate_only(true);
1585    /// ```
1586    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1587        self.validate_only = v.into();
1588        self
1589    }
1590
1591    /// Sets the value of [allow_missing][crate::model::DeleteRecognizerRequest::allow_missing].
1592    ///
1593    /// # Example
1594    /// ```ignore,no_run
1595    /// # use google_cloud_speech_v2::model::DeleteRecognizerRequest;
1596    /// let x = DeleteRecognizerRequest::new().set_allow_missing(true);
1597    /// ```
1598    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1599        self.allow_missing = v.into();
1600        self
1601    }
1602
1603    /// Sets the value of [etag][crate::model::DeleteRecognizerRequest::etag].
1604    ///
1605    /// # Example
1606    /// ```ignore,no_run
1607    /// # use google_cloud_speech_v2::model::DeleteRecognizerRequest;
1608    /// let x = DeleteRecognizerRequest::new().set_etag("example");
1609    /// ```
1610    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1611        self.etag = v.into();
1612        self
1613    }
1614}
1615
1616impl wkt::message::Message for DeleteRecognizerRequest {
1617    fn typename() -> &'static str {
1618        "type.googleapis.com/google.cloud.speech.v2.DeleteRecognizerRequest"
1619    }
1620}
1621
1622/// Request message for the
1623/// [UndeleteRecognizer][google.cloud.speech.v2.Speech.UndeleteRecognizer]
1624/// method.
1625///
1626/// [google.cloud.speech.v2.Speech.UndeleteRecognizer]: crate::client::Speech::undelete_recognizer
1627#[derive(Clone, Default, PartialEq)]
1628#[non_exhaustive]
1629pub struct UndeleteRecognizerRequest {
1630    /// Required. The name of the Recognizer to undelete.
1631    /// Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`
1632    pub name: std::string::String,
1633
1634    /// If set, validate the request and preview the undeleted Recognizer, but do
1635    /// not actually undelete it.
1636    pub validate_only: bool,
1637
1638    /// This checksum is computed by the server based on the value of other
1639    /// fields. This may be sent on update, undelete, and delete requests to ensure
1640    /// the client has an up-to-date value before proceeding.
1641    pub etag: std::string::String,
1642
1643    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1644}
1645
1646impl UndeleteRecognizerRequest {
1647    pub fn new() -> Self {
1648        std::default::Default::default()
1649    }
1650
1651    /// Sets the value of [name][crate::model::UndeleteRecognizerRequest::name].
1652    ///
1653    /// # Example
1654    /// ```ignore,no_run
1655    /// # use google_cloud_speech_v2::model::UndeleteRecognizerRequest;
1656    /// let x = UndeleteRecognizerRequest::new().set_name("example");
1657    /// ```
1658    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1659        self.name = v.into();
1660        self
1661    }
1662
1663    /// Sets the value of [validate_only][crate::model::UndeleteRecognizerRequest::validate_only].
1664    ///
1665    /// # Example
1666    /// ```ignore,no_run
1667    /// # use google_cloud_speech_v2::model::UndeleteRecognizerRequest;
1668    /// let x = UndeleteRecognizerRequest::new().set_validate_only(true);
1669    /// ```
1670    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1671        self.validate_only = v.into();
1672        self
1673    }
1674
1675    /// Sets the value of [etag][crate::model::UndeleteRecognizerRequest::etag].
1676    ///
1677    /// # Example
1678    /// ```ignore,no_run
1679    /// # use google_cloud_speech_v2::model::UndeleteRecognizerRequest;
1680    /// let x = UndeleteRecognizerRequest::new().set_etag("example");
1681    /// ```
1682    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1683        self.etag = v.into();
1684        self
1685    }
1686}
1687
1688impl wkt::message::Message for UndeleteRecognizerRequest {
1689    fn typename() -> &'static str {
1690        "type.googleapis.com/google.cloud.speech.v2.UndeleteRecognizerRequest"
1691    }
1692}
1693
1694/// A Recognizer message. Stores recognition configuration and metadata.
1695#[derive(Clone, Default, PartialEq)]
1696#[non_exhaustive]
1697pub struct Recognizer {
1698    /// Output only. Identifier. The resource name of the Recognizer.
1699    /// Format: `projects/{project}/locations/{location}/recognizers/{recognizer}`.
1700    pub name: std::string::String,
1701
1702    /// Output only. System-assigned unique identifier for the Recognizer.
1703    pub uid: std::string::String,
1704
1705    /// User-settable, human-readable name for the Recognizer. Must be 63
1706    /// characters or less.
1707    pub display_name: std::string::String,
1708
1709    /// Optional. This field is now deprecated. Prefer the
1710    /// [`model`][google.cloud.speech.v2.RecognitionConfig.model] field in the
1711    /// [`RecognitionConfig`][google.cloud.speech.v2.RecognitionConfig] message.
1712    ///
1713    /// Which model to use for recognition requests. Select the model best suited
1714    /// to your domain to get best results.
1715    ///
1716    /// Guidance for choosing which model to use can be found in the [Transcription
1717    /// Models
1718    /// Documentation](https://cloud.google.com/speech-to-text/v2/docs/transcription-model)
1719    /// and the models supported in each region can be found in the [Table Of
1720    /// Supported
1721    /// Models](https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages).
1722    ///
1723    /// [google.cloud.speech.v2.RecognitionConfig]: crate::model::RecognitionConfig
1724    /// [google.cloud.speech.v2.RecognitionConfig.model]: crate::model::RecognitionConfig::model
1725    #[deprecated]
1726    pub model: std::string::String,
1727
1728    /// Optional. This field is now deprecated. Prefer the
1729    /// [`language_codes`][google.cloud.speech.v2.RecognitionConfig.language_codes]
1730    /// field in the
1731    /// [`RecognitionConfig`][google.cloud.speech.v2.RecognitionConfig] message.
1732    ///
1733    /// The language of the supplied audio as a
1734    /// [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
1735    ///
1736    /// Supported languages for each model are listed in the [Table of Supported
1737    /// Models](https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages).
1738    ///
1739    /// If additional languages are provided, recognition result will contain
1740    /// recognition in the most likely language detected. The recognition result
1741    /// will include the language tag of the language detected in the audio.
1742    /// When you create or update a Recognizer, these values are
1743    /// stored in normalized BCP-47 form. For example, "en-us" is stored as
1744    /// "en-US".
1745    ///
1746    /// [google.cloud.speech.v2.RecognitionConfig]: crate::model::RecognitionConfig
1747    /// [google.cloud.speech.v2.RecognitionConfig.language_codes]: crate::model::RecognitionConfig::language_codes
1748    #[deprecated]
1749    pub language_codes: std::vec::Vec<std::string::String>,
1750
1751    /// Default configuration to use for requests with this Recognizer.
1752    /// This can be overwritten by inline configuration in the
1753    /// [RecognizeRequest.config][google.cloud.speech.v2.RecognizeRequest.config]
1754    /// field.
1755    ///
1756    /// [google.cloud.speech.v2.RecognizeRequest.config]: crate::model::RecognizeRequest::config
1757    pub default_recognition_config: std::option::Option<crate::model::RecognitionConfig>,
1758
1759    /// Allows users to store small amounts of arbitrary data.
1760    /// Both the key and the value must be 63 characters or less each.
1761    /// At most 100 annotations.
1762    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
1763
1764    /// Output only. The Recognizer lifecycle state.
1765    pub state: crate::model::recognizer::State,
1766
1767    /// Output only. Creation time.
1768    pub create_time: std::option::Option<wkt::Timestamp>,
1769
1770    /// Output only. The most recent time this Recognizer was modified.
1771    pub update_time: std::option::Option<wkt::Timestamp>,
1772
1773    /// Output only. The time at which this Recognizer was requested for deletion.
1774    pub delete_time: std::option::Option<wkt::Timestamp>,
1775
1776    /// Output only. The time at which this Recognizer will be purged.
1777    pub expire_time: std::option::Option<wkt::Timestamp>,
1778
1779    /// Output only. This checksum is computed by the server based on the value of
1780    /// other fields. This may be sent on update, undelete, and delete requests to
1781    /// ensure the client has an up-to-date value before proceeding.
1782    pub etag: std::string::String,
1783
1784    /// Output only. Whether or not this Recognizer is in the process of being
1785    /// updated.
1786    pub reconciling: bool,
1787
1788    /// Output only. The [KMS key
1789    /// name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
1790    /// the Recognizer is encrypted. The expected format is
1791    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
1792    pub kms_key_name: std::string::String,
1793
1794    /// Output only. The [KMS key version
1795    /// name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
1796    /// with which the Recognizer is encrypted. The expected format is
1797    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
1798    pub kms_key_version_name: std::string::String,
1799
1800    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1801}
1802
1803impl Recognizer {
1804    pub fn new() -> Self {
1805        std::default::Default::default()
1806    }
1807
1808    /// Sets the value of [name][crate::model::Recognizer::name].
1809    ///
1810    /// # Example
1811    /// ```ignore,no_run
1812    /// # use google_cloud_speech_v2::model::Recognizer;
1813    /// let x = Recognizer::new().set_name("example");
1814    /// ```
1815    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1816        self.name = v.into();
1817        self
1818    }
1819
1820    /// Sets the value of [uid][crate::model::Recognizer::uid].
1821    ///
1822    /// # Example
1823    /// ```ignore,no_run
1824    /// # use google_cloud_speech_v2::model::Recognizer;
1825    /// let x = Recognizer::new().set_uid("example");
1826    /// ```
1827    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1828        self.uid = v.into();
1829        self
1830    }
1831
1832    /// Sets the value of [display_name][crate::model::Recognizer::display_name].
1833    ///
1834    /// # Example
1835    /// ```ignore,no_run
1836    /// # use google_cloud_speech_v2::model::Recognizer;
1837    /// let x = Recognizer::new().set_display_name("example");
1838    /// ```
1839    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1840        self.display_name = v.into();
1841        self
1842    }
1843
1844    /// Sets the value of [model][crate::model::Recognizer::model].
1845    ///
1846    /// # Example
1847    /// ```ignore,no_run
1848    /// # use google_cloud_speech_v2::model::Recognizer;
1849    /// let x = Recognizer::new().set_model("example");
1850    /// ```
1851    #[deprecated]
1852    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1853        self.model = v.into();
1854        self
1855    }
1856
1857    /// Sets the value of [language_codes][crate::model::Recognizer::language_codes].
1858    ///
1859    /// # Example
1860    /// ```ignore,no_run
1861    /// # use google_cloud_speech_v2::model::Recognizer;
1862    /// let x = Recognizer::new().set_language_codes(["a", "b", "c"]);
1863    /// ```
1864    #[deprecated]
1865    pub fn set_language_codes<T, V>(mut self, v: T) -> Self
1866    where
1867        T: std::iter::IntoIterator<Item = V>,
1868        V: std::convert::Into<std::string::String>,
1869    {
1870        use std::iter::Iterator;
1871        self.language_codes = v.into_iter().map(|i| i.into()).collect();
1872        self
1873    }
1874
1875    /// Sets the value of [default_recognition_config][crate::model::Recognizer::default_recognition_config].
1876    ///
1877    /// # Example
1878    /// ```ignore,no_run
1879    /// # use google_cloud_speech_v2::model::Recognizer;
1880    /// use google_cloud_speech_v2::model::RecognitionConfig;
1881    /// let x = Recognizer::new().set_default_recognition_config(RecognitionConfig::default()/* use setters */);
1882    /// ```
1883    pub fn set_default_recognition_config<T>(mut self, v: T) -> Self
1884    where
1885        T: std::convert::Into<crate::model::RecognitionConfig>,
1886    {
1887        self.default_recognition_config = std::option::Option::Some(v.into());
1888        self
1889    }
1890
1891    /// Sets or clears the value of [default_recognition_config][crate::model::Recognizer::default_recognition_config].
1892    ///
1893    /// # Example
1894    /// ```ignore,no_run
1895    /// # use google_cloud_speech_v2::model::Recognizer;
1896    /// use google_cloud_speech_v2::model::RecognitionConfig;
1897    /// let x = Recognizer::new().set_or_clear_default_recognition_config(Some(RecognitionConfig::default()/* use setters */));
1898    /// let x = Recognizer::new().set_or_clear_default_recognition_config(None::<RecognitionConfig>);
1899    /// ```
1900    pub fn set_or_clear_default_recognition_config<T>(mut self, v: std::option::Option<T>) -> Self
1901    where
1902        T: std::convert::Into<crate::model::RecognitionConfig>,
1903    {
1904        self.default_recognition_config = v.map(|x| x.into());
1905        self
1906    }
1907
1908    /// Sets the value of [annotations][crate::model::Recognizer::annotations].
1909    ///
1910    /// # Example
1911    /// ```ignore,no_run
1912    /// # use google_cloud_speech_v2::model::Recognizer;
1913    /// let x = Recognizer::new().set_annotations([
1914    ///     ("key0", "abc"),
1915    ///     ("key1", "xyz"),
1916    /// ]);
1917    /// ```
1918    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
1919    where
1920        T: std::iter::IntoIterator<Item = (K, V)>,
1921        K: std::convert::Into<std::string::String>,
1922        V: std::convert::Into<std::string::String>,
1923    {
1924        use std::iter::Iterator;
1925        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1926        self
1927    }
1928
1929    /// Sets the value of [state][crate::model::Recognizer::state].
1930    ///
1931    /// # Example
1932    /// ```ignore,no_run
1933    /// # use google_cloud_speech_v2::model::Recognizer;
1934    /// use google_cloud_speech_v2::model::recognizer::State;
1935    /// let x0 = Recognizer::new().set_state(State::Active);
1936    /// let x1 = Recognizer::new().set_state(State::Deleted);
1937    /// ```
1938    pub fn set_state<T: std::convert::Into<crate::model::recognizer::State>>(
1939        mut self,
1940        v: T,
1941    ) -> Self {
1942        self.state = v.into();
1943        self
1944    }
1945
1946    /// Sets the value of [create_time][crate::model::Recognizer::create_time].
1947    ///
1948    /// # Example
1949    /// ```ignore,no_run
1950    /// # use google_cloud_speech_v2::model::Recognizer;
1951    /// use wkt::Timestamp;
1952    /// let x = Recognizer::new().set_create_time(Timestamp::default()/* use setters */);
1953    /// ```
1954    pub fn set_create_time<T>(mut self, v: T) -> Self
1955    where
1956        T: std::convert::Into<wkt::Timestamp>,
1957    {
1958        self.create_time = std::option::Option::Some(v.into());
1959        self
1960    }
1961
1962    /// Sets or clears the value of [create_time][crate::model::Recognizer::create_time].
1963    ///
1964    /// # Example
1965    /// ```ignore,no_run
1966    /// # use google_cloud_speech_v2::model::Recognizer;
1967    /// use wkt::Timestamp;
1968    /// let x = Recognizer::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1969    /// let x = Recognizer::new().set_or_clear_create_time(None::<Timestamp>);
1970    /// ```
1971    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1972    where
1973        T: std::convert::Into<wkt::Timestamp>,
1974    {
1975        self.create_time = v.map(|x| x.into());
1976        self
1977    }
1978
1979    /// Sets the value of [update_time][crate::model::Recognizer::update_time].
1980    ///
1981    /// # Example
1982    /// ```ignore,no_run
1983    /// # use google_cloud_speech_v2::model::Recognizer;
1984    /// use wkt::Timestamp;
1985    /// let x = Recognizer::new().set_update_time(Timestamp::default()/* use setters */);
1986    /// ```
1987    pub fn set_update_time<T>(mut self, v: T) -> Self
1988    where
1989        T: std::convert::Into<wkt::Timestamp>,
1990    {
1991        self.update_time = std::option::Option::Some(v.into());
1992        self
1993    }
1994
1995    /// Sets or clears the value of [update_time][crate::model::Recognizer::update_time].
1996    ///
1997    /// # Example
1998    /// ```ignore,no_run
1999    /// # use google_cloud_speech_v2::model::Recognizer;
2000    /// use wkt::Timestamp;
2001    /// let x = Recognizer::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2002    /// let x = Recognizer::new().set_or_clear_update_time(None::<Timestamp>);
2003    /// ```
2004    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2005    where
2006        T: std::convert::Into<wkt::Timestamp>,
2007    {
2008        self.update_time = v.map(|x| x.into());
2009        self
2010    }
2011
2012    /// Sets the value of [delete_time][crate::model::Recognizer::delete_time].
2013    ///
2014    /// # Example
2015    /// ```ignore,no_run
2016    /// # use google_cloud_speech_v2::model::Recognizer;
2017    /// use wkt::Timestamp;
2018    /// let x = Recognizer::new().set_delete_time(Timestamp::default()/* use setters */);
2019    /// ```
2020    pub fn set_delete_time<T>(mut self, v: T) -> Self
2021    where
2022        T: std::convert::Into<wkt::Timestamp>,
2023    {
2024        self.delete_time = std::option::Option::Some(v.into());
2025        self
2026    }
2027
2028    /// Sets or clears the value of [delete_time][crate::model::Recognizer::delete_time].
2029    ///
2030    /// # Example
2031    /// ```ignore,no_run
2032    /// # use google_cloud_speech_v2::model::Recognizer;
2033    /// use wkt::Timestamp;
2034    /// let x = Recognizer::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2035    /// let x = Recognizer::new().set_or_clear_delete_time(None::<Timestamp>);
2036    /// ```
2037    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2038    where
2039        T: std::convert::Into<wkt::Timestamp>,
2040    {
2041        self.delete_time = v.map(|x| x.into());
2042        self
2043    }
2044
2045    /// Sets the value of [expire_time][crate::model::Recognizer::expire_time].
2046    ///
2047    /// # Example
2048    /// ```ignore,no_run
2049    /// # use google_cloud_speech_v2::model::Recognizer;
2050    /// use wkt::Timestamp;
2051    /// let x = Recognizer::new().set_expire_time(Timestamp::default()/* use setters */);
2052    /// ```
2053    pub fn set_expire_time<T>(mut self, v: T) -> Self
2054    where
2055        T: std::convert::Into<wkt::Timestamp>,
2056    {
2057        self.expire_time = std::option::Option::Some(v.into());
2058        self
2059    }
2060
2061    /// Sets or clears the value of [expire_time][crate::model::Recognizer::expire_time].
2062    ///
2063    /// # Example
2064    /// ```ignore,no_run
2065    /// # use google_cloud_speech_v2::model::Recognizer;
2066    /// use wkt::Timestamp;
2067    /// let x = Recognizer::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
2068    /// let x = Recognizer::new().set_or_clear_expire_time(None::<Timestamp>);
2069    /// ```
2070    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
2071    where
2072        T: std::convert::Into<wkt::Timestamp>,
2073    {
2074        self.expire_time = v.map(|x| x.into());
2075        self
2076    }
2077
2078    /// Sets the value of [etag][crate::model::Recognizer::etag].
2079    ///
2080    /// # Example
2081    /// ```ignore,no_run
2082    /// # use google_cloud_speech_v2::model::Recognizer;
2083    /// let x = Recognizer::new().set_etag("example");
2084    /// ```
2085    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2086        self.etag = v.into();
2087        self
2088    }
2089
2090    /// Sets the value of [reconciling][crate::model::Recognizer::reconciling].
2091    ///
2092    /// # Example
2093    /// ```ignore,no_run
2094    /// # use google_cloud_speech_v2::model::Recognizer;
2095    /// let x = Recognizer::new().set_reconciling(true);
2096    /// ```
2097    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2098        self.reconciling = v.into();
2099        self
2100    }
2101
2102    /// Sets the value of [kms_key_name][crate::model::Recognizer::kms_key_name].
2103    ///
2104    /// # Example
2105    /// ```ignore,no_run
2106    /// # use google_cloud_speech_v2::model::Recognizer;
2107    /// let x = Recognizer::new().set_kms_key_name("example");
2108    /// ```
2109    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2110        self.kms_key_name = v.into();
2111        self
2112    }
2113
2114    /// Sets the value of [kms_key_version_name][crate::model::Recognizer::kms_key_version_name].
2115    ///
2116    /// # Example
2117    /// ```ignore,no_run
2118    /// # use google_cloud_speech_v2::model::Recognizer;
2119    /// let x = Recognizer::new().set_kms_key_version_name("example");
2120    /// ```
2121    pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
2122        mut self,
2123        v: T,
2124    ) -> Self {
2125        self.kms_key_version_name = v.into();
2126        self
2127    }
2128}
2129
2130impl wkt::message::Message for Recognizer {
2131    fn typename() -> &'static str {
2132        "type.googleapis.com/google.cloud.speech.v2.Recognizer"
2133    }
2134}
2135
2136/// Defines additional types related to [Recognizer].
2137pub mod recognizer {
2138    #[allow(unused_imports)]
2139    use super::*;
2140
2141    /// Set of states that define the lifecycle of a Recognizer.
2142    ///
2143    /// # Working with unknown values
2144    ///
2145    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2146    /// additional enum variants at any time. Adding new variants is not considered
2147    /// a breaking change. Applications should write their code in anticipation of:
2148    ///
2149    /// - New values appearing in future releases of the client library, **and**
2150    /// - New values received dynamically, without application changes.
2151    ///
2152    /// Please consult the [Working with enums] section in the user guide for some
2153    /// guidelines.
2154    ///
2155    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2156    #[derive(Clone, Debug, PartialEq)]
2157    #[non_exhaustive]
2158    pub enum State {
2159        /// The default value. This value is used if the state is omitted.
2160        Unspecified,
2161        /// The Recognizer is active and ready for use.
2162        Active,
2163        /// This Recognizer has been deleted.
2164        Deleted,
2165        /// If set, the enum was initialized with an unknown value.
2166        ///
2167        /// Applications can examine the value using [State::value] or
2168        /// [State::name].
2169        UnknownValue(state::UnknownValue),
2170    }
2171
2172    #[doc(hidden)]
2173    pub mod state {
2174        #[allow(unused_imports)]
2175        use super::*;
2176        #[derive(Clone, Debug, PartialEq)]
2177        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2178    }
2179
2180    impl State {
2181        /// Gets the enum value.
2182        ///
2183        /// Returns `None` if the enum contains an unknown value deserialized from
2184        /// the string representation of enums.
2185        pub fn value(&self) -> std::option::Option<i32> {
2186            match self {
2187                Self::Unspecified => std::option::Option::Some(0),
2188                Self::Active => std::option::Option::Some(2),
2189                Self::Deleted => std::option::Option::Some(4),
2190                Self::UnknownValue(u) => u.0.value(),
2191            }
2192        }
2193
2194        /// Gets the enum value as a string.
2195        ///
2196        /// Returns `None` if the enum contains an unknown value deserialized from
2197        /// the integer representation of enums.
2198        pub fn name(&self) -> std::option::Option<&str> {
2199            match self {
2200                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2201                Self::Active => std::option::Option::Some("ACTIVE"),
2202                Self::Deleted => std::option::Option::Some("DELETED"),
2203                Self::UnknownValue(u) => u.0.name(),
2204            }
2205        }
2206    }
2207
2208    impl std::default::Default for State {
2209        fn default() -> Self {
2210            use std::convert::From;
2211            Self::from(0)
2212        }
2213    }
2214
2215    impl std::fmt::Display for State {
2216        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2217            wkt::internal::display_enum(f, self.name(), self.value())
2218        }
2219    }
2220
2221    impl std::convert::From<i32> for State {
2222        fn from(value: i32) -> Self {
2223            match value {
2224                0 => Self::Unspecified,
2225                2 => Self::Active,
2226                4 => Self::Deleted,
2227                _ => Self::UnknownValue(state::UnknownValue(
2228                    wkt::internal::UnknownEnumValue::Integer(value),
2229                )),
2230            }
2231        }
2232    }
2233
2234    impl std::convert::From<&str> for State {
2235        fn from(value: &str) -> Self {
2236            use std::string::ToString;
2237            match value {
2238                "STATE_UNSPECIFIED" => Self::Unspecified,
2239                "ACTIVE" => Self::Active,
2240                "DELETED" => Self::Deleted,
2241                _ => Self::UnknownValue(state::UnknownValue(
2242                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2243                )),
2244            }
2245        }
2246    }
2247
2248    impl serde::ser::Serialize for State {
2249        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2250        where
2251            S: serde::Serializer,
2252        {
2253            match self {
2254                Self::Unspecified => serializer.serialize_i32(0),
2255                Self::Active => serializer.serialize_i32(2),
2256                Self::Deleted => serializer.serialize_i32(4),
2257                Self::UnknownValue(u) => u.0.serialize(serializer),
2258            }
2259        }
2260    }
2261
2262    impl<'de> serde::de::Deserialize<'de> for State {
2263        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2264        where
2265            D: serde::Deserializer<'de>,
2266        {
2267            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2268                ".google.cloud.speech.v2.Recognizer.State",
2269            ))
2270        }
2271    }
2272}
2273
2274/// Automatically detected decoding parameters.
2275/// Supported for the following encodings:
2276///
2277/// * WAV_LINEAR16: 16-bit signed little-endian PCM samples in a WAV container.
2278///
2279/// * WAV_MULAW: 8-bit companded mulaw samples in a WAV container.
2280///
2281/// * WAV_ALAW: 8-bit companded alaw samples in a WAV container.
2282///
2283/// * RFC4867_5_AMR: AMR frames with an rfc4867.5 header.
2284///
2285/// * RFC4867_5_AMRWB: AMR-WB frames with an rfc4867.5 header.
2286///
2287/// * FLAC: FLAC frames in the "native FLAC" container format.
2288///
2289/// * MP3: MPEG audio frames with optional (ignored) ID3 metadata.
2290///
2291/// * OGG_OPUS: Opus audio frames in an Ogg container.
2292///
2293/// * WEBM_OPUS: Opus audio frames in a WebM container.
2294///
2295/// * MP4_AAC: AAC audio frames in an MP4 container.
2296///
2297/// * M4A_AAC: AAC audio frames in an M4A container.
2298///
2299/// * MOV_AAC: AAC audio frames in an MOV container.
2300///
2301#[derive(Clone, Default, PartialEq)]
2302#[non_exhaustive]
2303pub struct AutoDetectDecodingConfig {
2304    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2305}
2306
2307impl AutoDetectDecodingConfig {
2308    pub fn new() -> Self {
2309        std::default::Default::default()
2310    }
2311}
2312
2313impl wkt::message::Message for AutoDetectDecodingConfig {
2314    fn typename() -> &'static str {
2315        "type.googleapis.com/google.cloud.speech.v2.AutoDetectDecodingConfig"
2316    }
2317}
2318
2319/// Explicitly specified decoding parameters.
2320#[derive(Clone, Default, PartialEq)]
2321#[non_exhaustive]
2322pub struct ExplicitDecodingConfig {
2323    /// Required. Encoding of the audio data sent for recognition.
2324    pub encoding: crate::model::explicit_decoding_config::AudioEncoding,
2325
2326    /// Optional. Sample rate in Hertz of the audio data sent for recognition.
2327    /// Valid values are: 8000-48000, and 16000 is optimal. For best results, set
2328    /// the sampling rate of the audio source to 16000 Hz. If that's not possible,
2329    /// use the native sample rate of the audio source (instead of resampling).
2330    /// Note that this field is marked as OPTIONAL for backward compatibility
2331    /// reasons. It is (and has always been) effectively REQUIRED.
2332    pub sample_rate_hertz: i32,
2333
2334    /// Optional. Number of channels present in the audio data sent for
2335    /// recognition. Note that this field is marked as OPTIONAL for backward
2336    /// compatibility reasons. It is (and has always been) effectively REQUIRED.
2337    ///
2338    /// The maximum allowed value is 8.
2339    pub audio_channel_count: i32,
2340
2341    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2342}
2343
2344impl ExplicitDecodingConfig {
2345    pub fn new() -> Self {
2346        std::default::Default::default()
2347    }
2348
2349    /// Sets the value of [encoding][crate::model::ExplicitDecodingConfig::encoding].
2350    ///
2351    /// # Example
2352    /// ```ignore,no_run
2353    /// # use google_cloud_speech_v2::model::ExplicitDecodingConfig;
2354    /// use google_cloud_speech_v2::model::explicit_decoding_config::AudioEncoding;
2355    /// let x0 = ExplicitDecodingConfig::new().set_encoding(AudioEncoding::Linear16);
2356    /// let x1 = ExplicitDecodingConfig::new().set_encoding(AudioEncoding::Mulaw);
2357    /// let x2 = ExplicitDecodingConfig::new().set_encoding(AudioEncoding::Alaw);
2358    /// ```
2359    pub fn set_encoding<
2360        T: std::convert::Into<crate::model::explicit_decoding_config::AudioEncoding>,
2361    >(
2362        mut self,
2363        v: T,
2364    ) -> Self {
2365        self.encoding = v.into();
2366        self
2367    }
2368
2369    /// Sets the value of [sample_rate_hertz][crate::model::ExplicitDecodingConfig::sample_rate_hertz].
2370    ///
2371    /// # Example
2372    /// ```ignore,no_run
2373    /// # use google_cloud_speech_v2::model::ExplicitDecodingConfig;
2374    /// let x = ExplicitDecodingConfig::new().set_sample_rate_hertz(42);
2375    /// ```
2376    pub fn set_sample_rate_hertz<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2377        self.sample_rate_hertz = v.into();
2378        self
2379    }
2380
2381    /// Sets the value of [audio_channel_count][crate::model::ExplicitDecodingConfig::audio_channel_count].
2382    ///
2383    /// # Example
2384    /// ```ignore,no_run
2385    /// # use google_cloud_speech_v2::model::ExplicitDecodingConfig;
2386    /// let x = ExplicitDecodingConfig::new().set_audio_channel_count(42);
2387    /// ```
2388    pub fn set_audio_channel_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2389        self.audio_channel_count = v.into();
2390        self
2391    }
2392}
2393
2394impl wkt::message::Message for ExplicitDecodingConfig {
2395    fn typename() -> &'static str {
2396        "type.googleapis.com/google.cloud.speech.v2.ExplicitDecodingConfig"
2397    }
2398}
2399
2400/// Defines additional types related to [ExplicitDecodingConfig].
2401pub mod explicit_decoding_config {
2402    #[allow(unused_imports)]
2403    use super::*;
2404
2405    /// Supported audio data encodings.
2406    ///
2407    /// # Working with unknown values
2408    ///
2409    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2410    /// additional enum variants at any time. Adding new variants is not considered
2411    /// a breaking change. Applications should write their code in anticipation of:
2412    ///
2413    /// - New values appearing in future releases of the client library, **and**
2414    /// - New values received dynamically, without application changes.
2415    ///
2416    /// Please consult the [Working with enums] section in the user guide for some
2417    /// guidelines.
2418    ///
2419    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2420    #[derive(Clone, Debug, PartialEq)]
2421    #[non_exhaustive]
2422    pub enum AudioEncoding {
2423        /// Default value. This value is unused.
2424        Unspecified,
2425        /// Headerless 16-bit signed little-endian PCM samples.
2426        Linear16,
2427        /// Headerless 8-bit companded mulaw samples.
2428        Mulaw,
2429        /// Headerless 8-bit companded alaw samples.
2430        Alaw,
2431        /// AMR frames with an rfc4867.5 header.
2432        Amr,
2433        /// AMR-WB frames with an rfc4867.5 header.
2434        AmrWb,
2435        /// FLAC frames in the "native FLAC" container format.
2436        Flac,
2437        /// MPEG audio frames with optional (ignored) ID3 metadata.
2438        Mp3,
2439        /// Opus audio frames in an Ogg container.
2440        OggOpus,
2441        /// Opus audio frames in a WebM container.
2442        WebmOpus,
2443        /// AAC audio frames in an MP4 container.
2444        Mp4Aac,
2445        /// AAC audio frames in an M4A container.
2446        M4AAac,
2447        /// AAC audio frames in an MOV container.
2448        MovAac,
2449        /// If set, the enum was initialized with an unknown value.
2450        ///
2451        /// Applications can examine the value using [AudioEncoding::value] or
2452        /// [AudioEncoding::name].
2453        UnknownValue(audio_encoding::UnknownValue),
2454    }
2455
2456    #[doc(hidden)]
2457    pub mod audio_encoding {
2458        #[allow(unused_imports)]
2459        use super::*;
2460        #[derive(Clone, Debug, PartialEq)]
2461        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2462    }
2463
2464    impl AudioEncoding {
2465        /// Gets the enum value.
2466        ///
2467        /// Returns `None` if the enum contains an unknown value deserialized from
2468        /// the string representation of enums.
2469        pub fn value(&self) -> std::option::Option<i32> {
2470            match self {
2471                Self::Unspecified => std::option::Option::Some(0),
2472                Self::Linear16 => std::option::Option::Some(1),
2473                Self::Mulaw => std::option::Option::Some(2),
2474                Self::Alaw => std::option::Option::Some(3),
2475                Self::Amr => std::option::Option::Some(4),
2476                Self::AmrWb => std::option::Option::Some(5),
2477                Self::Flac => std::option::Option::Some(6),
2478                Self::Mp3 => std::option::Option::Some(7),
2479                Self::OggOpus => std::option::Option::Some(8),
2480                Self::WebmOpus => std::option::Option::Some(9),
2481                Self::Mp4Aac => std::option::Option::Some(10),
2482                Self::M4AAac => std::option::Option::Some(11),
2483                Self::MovAac => std::option::Option::Some(12),
2484                Self::UnknownValue(u) => u.0.value(),
2485            }
2486        }
2487
2488        /// Gets the enum value as a string.
2489        ///
2490        /// Returns `None` if the enum contains an unknown value deserialized from
2491        /// the integer representation of enums.
2492        pub fn name(&self) -> std::option::Option<&str> {
2493            match self {
2494                Self::Unspecified => std::option::Option::Some("AUDIO_ENCODING_UNSPECIFIED"),
2495                Self::Linear16 => std::option::Option::Some("LINEAR16"),
2496                Self::Mulaw => std::option::Option::Some("MULAW"),
2497                Self::Alaw => std::option::Option::Some("ALAW"),
2498                Self::Amr => std::option::Option::Some("AMR"),
2499                Self::AmrWb => std::option::Option::Some("AMR_WB"),
2500                Self::Flac => std::option::Option::Some("FLAC"),
2501                Self::Mp3 => std::option::Option::Some("MP3"),
2502                Self::OggOpus => std::option::Option::Some("OGG_OPUS"),
2503                Self::WebmOpus => std::option::Option::Some("WEBM_OPUS"),
2504                Self::Mp4Aac => std::option::Option::Some("MP4_AAC"),
2505                Self::M4AAac => std::option::Option::Some("M4A_AAC"),
2506                Self::MovAac => std::option::Option::Some("MOV_AAC"),
2507                Self::UnknownValue(u) => u.0.name(),
2508            }
2509        }
2510    }
2511
2512    impl std::default::Default for AudioEncoding {
2513        fn default() -> Self {
2514            use std::convert::From;
2515            Self::from(0)
2516        }
2517    }
2518
2519    impl std::fmt::Display for AudioEncoding {
2520        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2521            wkt::internal::display_enum(f, self.name(), self.value())
2522        }
2523    }
2524
2525    impl std::convert::From<i32> for AudioEncoding {
2526        fn from(value: i32) -> Self {
2527            match value {
2528                0 => Self::Unspecified,
2529                1 => Self::Linear16,
2530                2 => Self::Mulaw,
2531                3 => Self::Alaw,
2532                4 => Self::Amr,
2533                5 => Self::AmrWb,
2534                6 => Self::Flac,
2535                7 => Self::Mp3,
2536                8 => Self::OggOpus,
2537                9 => Self::WebmOpus,
2538                10 => Self::Mp4Aac,
2539                11 => Self::M4AAac,
2540                12 => Self::MovAac,
2541                _ => Self::UnknownValue(audio_encoding::UnknownValue(
2542                    wkt::internal::UnknownEnumValue::Integer(value),
2543                )),
2544            }
2545        }
2546    }
2547
2548    impl std::convert::From<&str> for AudioEncoding {
2549        fn from(value: &str) -> Self {
2550            use std::string::ToString;
2551            match value {
2552                "AUDIO_ENCODING_UNSPECIFIED" => Self::Unspecified,
2553                "LINEAR16" => Self::Linear16,
2554                "MULAW" => Self::Mulaw,
2555                "ALAW" => Self::Alaw,
2556                "AMR" => Self::Amr,
2557                "AMR_WB" => Self::AmrWb,
2558                "FLAC" => Self::Flac,
2559                "MP3" => Self::Mp3,
2560                "OGG_OPUS" => Self::OggOpus,
2561                "WEBM_OPUS" => Self::WebmOpus,
2562                "MP4_AAC" => Self::Mp4Aac,
2563                "M4A_AAC" => Self::M4AAac,
2564                "MOV_AAC" => Self::MovAac,
2565                _ => Self::UnknownValue(audio_encoding::UnknownValue(
2566                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2567                )),
2568            }
2569        }
2570    }
2571
2572    impl serde::ser::Serialize for AudioEncoding {
2573        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2574        where
2575            S: serde::Serializer,
2576        {
2577            match self {
2578                Self::Unspecified => serializer.serialize_i32(0),
2579                Self::Linear16 => serializer.serialize_i32(1),
2580                Self::Mulaw => serializer.serialize_i32(2),
2581                Self::Alaw => serializer.serialize_i32(3),
2582                Self::Amr => serializer.serialize_i32(4),
2583                Self::AmrWb => serializer.serialize_i32(5),
2584                Self::Flac => serializer.serialize_i32(6),
2585                Self::Mp3 => serializer.serialize_i32(7),
2586                Self::OggOpus => serializer.serialize_i32(8),
2587                Self::WebmOpus => serializer.serialize_i32(9),
2588                Self::Mp4Aac => serializer.serialize_i32(10),
2589                Self::M4AAac => serializer.serialize_i32(11),
2590                Self::MovAac => serializer.serialize_i32(12),
2591                Self::UnknownValue(u) => u.0.serialize(serializer),
2592            }
2593        }
2594    }
2595
2596    impl<'de> serde::de::Deserialize<'de> for AudioEncoding {
2597        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2598        where
2599            D: serde::Deserializer<'de>,
2600        {
2601            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AudioEncoding>::new(
2602                ".google.cloud.speech.v2.ExplicitDecodingConfig.AudioEncoding",
2603            ))
2604        }
2605    }
2606}
2607
2608/// Configuration to enable speaker diarization.
2609#[derive(Clone, Default, PartialEq)]
2610#[non_exhaustive]
2611pub struct SpeakerDiarizationConfig {
2612    /// Required. Minimum number of speakers in the conversation. This range gives
2613    /// you more flexibility by allowing the system to automatically determine the
2614    /// correct number of speakers.
2615    ///
2616    /// To fix the number of speakers detected in the audio, set
2617    /// `min_speaker_count` = `max_speaker_count`.
2618    pub min_speaker_count: i32,
2619
2620    /// Required. Maximum number of speakers in the conversation. Valid values are:
2621    /// 1-6. Must be >= `min_speaker_count`. This range gives you more flexibility
2622    /// by allowing the system to automatically determine the correct number of
2623    /// speakers.
2624    pub max_speaker_count: i32,
2625
2626    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2627}
2628
2629impl SpeakerDiarizationConfig {
2630    pub fn new() -> Self {
2631        std::default::Default::default()
2632    }
2633
2634    /// Sets the value of [min_speaker_count][crate::model::SpeakerDiarizationConfig::min_speaker_count].
2635    ///
2636    /// # Example
2637    /// ```ignore,no_run
2638    /// # use google_cloud_speech_v2::model::SpeakerDiarizationConfig;
2639    /// let x = SpeakerDiarizationConfig::new().set_min_speaker_count(42);
2640    /// ```
2641    pub fn set_min_speaker_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2642        self.min_speaker_count = v.into();
2643        self
2644    }
2645
2646    /// Sets the value of [max_speaker_count][crate::model::SpeakerDiarizationConfig::max_speaker_count].
2647    ///
2648    /// # Example
2649    /// ```ignore,no_run
2650    /// # use google_cloud_speech_v2::model::SpeakerDiarizationConfig;
2651    /// let x = SpeakerDiarizationConfig::new().set_max_speaker_count(42);
2652    /// ```
2653    pub fn set_max_speaker_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2654        self.max_speaker_count = v.into();
2655        self
2656    }
2657}
2658
2659impl wkt::message::Message for SpeakerDiarizationConfig {
2660    fn typename() -> &'static str {
2661        "type.googleapis.com/google.cloud.speech.v2.SpeakerDiarizationConfig"
2662    }
2663}
2664
2665/// Available recognition features.
2666#[derive(Clone, Default, PartialEq)]
2667#[non_exhaustive]
2668pub struct RecognitionFeatures {
2669    /// If set to `true`, the server will attempt to filter out profanities,
2670    /// replacing all but the initial character in each filtered word with
2671    /// asterisks, for instance, "f***". If set to `false` or omitted, profanities
2672    /// won't be filtered out.
2673    pub profanity_filter: bool,
2674
2675    /// If `true`, the top result includes a list of words and the start and end
2676    /// time offsets (timestamps) for those words. If `false`, no word-level time
2677    /// offset information is returned. The default is `false`.
2678    pub enable_word_time_offsets: bool,
2679
2680    /// If `true`, the top result includes a list of words and the confidence for
2681    /// those words. If `false`, no word-level confidence information is returned.
2682    /// The default is `false`.
2683    pub enable_word_confidence: bool,
2684
2685    /// If `true`, adds punctuation to recognition result hypotheses. This feature
2686    /// is only available in select languages. The default `false` value does not
2687    /// add punctuation to result hypotheses.
2688    pub enable_automatic_punctuation: bool,
2689
2690    /// The spoken punctuation behavior for the call. If `true`, replaces spoken
2691    /// punctuation with the corresponding symbols in the request. For example,
2692    /// "how are you question mark" becomes "how are you?". See
2693    /// <https://cloud.google.com/speech-to-text/docs/spoken-punctuation> for
2694    /// support. If `false`, spoken punctuation is not replaced.
2695    pub enable_spoken_punctuation: bool,
2696
2697    /// The spoken emoji behavior for the call. If `true`, adds spoken emoji
2698    /// formatting for the request. This will replace spoken emojis with the
2699    /// corresponding Unicode symbols in the final transcript. If `false`, spoken
2700    /// emojis are not replaced.
2701    pub enable_spoken_emojis: bool,
2702
2703    /// Mode for recognizing multi-channel audio.
2704    pub multi_channel_mode: crate::model::recognition_features::MultiChannelMode,
2705
2706    /// Configuration to enable speaker diarization and set additional
2707    /// parameters to make diarization better suited for your application.
2708    /// When this is enabled, we send all the words from the beginning of the
2709    /// audio for the top alternative in every consecutive STREAMING responses.
2710    /// This is done in order to improve our speaker tags as our models learn to
2711    /// identify the speakers in the conversation over time.
2712    /// For non-streaming requests, the diarization results will be provided only
2713    /// in the top alternative of the FINAL SpeechRecognitionResult.
2714    pub diarization_config: std::option::Option<crate::model::SpeakerDiarizationConfig>,
2715
2716    /// Maximum number of recognition hypotheses to be returned.
2717    /// The server may return fewer than `max_alternatives`.
2718    /// Valid values are `0`-`30`. A value of `0` or `1` will return a maximum of
2719    /// one. If omitted, will return a maximum of one.
2720    pub max_alternatives: i32,
2721
2722    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2723}
2724
2725impl RecognitionFeatures {
2726    pub fn new() -> Self {
2727        std::default::Default::default()
2728    }
2729
2730    /// Sets the value of [profanity_filter][crate::model::RecognitionFeatures::profanity_filter].
2731    ///
2732    /// # Example
2733    /// ```ignore,no_run
2734    /// # use google_cloud_speech_v2::model::RecognitionFeatures;
2735    /// let x = RecognitionFeatures::new().set_profanity_filter(true);
2736    /// ```
2737    pub fn set_profanity_filter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2738        self.profanity_filter = v.into();
2739        self
2740    }
2741
2742    /// Sets the value of [enable_word_time_offsets][crate::model::RecognitionFeatures::enable_word_time_offsets].
2743    ///
2744    /// # Example
2745    /// ```ignore,no_run
2746    /// # use google_cloud_speech_v2::model::RecognitionFeatures;
2747    /// let x = RecognitionFeatures::new().set_enable_word_time_offsets(true);
2748    /// ```
2749    pub fn set_enable_word_time_offsets<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2750        self.enable_word_time_offsets = v.into();
2751        self
2752    }
2753
2754    /// Sets the value of [enable_word_confidence][crate::model::RecognitionFeatures::enable_word_confidence].
2755    ///
2756    /// # Example
2757    /// ```ignore,no_run
2758    /// # use google_cloud_speech_v2::model::RecognitionFeatures;
2759    /// let x = RecognitionFeatures::new().set_enable_word_confidence(true);
2760    /// ```
2761    pub fn set_enable_word_confidence<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2762        self.enable_word_confidence = v.into();
2763        self
2764    }
2765
2766    /// Sets the value of [enable_automatic_punctuation][crate::model::RecognitionFeatures::enable_automatic_punctuation].
2767    ///
2768    /// # Example
2769    /// ```ignore,no_run
2770    /// # use google_cloud_speech_v2::model::RecognitionFeatures;
2771    /// let x = RecognitionFeatures::new().set_enable_automatic_punctuation(true);
2772    /// ```
2773    pub fn set_enable_automatic_punctuation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2774        self.enable_automatic_punctuation = v.into();
2775        self
2776    }
2777
2778    /// Sets the value of [enable_spoken_punctuation][crate::model::RecognitionFeatures::enable_spoken_punctuation].
2779    ///
2780    /// # Example
2781    /// ```ignore,no_run
2782    /// # use google_cloud_speech_v2::model::RecognitionFeatures;
2783    /// let x = RecognitionFeatures::new().set_enable_spoken_punctuation(true);
2784    /// ```
2785    pub fn set_enable_spoken_punctuation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2786        self.enable_spoken_punctuation = v.into();
2787        self
2788    }
2789
2790    /// Sets the value of [enable_spoken_emojis][crate::model::RecognitionFeatures::enable_spoken_emojis].
2791    ///
2792    /// # Example
2793    /// ```ignore,no_run
2794    /// # use google_cloud_speech_v2::model::RecognitionFeatures;
2795    /// let x = RecognitionFeatures::new().set_enable_spoken_emojis(true);
2796    /// ```
2797    pub fn set_enable_spoken_emojis<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2798        self.enable_spoken_emojis = v.into();
2799        self
2800    }
2801
2802    /// Sets the value of [multi_channel_mode][crate::model::RecognitionFeatures::multi_channel_mode].
2803    ///
2804    /// # Example
2805    /// ```ignore,no_run
2806    /// # use google_cloud_speech_v2::model::RecognitionFeatures;
2807    /// use google_cloud_speech_v2::model::recognition_features::MultiChannelMode;
2808    /// let x0 = RecognitionFeatures::new().set_multi_channel_mode(MultiChannelMode::SeparateRecognitionPerChannel);
2809    /// ```
2810    pub fn set_multi_channel_mode<
2811        T: std::convert::Into<crate::model::recognition_features::MultiChannelMode>,
2812    >(
2813        mut self,
2814        v: T,
2815    ) -> Self {
2816        self.multi_channel_mode = v.into();
2817        self
2818    }
2819
2820    /// Sets the value of [diarization_config][crate::model::RecognitionFeatures::diarization_config].
2821    ///
2822    /// # Example
2823    /// ```ignore,no_run
2824    /// # use google_cloud_speech_v2::model::RecognitionFeatures;
2825    /// use google_cloud_speech_v2::model::SpeakerDiarizationConfig;
2826    /// let x = RecognitionFeatures::new().set_diarization_config(SpeakerDiarizationConfig::default()/* use setters */);
2827    /// ```
2828    pub fn set_diarization_config<T>(mut self, v: T) -> Self
2829    where
2830        T: std::convert::Into<crate::model::SpeakerDiarizationConfig>,
2831    {
2832        self.diarization_config = std::option::Option::Some(v.into());
2833        self
2834    }
2835
2836    /// Sets or clears the value of [diarization_config][crate::model::RecognitionFeatures::diarization_config].
2837    ///
2838    /// # Example
2839    /// ```ignore,no_run
2840    /// # use google_cloud_speech_v2::model::RecognitionFeatures;
2841    /// use google_cloud_speech_v2::model::SpeakerDiarizationConfig;
2842    /// let x = RecognitionFeatures::new().set_or_clear_diarization_config(Some(SpeakerDiarizationConfig::default()/* use setters */));
2843    /// let x = RecognitionFeatures::new().set_or_clear_diarization_config(None::<SpeakerDiarizationConfig>);
2844    /// ```
2845    pub fn set_or_clear_diarization_config<T>(mut self, v: std::option::Option<T>) -> Self
2846    where
2847        T: std::convert::Into<crate::model::SpeakerDiarizationConfig>,
2848    {
2849        self.diarization_config = v.map(|x| x.into());
2850        self
2851    }
2852
2853    /// Sets the value of [max_alternatives][crate::model::RecognitionFeatures::max_alternatives].
2854    ///
2855    /// # Example
2856    /// ```ignore,no_run
2857    /// # use google_cloud_speech_v2::model::RecognitionFeatures;
2858    /// let x = RecognitionFeatures::new().set_max_alternatives(42);
2859    /// ```
2860    pub fn set_max_alternatives<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2861        self.max_alternatives = v.into();
2862        self
2863    }
2864}
2865
2866impl wkt::message::Message for RecognitionFeatures {
2867    fn typename() -> &'static str {
2868        "type.googleapis.com/google.cloud.speech.v2.RecognitionFeatures"
2869    }
2870}
2871
2872/// Defines additional types related to [RecognitionFeatures].
2873pub mod recognition_features {
2874    #[allow(unused_imports)]
2875    use super::*;
2876
2877    /// Options for how to recognize multi-channel audio.
2878    ///
2879    /// # Working with unknown values
2880    ///
2881    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2882    /// additional enum variants at any time. Adding new variants is not considered
2883    /// a breaking change. Applications should write their code in anticipation of:
2884    ///
2885    /// - New values appearing in future releases of the client library, **and**
2886    /// - New values received dynamically, without application changes.
2887    ///
2888    /// Please consult the [Working with enums] section in the user guide for some
2889    /// guidelines.
2890    ///
2891    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2892    #[derive(Clone, Debug, PartialEq)]
2893    #[non_exhaustive]
2894    pub enum MultiChannelMode {
2895        /// Default value for the multi-channel mode. If the audio contains
2896        /// multiple channels, only the first channel will be transcribed; other
2897        /// channels will be ignored.
2898        Unspecified,
2899        /// If selected, each channel in the provided audio is transcribed
2900        /// independently. This cannot be selected if the selected
2901        /// [model][google.cloud.speech.v2.Recognizer.model] is `latest_short`.
2902        ///
2903        /// [google.cloud.speech.v2.Recognizer.model]: crate::model::Recognizer::model
2904        SeparateRecognitionPerChannel,
2905        /// If set, the enum was initialized with an unknown value.
2906        ///
2907        /// Applications can examine the value using [MultiChannelMode::value] or
2908        /// [MultiChannelMode::name].
2909        UnknownValue(multi_channel_mode::UnknownValue),
2910    }
2911
2912    #[doc(hidden)]
2913    pub mod multi_channel_mode {
2914        #[allow(unused_imports)]
2915        use super::*;
2916        #[derive(Clone, Debug, PartialEq)]
2917        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2918    }
2919
2920    impl MultiChannelMode {
2921        /// Gets the enum value.
2922        ///
2923        /// Returns `None` if the enum contains an unknown value deserialized from
2924        /// the string representation of enums.
2925        pub fn value(&self) -> std::option::Option<i32> {
2926            match self {
2927                Self::Unspecified => std::option::Option::Some(0),
2928                Self::SeparateRecognitionPerChannel => std::option::Option::Some(1),
2929                Self::UnknownValue(u) => u.0.value(),
2930            }
2931        }
2932
2933        /// Gets the enum value as a string.
2934        ///
2935        /// Returns `None` if the enum contains an unknown value deserialized from
2936        /// the integer representation of enums.
2937        pub fn name(&self) -> std::option::Option<&str> {
2938            match self {
2939                Self::Unspecified => std::option::Option::Some("MULTI_CHANNEL_MODE_UNSPECIFIED"),
2940                Self::SeparateRecognitionPerChannel => {
2941                    std::option::Option::Some("SEPARATE_RECOGNITION_PER_CHANNEL")
2942                }
2943                Self::UnknownValue(u) => u.0.name(),
2944            }
2945        }
2946    }
2947
2948    impl std::default::Default for MultiChannelMode {
2949        fn default() -> Self {
2950            use std::convert::From;
2951            Self::from(0)
2952        }
2953    }
2954
2955    impl std::fmt::Display for MultiChannelMode {
2956        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2957            wkt::internal::display_enum(f, self.name(), self.value())
2958        }
2959    }
2960
2961    impl std::convert::From<i32> for MultiChannelMode {
2962        fn from(value: i32) -> Self {
2963            match value {
2964                0 => Self::Unspecified,
2965                1 => Self::SeparateRecognitionPerChannel,
2966                _ => Self::UnknownValue(multi_channel_mode::UnknownValue(
2967                    wkt::internal::UnknownEnumValue::Integer(value),
2968                )),
2969            }
2970        }
2971    }
2972
2973    impl std::convert::From<&str> for MultiChannelMode {
2974        fn from(value: &str) -> Self {
2975            use std::string::ToString;
2976            match value {
2977                "MULTI_CHANNEL_MODE_UNSPECIFIED" => Self::Unspecified,
2978                "SEPARATE_RECOGNITION_PER_CHANNEL" => Self::SeparateRecognitionPerChannel,
2979                _ => Self::UnknownValue(multi_channel_mode::UnknownValue(
2980                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2981                )),
2982            }
2983        }
2984    }
2985
2986    impl serde::ser::Serialize for MultiChannelMode {
2987        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2988        where
2989            S: serde::Serializer,
2990        {
2991            match self {
2992                Self::Unspecified => serializer.serialize_i32(0),
2993                Self::SeparateRecognitionPerChannel => serializer.serialize_i32(1),
2994                Self::UnknownValue(u) => u.0.serialize(serializer),
2995            }
2996        }
2997    }
2998
2999    impl<'de> serde::de::Deserialize<'de> for MultiChannelMode {
3000        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3001        where
3002            D: serde::Deserializer<'de>,
3003        {
3004            deserializer.deserialize_any(wkt::internal::EnumVisitor::<MultiChannelMode>::new(
3005                ".google.cloud.speech.v2.RecognitionFeatures.MultiChannelMode",
3006            ))
3007        }
3008    }
3009}
3010
3011/// Transcription normalization configuration. Use transcription normalization
3012/// to automatically replace parts of the transcript with phrases of your
3013/// choosing. For StreamingRecognize, this normalization only applies to stable
3014/// partial transcripts (stability > 0.8) and final transcripts.
3015#[derive(Clone, Default, PartialEq)]
3016#[non_exhaustive]
3017pub struct TranscriptNormalization {
3018    /// A list of replacement entries. We will perform replacement with one entry
3019    /// at a time. For example, the second entry in ["cat" => "dog", "mountain cat"
3020    /// => "mountain dog"] will never be applied because we will always process the
3021    /// first entry before it. At most 100 entries.
3022    pub entries: std::vec::Vec<crate::model::transcript_normalization::Entry>,
3023
3024    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3025}
3026
3027impl TranscriptNormalization {
3028    pub fn new() -> Self {
3029        std::default::Default::default()
3030    }
3031
3032    /// Sets the value of [entries][crate::model::TranscriptNormalization::entries].
3033    ///
3034    /// # Example
3035    /// ```ignore,no_run
3036    /// # use google_cloud_speech_v2::model::TranscriptNormalization;
3037    /// use google_cloud_speech_v2::model::transcript_normalization::Entry;
3038    /// let x = TranscriptNormalization::new()
3039    ///     .set_entries([
3040    ///         Entry::default()/* use setters */,
3041    ///         Entry::default()/* use (different) setters */,
3042    ///     ]);
3043    /// ```
3044    pub fn set_entries<T, V>(mut self, v: T) -> Self
3045    where
3046        T: std::iter::IntoIterator<Item = V>,
3047        V: std::convert::Into<crate::model::transcript_normalization::Entry>,
3048    {
3049        use std::iter::Iterator;
3050        self.entries = v.into_iter().map(|i| i.into()).collect();
3051        self
3052    }
3053}
3054
3055impl wkt::message::Message for TranscriptNormalization {
3056    fn typename() -> &'static str {
3057        "type.googleapis.com/google.cloud.speech.v2.TranscriptNormalization"
3058    }
3059}
3060
3061/// Defines additional types related to [TranscriptNormalization].
3062pub mod transcript_normalization {
3063    #[allow(unused_imports)]
3064    use super::*;
3065
3066    /// A single replacement configuration.
3067    #[derive(Clone, Default, PartialEq)]
3068    #[non_exhaustive]
3069    pub struct Entry {
3070        /// What to replace. Max length is 100 characters.
3071        pub search: std::string::String,
3072
3073        /// What to replace with. Max length is 100 characters.
3074        pub replace: std::string::String,
3075
3076        /// Whether the search is case sensitive.
3077        pub case_sensitive: bool,
3078
3079        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3080    }
3081
3082    impl Entry {
3083        pub fn new() -> Self {
3084            std::default::Default::default()
3085        }
3086
3087        /// Sets the value of [search][crate::model::transcript_normalization::Entry::search].
3088        ///
3089        /// # Example
3090        /// ```ignore,no_run
3091        /// # use google_cloud_speech_v2::model::transcript_normalization::Entry;
3092        /// let x = Entry::new().set_search("example");
3093        /// ```
3094        pub fn set_search<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3095            self.search = v.into();
3096            self
3097        }
3098
3099        /// Sets the value of [replace][crate::model::transcript_normalization::Entry::replace].
3100        ///
3101        /// # Example
3102        /// ```ignore,no_run
3103        /// # use google_cloud_speech_v2::model::transcript_normalization::Entry;
3104        /// let x = Entry::new().set_replace("example");
3105        /// ```
3106        pub fn set_replace<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3107            self.replace = v.into();
3108            self
3109        }
3110
3111        /// Sets the value of [case_sensitive][crate::model::transcript_normalization::Entry::case_sensitive].
3112        ///
3113        /// # Example
3114        /// ```ignore,no_run
3115        /// # use google_cloud_speech_v2::model::transcript_normalization::Entry;
3116        /// let x = Entry::new().set_case_sensitive(true);
3117        /// ```
3118        pub fn set_case_sensitive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3119            self.case_sensitive = v.into();
3120            self
3121        }
3122    }
3123
3124    impl wkt::message::Message for Entry {
3125        fn typename() -> &'static str {
3126            "type.googleapis.com/google.cloud.speech.v2.TranscriptNormalization.Entry"
3127        }
3128    }
3129}
3130
3131/// Translation configuration. Use to translate the given audio into text for the
3132/// desired language.
3133#[derive(Clone, Default, PartialEq)]
3134#[non_exhaustive]
3135pub struct TranslationConfig {
3136    /// Required. The language code to translate to.
3137    pub target_language: std::string::String,
3138
3139    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3140}
3141
3142impl TranslationConfig {
3143    pub fn new() -> Self {
3144        std::default::Default::default()
3145    }
3146
3147    /// Sets the value of [target_language][crate::model::TranslationConfig::target_language].
3148    ///
3149    /// # Example
3150    /// ```ignore,no_run
3151    /// # use google_cloud_speech_v2::model::TranslationConfig;
3152    /// let x = TranslationConfig::new().set_target_language("example");
3153    /// ```
3154    pub fn set_target_language<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3155        self.target_language = v.into();
3156        self
3157    }
3158}
3159
3160impl wkt::message::Message for TranslationConfig {
3161    fn typename() -> &'static str {
3162        "type.googleapis.com/google.cloud.speech.v2.TranslationConfig"
3163    }
3164}
3165
3166/// Provides "hints" to the speech recognizer to favor specific words and phrases
3167/// in the results. PhraseSets can be specified as an inline resource, or a
3168/// reference to an existing PhraseSet resource.
3169#[derive(Clone, Default, PartialEq)]
3170#[non_exhaustive]
3171pub struct SpeechAdaptation {
3172    /// A list of inline or referenced PhraseSets.
3173    pub phrase_sets: std::vec::Vec<crate::model::speech_adaptation::AdaptationPhraseSet>,
3174
3175    /// A list of inline CustomClasses. Existing CustomClass resources can be
3176    /// referenced directly in a PhraseSet.
3177    pub custom_classes: std::vec::Vec<crate::model::CustomClass>,
3178
3179    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3180}
3181
3182impl SpeechAdaptation {
3183    pub fn new() -> Self {
3184        std::default::Default::default()
3185    }
3186
3187    /// Sets the value of [phrase_sets][crate::model::SpeechAdaptation::phrase_sets].
3188    ///
3189    /// # Example
3190    /// ```ignore,no_run
3191    /// # use google_cloud_speech_v2::model::SpeechAdaptation;
3192    /// use google_cloud_speech_v2::model::speech_adaptation::AdaptationPhraseSet;
3193    /// let x = SpeechAdaptation::new()
3194    ///     .set_phrase_sets([
3195    ///         AdaptationPhraseSet::default()/* use setters */,
3196    ///         AdaptationPhraseSet::default()/* use (different) setters */,
3197    ///     ]);
3198    /// ```
3199    pub fn set_phrase_sets<T, V>(mut self, v: T) -> Self
3200    where
3201        T: std::iter::IntoIterator<Item = V>,
3202        V: std::convert::Into<crate::model::speech_adaptation::AdaptationPhraseSet>,
3203    {
3204        use std::iter::Iterator;
3205        self.phrase_sets = v.into_iter().map(|i| i.into()).collect();
3206        self
3207    }
3208
3209    /// Sets the value of [custom_classes][crate::model::SpeechAdaptation::custom_classes].
3210    ///
3211    /// # Example
3212    /// ```ignore,no_run
3213    /// # use google_cloud_speech_v2::model::SpeechAdaptation;
3214    /// use google_cloud_speech_v2::model::CustomClass;
3215    /// let x = SpeechAdaptation::new()
3216    ///     .set_custom_classes([
3217    ///         CustomClass::default()/* use setters */,
3218    ///         CustomClass::default()/* use (different) setters */,
3219    ///     ]);
3220    /// ```
3221    pub fn set_custom_classes<T, V>(mut self, v: T) -> Self
3222    where
3223        T: std::iter::IntoIterator<Item = V>,
3224        V: std::convert::Into<crate::model::CustomClass>,
3225    {
3226        use std::iter::Iterator;
3227        self.custom_classes = v.into_iter().map(|i| i.into()).collect();
3228        self
3229    }
3230}
3231
3232impl wkt::message::Message for SpeechAdaptation {
3233    fn typename() -> &'static str {
3234        "type.googleapis.com/google.cloud.speech.v2.SpeechAdaptation"
3235    }
3236}
3237
3238/// Defines additional types related to [SpeechAdaptation].
3239pub mod speech_adaptation {
3240    #[allow(unused_imports)]
3241    use super::*;
3242
3243    /// A biasing PhraseSet, which can be either a string referencing the name of
3244    /// an existing PhraseSets resource, or an inline definition of a PhraseSet.
3245    #[derive(Clone, Default, PartialEq)]
3246    #[non_exhaustive]
3247    pub struct AdaptationPhraseSet {
3248        pub value:
3249            std::option::Option<crate::model::speech_adaptation::adaptation_phrase_set::Value>,
3250
3251        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3252    }
3253
3254    impl AdaptationPhraseSet {
3255        pub fn new() -> Self {
3256            std::default::Default::default()
3257        }
3258
3259        /// Sets the value of [value][crate::model::speech_adaptation::AdaptationPhraseSet::value].
3260        ///
3261        /// Note that all the setters affecting `value` are mutually
3262        /// exclusive.
3263        ///
3264        /// # Example
3265        /// ```ignore,no_run
3266        /// # use google_cloud_speech_v2::model::speech_adaptation::AdaptationPhraseSet;
3267        /// use google_cloud_speech_v2::model::speech_adaptation::adaptation_phrase_set::Value;
3268        /// let x = AdaptationPhraseSet::new().set_value(Some(Value::PhraseSet("example".to_string())));
3269        /// ```
3270        pub fn set_value<
3271            T: std::convert::Into<
3272                    std::option::Option<
3273                        crate::model::speech_adaptation::adaptation_phrase_set::Value,
3274                    >,
3275                >,
3276        >(
3277            mut self,
3278            v: T,
3279        ) -> Self {
3280            self.value = v.into();
3281            self
3282        }
3283
3284        /// The value of [value][crate::model::speech_adaptation::AdaptationPhraseSet::value]
3285        /// if it holds a `PhraseSet`, `None` if the field is not set or
3286        /// holds a different branch.
3287        pub fn phrase_set(&self) -> std::option::Option<&std::string::String> {
3288            #[allow(unreachable_patterns)]
3289            self.value.as_ref().and_then(|v| match v {
3290                crate::model::speech_adaptation::adaptation_phrase_set::Value::PhraseSet(v) => {
3291                    std::option::Option::Some(v)
3292                }
3293                _ => std::option::Option::None,
3294            })
3295        }
3296
3297        /// Sets the value of [value][crate::model::speech_adaptation::AdaptationPhraseSet::value]
3298        /// to hold a `PhraseSet`.
3299        ///
3300        /// Note that all the setters affecting `value` are
3301        /// mutually exclusive.
3302        ///
3303        /// # Example
3304        /// ```ignore,no_run
3305        /// # use google_cloud_speech_v2::model::speech_adaptation::AdaptationPhraseSet;
3306        /// let x = AdaptationPhraseSet::new().set_phrase_set("example");
3307        /// assert!(x.phrase_set().is_some());
3308        /// assert!(x.inline_phrase_set().is_none());
3309        /// ```
3310        pub fn set_phrase_set<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3311            self.value = std::option::Option::Some(
3312                crate::model::speech_adaptation::adaptation_phrase_set::Value::PhraseSet(v.into()),
3313            );
3314            self
3315        }
3316
3317        /// The value of [value][crate::model::speech_adaptation::AdaptationPhraseSet::value]
3318        /// if it holds a `InlinePhraseSet`, `None` if the field is not set or
3319        /// holds a different branch.
3320        pub fn inline_phrase_set(
3321            &self,
3322        ) -> std::option::Option<&std::boxed::Box<crate::model::PhraseSet>> {
3323            #[allow(unreachable_patterns)]
3324            self.value.as_ref().and_then(|v| match v {
3325                crate::model::speech_adaptation::adaptation_phrase_set::Value::InlinePhraseSet(
3326                    v,
3327                ) => std::option::Option::Some(v),
3328                _ => std::option::Option::None,
3329            })
3330        }
3331
3332        /// Sets the value of [value][crate::model::speech_adaptation::AdaptationPhraseSet::value]
3333        /// to hold a `InlinePhraseSet`.
3334        ///
3335        /// Note that all the setters affecting `value` are
3336        /// mutually exclusive.
3337        ///
3338        /// # Example
3339        /// ```ignore,no_run
3340        /// # use google_cloud_speech_v2::model::speech_adaptation::AdaptationPhraseSet;
3341        /// use google_cloud_speech_v2::model::PhraseSet;
3342        /// let x = AdaptationPhraseSet::new().set_inline_phrase_set(PhraseSet::default()/* use setters */);
3343        /// assert!(x.inline_phrase_set().is_some());
3344        /// assert!(x.phrase_set().is_none());
3345        /// ```
3346        pub fn set_inline_phrase_set<
3347            T: std::convert::Into<std::boxed::Box<crate::model::PhraseSet>>,
3348        >(
3349            mut self,
3350            v: T,
3351        ) -> Self {
3352            self.value = std::option::Option::Some(
3353                crate::model::speech_adaptation::adaptation_phrase_set::Value::InlinePhraseSet(
3354                    v.into(),
3355                ),
3356            );
3357            self
3358        }
3359    }
3360
3361    impl wkt::message::Message for AdaptationPhraseSet {
3362        fn typename() -> &'static str {
3363            "type.googleapis.com/google.cloud.speech.v2.SpeechAdaptation.AdaptationPhraseSet"
3364        }
3365    }
3366
3367    /// Defines additional types related to [AdaptationPhraseSet].
3368    pub mod adaptation_phrase_set {
3369        #[allow(unused_imports)]
3370        use super::*;
3371
3372        #[derive(Clone, Debug, PartialEq)]
3373        #[non_exhaustive]
3374        pub enum Value {
3375            /// The name of an existing PhraseSet resource. The user must have read
3376            /// access to the resource and it must not be deleted.
3377            PhraseSet(std::string::String),
3378            /// An inline defined PhraseSet.
3379            InlinePhraseSet(std::boxed::Box<crate::model::PhraseSet>),
3380        }
3381    }
3382}
3383
3384/// Denoiser config. May not be supported for all models and may
3385/// have no effect.
3386#[derive(Clone, Default, PartialEq)]
3387#[non_exhaustive]
3388pub struct DenoiserConfig {
3389    /// Denoise audio before sending to the transcription model.
3390    pub denoise_audio: bool,
3391
3392    /// Signal-to-Noise Ratio (SNR) threshold for the denoiser. Here SNR means the
3393    /// loudness of the speech signal. Audio with an SNR below this threshold,
3394    /// meaning the speech is too quiet, will be prevented from being sent to the
3395    /// transcription model.
3396    ///
3397    /// If snr_threshold=0, no filtering will be applied.
3398    pub snr_threshold: f32,
3399
3400    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3401}
3402
3403impl DenoiserConfig {
3404    pub fn new() -> Self {
3405        std::default::Default::default()
3406    }
3407
3408    /// Sets the value of [denoise_audio][crate::model::DenoiserConfig::denoise_audio].
3409    ///
3410    /// # Example
3411    /// ```ignore,no_run
3412    /// # use google_cloud_speech_v2::model::DenoiserConfig;
3413    /// let x = DenoiserConfig::new().set_denoise_audio(true);
3414    /// ```
3415    pub fn set_denoise_audio<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3416        self.denoise_audio = v.into();
3417        self
3418    }
3419
3420    /// Sets the value of [snr_threshold][crate::model::DenoiserConfig::snr_threshold].
3421    ///
3422    /// # Example
3423    /// ```ignore,no_run
3424    /// # use google_cloud_speech_v2::model::DenoiserConfig;
3425    /// let x = DenoiserConfig::new().set_snr_threshold(42.0);
3426    /// ```
3427    pub fn set_snr_threshold<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3428        self.snr_threshold = v.into();
3429        self
3430    }
3431}
3432
3433impl wkt::message::Message for DenoiserConfig {
3434    fn typename() -> &'static str {
3435        "type.googleapis.com/google.cloud.speech.v2.DenoiserConfig"
3436    }
3437}
3438
3439/// Provides information to the Recognizer that specifies how to process the
3440/// recognition request.
3441#[derive(Clone, Default, PartialEq)]
3442#[non_exhaustive]
3443pub struct RecognitionConfig {
3444    /// Optional. Which model to use for recognition requests. Select the model
3445    /// best suited to your domain to get best results.
3446    ///
3447    /// Guidance for choosing which model to use can be found in the [Transcription
3448    /// Models
3449    /// Documentation](https://cloud.google.com/speech-to-text/v2/docs/transcription-model)
3450    /// and the models supported in each region can be found in the [Table Of
3451    /// Supported
3452    /// Models](https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages).
3453    pub model: std::string::String,
3454
3455    /// Optional. The language of the supplied audio as a
3456    /// [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
3457    /// Language tags are normalized to BCP-47 before they are used eg "en-us"
3458    /// becomes "en-US".
3459    ///
3460    /// Supported languages for each model are listed in the [Table of Supported
3461    /// Models](https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages).
3462    ///
3463    /// If additional languages are provided, recognition result will contain
3464    /// recognition in the most likely language detected. The recognition result
3465    /// will include the language tag of the language detected in the audio.
3466    pub language_codes: std::vec::Vec<std::string::String>,
3467
3468    /// Speech recognition features to enable.
3469    pub features: std::option::Option<crate::model::RecognitionFeatures>,
3470
3471    /// Speech adaptation context that weights recognizer predictions for specific
3472    /// words and phrases.
3473    pub adaptation: std::option::Option<crate::model::SpeechAdaptation>,
3474
3475    /// Optional. Use transcription normalization to automatically replace parts of
3476    /// the transcript with phrases of your choosing. For StreamingRecognize, this
3477    /// normalization only applies to stable partial transcripts (stability > 0.8)
3478    /// and final transcripts.
3479    pub transcript_normalization: std::option::Option<crate::model::TranscriptNormalization>,
3480
3481    /// Optional. Optional configuration used to automatically run translation on
3482    /// the given audio to the desired language for supported models.
3483    pub translation_config: std::option::Option<crate::model::TranslationConfig>,
3484
3485    /// Optional. Optional denoiser config. May not be supported for all models
3486    /// and may have no effect.
3487    pub denoiser_config: std::option::Option<crate::model::DenoiserConfig>,
3488
3489    /// Decoding parameters for audio being sent for recognition.
3490    pub decoding_config: std::option::Option<crate::model::recognition_config::DecodingConfig>,
3491
3492    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3493}
3494
3495impl RecognitionConfig {
3496    pub fn new() -> Self {
3497        std::default::Default::default()
3498    }
3499
3500    /// Sets the value of [model][crate::model::RecognitionConfig::model].
3501    ///
3502    /// # Example
3503    /// ```ignore,no_run
3504    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3505    /// let x = RecognitionConfig::new().set_model("example");
3506    /// ```
3507    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3508        self.model = v.into();
3509        self
3510    }
3511
3512    /// Sets the value of [language_codes][crate::model::RecognitionConfig::language_codes].
3513    ///
3514    /// # Example
3515    /// ```ignore,no_run
3516    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3517    /// let x = RecognitionConfig::new().set_language_codes(["a", "b", "c"]);
3518    /// ```
3519    pub fn set_language_codes<T, V>(mut self, v: T) -> Self
3520    where
3521        T: std::iter::IntoIterator<Item = V>,
3522        V: std::convert::Into<std::string::String>,
3523    {
3524        use std::iter::Iterator;
3525        self.language_codes = v.into_iter().map(|i| i.into()).collect();
3526        self
3527    }
3528
3529    /// Sets the value of [features][crate::model::RecognitionConfig::features].
3530    ///
3531    /// # Example
3532    /// ```ignore,no_run
3533    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3534    /// use google_cloud_speech_v2::model::RecognitionFeatures;
3535    /// let x = RecognitionConfig::new().set_features(RecognitionFeatures::default()/* use setters */);
3536    /// ```
3537    pub fn set_features<T>(mut self, v: T) -> Self
3538    where
3539        T: std::convert::Into<crate::model::RecognitionFeatures>,
3540    {
3541        self.features = std::option::Option::Some(v.into());
3542        self
3543    }
3544
3545    /// Sets or clears the value of [features][crate::model::RecognitionConfig::features].
3546    ///
3547    /// # Example
3548    /// ```ignore,no_run
3549    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3550    /// use google_cloud_speech_v2::model::RecognitionFeatures;
3551    /// let x = RecognitionConfig::new().set_or_clear_features(Some(RecognitionFeatures::default()/* use setters */));
3552    /// let x = RecognitionConfig::new().set_or_clear_features(None::<RecognitionFeatures>);
3553    /// ```
3554    pub fn set_or_clear_features<T>(mut self, v: std::option::Option<T>) -> Self
3555    where
3556        T: std::convert::Into<crate::model::RecognitionFeatures>,
3557    {
3558        self.features = v.map(|x| x.into());
3559        self
3560    }
3561
3562    /// Sets the value of [adaptation][crate::model::RecognitionConfig::adaptation].
3563    ///
3564    /// # Example
3565    /// ```ignore,no_run
3566    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3567    /// use google_cloud_speech_v2::model::SpeechAdaptation;
3568    /// let x = RecognitionConfig::new().set_adaptation(SpeechAdaptation::default()/* use setters */);
3569    /// ```
3570    pub fn set_adaptation<T>(mut self, v: T) -> Self
3571    where
3572        T: std::convert::Into<crate::model::SpeechAdaptation>,
3573    {
3574        self.adaptation = std::option::Option::Some(v.into());
3575        self
3576    }
3577
3578    /// Sets or clears the value of [adaptation][crate::model::RecognitionConfig::adaptation].
3579    ///
3580    /// # Example
3581    /// ```ignore,no_run
3582    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3583    /// use google_cloud_speech_v2::model::SpeechAdaptation;
3584    /// let x = RecognitionConfig::new().set_or_clear_adaptation(Some(SpeechAdaptation::default()/* use setters */));
3585    /// let x = RecognitionConfig::new().set_or_clear_adaptation(None::<SpeechAdaptation>);
3586    /// ```
3587    pub fn set_or_clear_adaptation<T>(mut self, v: std::option::Option<T>) -> Self
3588    where
3589        T: std::convert::Into<crate::model::SpeechAdaptation>,
3590    {
3591        self.adaptation = v.map(|x| x.into());
3592        self
3593    }
3594
3595    /// Sets the value of [transcript_normalization][crate::model::RecognitionConfig::transcript_normalization].
3596    ///
3597    /// # Example
3598    /// ```ignore,no_run
3599    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3600    /// use google_cloud_speech_v2::model::TranscriptNormalization;
3601    /// let x = RecognitionConfig::new().set_transcript_normalization(TranscriptNormalization::default()/* use setters */);
3602    /// ```
3603    pub fn set_transcript_normalization<T>(mut self, v: T) -> Self
3604    where
3605        T: std::convert::Into<crate::model::TranscriptNormalization>,
3606    {
3607        self.transcript_normalization = std::option::Option::Some(v.into());
3608        self
3609    }
3610
3611    /// Sets or clears the value of [transcript_normalization][crate::model::RecognitionConfig::transcript_normalization].
3612    ///
3613    /// # Example
3614    /// ```ignore,no_run
3615    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3616    /// use google_cloud_speech_v2::model::TranscriptNormalization;
3617    /// let x = RecognitionConfig::new().set_or_clear_transcript_normalization(Some(TranscriptNormalization::default()/* use setters */));
3618    /// let x = RecognitionConfig::new().set_or_clear_transcript_normalization(None::<TranscriptNormalization>);
3619    /// ```
3620    pub fn set_or_clear_transcript_normalization<T>(mut self, v: std::option::Option<T>) -> Self
3621    where
3622        T: std::convert::Into<crate::model::TranscriptNormalization>,
3623    {
3624        self.transcript_normalization = v.map(|x| x.into());
3625        self
3626    }
3627
3628    /// Sets the value of [translation_config][crate::model::RecognitionConfig::translation_config].
3629    ///
3630    /// # Example
3631    /// ```ignore,no_run
3632    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3633    /// use google_cloud_speech_v2::model::TranslationConfig;
3634    /// let x = RecognitionConfig::new().set_translation_config(TranslationConfig::default()/* use setters */);
3635    /// ```
3636    pub fn set_translation_config<T>(mut self, v: T) -> Self
3637    where
3638        T: std::convert::Into<crate::model::TranslationConfig>,
3639    {
3640        self.translation_config = std::option::Option::Some(v.into());
3641        self
3642    }
3643
3644    /// Sets or clears the value of [translation_config][crate::model::RecognitionConfig::translation_config].
3645    ///
3646    /// # Example
3647    /// ```ignore,no_run
3648    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3649    /// use google_cloud_speech_v2::model::TranslationConfig;
3650    /// let x = RecognitionConfig::new().set_or_clear_translation_config(Some(TranslationConfig::default()/* use setters */));
3651    /// let x = RecognitionConfig::new().set_or_clear_translation_config(None::<TranslationConfig>);
3652    /// ```
3653    pub fn set_or_clear_translation_config<T>(mut self, v: std::option::Option<T>) -> Self
3654    where
3655        T: std::convert::Into<crate::model::TranslationConfig>,
3656    {
3657        self.translation_config = v.map(|x| x.into());
3658        self
3659    }
3660
3661    /// Sets the value of [denoiser_config][crate::model::RecognitionConfig::denoiser_config].
3662    ///
3663    /// # Example
3664    /// ```ignore,no_run
3665    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3666    /// use google_cloud_speech_v2::model::DenoiserConfig;
3667    /// let x = RecognitionConfig::new().set_denoiser_config(DenoiserConfig::default()/* use setters */);
3668    /// ```
3669    pub fn set_denoiser_config<T>(mut self, v: T) -> Self
3670    where
3671        T: std::convert::Into<crate::model::DenoiserConfig>,
3672    {
3673        self.denoiser_config = std::option::Option::Some(v.into());
3674        self
3675    }
3676
3677    /// Sets or clears the value of [denoiser_config][crate::model::RecognitionConfig::denoiser_config].
3678    ///
3679    /// # Example
3680    /// ```ignore,no_run
3681    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3682    /// use google_cloud_speech_v2::model::DenoiserConfig;
3683    /// let x = RecognitionConfig::new().set_or_clear_denoiser_config(Some(DenoiserConfig::default()/* use setters */));
3684    /// let x = RecognitionConfig::new().set_or_clear_denoiser_config(None::<DenoiserConfig>);
3685    /// ```
3686    pub fn set_or_clear_denoiser_config<T>(mut self, v: std::option::Option<T>) -> Self
3687    where
3688        T: std::convert::Into<crate::model::DenoiserConfig>,
3689    {
3690        self.denoiser_config = v.map(|x| x.into());
3691        self
3692    }
3693
3694    /// Sets the value of [decoding_config][crate::model::RecognitionConfig::decoding_config].
3695    ///
3696    /// Note that all the setters affecting `decoding_config` are mutually
3697    /// exclusive.
3698    ///
3699    /// # Example
3700    /// ```ignore,no_run
3701    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3702    /// use google_cloud_speech_v2::model::AutoDetectDecodingConfig;
3703    /// let x = RecognitionConfig::new().set_decoding_config(Some(
3704    ///     google_cloud_speech_v2::model::recognition_config::DecodingConfig::AutoDecodingConfig(AutoDetectDecodingConfig::default().into())));
3705    /// ```
3706    pub fn set_decoding_config<
3707        T: std::convert::Into<std::option::Option<crate::model::recognition_config::DecodingConfig>>,
3708    >(
3709        mut self,
3710        v: T,
3711    ) -> Self {
3712        self.decoding_config = v.into();
3713        self
3714    }
3715
3716    /// The value of [decoding_config][crate::model::RecognitionConfig::decoding_config]
3717    /// if it holds a `AutoDecodingConfig`, `None` if the field is not set or
3718    /// holds a different branch.
3719    pub fn auto_decoding_config(
3720        &self,
3721    ) -> std::option::Option<&std::boxed::Box<crate::model::AutoDetectDecodingConfig>> {
3722        #[allow(unreachable_patterns)]
3723        self.decoding_config.as_ref().and_then(|v| match v {
3724            crate::model::recognition_config::DecodingConfig::AutoDecodingConfig(v) => {
3725                std::option::Option::Some(v)
3726            }
3727            _ => std::option::Option::None,
3728        })
3729    }
3730
3731    /// Sets the value of [decoding_config][crate::model::RecognitionConfig::decoding_config]
3732    /// to hold a `AutoDecodingConfig`.
3733    ///
3734    /// Note that all the setters affecting `decoding_config` are
3735    /// mutually exclusive.
3736    ///
3737    /// # Example
3738    /// ```ignore,no_run
3739    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3740    /// use google_cloud_speech_v2::model::AutoDetectDecodingConfig;
3741    /// let x = RecognitionConfig::new().set_auto_decoding_config(AutoDetectDecodingConfig::default()/* use setters */);
3742    /// assert!(x.auto_decoding_config().is_some());
3743    /// assert!(x.explicit_decoding_config().is_none());
3744    /// ```
3745    pub fn set_auto_decoding_config<
3746        T: std::convert::Into<std::boxed::Box<crate::model::AutoDetectDecodingConfig>>,
3747    >(
3748        mut self,
3749        v: T,
3750    ) -> Self {
3751        self.decoding_config = std::option::Option::Some(
3752            crate::model::recognition_config::DecodingConfig::AutoDecodingConfig(v.into()),
3753        );
3754        self
3755    }
3756
3757    /// The value of [decoding_config][crate::model::RecognitionConfig::decoding_config]
3758    /// if it holds a `ExplicitDecodingConfig`, `None` if the field is not set or
3759    /// holds a different branch.
3760    pub fn explicit_decoding_config(
3761        &self,
3762    ) -> std::option::Option<&std::boxed::Box<crate::model::ExplicitDecodingConfig>> {
3763        #[allow(unreachable_patterns)]
3764        self.decoding_config.as_ref().and_then(|v| match v {
3765            crate::model::recognition_config::DecodingConfig::ExplicitDecodingConfig(v) => {
3766                std::option::Option::Some(v)
3767            }
3768            _ => std::option::Option::None,
3769        })
3770    }
3771
3772    /// Sets the value of [decoding_config][crate::model::RecognitionConfig::decoding_config]
3773    /// to hold a `ExplicitDecodingConfig`.
3774    ///
3775    /// Note that all the setters affecting `decoding_config` are
3776    /// mutually exclusive.
3777    ///
3778    /// # Example
3779    /// ```ignore,no_run
3780    /// # use google_cloud_speech_v2::model::RecognitionConfig;
3781    /// use google_cloud_speech_v2::model::ExplicitDecodingConfig;
3782    /// let x = RecognitionConfig::new().set_explicit_decoding_config(ExplicitDecodingConfig::default()/* use setters */);
3783    /// assert!(x.explicit_decoding_config().is_some());
3784    /// assert!(x.auto_decoding_config().is_none());
3785    /// ```
3786    pub fn set_explicit_decoding_config<
3787        T: std::convert::Into<std::boxed::Box<crate::model::ExplicitDecodingConfig>>,
3788    >(
3789        mut self,
3790        v: T,
3791    ) -> Self {
3792        self.decoding_config = std::option::Option::Some(
3793            crate::model::recognition_config::DecodingConfig::ExplicitDecodingConfig(v.into()),
3794        );
3795        self
3796    }
3797}
3798
3799impl wkt::message::Message for RecognitionConfig {
3800    fn typename() -> &'static str {
3801        "type.googleapis.com/google.cloud.speech.v2.RecognitionConfig"
3802    }
3803}
3804
3805/// Defines additional types related to [RecognitionConfig].
3806pub mod recognition_config {
3807    #[allow(unused_imports)]
3808    use super::*;
3809
3810    /// Decoding parameters for audio being sent for recognition.
3811    #[derive(Clone, Debug, PartialEq)]
3812    #[non_exhaustive]
3813    pub enum DecodingConfig {
3814        /// Automatically detect decoding parameters.
3815        /// Preferred for supported formats.
3816        AutoDecodingConfig(std::boxed::Box<crate::model::AutoDetectDecodingConfig>),
3817        /// Explicitly specified decoding parameters.
3818        /// Required if using headerless PCM audio (linear16, mulaw, alaw).
3819        ExplicitDecodingConfig(std::boxed::Box<crate::model::ExplicitDecodingConfig>),
3820    }
3821}
3822
3823/// Request message for the
3824/// [Recognize][google.cloud.speech.v2.Speech.Recognize] method. Either
3825/// `content` or `uri` must be supplied. Supplying both or neither returns
3826/// [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See [content
3827/// limits](https://cloud.google.com/speech-to-text/quotas#content).
3828///
3829/// [google.cloud.speech.v2.Speech.Recognize]: crate::client::Speech::recognize
3830#[derive(Clone, Default, PartialEq)]
3831#[non_exhaustive]
3832pub struct RecognizeRequest {
3833    /// Required. The name of the Recognizer to use during recognition. The
3834    /// expected format is
3835    /// `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
3836    /// {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
3837    pub recognizer: std::string::String,
3838
3839    /// Features and audio metadata to use for the Automatic Speech Recognition.
3840    /// This field in combination with the
3841    /// [config_mask][google.cloud.speech.v2.RecognizeRequest.config_mask] field
3842    /// can be used to override parts of the
3843    /// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
3844    /// of the Recognizer resource.
3845    ///
3846    /// [google.cloud.speech.v2.RecognizeRequest.config_mask]: crate::model::RecognizeRequest::config_mask
3847    /// [google.cloud.speech.v2.Recognizer.default_recognition_config]: crate::model::Recognizer::default_recognition_config
3848    pub config: std::option::Option<crate::model::RecognitionConfig>,
3849
3850    /// The list of fields in
3851    /// [config][google.cloud.speech.v2.RecognizeRequest.config] that override the
3852    /// values in the
3853    /// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
3854    /// of the recognizer during this recognition request. If no mask is provided,
3855    /// all non-default valued fields in
3856    /// [config][google.cloud.speech.v2.RecognizeRequest.config] override the
3857    /// values in the recognizer for this recognition request. If a mask is
3858    /// provided, only the fields listed in the mask override the config in the
3859    /// recognizer for this recognition request. If a wildcard (`*`) is provided,
3860    /// [config][google.cloud.speech.v2.RecognizeRequest.config] completely
3861    /// overrides and replaces the config in the recognizer for this recognition
3862    /// request.
3863    ///
3864    /// [google.cloud.speech.v2.RecognizeRequest.config]: crate::model::RecognizeRequest::config
3865    /// [google.cloud.speech.v2.Recognizer.default_recognition_config]: crate::model::Recognizer::default_recognition_config
3866    pub config_mask: std::option::Option<wkt::FieldMask>,
3867
3868    /// The audio source, which is either inline content or a Google Cloud
3869    /// Storage URI.
3870    pub audio_source: std::option::Option<crate::model::recognize_request::AudioSource>,
3871
3872    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3873}
3874
3875impl RecognizeRequest {
3876    pub fn new() -> Self {
3877        std::default::Default::default()
3878    }
3879
3880    /// Sets the value of [recognizer][crate::model::RecognizeRequest::recognizer].
3881    ///
3882    /// # Example
3883    /// ```ignore,no_run
3884    /// # use google_cloud_speech_v2::model::RecognizeRequest;
3885    /// let x = RecognizeRequest::new().set_recognizer("example");
3886    /// ```
3887    pub fn set_recognizer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3888        self.recognizer = v.into();
3889        self
3890    }
3891
3892    /// Sets the value of [config][crate::model::RecognizeRequest::config].
3893    ///
3894    /// # Example
3895    /// ```ignore,no_run
3896    /// # use google_cloud_speech_v2::model::RecognizeRequest;
3897    /// use google_cloud_speech_v2::model::RecognitionConfig;
3898    /// let x = RecognizeRequest::new().set_config(RecognitionConfig::default()/* use setters */);
3899    /// ```
3900    pub fn set_config<T>(mut self, v: T) -> Self
3901    where
3902        T: std::convert::Into<crate::model::RecognitionConfig>,
3903    {
3904        self.config = std::option::Option::Some(v.into());
3905        self
3906    }
3907
3908    /// Sets or clears the value of [config][crate::model::RecognizeRequest::config].
3909    ///
3910    /// # Example
3911    /// ```ignore,no_run
3912    /// # use google_cloud_speech_v2::model::RecognizeRequest;
3913    /// use google_cloud_speech_v2::model::RecognitionConfig;
3914    /// let x = RecognizeRequest::new().set_or_clear_config(Some(RecognitionConfig::default()/* use setters */));
3915    /// let x = RecognizeRequest::new().set_or_clear_config(None::<RecognitionConfig>);
3916    /// ```
3917    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
3918    where
3919        T: std::convert::Into<crate::model::RecognitionConfig>,
3920    {
3921        self.config = v.map(|x| x.into());
3922        self
3923    }
3924
3925    /// Sets the value of [config_mask][crate::model::RecognizeRequest::config_mask].
3926    ///
3927    /// # Example
3928    /// ```ignore,no_run
3929    /// # use google_cloud_speech_v2::model::RecognizeRequest;
3930    /// use wkt::FieldMask;
3931    /// let x = RecognizeRequest::new().set_config_mask(FieldMask::default()/* use setters */);
3932    /// ```
3933    pub fn set_config_mask<T>(mut self, v: T) -> Self
3934    where
3935        T: std::convert::Into<wkt::FieldMask>,
3936    {
3937        self.config_mask = std::option::Option::Some(v.into());
3938        self
3939    }
3940
3941    /// Sets or clears the value of [config_mask][crate::model::RecognizeRequest::config_mask].
3942    ///
3943    /// # Example
3944    /// ```ignore,no_run
3945    /// # use google_cloud_speech_v2::model::RecognizeRequest;
3946    /// use wkt::FieldMask;
3947    /// let x = RecognizeRequest::new().set_or_clear_config_mask(Some(FieldMask::default()/* use setters */));
3948    /// let x = RecognizeRequest::new().set_or_clear_config_mask(None::<FieldMask>);
3949    /// ```
3950    pub fn set_or_clear_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
3951    where
3952        T: std::convert::Into<wkt::FieldMask>,
3953    {
3954        self.config_mask = v.map(|x| x.into());
3955        self
3956    }
3957
3958    /// Sets the value of [audio_source][crate::model::RecognizeRequest::audio_source].
3959    ///
3960    /// Note that all the setters affecting `audio_source` are mutually
3961    /// exclusive.
3962    ///
3963    /// # Example
3964    /// ```ignore,no_run
3965    /// # use google_cloud_speech_v2::model::RecognizeRequest;
3966    /// use google_cloud_speech_v2::model::recognize_request::AudioSource;
3967    /// let x = RecognizeRequest::new().set_audio_source(Some(AudioSource::Content(bytes::Bytes::from_static(b"example"))));
3968    /// ```
3969    pub fn set_audio_source<
3970        T: std::convert::Into<std::option::Option<crate::model::recognize_request::AudioSource>>,
3971    >(
3972        mut self,
3973        v: T,
3974    ) -> Self {
3975        self.audio_source = v.into();
3976        self
3977    }
3978
3979    /// The value of [audio_source][crate::model::RecognizeRequest::audio_source]
3980    /// if it holds a `Content`, `None` if the field is not set or
3981    /// holds a different branch.
3982    pub fn content(&self) -> std::option::Option<&::bytes::Bytes> {
3983        #[allow(unreachable_patterns)]
3984        self.audio_source.as_ref().and_then(|v| match v {
3985            crate::model::recognize_request::AudioSource::Content(v) => {
3986                std::option::Option::Some(v)
3987            }
3988            _ => std::option::Option::None,
3989        })
3990    }
3991
3992    /// Sets the value of [audio_source][crate::model::RecognizeRequest::audio_source]
3993    /// to hold a `Content`.
3994    ///
3995    /// Note that all the setters affecting `audio_source` are
3996    /// mutually exclusive.
3997    ///
3998    /// # Example
3999    /// ```ignore,no_run
4000    /// # use google_cloud_speech_v2::model::RecognizeRequest;
4001    /// let x = RecognizeRequest::new().set_content(bytes::Bytes::from_static(b"example"));
4002    /// assert!(x.content().is_some());
4003    /// assert!(x.uri().is_none());
4004    /// ```
4005    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4006        self.audio_source = std::option::Option::Some(
4007            crate::model::recognize_request::AudioSource::Content(v.into()),
4008        );
4009        self
4010    }
4011
4012    /// The value of [audio_source][crate::model::RecognizeRequest::audio_source]
4013    /// if it holds a `Uri`, `None` if the field is not set or
4014    /// holds a different branch.
4015    pub fn uri(&self) -> std::option::Option<&std::string::String> {
4016        #[allow(unreachable_patterns)]
4017        self.audio_source.as_ref().and_then(|v| match v {
4018            crate::model::recognize_request::AudioSource::Uri(v) => std::option::Option::Some(v),
4019            _ => std::option::Option::None,
4020        })
4021    }
4022
4023    /// Sets the value of [audio_source][crate::model::RecognizeRequest::audio_source]
4024    /// to hold a `Uri`.
4025    ///
4026    /// Note that all the setters affecting `audio_source` are
4027    /// mutually exclusive.
4028    ///
4029    /// # Example
4030    /// ```ignore,no_run
4031    /// # use google_cloud_speech_v2::model::RecognizeRequest;
4032    /// let x = RecognizeRequest::new().set_uri("example");
4033    /// assert!(x.uri().is_some());
4034    /// assert!(x.content().is_none());
4035    /// ```
4036    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4037        self.audio_source =
4038            std::option::Option::Some(crate::model::recognize_request::AudioSource::Uri(v.into()));
4039        self
4040    }
4041}
4042
4043impl wkt::message::Message for RecognizeRequest {
4044    fn typename() -> &'static str {
4045        "type.googleapis.com/google.cloud.speech.v2.RecognizeRequest"
4046    }
4047}
4048
4049/// Defines additional types related to [RecognizeRequest].
4050pub mod recognize_request {
4051    #[allow(unused_imports)]
4052    use super::*;
4053
4054    /// The audio source, which is either inline content or a Google Cloud
4055    /// Storage URI.
4056    #[derive(Clone, Debug, PartialEq)]
4057    #[non_exhaustive]
4058    pub enum AudioSource {
4059        /// The audio data bytes encoded as specified in
4060        /// [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. As
4061        /// with all bytes fields, proto buffers use a pure binary representation,
4062        /// whereas JSON representations use base64.
4063        ///
4064        /// [google.cloud.speech.v2.RecognitionConfig]: crate::model::RecognitionConfig
4065        Content(::bytes::Bytes),
4066        /// URI that points to a file that contains audio data bytes as specified in
4067        /// [RecognitionConfig][google.cloud.speech.v2.RecognitionConfig]. The file
4068        /// must not be compressed (for example, gzip). Currently, only Google Cloud
4069        /// Storage URIs are supported, which must be specified in the following
4070        /// format: `gs://bucket_name/object_name` (other URI formats return
4071        /// [INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more
4072        /// information, see [Request
4073        /// URIs](https://cloud.google.com/storage/docs/reference-uris).
4074        ///
4075        /// [google.cloud.speech.v2.RecognitionConfig]: crate::model::RecognitionConfig
4076        Uri(std::string::String),
4077    }
4078}
4079
4080/// Metadata about the recognition request and response.
4081#[derive(Clone, Default, PartialEq)]
4082#[non_exhaustive]
4083pub struct RecognitionResponseMetadata {
4084    /// Global request identifier auto-generated by the API.
4085    pub request_id: std::string::String,
4086
4087    /// When available, billed audio seconds for the corresponding request.
4088    pub total_billed_duration: std::option::Option<wkt::Duration>,
4089
4090    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4091}
4092
4093impl RecognitionResponseMetadata {
4094    pub fn new() -> Self {
4095        std::default::Default::default()
4096    }
4097
4098    /// Sets the value of [request_id][crate::model::RecognitionResponseMetadata::request_id].
4099    ///
4100    /// # Example
4101    /// ```ignore,no_run
4102    /// # use google_cloud_speech_v2::model::RecognitionResponseMetadata;
4103    /// let x = RecognitionResponseMetadata::new().set_request_id("example");
4104    /// ```
4105    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4106        self.request_id = v.into();
4107        self
4108    }
4109
4110    /// Sets the value of [total_billed_duration][crate::model::RecognitionResponseMetadata::total_billed_duration].
4111    ///
4112    /// # Example
4113    /// ```ignore,no_run
4114    /// # use google_cloud_speech_v2::model::RecognitionResponseMetadata;
4115    /// use wkt::Duration;
4116    /// let x = RecognitionResponseMetadata::new().set_total_billed_duration(Duration::default()/* use setters */);
4117    /// ```
4118    pub fn set_total_billed_duration<T>(mut self, v: T) -> Self
4119    where
4120        T: std::convert::Into<wkt::Duration>,
4121    {
4122        self.total_billed_duration = std::option::Option::Some(v.into());
4123        self
4124    }
4125
4126    /// Sets or clears the value of [total_billed_duration][crate::model::RecognitionResponseMetadata::total_billed_duration].
4127    ///
4128    /// # Example
4129    /// ```ignore,no_run
4130    /// # use google_cloud_speech_v2::model::RecognitionResponseMetadata;
4131    /// use wkt::Duration;
4132    /// let x = RecognitionResponseMetadata::new().set_or_clear_total_billed_duration(Some(Duration::default()/* use setters */));
4133    /// let x = RecognitionResponseMetadata::new().set_or_clear_total_billed_duration(None::<Duration>);
4134    /// ```
4135    pub fn set_or_clear_total_billed_duration<T>(mut self, v: std::option::Option<T>) -> Self
4136    where
4137        T: std::convert::Into<wkt::Duration>,
4138    {
4139        self.total_billed_duration = v.map(|x| x.into());
4140        self
4141    }
4142}
4143
4144impl wkt::message::Message for RecognitionResponseMetadata {
4145    fn typename() -> &'static str {
4146        "type.googleapis.com/google.cloud.speech.v2.RecognitionResponseMetadata"
4147    }
4148}
4149
4150/// Alternative hypotheses (a.k.a. n-best list).
4151#[derive(Clone, Default, PartialEq)]
4152#[non_exhaustive]
4153pub struct SpeechRecognitionAlternative {
4154    /// Transcript text representing the words that the user spoke.
4155    pub transcript: std::string::String,
4156
4157    /// The confidence estimate between 0.0 and 1.0. A higher number
4158    /// indicates an estimated greater likelihood that the recognized words are
4159    /// correct. This field is set only for the top alternative of a non-streaming
4160    /// result or, of a streaming result where
4161    /// [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
4162    /// set to `true`. This field is not guaranteed to be accurate and users should
4163    /// not rely on it to be always provided. The default of 0.0 is a sentinel
4164    /// value indicating `confidence` was not set.
4165    ///
4166    /// [google.cloud.speech.v2.StreamingRecognitionResult.is_final]: crate::model::StreamingRecognitionResult::is_final
4167    pub confidence: f32,
4168
4169    /// A list of word-specific information for each recognized word.
4170    /// When the
4171    /// [SpeakerDiarizationConfig][google.cloud.speech.v2.SpeakerDiarizationConfig]
4172    /// is set, you will see all the words from the beginning of the audio.
4173    ///
4174    /// [google.cloud.speech.v2.SpeakerDiarizationConfig]: crate::model::SpeakerDiarizationConfig
4175    pub words: std::vec::Vec<crate::model::WordInfo>,
4176
4177    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4178}
4179
4180impl SpeechRecognitionAlternative {
4181    pub fn new() -> Self {
4182        std::default::Default::default()
4183    }
4184
4185    /// Sets the value of [transcript][crate::model::SpeechRecognitionAlternative::transcript].
4186    ///
4187    /// # Example
4188    /// ```ignore,no_run
4189    /// # use google_cloud_speech_v2::model::SpeechRecognitionAlternative;
4190    /// let x = SpeechRecognitionAlternative::new().set_transcript("example");
4191    /// ```
4192    pub fn set_transcript<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4193        self.transcript = v.into();
4194        self
4195    }
4196
4197    /// Sets the value of [confidence][crate::model::SpeechRecognitionAlternative::confidence].
4198    ///
4199    /// # Example
4200    /// ```ignore,no_run
4201    /// # use google_cloud_speech_v2::model::SpeechRecognitionAlternative;
4202    /// let x = SpeechRecognitionAlternative::new().set_confidence(42.0);
4203    /// ```
4204    pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4205        self.confidence = v.into();
4206        self
4207    }
4208
4209    /// Sets the value of [words][crate::model::SpeechRecognitionAlternative::words].
4210    ///
4211    /// # Example
4212    /// ```ignore,no_run
4213    /// # use google_cloud_speech_v2::model::SpeechRecognitionAlternative;
4214    /// use google_cloud_speech_v2::model::WordInfo;
4215    /// let x = SpeechRecognitionAlternative::new()
4216    ///     .set_words([
4217    ///         WordInfo::default()/* use setters */,
4218    ///         WordInfo::default()/* use (different) setters */,
4219    ///     ]);
4220    /// ```
4221    pub fn set_words<T, V>(mut self, v: T) -> Self
4222    where
4223        T: std::iter::IntoIterator<Item = V>,
4224        V: std::convert::Into<crate::model::WordInfo>,
4225    {
4226        use std::iter::Iterator;
4227        self.words = v.into_iter().map(|i| i.into()).collect();
4228        self
4229    }
4230}
4231
4232impl wkt::message::Message for SpeechRecognitionAlternative {
4233    fn typename() -> &'static str {
4234        "type.googleapis.com/google.cloud.speech.v2.SpeechRecognitionAlternative"
4235    }
4236}
4237
4238/// Word-specific information for recognized words.
4239#[derive(Clone, Default, PartialEq)]
4240#[non_exhaustive]
4241pub struct WordInfo {
4242    /// Time offset relative to the beginning of the audio,
4243    /// and corresponding to the start of the spoken word.
4244    /// This field is only set if
4245    /// [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
4246    /// is `true` and only in the top hypothesis. This is an experimental feature
4247    /// and the accuracy of the time offset can vary.
4248    ///
4249    /// [google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]: crate::model::RecognitionFeatures::enable_word_time_offsets
4250    pub start_offset: std::option::Option<wkt::Duration>,
4251
4252    /// Time offset relative to the beginning of the audio,
4253    /// and corresponding to the end of the spoken word.
4254    /// This field is only set if
4255    /// [enable_word_time_offsets][google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]
4256    /// is `true` and only in the top hypothesis. This is an experimental feature
4257    /// and the accuracy of the time offset can vary.
4258    ///
4259    /// [google.cloud.speech.v2.RecognitionFeatures.enable_word_time_offsets]: crate::model::RecognitionFeatures::enable_word_time_offsets
4260    pub end_offset: std::option::Option<wkt::Duration>,
4261
4262    /// The word corresponding to this set of information.
4263    pub word: std::string::String,
4264
4265    /// The confidence estimate between 0.0 and 1.0. A higher number
4266    /// indicates an estimated greater likelihood that the recognized words are
4267    /// correct. This field is set only for the top alternative of a non-streaming
4268    /// result or, of a streaming result where
4269    /// [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final] is
4270    /// set to `true`. This field is not guaranteed to be accurate and users should
4271    /// not rely on it to be always provided. The default of 0.0 is a sentinel
4272    /// value indicating `confidence` was not set.
4273    ///
4274    /// [google.cloud.speech.v2.StreamingRecognitionResult.is_final]: crate::model::StreamingRecognitionResult::is_final
4275    pub confidence: f32,
4276
4277    /// A distinct label is assigned for every speaker within the audio. This field
4278    /// specifies which one of those speakers was detected to have spoken this
4279    /// word. `speaker_label` is set if
4280    /// [SpeakerDiarizationConfig][google.cloud.speech.v2.SpeakerDiarizationConfig]
4281    /// is given and only in the top alternative.
4282    ///
4283    /// [google.cloud.speech.v2.SpeakerDiarizationConfig]: crate::model::SpeakerDiarizationConfig
4284    pub speaker_label: std::string::String,
4285
4286    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4287}
4288
4289impl WordInfo {
4290    pub fn new() -> Self {
4291        std::default::Default::default()
4292    }
4293
4294    /// Sets the value of [start_offset][crate::model::WordInfo::start_offset].
4295    ///
4296    /// # Example
4297    /// ```ignore,no_run
4298    /// # use google_cloud_speech_v2::model::WordInfo;
4299    /// use wkt::Duration;
4300    /// let x = WordInfo::new().set_start_offset(Duration::default()/* use setters */);
4301    /// ```
4302    pub fn set_start_offset<T>(mut self, v: T) -> Self
4303    where
4304        T: std::convert::Into<wkt::Duration>,
4305    {
4306        self.start_offset = std::option::Option::Some(v.into());
4307        self
4308    }
4309
4310    /// Sets or clears the value of [start_offset][crate::model::WordInfo::start_offset].
4311    ///
4312    /// # Example
4313    /// ```ignore,no_run
4314    /// # use google_cloud_speech_v2::model::WordInfo;
4315    /// use wkt::Duration;
4316    /// let x = WordInfo::new().set_or_clear_start_offset(Some(Duration::default()/* use setters */));
4317    /// let x = WordInfo::new().set_or_clear_start_offset(None::<Duration>);
4318    /// ```
4319    pub fn set_or_clear_start_offset<T>(mut self, v: std::option::Option<T>) -> Self
4320    where
4321        T: std::convert::Into<wkt::Duration>,
4322    {
4323        self.start_offset = v.map(|x| x.into());
4324        self
4325    }
4326
4327    /// Sets the value of [end_offset][crate::model::WordInfo::end_offset].
4328    ///
4329    /// # Example
4330    /// ```ignore,no_run
4331    /// # use google_cloud_speech_v2::model::WordInfo;
4332    /// use wkt::Duration;
4333    /// let x = WordInfo::new().set_end_offset(Duration::default()/* use setters */);
4334    /// ```
4335    pub fn set_end_offset<T>(mut self, v: T) -> Self
4336    where
4337        T: std::convert::Into<wkt::Duration>,
4338    {
4339        self.end_offset = std::option::Option::Some(v.into());
4340        self
4341    }
4342
4343    /// Sets or clears the value of [end_offset][crate::model::WordInfo::end_offset].
4344    ///
4345    /// # Example
4346    /// ```ignore,no_run
4347    /// # use google_cloud_speech_v2::model::WordInfo;
4348    /// use wkt::Duration;
4349    /// let x = WordInfo::new().set_or_clear_end_offset(Some(Duration::default()/* use setters */));
4350    /// let x = WordInfo::new().set_or_clear_end_offset(None::<Duration>);
4351    /// ```
4352    pub fn set_or_clear_end_offset<T>(mut self, v: std::option::Option<T>) -> Self
4353    where
4354        T: std::convert::Into<wkt::Duration>,
4355    {
4356        self.end_offset = v.map(|x| x.into());
4357        self
4358    }
4359
4360    /// Sets the value of [word][crate::model::WordInfo::word].
4361    ///
4362    /// # Example
4363    /// ```ignore,no_run
4364    /// # use google_cloud_speech_v2::model::WordInfo;
4365    /// let x = WordInfo::new().set_word("example");
4366    /// ```
4367    pub fn set_word<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4368        self.word = v.into();
4369        self
4370    }
4371
4372    /// Sets the value of [confidence][crate::model::WordInfo::confidence].
4373    ///
4374    /// # Example
4375    /// ```ignore,no_run
4376    /// # use google_cloud_speech_v2::model::WordInfo;
4377    /// let x = WordInfo::new().set_confidence(42.0);
4378    /// ```
4379    pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4380        self.confidence = v.into();
4381        self
4382    }
4383
4384    /// Sets the value of [speaker_label][crate::model::WordInfo::speaker_label].
4385    ///
4386    /// # Example
4387    /// ```ignore,no_run
4388    /// # use google_cloud_speech_v2::model::WordInfo;
4389    /// let x = WordInfo::new().set_speaker_label("example");
4390    /// ```
4391    pub fn set_speaker_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4392        self.speaker_label = v.into();
4393        self
4394    }
4395}
4396
4397impl wkt::message::Message for WordInfo {
4398    fn typename() -> &'static str {
4399        "type.googleapis.com/google.cloud.speech.v2.WordInfo"
4400    }
4401}
4402
4403/// A speech recognition result corresponding to a portion of the audio.
4404#[derive(Clone, Default, PartialEq)]
4405#[non_exhaustive]
4406pub struct SpeechRecognitionResult {
4407    /// May contain one or more recognition hypotheses. These alternatives are
4408    /// ordered in terms of accuracy, with the top (first) alternative being the
4409    /// most probable, as ranked by the recognizer.
4410    pub alternatives: std::vec::Vec<crate::model::SpeechRecognitionAlternative>,
4411
4412    /// For multi-channel audio, this is the channel number corresponding to the
4413    /// recognized result for the audio from that channel.
4414    /// For `audio_channel_count` = `N`, its output values can range from `1` to
4415    /// `N`.
4416    pub channel_tag: i32,
4417
4418    /// Time offset of the end of this result relative to the beginning of the
4419    /// audio.
4420    pub result_end_offset: std::option::Option<wkt::Duration>,
4421
4422    /// Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
4423    /// language tag of the language in this result. This language code was
4424    /// detected to have the most likelihood of being spoken in the audio.
4425    pub language_code: std::string::String,
4426
4427    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4428}
4429
4430impl SpeechRecognitionResult {
4431    pub fn new() -> Self {
4432        std::default::Default::default()
4433    }
4434
4435    /// Sets the value of [alternatives][crate::model::SpeechRecognitionResult::alternatives].
4436    ///
4437    /// # Example
4438    /// ```ignore,no_run
4439    /// # use google_cloud_speech_v2::model::SpeechRecognitionResult;
4440    /// use google_cloud_speech_v2::model::SpeechRecognitionAlternative;
4441    /// let x = SpeechRecognitionResult::new()
4442    ///     .set_alternatives([
4443    ///         SpeechRecognitionAlternative::default()/* use setters */,
4444    ///         SpeechRecognitionAlternative::default()/* use (different) setters */,
4445    ///     ]);
4446    /// ```
4447    pub fn set_alternatives<T, V>(mut self, v: T) -> Self
4448    where
4449        T: std::iter::IntoIterator<Item = V>,
4450        V: std::convert::Into<crate::model::SpeechRecognitionAlternative>,
4451    {
4452        use std::iter::Iterator;
4453        self.alternatives = v.into_iter().map(|i| i.into()).collect();
4454        self
4455    }
4456
4457    /// Sets the value of [channel_tag][crate::model::SpeechRecognitionResult::channel_tag].
4458    ///
4459    /// # Example
4460    /// ```ignore,no_run
4461    /// # use google_cloud_speech_v2::model::SpeechRecognitionResult;
4462    /// let x = SpeechRecognitionResult::new().set_channel_tag(42);
4463    /// ```
4464    pub fn set_channel_tag<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4465        self.channel_tag = v.into();
4466        self
4467    }
4468
4469    /// Sets the value of [result_end_offset][crate::model::SpeechRecognitionResult::result_end_offset].
4470    ///
4471    /// # Example
4472    /// ```ignore,no_run
4473    /// # use google_cloud_speech_v2::model::SpeechRecognitionResult;
4474    /// use wkt::Duration;
4475    /// let x = SpeechRecognitionResult::new().set_result_end_offset(Duration::default()/* use setters */);
4476    /// ```
4477    pub fn set_result_end_offset<T>(mut self, v: T) -> Self
4478    where
4479        T: std::convert::Into<wkt::Duration>,
4480    {
4481        self.result_end_offset = std::option::Option::Some(v.into());
4482        self
4483    }
4484
4485    /// Sets or clears the value of [result_end_offset][crate::model::SpeechRecognitionResult::result_end_offset].
4486    ///
4487    /// # Example
4488    /// ```ignore,no_run
4489    /// # use google_cloud_speech_v2::model::SpeechRecognitionResult;
4490    /// use wkt::Duration;
4491    /// let x = SpeechRecognitionResult::new().set_or_clear_result_end_offset(Some(Duration::default()/* use setters */));
4492    /// let x = SpeechRecognitionResult::new().set_or_clear_result_end_offset(None::<Duration>);
4493    /// ```
4494    pub fn set_or_clear_result_end_offset<T>(mut self, v: std::option::Option<T>) -> Self
4495    where
4496        T: std::convert::Into<wkt::Duration>,
4497    {
4498        self.result_end_offset = v.map(|x| x.into());
4499        self
4500    }
4501
4502    /// Sets the value of [language_code][crate::model::SpeechRecognitionResult::language_code].
4503    ///
4504    /// # Example
4505    /// ```ignore,no_run
4506    /// # use google_cloud_speech_v2::model::SpeechRecognitionResult;
4507    /// let x = SpeechRecognitionResult::new().set_language_code("example");
4508    /// ```
4509    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4510        self.language_code = v.into();
4511        self
4512    }
4513}
4514
4515impl wkt::message::Message for SpeechRecognitionResult {
4516    fn typename() -> &'static str {
4517        "type.googleapis.com/google.cloud.speech.v2.SpeechRecognitionResult"
4518    }
4519}
4520
4521/// Response message for the
4522/// [Recognize][google.cloud.speech.v2.Speech.Recognize] method.
4523///
4524/// [google.cloud.speech.v2.Speech.Recognize]: crate::client::Speech::recognize
4525#[derive(Clone, Default, PartialEq)]
4526#[non_exhaustive]
4527pub struct RecognizeResponse {
4528    /// Sequential list of transcription results corresponding to sequential
4529    /// portions of audio.
4530    pub results: std::vec::Vec<crate::model::SpeechRecognitionResult>,
4531
4532    /// Metadata about the recognition.
4533    pub metadata: std::option::Option<crate::model::RecognitionResponseMetadata>,
4534
4535    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4536}
4537
4538impl RecognizeResponse {
4539    pub fn new() -> Self {
4540        std::default::Default::default()
4541    }
4542
4543    /// Sets the value of [results][crate::model::RecognizeResponse::results].
4544    ///
4545    /// # Example
4546    /// ```ignore,no_run
4547    /// # use google_cloud_speech_v2::model::RecognizeResponse;
4548    /// use google_cloud_speech_v2::model::SpeechRecognitionResult;
4549    /// let x = RecognizeResponse::new()
4550    ///     .set_results([
4551    ///         SpeechRecognitionResult::default()/* use setters */,
4552    ///         SpeechRecognitionResult::default()/* use (different) setters */,
4553    ///     ]);
4554    /// ```
4555    pub fn set_results<T, V>(mut self, v: T) -> Self
4556    where
4557        T: std::iter::IntoIterator<Item = V>,
4558        V: std::convert::Into<crate::model::SpeechRecognitionResult>,
4559    {
4560        use std::iter::Iterator;
4561        self.results = v.into_iter().map(|i| i.into()).collect();
4562        self
4563    }
4564
4565    /// Sets the value of [metadata][crate::model::RecognizeResponse::metadata].
4566    ///
4567    /// # Example
4568    /// ```ignore,no_run
4569    /// # use google_cloud_speech_v2::model::RecognizeResponse;
4570    /// use google_cloud_speech_v2::model::RecognitionResponseMetadata;
4571    /// let x = RecognizeResponse::new().set_metadata(RecognitionResponseMetadata::default()/* use setters */);
4572    /// ```
4573    pub fn set_metadata<T>(mut self, v: T) -> Self
4574    where
4575        T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
4576    {
4577        self.metadata = std::option::Option::Some(v.into());
4578        self
4579    }
4580
4581    /// Sets or clears the value of [metadata][crate::model::RecognizeResponse::metadata].
4582    ///
4583    /// # Example
4584    /// ```ignore,no_run
4585    /// # use google_cloud_speech_v2::model::RecognizeResponse;
4586    /// use google_cloud_speech_v2::model::RecognitionResponseMetadata;
4587    /// let x = RecognizeResponse::new().set_or_clear_metadata(Some(RecognitionResponseMetadata::default()/* use setters */));
4588    /// let x = RecognizeResponse::new().set_or_clear_metadata(None::<RecognitionResponseMetadata>);
4589    /// ```
4590    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
4591    where
4592        T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
4593    {
4594        self.metadata = v.map(|x| x.into());
4595        self
4596    }
4597}
4598
4599impl wkt::message::Message for RecognizeResponse {
4600    fn typename() -> &'static str {
4601        "type.googleapis.com/google.cloud.speech.v2.RecognizeResponse"
4602    }
4603}
4604
4605/// Available recognition features specific to streaming recognition requests.
4606#[derive(Clone, Default, PartialEq)]
4607#[non_exhaustive]
4608pub struct StreamingRecognitionFeatures {
4609    /// If `true`, responses with voice activity speech events will be returned as
4610    /// they are detected.
4611    pub enable_voice_activity_events: bool,
4612
4613    /// Whether or not to stream interim results to the client. If set to true,
4614    /// interim results will be streamed to the client. Otherwise, only the final
4615    /// response will be streamed back.
4616    pub interim_results: bool,
4617
4618    /// If set, the server will automatically close the stream after the specified
4619    /// duration has elapsed after the last VOICE_ACTIVITY speech event has been
4620    /// sent. The field `voice_activity_events` must also be set to true.
4621    pub voice_activity_timeout:
4622        std::option::Option<crate::model::streaming_recognition_features::VoiceActivityTimeout>,
4623
4624    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4625}
4626
4627impl StreamingRecognitionFeatures {
4628    pub fn new() -> Self {
4629        std::default::Default::default()
4630    }
4631
4632    /// Sets the value of [enable_voice_activity_events][crate::model::StreamingRecognitionFeatures::enable_voice_activity_events].
4633    ///
4634    /// # Example
4635    /// ```ignore,no_run
4636    /// # use google_cloud_speech_v2::model::StreamingRecognitionFeatures;
4637    /// let x = StreamingRecognitionFeatures::new().set_enable_voice_activity_events(true);
4638    /// ```
4639    pub fn set_enable_voice_activity_events<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4640        self.enable_voice_activity_events = v.into();
4641        self
4642    }
4643
4644    /// Sets the value of [interim_results][crate::model::StreamingRecognitionFeatures::interim_results].
4645    ///
4646    /// # Example
4647    /// ```ignore,no_run
4648    /// # use google_cloud_speech_v2::model::StreamingRecognitionFeatures;
4649    /// let x = StreamingRecognitionFeatures::new().set_interim_results(true);
4650    /// ```
4651    pub fn set_interim_results<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4652        self.interim_results = v.into();
4653        self
4654    }
4655
4656    /// Sets the value of [voice_activity_timeout][crate::model::StreamingRecognitionFeatures::voice_activity_timeout].
4657    ///
4658    /// # Example
4659    /// ```ignore,no_run
4660    /// # use google_cloud_speech_v2::model::StreamingRecognitionFeatures;
4661    /// use google_cloud_speech_v2::model::streaming_recognition_features::VoiceActivityTimeout;
4662    /// let x = StreamingRecognitionFeatures::new().set_voice_activity_timeout(VoiceActivityTimeout::default()/* use setters */);
4663    /// ```
4664    pub fn set_voice_activity_timeout<T>(mut self, v: T) -> Self
4665    where
4666        T: std::convert::Into<crate::model::streaming_recognition_features::VoiceActivityTimeout>,
4667    {
4668        self.voice_activity_timeout = std::option::Option::Some(v.into());
4669        self
4670    }
4671
4672    /// Sets or clears the value of [voice_activity_timeout][crate::model::StreamingRecognitionFeatures::voice_activity_timeout].
4673    ///
4674    /// # Example
4675    /// ```ignore,no_run
4676    /// # use google_cloud_speech_v2::model::StreamingRecognitionFeatures;
4677    /// use google_cloud_speech_v2::model::streaming_recognition_features::VoiceActivityTimeout;
4678    /// let x = StreamingRecognitionFeatures::new().set_or_clear_voice_activity_timeout(Some(VoiceActivityTimeout::default()/* use setters */));
4679    /// let x = StreamingRecognitionFeatures::new().set_or_clear_voice_activity_timeout(None::<VoiceActivityTimeout>);
4680    /// ```
4681    pub fn set_or_clear_voice_activity_timeout<T>(mut self, v: std::option::Option<T>) -> Self
4682    where
4683        T: std::convert::Into<crate::model::streaming_recognition_features::VoiceActivityTimeout>,
4684    {
4685        self.voice_activity_timeout = v.map(|x| x.into());
4686        self
4687    }
4688}
4689
4690impl wkt::message::Message for StreamingRecognitionFeatures {
4691    fn typename() -> &'static str {
4692        "type.googleapis.com/google.cloud.speech.v2.StreamingRecognitionFeatures"
4693    }
4694}
4695
4696/// Defines additional types related to [StreamingRecognitionFeatures].
4697pub mod streaming_recognition_features {
4698    #[allow(unused_imports)]
4699    use super::*;
4700
4701    /// Events that a timeout can be set on for voice activity.
4702    #[derive(Clone, Default, PartialEq)]
4703    #[non_exhaustive]
4704    pub struct VoiceActivityTimeout {
4705        /// Duration to timeout the stream if no speech begins. If this is set and
4706        /// no speech is detected in this duration at the start of the stream, the
4707        /// server will close the stream.
4708        pub speech_start_timeout: std::option::Option<wkt::Duration>,
4709
4710        /// Duration to timeout the stream after speech ends. If this is set and no
4711        /// speech is detected in this duration after speech was detected, the server
4712        /// will close the stream.
4713        pub speech_end_timeout: std::option::Option<wkt::Duration>,
4714
4715        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4716    }
4717
4718    impl VoiceActivityTimeout {
4719        pub fn new() -> Self {
4720            std::default::Default::default()
4721        }
4722
4723        /// Sets the value of [speech_start_timeout][crate::model::streaming_recognition_features::VoiceActivityTimeout::speech_start_timeout].
4724        ///
4725        /// # Example
4726        /// ```ignore,no_run
4727        /// # use google_cloud_speech_v2::model::streaming_recognition_features::VoiceActivityTimeout;
4728        /// use wkt::Duration;
4729        /// let x = VoiceActivityTimeout::new().set_speech_start_timeout(Duration::default()/* use setters */);
4730        /// ```
4731        pub fn set_speech_start_timeout<T>(mut self, v: T) -> Self
4732        where
4733            T: std::convert::Into<wkt::Duration>,
4734        {
4735            self.speech_start_timeout = std::option::Option::Some(v.into());
4736            self
4737        }
4738
4739        /// Sets or clears the value of [speech_start_timeout][crate::model::streaming_recognition_features::VoiceActivityTimeout::speech_start_timeout].
4740        ///
4741        /// # Example
4742        /// ```ignore,no_run
4743        /// # use google_cloud_speech_v2::model::streaming_recognition_features::VoiceActivityTimeout;
4744        /// use wkt::Duration;
4745        /// let x = VoiceActivityTimeout::new().set_or_clear_speech_start_timeout(Some(Duration::default()/* use setters */));
4746        /// let x = VoiceActivityTimeout::new().set_or_clear_speech_start_timeout(None::<Duration>);
4747        /// ```
4748        pub fn set_or_clear_speech_start_timeout<T>(mut self, v: std::option::Option<T>) -> Self
4749        where
4750            T: std::convert::Into<wkt::Duration>,
4751        {
4752            self.speech_start_timeout = v.map(|x| x.into());
4753            self
4754        }
4755
4756        /// Sets the value of [speech_end_timeout][crate::model::streaming_recognition_features::VoiceActivityTimeout::speech_end_timeout].
4757        ///
4758        /// # Example
4759        /// ```ignore,no_run
4760        /// # use google_cloud_speech_v2::model::streaming_recognition_features::VoiceActivityTimeout;
4761        /// use wkt::Duration;
4762        /// let x = VoiceActivityTimeout::new().set_speech_end_timeout(Duration::default()/* use setters */);
4763        /// ```
4764        pub fn set_speech_end_timeout<T>(mut self, v: T) -> Self
4765        where
4766            T: std::convert::Into<wkt::Duration>,
4767        {
4768            self.speech_end_timeout = std::option::Option::Some(v.into());
4769            self
4770        }
4771
4772        /// Sets or clears the value of [speech_end_timeout][crate::model::streaming_recognition_features::VoiceActivityTimeout::speech_end_timeout].
4773        ///
4774        /// # Example
4775        /// ```ignore,no_run
4776        /// # use google_cloud_speech_v2::model::streaming_recognition_features::VoiceActivityTimeout;
4777        /// use wkt::Duration;
4778        /// let x = VoiceActivityTimeout::new().set_or_clear_speech_end_timeout(Some(Duration::default()/* use setters */));
4779        /// let x = VoiceActivityTimeout::new().set_or_clear_speech_end_timeout(None::<Duration>);
4780        /// ```
4781        pub fn set_or_clear_speech_end_timeout<T>(mut self, v: std::option::Option<T>) -> Self
4782        where
4783            T: std::convert::Into<wkt::Duration>,
4784        {
4785            self.speech_end_timeout = v.map(|x| x.into());
4786            self
4787        }
4788    }
4789
4790    impl wkt::message::Message for VoiceActivityTimeout {
4791        fn typename() -> &'static str {
4792            "type.googleapis.com/google.cloud.speech.v2.StreamingRecognitionFeatures.VoiceActivityTimeout"
4793        }
4794    }
4795}
4796
4797/// Provides configuration information for the StreamingRecognize request.
4798#[derive(Clone, Default, PartialEq)]
4799#[non_exhaustive]
4800pub struct StreamingRecognitionConfig {
4801    /// Required. Features and audio metadata to use for the Automatic Speech
4802    /// Recognition. This field in combination with the
4803    /// [config_mask][google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]
4804    /// field can be used to override parts of the
4805    /// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
4806    /// of the Recognizer resource.
4807    ///
4808    /// [google.cloud.speech.v2.Recognizer.default_recognition_config]: crate::model::Recognizer::default_recognition_config
4809    /// [google.cloud.speech.v2.StreamingRecognitionConfig.config_mask]: crate::model::StreamingRecognitionConfig::config_mask
4810    pub config: std::option::Option<crate::model::RecognitionConfig>,
4811
4812    /// The list of fields in
4813    /// [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] that
4814    /// override the values in the
4815    /// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
4816    /// of the recognizer during this recognition request. If no mask is provided,
4817    /// all non-default valued fields in
4818    /// [config][google.cloud.speech.v2.StreamingRecognitionConfig.config] override
4819    /// the values in the Recognizer for this recognition request. If a mask is
4820    /// provided, only the fields listed in the mask override the config in the
4821    /// Recognizer for this recognition request. If a wildcard (`*`) is provided,
4822    /// [config][google.cloud.speech.v2.StreamingRecognitionConfig.config]
4823    /// completely overrides and replaces the config in the recognizer for this
4824    /// recognition request.
4825    ///
4826    /// [google.cloud.speech.v2.Recognizer.default_recognition_config]: crate::model::Recognizer::default_recognition_config
4827    /// [google.cloud.speech.v2.StreamingRecognitionConfig.config]: crate::model::StreamingRecognitionConfig::config
4828    pub config_mask: std::option::Option<wkt::FieldMask>,
4829
4830    /// Speech recognition features to enable specific to streaming audio
4831    /// recognition requests.
4832    pub streaming_features: std::option::Option<crate::model::StreamingRecognitionFeatures>,
4833
4834    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4835}
4836
4837impl StreamingRecognitionConfig {
4838    pub fn new() -> Self {
4839        std::default::Default::default()
4840    }
4841
4842    /// Sets the value of [config][crate::model::StreamingRecognitionConfig::config].
4843    ///
4844    /// # Example
4845    /// ```ignore,no_run
4846    /// # use google_cloud_speech_v2::model::StreamingRecognitionConfig;
4847    /// use google_cloud_speech_v2::model::RecognitionConfig;
4848    /// let x = StreamingRecognitionConfig::new().set_config(RecognitionConfig::default()/* use setters */);
4849    /// ```
4850    pub fn set_config<T>(mut self, v: T) -> Self
4851    where
4852        T: std::convert::Into<crate::model::RecognitionConfig>,
4853    {
4854        self.config = std::option::Option::Some(v.into());
4855        self
4856    }
4857
4858    /// Sets or clears the value of [config][crate::model::StreamingRecognitionConfig::config].
4859    ///
4860    /// # Example
4861    /// ```ignore,no_run
4862    /// # use google_cloud_speech_v2::model::StreamingRecognitionConfig;
4863    /// use google_cloud_speech_v2::model::RecognitionConfig;
4864    /// let x = StreamingRecognitionConfig::new().set_or_clear_config(Some(RecognitionConfig::default()/* use setters */));
4865    /// let x = StreamingRecognitionConfig::new().set_or_clear_config(None::<RecognitionConfig>);
4866    /// ```
4867    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
4868    where
4869        T: std::convert::Into<crate::model::RecognitionConfig>,
4870    {
4871        self.config = v.map(|x| x.into());
4872        self
4873    }
4874
4875    /// Sets the value of [config_mask][crate::model::StreamingRecognitionConfig::config_mask].
4876    ///
4877    /// # Example
4878    /// ```ignore,no_run
4879    /// # use google_cloud_speech_v2::model::StreamingRecognitionConfig;
4880    /// use wkt::FieldMask;
4881    /// let x = StreamingRecognitionConfig::new().set_config_mask(FieldMask::default()/* use setters */);
4882    /// ```
4883    pub fn set_config_mask<T>(mut self, v: T) -> Self
4884    where
4885        T: std::convert::Into<wkt::FieldMask>,
4886    {
4887        self.config_mask = std::option::Option::Some(v.into());
4888        self
4889    }
4890
4891    /// Sets or clears the value of [config_mask][crate::model::StreamingRecognitionConfig::config_mask].
4892    ///
4893    /// # Example
4894    /// ```ignore,no_run
4895    /// # use google_cloud_speech_v2::model::StreamingRecognitionConfig;
4896    /// use wkt::FieldMask;
4897    /// let x = StreamingRecognitionConfig::new().set_or_clear_config_mask(Some(FieldMask::default()/* use setters */));
4898    /// let x = StreamingRecognitionConfig::new().set_or_clear_config_mask(None::<FieldMask>);
4899    /// ```
4900    pub fn set_or_clear_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
4901    where
4902        T: std::convert::Into<wkt::FieldMask>,
4903    {
4904        self.config_mask = v.map(|x| x.into());
4905        self
4906    }
4907
4908    /// Sets the value of [streaming_features][crate::model::StreamingRecognitionConfig::streaming_features].
4909    ///
4910    /// # Example
4911    /// ```ignore,no_run
4912    /// # use google_cloud_speech_v2::model::StreamingRecognitionConfig;
4913    /// use google_cloud_speech_v2::model::StreamingRecognitionFeatures;
4914    /// let x = StreamingRecognitionConfig::new().set_streaming_features(StreamingRecognitionFeatures::default()/* use setters */);
4915    /// ```
4916    pub fn set_streaming_features<T>(mut self, v: T) -> Self
4917    where
4918        T: std::convert::Into<crate::model::StreamingRecognitionFeatures>,
4919    {
4920        self.streaming_features = std::option::Option::Some(v.into());
4921        self
4922    }
4923
4924    /// Sets or clears the value of [streaming_features][crate::model::StreamingRecognitionConfig::streaming_features].
4925    ///
4926    /// # Example
4927    /// ```ignore,no_run
4928    /// # use google_cloud_speech_v2::model::StreamingRecognitionConfig;
4929    /// use google_cloud_speech_v2::model::StreamingRecognitionFeatures;
4930    /// let x = StreamingRecognitionConfig::new().set_or_clear_streaming_features(Some(StreamingRecognitionFeatures::default()/* use setters */));
4931    /// let x = StreamingRecognitionConfig::new().set_or_clear_streaming_features(None::<StreamingRecognitionFeatures>);
4932    /// ```
4933    pub fn set_or_clear_streaming_features<T>(mut self, v: std::option::Option<T>) -> Self
4934    where
4935        T: std::convert::Into<crate::model::StreamingRecognitionFeatures>,
4936    {
4937        self.streaming_features = v.map(|x| x.into());
4938        self
4939    }
4940}
4941
4942impl wkt::message::Message for StreamingRecognitionConfig {
4943    fn typename() -> &'static str {
4944        "type.googleapis.com/google.cloud.speech.v2.StreamingRecognitionConfig"
4945    }
4946}
4947
4948/// Request message for the
4949/// [StreamingRecognize][google.cloud.speech.v2.Speech.StreamingRecognize]
4950/// method. Multiple
4951/// [StreamingRecognizeRequest][google.cloud.speech.v2.StreamingRecognizeRequest]
4952/// messages are sent in one call.
4953///
4954/// If the [Recognizer][google.cloud.speech.v2.Recognizer] referenced by
4955/// [recognizer][google.cloud.speech.v2.StreamingRecognizeRequest.recognizer]
4956/// contains a fully specified request configuration then the stream may only
4957/// contain messages with only
4958/// [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio] set.
4959///
4960/// Otherwise the first message must contain a
4961/// [recognizer][google.cloud.speech.v2.StreamingRecognizeRequest.recognizer] and
4962/// a
4963/// [streaming_config][google.cloud.speech.v2.StreamingRecognizeRequest.streaming_config]
4964/// message that together fully specify the request configuration and must not
4965/// contain [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio]. All
4966/// subsequent messages must only have
4967/// [audio][google.cloud.speech.v2.StreamingRecognizeRequest.audio] set.
4968///
4969/// [google.cloud.speech.v2.Recognizer]: crate::model::Recognizer
4970/// [google.cloud.speech.v2.StreamingRecognizeRequest]: crate::model::StreamingRecognizeRequest
4971/// [google.cloud.speech.v2.StreamingRecognizeRequest.audio]: crate::model::StreamingRecognizeRequest::streaming_request
4972/// [google.cloud.speech.v2.StreamingRecognizeRequest.recognizer]: crate::model::StreamingRecognizeRequest::recognizer
4973/// [google.cloud.speech.v2.StreamingRecognizeRequest.streaming_config]: crate::model::StreamingRecognizeRequest::streaming_request
4974#[derive(Clone, Default, PartialEq)]
4975#[non_exhaustive]
4976pub struct StreamingRecognizeRequest {
4977    /// Required. The name of the Recognizer to use during recognition. The
4978    /// expected format is
4979    /// `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
4980    /// {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
4981    pub recognizer: std::string::String,
4982
4983    pub streaming_request:
4984        std::option::Option<crate::model::streaming_recognize_request::StreamingRequest>,
4985
4986    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4987}
4988
4989impl StreamingRecognizeRequest {
4990    pub fn new() -> Self {
4991        std::default::Default::default()
4992    }
4993
4994    /// Sets the value of [recognizer][crate::model::StreamingRecognizeRequest::recognizer].
4995    ///
4996    /// # Example
4997    /// ```ignore,no_run
4998    /// # use google_cloud_speech_v2::model::StreamingRecognizeRequest;
4999    /// let x = StreamingRecognizeRequest::new().set_recognizer("example");
5000    /// ```
5001    pub fn set_recognizer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5002        self.recognizer = v.into();
5003        self
5004    }
5005
5006    /// Sets the value of [streaming_request][crate::model::StreamingRecognizeRequest::streaming_request].
5007    ///
5008    /// Note that all the setters affecting `streaming_request` are mutually
5009    /// exclusive.
5010    ///
5011    /// # Example
5012    /// ```ignore,no_run
5013    /// # use google_cloud_speech_v2::model::StreamingRecognizeRequest;
5014    /// use google_cloud_speech_v2::model::streaming_recognize_request::StreamingRequest;
5015    /// let x = StreamingRecognizeRequest::new().set_streaming_request(Some(StreamingRequest::Audio(bytes::Bytes::from_static(b"example"))));
5016    /// ```
5017    pub fn set_streaming_request<
5018        T: std::convert::Into<
5019                std::option::Option<crate::model::streaming_recognize_request::StreamingRequest>,
5020            >,
5021    >(
5022        mut self,
5023        v: T,
5024    ) -> Self {
5025        self.streaming_request = v.into();
5026        self
5027    }
5028
5029    /// The value of [streaming_request][crate::model::StreamingRecognizeRequest::streaming_request]
5030    /// if it holds a `StreamingConfig`, `None` if the field is not set or
5031    /// holds a different branch.
5032    pub fn streaming_config(
5033        &self,
5034    ) -> std::option::Option<&std::boxed::Box<crate::model::StreamingRecognitionConfig>> {
5035        #[allow(unreachable_patterns)]
5036        self.streaming_request.as_ref().and_then(|v| match v {
5037            crate::model::streaming_recognize_request::StreamingRequest::StreamingConfig(v) => {
5038                std::option::Option::Some(v)
5039            }
5040            _ => std::option::Option::None,
5041        })
5042    }
5043
5044    /// Sets the value of [streaming_request][crate::model::StreamingRecognizeRequest::streaming_request]
5045    /// to hold a `StreamingConfig`.
5046    ///
5047    /// Note that all the setters affecting `streaming_request` are
5048    /// mutually exclusive.
5049    ///
5050    /// # Example
5051    /// ```ignore,no_run
5052    /// # use google_cloud_speech_v2::model::StreamingRecognizeRequest;
5053    /// use google_cloud_speech_v2::model::StreamingRecognitionConfig;
5054    /// let x = StreamingRecognizeRequest::new().set_streaming_config(StreamingRecognitionConfig::default()/* use setters */);
5055    /// assert!(x.streaming_config().is_some());
5056    /// assert!(x.audio().is_none());
5057    /// ```
5058    pub fn set_streaming_config<
5059        T: std::convert::Into<std::boxed::Box<crate::model::StreamingRecognitionConfig>>,
5060    >(
5061        mut self,
5062        v: T,
5063    ) -> Self {
5064        self.streaming_request = std::option::Option::Some(
5065            crate::model::streaming_recognize_request::StreamingRequest::StreamingConfig(v.into()),
5066        );
5067        self
5068    }
5069
5070    /// The value of [streaming_request][crate::model::StreamingRecognizeRequest::streaming_request]
5071    /// if it holds a `Audio`, `None` if the field is not set or
5072    /// holds a different branch.
5073    pub fn audio(&self) -> std::option::Option<&::bytes::Bytes> {
5074        #[allow(unreachable_patterns)]
5075        self.streaming_request.as_ref().and_then(|v| match v {
5076            crate::model::streaming_recognize_request::StreamingRequest::Audio(v) => {
5077                std::option::Option::Some(v)
5078            }
5079            _ => std::option::Option::None,
5080        })
5081    }
5082
5083    /// Sets the value of [streaming_request][crate::model::StreamingRecognizeRequest::streaming_request]
5084    /// to hold a `Audio`.
5085    ///
5086    /// Note that all the setters affecting `streaming_request` are
5087    /// mutually exclusive.
5088    ///
5089    /// # Example
5090    /// ```ignore,no_run
5091    /// # use google_cloud_speech_v2::model::StreamingRecognizeRequest;
5092    /// let x = StreamingRecognizeRequest::new().set_audio(bytes::Bytes::from_static(b"example"));
5093    /// assert!(x.audio().is_some());
5094    /// assert!(x.streaming_config().is_none());
5095    /// ```
5096    pub fn set_audio<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5097        self.streaming_request = std::option::Option::Some(
5098            crate::model::streaming_recognize_request::StreamingRequest::Audio(v.into()),
5099        );
5100        self
5101    }
5102}
5103
5104impl wkt::message::Message for StreamingRecognizeRequest {
5105    fn typename() -> &'static str {
5106        "type.googleapis.com/google.cloud.speech.v2.StreamingRecognizeRequest"
5107    }
5108}
5109
5110/// Defines additional types related to [StreamingRecognizeRequest].
5111pub mod streaming_recognize_request {
5112    #[allow(unused_imports)]
5113    use super::*;
5114
5115    #[derive(Clone, Debug, PartialEq)]
5116    #[non_exhaustive]
5117    pub enum StreamingRequest {
5118        /// StreamingRecognitionConfig to be used in this recognition attempt.
5119        /// If provided, it will override the default RecognitionConfig stored in the
5120        /// Recognizer.
5121        StreamingConfig(std::boxed::Box<crate::model::StreamingRecognitionConfig>),
5122        /// Inline audio bytes to be Recognized.
5123        /// Maximum size for this field is 15 KB per request.
5124        Audio(::bytes::Bytes),
5125    }
5126}
5127
5128/// Request message for the
5129/// [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize]
5130/// method.
5131///
5132/// [google.cloud.speech.v2.Speech.BatchRecognize]: crate::client::Speech::batch_recognize
5133#[derive(Clone, Default, PartialEq)]
5134#[non_exhaustive]
5135pub struct BatchRecognizeRequest {
5136    /// Required. The name of the Recognizer to use during recognition. The
5137    /// expected format is
5138    /// `projects/{project}/locations/{location}/recognizers/{recognizer}`. The
5139    /// {recognizer} segment may be set to `_` to use an empty implicit Recognizer.
5140    pub recognizer: std::string::String,
5141
5142    /// Features and audio metadata to use for the Automatic Speech Recognition.
5143    /// This field in combination with the
5144    /// [config_mask][google.cloud.speech.v2.BatchRecognizeRequest.config_mask]
5145    /// field can be used to override parts of the
5146    /// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
5147    /// of the Recognizer resource.
5148    ///
5149    /// [google.cloud.speech.v2.BatchRecognizeRequest.config_mask]: crate::model::BatchRecognizeRequest::config_mask
5150    /// [google.cloud.speech.v2.Recognizer.default_recognition_config]: crate::model::Recognizer::default_recognition_config
5151    pub config: std::option::Option<crate::model::RecognitionConfig>,
5152
5153    /// The list of fields in
5154    /// [config][google.cloud.speech.v2.BatchRecognizeRequest.config] that override
5155    /// the values in the
5156    /// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
5157    /// of the recognizer during this recognition request. If no mask is provided,
5158    /// all given fields in
5159    /// [config][google.cloud.speech.v2.BatchRecognizeRequest.config] override the
5160    /// values in the recognizer for this recognition request. If a mask is
5161    /// provided, only the fields listed in the mask override the config in the
5162    /// recognizer for this recognition request. If a wildcard (`*`) is provided,
5163    /// [config][google.cloud.speech.v2.BatchRecognizeRequest.config] completely
5164    /// overrides and replaces the config in the recognizer for this recognition
5165    /// request.
5166    ///
5167    /// [google.cloud.speech.v2.BatchRecognizeRequest.config]: crate::model::BatchRecognizeRequest::config
5168    /// [google.cloud.speech.v2.Recognizer.default_recognition_config]: crate::model::Recognizer::default_recognition_config
5169    pub config_mask: std::option::Option<wkt::FieldMask>,
5170
5171    /// Audio files with file metadata for ASR.
5172    /// The maximum number of files allowed to be specified is 15.
5173    pub files: std::vec::Vec<crate::model::BatchRecognizeFileMetadata>,
5174
5175    /// Configuration options for where to output the transcripts of each file.
5176    pub recognition_output_config: std::option::Option<crate::model::RecognitionOutputConfig>,
5177
5178    /// Processing strategy to use for this request.
5179    pub processing_strategy: crate::model::batch_recognize_request::ProcessingStrategy,
5180
5181    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5182}
5183
5184impl BatchRecognizeRequest {
5185    pub fn new() -> Self {
5186        std::default::Default::default()
5187    }
5188
5189    /// Sets the value of [recognizer][crate::model::BatchRecognizeRequest::recognizer].
5190    ///
5191    /// # Example
5192    /// ```ignore,no_run
5193    /// # use google_cloud_speech_v2::model::BatchRecognizeRequest;
5194    /// let x = BatchRecognizeRequest::new().set_recognizer("example");
5195    /// ```
5196    pub fn set_recognizer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5197        self.recognizer = v.into();
5198        self
5199    }
5200
5201    /// Sets the value of [config][crate::model::BatchRecognizeRequest::config].
5202    ///
5203    /// # Example
5204    /// ```ignore,no_run
5205    /// # use google_cloud_speech_v2::model::BatchRecognizeRequest;
5206    /// use google_cloud_speech_v2::model::RecognitionConfig;
5207    /// let x = BatchRecognizeRequest::new().set_config(RecognitionConfig::default()/* use setters */);
5208    /// ```
5209    pub fn set_config<T>(mut self, v: T) -> Self
5210    where
5211        T: std::convert::Into<crate::model::RecognitionConfig>,
5212    {
5213        self.config = std::option::Option::Some(v.into());
5214        self
5215    }
5216
5217    /// Sets or clears the value of [config][crate::model::BatchRecognizeRequest::config].
5218    ///
5219    /// # Example
5220    /// ```ignore,no_run
5221    /// # use google_cloud_speech_v2::model::BatchRecognizeRequest;
5222    /// use google_cloud_speech_v2::model::RecognitionConfig;
5223    /// let x = BatchRecognizeRequest::new().set_or_clear_config(Some(RecognitionConfig::default()/* use setters */));
5224    /// let x = BatchRecognizeRequest::new().set_or_clear_config(None::<RecognitionConfig>);
5225    /// ```
5226    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
5227    where
5228        T: std::convert::Into<crate::model::RecognitionConfig>,
5229    {
5230        self.config = v.map(|x| x.into());
5231        self
5232    }
5233
5234    /// Sets the value of [config_mask][crate::model::BatchRecognizeRequest::config_mask].
5235    ///
5236    /// # Example
5237    /// ```ignore,no_run
5238    /// # use google_cloud_speech_v2::model::BatchRecognizeRequest;
5239    /// use wkt::FieldMask;
5240    /// let x = BatchRecognizeRequest::new().set_config_mask(FieldMask::default()/* use setters */);
5241    /// ```
5242    pub fn set_config_mask<T>(mut self, v: T) -> Self
5243    where
5244        T: std::convert::Into<wkt::FieldMask>,
5245    {
5246        self.config_mask = std::option::Option::Some(v.into());
5247        self
5248    }
5249
5250    /// Sets or clears the value of [config_mask][crate::model::BatchRecognizeRequest::config_mask].
5251    ///
5252    /// # Example
5253    /// ```ignore,no_run
5254    /// # use google_cloud_speech_v2::model::BatchRecognizeRequest;
5255    /// use wkt::FieldMask;
5256    /// let x = BatchRecognizeRequest::new().set_or_clear_config_mask(Some(FieldMask::default()/* use setters */));
5257    /// let x = BatchRecognizeRequest::new().set_or_clear_config_mask(None::<FieldMask>);
5258    /// ```
5259    pub fn set_or_clear_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
5260    where
5261        T: std::convert::Into<wkt::FieldMask>,
5262    {
5263        self.config_mask = v.map(|x| x.into());
5264        self
5265    }
5266
5267    /// Sets the value of [files][crate::model::BatchRecognizeRequest::files].
5268    ///
5269    /// # Example
5270    /// ```ignore,no_run
5271    /// # use google_cloud_speech_v2::model::BatchRecognizeRequest;
5272    /// use google_cloud_speech_v2::model::BatchRecognizeFileMetadata;
5273    /// let x = BatchRecognizeRequest::new()
5274    ///     .set_files([
5275    ///         BatchRecognizeFileMetadata::default()/* use setters */,
5276    ///         BatchRecognizeFileMetadata::default()/* use (different) setters */,
5277    ///     ]);
5278    /// ```
5279    pub fn set_files<T, V>(mut self, v: T) -> Self
5280    where
5281        T: std::iter::IntoIterator<Item = V>,
5282        V: std::convert::Into<crate::model::BatchRecognizeFileMetadata>,
5283    {
5284        use std::iter::Iterator;
5285        self.files = v.into_iter().map(|i| i.into()).collect();
5286        self
5287    }
5288
5289    /// Sets the value of [recognition_output_config][crate::model::BatchRecognizeRequest::recognition_output_config].
5290    ///
5291    /// # Example
5292    /// ```ignore,no_run
5293    /// # use google_cloud_speech_v2::model::BatchRecognizeRequest;
5294    /// use google_cloud_speech_v2::model::RecognitionOutputConfig;
5295    /// let x = BatchRecognizeRequest::new().set_recognition_output_config(RecognitionOutputConfig::default()/* use setters */);
5296    /// ```
5297    pub fn set_recognition_output_config<T>(mut self, v: T) -> Self
5298    where
5299        T: std::convert::Into<crate::model::RecognitionOutputConfig>,
5300    {
5301        self.recognition_output_config = std::option::Option::Some(v.into());
5302        self
5303    }
5304
5305    /// Sets or clears the value of [recognition_output_config][crate::model::BatchRecognizeRequest::recognition_output_config].
5306    ///
5307    /// # Example
5308    /// ```ignore,no_run
5309    /// # use google_cloud_speech_v2::model::BatchRecognizeRequest;
5310    /// use google_cloud_speech_v2::model::RecognitionOutputConfig;
5311    /// let x = BatchRecognizeRequest::new().set_or_clear_recognition_output_config(Some(RecognitionOutputConfig::default()/* use setters */));
5312    /// let x = BatchRecognizeRequest::new().set_or_clear_recognition_output_config(None::<RecognitionOutputConfig>);
5313    /// ```
5314    pub fn set_or_clear_recognition_output_config<T>(mut self, v: std::option::Option<T>) -> Self
5315    where
5316        T: std::convert::Into<crate::model::RecognitionOutputConfig>,
5317    {
5318        self.recognition_output_config = v.map(|x| x.into());
5319        self
5320    }
5321
5322    /// Sets the value of [processing_strategy][crate::model::BatchRecognizeRequest::processing_strategy].
5323    ///
5324    /// # Example
5325    /// ```ignore,no_run
5326    /// # use google_cloud_speech_v2::model::BatchRecognizeRequest;
5327    /// use google_cloud_speech_v2::model::batch_recognize_request::ProcessingStrategy;
5328    /// let x0 = BatchRecognizeRequest::new().set_processing_strategy(ProcessingStrategy::DynamicBatching);
5329    /// ```
5330    pub fn set_processing_strategy<
5331        T: std::convert::Into<crate::model::batch_recognize_request::ProcessingStrategy>,
5332    >(
5333        mut self,
5334        v: T,
5335    ) -> Self {
5336        self.processing_strategy = v.into();
5337        self
5338    }
5339}
5340
5341impl wkt::message::Message for BatchRecognizeRequest {
5342    fn typename() -> &'static str {
5343        "type.googleapis.com/google.cloud.speech.v2.BatchRecognizeRequest"
5344    }
5345}
5346
5347/// Defines additional types related to [BatchRecognizeRequest].
5348pub mod batch_recognize_request {
5349    #[allow(unused_imports)]
5350    use super::*;
5351
5352    /// Possible processing strategies for batch requests.
5353    ///
5354    /// # Working with unknown values
5355    ///
5356    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5357    /// additional enum variants at any time. Adding new variants is not considered
5358    /// a breaking change. Applications should write their code in anticipation of:
5359    ///
5360    /// - New values appearing in future releases of the client library, **and**
5361    /// - New values received dynamically, without application changes.
5362    ///
5363    /// Please consult the [Working with enums] section in the user guide for some
5364    /// guidelines.
5365    ///
5366    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5367    #[derive(Clone, Debug, PartialEq)]
5368    #[non_exhaustive]
5369    pub enum ProcessingStrategy {
5370        /// Default value for the processing strategy. The request is processed as
5371        /// soon as its received.
5372        Unspecified,
5373        /// If selected, processes the request during lower utilization periods for a
5374        /// price discount. The request is fulfilled within 24 hours.
5375        DynamicBatching,
5376        /// If set, the enum was initialized with an unknown value.
5377        ///
5378        /// Applications can examine the value using [ProcessingStrategy::value] or
5379        /// [ProcessingStrategy::name].
5380        UnknownValue(processing_strategy::UnknownValue),
5381    }
5382
5383    #[doc(hidden)]
5384    pub mod processing_strategy {
5385        #[allow(unused_imports)]
5386        use super::*;
5387        #[derive(Clone, Debug, PartialEq)]
5388        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5389    }
5390
5391    impl ProcessingStrategy {
5392        /// Gets the enum value.
5393        ///
5394        /// Returns `None` if the enum contains an unknown value deserialized from
5395        /// the string representation of enums.
5396        pub fn value(&self) -> std::option::Option<i32> {
5397            match self {
5398                Self::Unspecified => std::option::Option::Some(0),
5399                Self::DynamicBatching => std::option::Option::Some(1),
5400                Self::UnknownValue(u) => u.0.value(),
5401            }
5402        }
5403
5404        /// Gets the enum value as a string.
5405        ///
5406        /// Returns `None` if the enum contains an unknown value deserialized from
5407        /// the integer representation of enums.
5408        pub fn name(&self) -> std::option::Option<&str> {
5409            match self {
5410                Self::Unspecified => std::option::Option::Some("PROCESSING_STRATEGY_UNSPECIFIED"),
5411                Self::DynamicBatching => std::option::Option::Some("DYNAMIC_BATCHING"),
5412                Self::UnknownValue(u) => u.0.name(),
5413            }
5414        }
5415    }
5416
5417    impl std::default::Default for ProcessingStrategy {
5418        fn default() -> Self {
5419            use std::convert::From;
5420            Self::from(0)
5421        }
5422    }
5423
5424    impl std::fmt::Display for ProcessingStrategy {
5425        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5426            wkt::internal::display_enum(f, self.name(), self.value())
5427        }
5428    }
5429
5430    impl std::convert::From<i32> for ProcessingStrategy {
5431        fn from(value: i32) -> Self {
5432            match value {
5433                0 => Self::Unspecified,
5434                1 => Self::DynamicBatching,
5435                _ => Self::UnknownValue(processing_strategy::UnknownValue(
5436                    wkt::internal::UnknownEnumValue::Integer(value),
5437                )),
5438            }
5439        }
5440    }
5441
5442    impl std::convert::From<&str> for ProcessingStrategy {
5443        fn from(value: &str) -> Self {
5444            use std::string::ToString;
5445            match value {
5446                "PROCESSING_STRATEGY_UNSPECIFIED" => Self::Unspecified,
5447                "DYNAMIC_BATCHING" => Self::DynamicBatching,
5448                _ => Self::UnknownValue(processing_strategy::UnknownValue(
5449                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5450                )),
5451            }
5452        }
5453    }
5454
5455    impl serde::ser::Serialize for ProcessingStrategy {
5456        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5457        where
5458            S: serde::Serializer,
5459        {
5460            match self {
5461                Self::Unspecified => serializer.serialize_i32(0),
5462                Self::DynamicBatching => serializer.serialize_i32(1),
5463                Self::UnknownValue(u) => u.0.serialize(serializer),
5464            }
5465        }
5466    }
5467
5468    impl<'de> serde::de::Deserialize<'de> for ProcessingStrategy {
5469        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5470        where
5471            D: serde::Deserializer<'de>,
5472        {
5473            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProcessingStrategy>::new(
5474                ".google.cloud.speech.v2.BatchRecognizeRequest.ProcessingStrategy",
5475            ))
5476        }
5477    }
5478}
5479
5480/// Output configurations for Cloud Storage.
5481#[derive(Clone, Default, PartialEq)]
5482#[non_exhaustive]
5483pub struct GcsOutputConfig {
5484    /// The Cloud Storage URI prefix with which recognition results will be
5485    /// written.
5486    pub uri: std::string::String,
5487
5488    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5489}
5490
5491impl GcsOutputConfig {
5492    pub fn new() -> Self {
5493        std::default::Default::default()
5494    }
5495
5496    /// Sets the value of [uri][crate::model::GcsOutputConfig::uri].
5497    ///
5498    /// # Example
5499    /// ```ignore,no_run
5500    /// # use google_cloud_speech_v2::model::GcsOutputConfig;
5501    /// let x = GcsOutputConfig::new().set_uri("example");
5502    /// ```
5503    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5504        self.uri = v.into();
5505        self
5506    }
5507}
5508
5509impl wkt::message::Message for GcsOutputConfig {
5510    fn typename() -> &'static str {
5511        "type.googleapis.com/google.cloud.speech.v2.GcsOutputConfig"
5512    }
5513}
5514
5515/// Output configurations for inline response.
5516#[derive(Clone, Default, PartialEq)]
5517#[non_exhaustive]
5518pub struct InlineOutputConfig {
5519    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5520}
5521
5522impl InlineOutputConfig {
5523    pub fn new() -> Self {
5524        std::default::Default::default()
5525    }
5526}
5527
5528impl wkt::message::Message for InlineOutputConfig {
5529    fn typename() -> &'static str {
5530        "type.googleapis.com/google.cloud.speech.v2.InlineOutputConfig"
5531    }
5532}
5533
5534/// Output configurations for serialized `BatchRecognizeResults` protos.
5535#[derive(Clone, Default, PartialEq)]
5536#[non_exhaustive]
5537pub struct NativeOutputFileFormatConfig {
5538    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5539}
5540
5541impl NativeOutputFileFormatConfig {
5542    pub fn new() -> Self {
5543        std::default::Default::default()
5544    }
5545}
5546
5547impl wkt::message::Message for NativeOutputFileFormatConfig {
5548    fn typename() -> &'static str {
5549        "type.googleapis.com/google.cloud.speech.v2.NativeOutputFileFormatConfig"
5550    }
5551}
5552
5553/// Output configurations for [WebVTT](https://www.w3.org/TR/webvtt1/) formatted
5554/// subtitle file.
5555#[derive(Clone, Default, PartialEq)]
5556#[non_exhaustive]
5557pub struct VttOutputFileFormatConfig {
5558    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5559}
5560
5561impl VttOutputFileFormatConfig {
5562    pub fn new() -> Self {
5563        std::default::Default::default()
5564    }
5565}
5566
5567impl wkt::message::Message for VttOutputFileFormatConfig {
5568    fn typename() -> &'static str {
5569        "type.googleapis.com/google.cloud.speech.v2.VttOutputFileFormatConfig"
5570    }
5571}
5572
5573/// Output configurations [SubRip
5574/// Text](https://www.matroska.org/technical/subtitles.html#srt-subtitles)
5575/// formatted subtitle file.
5576#[derive(Clone, Default, PartialEq)]
5577#[non_exhaustive]
5578pub struct SrtOutputFileFormatConfig {
5579    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5580}
5581
5582impl SrtOutputFileFormatConfig {
5583    pub fn new() -> Self {
5584        std::default::Default::default()
5585    }
5586}
5587
5588impl wkt::message::Message for SrtOutputFileFormatConfig {
5589    fn typename() -> &'static str {
5590        "type.googleapis.com/google.cloud.speech.v2.SrtOutputFileFormatConfig"
5591    }
5592}
5593
5594/// Configuration for the format of the results stored to `output`.
5595#[derive(Clone, Default, PartialEq)]
5596#[non_exhaustive]
5597pub struct OutputFormatConfig {
5598    /// Configuration for the native output format. If this field is set or if no
5599    /// other output format field is set, then transcripts will be written to the
5600    /// sink in the native format.
5601    pub native: std::option::Option<crate::model::NativeOutputFileFormatConfig>,
5602
5603    /// Configuration for the VTT output format. If this field is set, then
5604    /// transcripts will be written to the sink in the VTT format.
5605    pub vtt: std::option::Option<crate::model::VttOutputFileFormatConfig>,
5606
5607    /// Configuration for the SRT output format. If this field is set, then
5608    /// transcripts will be written to the sink in the SRT format.
5609    pub srt: std::option::Option<crate::model::SrtOutputFileFormatConfig>,
5610
5611    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5612}
5613
5614impl OutputFormatConfig {
5615    pub fn new() -> Self {
5616        std::default::Default::default()
5617    }
5618
5619    /// Sets the value of [native][crate::model::OutputFormatConfig::native].
5620    ///
5621    /// # Example
5622    /// ```ignore,no_run
5623    /// # use google_cloud_speech_v2::model::OutputFormatConfig;
5624    /// use google_cloud_speech_v2::model::NativeOutputFileFormatConfig;
5625    /// let x = OutputFormatConfig::new().set_native(NativeOutputFileFormatConfig::default()/* use setters */);
5626    /// ```
5627    pub fn set_native<T>(mut self, v: T) -> Self
5628    where
5629        T: std::convert::Into<crate::model::NativeOutputFileFormatConfig>,
5630    {
5631        self.native = std::option::Option::Some(v.into());
5632        self
5633    }
5634
5635    /// Sets or clears the value of [native][crate::model::OutputFormatConfig::native].
5636    ///
5637    /// # Example
5638    /// ```ignore,no_run
5639    /// # use google_cloud_speech_v2::model::OutputFormatConfig;
5640    /// use google_cloud_speech_v2::model::NativeOutputFileFormatConfig;
5641    /// let x = OutputFormatConfig::new().set_or_clear_native(Some(NativeOutputFileFormatConfig::default()/* use setters */));
5642    /// let x = OutputFormatConfig::new().set_or_clear_native(None::<NativeOutputFileFormatConfig>);
5643    /// ```
5644    pub fn set_or_clear_native<T>(mut self, v: std::option::Option<T>) -> Self
5645    where
5646        T: std::convert::Into<crate::model::NativeOutputFileFormatConfig>,
5647    {
5648        self.native = v.map(|x| x.into());
5649        self
5650    }
5651
5652    /// Sets the value of [vtt][crate::model::OutputFormatConfig::vtt].
5653    ///
5654    /// # Example
5655    /// ```ignore,no_run
5656    /// # use google_cloud_speech_v2::model::OutputFormatConfig;
5657    /// use google_cloud_speech_v2::model::VttOutputFileFormatConfig;
5658    /// let x = OutputFormatConfig::new().set_vtt(VttOutputFileFormatConfig::default()/* use setters */);
5659    /// ```
5660    pub fn set_vtt<T>(mut self, v: T) -> Self
5661    where
5662        T: std::convert::Into<crate::model::VttOutputFileFormatConfig>,
5663    {
5664        self.vtt = std::option::Option::Some(v.into());
5665        self
5666    }
5667
5668    /// Sets or clears the value of [vtt][crate::model::OutputFormatConfig::vtt].
5669    ///
5670    /// # Example
5671    /// ```ignore,no_run
5672    /// # use google_cloud_speech_v2::model::OutputFormatConfig;
5673    /// use google_cloud_speech_v2::model::VttOutputFileFormatConfig;
5674    /// let x = OutputFormatConfig::new().set_or_clear_vtt(Some(VttOutputFileFormatConfig::default()/* use setters */));
5675    /// let x = OutputFormatConfig::new().set_or_clear_vtt(None::<VttOutputFileFormatConfig>);
5676    /// ```
5677    pub fn set_or_clear_vtt<T>(mut self, v: std::option::Option<T>) -> Self
5678    where
5679        T: std::convert::Into<crate::model::VttOutputFileFormatConfig>,
5680    {
5681        self.vtt = v.map(|x| x.into());
5682        self
5683    }
5684
5685    /// Sets the value of [srt][crate::model::OutputFormatConfig::srt].
5686    ///
5687    /// # Example
5688    /// ```ignore,no_run
5689    /// # use google_cloud_speech_v2::model::OutputFormatConfig;
5690    /// use google_cloud_speech_v2::model::SrtOutputFileFormatConfig;
5691    /// let x = OutputFormatConfig::new().set_srt(SrtOutputFileFormatConfig::default()/* use setters */);
5692    /// ```
5693    pub fn set_srt<T>(mut self, v: T) -> Self
5694    where
5695        T: std::convert::Into<crate::model::SrtOutputFileFormatConfig>,
5696    {
5697        self.srt = std::option::Option::Some(v.into());
5698        self
5699    }
5700
5701    /// Sets or clears the value of [srt][crate::model::OutputFormatConfig::srt].
5702    ///
5703    /// # Example
5704    /// ```ignore,no_run
5705    /// # use google_cloud_speech_v2::model::OutputFormatConfig;
5706    /// use google_cloud_speech_v2::model::SrtOutputFileFormatConfig;
5707    /// let x = OutputFormatConfig::new().set_or_clear_srt(Some(SrtOutputFileFormatConfig::default()/* use setters */));
5708    /// let x = OutputFormatConfig::new().set_or_clear_srt(None::<SrtOutputFileFormatConfig>);
5709    /// ```
5710    pub fn set_or_clear_srt<T>(mut self, v: std::option::Option<T>) -> Self
5711    where
5712        T: std::convert::Into<crate::model::SrtOutputFileFormatConfig>,
5713    {
5714        self.srt = v.map(|x| x.into());
5715        self
5716    }
5717}
5718
5719impl wkt::message::Message for OutputFormatConfig {
5720    fn typename() -> &'static str {
5721        "type.googleapis.com/google.cloud.speech.v2.OutputFormatConfig"
5722    }
5723}
5724
5725/// Configuration options for the output(s) of recognition.
5726#[derive(Clone, Default, PartialEq)]
5727#[non_exhaustive]
5728pub struct RecognitionOutputConfig {
5729    /// Optional. Configuration for the format of the results stored to `output`.
5730    /// If unspecified transcripts will be written in the `NATIVE` format only.
5731    pub output_format_config: std::option::Option<crate::model::OutputFormatConfig>,
5732
5733    pub output: std::option::Option<crate::model::recognition_output_config::Output>,
5734
5735    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5736}
5737
5738impl RecognitionOutputConfig {
5739    pub fn new() -> Self {
5740        std::default::Default::default()
5741    }
5742
5743    /// Sets the value of [output_format_config][crate::model::RecognitionOutputConfig::output_format_config].
5744    ///
5745    /// # Example
5746    /// ```ignore,no_run
5747    /// # use google_cloud_speech_v2::model::RecognitionOutputConfig;
5748    /// use google_cloud_speech_v2::model::OutputFormatConfig;
5749    /// let x = RecognitionOutputConfig::new().set_output_format_config(OutputFormatConfig::default()/* use setters */);
5750    /// ```
5751    pub fn set_output_format_config<T>(mut self, v: T) -> Self
5752    where
5753        T: std::convert::Into<crate::model::OutputFormatConfig>,
5754    {
5755        self.output_format_config = std::option::Option::Some(v.into());
5756        self
5757    }
5758
5759    /// Sets or clears the value of [output_format_config][crate::model::RecognitionOutputConfig::output_format_config].
5760    ///
5761    /// # Example
5762    /// ```ignore,no_run
5763    /// # use google_cloud_speech_v2::model::RecognitionOutputConfig;
5764    /// use google_cloud_speech_v2::model::OutputFormatConfig;
5765    /// let x = RecognitionOutputConfig::new().set_or_clear_output_format_config(Some(OutputFormatConfig::default()/* use setters */));
5766    /// let x = RecognitionOutputConfig::new().set_or_clear_output_format_config(None::<OutputFormatConfig>);
5767    /// ```
5768    pub fn set_or_clear_output_format_config<T>(mut self, v: std::option::Option<T>) -> Self
5769    where
5770        T: std::convert::Into<crate::model::OutputFormatConfig>,
5771    {
5772        self.output_format_config = v.map(|x| x.into());
5773        self
5774    }
5775
5776    /// Sets the value of [output][crate::model::RecognitionOutputConfig::output].
5777    ///
5778    /// Note that all the setters affecting `output` are mutually
5779    /// exclusive.
5780    ///
5781    /// # Example
5782    /// ```ignore,no_run
5783    /// # use google_cloud_speech_v2::model::RecognitionOutputConfig;
5784    /// use google_cloud_speech_v2::model::GcsOutputConfig;
5785    /// let x = RecognitionOutputConfig::new().set_output(Some(
5786    ///     google_cloud_speech_v2::model::recognition_output_config::Output::GcsOutputConfig(GcsOutputConfig::default().into())));
5787    /// ```
5788    pub fn set_output<
5789        T: std::convert::Into<std::option::Option<crate::model::recognition_output_config::Output>>,
5790    >(
5791        mut self,
5792        v: T,
5793    ) -> Self {
5794        self.output = v.into();
5795        self
5796    }
5797
5798    /// The value of [output][crate::model::RecognitionOutputConfig::output]
5799    /// if it holds a `GcsOutputConfig`, `None` if the field is not set or
5800    /// holds a different branch.
5801    pub fn gcs_output_config(
5802        &self,
5803    ) -> std::option::Option<&std::boxed::Box<crate::model::GcsOutputConfig>> {
5804        #[allow(unreachable_patterns)]
5805        self.output.as_ref().and_then(|v| match v {
5806            crate::model::recognition_output_config::Output::GcsOutputConfig(v) => {
5807                std::option::Option::Some(v)
5808            }
5809            _ => std::option::Option::None,
5810        })
5811    }
5812
5813    /// Sets the value of [output][crate::model::RecognitionOutputConfig::output]
5814    /// to hold a `GcsOutputConfig`.
5815    ///
5816    /// Note that all the setters affecting `output` are
5817    /// mutually exclusive.
5818    ///
5819    /// # Example
5820    /// ```ignore,no_run
5821    /// # use google_cloud_speech_v2::model::RecognitionOutputConfig;
5822    /// use google_cloud_speech_v2::model::GcsOutputConfig;
5823    /// let x = RecognitionOutputConfig::new().set_gcs_output_config(GcsOutputConfig::default()/* use setters */);
5824    /// assert!(x.gcs_output_config().is_some());
5825    /// assert!(x.inline_response_config().is_none());
5826    /// ```
5827    pub fn set_gcs_output_config<
5828        T: std::convert::Into<std::boxed::Box<crate::model::GcsOutputConfig>>,
5829    >(
5830        mut self,
5831        v: T,
5832    ) -> Self {
5833        self.output = std::option::Option::Some(
5834            crate::model::recognition_output_config::Output::GcsOutputConfig(v.into()),
5835        );
5836        self
5837    }
5838
5839    /// The value of [output][crate::model::RecognitionOutputConfig::output]
5840    /// if it holds a `InlineResponseConfig`, `None` if the field is not set or
5841    /// holds a different branch.
5842    pub fn inline_response_config(
5843        &self,
5844    ) -> std::option::Option<&std::boxed::Box<crate::model::InlineOutputConfig>> {
5845        #[allow(unreachable_patterns)]
5846        self.output.as_ref().and_then(|v| match v {
5847            crate::model::recognition_output_config::Output::InlineResponseConfig(v) => {
5848                std::option::Option::Some(v)
5849            }
5850            _ => std::option::Option::None,
5851        })
5852    }
5853
5854    /// Sets the value of [output][crate::model::RecognitionOutputConfig::output]
5855    /// to hold a `InlineResponseConfig`.
5856    ///
5857    /// Note that all the setters affecting `output` are
5858    /// mutually exclusive.
5859    ///
5860    /// # Example
5861    /// ```ignore,no_run
5862    /// # use google_cloud_speech_v2::model::RecognitionOutputConfig;
5863    /// use google_cloud_speech_v2::model::InlineOutputConfig;
5864    /// let x = RecognitionOutputConfig::new().set_inline_response_config(InlineOutputConfig::default()/* use setters */);
5865    /// assert!(x.inline_response_config().is_some());
5866    /// assert!(x.gcs_output_config().is_none());
5867    /// ```
5868    pub fn set_inline_response_config<
5869        T: std::convert::Into<std::boxed::Box<crate::model::InlineOutputConfig>>,
5870    >(
5871        mut self,
5872        v: T,
5873    ) -> Self {
5874        self.output = std::option::Option::Some(
5875            crate::model::recognition_output_config::Output::InlineResponseConfig(v.into()),
5876        );
5877        self
5878    }
5879}
5880
5881impl wkt::message::Message for RecognitionOutputConfig {
5882    fn typename() -> &'static str {
5883        "type.googleapis.com/google.cloud.speech.v2.RecognitionOutputConfig"
5884    }
5885}
5886
5887/// Defines additional types related to [RecognitionOutputConfig].
5888pub mod recognition_output_config {
5889    #[allow(unused_imports)]
5890    use super::*;
5891
5892    #[derive(Clone, Debug, PartialEq)]
5893    #[non_exhaustive]
5894    pub enum Output {
5895        /// If this message is populated, recognition results are written to the
5896        /// provided Google Cloud Storage URI.
5897        GcsOutputConfig(std::boxed::Box<crate::model::GcsOutputConfig>),
5898        /// If this message is populated, recognition results are provided in the
5899        /// [BatchRecognizeResponse][google.cloud.speech.v2.BatchRecognizeResponse]
5900        /// message of the Operation when completed. This is only supported when
5901        /// calling [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize]
5902        /// with just one audio file.
5903        ///
5904        /// [google.cloud.speech.v2.BatchRecognizeResponse]: crate::model::BatchRecognizeResponse
5905        /// [google.cloud.speech.v2.Speech.BatchRecognize]: crate::client::Speech::batch_recognize
5906        InlineResponseConfig(std::boxed::Box<crate::model::InlineOutputConfig>),
5907    }
5908}
5909
5910/// Response message for
5911/// [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize] that is
5912/// packaged into a longrunning [Operation][google.longrunning.Operation].
5913///
5914/// [google.cloud.speech.v2.Speech.BatchRecognize]: crate::client::Speech::batch_recognize
5915/// [google.longrunning.Operation]: longrunning::model::Operation
5916#[derive(Clone, Default, PartialEq)]
5917#[non_exhaustive]
5918pub struct BatchRecognizeResponse {
5919    /// Map from filename to the final result for that file.
5920    pub results:
5921        std::collections::HashMap<std::string::String, crate::model::BatchRecognizeFileResult>,
5922
5923    /// When available, billed audio seconds for the corresponding request.
5924    pub total_billed_duration: std::option::Option<wkt::Duration>,
5925
5926    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5927}
5928
5929impl BatchRecognizeResponse {
5930    pub fn new() -> Self {
5931        std::default::Default::default()
5932    }
5933
5934    /// Sets the value of [results][crate::model::BatchRecognizeResponse::results].
5935    ///
5936    /// # Example
5937    /// ```ignore,no_run
5938    /// # use google_cloud_speech_v2::model::BatchRecognizeResponse;
5939    /// use google_cloud_speech_v2::model::BatchRecognizeFileResult;
5940    /// let x = BatchRecognizeResponse::new().set_results([
5941    ///     ("key0", BatchRecognizeFileResult::default()/* use setters */),
5942    ///     ("key1", BatchRecognizeFileResult::default()/* use (different) setters */),
5943    /// ]);
5944    /// ```
5945    pub fn set_results<T, K, V>(mut self, v: T) -> Self
5946    where
5947        T: std::iter::IntoIterator<Item = (K, V)>,
5948        K: std::convert::Into<std::string::String>,
5949        V: std::convert::Into<crate::model::BatchRecognizeFileResult>,
5950    {
5951        use std::iter::Iterator;
5952        self.results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5953        self
5954    }
5955
5956    /// Sets the value of [total_billed_duration][crate::model::BatchRecognizeResponse::total_billed_duration].
5957    ///
5958    /// # Example
5959    /// ```ignore,no_run
5960    /// # use google_cloud_speech_v2::model::BatchRecognizeResponse;
5961    /// use wkt::Duration;
5962    /// let x = BatchRecognizeResponse::new().set_total_billed_duration(Duration::default()/* use setters */);
5963    /// ```
5964    pub fn set_total_billed_duration<T>(mut self, v: T) -> Self
5965    where
5966        T: std::convert::Into<wkt::Duration>,
5967    {
5968        self.total_billed_duration = std::option::Option::Some(v.into());
5969        self
5970    }
5971
5972    /// Sets or clears the value of [total_billed_duration][crate::model::BatchRecognizeResponse::total_billed_duration].
5973    ///
5974    /// # Example
5975    /// ```ignore,no_run
5976    /// # use google_cloud_speech_v2::model::BatchRecognizeResponse;
5977    /// use wkt::Duration;
5978    /// let x = BatchRecognizeResponse::new().set_or_clear_total_billed_duration(Some(Duration::default()/* use setters */));
5979    /// let x = BatchRecognizeResponse::new().set_or_clear_total_billed_duration(None::<Duration>);
5980    /// ```
5981    pub fn set_or_clear_total_billed_duration<T>(mut self, v: std::option::Option<T>) -> Self
5982    where
5983        T: std::convert::Into<wkt::Duration>,
5984    {
5985        self.total_billed_duration = v.map(|x| x.into());
5986        self
5987    }
5988}
5989
5990impl wkt::message::Message for BatchRecognizeResponse {
5991    fn typename() -> &'static str {
5992        "type.googleapis.com/google.cloud.speech.v2.BatchRecognizeResponse"
5993    }
5994}
5995
5996/// Output type for Cloud Storage of BatchRecognize transcripts. Though this
5997/// proto isn't returned in this API anywhere, the Cloud Storage transcripts will
5998/// be this proto serialized and should be parsed as such.
5999#[derive(Clone, Default, PartialEq)]
6000#[non_exhaustive]
6001pub struct BatchRecognizeResults {
6002    /// Sequential list of transcription results corresponding to sequential
6003    /// portions of audio.
6004    pub results: std::vec::Vec<crate::model::SpeechRecognitionResult>,
6005
6006    /// Metadata about the recognition.
6007    pub metadata: std::option::Option<crate::model::RecognitionResponseMetadata>,
6008
6009    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6010}
6011
6012impl BatchRecognizeResults {
6013    pub fn new() -> Self {
6014        std::default::Default::default()
6015    }
6016
6017    /// Sets the value of [results][crate::model::BatchRecognizeResults::results].
6018    ///
6019    /// # Example
6020    /// ```ignore,no_run
6021    /// # use google_cloud_speech_v2::model::BatchRecognizeResults;
6022    /// use google_cloud_speech_v2::model::SpeechRecognitionResult;
6023    /// let x = BatchRecognizeResults::new()
6024    ///     .set_results([
6025    ///         SpeechRecognitionResult::default()/* use setters */,
6026    ///         SpeechRecognitionResult::default()/* use (different) setters */,
6027    ///     ]);
6028    /// ```
6029    pub fn set_results<T, V>(mut self, v: T) -> Self
6030    where
6031        T: std::iter::IntoIterator<Item = V>,
6032        V: std::convert::Into<crate::model::SpeechRecognitionResult>,
6033    {
6034        use std::iter::Iterator;
6035        self.results = v.into_iter().map(|i| i.into()).collect();
6036        self
6037    }
6038
6039    /// Sets the value of [metadata][crate::model::BatchRecognizeResults::metadata].
6040    ///
6041    /// # Example
6042    /// ```ignore,no_run
6043    /// # use google_cloud_speech_v2::model::BatchRecognizeResults;
6044    /// use google_cloud_speech_v2::model::RecognitionResponseMetadata;
6045    /// let x = BatchRecognizeResults::new().set_metadata(RecognitionResponseMetadata::default()/* use setters */);
6046    /// ```
6047    pub fn set_metadata<T>(mut self, v: T) -> Self
6048    where
6049        T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
6050    {
6051        self.metadata = std::option::Option::Some(v.into());
6052        self
6053    }
6054
6055    /// Sets or clears the value of [metadata][crate::model::BatchRecognizeResults::metadata].
6056    ///
6057    /// # Example
6058    /// ```ignore,no_run
6059    /// # use google_cloud_speech_v2::model::BatchRecognizeResults;
6060    /// use google_cloud_speech_v2::model::RecognitionResponseMetadata;
6061    /// let x = BatchRecognizeResults::new().set_or_clear_metadata(Some(RecognitionResponseMetadata::default()/* use setters */));
6062    /// let x = BatchRecognizeResults::new().set_or_clear_metadata(None::<RecognitionResponseMetadata>);
6063    /// ```
6064    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
6065    where
6066        T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
6067    {
6068        self.metadata = v.map(|x| x.into());
6069        self
6070    }
6071}
6072
6073impl wkt::message::Message for BatchRecognizeResults {
6074    fn typename() -> &'static str {
6075        "type.googleapis.com/google.cloud.speech.v2.BatchRecognizeResults"
6076    }
6077}
6078
6079/// Final results written to Cloud Storage.
6080#[derive(Clone, Default, PartialEq)]
6081#[non_exhaustive]
6082pub struct CloudStorageResult {
6083    /// The Cloud Storage URI to which recognition results were written.
6084    pub uri: std::string::String,
6085
6086    /// The Cloud Storage URI to which recognition results were written as VTT
6087    /// formatted captions. This is populated only when `VTT` output is requested.
6088    pub vtt_format_uri: std::string::String,
6089
6090    /// The Cloud Storage URI to which recognition results were written as SRT
6091    /// formatted captions. This is populated only when `SRT` output is requested.
6092    pub srt_format_uri: std::string::String,
6093
6094    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6095}
6096
6097impl CloudStorageResult {
6098    pub fn new() -> Self {
6099        std::default::Default::default()
6100    }
6101
6102    /// Sets the value of [uri][crate::model::CloudStorageResult::uri].
6103    ///
6104    /// # Example
6105    /// ```ignore,no_run
6106    /// # use google_cloud_speech_v2::model::CloudStorageResult;
6107    /// let x = CloudStorageResult::new().set_uri("example");
6108    /// ```
6109    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6110        self.uri = v.into();
6111        self
6112    }
6113
6114    /// Sets the value of [vtt_format_uri][crate::model::CloudStorageResult::vtt_format_uri].
6115    ///
6116    /// # Example
6117    /// ```ignore,no_run
6118    /// # use google_cloud_speech_v2::model::CloudStorageResult;
6119    /// let x = CloudStorageResult::new().set_vtt_format_uri("example");
6120    /// ```
6121    pub fn set_vtt_format_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6122        self.vtt_format_uri = v.into();
6123        self
6124    }
6125
6126    /// Sets the value of [srt_format_uri][crate::model::CloudStorageResult::srt_format_uri].
6127    ///
6128    /// # Example
6129    /// ```ignore,no_run
6130    /// # use google_cloud_speech_v2::model::CloudStorageResult;
6131    /// let x = CloudStorageResult::new().set_srt_format_uri("example");
6132    /// ```
6133    pub fn set_srt_format_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6134        self.srt_format_uri = v.into();
6135        self
6136    }
6137}
6138
6139impl wkt::message::Message for CloudStorageResult {
6140    fn typename() -> &'static str {
6141        "type.googleapis.com/google.cloud.speech.v2.CloudStorageResult"
6142    }
6143}
6144
6145/// Final results returned inline in the recognition response.
6146#[derive(Clone, Default, PartialEq)]
6147#[non_exhaustive]
6148pub struct InlineResult {
6149    /// The transcript for the audio file.
6150    pub transcript: std::option::Option<crate::model::BatchRecognizeResults>,
6151
6152    /// The transcript for the audio file as VTT formatted captions. This is
6153    /// populated only when `VTT` output is requested.
6154    pub vtt_captions: std::string::String,
6155
6156    /// The transcript for the audio file as SRT formatted captions. This is
6157    /// populated only when `SRT` output is requested.
6158    pub srt_captions: std::string::String,
6159
6160    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6161}
6162
6163impl InlineResult {
6164    pub fn new() -> Self {
6165        std::default::Default::default()
6166    }
6167
6168    /// Sets the value of [transcript][crate::model::InlineResult::transcript].
6169    ///
6170    /// # Example
6171    /// ```ignore,no_run
6172    /// # use google_cloud_speech_v2::model::InlineResult;
6173    /// use google_cloud_speech_v2::model::BatchRecognizeResults;
6174    /// let x = InlineResult::new().set_transcript(BatchRecognizeResults::default()/* use setters */);
6175    /// ```
6176    pub fn set_transcript<T>(mut self, v: T) -> Self
6177    where
6178        T: std::convert::Into<crate::model::BatchRecognizeResults>,
6179    {
6180        self.transcript = std::option::Option::Some(v.into());
6181        self
6182    }
6183
6184    /// Sets or clears the value of [transcript][crate::model::InlineResult::transcript].
6185    ///
6186    /// # Example
6187    /// ```ignore,no_run
6188    /// # use google_cloud_speech_v2::model::InlineResult;
6189    /// use google_cloud_speech_v2::model::BatchRecognizeResults;
6190    /// let x = InlineResult::new().set_or_clear_transcript(Some(BatchRecognizeResults::default()/* use setters */));
6191    /// let x = InlineResult::new().set_or_clear_transcript(None::<BatchRecognizeResults>);
6192    /// ```
6193    pub fn set_or_clear_transcript<T>(mut self, v: std::option::Option<T>) -> Self
6194    where
6195        T: std::convert::Into<crate::model::BatchRecognizeResults>,
6196    {
6197        self.transcript = v.map(|x| x.into());
6198        self
6199    }
6200
6201    /// Sets the value of [vtt_captions][crate::model::InlineResult::vtt_captions].
6202    ///
6203    /// # Example
6204    /// ```ignore,no_run
6205    /// # use google_cloud_speech_v2::model::InlineResult;
6206    /// let x = InlineResult::new().set_vtt_captions("example");
6207    /// ```
6208    pub fn set_vtt_captions<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6209        self.vtt_captions = v.into();
6210        self
6211    }
6212
6213    /// Sets the value of [srt_captions][crate::model::InlineResult::srt_captions].
6214    ///
6215    /// # Example
6216    /// ```ignore,no_run
6217    /// # use google_cloud_speech_v2::model::InlineResult;
6218    /// let x = InlineResult::new().set_srt_captions("example");
6219    /// ```
6220    pub fn set_srt_captions<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6221        self.srt_captions = v.into();
6222        self
6223    }
6224}
6225
6226impl wkt::message::Message for InlineResult {
6227    fn typename() -> &'static str {
6228        "type.googleapis.com/google.cloud.speech.v2.InlineResult"
6229    }
6230}
6231
6232/// Final results for a single file.
6233#[derive(Clone, Default, PartialEq)]
6234#[non_exhaustive]
6235pub struct BatchRecognizeFileResult {
6236    /// Error if one was encountered.
6237    pub error: std::option::Option<rpc::model::Status>,
6238
6239    pub metadata: std::option::Option<crate::model::RecognitionResponseMetadata>,
6240
6241    /// Deprecated. Use `cloud_storage_result.native_format_uri` instead.
6242    #[deprecated]
6243    pub uri: std::string::String,
6244
6245    /// Deprecated. Use `inline_result.transcript` instead.
6246    #[deprecated]
6247    pub transcript: std::option::Option<crate::model::BatchRecognizeResults>,
6248
6249    pub result: std::option::Option<crate::model::batch_recognize_file_result::Result>,
6250
6251    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6252}
6253
6254impl BatchRecognizeFileResult {
6255    pub fn new() -> Self {
6256        std::default::Default::default()
6257    }
6258
6259    /// Sets the value of [error][crate::model::BatchRecognizeFileResult::error].
6260    ///
6261    /// # Example
6262    /// ```ignore,no_run
6263    /// # use google_cloud_speech_v2::model::BatchRecognizeFileResult;
6264    /// use rpc::model::Status;
6265    /// let x = BatchRecognizeFileResult::new().set_error(Status::default()/* use setters */);
6266    /// ```
6267    pub fn set_error<T>(mut self, v: T) -> Self
6268    where
6269        T: std::convert::Into<rpc::model::Status>,
6270    {
6271        self.error = std::option::Option::Some(v.into());
6272        self
6273    }
6274
6275    /// Sets or clears the value of [error][crate::model::BatchRecognizeFileResult::error].
6276    ///
6277    /// # Example
6278    /// ```ignore,no_run
6279    /// # use google_cloud_speech_v2::model::BatchRecognizeFileResult;
6280    /// use rpc::model::Status;
6281    /// let x = BatchRecognizeFileResult::new().set_or_clear_error(Some(Status::default()/* use setters */));
6282    /// let x = BatchRecognizeFileResult::new().set_or_clear_error(None::<Status>);
6283    /// ```
6284    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
6285    where
6286        T: std::convert::Into<rpc::model::Status>,
6287    {
6288        self.error = v.map(|x| x.into());
6289        self
6290    }
6291
6292    /// Sets the value of [metadata][crate::model::BatchRecognizeFileResult::metadata].
6293    ///
6294    /// # Example
6295    /// ```ignore,no_run
6296    /// # use google_cloud_speech_v2::model::BatchRecognizeFileResult;
6297    /// use google_cloud_speech_v2::model::RecognitionResponseMetadata;
6298    /// let x = BatchRecognizeFileResult::new().set_metadata(RecognitionResponseMetadata::default()/* use setters */);
6299    /// ```
6300    pub fn set_metadata<T>(mut self, v: T) -> Self
6301    where
6302        T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
6303    {
6304        self.metadata = std::option::Option::Some(v.into());
6305        self
6306    }
6307
6308    /// Sets or clears the value of [metadata][crate::model::BatchRecognizeFileResult::metadata].
6309    ///
6310    /// # Example
6311    /// ```ignore,no_run
6312    /// # use google_cloud_speech_v2::model::BatchRecognizeFileResult;
6313    /// use google_cloud_speech_v2::model::RecognitionResponseMetadata;
6314    /// let x = BatchRecognizeFileResult::new().set_or_clear_metadata(Some(RecognitionResponseMetadata::default()/* use setters */));
6315    /// let x = BatchRecognizeFileResult::new().set_or_clear_metadata(None::<RecognitionResponseMetadata>);
6316    /// ```
6317    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
6318    where
6319        T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
6320    {
6321        self.metadata = v.map(|x| x.into());
6322        self
6323    }
6324
6325    /// Sets the value of [uri][crate::model::BatchRecognizeFileResult::uri].
6326    ///
6327    /// # Example
6328    /// ```ignore,no_run
6329    /// # use google_cloud_speech_v2::model::BatchRecognizeFileResult;
6330    /// let x = BatchRecognizeFileResult::new().set_uri("example");
6331    /// ```
6332    #[deprecated]
6333    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6334        self.uri = v.into();
6335        self
6336    }
6337
6338    /// Sets the value of [transcript][crate::model::BatchRecognizeFileResult::transcript].
6339    ///
6340    /// # Example
6341    /// ```ignore,no_run
6342    /// # use google_cloud_speech_v2::model::BatchRecognizeFileResult;
6343    /// use google_cloud_speech_v2::model::BatchRecognizeResults;
6344    /// let x = BatchRecognizeFileResult::new().set_transcript(BatchRecognizeResults::default()/* use setters */);
6345    /// ```
6346    #[deprecated]
6347    pub fn set_transcript<T>(mut self, v: T) -> Self
6348    where
6349        T: std::convert::Into<crate::model::BatchRecognizeResults>,
6350    {
6351        self.transcript = std::option::Option::Some(v.into());
6352        self
6353    }
6354
6355    /// Sets or clears the value of [transcript][crate::model::BatchRecognizeFileResult::transcript].
6356    ///
6357    /// # Example
6358    /// ```ignore,no_run
6359    /// # use google_cloud_speech_v2::model::BatchRecognizeFileResult;
6360    /// use google_cloud_speech_v2::model::BatchRecognizeResults;
6361    /// let x = BatchRecognizeFileResult::new().set_or_clear_transcript(Some(BatchRecognizeResults::default()/* use setters */));
6362    /// let x = BatchRecognizeFileResult::new().set_or_clear_transcript(None::<BatchRecognizeResults>);
6363    /// ```
6364    #[deprecated]
6365    pub fn set_or_clear_transcript<T>(mut self, v: std::option::Option<T>) -> Self
6366    where
6367        T: std::convert::Into<crate::model::BatchRecognizeResults>,
6368    {
6369        self.transcript = v.map(|x| x.into());
6370        self
6371    }
6372
6373    /// Sets the value of [result][crate::model::BatchRecognizeFileResult::result].
6374    ///
6375    /// Note that all the setters affecting `result` are mutually
6376    /// exclusive.
6377    ///
6378    /// # Example
6379    /// ```ignore,no_run
6380    /// # use google_cloud_speech_v2::model::BatchRecognizeFileResult;
6381    /// use google_cloud_speech_v2::model::CloudStorageResult;
6382    /// let x = BatchRecognizeFileResult::new().set_result(Some(
6383    ///     google_cloud_speech_v2::model::batch_recognize_file_result::Result::CloudStorageResult(CloudStorageResult::default().into())));
6384    /// ```
6385    pub fn set_result<
6386        T: std::convert::Into<std::option::Option<crate::model::batch_recognize_file_result::Result>>,
6387    >(
6388        mut self,
6389        v: T,
6390    ) -> Self {
6391        self.result = v.into();
6392        self
6393    }
6394
6395    /// The value of [result][crate::model::BatchRecognizeFileResult::result]
6396    /// if it holds a `CloudStorageResult`, `None` if the field is not set or
6397    /// holds a different branch.
6398    pub fn cloud_storage_result(
6399        &self,
6400    ) -> std::option::Option<&std::boxed::Box<crate::model::CloudStorageResult>> {
6401        #[allow(unreachable_patterns)]
6402        self.result.as_ref().and_then(|v| match v {
6403            crate::model::batch_recognize_file_result::Result::CloudStorageResult(v) => {
6404                std::option::Option::Some(v)
6405            }
6406            _ => std::option::Option::None,
6407        })
6408    }
6409
6410    /// Sets the value of [result][crate::model::BatchRecognizeFileResult::result]
6411    /// to hold a `CloudStorageResult`.
6412    ///
6413    /// Note that all the setters affecting `result` are
6414    /// mutually exclusive.
6415    ///
6416    /// # Example
6417    /// ```ignore,no_run
6418    /// # use google_cloud_speech_v2::model::BatchRecognizeFileResult;
6419    /// use google_cloud_speech_v2::model::CloudStorageResult;
6420    /// let x = BatchRecognizeFileResult::new().set_cloud_storage_result(CloudStorageResult::default()/* use setters */);
6421    /// assert!(x.cloud_storage_result().is_some());
6422    /// assert!(x.inline_result().is_none());
6423    /// ```
6424    pub fn set_cloud_storage_result<
6425        T: std::convert::Into<std::boxed::Box<crate::model::CloudStorageResult>>,
6426    >(
6427        mut self,
6428        v: T,
6429    ) -> Self {
6430        self.result = std::option::Option::Some(
6431            crate::model::batch_recognize_file_result::Result::CloudStorageResult(v.into()),
6432        );
6433        self
6434    }
6435
6436    /// The value of [result][crate::model::BatchRecognizeFileResult::result]
6437    /// if it holds a `InlineResult`, `None` if the field is not set or
6438    /// holds a different branch.
6439    pub fn inline_result(
6440        &self,
6441    ) -> std::option::Option<&std::boxed::Box<crate::model::InlineResult>> {
6442        #[allow(unreachable_patterns)]
6443        self.result.as_ref().and_then(|v| match v {
6444            crate::model::batch_recognize_file_result::Result::InlineResult(v) => {
6445                std::option::Option::Some(v)
6446            }
6447            _ => std::option::Option::None,
6448        })
6449    }
6450
6451    /// Sets the value of [result][crate::model::BatchRecognizeFileResult::result]
6452    /// to hold a `InlineResult`.
6453    ///
6454    /// Note that all the setters affecting `result` are
6455    /// mutually exclusive.
6456    ///
6457    /// # Example
6458    /// ```ignore,no_run
6459    /// # use google_cloud_speech_v2::model::BatchRecognizeFileResult;
6460    /// use google_cloud_speech_v2::model::InlineResult;
6461    /// let x = BatchRecognizeFileResult::new().set_inline_result(InlineResult::default()/* use setters */);
6462    /// assert!(x.inline_result().is_some());
6463    /// assert!(x.cloud_storage_result().is_none());
6464    /// ```
6465    pub fn set_inline_result<T: std::convert::Into<std::boxed::Box<crate::model::InlineResult>>>(
6466        mut self,
6467        v: T,
6468    ) -> Self {
6469        self.result = std::option::Option::Some(
6470            crate::model::batch_recognize_file_result::Result::InlineResult(v.into()),
6471        );
6472        self
6473    }
6474}
6475
6476impl wkt::message::Message for BatchRecognizeFileResult {
6477    fn typename() -> &'static str {
6478        "type.googleapis.com/google.cloud.speech.v2.BatchRecognizeFileResult"
6479    }
6480}
6481
6482/// Defines additional types related to [BatchRecognizeFileResult].
6483pub mod batch_recognize_file_result {
6484    #[allow(unused_imports)]
6485    use super::*;
6486
6487    #[derive(Clone, Debug, PartialEq)]
6488    #[non_exhaustive]
6489    pub enum Result {
6490        /// Recognition results written to Cloud Storage. This is
6491        /// populated only when
6492        /// [GcsOutputConfig][google.cloud.speech.v2.GcsOutputConfig] is set in
6493        /// the
6494        /// [RecognitionOutputConfig][[google.cloud.speech.v2.RecognitionOutputConfig].
6495        ///
6496        /// [google.cloud.speech.v2.GcsOutputConfig]: crate::model::GcsOutputConfig
6497        CloudStorageResult(std::boxed::Box<crate::model::CloudStorageResult>),
6498        /// Recognition results. This is populated only when
6499        /// [InlineOutputConfig][google.cloud.speech.v2.InlineOutputConfig] is set in
6500        /// the
6501        /// [RecognitionOutputConfig][[google.cloud.speech.v2.RecognitionOutputConfig].
6502        ///
6503        /// [google.cloud.speech.v2.InlineOutputConfig]: crate::model::InlineOutputConfig
6504        InlineResult(std::boxed::Box<crate::model::InlineResult>),
6505    }
6506}
6507
6508/// Metadata about transcription for a single file (for example, progress
6509/// percent).
6510#[derive(Clone, Default, PartialEq)]
6511#[non_exhaustive]
6512pub struct BatchRecognizeTranscriptionMetadata {
6513    /// How much of the file has been transcribed so far.
6514    pub progress_percent: i32,
6515
6516    /// Error if one was encountered.
6517    pub error: std::option::Option<rpc::model::Status>,
6518
6519    /// The Cloud Storage URI to which recognition results will be written.
6520    pub uri: std::string::String,
6521
6522    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6523}
6524
6525impl BatchRecognizeTranscriptionMetadata {
6526    pub fn new() -> Self {
6527        std::default::Default::default()
6528    }
6529
6530    /// Sets the value of [progress_percent][crate::model::BatchRecognizeTranscriptionMetadata::progress_percent].
6531    ///
6532    /// # Example
6533    /// ```ignore,no_run
6534    /// # use google_cloud_speech_v2::model::BatchRecognizeTranscriptionMetadata;
6535    /// let x = BatchRecognizeTranscriptionMetadata::new().set_progress_percent(42);
6536    /// ```
6537    pub fn set_progress_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6538        self.progress_percent = v.into();
6539        self
6540    }
6541
6542    /// Sets the value of [error][crate::model::BatchRecognizeTranscriptionMetadata::error].
6543    ///
6544    /// # Example
6545    /// ```ignore,no_run
6546    /// # use google_cloud_speech_v2::model::BatchRecognizeTranscriptionMetadata;
6547    /// use rpc::model::Status;
6548    /// let x = BatchRecognizeTranscriptionMetadata::new().set_error(Status::default()/* use setters */);
6549    /// ```
6550    pub fn set_error<T>(mut self, v: T) -> Self
6551    where
6552        T: std::convert::Into<rpc::model::Status>,
6553    {
6554        self.error = std::option::Option::Some(v.into());
6555        self
6556    }
6557
6558    /// Sets or clears the value of [error][crate::model::BatchRecognizeTranscriptionMetadata::error].
6559    ///
6560    /// # Example
6561    /// ```ignore,no_run
6562    /// # use google_cloud_speech_v2::model::BatchRecognizeTranscriptionMetadata;
6563    /// use rpc::model::Status;
6564    /// let x = BatchRecognizeTranscriptionMetadata::new().set_or_clear_error(Some(Status::default()/* use setters */));
6565    /// let x = BatchRecognizeTranscriptionMetadata::new().set_or_clear_error(None::<Status>);
6566    /// ```
6567    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
6568    where
6569        T: std::convert::Into<rpc::model::Status>,
6570    {
6571        self.error = v.map(|x| x.into());
6572        self
6573    }
6574
6575    /// Sets the value of [uri][crate::model::BatchRecognizeTranscriptionMetadata::uri].
6576    ///
6577    /// # Example
6578    /// ```ignore,no_run
6579    /// # use google_cloud_speech_v2::model::BatchRecognizeTranscriptionMetadata;
6580    /// let x = BatchRecognizeTranscriptionMetadata::new().set_uri("example");
6581    /// ```
6582    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6583        self.uri = v.into();
6584        self
6585    }
6586}
6587
6588impl wkt::message::Message for BatchRecognizeTranscriptionMetadata {
6589    fn typename() -> &'static str {
6590        "type.googleapis.com/google.cloud.speech.v2.BatchRecognizeTranscriptionMetadata"
6591    }
6592}
6593
6594/// Operation metadata for
6595/// [BatchRecognize][google.cloud.speech.v2.Speech.BatchRecognize].
6596///
6597/// [google.cloud.speech.v2.Speech.BatchRecognize]: crate::client::Speech::batch_recognize
6598#[derive(Clone, Default, PartialEq)]
6599#[non_exhaustive]
6600pub struct BatchRecognizeMetadata {
6601    /// Map from provided filename to the transcription metadata for that file.
6602    pub transcription_metadata: std::collections::HashMap<
6603        std::string::String,
6604        crate::model::BatchRecognizeTranscriptionMetadata,
6605    >,
6606
6607    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6608}
6609
6610impl BatchRecognizeMetadata {
6611    pub fn new() -> Self {
6612        std::default::Default::default()
6613    }
6614
6615    /// Sets the value of [transcription_metadata][crate::model::BatchRecognizeMetadata::transcription_metadata].
6616    ///
6617    /// # Example
6618    /// ```ignore,no_run
6619    /// # use google_cloud_speech_v2::model::BatchRecognizeMetadata;
6620    /// use google_cloud_speech_v2::model::BatchRecognizeTranscriptionMetadata;
6621    /// let x = BatchRecognizeMetadata::new().set_transcription_metadata([
6622    ///     ("key0", BatchRecognizeTranscriptionMetadata::default()/* use setters */),
6623    ///     ("key1", BatchRecognizeTranscriptionMetadata::default()/* use (different) setters */),
6624    /// ]);
6625    /// ```
6626    pub fn set_transcription_metadata<T, K, V>(mut self, v: T) -> Self
6627    where
6628        T: std::iter::IntoIterator<Item = (K, V)>,
6629        K: std::convert::Into<std::string::String>,
6630        V: std::convert::Into<crate::model::BatchRecognizeTranscriptionMetadata>,
6631    {
6632        use std::iter::Iterator;
6633        self.transcription_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6634        self
6635    }
6636}
6637
6638impl wkt::message::Message for BatchRecognizeMetadata {
6639    fn typename() -> &'static str {
6640        "type.googleapis.com/google.cloud.speech.v2.BatchRecognizeMetadata"
6641    }
6642}
6643
6644/// Metadata about a single file in a batch for BatchRecognize.
6645#[derive(Clone, Default, PartialEq)]
6646#[non_exhaustive]
6647pub struct BatchRecognizeFileMetadata {
6648    /// Features and audio metadata to use for the Automatic Speech Recognition.
6649    /// This field in combination with the
6650    /// [config_mask][google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]
6651    /// field can be used to override parts of the
6652    /// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
6653    /// of the Recognizer resource as well as the
6654    /// [config][google.cloud.speech.v2.BatchRecognizeRequest.config] at the
6655    /// request level.
6656    ///
6657    /// [google.cloud.speech.v2.BatchRecognizeFileMetadata.config_mask]: crate::model::BatchRecognizeFileMetadata::config_mask
6658    /// [google.cloud.speech.v2.BatchRecognizeRequest.config]: crate::model::BatchRecognizeRequest::config
6659    /// [google.cloud.speech.v2.Recognizer.default_recognition_config]: crate::model::Recognizer::default_recognition_config
6660    pub config: std::option::Option<crate::model::RecognitionConfig>,
6661
6662    /// The list of fields in
6663    /// [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] that
6664    /// override the values in the
6665    /// [default_recognition_config][google.cloud.speech.v2.Recognizer.default_recognition_config]
6666    /// of the recognizer during this recognition request. If no mask is provided,
6667    /// all non-default valued fields in
6668    /// [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config] override
6669    /// the values in the recognizer for this recognition request. If a mask is
6670    /// provided, only the fields listed in the mask override the config in the
6671    /// recognizer for this recognition request. If a wildcard (`*`) is provided,
6672    /// [config][google.cloud.speech.v2.BatchRecognizeFileMetadata.config]
6673    /// completely overrides and replaces the config in the recognizer for this
6674    /// recognition request.
6675    ///
6676    /// [google.cloud.speech.v2.BatchRecognizeFileMetadata.config]: crate::model::BatchRecognizeFileMetadata::config
6677    /// [google.cloud.speech.v2.Recognizer.default_recognition_config]: crate::model::Recognizer::default_recognition_config
6678    pub config_mask: std::option::Option<wkt::FieldMask>,
6679
6680    /// The audio source, which is a Google Cloud Storage URI.
6681    pub audio_source: std::option::Option<crate::model::batch_recognize_file_metadata::AudioSource>,
6682
6683    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6684}
6685
6686impl BatchRecognizeFileMetadata {
6687    pub fn new() -> Self {
6688        std::default::Default::default()
6689    }
6690
6691    /// Sets the value of [config][crate::model::BatchRecognizeFileMetadata::config].
6692    ///
6693    /// # Example
6694    /// ```ignore,no_run
6695    /// # use google_cloud_speech_v2::model::BatchRecognizeFileMetadata;
6696    /// use google_cloud_speech_v2::model::RecognitionConfig;
6697    /// let x = BatchRecognizeFileMetadata::new().set_config(RecognitionConfig::default()/* use setters */);
6698    /// ```
6699    pub fn set_config<T>(mut self, v: T) -> Self
6700    where
6701        T: std::convert::Into<crate::model::RecognitionConfig>,
6702    {
6703        self.config = std::option::Option::Some(v.into());
6704        self
6705    }
6706
6707    /// Sets or clears the value of [config][crate::model::BatchRecognizeFileMetadata::config].
6708    ///
6709    /// # Example
6710    /// ```ignore,no_run
6711    /// # use google_cloud_speech_v2::model::BatchRecognizeFileMetadata;
6712    /// use google_cloud_speech_v2::model::RecognitionConfig;
6713    /// let x = BatchRecognizeFileMetadata::new().set_or_clear_config(Some(RecognitionConfig::default()/* use setters */));
6714    /// let x = BatchRecognizeFileMetadata::new().set_or_clear_config(None::<RecognitionConfig>);
6715    /// ```
6716    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
6717    where
6718        T: std::convert::Into<crate::model::RecognitionConfig>,
6719    {
6720        self.config = v.map(|x| x.into());
6721        self
6722    }
6723
6724    /// Sets the value of [config_mask][crate::model::BatchRecognizeFileMetadata::config_mask].
6725    ///
6726    /// # Example
6727    /// ```ignore,no_run
6728    /// # use google_cloud_speech_v2::model::BatchRecognizeFileMetadata;
6729    /// use wkt::FieldMask;
6730    /// let x = BatchRecognizeFileMetadata::new().set_config_mask(FieldMask::default()/* use setters */);
6731    /// ```
6732    pub fn set_config_mask<T>(mut self, v: T) -> Self
6733    where
6734        T: std::convert::Into<wkt::FieldMask>,
6735    {
6736        self.config_mask = std::option::Option::Some(v.into());
6737        self
6738    }
6739
6740    /// Sets or clears the value of [config_mask][crate::model::BatchRecognizeFileMetadata::config_mask].
6741    ///
6742    /// # Example
6743    /// ```ignore,no_run
6744    /// # use google_cloud_speech_v2::model::BatchRecognizeFileMetadata;
6745    /// use wkt::FieldMask;
6746    /// let x = BatchRecognizeFileMetadata::new().set_or_clear_config_mask(Some(FieldMask::default()/* use setters */));
6747    /// let x = BatchRecognizeFileMetadata::new().set_or_clear_config_mask(None::<FieldMask>);
6748    /// ```
6749    pub fn set_or_clear_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
6750    where
6751        T: std::convert::Into<wkt::FieldMask>,
6752    {
6753        self.config_mask = v.map(|x| x.into());
6754        self
6755    }
6756
6757    /// Sets the value of [audio_source][crate::model::BatchRecognizeFileMetadata::audio_source].
6758    ///
6759    /// Note that all the setters affecting `audio_source` are mutually
6760    /// exclusive.
6761    ///
6762    /// # Example
6763    /// ```ignore,no_run
6764    /// # use google_cloud_speech_v2::model::BatchRecognizeFileMetadata;
6765    /// use google_cloud_speech_v2::model::batch_recognize_file_metadata::AudioSource;
6766    /// let x = BatchRecognizeFileMetadata::new().set_audio_source(Some(AudioSource::Uri("example".to_string())));
6767    /// ```
6768    pub fn set_audio_source<
6769        T: std::convert::Into<
6770                std::option::Option<crate::model::batch_recognize_file_metadata::AudioSource>,
6771            >,
6772    >(
6773        mut self,
6774        v: T,
6775    ) -> Self {
6776        self.audio_source = v.into();
6777        self
6778    }
6779
6780    /// The value of [audio_source][crate::model::BatchRecognizeFileMetadata::audio_source]
6781    /// if it holds a `Uri`, `None` if the field is not set or
6782    /// holds a different branch.
6783    pub fn uri(&self) -> std::option::Option<&std::string::String> {
6784        #[allow(unreachable_patterns)]
6785        self.audio_source.as_ref().and_then(|v| match v {
6786            crate::model::batch_recognize_file_metadata::AudioSource::Uri(v) => {
6787                std::option::Option::Some(v)
6788            }
6789            _ => std::option::Option::None,
6790        })
6791    }
6792
6793    /// Sets the value of [audio_source][crate::model::BatchRecognizeFileMetadata::audio_source]
6794    /// to hold a `Uri`.
6795    ///
6796    /// Note that all the setters affecting `audio_source` are
6797    /// mutually exclusive.
6798    ///
6799    /// # Example
6800    /// ```ignore,no_run
6801    /// # use google_cloud_speech_v2::model::BatchRecognizeFileMetadata;
6802    /// let x = BatchRecognizeFileMetadata::new().set_uri("example");
6803    /// assert!(x.uri().is_some());
6804    /// ```
6805    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6806        self.audio_source = std::option::Option::Some(
6807            crate::model::batch_recognize_file_metadata::AudioSource::Uri(v.into()),
6808        );
6809        self
6810    }
6811}
6812
6813impl wkt::message::Message for BatchRecognizeFileMetadata {
6814    fn typename() -> &'static str {
6815        "type.googleapis.com/google.cloud.speech.v2.BatchRecognizeFileMetadata"
6816    }
6817}
6818
6819/// Defines additional types related to [BatchRecognizeFileMetadata].
6820pub mod batch_recognize_file_metadata {
6821    #[allow(unused_imports)]
6822    use super::*;
6823
6824    /// The audio source, which is a Google Cloud Storage URI.
6825    #[derive(Clone, Debug, PartialEq)]
6826    #[non_exhaustive]
6827    pub enum AudioSource {
6828        /// Cloud Storage URI for the audio file.
6829        Uri(std::string::String),
6830    }
6831}
6832
6833/// A streaming speech recognition result corresponding to a portion of the audio
6834/// that is currently being processed.
6835#[derive(Clone, Default, PartialEq)]
6836#[non_exhaustive]
6837pub struct StreamingRecognitionResult {
6838    /// May contain one or more recognition hypotheses. These alternatives are
6839    /// ordered in terms of accuracy, with the top (first) alternative being the
6840    /// most probable, as ranked by the recognizer.
6841    pub alternatives: std::vec::Vec<crate::model::SpeechRecognitionAlternative>,
6842
6843    /// If `false`, this
6844    /// [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult]
6845    /// represents an interim result that may change. If `true`, this is the final
6846    /// time the speech service will return this particular
6847    /// [StreamingRecognitionResult][google.cloud.speech.v2.StreamingRecognitionResult],
6848    /// the recognizer will not return any further hypotheses for this portion of
6849    /// the transcript and corresponding audio.
6850    ///
6851    /// [google.cloud.speech.v2.StreamingRecognitionResult]: crate::model::StreamingRecognitionResult
6852    pub is_final: bool,
6853
6854    /// An estimate of the likelihood that the recognizer will not change its guess
6855    /// about this interim result. Values range from 0.0 (completely unstable)
6856    /// to 1.0 (completely stable). This field is only provided for interim results
6857    /// ([is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`).
6858    /// The default of 0.0 is a sentinel value indicating `stability` was not set.
6859    ///
6860    /// [google.cloud.speech.v2.StreamingRecognitionResult.is_final]: crate::model::StreamingRecognitionResult::is_final
6861    pub stability: f32,
6862
6863    /// Time offset of the end of this result relative to the beginning of the
6864    /// audio.
6865    pub result_end_offset: std::option::Option<wkt::Duration>,
6866
6867    /// For multi-channel audio, this is the channel number corresponding to the
6868    /// recognized result for the audio from that channel.
6869    /// For
6870    /// `audio_channel_count` = `N`, its output values can range from `1` to `N`.
6871    pub channel_tag: i32,
6872
6873    /// Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
6874    /// language tag of the language in this result. This language code was
6875    /// detected to have the most likelihood of being spoken in the audio.
6876    pub language_code: std::string::String,
6877
6878    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6879}
6880
6881impl StreamingRecognitionResult {
6882    pub fn new() -> Self {
6883        std::default::Default::default()
6884    }
6885
6886    /// Sets the value of [alternatives][crate::model::StreamingRecognitionResult::alternatives].
6887    ///
6888    /// # Example
6889    /// ```ignore,no_run
6890    /// # use google_cloud_speech_v2::model::StreamingRecognitionResult;
6891    /// use google_cloud_speech_v2::model::SpeechRecognitionAlternative;
6892    /// let x = StreamingRecognitionResult::new()
6893    ///     .set_alternatives([
6894    ///         SpeechRecognitionAlternative::default()/* use setters */,
6895    ///         SpeechRecognitionAlternative::default()/* use (different) setters */,
6896    ///     ]);
6897    /// ```
6898    pub fn set_alternatives<T, V>(mut self, v: T) -> Self
6899    where
6900        T: std::iter::IntoIterator<Item = V>,
6901        V: std::convert::Into<crate::model::SpeechRecognitionAlternative>,
6902    {
6903        use std::iter::Iterator;
6904        self.alternatives = v.into_iter().map(|i| i.into()).collect();
6905        self
6906    }
6907
6908    /// Sets the value of [is_final][crate::model::StreamingRecognitionResult::is_final].
6909    ///
6910    /// # Example
6911    /// ```ignore,no_run
6912    /// # use google_cloud_speech_v2::model::StreamingRecognitionResult;
6913    /// let x = StreamingRecognitionResult::new().set_is_final(true);
6914    /// ```
6915    pub fn set_is_final<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6916        self.is_final = v.into();
6917        self
6918    }
6919
6920    /// Sets the value of [stability][crate::model::StreamingRecognitionResult::stability].
6921    ///
6922    /// # Example
6923    /// ```ignore,no_run
6924    /// # use google_cloud_speech_v2::model::StreamingRecognitionResult;
6925    /// let x = StreamingRecognitionResult::new().set_stability(42.0);
6926    /// ```
6927    pub fn set_stability<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6928        self.stability = v.into();
6929        self
6930    }
6931
6932    /// Sets the value of [result_end_offset][crate::model::StreamingRecognitionResult::result_end_offset].
6933    ///
6934    /// # Example
6935    /// ```ignore,no_run
6936    /// # use google_cloud_speech_v2::model::StreamingRecognitionResult;
6937    /// use wkt::Duration;
6938    /// let x = StreamingRecognitionResult::new().set_result_end_offset(Duration::default()/* use setters */);
6939    /// ```
6940    pub fn set_result_end_offset<T>(mut self, v: T) -> Self
6941    where
6942        T: std::convert::Into<wkt::Duration>,
6943    {
6944        self.result_end_offset = std::option::Option::Some(v.into());
6945        self
6946    }
6947
6948    /// Sets or clears the value of [result_end_offset][crate::model::StreamingRecognitionResult::result_end_offset].
6949    ///
6950    /// # Example
6951    /// ```ignore,no_run
6952    /// # use google_cloud_speech_v2::model::StreamingRecognitionResult;
6953    /// use wkt::Duration;
6954    /// let x = StreamingRecognitionResult::new().set_or_clear_result_end_offset(Some(Duration::default()/* use setters */));
6955    /// let x = StreamingRecognitionResult::new().set_or_clear_result_end_offset(None::<Duration>);
6956    /// ```
6957    pub fn set_or_clear_result_end_offset<T>(mut self, v: std::option::Option<T>) -> Self
6958    where
6959        T: std::convert::Into<wkt::Duration>,
6960    {
6961        self.result_end_offset = v.map(|x| x.into());
6962        self
6963    }
6964
6965    /// Sets the value of [channel_tag][crate::model::StreamingRecognitionResult::channel_tag].
6966    ///
6967    /// # Example
6968    /// ```ignore,no_run
6969    /// # use google_cloud_speech_v2::model::StreamingRecognitionResult;
6970    /// let x = StreamingRecognitionResult::new().set_channel_tag(42);
6971    /// ```
6972    pub fn set_channel_tag<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6973        self.channel_tag = v.into();
6974        self
6975    }
6976
6977    /// Sets the value of [language_code][crate::model::StreamingRecognitionResult::language_code].
6978    ///
6979    /// # Example
6980    /// ```ignore,no_run
6981    /// # use google_cloud_speech_v2::model::StreamingRecognitionResult;
6982    /// let x = StreamingRecognitionResult::new().set_language_code("example");
6983    /// ```
6984    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6985        self.language_code = v.into();
6986        self
6987    }
6988}
6989
6990impl wkt::message::Message for StreamingRecognitionResult {
6991    fn typename() -> &'static str {
6992        "type.googleapis.com/google.cloud.speech.v2.StreamingRecognitionResult"
6993    }
6994}
6995
6996/// `StreamingRecognizeResponse` is the only message returned to the client by
6997/// `StreamingRecognize`. A series of zero or more `StreamingRecognizeResponse`
6998/// messages are streamed back to the client. If there is no recognizable
6999/// audio then no messages are streamed back to the client.
7000///
7001/// Here are some examples of `StreamingRecognizeResponse`s that might
7002/// be returned while processing audio:
7003///
7004/// 1. results { alternatives { transcript: "tube" } stability: 0.01 }
7005///
7006/// 1. results { alternatives { transcript: "to be a" } stability: 0.01 }
7007///
7008/// 1. results { alternatives { transcript: "to be" } stability: 0.9 }
7009///    results { alternatives { transcript: " or not to be" } stability: 0.01 }
7010///
7011/// 1. results { alternatives { transcript: "to be or not to be"
7012///    confidence: 0.92 }
7013///    alternatives { transcript: "to bee or not to bee" }
7014///    is_final: true }
7015///
7016/// 1. results { alternatives { transcript: " that's" } stability: 0.01 }
7017///
7018/// 1. results { alternatives { transcript: " that is" } stability: 0.9 }
7019///    results { alternatives { transcript: " the question" } stability: 0.01 }
7020///
7021/// 1. results { alternatives { transcript: " that is the question"
7022///    confidence: 0.98 }
7023///    alternatives { transcript: " that was the question" }
7024///    is_final: true }
7025///
7026///
7027/// Notes:
7028///
7029/// - Only two of the above responses #4 and #7 contain final results; they are
7030///   indicated by `is_final: true`. Concatenating these together generates the
7031///   full transcript: "to be or not to be that is the question".
7032///
7033/// - The others contain interim `results`. #3 and #6 contain two interim
7034///   `results`: the first portion has a high stability and is less likely to
7035///   change; the second portion has a low stability and is very likely to
7036///   change. A UI designer might choose to show only high stability `results`.
7037///
7038/// - The specific `stability` and `confidence` values shown above are only for
7039///   illustrative purposes. Actual values may vary.
7040///
7041/// - In each response, only one of these fields will be set:
7042///   `error`,
7043///   `speech_event_type`, or
7044///   one or more (repeated) `results`.
7045///
7046#[derive(Clone, Default, PartialEq)]
7047#[non_exhaustive]
7048pub struct StreamingRecognizeResponse {
7049    /// This repeated list contains zero or more results that
7050    /// correspond to consecutive portions of the audio currently being processed.
7051    /// It contains zero or one
7052    /// [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`true`
7053    /// result (the newly settled portion), followed by zero or more
7054    /// [is_final][google.cloud.speech.v2.StreamingRecognitionResult.is_final]=`false`
7055    /// results (the interim results).
7056    ///
7057    /// [google.cloud.speech.v2.StreamingRecognitionResult.is_final]: crate::model::StreamingRecognitionResult::is_final
7058    pub results: std::vec::Vec<crate::model::StreamingRecognitionResult>,
7059
7060    /// Indicates the type of speech event.
7061    pub speech_event_type: crate::model::streaming_recognize_response::SpeechEventType,
7062
7063    /// Time offset between the beginning of the audio and event emission.
7064    pub speech_event_offset: std::option::Option<wkt::Duration>,
7065
7066    /// Metadata about the recognition.
7067    pub metadata: std::option::Option<crate::model::RecognitionResponseMetadata>,
7068
7069    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7070}
7071
7072impl StreamingRecognizeResponse {
7073    pub fn new() -> Self {
7074        std::default::Default::default()
7075    }
7076
7077    /// Sets the value of [results][crate::model::StreamingRecognizeResponse::results].
7078    ///
7079    /// # Example
7080    /// ```ignore,no_run
7081    /// # use google_cloud_speech_v2::model::StreamingRecognizeResponse;
7082    /// use google_cloud_speech_v2::model::StreamingRecognitionResult;
7083    /// let x = StreamingRecognizeResponse::new()
7084    ///     .set_results([
7085    ///         StreamingRecognitionResult::default()/* use setters */,
7086    ///         StreamingRecognitionResult::default()/* use (different) setters */,
7087    ///     ]);
7088    /// ```
7089    pub fn set_results<T, V>(mut self, v: T) -> Self
7090    where
7091        T: std::iter::IntoIterator<Item = V>,
7092        V: std::convert::Into<crate::model::StreamingRecognitionResult>,
7093    {
7094        use std::iter::Iterator;
7095        self.results = v.into_iter().map(|i| i.into()).collect();
7096        self
7097    }
7098
7099    /// Sets the value of [speech_event_type][crate::model::StreamingRecognizeResponse::speech_event_type].
7100    ///
7101    /// # Example
7102    /// ```ignore,no_run
7103    /// # use google_cloud_speech_v2::model::StreamingRecognizeResponse;
7104    /// use google_cloud_speech_v2::model::streaming_recognize_response::SpeechEventType;
7105    /// let x0 = StreamingRecognizeResponse::new().set_speech_event_type(SpeechEventType::EndOfSingleUtterance);
7106    /// let x1 = StreamingRecognizeResponse::new().set_speech_event_type(SpeechEventType::SpeechActivityBegin);
7107    /// let x2 = StreamingRecognizeResponse::new().set_speech_event_type(SpeechEventType::SpeechActivityEnd);
7108    /// ```
7109    pub fn set_speech_event_type<
7110        T: std::convert::Into<crate::model::streaming_recognize_response::SpeechEventType>,
7111    >(
7112        mut self,
7113        v: T,
7114    ) -> Self {
7115        self.speech_event_type = v.into();
7116        self
7117    }
7118
7119    /// Sets the value of [speech_event_offset][crate::model::StreamingRecognizeResponse::speech_event_offset].
7120    ///
7121    /// # Example
7122    /// ```ignore,no_run
7123    /// # use google_cloud_speech_v2::model::StreamingRecognizeResponse;
7124    /// use wkt::Duration;
7125    /// let x = StreamingRecognizeResponse::new().set_speech_event_offset(Duration::default()/* use setters */);
7126    /// ```
7127    pub fn set_speech_event_offset<T>(mut self, v: T) -> Self
7128    where
7129        T: std::convert::Into<wkt::Duration>,
7130    {
7131        self.speech_event_offset = std::option::Option::Some(v.into());
7132        self
7133    }
7134
7135    /// Sets or clears the value of [speech_event_offset][crate::model::StreamingRecognizeResponse::speech_event_offset].
7136    ///
7137    /// # Example
7138    /// ```ignore,no_run
7139    /// # use google_cloud_speech_v2::model::StreamingRecognizeResponse;
7140    /// use wkt::Duration;
7141    /// let x = StreamingRecognizeResponse::new().set_or_clear_speech_event_offset(Some(Duration::default()/* use setters */));
7142    /// let x = StreamingRecognizeResponse::new().set_or_clear_speech_event_offset(None::<Duration>);
7143    /// ```
7144    pub fn set_or_clear_speech_event_offset<T>(mut self, v: std::option::Option<T>) -> Self
7145    where
7146        T: std::convert::Into<wkt::Duration>,
7147    {
7148        self.speech_event_offset = v.map(|x| x.into());
7149        self
7150    }
7151
7152    /// Sets the value of [metadata][crate::model::StreamingRecognizeResponse::metadata].
7153    ///
7154    /// # Example
7155    /// ```ignore,no_run
7156    /// # use google_cloud_speech_v2::model::StreamingRecognizeResponse;
7157    /// use google_cloud_speech_v2::model::RecognitionResponseMetadata;
7158    /// let x = StreamingRecognizeResponse::new().set_metadata(RecognitionResponseMetadata::default()/* use setters */);
7159    /// ```
7160    pub fn set_metadata<T>(mut self, v: T) -> Self
7161    where
7162        T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
7163    {
7164        self.metadata = std::option::Option::Some(v.into());
7165        self
7166    }
7167
7168    /// Sets or clears the value of [metadata][crate::model::StreamingRecognizeResponse::metadata].
7169    ///
7170    /// # Example
7171    /// ```ignore,no_run
7172    /// # use google_cloud_speech_v2::model::StreamingRecognizeResponse;
7173    /// use google_cloud_speech_v2::model::RecognitionResponseMetadata;
7174    /// let x = StreamingRecognizeResponse::new().set_or_clear_metadata(Some(RecognitionResponseMetadata::default()/* use setters */));
7175    /// let x = StreamingRecognizeResponse::new().set_or_clear_metadata(None::<RecognitionResponseMetadata>);
7176    /// ```
7177    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
7178    where
7179        T: std::convert::Into<crate::model::RecognitionResponseMetadata>,
7180    {
7181        self.metadata = v.map(|x| x.into());
7182        self
7183    }
7184}
7185
7186impl wkt::message::Message for StreamingRecognizeResponse {
7187    fn typename() -> &'static str {
7188        "type.googleapis.com/google.cloud.speech.v2.StreamingRecognizeResponse"
7189    }
7190}
7191
7192/// Defines additional types related to [StreamingRecognizeResponse].
7193pub mod streaming_recognize_response {
7194    #[allow(unused_imports)]
7195    use super::*;
7196
7197    /// Indicates the type of speech event.
7198    ///
7199    /// # Working with unknown values
7200    ///
7201    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7202    /// additional enum variants at any time. Adding new variants is not considered
7203    /// a breaking change. Applications should write their code in anticipation of:
7204    ///
7205    /// - New values appearing in future releases of the client library, **and**
7206    /// - New values received dynamically, without application changes.
7207    ///
7208    /// Please consult the [Working with enums] section in the user guide for some
7209    /// guidelines.
7210    ///
7211    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7212    #[derive(Clone, Debug, PartialEq)]
7213    #[non_exhaustive]
7214    pub enum SpeechEventType {
7215        /// No speech event specified.
7216        Unspecified,
7217        /// This event indicates that the server has detected the end of the user's
7218        /// speech utterance and expects no additional speech. Therefore, the server
7219        /// will not process additional audio and will close the gRPC bidirectional
7220        /// stream. This event is only sent if there was a force cutoff due to
7221        /// silence being detected early. This event is only available through the
7222        /// `latest_short` [model][google.cloud.speech.v2.Recognizer.model].
7223        ///
7224        /// [google.cloud.speech.v2.Recognizer.model]: crate::model::Recognizer::model
7225        EndOfSingleUtterance,
7226        /// This event indicates that the server has detected the beginning of human
7227        /// voice activity in the stream. This event can be returned multiple times
7228        /// if speech starts and stops repeatedly throughout the stream. This event
7229        /// is only sent if `voice_activity_events` is set to true.
7230        SpeechActivityBegin,
7231        /// This event indicates that the server has detected the end of human voice
7232        /// activity in the stream. This event can be returned multiple times if
7233        /// speech starts and stops repeatedly throughout the stream. This event is
7234        /// only sent if `voice_activity_events` is set to true.
7235        SpeechActivityEnd,
7236        /// If set, the enum was initialized with an unknown value.
7237        ///
7238        /// Applications can examine the value using [SpeechEventType::value] or
7239        /// [SpeechEventType::name].
7240        UnknownValue(speech_event_type::UnknownValue),
7241    }
7242
7243    #[doc(hidden)]
7244    pub mod speech_event_type {
7245        #[allow(unused_imports)]
7246        use super::*;
7247        #[derive(Clone, Debug, PartialEq)]
7248        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7249    }
7250
7251    impl SpeechEventType {
7252        /// Gets the enum value.
7253        ///
7254        /// Returns `None` if the enum contains an unknown value deserialized from
7255        /// the string representation of enums.
7256        pub fn value(&self) -> std::option::Option<i32> {
7257            match self {
7258                Self::Unspecified => std::option::Option::Some(0),
7259                Self::EndOfSingleUtterance => std::option::Option::Some(1),
7260                Self::SpeechActivityBegin => std::option::Option::Some(2),
7261                Self::SpeechActivityEnd => std::option::Option::Some(3),
7262                Self::UnknownValue(u) => u.0.value(),
7263            }
7264        }
7265
7266        /// Gets the enum value as a string.
7267        ///
7268        /// Returns `None` if the enum contains an unknown value deserialized from
7269        /// the integer representation of enums.
7270        pub fn name(&self) -> std::option::Option<&str> {
7271            match self {
7272                Self::Unspecified => std::option::Option::Some("SPEECH_EVENT_TYPE_UNSPECIFIED"),
7273                Self::EndOfSingleUtterance => std::option::Option::Some("END_OF_SINGLE_UTTERANCE"),
7274                Self::SpeechActivityBegin => std::option::Option::Some("SPEECH_ACTIVITY_BEGIN"),
7275                Self::SpeechActivityEnd => std::option::Option::Some("SPEECH_ACTIVITY_END"),
7276                Self::UnknownValue(u) => u.0.name(),
7277            }
7278        }
7279    }
7280
7281    impl std::default::Default for SpeechEventType {
7282        fn default() -> Self {
7283            use std::convert::From;
7284            Self::from(0)
7285        }
7286    }
7287
7288    impl std::fmt::Display for SpeechEventType {
7289        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7290            wkt::internal::display_enum(f, self.name(), self.value())
7291        }
7292    }
7293
7294    impl std::convert::From<i32> for SpeechEventType {
7295        fn from(value: i32) -> Self {
7296            match value {
7297                0 => Self::Unspecified,
7298                1 => Self::EndOfSingleUtterance,
7299                2 => Self::SpeechActivityBegin,
7300                3 => Self::SpeechActivityEnd,
7301                _ => Self::UnknownValue(speech_event_type::UnknownValue(
7302                    wkt::internal::UnknownEnumValue::Integer(value),
7303                )),
7304            }
7305        }
7306    }
7307
7308    impl std::convert::From<&str> for SpeechEventType {
7309        fn from(value: &str) -> Self {
7310            use std::string::ToString;
7311            match value {
7312                "SPEECH_EVENT_TYPE_UNSPECIFIED" => Self::Unspecified,
7313                "END_OF_SINGLE_UTTERANCE" => Self::EndOfSingleUtterance,
7314                "SPEECH_ACTIVITY_BEGIN" => Self::SpeechActivityBegin,
7315                "SPEECH_ACTIVITY_END" => Self::SpeechActivityEnd,
7316                _ => Self::UnknownValue(speech_event_type::UnknownValue(
7317                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7318                )),
7319            }
7320        }
7321    }
7322
7323    impl serde::ser::Serialize for SpeechEventType {
7324        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7325        where
7326            S: serde::Serializer,
7327        {
7328            match self {
7329                Self::Unspecified => serializer.serialize_i32(0),
7330                Self::EndOfSingleUtterance => serializer.serialize_i32(1),
7331                Self::SpeechActivityBegin => serializer.serialize_i32(2),
7332                Self::SpeechActivityEnd => serializer.serialize_i32(3),
7333                Self::UnknownValue(u) => u.0.serialize(serializer),
7334            }
7335        }
7336    }
7337
7338    impl<'de> serde::de::Deserialize<'de> for SpeechEventType {
7339        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7340        where
7341            D: serde::Deserializer<'de>,
7342        {
7343            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SpeechEventType>::new(
7344                ".google.cloud.speech.v2.StreamingRecognizeResponse.SpeechEventType",
7345            ))
7346        }
7347    }
7348}
7349
7350/// Message representing the config for the Speech-to-Text API. This includes an
7351/// optional [KMS key](https://cloud.google.com/kms/docs/resource-hierarchy#keys)
7352/// with which incoming data will be encrypted.
7353#[derive(Clone, Default, PartialEq)]
7354#[non_exhaustive]
7355pub struct Config {
7356    /// Output only. Identifier. The name of the config resource. There is exactly
7357    /// one config resource per project per location. The expected format is
7358    /// `projects/{project}/locations/{location}/config`.
7359    pub name: std::string::String,
7360
7361    /// Optional. An optional [KMS key
7362    /// name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) that if
7363    /// present, will be used to encrypt Speech-to-Text resources at-rest. Updating
7364    /// this key will not encrypt existing resources using this key; only new
7365    /// resources will be encrypted using this key. The expected format is
7366    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
7367    pub kms_key_name: std::string::String,
7368
7369    /// Output only. The most recent time this resource was modified.
7370    pub update_time: std::option::Option<wkt::Timestamp>,
7371
7372    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7373}
7374
7375impl Config {
7376    pub fn new() -> Self {
7377        std::default::Default::default()
7378    }
7379
7380    /// Sets the value of [name][crate::model::Config::name].
7381    ///
7382    /// # Example
7383    /// ```ignore,no_run
7384    /// # use google_cloud_speech_v2::model::Config;
7385    /// let x = Config::new().set_name("example");
7386    /// ```
7387    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7388        self.name = v.into();
7389        self
7390    }
7391
7392    /// Sets the value of [kms_key_name][crate::model::Config::kms_key_name].
7393    ///
7394    /// # Example
7395    /// ```ignore,no_run
7396    /// # use google_cloud_speech_v2::model::Config;
7397    /// let x = Config::new().set_kms_key_name("example");
7398    /// ```
7399    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7400        self.kms_key_name = v.into();
7401        self
7402    }
7403
7404    /// Sets the value of [update_time][crate::model::Config::update_time].
7405    ///
7406    /// # Example
7407    /// ```ignore,no_run
7408    /// # use google_cloud_speech_v2::model::Config;
7409    /// use wkt::Timestamp;
7410    /// let x = Config::new().set_update_time(Timestamp::default()/* use setters */);
7411    /// ```
7412    pub fn set_update_time<T>(mut self, v: T) -> Self
7413    where
7414        T: std::convert::Into<wkt::Timestamp>,
7415    {
7416        self.update_time = std::option::Option::Some(v.into());
7417        self
7418    }
7419
7420    /// Sets or clears the value of [update_time][crate::model::Config::update_time].
7421    ///
7422    /// # Example
7423    /// ```ignore,no_run
7424    /// # use google_cloud_speech_v2::model::Config;
7425    /// use wkt::Timestamp;
7426    /// let x = Config::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
7427    /// let x = Config::new().set_or_clear_update_time(None::<Timestamp>);
7428    /// ```
7429    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7430    where
7431        T: std::convert::Into<wkt::Timestamp>,
7432    {
7433        self.update_time = v.map(|x| x.into());
7434        self
7435    }
7436}
7437
7438impl wkt::message::Message for Config {
7439    fn typename() -> &'static str {
7440        "type.googleapis.com/google.cloud.speech.v2.Config"
7441    }
7442}
7443
7444/// Request message for the
7445/// [GetConfig][google.cloud.speech.v2.Speech.GetConfig] method.
7446///
7447/// [google.cloud.speech.v2.Speech.GetConfig]: crate::client::Speech::get_config
7448#[derive(Clone, Default, PartialEq)]
7449#[non_exhaustive]
7450pub struct GetConfigRequest {
7451    /// Required. The name of the config to retrieve. There is exactly one config
7452    /// resource per project per location. The expected format is
7453    /// `projects/{project}/locations/{location}/config`.
7454    pub name: std::string::String,
7455
7456    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7457}
7458
7459impl GetConfigRequest {
7460    pub fn new() -> Self {
7461        std::default::Default::default()
7462    }
7463
7464    /// Sets the value of [name][crate::model::GetConfigRequest::name].
7465    ///
7466    /// # Example
7467    /// ```ignore,no_run
7468    /// # use google_cloud_speech_v2::model::GetConfigRequest;
7469    /// let x = GetConfigRequest::new().set_name("example");
7470    /// ```
7471    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7472        self.name = v.into();
7473        self
7474    }
7475}
7476
7477impl wkt::message::Message for GetConfigRequest {
7478    fn typename() -> &'static str {
7479        "type.googleapis.com/google.cloud.speech.v2.GetConfigRequest"
7480    }
7481}
7482
7483/// Request message for the
7484/// [UpdateConfig][google.cloud.speech.v2.Speech.UpdateConfig] method.
7485///
7486/// [google.cloud.speech.v2.Speech.UpdateConfig]: crate::client::Speech::update_config
7487#[derive(Clone, Default, PartialEq)]
7488#[non_exhaustive]
7489pub struct UpdateConfigRequest {
7490    /// Required. The config to update.
7491    ///
7492    /// The config's `name` field is used to identify the config to be updated.
7493    /// The expected format is `projects/{project}/locations/{location}/config`.
7494    pub config: std::option::Option<crate::model::Config>,
7495
7496    /// The list of fields to be updated.
7497    pub update_mask: std::option::Option<wkt::FieldMask>,
7498
7499    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7500}
7501
7502impl UpdateConfigRequest {
7503    pub fn new() -> Self {
7504        std::default::Default::default()
7505    }
7506
7507    /// Sets the value of [config][crate::model::UpdateConfigRequest::config].
7508    ///
7509    /// # Example
7510    /// ```ignore,no_run
7511    /// # use google_cloud_speech_v2::model::UpdateConfigRequest;
7512    /// use google_cloud_speech_v2::model::Config;
7513    /// let x = UpdateConfigRequest::new().set_config(Config::default()/* use setters */);
7514    /// ```
7515    pub fn set_config<T>(mut self, v: T) -> Self
7516    where
7517        T: std::convert::Into<crate::model::Config>,
7518    {
7519        self.config = std::option::Option::Some(v.into());
7520        self
7521    }
7522
7523    /// Sets or clears the value of [config][crate::model::UpdateConfigRequest::config].
7524    ///
7525    /// # Example
7526    /// ```ignore,no_run
7527    /// # use google_cloud_speech_v2::model::UpdateConfigRequest;
7528    /// use google_cloud_speech_v2::model::Config;
7529    /// let x = UpdateConfigRequest::new().set_or_clear_config(Some(Config::default()/* use setters */));
7530    /// let x = UpdateConfigRequest::new().set_or_clear_config(None::<Config>);
7531    /// ```
7532    pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
7533    where
7534        T: std::convert::Into<crate::model::Config>,
7535    {
7536        self.config = v.map(|x| x.into());
7537        self
7538    }
7539
7540    /// Sets the value of [update_mask][crate::model::UpdateConfigRequest::update_mask].
7541    ///
7542    /// # Example
7543    /// ```ignore,no_run
7544    /// # use google_cloud_speech_v2::model::UpdateConfigRequest;
7545    /// use wkt::FieldMask;
7546    /// let x = UpdateConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
7547    /// ```
7548    pub fn set_update_mask<T>(mut self, v: T) -> Self
7549    where
7550        T: std::convert::Into<wkt::FieldMask>,
7551    {
7552        self.update_mask = std::option::Option::Some(v.into());
7553        self
7554    }
7555
7556    /// Sets or clears the value of [update_mask][crate::model::UpdateConfigRequest::update_mask].
7557    ///
7558    /// # Example
7559    /// ```ignore,no_run
7560    /// # use google_cloud_speech_v2::model::UpdateConfigRequest;
7561    /// use wkt::FieldMask;
7562    /// let x = UpdateConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
7563    /// let x = UpdateConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
7564    /// ```
7565    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7566    where
7567        T: std::convert::Into<wkt::FieldMask>,
7568    {
7569        self.update_mask = v.map(|x| x.into());
7570        self
7571    }
7572}
7573
7574impl wkt::message::Message for UpdateConfigRequest {
7575    fn typename() -> &'static str {
7576        "type.googleapis.com/google.cloud.speech.v2.UpdateConfigRequest"
7577    }
7578}
7579
7580/// CustomClass for biasing in speech recognition. Used to define a set of words
7581/// or phrases that represents a common concept or theme likely to appear in your
7582/// audio, for example a list of passenger ship names.
7583#[derive(Clone, Default, PartialEq)]
7584#[non_exhaustive]
7585pub struct CustomClass {
7586    /// Output only. Identifier. The resource name of the CustomClass.
7587    /// Format:
7588    /// `projects/{project}/locations/{location}/customClasses/{custom_class}`.
7589    pub name: std::string::String,
7590
7591    /// Output only. System-assigned unique identifier for the CustomClass.
7592    pub uid: std::string::String,
7593
7594    /// Optional. User-settable, human-readable name for the CustomClass. Must be
7595    /// 63 characters or less.
7596    pub display_name: std::string::String,
7597
7598    /// A collection of class items.
7599    pub items: std::vec::Vec<crate::model::custom_class::ClassItem>,
7600
7601    /// Output only. The CustomClass lifecycle state.
7602    pub state: crate::model::custom_class::State,
7603
7604    /// Output only. Creation time.
7605    pub create_time: std::option::Option<wkt::Timestamp>,
7606
7607    /// Output only. The most recent time this resource was modified.
7608    pub update_time: std::option::Option<wkt::Timestamp>,
7609
7610    /// Output only. The time at which this resource was requested for deletion.
7611    pub delete_time: std::option::Option<wkt::Timestamp>,
7612
7613    /// Output only. The time at which this resource will be purged.
7614    pub expire_time: std::option::Option<wkt::Timestamp>,
7615
7616    /// Optional. Allows users to store small amounts of arbitrary data.
7617    /// Both the key and the value must be 63 characters or less each.
7618    /// At most 100 annotations.
7619    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
7620
7621    /// Output only. This checksum is computed by the server based on the value of
7622    /// other fields. This may be sent on update, undelete, and delete requests to
7623    /// ensure the client has an up-to-date value before proceeding.
7624    pub etag: std::string::String,
7625
7626    /// Output only. Whether or not this CustomClass is in the process of being
7627    /// updated.
7628    pub reconciling: bool,
7629
7630    /// Output only. The [KMS key
7631    /// name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
7632    /// the CustomClass is encrypted. The expected format is
7633    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
7634    pub kms_key_name: std::string::String,
7635
7636    /// Output only. The [KMS key version
7637    /// name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
7638    /// with which the CustomClass is encrypted. The expected format is
7639    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
7640    pub kms_key_version_name: std::string::String,
7641
7642    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7643}
7644
7645impl CustomClass {
7646    pub fn new() -> Self {
7647        std::default::Default::default()
7648    }
7649
7650    /// Sets the value of [name][crate::model::CustomClass::name].
7651    ///
7652    /// # Example
7653    /// ```ignore,no_run
7654    /// # use google_cloud_speech_v2::model::CustomClass;
7655    /// let x = CustomClass::new().set_name("example");
7656    /// ```
7657    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7658        self.name = v.into();
7659        self
7660    }
7661
7662    /// Sets the value of [uid][crate::model::CustomClass::uid].
7663    ///
7664    /// # Example
7665    /// ```ignore,no_run
7666    /// # use google_cloud_speech_v2::model::CustomClass;
7667    /// let x = CustomClass::new().set_uid("example");
7668    /// ```
7669    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7670        self.uid = v.into();
7671        self
7672    }
7673
7674    /// Sets the value of [display_name][crate::model::CustomClass::display_name].
7675    ///
7676    /// # Example
7677    /// ```ignore,no_run
7678    /// # use google_cloud_speech_v2::model::CustomClass;
7679    /// let x = CustomClass::new().set_display_name("example");
7680    /// ```
7681    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7682        self.display_name = v.into();
7683        self
7684    }
7685
7686    /// Sets the value of [items][crate::model::CustomClass::items].
7687    ///
7688    /// # Example
7689    /// ```ignore,no_run
7690    /// # use google_cloud_speech_v2::model::CustomClass;
7691    /// use google_cloud_speech_v2::model::custom_class::ClassItem;
7692    /// let x = CustomClass::new()
7693    ///     .set_items([
7694    ///         ClassItem::default()/* use setters */,
7695    ///         ClassItem::default()/* use (different) setters */,
7696    ///     ]);
7697    /// ```
7698    pub fn set_items<T, V>(mut self, v: T) -> Self
7699    where
7700        T: std::iter::IntoIterator<Item = V>,
7701        V: std::convert::Into<crate::model::custom_class::ClassItem>,
7702    {
7703        use std::iter::Iterator;
7704        self.items = v.into_iter().map(|i| i.into()).collect();
7705        self
7706    }
7707
7708    /// Sets the value of [state][crate::model::CustomClass::state].
7709    ///
7710    /// # Example
7711    /// ```ignore,no_run
7712    /// # use google_cloud_speech_v2::model::CustomClass;
7713    /// use google_cloud_speech_v2::model::custom_class::State;
7714    /// let x0 = CustomClass::new().set_state(State::Active);
7715    /// let x1 = CustomClass::new().set_state(State::Deleted);
7716    /// ```
7717    pub fn set_state<T: std::convert::Into<crate::model::custom_class::State>>(
7718        mut self,
7719        v: T,
7720    ) -> Self {
7721        self.state = v.into();
7722        self
7723    }
7724
7725    /// Sets the value of [create_time][crate::model::CustomClass::create_time].
7726    ///
7727    /// # Example
7728    /// ```ignore,no_run
7729    /// # use google_cloud_speech_v2::model::CustomClass;
7730    /// use wkt::Timestamp;
7731    /// let x = CustomClass::new().set_create_time(Timestamp::default()/* use setters */);
7732    /// ```
7733    pub fn set_create_time<T>(mut self, v: T) -> Self
7734    where
7735        T: std::convert::Into<wkt::Timestamp>,
7736    {
7737        self.create_time = std::option::Option::Some(v.into());
7738        self
7739    }
7740
7741    /// Sets or clears the value of [create_time][crate::model::CustomClass::create_time].
7742    ///
7743    /// # Example
7744    /// ```ignore,no_run
7745    /// # use google_cloud_speech_v2::model::CustomClass;
7746    /// use wkt::Timestamp;
7747    /// let x = CustomClass::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7748    /// let x = CustomClass::new().set_or_clear_create_time(None::<Timestamp>);
7749    /// ```
7750    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7751    where
7752        T: std::convert::Into<wkt::Timestamp>,
7753    {
7754        self.create_time = v.map(|x| x.into());
7755        self
7756    }
7757
7758    /// Sets the value of [update_time][crate::model::CustomClass::update_time].
7759    ///
7760    /// # Example
7761    /// ```ignore,no_run
7762    /// # use google_cloud_speech_v2::model::CustomClass;
7763    /// use wkt::Timestamp;
7764    /// let x = CustomClass::new().set_update_time(Timestamp::default()/* use setters */);
7765    /// ```
7766    pub fn set_update_time<T>(mut self, v: T) -> Self
7767    where
7768        T: std::convert::Into<wkt::Timestamp>,
7769    {
7770        self.update_time = std::option::Option::Some(v.into());
7771        self
7772    }
7773
7774    /// Sets or clears the value of [update_time][crate::model::CustomClass::update_time].
7775    ///
7776    /// # Example
7777    /// ```ignore,no_run
7778    /// # use google_cloud_speech_v2::model::CustomClass;
7779    /// use wkt::Timestamp;
7780    /// let x = CustomClass::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
7781    /// let x = CustomClass::new().set_or_clear_update_time(None::<Timestamp>);
7782    /// ```
7783    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
7784    where
7785        T: std::convert::Into<wkt::Timestamp>,
7786    {
7787        self.update_time = v.map(|x| x.into());
7788        self
7789    }
7790
7791    /// Sets the value of [delete_time][crate::model::CustomClass::delete_time].
7792    ///
7793    /// # Example
7794    /// ```ignore,no_run
7795    /// # use google_cloud_speech_v2::model::CustomClass;
7796    /// use wkt::Timestamp;
7797    /// let x = CustomClass::new().set_delete_time(Timestamp::default()/* use setters */);
7798    /// ```
7799    pub fn set_delete_time<T>(mut self, v: T) -> Self
7800    where
7801        T: std::convert::Into<wkt::Timestamp>,
7802    {
7803        self.delete_time = std::option::Option::Some(v.into());
7804        self
7805    }
7806
7807    /// Sets or clears the value of [delete_time][crate::model::CustomClass::delete_time].
7808    ///
7809    /// # Example
7810    /// ```ignore,no_run
7811    /// # use google_cloud_speech_v2::model::CustomClass;
7812    /// use wkt::Timestamp;
7813    /// let x = CustomClass::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
7814    /// let x = CustomClass::new().set_or_clear_delete_time(None::<Timestamp>);
7815    /// ```
7816    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
7817    where
7818        T: std::convert::Into<wkt::Timestamp>,
7819    {
7820        self.delete_time = v.map(|x| x.into());
7821        self
7822    }
7823
7824    /// Sets the value of [expire_time][crate::model::CustomClass::expire_time].
7825    ///
7826    /// # Example
7827    /// ```ignore,no_run
7828    /// # use google_cloud_speech_v2::model::CustomClass;
7829    /// use wkt::Timestamp;
7830    /// let x = CustomClass::new().set_expire_time(Timestamp::default()/* use setters */);
7831    /// ```
7832    pub fn set_expire_time<T>(mut self, v: T) -> Self
7833    where
7834        T: std::convert::Into<wkt::Timestamp>,
7835    {
7836        self.expire_time = std::option::Option::Some(v.into());
7837        self
7838    }
7839
7840    /// Sets or clears the value of [expire_time][crate::model::CustomClass::expire_time].
7841    ///
7842    /// # Example
7843    /// ```ignore,no_run
7844    /// # use google_cloud_speech_v2::model::CustomClass;
7845    /// use wkt::Timestamp;
7846    /// let x = CustomClass::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
7847    /// let x = CustomClass::new().set_or_clear_expire_time(None::<Timestamp>);
7848    /// ```
7849    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
7850    where
7851        T: std::convert::Into<wkt::Timestamp>,
7852    {
7853        self.expire_time = v.map(|x| x.into());
7854        self
7855    }
7856
7857    /// Sets the value of [annotations][crate::model::CustomClass::annotations].
7858    ///
7859    /// # Example
7860    /// ```ignore,no_run
7861    /// # use google_cloud_speech_v2::model::CustomClass;
7862    /// let x = CustomClass::new().set_annotations([
7863    ///     ("key0", "abc"),
7864    ///     ("key1", "xyz"),
7865    /// ]);
7866    /// ```
7867    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
7868    where
7869        T: std::iter::IntoIterator<Item = (K, V)>,
7870        K: std::convert::Into<std::string::String>,
7871        V: std::convert::Into<std::string::String>,
7872    {
7873        use std::iter::Iterator;
7874        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7875        self
7876    }
7877
7878    /// Sets the value of [etag][crate::model::CustomClass::etag].
7879    ///
7880    /// # Example
7881    /// ```ignore,no_run
7882    /// # use google_cloud_speech_v2::model::CustomClass;
7883    /// let x = CustomClass::new().set_etag("example");
7884    /// ```
7885    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7886        self.etag = v.into();
7887        self
7888    }
7889
7890    /// Sets the value of [reconciling][crate::model::CustomClass::reconciling].
7891    ///
7892    /// # Example
7893    /// ```ignore,no_run
7894    /// # use google_cloud_speech_v2::model::CustomClass;
7895    /// let x = CustomClass::new().set_reconciling(true);
7896    /// ```
7897    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7898        self.reconciling = v.into();
7899        self
7900    }
7901
7902    /// Sets the value of [kms_key_name][crate::model::CustomClass::kms_key_name].
7903    ///
7904    /// # Example
7905    /// ```ignore,no_run
7906    /// # use google_cloud_speech_v2::model::CustomClass;
7907    /// let x = CustomClass::new().set_kms_key_name("example");
7908    /// ```
7909    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7910        self.kms_key_name = v.into();
7911        self
7912    }
7913
7914    /// Sets the value of [kms_key_version_name][crate::model::CustomClass::kms_key_version_name].
7915    ///
7916    /// # Example
7917    /// ```ignore,no_run
7918    /// # use google_cloud_speech_v2::model::CustomClass;
7919    /// let x = CustomClass::new().set_kms_key_version_name("example");
7920    /// ```
7921    pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
7922        mut self,
7923        v: T,
7924    ) -> Self {
7925        self.kms_key_version_name = v.into();
7926        self
7927    }
7928}
7929
7930impl wkt::message::Message for CustomClass {
7931    fn typename() -> &'static str {
7932        "type.googleapis.com/google.cloud.speech.v2.CustomClass"
7933    }
7934}
7935
7936/// Defines additional types related to [CustomClass].
7937pub mod custom_class {
7938    #[allow(unused_imports)]
7939    use super::*;
7940
7941    /// An item of the class.
7942    #[derive(Clone, Default, PartialEq)]
7943    #[non_exhaustive]
7944    pub struct ClassItem {
7945        /// The class item's value.
7946        pub value: std::string::String,
7947
7948        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7949    }
7950
7951    impl ClassItem {
7952        pub fn new() -> Self {
7953            std::default::Default::default()
7954        }
7955
7956        /// Sets the value of [value][crate::model::custom_class::ClassItem::value].
7957        ///
7958        /// # Example
7959        /// ```ignore,no_run
7960        /// # use google_cloud_speech_v2::model::custom_class::ClassItem;
7961        /// let x = ClassItem::new().set_value("example");
7962        /// ```
7963        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7964            self.value = v.into();
7965            self
7966        }
7967    }
7968
7969    impl wkt::message::Message for ClassItem {
7970        fn typename() -> &'static str {
7971            "type.googleapis.com/google.cloud.speech.v2.CustomClass.ClassItem"
7972        }
7973    }
7974
7975    /// Set of states that define the lifecycle of a CustomClass.
7976    ///
7977    /// # Working with unknown values
7978    ///
7979    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7980    /// additional enum variants at any time. Adding new variants is not considered
7981    /// a breaking change. Applications should write their code in anticipation of:
7982    ///
7983    /// - New values appearing in future releases of the client library, **and**
7984    /// - New values received dynamically, without application changes.
7985    ///
7986    /// Please consult the [Working with enums] section in the user guide for some
7987    /// guidelines.
7988    ///
7989    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7990    #[derive(Clone, Debug, PartialEq)]
7991    #[non_exhaustive]
7992    pub enum State {
7993        /// Unspecified state.  This is only used/useful for distinguishing
7994        /// unset values.
7995        Unspecified,
7996        /// The normal and active state.
7997        Active,
7998        /// This CustomClass has been deleted.
7999        Deleted,
8000        /// If set, the enum was initialized with an unknown value.
8001        ///
8002        /// Applications can examine the value using [State::value] or
8003        /// [State::name].
8004        UnknownValue(state::UnknownValue),
8005    }
8006
8007    #[doc(hidden)]
8008    pub mod state {
8009        #[allow(unused_imports)]
8010        use super::*;
8011        #[derive(Clone, Debug, PartialEq)]
8012        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8013    }
8014
8015    impl State {
8016        /// Gets the enum value.
8017        ///
8018        /// Returns `None` if the enum contains an unknown value deserialized from
8019        /// the string representation of enums.
8020        pub fn value(&self) -> std::option::Option<i32> {
8021            match self {
8022                Self::Unspecified => std::option::Option::Some(0),
8023                Self::Active => std::option::Option::Some(2),
8024                Self::Deleted => std::option::Option::Some(4),
8025                Self::UnknownValue(u) => u.0.value(),
8026            }
8027        }
8028
8029        /// Gets the enum value as a string.
8030        ///
8031        /// Returns `None` if the enum contains an unknown value deserialized from
8032        /// the integer representation of enums.
8033        pub fn name(&self) -> std::option::Option<&str> {
8034            match self {
8035                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
8036                Self::Active => std::option::Option::Some("ACTIVE"),
8037                Self::Deleted => std::option::Option::Some("DELETED"),
8038                Self::UnknownValue(u) => u.0.name(),
8039            }
8040        }
8041    }
8042
8043    impl std::default::Default for State {
8044        fn default() -> Self {
8045            use std::convert::From;
8046            Self::from(0)
8047        }
8048    }
8049
8050    impl std::fmt::Display for State {
8051        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8052            wkt::internal::display_enum(f, self.name(), self.value())
8053        }
8054    }
8055
8056    impl std::convert::From<i32> for State {
8057        fn from(value: i32) -> Self {
8058            match value {
8059                0 => Self::Unspecified,
8060                2 => Self::Active,
8061                4 => Self::Deleted,
8062                _ => Self::UnknownValue(state::UnknownValue(
8063                    wkt::internal::UnknownEnumValue::Integer(value),
8064                )),
8065            }
8066        }
8067    }
8068
8069    impl std::convert::From<&str> for State {
8070        fn from(value: &str) -> Self {
8071            use std::string::ToString;
8072            match value {
8073                "STATE_UNSPECIFIED" => Self::Unspecified,
8074                "ACTIVE" => Self::Active,
8075                "DELETED" => Self::Deleted,
8076                _ => Self::UnknownValue(state::UnknownValue(
8077                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8078                )),
8079            }
8080        }
8081    }
8082
8083    impl serde::ser::Serialize for State {
8084        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8085        where
8086            S: serde::Serializer,
8087        {
8088            match self {
8089                Self::Unspecified => serializer.serialize_i32(0),
8090                Self::Active => serializer.serialize_i32(2),
8091                Self::Deleted => serializer.serialize_i32(4),
8092                Self::UnknownValue(u) => u.0.serialize(serializer),
8093            }
8094        }
8095    }
8096
8097    impl<'de> serde::de::Deserialize<'de> for State {
8098        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8099        where
8100            D: serde::Deserializer<'de>,
8101        {
8102            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
8103                ".google.cloud.speech.v2.CustomClass.State",
8104            ))
8105        }
8106    }
8107}
8108
8109/// PhraseSet for biasing in speech recognition. A PhraseSet is used to provide
8110/// "hints" to the speech recognizer to favor specific words and phrases in the
8111/// results.
8112#[derive(Clone, Default, PartialEq)]
8113#[non_exhaustive]
8114pub struct PhraseSet {
8115    /// Output only. Identifier. The resource name of the PhraseSet.
8116    /// Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
8117    pub name: std::string::String,
8118
8119    /// Output only. System-assigned unique identifier for the PhraseSet.
8120    pub uid: std::string::String,
8121
8122    /// A list of word and phrases.
8123    pub phrases: std::vec::Vec<crate::model::phrase_set::Phrase>,
8124
8125    /// Hint Boost. Positive value will increase the probability that a specific
8126    /// phrase will be recognized over other similar sounding phrases. The higher
8127    /// the boost, the higher the chance of false positive recognition as well.
8128    /// Valid `boost` values are between 0 (exclusive) and 20. We recommend using a
8129    /// binary search approach to finding the optimal value for your use case as
8130    /// well as adding phrases both with and without boost to your requests.
8131    pub boost: f32,
8132
8133    /// User-settable, human-readable name for the PhraseSet. Must be 63
8134    /// characters or less.
8135    pub display_name: std::string::String,
8136
8137    /// Output only. The PhraseSet lifecycle state.
8138    pub state: crate::model::phrase_set::State,
8139
8140    /// Output only. Creation time.
8141    pub create_time: std::option::Option<wkt::Timestamp>,
8142
8143    /// Output only. The most recent time this resource was modified.
8144    pub update_time: std::option::Option<wkt::Timestamp>,
8145
8146    /// Output only. The time at which this resource was requested for deletion.
8147    pub delete_time: std::option::Option<wkt::Timestamp>,
8148
8149    /// Output only. The time at which this resource will be purged.
8150    pub expire_time: std::option::Option<wkt::Timestamp>,
8151
8152    /// Allows users to store small amounts of arbitrary data.
8153    /// Both the key and the value must be 63 characters or less each.
8154    /// At most 100 annotations.
8155    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
8156
8157    /// Output only. This checksum is computed by the server based on the value of
8158    /// other fields. This may be sent on update, undelete, and delete requests to
8159    /// ensure the client has an up-to-date value before proceeding.
8160    pub etag: std::string::String,
8161
8162    /// Output only. Whether or not this PhraseSet is in the process of being
8163    /// updated.
8164    pub reconciling: bool,
8165
8166    /// Output only. The [KMS key
8167    /// name](https://cloud.google.com/kms/docs/resource-hierarchy#keys) with which
8168    /// the PhraseSet is encrypted. The expected format is
8169    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
8170    pub kms_key_name: std::string::String,
8171
8172    /// Output only. The [KMS key version
8173    /// name](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions)
8174    /// with which the PhraseSet is encrypted. The expected format is
8175    /// `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}`.
8176    pub kms_key_version_name: std::string::String,
8177
8178    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8179}
8180
8181impl PhraseSet {
8182    pub fn new() -> Self {
8183        std::default::Default::default()
8184    }
8185
8186    /// Sets the value of [name][crate::model::PhraseSet::name].
8187    ///
8188    /// # Example
8189    /// ```ignore,no_run
8190    /// # use google_cloud_speech_v2::model::PhraseSet;
8191    /// let x = PhraseSet::new().set_name("example");
8192    /// ```
8193    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8194        self.name = v.into();
8195        self
8196    }
8197
8198    /// Sets the value of [uid][crate::model::PhraseSet::uid].
8199    ///
8200    /// # Example
8201    /// ```ignore,no_run
8202    /// # use google_cloud_speech_v2::model::PhraseSet;
8203    /// let x = PhraseSet::new().set_uid("example");
8204    /// ```
8205    pub fn set_uid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8206        self.uid = v.into();
8207        self
8208    }
8209
8210    /// Sets the value of [phrases][crate::model::PhraseSet::phrases].
8211    ///
8212    /// # Example
8213    /// ```ignore,no_run
8214    /// # use google_cloud_speech_v2::model::PhraseSet;
8215    /// use google_cloud_speech_v2::model::phrase_set::Phrase;
8216    /// let x = PhraseSet::new()
8217    ///     .set_phrases([
8218    ///         Phrase::default()/* use setters */,
8219    ///         Phrase::default()/* use (different) setters */,
8220    ///     ]);
8221    /// ```
8222    pub fn set_phrases<T, V>(mut self, v: T) -> Self
8223    where
8224        T: std::iter::IntoIterator<Item = V>,
8225        V: std::convert::Into<crate::model::phrase_set::Phrase>,
8226    {
8227        use std::iter::Iterator;
8228        self.phrases = v.into_iter().map(|i| i.into()).collect();
8229        self
8230    }
8231
8232    /// Sets the value of [boost][crate::model::PhraseSet::boost].
8233    ///
8234    /// # Example
8235    /// ```ignore,no_run
8236    /// # use google_cloud_speech_v2::model::PhraseSet;
8237    /// let x = PhraseSet::new().set_boost(42.0);
8238    /// ```
8239    pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
8240        self.boost = v.into();
8241        self
8242    }
8243
8244    /// Sets the value of [display_name][crate::model::PhraseSet::display_name].
8245    ///
8246    /// # Example
8247    /// ```ignore,no_run
8248    /// # use google_cloud_speech_v2::model::PhraseSet;
8249    /// let x = PhraseSet::new().set_display_name("example");
8250    /// ```
8251    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8252        self.display_name = v.into();
8253        self
8254    }
8255
8256    /// Sets the value of [state][crate::model::PhraseSet::state].
8257    ///
8258    /// # Example
8259    /// ```ignore,no_run
8260    /// # use google_cloud_speech_v2::model::PhraseSet;
8261    /// use google_cloud_speech_v2::model::phrase_set::State;
8262    /// let x0 = PhraseSet::new().set_state(State::Active);
8263    /// let x1 = PhraseSet::new().set_state(State::Deleted);
8264    /// ```
8265    pub fn set_state<T: std::convert::Into<crate::model::phrase_set::State>>(
8266        mut self,
8267        v: T,
8268    ) -> Self {
8269        self.state = v.into();
8270        self
8271    }
8272
8273    /// Sets the value of [create_time][crate::model::PhraseSet::create_time].
8274    ///
8275    /// # Example
8276    /// ```ignore,no_run
8277    /// # use google_cloud_speech_v2::model::PhraseSet;
8278    /// use wkt::Timestamp;
8279    /// let x = PhraseSet::new().set_create_time(Timestamp::default()/* use setters */);
8280    /// ```
8281    pub fn set_create_time<T>(mut self, v: T) -> Self
8282    where
8283        T: std::convert::Into<wkt::Timestamp>,
8284    {
8285        self.create_time = std::option::Option::Some(v.into());
8286        self
8287    }
8288
8289    /// Sets or clears the value of [create_time][crate::model::PhraseSet::create_time].
8290    ///
8291    /// # Example
8292    /// ```ignore,no_run
8293    /// # use google_cloud_speech_v2::model::PhraseSet;
8294    /// use wkt::Timestamp;
8295    /// let x = PhraseSet::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8296    /// let x = PhraseSet::new().set_or_clear_create_time(None::<Timestamp>);
8297    /// ```
8298    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8299    where
8300        T: std::convert::Into<wkt::Timestamp>,
8301    {
8302        self.create_time = v.map(|x| x.into());
8303        self
8304    }
8305
8306    /// Sets the value of [update_time][crate::model::PhraseSet::update_time].
8307    ///
8308    /// # Example
8309    /// ```ignore,no_run
8310    /// # use google_cloud_speech_v2::model::PhraseSet;
8311    /// use wkt::Timestamp;
8312    /// let x = PhraseSet::new().set_update_time(Timestamp::default()/* use setters */);
8313    /// ```
8314    pub fn set_update_time<T>(mut self, v: T) -> Self
8315    where
8316        T: std::convert::Into<wkt::Timestamp>,
8317    {
8318        self.update_time = std::option::Option::Some(v.into());
8319        self
8320    }
8321
8322    /// Sets or clears the value of [update_time][crate::model::PhraseSet::update_time].
8323    ///
8324    /// # Example
8325    /// ```ignore,no_run
8326    /// # use google_cloud_speech_v2::model::PhraseSet;
8327    /// use wkt::Timestamp;
8328    /// let x = PhraseSet::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
8329    /// let x = PhraseSet::new().set_or_clear_update_time(None::<Timestamp>);
8330    /// ```
8331    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
8332    where
8333        T: std::convert::Into<wkt::Timestamp>,
8334    {
8335        self.update_time = v.map(|x| x.into());
8336        self
8337    }
8338
8339    /// Sets the value of [delete_time][crate::model::PhraseSet::delete_time].
8340    ///
8341    /// # Example
8342    /// ```ignore,no_run
8343    /// # use google_cloud_speech_v2::model::PhraseSet;
8344    /// use wkt::Timestamp;
8345    /// let x = PhraseSet::new().set_delete_time(Timestamp::default()/* use setters */);
8346    /// ```
8347    pub fn set_delete_time<T>(mut self, v: T) -> Self
8348    where
8349        T: std::convert::Into<wkt::Timestamp>,
8350    {
8351        self.delete_time = std::option::Option::Some(v.into());
8352        self
8353    }
8354
8355    /// Sets or clears the value of [delete_time][crate::model::PhraseSet::delete_time].
8356    ///
8357    /// # Example
8358    /// ```ignore,no_run
8359    /// # use google_cloud_speech_v2::model::PhraseSet;
8360    /// use wkt::Timestamp;
8361    /// let x = PhraseSet::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
8362    /// let x = PhraseSet::new().set_or_clear_delete_time(None::<Timestamp>);
8363    /// ```
8364    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
8365    where
8366        T: std::convert::Into<wkt::Timestamp>,
8367    {
8368        self.delete_time = v.map(|x| x.into());
8369        self
8370    }
8371
8372    /// Sets the value of [expire_time][crate::model::PhraseSet::expire_time].
8373    ///
8374    /// # Example
8375    /// ```ignore,no_run
8376    /// # use google_cloud_speech_v2::model::PhraseSet;
8377    /// use wkt::Timestamp;
8378    /// let x = PhraseSet::new().set_expire_time(Timestamp::default()/* use setters */);
8379    /// ```
8380    pub fn set_expire_time<T>(mut self, v: T) -> Self
8381    where
8382        T: std::convert::Into<wkt::Timestamp>,
8383    {
8384        self.expire_time = std::option::Option::Some(v.into());
8385        self
8386    }
8387
8388    /// Sets or clears the value of [expire_time][crate::model::PhraseSet::expire_time].
8389    ///
8390    /// # Example
8391    /// ```ignore,no_run
8392    /// # use google_cloud_speech_v2::model::PhraseSet;
8393    /// use wkt::Timestamp;
8394    /// let x = PhraseSet::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
8395    /// let x = PhraseSet::new().set_or_clear_expire_time(None::<Timestamp>);
8396    /// ```
8397    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
8398    where
8399        T: std::convert::Into<wkt::Timestamp>,
8400    {
8401        self.expire_time = v.map(|x| x.into());
8402        self
8403    }
8404
8405    /// Sets the value of [annotations][crate::model::PhraseSet::annotations].
8406    ///
8407    /// # Example
8408    /// ```ignore,no_run
8409    /// # use google_cloud_speech_v2::model::PhraseSet;
8410    /// let x = PhraseSet::new().set_annotations([
8411    ///     ("key0", "abc"),
8412    ///     ("key1", "xyz"),
8413    /// ]);
8414    /// ```
8415    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
8416    where
8417        T: std::iter::IntoIterator<Item = (K, V)>,
8418        K: std::convert::Into<std::string::String>,
8419        V: std::convert::Into<std::string::String>,
8420    {
8421        use std::iter::Iterator;
8422        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8423        self
8424    }
8425
8426    /// Sets the value of [etag][crate::model::PhraseSet::etag].
8427    ///
8428    /// # Example
8429    /// ```ignore,no_run
8430    /// # use google_cloud_speech_v2::model::PhraseSet;
8431    /// let x = PhraseSet::new().set_etag("example");
8432    /// ```
8433    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8434        self.etag = v.into();
8435        self
8436    }
8437
8438    /// Sets the value of [reconciling][crate::model::PhraseSet::reconciling].
8439    ///
8440    /// # Example
8441    /// ```ignore,no_run
8442    /// # use google_cloud_speech_v2::model::PhraseSet;
8443    /// let x = PhraseSet::new().set_reconciling(true);
8444    /// ```
8445    pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8446        self.reconciling = v.into();
8447        self
8448    }
8449
8450    /// Sets the value of [kms_key_name][crate::model::PhraseSet::kms_key_name].
8451    ///
8452    /// # Example
8453    /// ```ignore,no_run
8454    /// # use google_cloud_speech_v2::model::PhraseSet;
8455    /// let x = PhraseSet::new().set_kms_key_name("example");
8456    /// ```
8457    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8458        self.kms_key_name = v.into();
8459        self
8460    }
8461
8462    /// Sets the value of [kms_key_version_name][crate::model::PhraseSet::kms_key_version_name].
8463    ///
8464    /// # Example
8465    /// ```ignore,no_run
8466    /// # use google_cloud_speech_v2::model::PhraseSet;
8467    /// let x = PhraseSet::new().set_kms_key_version_name("example");
8468    /// ```
8469    pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
8470        mut self,
8471        v: T,
8472    ) -> Self {
8473        self.kms_key_version_name = v.into();
8474        self
8475    }
8476}
8477
8478impl wkt::message::Message for PhraseSet {
8479    fn typename() -> &'static str {
8480        "type.googleapis.com/google.cloud.speech.v2.PhraseSet"
8481    }
8482}
8483
8484/// Defines additional types related to [PhraseSet].
8485pub mod phrase_set {
8486    #[allow(unused_imports)]
8487    use super::*;
8488
8489    /// A Phrase contains words and phrase "hints" so that the speech recognition
8490    /// is more likely to recognize them. This can be used to improve the accuracy
8491    /// for specific words and phrases, for example, if specific commands are
8492    /// typically spoken by the user. This can also be used to add additional words
8493    /// to the vocabulary of the recognizer.
8494    ///
8495    /// List items can also include CustomClass references containing groups of
8496    /// words that represent common concepts that occur in natural language.
8497    #[derive(Clone, Default, PartialEq)]
8498    #[non_exhaustive]
8499    pub struct Phrase {
8500        /// The phrase itself.
8501        pub value: std::string::String,
8502
8503        /// Hint Boost. Overrides the boost set at the phrase set level.
8504        /// Positive value will increase the probability that a specific phrase will
8505        /// be recognized over other similar sounding phrases. The higher the boost,
8506        /// the higher the chance of false positive recognition as well. Negative
8507        /// boost values would correspond to anti-biasing. Anti-biasing is not
8508        /// enabled, so negative boost values will return an error. Boost values must
8509        /// be between 0 and 20. Any values outside that range will return an error.
8510        /// We recommend using a binary search approach to finding the optimal value
8511        /// for your use case as well as adding phrases both with and without boost
8512        /// to your requests.
8513        pub boost: f32,
8514
8515        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8516    }
8517
8518    impl Phrase {
8519        pub fn new() -> Self {
8520            std::default::Default::default()
8521        }
8522
8523        /// Sets the value of [value][crate::model::phrase_set::Phrase::value].
8524        ///
8525        /// # Example
8526        /// ```ignore,no_run
8527        /// # use google_cloud_speech_v2::model::phrase_set::Phrase;
8528        /// let x = Phrase::new().set_value("example");
8529        /// ```
8530        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8531            self.value = v.into();
8532            self
8533        }
8534
8535        /// Sets the value of [boost][crate::model::phrase_set::Phrase::boost].
8536        ///
8537        /// # Example
8538        /// ```ignore,no_run
8539        /// # use google_cloud_speech_v2::model::phrase_set::Phrase;
8540        /// let x = Phrase::new().set_boost(42.0);
8541        /// ```
8542        pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
8543            self.boost = v.into();
8544            self
8545        }
8546    }
8547
8548    impl wkt::message::Message for Phrase {
8549        fn typename() -> &'static str {
8550            "type.googleapis.com/google.cloud.speech.v2.PhraseSet.Phrase"
8551        }
8552    }
8553
8554    /// Set of states that define the lifecycle of a PhraseSet.
8555    ///
8556    /// # Working with unknown values
8557    ///
8558    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8559    /// additional enum variants at any time. Adding new variants is not considered
8560    /// a breaking change. Applications should write their code in anticipation of:
8561    ///
8562    /// - New values appearing in future releases of the client library, **and**
8563    /// - New values received dynamically, without application changes.
8564    ///
8565    /// Please consult the [Working with enums] section in the user guide for some
8566    /// guidelines.
8567    ///
8568    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8569    #[derive(Clone, Debug, PartialEq)]
8570    #[non_exhaustive]
8571    pub enum State {
8572        /// Unspecified state.  This is only used/useful for distinguishing
8573        /// unset values.
8574        Unspecified,
8575        /// The normal and active state.
8576        Active,
8577        /// This PhraseSet has been deleted.
8578        Deleted,
8579        /// If set, the enum was initialized with an unknown value.
8580        ///
8581        /// Applications can examine the value using [State::value] or
8582        /// [State::name].
8583        UnknownValue(state::UnknownValue),
8584    }
8585
8586    #[doc(hidden)]
8587    pub mod state {
8588        #[allow(unused_imports)]
8589        use super::*;
8590        #[derive(Clone, Debug, PartialEq)]
8591        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8592    }
8593
8594    impl State {
8595        /// Gets the enum value.
8596        ///
8597        /// Returns `None` if the enum contains an unknown value deserialized from
8598        /// the string representation of enums.
8599        pub fn value(&self) -> std::option::Option<i32> {
8600            match self {
8601                Self::Unspecified => std::option::Option::Some(0),
8602                Self::Active => std::option::Option::Some(2),
8603                Self::Deleted => std::option::Option::Some(4),
8604                Self::UnknownValue(u) => u.0.value(),
8605            }
8606        }
8607
8608        /// Gets the enum value as a string.
8609        ///
8610        /// Returns `None` if the enum contains an unknown value deserialized from
8611        /// the integer representation of enums.
8612        pub fn name(&self) -> std::option::Option<&str> {
8613            match self {
8614                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
8615                Self::Active => std::option::Option::Some("ACTIVE"),
8616                Self::Deleted => std::option::Option::Some("DELETED"),
8617                Self::UnknownValue(u) => u.0.name(),
8618            }
8619        }
8620    }
8621
8622    impl std::default::Default for State {
8623        fn default() -> Self {
8624            use std::convert::From;
8625            Self::from(0)
8626        }
8627    }
8628
8629    impl std::fmt::Display for State {
8630        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8631            wkt::internal::display_enum(f, self.name(), self.value())
8632        }
8633    }
8634
8635    impl std::convert::From<i32> for State {
8636        fn from(value: i32) -> Self {
8637            match value {
8638                0 => Self::Unspecified,
8639                2 => Self::Active,
8640                4 => Self::Deleted,
8641                _ => Self::UnknownValue(state::UnknownValue(
8642                    wkt::internal::UnknownEnumValue::Integer(value),
8643                )),
8644            }
8645        }
8646    }
8647
8648    impl std::convert::From<&str> for State {
8649        fn from(value: &str) -> Self {
8650            use std::string::ToString;
8651            match value {
8652                "STATE_UNSPECIFIED" => Self::Unspecified,
8653                "ACTIVE" => Self::Active,
8654                "DELETED" => Self::Deleted,
8655                _ => Self::UnknownValue(state::UnknownValue(
8656                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8657                )),
8658            }
8659        }
8660    }
8661
8662    impl serde::ser::Serialize for State {
8663        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8664        where
8665            S: serde::Serializer,
8666        {
8667            match self {
8668                Self::Unspecified => serializer.serialize_i32(0),
8669                Self::Active => serializer.serialize_i32(2),
8670                Self::Deleted => serializer.serialize_i32(4),
8671                Self::UnknownValue(u) => u.0.serialize(serializer),
8672            }
8673        }
8674    }
8675
8676    impl<'de> serde::de::Deserialize<'de> for State {
8677        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8678        where
8679            D: serde::Deserializer<'de>,
8680        {
8681            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
8682                ".google.cloud.speech.v2.PhraseSet.State",
8683            ))
8684        }
8685    }
8686}
8687
8688/// Request message for the
8689/// [CreateCustomClass][google.cloud.speech.v2.Speech.CreateCustomClass] method.
8690///
8691/// [google.cloud.speech.v2.Speech.CreateCustomClass]: crate::client::Speech::create_custom_class
8692#[derive(Clone, Default, PartialEq)]
8693#[non_exhaustive]
8694pub struct CreateCustomClassRequest {
8695    /// Required. The CustomClass to create.
8696    pub custom_class: std::option::Option<crate::model::CustomClass>,
8697
8698    /// If set, validate the request and preview the CustomClass, but do not
8699    /// actually create it.
8700    pub validate_only: bool,
8701
8702    /// The ID to use for the CustomClass, which will become the final component of
8703    /// the CustomClass's resource name.
8704    ///
8705    /// This value should be 4-63 characters, and valid characters
8706    /// are /[a-z][0-9]-/.
8707    pub custom_class_id: std::string::String,
8708
8709    /// Required. The project and location where this CustomClass will be created.
8710    /// The expected format is `projects/{project}/locations/{location}`.
8711    pub parent: std::string::String,
8712
8713    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8714}
8715
8716impl CreateCustomClassRequest {
8717    pub fn new() -> Self {
8718        std::default::Default::default()
8719    }
8720
8721    /// Sets the value of [custom_class][crate::model::CreateCustomClassRequest::custom_class].
8722    ///
8723    /// # Example
8724    /// ```ignore,no_run
8725    /// # use google_cloud_speech_v2::model::CreateCustomClassRequest;
8726    /// use google_cloud_speech_v2::model::CustomClass;
8727    /// let x = CreateCustomClassRequest::new().set_custom_class(CustomClass::default()/* use setters */);
8728    /// ```
8729    pub fn set_custom_class<T>(mut self, v: T) -> Self
8730    where
8731        T: std::convert::Into<crate::model::CustomClass>,
8732    {
8733        self.custom_class = std::option::Option::Some(v.into());
8734        self
8735    }
8736
8737    /// Sets or clears the value of [custom_class][crate::model::CreateCustomClassRequest::custom_class].
8738    ///
8739    /// # Example
8740    /// ```ignore,no_run
8741    /// # use google_cloud_speech_v2::model::CreateCustomClassRequest;
8742    /// use google_cloud_speech_v2::model::CustomClass;
8743    /// let x = CreateCustomClassRequest::new().set_or_clear_custom_class(Some(CustomClass::default()/* use setters */));
8744    /// let x = CreateCustomClassRequest::new().set_or_clear_custom_class(None::<CustomClass>);
8745    /// ```
8746    pub fn set_or_clear_custom_class<T>(mut self, v: std::option::Option<T>) -> Self
8747    where
8748        T: std::convert::Into<crate::model::CustomClass>,
8749    {
8750        self.custom_class = v.map(|x| x.into());
8751        self
8752    }
8753
8754    /// Sets the value of [validate_only][crate::model::CreateCustomClassRequest::validate_only].
8755    ///
8756    /// # Example
8757    /// ```ignore,no_run
8758    /// # use google_cloud_speech_v2::model::CreateCustomClassRequest;
8759    /// let x = CreateCustomClassRequest::new().set_validate_only(true);
8760    /// ```
8761    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8762        self.validate_only = v.into();
8763        self
8764    }
8765
8766    /// Sets the value of [custom_class_id][crate::model::CreateCustomClassRequest::custom_class_id].
8767    ///
8768    /// # Example
8769    /// ```ignore,no_run
8770    /// # use google_cloud_speech_v2::model::CreateCustomClassRequest;
8771    /// let x = CreateCustomClassRequest::new().set_custom_class_id("example");
8772    /// ```
8773    pub fn set_custom_class_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8774        self.custom_class_id = v.into();
8775        self
8776    }
8777
8778    /// Sets the value of [parent][crate::model::CreateCustomClassRequest::parent].
8779    ///
8780    /// # Example
8781    /// ```ignore,no_run
8782    /// # use google_cloud_speech_v2::model::CreateCustomClassRequest;
8783    /// let x = CreateCustomClassRequest::new().set_parent("example");
8784    /// ```
8785    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8786        self.parent = v.into();
8787        self
8788    }
8789}
8790
8791impl wkt::message::Message for CreateCustomClassRequest {
8792    fn typename() -> &'static str {
8793        "type.googleapis.com/google.cloud.speech.v2.CreateCustomClassRequest"
8794    }
8795}
8796
8797/// Request message for the
8798/// [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] method.
8799///
8800/// [google.cloud.speech.v2.Speech.ListCustomClasses]: crate::client::Speech::list_custom_classes
8801#[derive(Clone, Default, PartialEq)]
8802#[non_exhaustive]
8803pub struct ListCustomClassesRequest {
8804    /// Required. The project and location of CustomClass resources to list. The
8805    /// expected format is `projects/{project}/locations/{location}`.
8806    pub parent: std::string::String,
8807
8808    /// Number of results per requests. A valid page_size ranges from 0 to 100
8809    /// inclusive. If the page_size is zero or unspecified, a page size of 5 will
8810    /// be chosen. If the page size exceeds 100, it will be coerced down to 100.
8811    /// Note that a call might return fewer results than the requested page size.
8812    pub page_size: i32,
8813
8814    /// A page token, received from a previous
8815    /// [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] call.
8816    /// Provide this to retrieve the subsequent page.
8817    ///
8818    /// When paginating, all other parameters provided to
8819    /// [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] must
8820    /// match the call that provided the page token.
8821    ///
8822    /// [google.cloud.speech.v2.Speech.ListCustomClasses]: crate::client::Speech::list_custom_classes
8823    pub page_token: std::string::String,
8824
8825    /// Whether, or not, to show resources that have been deleted.
8826    pub show_deleted: bool,
8827
8828    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8829}
8830
8831impl ListCustomClassesRequest {
8832    pub fn new() -> Self {
8833        std::default::Default::default()
8834    }
8835
8836    /// Sets the value of [parent][crate::model::ListCustomClassesRequest::parent].
8837    ///
8838    /// # Example
8839    /// ```ignore,no_run
8840    /// # use google_cloud_speech_v2::model::ListCustomClassesRequest;
8841    /// let x = ListCustomClassesRequest::new().set_parent("example");
8842    /// ```
8843    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8844        self.parent = v.into();
8845        self
8846    }
8847
8848    /// Sets the value of [page_size][crate::model::ListCustomClassesRequest::page_size].
8849    ///
8850    /// # Example
8851    /// ```ignore,no_run
8852    /// # use google_cloud_speech_v2::model::ListCustomClassesRequest;
8853    /// let x = ListCustomClassesRequest::new().set_page_size(42);
8854    /// ```
8855    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8856        self.page_size = v.into();
8857        self
8858    }
8859
8860    /// Sets the value of [page_token][crate::model::ListCustomClassesRequest::page_token].
8861    ///
8862    /// # Example
8863    /// ```ignore,no_run
8864    /// # use google_cloud_speech_v2::model::ListCustomClassesRequest;
8865    /// let x = ListCustomClassesRequest::new().set_page_token("example");
8866    /// ```
8867    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8868        self.page_token = v.into();
8869        self
8870    }
8871
8872    /// Sets the value of [show_deleted][crate::model::ListCustomClassesRequest::show_deleted].
8873    ///
8874    /// # Example
8875    /// ```ignore,no_run
8876    /// # use google_cloud_speech_v2::model::ListCustomClassesRequest;
8877    /// let x = ListCustomClassesRequest::new().set_show_deleted(true);
8878    /// ```
8879    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8880        self.show_deleted = v.into();
8881        self
8882    }
8883}
8884
8885impl wkt::message::Message for ListCustomClassesRequest {
8886    fn typename() -> &'static str {
8887        "type.googleapis.com/google.cloud.speech.v2.ListCustomClassesRequest"
8888    }
8889}
8890
8891/// Response message for the
8892/// [ListCustomClasses][google.cloud.speech.v2.Speech.ListCustomClasses] method.
8893///
8894/// [google.cloud.speech.v2.Speech.ListCustomClasses]: crate::client::Speech::list_custom_classes
8895#[derive(Clone, Default, PartialEq)]
8896#[non_exhaustive]
8897pub struct ListCustomClassesResponse {
8898    /// The list of requested CustomClasses.
8899    pub custom_classes: std::vec::Vec<crate::model::CustomClass>,
8900
8901    /// A token, which can be sent as
8902    /// [page_token][google.cloud.speech.v2.ListCustomClassesRequest.page_token] to
8903    /// retrieve the next page. If this field is omitted, there are no subsequent
8904    /// pages. This token expires after 72 hours.
8905    ///
8906    /// [google.cloud.speech.v2.ListCustomClassesRequest.page_token]: crate::model::ListCustomClassesRequest::page_token
8907    pub next_page_token: std::string::String,
8908
8909    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8910}
8911
8912impl ListCustomClassesResponse {
8913    pub fn new() -> Self {
8914        std::default::Default::default()
8915    }
8916
8917    /// Sets the value of [custom_classes][crate::model::ListCustomClassesResponse::custom_classes].
8918    ///
8919    /// # Example
8920    /// ```ignore,no_run
8921    /// # use google_cloud_speech_v2::model::ListCustomClassesResponse;
8922    /// use google_cloud_speech_v2::model::CustomClass;
8923    /// let x = ListCustomClassesResponse::new()
8924    ///     .set_custom_classes([
8925    ///         CustomClass::default()/* use setters */,
8926    ///         CustomClass::default()/* use (different) setters */,
8927    ///     ]);
8928    /// ```
8929    pub fn set_custom_classes<T, V>(mut self, v: T) -> Self
8930    where
8931        T: std::iter::IntoIterator<Item = V>,
8932        V: std::convert::Into<crate::model::CustomClass>,
8933    {
8934        use std::iter::Iterator;
8935        self.custom_classes = v.into_iter().map(|i| i.into()).collect();
8936        self
8937    }
8938
8939    /// Sets the value of [next_page_token][crate::model::ListCustomClassesResponse::next_page_token].
8940    ///
8941    /// # Example
8942    /// ```ignore,no_run
8943    /// # use google_cloud_speech_v2::model::ListCustomClassesResponse;
8944    /// let x = ListCustomClassesResponse::new().set_next_page_token("example");
8945    /// ```
8946    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8947        self.next_page_token = v.into();
8948        self
8949    }
8950}
8951
8952impl wkt::message::Message for ListCustomClassesResponse {
8953    fn typename() -> &'static str {
8954        "type.googleapis.com/google.cloud.speech.v2.ListCustomClassesResponse"
8955    }
8956}
8957
8958#[doc(hidden)]
8959impl gax::paginator::internal::PageableResponse for ListCustomClassesResponse {
8960    type PageItem = crate::model::CustomClass;
8961
8962    fn items(self) -> std::vec::Vec<Self::PageItem> {
8963        self.custom_classes
8964    }
8965
8966    fn next_page_token(&self) -> std::string::String {
8967        use std::clone::Clone;
8968        self.next_page_token.clone()
8969    }
8970}
8971
8972/// Request message for the
8973/// [GetCustomClass][google.cloud.speech.v2.Speech.GetCustomClass] method.
8974///
8975/// [google.cloud.speech.v2.Speech.GetCustomClass]: crate::client::Speech::get_custom_class
8976#[derive(Clone, Default, PartialEq)]
8977#[non_exhaustive]
8978pub struct GetCustomClassRequest {
8979    /// Required. The name of the CustomClass to retrieve. The expected format is
8980    /// `projects/{project}/locations/{location}/customClasses/{custom_class}`.
8981    pub name: std::string::String,
8982
8983    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8984}
8985
8986impl GetCustomClassRequest {
8987    pub fn new() -> Self {
8988        std::default::Default::default()
8989    }
8990
8991    /// Sets the value of [name][crate::model::GetCustomClassRequest::name].
8992    ///
8993    /// # Example
8994    /// ```ignore,no_run
8995    /// # use google_cloud_speech_v2::model::GetCustomClassRequest;
8996    /// let x = GetCustomClassRequest::new().set_name("example");
8997    /// ```
8998    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8999        self.name = v.into();
9000        self
9001    }
9002}
9003
9004impl wkt::message::Message for GetCustomClassRequest {
9005    fn typename() -> &'static str {
9006        "type.googleapis.com/google.cloud.speech.v2.GetCustomClassRequest"
9007    }
9008}
9009
9010/// Request message for the
9011/// [UpdateCustomClass][google.cloud.speech.v2.Speech.UpdateCustomClass] method.
9012///
9013/// [google.cloud.speech.v2.Speech.UpdateCustomClass]: crate::client::Speech::update_custom_class
9014#[derive(Clone, Default, PartialEq)]
9015#[non_exhaustive]
9016pub struct UpdateCustomClassRequest {
9017    /// Required. The CustomClass to update.
9018    ///
9019    /// The CustomClass's `name` field is used to identify the CustomClass to
9020    /// update. Format:
9021    /// `projects/{project}/locations/{location}/customClasses/{custom_class}`.
9022    pub custom_class: std::option::Option<crate::model::CustomClass>,
9023
9024    /// The list of fields to be updated. If empty, all fields are considered for
9025    /// update.
9026    pub update_mask: std::option::Option<wkt::FieldMask>,
9027
9028    /// If set, validate the request and preview the updated CustomClass, but do
9029    /// not actually update it.
9030    pub validate_only: bool,
9031
9032    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9033}
9034
9035impl UpdateCustomClassRequest {
9036    pub fn new() -> Self {
9037        std::default::Default::default()
9038    }
9039
9040    /// Sets the value of [custom_class][crate::model::UpdateCustomClassRequest::custom_class].
9041    ///
9042    /// # Example
9043    /// ```ignore,no_run
9044    /// # use google_cloud_speech_v2::model::UpdateCustomClassRequest;
9045    /// use google_cloud_speech_v2::model::CustomClass;
9046    /// let x = UpdateCustomClassRequest::new().set_custom_class(CustomClass::default()/* use setters */);
9047    /// ```
9048    pub fn set_custom_class<T>(mut self, v: T) -> Self
9049    where
9050        T: std::convert::Into<crate::model::CustomClass>,
9051    {
9052        self.custom_class = std::option::Option::Some(v.into());
9053        self
9054    }
9055
9056    /// Sets or clears the value of [custom_class][crate::model::UpdateCustomClassRequest::custom_class].
9057    ///
9058    /// # Example
9059    /// ```ignore,no_run
9060    /// # use google_cloud_speech_v2::model::UpdateCustomClassRequest;
9061    /// use google_cloud_speech_v2::model::CustomClass;
9062    /// let x = UpdateCustomClassRequest::new().set_or_clear_custom_class(Some(CustomClass::default()/* use setters */));
9063    /// let x = UpdateCustomClassRequest::new().set_or_clear_custom_class(None::<CustomClass>);
9064    /// ```
9065    pub fn set_or_clear_custom_class<T>(mut self, v: std::option::Option<T>) -> Self
9066    where
9067        T: std::convert::Into<crate::model::CustomClass>,
9068    {
9069        self.custom_class = v.map(|x| x.into());
9070        self
9071    }
9072
9073    /// Sets the value of [update_mask][crate::model::UpdateCustomClassRequest::update_mask].
9074    ///
9075    /// # Example
9076    /// ```ignore,no_run
9077    /// # use google_cloud_speech_v2::model::UpdateCustomClassRequest;
9078    /// use wkt::FieldMask;
9079    /// let x = UpdateCustomClassRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9080    /// ```
9081    pub fn set_update_mask<T>(mut self, v: T) -> Self
9082    where
9083        T: std::convert::Into<wkt::FieldMask>,
9084    {
9085        self.update_mask = std::option::Option::Some(v.into());
9086        self
9087    }
9088
9089    /// Sets or clears the value of [update_mask][crate::model::UpdateCustomClassRequest::update_mask].
9090    ///
9091    /// # Example
9092    /// ```ignore,no_run
9093    /// # use google_cloud_speech_v2::model::UpdateCustomClassRequest;
9094    /// use wkt::FieldMask;
9095    /// let x = UpdateCustomClassRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9096    /// let x = UpdateCustomClassRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9097    /// ```
9098    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9099    where
9100        T: std::convert::Into<wkt::FieldMask>,
9101    {
9102        self.update_mask = v.map(|x| x.into());
9103        self
9104    }
9105
9106    /// Sets the value of [validate_only][crate::model::UpdateCustomClassRequest::validate_only].
9107    ///
9108    /// # Example
9109    /// ```ignore,no_run
9110    /// # use google_cloud_speech_v2::model::UpdateCustomClassRequest;
9111    /// let x = UpdateCustomClassRequest::new().set_validate_only(true);
9112    /// ```
9113    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9114        self.validate_only = v.into();
9115        self
9116    }
9117}
9118
9119impl wkt::message::Message for UpdateCustomClassRequest {
9120    fn typename() -> &'static str {
9121        "type.googleapis.com/google.cloud.speech.v2.UpdateCustomClassRequest"
9122    }
9123}
9124
9125/// Request message for the
9126/// [DeleteCustomClass][google.cloud.speech.v2.Speech.DeleteCustomClass] method.
9127///
9128/// [google.cloud.speech.v2.Speech.DeleteCustomClass]: crate::client::Speech::delete_custom_class
9129#[derive(Clone, Default, PartialEq)]
9130#[non_exhaustive]
9131pub struct DeleteCustomClassRequest {
9132    /// Required. The name of the CustomClass to delete.
9133    /// Format:
9134    /// `projects/{project}/locations/{location}/customClasses/{custom_class}`
9135    pub name: std::string::String,
9136
9137    /// If set, validate the request and preview the deleted CustomClass, but do
9138    /// not actually delete it.
9139    pub validate_only: bool,
9140
9141    /// If set to true, and the CustomClass is not found, the request will succeed
9142    /// and  be a no-op (no Operation is recorded in this case).
9143    pub allow_missing: bool,
9144
9145    /// This checksum is computed by the server based on the value of other
9146    /// fields. This may be sent on update, undelete, and delete requests to ensure
9147    /// the client has an up-to-date value before proceeding.
9148    pub etag: std::string::String,
9149
9150    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9151}
9152
9153impl DeleteCustomClassRequest {
9154    pub fn new() -> Self {
9155        std::default::Default::default()
9156    }
9157
9158    /// Sets the value of [name][crate::model::DeleteCustomClassRequest::name].
9159    ///
9160    /// # Example
9161    /// ```ignore,no_run
9162    /// # use google_cloud_speech_v2::model::DeleteCustomClassRequest;
9163    /// let x = DeleteCustomClassRequest::new().set_name("example");
9164    /// ```
9165    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9166        self.name = v.into();
9167        self
9168    }
9169
9170    /// Sets the value of [validate_only][crate::model::DeleteCustomClassRequest::validate_only].
9171    ///
9172    /// # Example
9173    /// ```ignore,no_run
9174    /// # use google_cloud_speech_v2::model::DeleteCustomClassRequest;
9175    /// let x = DeleteCustomClassRequest::new().set_validate_only(true);
9176    /// ```
9177    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9178        self.validate_only = v.into();
9179        self
9180    }
9181
9182    /// Sets the value of [allow_missing][crate::model::DeleteCustomClassRequest::allow_missing].
9183    ///
9184    /// # Example
9185    /// ```ignore,no_run
9186    /// # use google_cloud_speech_v2::model::DeleteCustomClassRequest;
9187    /// let x = DeleteCustomClassRequest::new().set_allow_missing(true);
9188    /// ```
9189    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9190        self.allow_missing = v.into();
9191        self
9192    }
9193
9194    /// Sets the value of [etag][crate::model::DeleteCustomClassRequest::etag].
9195    ///
9196    /// # Example
9197    /// ```ignore,no_run
9198    /// # use google_cloud_speech_v2::model::DeleteCustomClassRequest;
9199    /// let x = DeleteCustomClassRequest::new().set_etag("example");
9200    /// ```
9201    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9202        self.etag = v.into();
9203        self
9204    }
9205}
9206
9207impl wkt::message::Message for DeleteCustomClassRequest {
9208    fn typename() -> &'static str {
9209        "type.googleapis.com/google.cloud.speech.v2.DeleteCustomClassRequest"
9210    }
9211}
9212
9213/// Request message for the
9214/// [UndeleteCustomClass][google.cloud.speech.v2.Speech.UndeleteCustomClass]
9215/// method.
9216///
9217/// [google.cloud.speech.v2.Speech.UndeleteCustomClass]: crate::client::Speech::undelete_custom_class
9218#[derive(Clone, Default, PartialEq)]
9219#[non_exhaustive]
9220pub struct UndeleteCustomClassRequest {
9221    /// Required. The name of the CustomClass to undelete.
9222    /// Format:
9223    /// `projects/{project}/locations/{location}/customClasses/{custom_class}`
9224    pub name: std::string::String,
9225
9226    /// If set, validate the request and preview the undeleted CustomClass, but do
9227    /// not actually undelete it.
9228    pub validate_only: bool,
9229
9230    /// This checksum is computed by the server based on the value of other
9231    /// fields. This may be sent on update, undelete, and delete requests to ensure
9232    /// the client has an up-to-date value before proceeding.
9233    pub etag: std::string::String,
9234
9235    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9236}
9237
9238impl UndeleteCustomClassRequest {
9239    pub fn new() -> Self {
9240        std::default::Default::default()
9241    }
9242
9243    /// Sets the value of [name][crate::model::UndeleteCustomClassRequest::name].
9244    ///
9245    /// # Example
9246    /// ```ignore,no_run
9247    /// # use google_cloud_speech_v2::model::UndeleteCustomClassRequest;
9248    /// let x = UndeleteCustomClassRequest::new().set_name("example");
9249    /// ```
9250    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9251        self.name = v.into();
9252        self
9253    }
9254
9255    /// Sets the value of [validate_only][crate::model::UndeleteCustomClassRequest::validate_only].
9256    ///
9257    /// # Example
9258    /// ```ignore,no_run
9259    /// # use google_cloud_speech_v2::model::UndeleteCustomClassRequest;
9260    /// let x = UndeleteCustomClassRequest::new().set_validate_only(true);
9261    /// ```
9262    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9263        self.validate_only = v.into();
9264        self
9265    }
9266
9267    /// Sets the value of [etag][crate::model::UndeleteCustomClassRequest::etag].
9268    ///
9269    /// # Example
9270    /// ```ignore,no_run
9271    /// # use google_cloud_speech_v2::model::UndeleteCustomClassRequest;
9272    /// let x = UndeleteCustomClassRequest::new().set_etag("example");
9273    /// ```
9274    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9275        self.etag = v.into();
9276        self
9277    }
9278}
9279
9280impl wkt::message::Message for UndeleteCustomClassRequest {
9281    fn typename() -> &'static str {
9282        "type.googleapis.com/google.cloud.speech.v2.UndeleteCustomClassRequest"
9283    }
9284}
9285
9286/// Request message for the
9287/// [CreatePhraseSet][google.cloud.speech.v2.Speech.CreatePhraseSet] method.
9288///
9289/// [google.cloud.speech.v2.Speech.CreatePhraseSet]: crate::client::Speech::create_phrase_set
9290#[derive(Clone, Default, PartialEq)]
9291#[non_exhaustive]
9292pub struct CreatePhraseSetRequest {
9293    /// Required. The PhraseSet to create.
9294    pub phrase_set: std::option::Option<crate::model::PhraseSet>,
9295
9296    /// If set, validate the request and preview the PhraseSet, but do not
9297    /// actually create it.
9298    pub validate_only: bool,
9299
9300    /// The ID to use for the PhraseSet, which will become the final component of
9301    /// the PhraseSet's resource name.
9302    ///
9303    /// This value should be 4-63 characters, and valid characters
9304    /// are /[a-z][0-9]-/.
9305    pub phrase_set_id: std::string::String,
9306
9307    /// Required. The project and location where this PhraseSet will be created.
9308    /// The expected format is `projects/{project}/locations/{location}`.
9309    pub parent: std::string::String,
9310
9311    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9312}
9313
9314impl CreatePhraseSetRequest {
9315    pub fn new() -> Self {
9316        std::default::Default::default()
9317    }
9318
9319    /// Sets the value of [phrase_set][crate::model::CreatePhraseSetRequest::phrase_set].
9320    ///
9321    /// # Example
9322    /// ```ignore,no_run
9323    /// # use google_cloud_speech_v2::model::CreatePhraseSetRequest;
9324    /// use google_cloud_speech_v2::model::PhraseSet;
9325    /// let x = CreatePhraseSetRequest::new().set_phrase_set(PhraseSet::default()/* use setters */);
9326    /// ```
9327    pub fn set_phrase_set<T>(mut self, v: T) -> Self
9328    where
9329        T: std::convert::Into<crate::model::PhraseSet>,
9330    {
9331        self.phrase_set = std::option::Option::Some(v.into());
9332        self
9333    }
9334
9335    /// Sets or clears the value of [phrase_set][crate::model::CreatePhraseSetRequest::phrase_set].
9336    ///
9337    /// # Example
9338    /// ```ignore,no_run
9339    /// # use google_cloud_speech_v2::model::CreatePhraseSetRequest;
9340    /// use google_cloud_speech_v2::model::PhraseSet;
9341    /// let x = CreatePhraseSetRequest::new().set_or_clear_phrase_set(Some(PhraseSet::default()/* use setters */));
9342    /// let x = CreatePhraseSetRequest::new().set_or_clear_phrase_set(None::<PhraseSet>);
9343    /// ```
9344    pub fn set_or_clear_phrase_set<T>(mut self, v: std::option::Option<T>) -> Self
9345    where
9346        T: std::convert::Into<crate::model::PhraseSet>,
9347    {
9348        self.phrase_set = v.map(|x| x.into());
9349        self
9350    }
9351
9352    /// Sets the value of [validate_only][crate::model::CreatePhraseSetRequest::validate_only].
9353    ///
9354    /// # Example
9355    /// ```ignore,no_run
9356    /// # use google_cloud_speech_v2::model::CreatePhraseSetRequest;
9357    /// let x = CreatePhraseSetRequest::new().set_validate_only(true);
9358    /// ```
9359    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9360        self.validate_only = v.into();
9361        self
9362    }
9363
9364    /// Sets the value of [phrase_set_id][crate::model::CreatePhraseSetRequest::phrase_set_id].
9365    ///
9366    /// # Example
9367    /// ```ignore,no_run
9368    /// # use google_cloud_speech_v2::model::CreatePhraseSetRequest;
9369    /// let x = CreatePhraseSetRequest::new().set_phrase_set_id("example");
9370    /// ```
9371    pub fn set_phrase_set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9372        self.phrase_set_id = v.into();
9373        self
9374    }
9375
9376    /// Sets the value of [parent][crate::model::CreatePhraseSetRequest::parent].
9377    ///
9378    /// # Example
9379    /// ```ignore,no_run
9380    /// # use google_cloud_speech_v2::model::CreatePhraseSetRequest;
9381    /// let x = CreatePhraseSetRequest::new().set_parent("example");
9382    /// ```
9383    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9384        self.parent = v.into();
9385        self
9386    }
9387}
9388
9389impl wkt::message::Message for CreatePhraseSetRequest {
9390    fn typename() -> &'static str {
9391        "type.googleapis.com/google.cloud.speech.v2.CreatePhraseSetRequest"
9392    }
9393}
9394
9395/// Request message for the
9396/// [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] method.
9397///
9398/// [google.cloud.speech.v2.Speech.ListPhraseSets]: crate::client::Speech::list_phrase_sets
9399#[derive(Clone, Default, PartialEq)]
9400#[non_exhaustive]
9401pub struct ListPhraseSetsRequest {
9402    /// Required. The project and location of PhraseSet resources to list. The
9403    /// expected format is `projects/{project}/locations/{location}`.
9404    pub parent: std::string::String,
9405
9406    /// The maximum number of PhraseSets to return. The service may return fewer
9407    /// than this value. If unspecified, at most 5 PhraseSets will be returned.
9408    /// The maximum value is 100; values above 100 will be coerced to 100.
9409    pub page_size: i32,
9410
9411    /// A page token, received from a previous
9412    /// [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] call.
9413    /// Provide this to retrieve the subsequent page.
9414    ///
9415    /// When paginating, all other parameters provided to
9416    /// [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] must match
9417    /// the call that provided the page token.
9418    ///
9419    /// [google.cloud.speech.v2.Speech.ListPhraseSets]: crate::client::Speech::list_phrase_sets
9420    pub page_token: std::string::String,
9421
9422    /// Whether, or not, to show resources that have been deleted.
9423    pub show_deleted: bool,
9424
9425    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9426}
9427
9428impl ListPhraseSetsRequest {
9429    pub fn new() -> Self {
9430        std::default::Default::default()
9431    }
9432
9433    /// Sets the value of [parent][crate::model::ListPhraseSetsRequest::parent].
9434    ///
9435    /// # Example
9436    /// ```ignore,no_run
9437    /// # use google_cloud_speech_v2::model::ListPhraseSetsRequest;
9438    /// let x = ListPhraseSetsRequest::new().set_parent("example");
9439    /// ```
9440    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9441        self.parent = v.into();
9442        self
9443    }
9444
9445    /// Sets the value of [page_size][crate::model::ListPhraseSetsRequest::page_size].
9446    ///
9447    /// # Example
9448    /// ```ignore,no_run
9449    /// # use google_cloud_speech_v2::model::ListPhraseSetsRequest;
9450    /// let x = ListPhraseSetsRequest::new().set_page_size(42);
9451    /// ```
9452    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9453        self.page_size = v.into();
9454        self
9455    }
9456
9457    /// Sets the value of [page_token][crate::model::ListPhraseSetsRequest::page_token].
9458    ///
9459    /// # Example
9460    /// ```ignore,no_run
9461    /// # use google_cloud_speech_v2::model::ListPhraseSetsRequest;
9462    /// let x = ListPhraseSetsRequest::new().set_page_token("example");
9463    /// ```
9464    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9465        self.page_token = v.into();
9466        self
9467    }
9468
9469    /// Sets the value of [show_deleted][crate::model::ListPhraseSetsRequest::show_deleted].
9470    ///
9471    /// # Example
9472    /// ```ignore,no_run
9473    /// # use google_cloud_speech_v2::model::ListPhraseSetsRequest;
9474    /// let x = ListPhraseSetsRequest::new().set_show_deleted(true);
9475    /// ```
9476    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9477        self.show_deleted = v.into();
9478        self
9479    }
9480}
9481
9482impl wkt::message::Message for ListPhraseSetsRequest {
9483    fn typename() -> &'static str {
9484        "type.googleapis.com/google.cloud.speech.v2.ListPhraseSetsRequest"
9485    }
9486}
9487
9488/// Response message for the
9489/// [ListPhraseSets][google.cloud.speech.v2.Speech.ListPhraseSets] method.
9490///
9491/// [google.cloud.speech.v2.Speech.ListPhraseSets]: crate::client::Speech::list_phrase_sets
9492#[derive(Clone, Default, PartialEq)]
9493#[non_exhaustive]
9494pub struct ListPhraseSetsResponse {
9495    /// The list of requested PhraseSets.
9496    pub phrase_sets: std::vec::Vec<crate::model::PhraseSet>,
9497
9498    /// A token, which can be sent as
9499    /// [page_token][google.cloud.speech.v2.ListPhraseSetsRequest.page_token] to
9500    /// retrieve the next page. If this field is omitted, there are no subsequent
9501    /// pages. This token expires after 72 hours.
9502    ///
9503    /// [google.cloud.speech.v2.ListPhraseSetsRequest.page_token]: crate::model::ListPhraseSetsRequest::page_token
9504    pub next_page_token: std::string::String,
9505
9506    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9507}
9508
9509impl ListPhraseSetsResponse {
9510    pub fn new() -> Self {
9511        std::default::Default::default()
9512    }
9513
9514    /// Sets the value of [phrase_sets][crate::model::ListPhraseSetsResponse::phrase_sets].
9515    ///
9516    /// # Example
9517    /// ```ignore,no_run
9518    /// # use google_cloud_speech_v2::model::ListPhraseSetsResponse;
9519    /// use google_cloud_speech_v2::model::PhraseSet;
9520    /// let x = ListPhraseSetsResponse::new()
9521    ///     .set_phrase_sets([
9522    ///         PhraseSet::default()/* use setters */,
9523    ///         PhraseSet::default()/* use (different) setters */,
9524    ///     ]);
9525    /// ```
9526    pub fn set_phrase_sets<T, V>(mut self, v: T) -> Self
9527    where
9528        T: std::iter::IntoIterator<Item = V>,
9529        V: std::convert::Into<crate::model::PhraseSet>,
9530    {
9531        use std::iter::Iterator;
9532        self.phrase_sets = v.into_iter().map(|i| i.into()).collect();
9533        self
9534    }
9535
9536    /// Sets the value of [next_page_token][crate::model::ListPhraseSetsResponse::next_page_token].
9537    ///
9538    /// # Example
9539    /// ```ignore,no_run
9540    /// # use google_cloud_speech_v2::model::ListPhraseSetsResponse;
9541    /// let x = ListPhraseSetsResponse::new().set_next_page_token("example");
9542    /// ```
9543    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9544        self.next_page_token = v.into();
9545        self
9546    }
9547}
9548
9549impl wkt::message::Message for ListPhraseSetsResponse {
9550    fn typename() -> &'static str {
9551        "type.googleapis.com/google.cloud.speech.v2.ListPhraseSetsResponse"
9552    }
9553}
9554
9555#[doc(hidden)]
9556impl gax::paginator::internal::PageableResponse for ListPhraseSetsResponse {
9557    type PageItem = crate::model::PhraseSet;
9558
9559    fn items(self) -> std::vec::Vec<Self::PageItem> {
9560        self.phrase_sets
9561    }
9562
9563    fn next_page_token(&self) -> std::string::String {
9564        use std::clone::Clone;
9565        self.next_page_token.clone()
9566    }
9567}
9568
9569/// Request message for the
9570/// [GetPhraseSet][google.cloud.speech.v2.Speech.GetPhraseSet] method.
9571///
9572/// [google.cloud.speech.v2.Speech.GetPhraseSet]: crate::client::Speech::get_phrase_set
9573#[derive(Clone, Default, PartialEq)]
9574#[non_exhaustive]
9575pub struct GetPhraseSetRequest {
9576    /// Required. The name of the PhraseSet to retrieve. The expected format is
9577    /// `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
9578    pub name: std::string::String,
9579
9580    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9581}
9582
9583impl GetPhraseSetRequest {
9584    pub fn new() -> Self {
9585        std::default::Default::default()
9586    }
9587
9588    /// Sets the value of [name][crate::model::GetPhraseSetRequest::name].
9589    ///
9590    /// # Example
9591    /// ```ignore,no_run
9592    /// # use google_cloud_speech_v2::model::GetPhraseSetRequest;
9593    /// let x = GetPhraseSetRequest::new().set_name("example");
9594    /// ```
9595    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9596        self.name = v.into();
9597        self
9598    }
9599}
9600
9601impl wkt::message::Message for GetPhraseSetRequest {
9602    fn typename() -> &'static str {
9603        "type.googleapis.com/google.cloud.speech.v2.GetPhraseSetRequest"
9604    }
9605}
9606
9607/// Request message for the
9608/// [UpdatePhraseSet][google.cloud.speech.v2.Speech.UpdatePhraseSet] method.
9609///
9610/// [google.cloud.speech.v2.Speech.UpdatePhraseSet]: crate::client::Speech::update_phrase_set
9611#[derive(Clone, Default, PartialEq)]
9612#[non_exhaustive]
9613pub struct UpdatePhraseSetRequest {
9614    /// Required. The PhraseSet to update.
9615    ///
9616    /// The PhraseSet's `name` field is used to identify the PhraseSet to update.
9617    /// Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`.
9618    pub phrase_set: std::option::Option<crate::model::PhraseSet>,
9619
9620    /// The list of fields to update. If empty, all non-default valued fields are
9621    /// considered for update. Use `*` to update the entire PhraseSet resource.
9622    pub update_mask: std::option::Option<wkt::FieldMask>,
9623
9624    /// If set, validate the request and preview the updated PhraseSet, but do not
9625    /// actually update it.
9626    pub validate_only: bool,
9627
9628    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9629}
9630
9631impl UpdatePhraseSetRequest {
9632    pub fn new() -> Self {
9633        std::default::Default::default()
9634    }
9635
9636    /// Sets the value of [phrase_set][crate::model::UpdatePhraseSetRequest::phrase_set].
9637    ///
9638    /// # Example
9639    /// ```ignore,no_run
9640    /// # use google_cloud_speech_v2::model::UpdatePhraseSetRequest;
9641    /// use google_cloud_speech_v2::model::PhraseSet;
9642    /// let x = UpdatePhraseSetRequest::new().set_phrase_set(PhraseSet::default()/* use setters */);
9643    /// ```
9644    pub fn set_phrase_set<T>(mut self, v: T) -> Self
9645    where
9646        T: std::convert::Into<crate::model::PhraseSet>,
9647    {
9648        self.phrase_set = std::option::Option::Some(v.into());
9649        self
9650    }
9651
9652    /// Sets or clears the value of [phrase_set][crate::model::UpdatePhraseSetRequest::phrase_set].
9653    ///
9654    /// # Example
9655    /// ```ignore,no_run
9656    /// # use google_cloud_speech_v2::model::UpdatePhraseSetRequest;
9657    /// use google_cloud_speech_v2::model::PhraseSet;
9658    /// let x = UpdatePhraseSetRequest::new().set_or_clear_phrase_set(Some(PhraseSet::default()/* use setters */));
9659    /// let x = UpdatePhraseSetRequest::new().set_or_clear_phrase_set(None::<PhraseSet>);
9660    /// ```
9661    pub fn set_or_clear_phrase_set<T>(mut self, v: std::option::Option<T>) -> Self
9662    where
9663        T: std::convert::Into<crate::model::PhraseSet>,
9664    {
9665        self.phrase_set = v.map(|x| x.into());
9666        self
9667    }
9668
9669    /// Sets the value of [update_mask][crate::model::UpdatePhraseSetRequest::update_mask].
9670    ///
9671    /// # Example
9672    /// ```ignore,no_run
9673    /// # use google_cloud_speech_v2::model::UpdatePhraseSetRequest;
9674    /// use wkt::FieldMask;
9675    /// let x = UpdatePhraseSetRequest::new().set_update_mask(FieldMask::default()/* use setters */);
9676    /// ```
9677    pub fn set_update_mask<T>(mut self, v: T) -> Self
9678    where
9679        T: std::convert::Into<wkt::FieldMask>,
9680    {
9681        self.update_mask = std::option::Option::Some(v.into());
9682        self
9683    }
9684
9685    /// Sets or clears the value of [update_mask][crate::model::UpdatePhraseSetRequest::update_mask].
9686    ///
9687    /// # Example
9688    /// ```ignore,no_run
9689    /// # use google_cloud_speech_v2::model::UpdatePhraseSetRequest;
9690    /// use wkt::FieldMask;
9691    /// let x = UpdatePhraseSetRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
9692    /// let x = UpdatePhraseSetRequest::new().set_or_clear_update_mask(None::<FieldMask>);
9693    /// ```
9694    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9695    where
9696        T: std::convert::Into<wkt::FieldMask>,
9697    {
9698        self.update_mask = v.map(|x| x.into());
9699        self
9700    }
9701
9702    /// Sets the value of [validate_only][crate::model::UpdatePhraseSetRequest::validate_only].
9703    ///
9704    /// # Example
9705    /// ```ignore,no_run
9706    /// # use google_cloud_speech_v2::model::UpdatePhraseSetRequest;
9707    /// let x = UpdatePhraseSetRequest::new().set_validate_only(true);
9708    /// ```
9709    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9710        self.validate_only = v.into();
9711        self
9712    }
9713}
9714
9715impl wkt::message::Message for UpdatePhraseSetRequest {
9716    fn typename() -> &'static str {
9717        "type.googleapis.com/google.cloud.speech.v2.UpdatePhraseSetRequest"
9718    }
9719}
9720
9721/// Request message for the
9722/// [DeletePhraseSet][google.cloud.speech.v2.Speech.DeletePhraseSet] method.
9723///
9724/// [google.cloud.speech.v2.Speech.DeletePhraseSet]: crate::client::Speech::delete_phrase_set
9725#[derive(Clone, Default, PartialEq)]
9726#[non_exhaustive]
9727pub struct DeletePhraseSetRequest {
9728    /// Required. The name of the PhraseSet to delete.
9729    /// Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
9730    pub name: std::string::String,
9731
9732    /// If set, validate the request and preview the deleted PhraseSet, but do not
9733    /// actually delete it.
9734    pub validate_only: bool,
9735
9736    /// If set to true, and the PhraseSet is not found, the request will succeed
9737    /// and  be a no-op (no Operation is recorded in this case).
9738    pub allow_missing: bool,
9739
9740    /// This checksum is computed by the server based on the value of other
9741    /// fields. This may be sent on update, undelete, and delete requests to ensure
9742    /// the client has an up-to-date value before proceeding.
9743    pub etag: std::string::String,
9744
9745    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9746}
9747
9748impl DeletePhraseSetRequest {
9749    pub fn new() -> Self {
9750        std::default::Default::default()
9751    }
9752
9753    /// Sets the value of [name][crate::model::DeletePhraseSetRequest::name].
9754    ///
9755    /// # Example
9756    /// ```ignore,no_run
9757    /// # use google_cloud_speech_v2::model::DeletePhraseSetRequest;
9758    /// let x = DeletePhraseSetRequest::new().set_name("example");
9759    /// ```
9760    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9761        self.name = v.into();
9762        self
9763    }
9764
9765    /// Sets the value of [validate_only][crate::model::DeletePhraseSetRequest::validate_only].
9766    ///
9767    /// # Example
9768    /// ```ignore,no_run
9769    /// # use google_cloud_speech_v2::model::DeletePhraseSetRequest;
9770    /// let x = DeletePhraseSetRequest::new().set_validate_only(true);
9771    /// ```
9772    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9773        self.validate_only = v.into();
9774        self
9775    }
9776
9777    /// Sets the value of [allow_missing][crate::model::DeletePhraseSetRequest::allow_missing].
9778    ///
9779    /// # Example
9780    /// ```ignore,no_run
9781    /// # use google_cloud_speech_v2::model::DeletePhraseSetRequest;
9782    /// let x = DeletePhraseSetRequest::new().set_allow_missing(true);
9783    /// ```
9784    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9785        self.allow_missing = v.into();
9786        self
9787    }
9788
9789    /// Sets the value of [etag][crate::model::DeletePhraseSetRequest::etag].
9790    ///
9791    /// # Example
9792    /// ```ignore,no_run
9793    /// # use google_cloud_speech_v2::model::DeletePhraseSetRequest;
9794    /// let x = DeletePhraseSetRequest::new().set_etag("example");
9795    /// ```
9796    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9797        self.etag = v.into();
9798        self
9799    }
9800}
9801
9802impl wkt::message::Message for DeletePhraseSetRequest {
9803    fn typename() -> &'static str {
9804        "type.googleapis.com/google.cloud.speech.v2.DeletePhraseSetRequest"
9805    }
9806}
9807
9808/// Request message for the
9809/// [UndeletePhraseSet][google.cloud.speech.v2.Speech.UndeletePhraseSet]
9810/// method.
9811///
9812/// [google.cloud.speech.v2.Speech.UndeletePhraseSet]: crate::client::Speech::undelete_phrase_set
9813#[derive(Clone, Default, PartialEq)]
9814#[non_exhaustive]
9815pub struct UndeletePhraseSetRequest {
9816    /// Required. The name of the PhraseSet to undelete.
9817    /// Format: `projects/{project}/locations/{location}/phraseSets/{phrase_set}`
9818    pub name: std::string::String,
9819
9820    /// If set, validate the request and preview the undeleted PhraseSet, but do
9821    /// not actually undelete it.
9822    pub validate_only: bool,
9823
9824    /// This checksum is computed by the server based on the value of other
9825    /// fields. This may be sent on update, undelete, and delete requests to ensure
9826    /// the client has an up-to-date value before proceeding.
9827    pub etag: std::string::String,
9828
9829    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9830}
9831
9832impl UndeletePhraseSetRequest {
9833    pub fn new() -> Self {
9834        std::default::Default::default()
9835    }
9836
9837    /// Sets the value of [name][crate::model::UndeletePhraseSetRequest::name].
9838    ///
9839    /// # Example
9840    /// ```ignore,no_run
9841    /// # use google_cloud_speech_v2::model::UndeletePhraseSetRequest;
9842    /// let x = UndeletePhraseSetRequest::new().set_name("example");
9843    /// ```
9844    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9845        self.name = v.into();
9846        self
9847    }
9848
9849    /// Sets the value of [validate_only][crate::model::UndeletePhraseSetRequest::validate_only].
9850    ///
9851    /// # Example
9852    /// ```ignore,no_run
9853    /// # use google_cloud_speech_v2::model::UndeletePhraseSetRequest;
9854    /// let x = UndeletePhraseSetRequest::new().set_validate_only(true);
9855    /// ```
9856    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9857        self.validate_only = v.into();
9858        self
9859    }
9860
9861    /// Sets the value of [etag][crate::model::UndeletePhraseSetRequest::etag].
9862    ///
9863    /// # Example
9864    /// ```ignore,no_run
9865    /// # use google_cloud_speech_v2::model::UndeletePhraseSetRequest;
9866    /// let x = UndeletePhraseSetRequest::new().set_etag("example");
9867    /// ```
9868    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9869        self.etag = v.into();
9870        self
9871    }
9872}
9873
9874impl wkt::message::Message for UndeletePhraseSetRequest {
9875    fn typename() -> &'static str {
9876        "type.googleapis.com/google.cloud.speech.v2.UndeletePhraseSetRequest"
9877    }
9878}
9879
9880/// Represents a singular feature of a model. If the feature is `recognizer`,
9881/// the release_state of the feature represents the release_state of the model
9882#[derive(Clone, Default, PartialEq)]
9883#[non_exhaustive]
9884pub struct ModelFeature {
9885    /// The name of the feature (Note: the feature can be `recognizer`)
9886    pub feature: std::string::String,
9887
9888    /// The release state of the feature
9889    pub release_state: std::string::String,
9890
9891    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9892}
9893
9894impl ModelFeature {
9895    pub fn new() -> Self {
9896        std::default::Default::default()
9897    }
9898
9899    /// Sets the value of [feature][crate::model::ModelFeature::feature].
9900    ///
9901    /// # Example
9902    /// ```ignore,no_run
9903    /// # use google_cloud_speech_v2::model::ModelFeature;
9904    /// let x = ModelFeature::new().set_feature("example");
9905    /// ```
9906    pub fn set_feature<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9907        self.feature = v.into();
9908        self
9909    }
9910
9911    /// Sets the value of [release_state][crate::model::ModelFeature::release_state].
9912    ///
9913    /// # Example
9914    /// ```ignore,no_run
9915    /// # use google_cloud_speech_v2::model::ModelFeature;
9916    /// let x = ModelFeature::new().set_release_state("example");
9917    /// ```
9918    pub fn set_release_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9919        self.release_state = v.into();
9920        self
9921    }
9922}
9923
9924impl wkt::message::Message for ModelFeature {
9925    fn typename() -> &'static str {
9926        "type.googleapis.com/google.cloud.speech.v2.ModelFeature"
9927    }
9928}
9929
9930/// Represents the collection of features belonging to a model
9931#[derive(Clone, Default, PartialEq)]
9932#[non_exhaustive]
9933pub struct ModelFeatures {
9934    /// Repeated field that contains all features of the model
9935    pub model_feature: std::vec::Vec<crate::model::ModelFeature>,
9936
9937    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9938}
9939
9940impl ModelFeatures {
9941    pub fn new() -> Self {
9942        std::default::Default::default()
9943    }
9944
9945    /// Sets the value of [model_feature][crate::model::ModelFeatures::model_feature].
9946    ///
9947    /// # Example
9948    /// ```ignore,no_run
9949    /// # use google_cloud_speech_v2::model::ModelFeatures;
9950    /// use google_cloud_speech_v2::model::ModelFeature;
9951    /// let x = ModelFeatures::new()
9952    ///     .set_model_feature([
9953    ///         ModelFeature::default()/* use setters */,
9954    ///         ModelFeature::default()/* use (different) setters */,
9955    ///     ]);
9956    /// ```
9957    pub fn set_model_feature<T, V>(mut self, v: T) -> Self
9958    where
9959        T: std::iter::IntoIterator<Item = V>,
9960        V: std::convert::Into<crate::model::ModelFeature>,
9961    {
9962        use std::iter::Iterator;
9963        self.model_feature = v.into_iter().map(|i| i.into()).collect();
9964        self
9965    }
9966}
9967
9968impl wkt::message::Message for ModelFeatures {
9969    fn typename() -> &'static str {
9970        "type.googleapis.com/google.cloud.speech.v2.ModelFeatures"
9971    }
9972}
9973
9974/// The metadata about the models in a given region for a specific locale.
9975/// Currently this is just the features of the model
9976#[derive(Clone, Default, PartialEq)]
9977#[non_exhaustive]
9978pub struct ModelMetadata {
9979    /// Map of the model name -> features of that model
9980    pub model_features: std::collections::HashMap<std::string::String, crate::model::ModelFeatures>,
9981
9982    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9983}
9984
9985impl ModelMetadata {
9986    pub fn new() -> Self {
9987        std::default::Default::default()
9988    }
9989
9990    /// Sets the value of [model_features][crate::model::ModelMetadata::model_features].
9991    ///
9992    /// # Example
9993    /// ```ignore,no_run
9994    /// # use google_cloud_speech_v2::model::ModelMetadata;
9995    /// use google_cloud_speech_v2::model::ModelFeatures;
9996    /// let x = ModelMetadata::new().set_model_features([
9997    ///     ("key0", ModelFeatures::default()/* use setters */),
9998    ///     ("key1", ModelFeatures::default()/* use (different) setters */),
9999    /// ]);
10000    /// ```
10001    pub fn set_model_features<T, K, V>(mut self, v: T) -> Self
10002    where
10003        T: std::iter::IntoIterator<Item = (K, V)>,
10004        K: std::convert::Into<std::string::String>,
10005        V: std::convert::Into<crate::model::ModelFeatures>,
10006    {
10007        use std::iter::Iterator;
10008        self.model_features = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10009        self
10010    }
10011}
10012
10013impl wkt::message::Message for ModelMetadata {
10014    fn typename() -> &'static str {
10015        "type.googleapis.com/google.cloud.speech.v2.ModelMetadata"
10016    }
10017}
10018
10019/// The metadata about locales available in a given region. Currently this is
10020/// just the models that are available for each locale
10021#[derive(Clone, Default, PartialEq)]
10022#[non_exhaustive]
10023pub struct LanguageMetadata {
10024    /// Map of locale (language code) -> models
10025    pub models: std::collections::HashMap<std::string::String, crate::model::ModelMetadata>,
10026
10027    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10028}
10029
10030impl LanguageMetadata {
10031    pub fn new() -> Self {
10032        std::default::Default::default()
10033    }
10034
10035    /// Sets the value of [models][crate::model::LanguageMetadata::models].
10036    ///
10037    /// # Example
10038    /// ```ignore,no_run
10039    /// # use google_cloud_speech_v2::model::LanguageMetadata;
10040    /// use google_cloud_speech_v2::model::ModelMetadata;
10041    /// let x = LanguageMetadata::new().set_models([
10042    ///     ("key0", ModelMetadata::default()/* use setters */),
10043    ///     ("key1", ModelMetadata::default()/* use (different) setters */),
10044    /// ]);
10045    /// ```
10046    pub fn set_models<T, K, V>(mut self, v: T) -> Self
10047    where
10048        T: std::iter::IntoIterator<Item = (K, V)>,
10049        K: std::convert::Into<std::string::String>,
10050        V: std::convert::Into<crate::model::ModelMetadata>,
10051    {
10052        use std::iter::Iterator;
10053        self.models = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10054        self
10055    }
10056}
10057
10058impl wkt::message::Message for LanguageMetadata {
10059    fn typename() -> &'static str {
10060        "type.googleapis.com/google.cloud.speech.v2.LanguageMetadata"
10061    }
10062}
10063
10064/// The access metadata for a particular region. This can be applied if the org
10065/// policy for the given project disallows a particular region.
10066#[derive(Clone, Default, PartialEq)]
10067#[non_exhaustive]
10068pub struct AccessMetadata {
10069    /// Describes the different types of constraints that are applied.
10070    pub constraint_type: crate::model::access_metadata::ConstraintType,
10071
10072    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10073}
10074
10075impl AccessMetadata {
10076    pub fn new() -> Self {
10077        std::default::Default::default()
10078    }
10079
10080    /// Sets the value of [constraint_type][crate::model::AccessMetadata::constraint_type].
10081    ///
10082    /// # Example
10083    /// ```ignore,no_run
10084    /// # use google_cloud_speech_v2::model::AccessMetadata;
10085    /// use google_cloud_speech_v2::model::access_metadata::ConstraintType;
10086    /// let x0 = AccessMetadata::new().set_constraint_type(ConstraintType::ResourceLocationsOrgPolicyCreateConstraint);
10087    /// ```
10088    pub fn set_constraint_type<
10089        T: std::convert::Into<crate::model::access_metadata::ConstraintType>,
10090    >(
10091        mut self,
10092        v: T,
10093    ) -> Self {
10094        self.constraint_type = v.into();
10095        self
10096    }
10097}
10098
10099impl wkt::message::Message for AccessMetadata {
10100    fn typename() -> &'static str {
10101        "type.googleapis.com/google.cloud.speech.v2.AccessMetadata"
10102    }
10103}
10104
10105/// Defines additional types related to [AccessMetadata].
10106pub mod access_metadata {
10107    #[allow(unused_imports)]
10108    use super::*;
10109
10110    /// Describes the different types of constraints that can be applied on a
10111    /// region.
10112    ///
10113    /// # Working with unknown values
10114    ///
10115    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10116    /// additional enum variants at any time. Adding new variants is not considered
10117    /// a breaking change. Applications should write their code in anticipation of:
10118    ///
10119    /// - New values appearing in future releases of the client library, **and**
10120    /// - New values received dynamically, without application changes.
10121    ///
10122    /// Please consult the [Working with enums] section in the user guide for some
10123    /// guidelines.
10124    ///
10125    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10126    #[derive(Clone, Debug, PartialEq)]
10127    #[non_exhaustive]
10128    pub enum ConstraintType {
10129        /// Unspecified constraint applied.
10130        Unspecified,
10131        /// The project's org policy disallows the given region.
10132        ResourceLocationsOrgPolicyCreateConstraint,
10133        /// If set, the enum was initialized with an unknown value.
10134        ///
10135        /// Applications can examine the value using [ConstraintType::value] or
10136        /// [ConstraintType::name].
10137        UnknownValue(constraint_type::UnknownValue),
10138    }
10139
10140    #[doc(hidden)]
10141    pub mod constraint_type {
10142        #[allow(unused_imports)]
10143        use super::*;
10144        #[derive(Clone, Debug, PartialEq)]
10145        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10146    }
10147
10148    impl ConstraintType {
10149        /// Gets the enum value.
10150        ///
10151        /// Returns `None` if the enum contains an unknown value deserialized from
10152        /// the string representation of enums.
10153        pub fn value(&self) -> std::option::Option<i32> {
10154            match self {
10155                Self::Unspecified => std::option::Option::Some(0),
10156                Self::ResourceLocationsOrgPolicyCreateConstraint => std::option::Option::Some(1),
10157                Self::UnknownValue(u) => u.0.value(),
10158            }
10159        }
10160
10161        /// Gets the enum value as a string.
10162        ///
10163        /// Returns `None` if the enum contains an unknown value deserialized from
10164        /// the integer representation of enums.
10165        pub fn name(&self) -> std::option::Option<&str> {
10166            match self {
10167                Self::Unspecified => std::option::Option::Some("CONSTRAINT_TYPE_UNSPECIFIED"),
10168                Self::ResourceLocationsOrgPolicyCreateConstraint => {
10169                    std::option::Option::Some("RESOURCE_LOCATIONS_ORG_POLICY_CREATE_CONSTRAINT")
10170                }
10171                Self::UnknownValue(u) => u.0.name(),
10172            }
10173        }
10174    }
10175
10176    impl std::default::Default for ConstraintType {
10177        fn default() -> Self {
10178            use std::convert::From;
10179            Self::from(0)
10180        }
10181    }
10182
10183    impl std::fmt::Display for ConstraintType {
10184        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10185            wkt::internal::display_enum(f, self.name(), self.value())
10186        }
10187    }
10188
10189    impl std::convert::From<i32> for ConstraintType {
10190        fn from(value: i32) -> Self {
10191            match value {
10192                0 => Self::Unspecified,
10193                1 => Self::ResourceLocationsOrgPolicyCreateConstraint,
10194                _ => Self::UnknownValue(constraint_type::UnknownValue(
10195                    wkt::internal::UnknownEnumValue::Integer(value),
10196                )),
10197            }
10198        }
10199    }
10200
10201    impl std::convert::From<&str> for ConstraintType {
10202        fn from(value: &str) -> Self {
10203            use std::string::ToString;
10204            match value {
10205                "CONSTRAINT_TYPE_UNSPECIFIED" => Self::Unspecified,
10206                "RESOURCE_LOCATIONS_ORG_POLICY_CREATE_CONSTRAINT" => {
10207                    Self::ResourceLocationsOrgPolicyCreateConstraint
10208                }
10209                _ => Self::UnknownValue(constraint_type::UnknownValue(
10210                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10211                )),
10212            }
10213        }
10214    }
10215
10216    impl serde::ser::Serialize for ConstraintType {
10217        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10218        where
10219            S: serde::Serializer,
10220        {
10221            match self {
10222                Self::Unspecified => serializer.serialize_i32(0),
10223                Self::ResourceLocationsOrgPolicyCreateConstraint => serializer.serialize_i32(1),
10224                Self::UnknownValue(u) => u.0.serialize(serializer),
10225            }
10226        }
10227    }
10228
10229    impl<'de> serde::de::Deserialize<'de> for ConstraintType {
10230        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10231        where
10232            D: serde::Deserializer<'de>,
10233        {
10234            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ConstraintType>::new(
10235                ".google.cloud.speech.v2.AccessMetadata.ConstraintType",
10236            ))
10237        }
10238    }
10239}
10240
10241/// Main metadata for the Locations API for STT V2. Currently this is just the
10242/// metadata about locales, models, and features
10243#[derive(Clone, Default, PartialEq)]
10244#[non_exhaustive]
10245pub struct LocationsMetadata {
10246    /// Information about available locales, models, and features represented in
10247    /// the hierarchical structure of locales -> models -> features
10248    pub languages: std::option::Option<crate::model::LanguageMetadata>,
10249
10250    /// Information about access metadata for the region and given project.
10251    pub access_metadata: std::option::Option<crate::model::AccessMetadata>,
10252
10253    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10254}
10255
10256impl LocationsMetadata {
10257    pub fn new() -> Self {
10258        std::default::Default::default()
10259    }
10260
10261    /// Sets the value of [languages][crate::model::LocationsMetadata::languages].
10262    ///
10263    /// # Example
10264    /// ```ignore,no_run
10265    /// # use google_cloud_speech_v2::model::LocationsMetadata;
10266    /// use google_cloud_speech_v2::model::LanguageMetadata;
10267    /// let x = LocationsMetadata::new().set_languages(LanguageMetadata::default()/* use setters */);
10268    /// ```
10269    pub fn set_languages<T>(mut self, v: T) -> Self
10270    where
10271        T: std::convert::Into<crate::model::LanguageMetadata>,
10272    {
10273        self.languages = std::option::Option::Some(v.into());
10274        self
10275    }
10276
10277    /// Sets or clears the value of [languages][crate::model::LocationsMetadata::languages].
10278    ///
10279    /// # Example
10280    /// ```ignore,no_run
10281    /// # use google_cloud_speech_v2::model::LocationsMetadata;
10282    /// use google_cloud_speech_v2::model::LanguageMetadata;
10283    /// let x = LocationsMetadata::new().set_or_clear_languages(Some(LanguageMetadata::default()/* use setters */));
10284    /// let x = LocationsMetadata::new().set_or_clear_languages(None::<LanguageMetadata>);
10285    /// ```
10286    pub fn set_or_clear_languages<T>(mut self, v: std::option::Option<T>) -> Self
10287    where
10288        T: std::convert::Into<crate::model::LanguageMetadata>,
10289    {
10290        self.languages = v.map(|x| x.into());
10291        self
10292    }
10293
10294    /// Sets the value of [access_metadata][crate::model::LocationsMetadata::access_metadata].
10295    ///
10296    /// # Example
10297    /// ```ignore,no_run
10298    /// # use google_cloud_speech_v2::model::LocationsMetadata;
10299    /// use google_cloud_speech_v2::model::AccessMetadata;
10300    /// let x = LocationsMetadata::new().set_access_metadata(AccessMetadata::default()/* use setters */);
10301    /// ```
10302    pub fn set_access_metadata<T>(mut self, v: T) -> Self
10303    where
10304        T: std::convert::Into<crate::model::AccessMetadata>,
10305    {
10306        self.access_metadata = std::option::Option::Some(v.into());
10307        self
10308    }
10309
10310    /// Sets or clears the value of [access_metadata][crate::model::LocationsMetadata::access_metadata].
10311    ///
10312    /// # Example
10313    /// ```ignore,no_run
10314    /// # use google_cloud_speech_v2::model::LocationsMetadata;
10315    /// use google_cloud_speech_v2::model::AccessMetadata;
10316    /// let x = LocationsMetadata::new().set_or_clear_access_metadata(Some(AccessMetadata::default()/* use setters */));
10317    /// let x = LocationsMetadata::new().set_or_clear_access_metadata(None::<AccessMetadata>);
10318    /// ```
10319    pub fn set_or_clear_access_metadata<T>(mut self, v: std::option::Option<T>) -> Self
10320    where
10321        T: std::convert::Into<crate::model::AccessMetadata>,
10322    {
10323        self.access_metadata = v.map(|x| x.into());
10324        self
10325    }
10326}
10327
10328impl wkt::message::Message for LocationsMetadata {
10329    fn typename() -> &'static str {
10330        "type.googleapis.com/google.cloud.speech.v2.LocationsMetadata"
10331    }
10332}