Skip to main content

google_cloud_speech_v2/
builder.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/// Request and client builders for [Speech][crate::client::Speech].
18pub mod speech {
19    use crate::Result;
20
21    /// A builder for [Speech][crate::client::Speech].
22    ///
23    /// ```
24    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25    /// # use google_cloud_speech_v2::*;
26    /// # use builder::speech::ClientBuilder;
27    /// # use client::Speech;
28    /// let builder : ClientBuilder = Speech::builder();
29    /// let client = builder
30    ///     .with_endpoint("https://speech.googleapis.com")
31    ///     .build().await?;
32    /// # Ok(()) }
33    /// ```
34    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36    pub(crate) mod client {
37        use super::super::super::client::Speech;
38        pub struct Factory;
39        impl crate::ClientFactory for Factory {
40            type Client = Speech;
41            type Credentials = gaxi::options::Credentials;
42            async fn build(
43                self,
44                config: gaxi::options::ClientConfig,
45            ) -> crate::ClientBuilderResult<Self::Client> {
46                Self::Client::new(config).await
47            }
48        }
49    }
50
51    /// Common implementation for [crate::client::Speech] request builders.
52    #[derive(Clone, Debug)]
53    pub(crate) struct RequestBuilder<R: std::default::Default> {
54        stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>,
55        request: R,
56        options: crate::RequestOptions,
57    }
58
59    impl<R> RequestBuilder<R>
60    where
61        R: std::default::Default,
62    {
63        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
64            Self {
65                stub,
66                request: R::default(),
67                options: crate::RequestOptions::default(),
68            }
69        }
70    }
71
72    /// The request builder for [Speech::create_recognizer][crate::client::Speech::create_recognizer] calls.
73    ///
74    /// # Example
75    /// ```
76    /// # use google_cloud_speech_v2::builder::speech::CreateRecognizer;
77    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
78    /// use google_cloud_lro::Poller;
79    ///
80    /// let builder = prepare_request_builder();
81    /// let response = builder.poller().until_done().await?;
82    /// # Ok(()) }
83    ///
84    /// fn prepare_request_builder() -> CreateRecognizer {
85    ///   # panic!();
86    ///   // ... details omitted ...
87    /// }
88    /// ```
89    #[derive(Clone, Debug)]
90    pub struct CreateRecognizer(RequestBuilder<crate::model::CreateRecognizerRequest>);
91
92    impl CreateRecognizer {
93        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
94            Self(RequestBuilder::new(stub))
95        }
96
97        /// Sets the full request, replacing any prior values.
98        pub fn with_request<V: Into<crate::model::CreateRecognizerRequest>>(
99            mut self,
100            v: V,
101        ) -> Self {
102            self.0.request = v.into();
103            self
104        }
105
106        /// Sets all the options, replacing any prior values.
107        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
108            self.0.options = v.into();
109            self
110        }
111
112        /// Sends the request.
113        ///
114        /// # Long running operations
115        ///
116        /// This starts, but does not poll, a longrunning operation. More information
117        /// on [create_recognizer][crate::client::Speech::create_recognizer].
118        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
119            (*self.0.stub)
120                .create_recognizer(self.0.request, self.0.options)
121                .await
122                .map(crate::Response::into_body)
123        }
124
125        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_recognizer`.
126        pub fn poller(
127            self,
128        ) -> impl google_cloud_lro::Poller<crate::model::Recognizer, crate::model::OperationMetadata>
129        {
130            type Operation = google_cloud_lro::internal::Operation<
131                crate::model::Recognizer,
132                crate::model::OperationMetadata,
133            >;
134            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
135            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
136            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
137            if let Some(ref mut details) = poller_options.tracing {
138                details.method_name =
139                    "google_cloud_speech_v2::client::Speech::create_recognizer::until_done";
140            }
141
142            let stub = self.0.stub.clone();
143            let mut options = self.0.options.clone();
144            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
145            let query = move |name| {
146                let stub = stub.clone();
147                let options = options.clone();
148                async {
149                    let op = GetOperation::new(stub)
150                        .set_name(name)
151                        .with_options(options)
152                        .send()
153                        .await?;
154                    Ok(Operation::new(op))
155                }
156            };
157
158            let start = move || async {
159                let op = self.send().await?;
160                Ok(Operation::new(op))
161            };
162
163            use google_cloud_lro::internal::PollerExt;
164            {
165                google_cloud_lro::internal::new_poller(
166                    polling_error_policy,
167                    polling_backoff_policy,
168                    start,
169                    query,
170                )
171            }
172            .with_options(poller_options)
173        }
174
175        /// Sets the value of [recognizer][crate::model::CreateRecognizerRequest::recognizer].
176        ///
177        /// This is a **required** field for requests.
178        pub fn set_recognizer<T>(mut self, v: T) -> Self
179        where
180            T: std::convert::Into<crate::model::Recognizer>,
181        {
182            self.0.request.recognizer = std::option::Option::Some(v.into());
183            self
184        }
185
186        /// Sets or clears the value of [recognizer][crate::model::CreateRecognizerRequest::recognizer].
187        ///
188        /// This is a **required** field for requests.
189        pub fn set_or_clear_recognizer<T>(mut self, v: std::option::Option<T>) -> Self
190        where
191            T: std::convert::Into<crate::model::Recognizer>,
192        {
193            self.0.request.recognizer = v.map(|x| x.into());
194            self
195        }
196
197        /// Sets the value of [validate_only][crate::model::CreateRecognizerRequest::validate_only].
198        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
199            self.0.request.validate_only = v.into();
200            self
201        }
202
203        /// Sets the value of [recognizer_id][crate::model::CreateRecognizerRequest::recognizer_id].
204        pub fn set_recognizer_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
205            self.0.request.recognizer_id = v.into();
206            self
207        }
208
209        /// Sets the value of [parent][crate::model::CreateRecognizerRequest::parent].
210        ///
211        /// This is a **required** field for requests.
212        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
213            self.0.request.parent = v.into();
214            self
215        }
216    }
217
218    #[doc(hidden)]
219    impl crate::RequestBuilder for CreateRecognizer {
220        fn request_options(&mut self) -> &mut crate::RequestOptions {
221            &mut self.0.options
222        }
223    }
224
225    /// The request builder for [Speech::list_recognizers][crate::client::Speech::list_recognizers] calls.
226    ///
227    /// # Example
228    /// ```
229    /// # use google_cloud_speech_v2::builder::speech::ListRecognizers;
230    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
231    /// use google_cloud_gax::paginator::ItemPaginator;
232    ///
233    /// let builder = prepare_request_builder();
234    /// let mut items = builder.by_item();
235    /// while let Some(result) = items.next().await {
236    ///   let item = result?;
237    /// }
238    /// # Ok(()) }
239    ///
240    /// fn prepare_request_builder() -> ListRecognizers {
241    ///   # panic!();
242    ///   // ... details omitted ...
243    /// }
244    /// ```
245    #[derive(Clone, Debug)]
246    pub struct ListRecognizers(RequestBuilder<crate::model::ListRecognizersRequest>);
247
248    impl ListRecognizers {
249        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
250            Self(RequestBuilder::new(stub))
251        }
252
253        /// Sets the full request, replacing any prior values.
254        pub fn with_request<V: Into<crate::model::ListRecognizersRequest>>(mut self, v: V) -> Self {
255            self.0.request = v.into();
256            self
257        }
258
259        /// Sets all the options, replacing any prior values.
260        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
261            self.0.options = v.into();
262            self
263        }
264
265        /// Sends the request.
266        pub async fn send(self) -> Result<crate::model::ListRecognizersResponse> {
267            (*self.0.stub)
268                .list_recognizers(self.0.request, self.0.options)
269                .await
270                .map(crate::Response::into_body)
271        }
272
273        /// Streams each page in the collection.
274        pub fn by_page(
275            self,
276        ) -> impl google_cloud_gax::paginator::Paginator<
277            crate::model::ListRecognizersResponse,
278            crate::Error,
279        > {
280            use std::clone::Clone;
281            let token = self.0.request.page_token.clone();
282            let execute = move |token: String| {
283                let mut builder = self.clone();
284                builder.0.request = builder.0.request.set_page_token(token);
285                builder.send()
286            };
287            google_cloud_gax::paginator::internal::new_paginator(token, execute)
288        }
289
290        /// Streams each item in the collection.
291        pub fn by_item(
292            self,
293        ) -> impl google_cloud_gax::paginator::ItemPaginator<
294            crate::model::ListRecognizersResponse,
295            crate::Error,
296        > {
297            use google_cloud_gax::paginator::Paginator;
298            self.by_page().items()
299        }
300
301        /// Sets the value of [parent][crate::model::ListRecognizersRequest::parent].
302        ///
303        /// This is a **required** field for requests.
304        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
305            self.0.request.parent = v.into();
306            self
307        }
308
309        /// Sets the value of [page_size][crate::model::ListRecognizersRequest::page_size].
310        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
311            self.0.request.page_size = v.into();
312            self
313        }
314
315        /// Sets the value of [page_token][crate::model::ListRecognizersRequest::page_token].
316        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
317            self.0.request.page_token = v.into();
318            self
319        }
320
321        /// Sets the value of [show_deleted][crate::model::ListRecognizersRequest::show_deleted].
322        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
323            self.0.request.show_deleted = v.into();
324            self
325        }
326    }
327
328    #[doc(hidden)]
329    impl crate::RequestBuilder for ListRecognizers {
330        fn request_options(&mut self) -> &mut crate::RequestOptions {
331            &mut self.0.options
332        }
333    }
334
335    /// The request builder for [Speech::get_recognizer][crate::client::Speech::get_recognizer] calls.
336    ///
337    /// # Example
338    /// ```
339    /// # use google_cloud_speech_v2::builder::speech::GetRecognizer;
340    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
341    ///
342    /// let builder = prepare_request_builder();
343    /// let response = builder.send().await?;
344    /// # Ok(()) }
345    ///
346    /// fn prepare_request_builder() -> GetRecognizer {
347    ///   # panic!();
348    ///   // ... details omitted ...
349    /// }
350    /// ```
351    #[derive(Clone, Debug)]
352    pub struct GetRecognizer(RequestBuilder<crate::model::GetRecognizerRequest>);
353
354    impl GetRecognizer {
355        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
356            Self(RequestBuilder::new(stub))
357        }
358
359        /// Sets the full request, replacing any prior values.
360        pub fn with_request<V: Into<crate::model::GetRecognizerRequest>>(mut self, v: V) -> Self {
361            self.0.request = v.into();
362            self
363        }
364
365        /// Sets all the options, replacing any prior values.
366        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
367            self.0.options = v.into();
368            self
369        }
370
371        /// Sends the request.
372        pub async fn send(self) -> Result<crate::model::Recognizer> {
373            (*self.0.stub)
374                .get_recognizer(self.0.request, self.0.options)
375                .await
376                .map(crate::Response::into_body)
377        }
378
379        /// Sets the value of [name][crate::model::GetRecognizerRequest::name].
380        ///
381        /// This is a **required** field for requests.
382        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
383            self.0.request.name = v.into();
384            self
385        }
386    }
387
388    #[doc(hidden)]
389    impl crate::RequestBuilder for GetRecognizer {
390        fn request_options(&mut self) -> &mut crate::RequestOptions {
391            &mut self.0.options
392        }
393    }
394
395    /// The request builder for [Speech::update_recognizer][crate::client::Speech::update_recognizer] calls.
396    ///
397    /// # Example
398    /// ```
399    /// # use google_cloud_speech_v2::builder::speech::UpdateRecognizer;
400    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
401    /// use google_cloud_lro::Poller;
402    ///
403    /// let builder = prepare_request_builder();
404    /// let response = builder.poller().until_done().await?;
405    /// # Ok(()) }
406    ///
407    /// fn prepare_request_builder() -> UpdateRecognizer {
408    ///   # panic!();
409    ///   // ... details omitted ...
410    /// }
411    /// ```
412    #[derive(Clone, Debug)]
413    pub struct UpdateRecognizer(RequestBuilder<crate::model::UpdateRecognizerRequest>);
414
415    impl UpdateRecognizer {
416        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
417            Self(RequestBuilder::new(stub))
418        }
419
420        /// Sets the full request, replacing any prior values.
421        pub fn with_request<V: Into<crate::model::UpdateRecognizerRequest>>(
422            mut self,
423            v: V,
424        ) -> Self {
425            self.0.request = v.into();
426            self
427        }
428
429        /// Sets all the options, replacing any prior values.
430        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
431            self.0.options = v.into();
432            self
433        }
434
435        /// Sends the request.
436        ///
437        /// # Long running operations
438        ///
439        /// This starts, but does not poll, a longrunning operation. More information
440        /// on [update_recognizer][crate::client::Speech::update_recognizer].
441        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
442            (*self.0.stub)
443                .update_recognizer(self.0.request, self.0.options)
444                .await
445                .map(crate::Response::into_body)
446        }
447
448        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_recognizer`.
449        pub fn poller(
450            self,
451        ) -> impl google_cloud_lro::Poller<crate::model::Recognizer, crate::model::OperationMetadata>
452        {
453            type Operation = google_cloud_lro::internal::Operation<
454                crate::model::Recognizer,
455                crate::model::OperationMetadata,
456            >;
457            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
458            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
459            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
460            if let Some(ref mut details) = poller_options.tracing {
461                details.method_name =
462                    "google_cloud_speech_v2::client::Speech::update_recognizer::until_done";
463            }
464
465            let stub = self.0.stub.clone();
466            let mut options = self.0.options.clone();
467            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
468            let query = move |name| {
469                let stub = stub.clone();
470                let options = options.clone();
471                async {
472                    let op = GetOperation::new(stub)
473                        .set_name(name)
474                        .with_options(options)
475                        .send()
476                        .await?;
477                    Ok(Operation::new(op))
478                }
479            };
480
481            let start = move || async {
482                let op = self.send().await?;
483                Ok(Operation::new(op))
484            };
485
486            use google_cloud_lro::internal::PollerExt;
487            {
488                google_cloud_lro::internal::new_poller(
489                    polling_error_policy,
490                    polling_backoff_policy,
491                    start,
492                    query,
493                )
494            }
495            .with_options(poller_options)
496        }
497
498        /// Sets the value of [recognizer][crate::model::UpdateRecognizerRequest::recognizer].
499        ///
500        /// This is a **required** field for requests.
501        pub fn set_recognizer<T>(mut self, v: T) -> Self
502        where
503            T: std::convert::Into<crate::model::Recognizer>,
504        {
505            self.0.request.recognizer = std::option::Option::Some(v.into());
506            self
507        }
508
509        /// Sets or clears the value of [recognizer][crate::model::UpdateRecognizerRequest::recognizer].
510        ///
511        /// This is a **required** field for requests.
512        pub fn set_or_clear_recognizer<T>(mut self, v: std::option::Option<T>) -> Self
513        where
514            T: std::convert::Into<crate::model::Recognizer>,
515        {
516            self.0.request.recognizer = v.map(|x| x.into());
517            self
518        }
519
520        /// Sets the value of [update_mask][crate::model::UpdateRecognizerRequest::update_mask].
521        pub fn set_update_mask<T>(mut self, v: T) -> Self
522        where
523            T: std::convert::Into<wkt::FieldMask>,
524        {
525            self.0.request.update_mask = std::option::Option::Some(v.into());
526            self
527        }
528
529        /// Sets or clears the value of [update_mask][crate::model::UpdateRecognizerRequest::update_mask].
530        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
531        where
532            T: std::convert::Into<wkt::FieldMask>,
533        {
534            self.0.request.update_mask = v.map(|x| x.into());
535            self
536        }
537
538        /// Sets the value of [validate_only][crate::model::UpdateRecognizerRequest::validate_only].
539        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
540            self.0.request.validate_only = v.into();
541            self
542        }
543    }
544
545    #[doc(hidden)]
546    impl crate::RequestBuilder for UpdateRecognizer {
547        fn request_options(&mut self) -> &mut crate::RequestOptions {
548            &mut self.0.options
549        }
550    }
551
552    /// The request builder for [Speech::delete_recognizer][crate::client::Speech::delete_recognizer] calls.
553    ///
554    /// # Example
555    /// ```
556    /// # use google_cloud_speech_v2::builder::speech::DeleteRecognizer;
557    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
558    /// use google_cloud_lro::Poller;
559    ///
560    /// let builder = prepare_request_builder();
561    /// let response = builder.poller().until_done().await?;
562    /// # Ok(()) }
563    ///
564    /// fn prepare_request_builder() -> DeleteRecognizer {
565    ///   # panic!();
566    ///   // ... details omitted ...
567    /// }
568    /// ```
569    #[derive(Clone, Debug)]
570    pub struct DeleteRecognizer(RequestBuilder<crate::model::DeleteRecognizerRequest>);
571
572    impl DeleteRecognizer {
573        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
574            Self(RequestBuilder::new(stub))
575        }
576
577        /// Sets the full request, replacing any prior values.
578        pub fn with_request<V: Into<crate::model::DeleteRecognizerRequest>>(
579            mut self,
580            v: V,
581        ) -> Self {
582            self.0.request = v.into();
583            self
584        }
585
586        /// Sets all the options, replacing any prior values.
587        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
588            self.0.options = v.into();
589            self
590        }
591
592        /// Sends the request.
593        ///
594        /// # Long running operations
595        ///
596        /// This starts, but does not poll, a longrunning operation. More information
597        /// on [delete_recognizer][crate::client::Speech::delete_recognizer].
598        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
599            (*self.0.stub)
600                .delete_recognizer(self.0.request, self.0.options)
601                .await
602                .map(crate::Response::into_body)
603        }
604
605        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_recognizer`.
606        pub fn poller(
607            self,
608        ) -> impl google_cloud_lro::Poller<crate::model::Recognizer, crate::model::OperationMetadata>
609        {
610            type Operation = google_cloud_lro::internal::Operation<
611                crate::model::Recognizer,
612                crate::model::OperationMetadata,
613            >;
614            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
615            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
616            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
617            if let Some(ref mut details) = poller_options.tracing {
618                details.method_name =
619                    "google_cloud_speech_v2::client::Speech::delete_recognizer::until_done";
620            }
621
622            let stub = self.0.stub.clone();
623            let mut options = self.0.options.clone();
624            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
625            let query = move |name| {
626                let stub = stub.clone();
627                let options = options.clone();
628                async {
629                    let op = GetOperation::new(stub)
630                        .set_name(name)
631                        .with_options(options)
632                        .send()
633                        .await?;
634                    Ok(Operation::new(op))
635                }
636            };
637
638            let start = move || async {
639                let op = self.send().await?;
640                Ok(Operation::new(op))
641            };
642
643            use google_cloud_lro::internal::PollerExt;
644            {
645                google_cloud_lro::internal::new_poller(
646                    polling_error_policy,
647                    polling_backoff_policy,
648                    start,
649                    query,
650                )
651            }
652            .with_options(poller_options)
653        }
654
655        /// Sets the value of [name][crate::model::DeleteRecognizerRequest::name].
656        ///
657        /// This is a **required** field for requests.
658        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
659            self.0.request.name = v.into();
660            self
661        }
662
663        /// Sets the value of [validate_only][crate::model::DeleteRecognizerRequest::validate_only].
664        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
665            self.0.request.validate_only = v.into();
666            self
667        }
668
669        /// Sets the value of [allow_missing][crate::model::DeleteRecognizerRequest::allow_missing].
670        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
671            self.0.request.allow_missing = v.into();
672            self
673        }
674
675        /// Sets the value of [etag][crate::model::DeleteRecognizerRequest::etag].
676        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
677            self.0.request.etag = v.into();
678            self
679        }
680    }
681
682    #[doc(hidden)]
683    impl crate::RequestBuilder for DeleteRecognizer {
684        fn request_options(&mut self) -> &mut crate::RequestOptions {
685            &mut self.0.options
686        }
687    }
688
689    /// The request builder for [Speech::undelete_recognizer][crate::client::Speech::undelete_recognizer] calls.
690    ///
691    /// # Example
692    /// ```
693    /// # use google_cloud_speech_v2::builder::speech::UndeleteRecognizer;
694    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
695    /// use google_cloud_lro::Poller;
696    ///
697    /// let builder = prepare_request_builder();
698    /// let response = builder.poller().until_done().await?;
699    /// # Ok(()) }
700    ///
701    /// fn prepare_request_builder() -> UndeleteRecognizer {
702    ///   # panic!();
703    ///   // ... details omitted ...
704    /// }
705    /// ```
706    #[derive(Clone, Debug)]
707    pub struct UndeleteRecognizer(RequestBuilder<crate::model::UndeleteRecognizerRequest>);
708
709    impl UndeleteRecognizer {
710        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
711            Self(RequestBuilder::new(stub))
712        }
713
714        /// Sets the full request, replacing any prior values.
715        pub fn with_request<V: Into<crate::model::UndeleteRecognizerRequest>>(
716            mut self,
717            v: V,
718        ) -> Self {
719            self.0.request = v.into();
720            self
721        }
722
723        /// Sets all the options, replacing any prior values.
724        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
725            self.0.options = v.into();
726            self
727        }
728
729        /// Sends the request.
730        ///
731        /// # Long running operations
732        ///
733        /// This starts, but does not poll, a longrunning operation. More information
734        /// on [undelete_recognizer][crate::client::Speech::undelete_recognizer].
735        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
736            (*self.0.stub)
737                .undelete_recognizer(self.0.request, self.0.options)
738                .await
739                .map(crate::Response::into_body)
740        }
741
742        /// Creates a [Poller][google_cloud_lro::Poller] to work with `undelete_recognizer`.
743        pub fn poller(
744            self,
745        ) -> impl google_cloud_lro::Poller<crate::model::Recognizer, crate::model::OperationMetadata>
746        {
747            type Operation = google_cloud_lro::internal::Operation<
748                crate::model::Recognizer,
749                crate::model::OperationMetadata,
750            >;
751            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
752            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
753            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
754            if let Some(ref mut details) = poller_options.tracing {
755                details.method_name =
756                    "google_cloud_speech_v2::client::Speech::undelete_recognizer::until_done";
757            }
758
759            let stub = self.0.stub.clone();
760            let mut options = self.0.options.clone();
761            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
762            let query = move |name| {
763                let stub = stub.clone();
764                let options = options.clone();
765                async {
766                    let op = GetOperation::new(stub)
767                        .set_name(name)
768                        .with_options(options)
769                        .send()
770                        .await?;
771                    Ok(Operation::new(op))
772                }
773            };
774
775            let start = move || async {
776                let op = self.send().await?;
777                Ok(Operation::new(op))
778            };
779
780            use google_cloud_lro::internal::PollerExt;
781            {
782                google_cloud_lro::internal::new_poller(
783                    polling_error_policy,
784                    polling_backoff_policy,
785                    start,
786                    query,
787                )
788            }
789            .with_options(poller_options)
790        }
791
792        /// Sets the value of [name][crate::model::UndeleteRecognizerRequest::name].
793        ///
794        /// This is a **required** field for requests.
795        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
796            self.0.request.name = v.into();
797            self
798        }
799
800        /// Sets the value of [validate_only][crate::model::UndeleteRecognizerRequest::validate_only].
801        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
802            self.0.request.validate_only = v.into();
803            self
804        }
805
806        /// Sets the value of [etag][crate::model::UndeleteRecognizerRequest::etag].
807        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
808            self.0.request.etag = v.into();
809            self
810        }
811    }
812
813    #[doc(hidden)]
814    impl crate::RequestBuilder for UndeleteRecognizer {
815        fn request_options(&mut self) -> &mut crate::RequestOptions {
816            &mut self.0.options
817        }
818    }
819
820    /// The request builder for [Speech::recognize][crate::client::Speech::recognize] calls.
821    ///
822    /// # Example
823    /// ```
824    /// # use google_cloud_speech_v2::builder::speech::Recognize;
825    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
826    ///
827    /// let builder = prepare_request_builder();
828    /// let response = builder.send().await?;
829    /// # Ok(()) }
830    ///
831    /// fn prepare_request_builder() -> Recognize {
832    ///   # panic!();
833    ///   // ... details omitted ...
834    /// }
835    /// ```
836    #[derive(Clone, Debug)]
837    pub struct Recognize(RequestBuilder<crate::model::RecognizeRequest>);
838
839    impl Recognize {
840        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
841            Self(RequestBuilder::new(stub))
842        }
843
844        /// Sets the full request, replacing any prior values.
845        pub fn with_request<V: Into<crate::model::RecognizeRequest>>(mut self, v: V) -> Self {
846            self.0.request = v.into();
847            self
848        }
849
850        /// Sets all the options, replacing any prior values.
851        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
852            self.0.options = v.into();
853            self
854        }
855
856        /// Sends the request.
857        pub async fn send(self) -> Result<crate::model::RecognizeResponse> {
858            (*self.0.stub)
859                .recognize(self.0.request, self.0.options)
860                .await
861                .map(crate::Response::into_body)
862        }
863
864        /// Sets the value of [recognizer][crate::model::RecognizeRequest::recognizer].
865        ///
866        /// This is a **required** field for requests.
867        pub fn set_recognizer<T: Into<std::string::String>>(mut self, v: T) -> Self {
868            self.0.request.recognizer = v.into();
869            self
870        }
871
872        /// Sets the value of [config][crate::model::RecognizeRequest::config].
873        pub fn set_config<T>(mut self, v: T) -> Self
874        where
875            T: std::convert::Into<crate::model::RecognitionConfig>,
876        {
877            self.0.request.config = std::option::Option::Some(v.into());
878            self
879        }
880
881        /// Sets or clears the value of [config][crate::model::RecognizeRequest::config].
882        pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
883        where
884            T: std::convert::Into<crate::model::RecognitionConfig>,
885        {
886            self.0.request.config = v.map(|x| x.into());
887            self
888        }
889
890        /// Sets the value of [config_mask][crate::model::RecognizeRequest::config_mask].
891        pub fn set_config_mask<T>(mut self, v: T) -> Self
892        where
893            T: std::convert::Into<wkt::FieldMask>,
894        {
895            self.0.request.config_mask = std::option::Option::Some(v.into());
896            self
897        }
898
899        /// Sets or clears the value of [config_mask][crate::model::RecognizeRequest::config_mask].
900        pub fn set_or_clear_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
901        where
902            T: std::convert::Into<wkt::FieldMask>,
903        {
904            self.0.request.config_mask = v.map(|x| x.into());
905            self
906        }
907
908        /// Sets the value of [audio_source][crate::model::RecognizeRequest::audio_source].
909        ///
910        /// Note that all the setters affecting `audio_source` are
911        /// mutually exclusive.
912        pub fn set_audio_source<T: Into<Option<crate::model::recognize_request::AudioSource>>>(
913            mut self,
914            v: T,
915        ) -> Self {
916            self.0.request.audio_source = v.into();
917            self
918        }
919
920        /// Sets the value of [audio_source][crate::model::RecognizeRequest::audio_source]
921        /// to hold a `Content`.
922        ///
923        /// Note that all the setters affecting `audio_source` are
924        /// mutually exclusive.
925        pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
926            self.0.request = self.0.request.set_content(v);
927            self
928        }
929
930        /// Sets the value of [audio_source][crate::model::RecognizeRequest::audio_source]
931        /// to hold a `Uri`.
932        ///
933        /// Note that all the setters affecting `audio_source` are
934        /// mutually exclusive.
935        pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
936            self.0.request = self.0.request.set_uri(v);
937            self
938        }
939    }
940
941    #[doc(hidden)]
942    impl crate::RequestBuilder for Recognize {
943        fn request_options(&mut self) -> &mut crate::RequestOptions {
944            &mut self.0.options
945        }
946    }
947
948    /// The request builder for [Speech::batch_recognize][crate::client::Speech::batch_recognize] calls.
949    ///
950    /// # Example
951    /// ```
952    /// # use google_cloud_speech_v2::builder::speech::BatchRecognize;
953    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
954    /// use google_cloud_lro::Poller;
955    ///
956    /// let builder = prepare_request_builder();
957    /// let response = builder.poller().until_done().await?;
958    /// # Ok(()) }
959    ///
960    /// fn prepare_request_builder() -> BatchRecognize {
961    ///   # panic!();
962    ///   // ... details omitted ...
963    /// }
964    /// ```
965    #[derive(Clone, Debug)]
966    pub struct BatchRecognize(RequestBuilder<crate::model::BatchRecognizeRequest>);
967
968    impl BatchRecognize {
969        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
970            Self(RequestBuilder::new(stub))
971        }
972
973        /// Sets the full request, replacing any prior values.
974        pub fn with_request<V: Into<crate::model::BatchRecognizeRequest>>(mut self, v: V) -> Self {
975            self.0.request = v.into();
976            self
977        }
978
979        /// Sets all the options, replacing any prior values.
980        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
981            self.0.options = v.into();
982            self
983        }
984
985        /// Sends the request.
986        ///
987        /// # Long running operations
988        ///
989        /// This starts, but does not poll, a longrunning operation. More information
990        /// on [batch_recognize][crate::client::Speech::batch_recognize].
991        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
992            (*self.0.stub)
993                .batch_recognize(self.0.request, self.0.options)
994                .await
995                .map(crate::Response::into_body)
996        }
997
998        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_recognize`.
999        pub fn poller(
1000            self,
1001        ) -> impl google_cloud_lro::Poller<
1002            crate::model::BatchRecognizeResponse,
1003            crate::model::OperationMetadata,
1004        > {
1005            type Operation = google_cloud_lro::internal::Operation<
1006                crate::model::BatchRecognizeResponse,
1007                crate::model::OperationMetadata,
1008            >;
1009            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1010            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1011            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1012            if let Some(ref mut details) = poller_options.tracing {
1013                details.method_name =
1014                    "google_cloud_speech_v2::client::Speech::batch_recognize::until_done";
1015            }
1016
1017            let stub = self.0.stub.clone();
1018            let mut options = self.0.options.clone();
1019            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1020            let query = move |name| {
1021                let stub = stub.clone();
1022                let options = options.clone();
1023                async {
1024                    let op = GetOperation::new(stub)
1025                        .set_name(name)
1026                        .with_options(options)
1027                        .send()
1028                        .await?;
1029                    Ok(Operation::new(op))
1030                }
1031            };
1032
1033            let start = move || async {
1034                let op = self.send().await?;
1035                Ok(Operation::new(op))
1036            };
1037
1038            use google_cloud_lro::internal::PollerExt;
1039            {
1040                google_cloud_lro::internal::new_poller(
1041                    polling_error_policy,
1042                    polling_backoff_policy,
1043                    start,
1044                    query,
1045                )
1046            }
1047            .with_options(poller_options)
1048        }
1049
1050        /// Sets the value of [recognizer][crate::model::BatchRecognizeRequest::recognizer].
1051        ///
1052        /// This is a **required** field for requests.
1053        pub fn set_recognizer<T: Into<std::string::String>>(mut self, v: T) -> Self {
1054            self.0.request.recognizer = v.into();
1055            self
1056        }
1057
1058        /// Sets the value of [config][crate::model::BatchRecognizeRequest::config].
1059        pub fn set_config<T>(mut self, v: T) -> Self
1060        where
1061            T: std::convert::Into<crate::model::RecognitionConfig>,
1062        {
1063            self.0.request.config = std::option::Option::Some(v.into());
1064            self
1065        }
1066
1067        /// Sets or clears the value of [config][crate::model::BatchRecognizeRequest::config].
1068        pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
1069        where
1070            T: std::convert::Into<crate::model::RecognitionConfig>,
1071        {
1072            self.0.request.config = v.map(|x| x.into());
1073            self
1074        }
1075
1076        /// Sets the value of [config_mask][crate::model::BatchRecognizeRequest::config_mask].
1077        pub fn set_config_mask<T>(mut self, v: T) -> Self
1078        where
1079            T: std::convert::Into<wkt::FieldMask>,
1080        {
1081            self.0.request.config_mask = std::option::Option::Some(v.into());
1082            self
1083        }
1084
1085        /// Sets or clears the value of [config_mask][crate::model::BatchRecognizeRequest::config_mask].
1086        pub fn set_or_clear_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
1087        where
1088            T: std::convert::Into<wkt::FieldMask>,
1089        {
1090            self.0.request.config_mask = v.map(|x| x.into());
1091            self
1092        }
1093
1094        /// Sets the value of [files][crate::model::BatchRecognizeRequest::files].
1095        pub fn set_files<T, V>(mut self, v: T) -> Self
1096        where
1097            T: std::iter::IntoIterator<Item = V>,
1098            V: std::convert::Into<crate::model::BatchRecognizeFileMetadata>,
1099        {
1100            use std::iter::Iterator;
1101            self.0.request.files = v.into_iter().map(|i| i.into()).collect();
1102            self
1103        }
1104
1105        /// Sets the value of [recognition_output_config][crate::model::BatchRecognizeRequest::recognition_output_config].
1106        pub fn set_recognition_output_config<T>(mut self, v: T) -> Self
1107        where
1108            T: std::convert::Into<crate::model::RecognitionOutputConfig>,
1109        {
1110            self.0.request.recognition_output_config = std::option::Option::Some(v.into());
1111            self
1112        }
1113
1114        /// Sets or clears the value of [recognition_output_config][crate::model::BatchRecognizeRequest::recognition_output_config].
1115        pub fn set_or_clear_recognition_output_config<T>(
1116            mut self,
1117            v: std::option::Option<T>,
1118        ) -> Self
1119        where
1120            T: std::convert::Into<crate::model::RecognitionOutputConfig>,
1121        {
1122            self.0.request.recognition_output_config = v.map(|x| x.into());
1123            self
1124        }
1125
1126        /// Sets the value of [processing_strategy][crate::model::BatchRecognizeRequest::processing_strategy].
1127        pub fn set_processing_strategy<
1128            T: Into<crate::model::batch_recognize_request::ProcessingStrategy>,
1129        >(
1130            mut self,
1131            v: T,
1132        ) -> Self {
1133            self.0.request.processing_strategy = v.into();
1134            self
1135        }
1136    }
1137
1138    #[doc(hidden)]
1139    impl crate::RequestBuilder for BatchRecognize {
1140        fn request_options(&mut self) -> &mut crate::RequestOptions {
1141            &mut self.0.options
1142        }
1143    }
1144
1145    /// The request builder for [Speech::get_config][crate::client::Speech::get_config] calls.
1146    ///
1147    /// # Example
1148    /// ```
1149    /// # use google_cloud_speech_v2::builder::speech::GetConfig;
1150    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
1151    ///
1152    /// let builder = prepare_request_builder();
1153    /// let response = builder.send().await?;
1154    /// # Ok(()) }
1155    ///
1156    /// fn prepare_request_builder() -> GetConfig {
1157    ///   # panic!();
1158    ///   // ... details omitted ...
1159    /// }
1160    /// ```
1161    #[derive(Clone, Debug)]
1162    pub struct GetConfig(RequestBuilder<crate::model::GetConfigRequest>);
1163
1164    impl GetConfig {
1165        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1166            Self(RequestBuilder::new(stub))
1167        }
1168
1169        /// Sets the full request, replacing any prior values.
1170        pub fn with_request<V: Into<crate::model::GetConfigRequest>>(mut self, v: V) -> Self {
1171            self.0.request = v.into();
1172            self
1173        }
1174
1175        /// Sets all the options, replacing any prior values.
1176        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1177            self.0.options = v.into();
1178            self
1179        }
1180
1181        /// Sends the request.
1182        pub async fn send(self) -> Result<crate::model::Config> {
1183            (*self.0.stub)
1184                .get_config(self.0.request, self.0.options)
1185                .await
1186                .map(crate::Response::into_body)
1187        }
1188
1189        /// Sets the value of [name][crate::model::GetConfigRequest::name].
1190        ///
1191        /// This is a **required** field for requests.
1192        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1193            self.0.request.name = v.into();
1194            self
1195        }
1196    }
1197
1198    #[doc(hidden)]
1199    impl crate::RequestBuilder for GetConfig {
1200        fn request_options(&mut self) -> &mut crate::RequestOptions {
1201            &mut self.0.options
1202        }
1203    }
1204
1205    /// The request builder for [Speech::update_config][crate::client::Speech::update_config] calls.
1206    ///
1207    /// # Example
1208    /// ```
1209    /// # use google_cloud_speech_v2::builder::speech::UpdateConfig;
1210    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
1211    ///
1212    /// let builder = prepare_request_builder();
1213    /// let response = builder.send().await?;
1214    /// # Ok(()) }
1215    ///
1216    /// fn prepare_request_builder() -> UpdateConfig {
1217    ///   # panic!();
1218    ///   // ... details omitted ...
1219    /// }
1220    /// ```
1221    #[derive(Clone, Debug)]
1222    pub struct UpdateConfig(RequestBuilder<crate::model::UpdateConfigRequest>);
1223
1224    impl UpdateConfig {
1225        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1226            Self(RequestBuilder::new(stub))
1227        }
1228
1229        /// Sets the full request, replacing any prior values.
1230        pub fn with_request<V: Into<crate::model::UpdateConfigRequest>>(mut self, v: V) -> Self {
1231            self.0.request = v.into();
1232            self
1233        }
1234
1235        /// Sets all the options, replacing any prior values.
1236        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1237            self.0.options = v.into();
1238            self
1239        }
1240
1241        /// Sends the request.
1242        pub async fn send(self) -> Result<crate::model::Config> {
1243            (*self.0.stub)
1244                .update_config(self.0.request, self.0.options)
1245                .await
1246                .map(crate::Response::into_body)
1247        }
1248
1249        /// Sets the value of [config][crate::model::UpdateConfigRequest::config].
1250        ///
1251        /// This is a **required** field for requests.
1252        pub fn set_config<T>(mut self, v: T) -> Self
1253        where
1254            T: std::convert::Into<crate::model::Config>,
1255        {
1256            self.0.request.config = std::option::Option::Some(v.into());
1257            self
1258        }
1259
1260        /// Sets or clears the value of [config][crate::model::UpdateConfigRequest::config].
1261        ///
1262        /// This is a **required** field for requests.
1263        pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
1264        where
1265            T: std::convert::Into<crate::model::Config>,
1266        {
1267            self.0.request.config = v.map(|x| x.into());
1268            self
1269        }
1270
1271        /// Sets the value of [update_mask][crate::model::UpdateConfigRequest::update_mask].
1272        pub fn set_update_mask<T>(mut self, v: T) -> Self
1273        where
1274            T: std::convert::Into<wkt::FieldMask>,
1275        {
1276            self.0.request.update_mask = std::option::Option::Some(v.into());
1277            self
1278        }
1279
1280        /// Sets or clears the value of [update_mask][crate::model::UpdateConfigRequest::update_mask].
1281        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1282        where
1283            T: std::convert::Into<wkt::FieldMask>,
1284        {
1285            self.0.request.update_mask = v.map(|x| x.into());
1286            self
1287        }
1288    }
1289
1290    #[doc(hidden)]
1291    impl crate::RequestBuilder for UpdateConfig {
1292        fn request_options(&mut self) -> &mut crate::RequestOptions {
1293            &mut self.0.options
1294        }
1295    }
1296
1297    /// The request builder for [Speech::create_custom_class][crate::client::Speech::create_custom_class] calls.
1298    ///
1299    /// # Example
1300    /// ```
1301    /// # use google_cloud_speech_v2::builder::speech::CreateCustomClass;
1302    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
1303    /// use google_cloud_lro::Poller;
1304    ///
1305    /// let builder = prepare_request_builder();
1306    /// let response = builder.poller().until_done().await?;
1307    /// # Ok(()) }
1308    ///
1309    /// fn prepare_request_builder() -> CreateCustomClass {
1310    ///   # panic!();
1311    ///   // ... details omitted ...
1312    /// }
1313    /// ```
1314    #[derive(Clone, Debug)]
1315    pub struct CreateCustomClass(RequestBuilder<crate::model::CreateCustomClassRequest>);
1316
1317    impl CreateCustomClass {
1318        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1319            Self(RequestBuilder::new(stub))
1320        }
1321
1322        /// Sets the full request, replacing any prior values.
1323        pub fn with_request<V: Into<crate::model::CreateCustomClassRequest>>(
1324            mut self,
1325            v: V,
1326        ) -> Self {
1327            self.0.request = v.into();
1328            self
1329        }
1330
1331        /// Sets all the options, replacing any prior values.
1332        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1333            self.0.options = v.into();
1334            self
1335        }
1336
1337        /// Sends the request.
1338        ///
1339        /// # Long running operations
1340        ///
1341        /// This starts, but does not poll, a longrunning operation. More information
1342        /// on [create_custom_class][crate::client::Speech::create_custom_class].
1343        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1344            (*self.0.stub)
1345                .create_custom_class(self.0.request, self.0.options)
1346                .await
1347                .map(crate::Response::into_body)
1348        }
1349
1350        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_custom_class`.
1351        pub fn poller(
1352            self,
1353        ) -> impl google_cloud_lro::Poller<crate::model::CustomClass, crate::model::OperationMetadata>
1354        {
1355            type Operation = google_cloud_lro::internal::Operation<
1356                crate::model::CustomClass,
1357                crate::model::OperationMetadata,
1358            >;
1359            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1360            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1361            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1362            if let Some(ref mut details) = poller_options.tracing {
1363                details.method_name =
1364                    "google_cloud_speech_v2::client::Speech::create_custom_class::until_done";
1365            }
1366
1367            let stub = self.0.stub.clone();
1368            let mut options = self.0.options.clone();
1369            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1370            let query = move |name| {
1371                let stub = stub.clone();
1372                let options = options.clone();
1373                async {
1374                    let op = GetOperation::new(stub)
1375                        .set_name(name)
1376                        .with_options(options)
1377                        .send()
1378                        .await?;
1379                    Ok(Operation::new(op))
1380                }
1381            };
1382
1383            let start = move || async {
1384                let op = self.send().await?;
1385                Ok(Operation::new(op))
1386            };
1387
1388            use google_cloud_lro::internal::PollerExt;
1389            {
1390                google_cloud_lro::internal::new_poller(
1391                    polling_error_policy,
1392                    polling_backoff_policy,
1393                    start,
1394                    query,
1395                )
1396            }
1397            .with_options(poller_options)
1398        }
1399
1400        /// Sets the value of [custom_class][crate::model::CreateCustomClassRequest::custom_class].
1401        ///
1402        /// This is a **required** field for requests.
1403        pub fn set_custom_class<T>(mut self, v: T) -> Self
1404        where
1405            T: std::convert::Into<crate::model::CustomClass>,
1406        {
1407            self.0.request.custom_class = std::option::Option::Some(v.into());
1408            self
1409        }
1410
1411        /// Sets or clears the value of [custom_class][crate::model::CreateCustomClassRequest::custom_class].
1412        ///
1413        /// This is a **required** field for requests.
1414        pub fn set_or_clear_custom_class<T>(mut self, v: std::option::Option<T>) -> Self
1415        where
1416            T: std::convert::Into<crate::model::CustomClass>,
1417        {
1418            self.0.request.custom_class = v.map(|x| x.into());
1419            self
1420        }
1421
1422        /// Sets the value of [validate_only][crate::model::CreateCustomClassRequest::validate_only].
1423        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1424            self.0.request.validate_only = v.into();
1425            self
1426        }
1427
1428        /// Sets the value of [custom_class_id][crate::model::CreateCustomClassRequest::custom_class_id].
1429        pub fn set_custom_class_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1430            self.0.request.custom_class_id = v.into();
1431            self
1432        }
1433
1434        /// Sets the value of [parent][crate::model::CreateCustomClassRequest::parent].
1435        ///
1436        /// This is a **required** field for requests.
1437        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1438            self.0.request.parent = v.into();
1439            self
1440        }
1441    }
1442
1443    #[doc(hidden)]
1444    impl crate::RequestBuilder for CreateCustomClass {
1445        fn request_options(&mut self) -> &mut crate::RequestOptions {
1446            &mut self.0.options
1447        }
1448    }
1449
1450    /// The request builder for [Speech::list_custom_classes][crate::client::Speech::list_custom_classes] calls.
1451    ///
1452    /// # Example
1453    /// ```
1454    /// # use google_cloud_speech_v2::builder::speech::ListCustomClasses;
1455    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
1456    /// use google_cloud_gax::paginator::ItemPaginator;
1457    ///
1458    /// let builder = prepare_request_builder();
1459    /// let mut items = builder.by_item();
1460    /// while let Some(result) = items.next().await {
1461    ///   let item = result?;
1462    /// }
1463    /// # Ok(()) }
1464    ///
1465    /// fn prepare_request_builder() -> ListCustomClasses {
1466    ///   # panic!();
1467    ///   // ... details omitted ...
1468    /// }
1469    /// ```
1470    #[derive(Clone, Debug)]
1471    pub struct ListCustomClasses(RequestBuilder<crate::model::ListCustomClassesRequest>);
1472
1473    impl ListCustomClasses {
1474        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1475            Self(RequestBuilder::new(stub))
1476        }
1477
1478        /// Sets the full request, replacing any prior values.
1479        pub fn with_request<V: Into<crate::model::ListCustomClassesRequest>>(
1480            mut self,
1481            v: V,
1482        ) -> Self {
1483            self.0.request = v.into();
1484            self
1485        }
1486
1487        /// Sets all the options, replacing any prior values.
1488        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1489            self.0.options = v.into();
1490            self
1491        }
1492
1493        /// Sends the request.
1494        pub async fn send(self) -> Result<crate::model::ListCustomClassesResponse> {
1495            (*self.0.stub)
1496                .list_custom_classes(self.0.request, self.0.options)
1497                .await
1498                .map(crate::Response::into_body)
1499        }
1500
1501        /// Streams each page in the collection.
1502        pub fn by_page(
1503            self,
1504        ) -> impl google_cloud_gax::paginator::Paginator<
1505            crate::model::ListCustomClassesResponse,
1506            crate::Error,
1507        > {
1508            use std::clone::Clone;
1509            let token = self.0.request.page_token.clone();
1510            let execute = move |token: String| {
1511                let mut builder = self.clone();
1512                builder.0.request = builder.0.request.set_page_token(token);
1513                builder.send()
1514            };
1515            google_cloud_gax::paginator::internal::new_paginator(token, execute)
1516        }
1517
1518        /// Streams each item in the collection.
1519        pub fn by_item(
1520            self,
1521        ) -> impl google_cloud_gax::paginator::ItemPaginator<
1522            crate::model::ListCustomClassesResponse,
1523            crate::Error,
1524        > {
1525            use google_cloud_gax::paginator::Paginator;
1526            self.by_page().items()
1527        }
1528
1529        /// Sets the value of [parent][crate::model::ListCustomClassesRequest::parent].
1530        ///
1531        /// This is a **required** field for requests.
1532        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1533            self.0.request.parent = v.into();
1534            self
1535        }
1536
1537        /// Sets the value of [page_size][crate::model::ListCustomClassesRequest::page_size].
1538        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1539            self.0.request.page_size = v.into();
1540            self
1541        }
1542
1543        /// Sets the value of [page_token][crate::model::ListCustomClassesRequest::page_token].
1544        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1545            self.0.request.page_token = v.into();
1546            self
1547        }
1548
1549        /// Sets the value of [show_deleted][crate::model::ListCustomClassesRequest::show_deleted].
1550        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
1551            self.0.request.show_deleted = v.into();
1552            self
1553        }
1554    }
1555
1556    #[doc(hidden)]
1557    impl crate::RequestBuilder for ListCustomClasses {
1558        fn request_options(&mut self) -> &mut crate::RequestOptions {
1559            &mut self.0.options
1560        }
1561    }
1562
1563    /// The request builder for [Speech::get_custom_class][crate::client::Speech::get_custom_class] calls.
1564    ///
1565    /// # Example
1566    /// ```
1567    /// # use google_cloud_speech_v2::builder::speech::GetCustomClass;
1568    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
1569    ///
1570    /// let builder = prepare_request_builder();
1571    /// let response = builder.send().await?;
1572    /// # Ok(()) }
1573    ///
1574    /// fn prepare_request_builder() -> GetCustomClass {
1575    ///   # panic!();
1576    ///   // ... details omitted ...
1577    /// }
1578    /// ```
1579    #[derive(Clone, Debug)]
1580    pub struct GetCustomClass(RequestBuilder<crate::model::GetCustomClassRequest>);
1581
1582    impl GetCustomClass {
1583        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1584            Self(RequestBuilder::new(stub))
1585        }
1586
1587        /// Sets the full request, replacing any prior values.
1588        pub fn with_request<V: Into<crate::model::GetCustomClassRequest>>(mut self, v: V) -> Self {
1589            self.0.request = v.into();
1590            self
1591        }
1592
1593        /// Sets all the options, replacing any prior values.
1594        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1595            self.0.options = v.into();
1596            self
1597        }
1598
1599        /// Sends the request.
1600        pub async fn send(self) -> Result<crate::model::CustomClass> {
1601            (*self.0.stub)
1602                .get_custom_class(self.0.request, self.0.options)
1603                .await
1604                .map(crate::Response::into_body)
1605        }
1606
1607        /// Sets the value of [name][crate::model::GetCustomClassRequest::name].
1608        ///
1609        /// This is a **required** field for requests.
1610        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1611            self.0.request.name = v.into();
1612            self
1613        }
1614    }
1615
1616    #[doc(hidden)]
1617    impl crate::RequestBuilder for GetCustomClass {
1618        fn request_options(&mut self) -> &mut crate::RequestOptions {
1619            &mut self.0.options
1620        }
1621    }
1622
1623    /// The request builder for [Speech::update_custom_class][crate::client::Speech::update_custom_class] calls.
1624    ///
1625    /// # Example
1626    /// ```
1627    /// # use google_cloud_speech_v2::builder::speech::UpdateCustomClass;
1628    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
1629    /// use google_cloud_lro::Poller;
1630    ///
1631    /// let builder = prepare_request_builder();
1632    /// let response = builder.poller().until_done().await?;
1633    /// # Ok(()) }
1634    ///
1635    /// fn prepare_request_builder() -> UpdateCustomClass {
1636    ///   # panic!();
1637    ///   // ... details omitted ...
1638    /// }
1639    /// ```
1640    #[derive(Clone, Debug)]
1641    pub struct UpdateCustomClass(RequestBuilder<crate::model::UpdateCustomClassRequest>);
1642
1643    impl UpdateCustomClass {
1644        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1645            Self(RequestBuilder::new(stub))
1646        }
1647
1648        /// Sets the full request, replacing any prior values.
1649        pub fn with_request<V: Into<crate::model::UpdateCustomClassRequest>>(
1650            mut self,
1651            v: V,
1652        ) -> Self {
1653            self.0.request = v.into();
1654            self
1655        }
1656
1657        /// Sets all the options, replacing any prior values.
1658        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1659            self.0.options = v.into();
1660            self
1661        }
1662
1663        /// Sends the request.
1664        ///
1665        /// # Long running operations
1666        ///
1667        /// This starts, but does not poll, a longrunning operation. More information
1668        /// on [update_custom_class][crate::client::Speech::update_custom_class].
1669        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1670            (*self.0.stub)
1671                .update_custom_class(self.0.request, self.0.options)
1672                .await
1673                .map(crate::Response::into_body)
1674        }
1675
1676        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_custom_class`.
1677        pub fn poller(
1678            self,
1679        ) -> impl google_cloud_lro::Poller<crate::model::CustomClass, crate::model::OperationMetadata>
1680        {
1681            type Operation = google_cloud_lro::internal::Operation<
1682                crate::model::CustomClass,
1683                crate::model::OperationMetadata,
1684            >;
1685            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1686            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1687            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1688            if let Some(ref mut details) = poller_options.tracing {
1689                details.method_name =
1690                    "google_cloud_speech_v2::client::Speech::update_custom_class::until_done";
1691            }
1692
1693            let stub = self.0.stub.clone();
1694            let mut options = self.0.options.clone();
1695            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1696            let query = move |name| {
1697                let stub = stub.clone();
1698                let options = options.clone();
1699                async {
1700                    let op = GetOperation::new(stub)
1701                        .set_name(name)
1702                        .with_options(options)
1703                        .send()
1704                        .await?;
1705                    Ok(Operation::new(op))
1706                }
1707            };
1708
1709            let start = move || async {
1710                let op = self.send().await?;
1711                Ok(Operation::new(op))
1712            };
1713
1714            use google_cloud_lro::internal::PollerExt;
1715            {
1716                google_cloud_lro::internal::new_poller(
1717                    polling_error_policy,
1718                    polling_backoff_policy,
1719                    start,
1720                    query,
1721                )
1722            }
1723            .with_options(poller_options)
1724        }
1725
1726        /// Sets the value of [custom_class][crate::model::UpdateCustomClassRequest::custom_class].
1727        ///
1728        /// This is a **required** field for requests.
1729        pub fn set_custom_class<T>(mut self, v: T) -> Self
1730        where
1731            T: std::convert::Into<crate::model::CustomClass>,
1732        {
1733            self.0.request.custom_class = std::option::Option::Some(v.into());
1734            self
1735        }
1736
1737        /// Sets or clears the value of [custom_class][crate::model::UpdateCustomClassRequest::custom_class].
1738        ///
1739        /// This is a **required** field for requests.
1740        pub fn set_or_clear_custom_class<T>(mut self, v: std::option::Option<T>) -> Self
1741        where
1742            T: std::convert::Into<crate::model::CustomClass>,
1743        {
1744            self.0.request.custom_class = v.map(|x| x.into());
1745            self
1746        }
1747
1748        /// Sets the value of [update_mask][crate::model::UpdateCustomClassRequest::update_mask].
1749        pub fn set_update_mask<T>(mut self, v: T) -> Self
1750        where
1751            T: std::convert::Into<wkt::FieldMask>,
1752        {
1753            self.0.request.update_mask = std::option::Option::Some(v.into());
1754            self
1755        }
1756
1757        /// Sets or clears the value of [update_mask][crate::model::UpdateCustomClassRequest::update_mask].
1758        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1759        where
1760            T: std::convert::Into<wkt::FieldMask>,
1761        {
1762            self.0.request.update_mask = v.map(|x| x.into());
1763            self
1764        }
1765
1766        /// Sets the value of [validate_only][crate::model::UpdateCustomClassRequest::validate_only].
1767        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1768            self.0.request.validate_only = v.into();
1769            self
1770        }
1771    }
1772
1773    #[doc(hidden)]
1774    impl crate::RequestBuilder for UpdateCustomClass {
1775        fn request_options(&mut self) -> &mut crate::RequestOptions {
1776            &mut self.0.options
1777        }
1778    }
1779
1780    /// The request builder for [Speech::delete_custom_class][crate::client::Speech::delete_custom_class] calls.
1781    ///
1782    /// # Example
1783    /// ```
1784    /// # use google_cloud_speech_v2::builder::speech::DeleteCustomClass;
1785    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
1786    /// use google_cloud_lro::Poller;
1787    ///
1788    /// let builder = prepare_request_builder();
1789    /// let response = builder.poller().until_done().await?;
1790    /// # Ok(()) }
1791    ///
1792    /// fn prepare_request_builder() -> DeleteCustomClass {
1793    ///   # panic!();
1794    ///   // ... details omitted ...
1795    /// }
1796    /// ```
1797    #[derive(Clone, Debug)]
1798    pub struct DeleteCustomClass(RequestBuilder<crate::model::DeleteCustomClassRequest>);
1799
1800    impl DeleteCustomClass {
1801        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1802            Self(RequestBuilder::new(stub))
1803        }
1804
1805        /// Sets the full request, replacing any prior values.
1806        pub fn with_request<V: Into<crate::model::DeleteCustomClassRequest>>(
1807            mut self,
1808            v: V,
1809        ) -> Self {
1810            self.0.request = v.into();
1811            self
1812        }
1813
1814        /// Sets all the options, replacing any prior values.
1815        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1816            self.0.options = v.into();
1817            self
1818        }
1819
1820        /// Sends the request.
1821        ///
1822        /// # Long running operations
1823        ///
1824        /// This starts, but does not poll, a longrunning operation. More information
1825        /// on [delete_custom_class][crate::client::Speech::delete_custom_class].
1826        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1827            (*self.0.stub)
1828                .delete_custom_class(self.0.request, self.0.options)
1829                .await
1830                .map(crate::Response::into_body)
1831        }
1832
1833        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_custom_class`.
1834        pub fn poller(
1835            self,
1836        ) -> impl google_cloud_lro::Poller<crate::model::CustomClass, crate::model::OperationMetadata>
1837        {
1838            type Operation = google_cloud_lro::internal::Operation<
1839                crate::model::CustomClass,
1840                crate::model::OperationMetadata,
1841            >;
1842            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1843            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1844            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1845            if let Some(ref mut details) = poller_options.tracing {
1846                details.method_name =
1847                    "google_cloud_speech_v2::client::Speech::delete_custom_class::until_done";
1848            }
1849
1850            let stub = self.0.stub.clone();
1851            let mut options = self.0.options.clone();
1852            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1853            let query = move |name| {
1854                let stub = stub.clone();
1855                let options = options.clone();
1856                async {
1857                    let op = GetOperation::new(stub)
1858                        .set_name(name)
1859                        .with_options(options)
1860                        .send()
1861                        .await?;
1862                    Ok(Operation::new(op))
1863                }
1864            };
1865
1866            let start = move || async {
1867                let op = self.send().await?;
1868                Ok(Operation::new(op))
1869            };
1870
1871            use google_cloud_lro::internal::PollerExt;
1872            {
1873                google_cloud_lro::internal::new_poller(
1874                    polling_error_policy,
1875                    polling_backoff_policy,
1876                    start,
1877                    query,
1878                )
1879            }
1880            .with_options(poller_options)
1881        }
1882
1883        /// Sets the value of [name][crate::model::DeleteCustomClassRequest::name].
1884        ///
1885        /// This is a **required** field for requests.
1886        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1887            self.0.request.name = v.into();
1888            self
1889        }
1890
1891        /// Sets the value of [validate_only][crate::model::DeleteCustomClassRequest::validate_only].
1892        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1893            self.0.request.validate_only = v.into();
1894            self
1895        }
1896
1897        /// Sets the value of [allow_missing][crate::model::DeleteCustomClassRequest::allow_missing].
1898        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
1899            self.0.request.allow_missing = v.into();
1900            self
1901        }
1902
1903        /// Sets the value of [etag][crate::model::DeleteCustomClassRequest::etag].
1904        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1905            self.0.request.etag = v.into();
1906            self
1907        }
1908    }
1909
1910    #[doc(hidden)]
1911    impl crate::RequestBuilder for DeleteCustomClass {
1912        fn request_options(&mut self) -> &mut crate::RequestOptions {
1913            &mut self.0.options
1914        }
1915    }
1916
1917    /// The request builder for [Speech::undelete_custom_class][crate::client::Speech::undelete_custom_class] calls.
1918    ///
1919    /// # Example
1920    /// ```
1921    /// # use google_cloud_speech_v2::builder::speech::UndeleteCustomClass;
1922    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
1923    /// use google_cloud_lro::Poller;
1924    ///
1925    /// let builder = prepare_request_builder();
1926    /// let response = builder.poller().until_done().await?;
1927    /// # Ok(()) }
1928    ///
1929    /// fn prepare_request_builder() -> UndeleteCustomClass {
1930    ///   # panic!();
1931    ///   // ... details omitted ...
1932    /// }
1933    /// ```
1934    #[derive(Clone, Debug)]
1935    pub struct UndeleteCustomClass(RequestBuilder<crate::model::UndeleteCustomClassRequest>);
1936
1937    impl UndeleteCustomClass {
1938        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1939            Self(RequestBuilder::new(stub))
1940        }
1941
1942        /// Sets the full request, replacing any prior values.
1943        pub fn with_request<V: Into<crate::model::UndeleteCustomClassRequest>>(
1944            mut self,
1945            v: V,
1946        ) -> Self {
1947            self.0.request = v.into();
1948            self
1949        }
1950
1951        /// Sets all the options, replacing any prior values.
1952        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1953            self.0.options = v.into();
1954            self
1955        }
1956
1957        /// Sends the request.
1958        ///
1959        /// # Long running operations
1960        ///
1961        /// This starts, but does not poll, a longrunning operation. More information
1962        /// on [undelete_custom_class][crate::client::Speech::undelete_custom_class].
1963        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1964            (*self.0.stub)
1965                .undelete_custom_class(self.0.request, self.0.options)
1966                .await
1967                .map(crate::Response::into_body)
1968        }
1969
1970        /// Creates a [Poller][google_cloud_lro::Poller] to work with `undelete_custom_class`.
1971        pub fn poller(
1972            self,
1973        ) -> impl google_cloud_lro::Poller<crate::model::CustomClass, crate::model::OperationMetadata>
1974        {
1975            type Operation = google_cloud_lro::internal::Operation<
1976                crate::model::CustomClass,
1977                crate::model::OperationMetadata,
1978            >;
1979            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1980            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1981            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1982            if let Some(ref mut details) = poller_options.tracing {
1983                details.method_name =
1984                    "google_cloud_speech_v2::client::Speech::undelete_custom_class::until_done";
1985            }
1986
1987            let stub = self.0.stub.clone();
1988            let mut options = self.0.options.clone();
1989            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1990            let query = move |name| {
1991                let stub = stub.clone();
1992                let options = options.clone();
1993                async {
1994                    let op = GetOperation::new(stub)
1995                        .set_name(name)
1996                        .with_options(options)
1997                        .send()
1998                        .await?;
1999                    Ok(Operation::new(op))
2000                }
2001            };
2002
2003            let start = move || async {
2004                let op = self.send().await?;
2005                Ok(Operation::new(op))
2006            };
2007
2008            use google_cloud_lro::internal::PollerExt;
2009            {
2010                google_cloud_lro::internal::new_poller(
2011                    polling_error_policy,
2012                    polling_backoff_policy,
2013                    start,
2014                    query,
2015                )
2016            }
2017            .with_options(poller_options)
2018        }
2019
2020        /// Sets the value of [name][crate::model::UndeleteCustomClassRequest::name].
2021        ///
2022        /// This is a **required** field for requests.
2023        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2024            self.0.request.name = v.into();
2025            self
2026        }
2027
2028        /// Sets the value of [validate_only][crate::model::UndeleteCustomClassRequest::validate_only].
2029        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2030            self.0.request.validate_only = v.into();
2031            self
2032        }
2033
2034        /// Sets the value of [etag][crate::model::UndeleteCustomClassRequest::etag].
2035        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2036            self.0.request.etag = v.into();
2037            self
2038        }
2039    }
2040
2041    #[doc(hidden)]
2042    impl crate::RequestBuilder for UndeleteCustomClass {
2043        fn request_options(&mut self) -> &mut crate::RequestOptions {
2044            &mut self.0.options
2045        }
2046    }
2047
2048    /// The request builder for [Speech::create_phrase_set][crate::client::Speech::create_phrase_set] calls.
2049    ///
2050    /// # Example
2051    /// ```
2052    /// # use google_cloud_speech_v2::builder::speech::CreatePhraseSet;
2053    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
2054    /// use google_cloud_lro::Poller;
2055    ///
2056    /// let builder = prepare_request_builder();
2057    /// let response = builder.poller().until_done().await?;
2058    /// # Ok(()) }
2059    ///
2060    /// fn prepare_request_builder() -> CreatePhraseSet {
2061    ///   # panic!();
2062    ///   // ... details omitted ...
2063    /// }
2064    /// ```
2065    #[derive(Clone, Debug)]
2066    pub struct CreatePhraseSet(RequestBuilder<crate::model::CreatePhraseSetRequest>);
2067
2068    impl CreatePhraseSet {
2069        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2070            Self(RequestBuilder::new(stub))
2071        }
2072
2073        /// Sets the full request, replacing any prior values.
2074        pub fn with_request<V: Into<crate::model::CreatePhraseSetRequest>>(mut self, v: V) -> Self {
2075            self.0.request = v.into();
2076            self
2077        }
2078
2079        /// Sets all the options, replacing any prior values.
2080        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2081            self.0.options = v.into();
2082            self
2083        }
2084
2085        /// Sends the request.
2086        ///
2087        /// # Long running operations
2088        ///
2089        /// This starts, but does not poll, a longrunning operation. More information
2090        /// on [create_phrase_set][crate::client::Speech::create_phrase_set].
2091        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2092            (*self.0.stub)
2093                .create_phrase_set(self.0.request, self.0.options)
2094                .await
2095                .map(crate::Response::into_body)
2096        }
2097
2098        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_phrase_set`.
2099        pub fn poller(
2100            self,
2101        ) -> impl google_cloud_lro::Poller<crate::model::PhraseSet, crate::model::OperationMetadata>
2102        {
2103            type Operation = google_cloud_lro::internal::Operation<
2104                crate::model::PhraseSet,
2105                crate::model::OperationMetadata,
2106            >;
2107            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2108            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2109            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2110            if let Some(ref mut details) = poller_options.tracing {
2111                details.method_name =
2112                    "google_cloud_speech_v2::client::Speech::create_phrase_set::until_done";
2113            }
2114
2115            let stub = self.0.stub.clone();
2116            let mut options = self.0.options.clone();
2117            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2118            let query = move |name| {
2119                let stub = stub.clone();
2120                let options = options.clone();
2121                async {
2122                    let op = GetOperation::new(stub)
2123                        .set_name(name)
2124                        .with_options(options)
2125                        .send()
2126                        .await?;
2127                    Ok(Operation::new(op))
2128                }
2129            };
2130
2131            let start = move || async {
2132                let op = self.send().await?;
2133                Ok(Operation::new(op))
2134            };
2135
2136            use google_cloud_lro::internal::PollerExt;
2137            {
2138                google_cloud_lro::internal::new_poller(
2139                    polling_error_policy,
2140                    polling_backoff_policy,
2141                    start,
2142                    query,
2143                )
2144            }
2145            .with_options(poller_options)
2146        }
2147
2148        /// Sets the value of [phrase_set][crate::model::CreatePhraseSetRequest::phrase_set].
2149        ///
2150        /// This is a **required** field for requests.
2151        pub fn set_phrase_set<T>(mut self, v: T) -> Self
2152        where
2153            T: std::convert::Into<crate::model::PhraseSet>,
2154        {
2155            self.0.request.phrase_set = std::option::Option::Some(v.into());
2156            self
2157        }
2158
2159        /// Sets or clears the value of [phrase_set][crate::model::CreatePhraseSetRequest::phrase_set].
2160        ///
2161        /// This is a **required** field for requests.
2162        pub fn set_or_clear_phrase_set<T>(mut self, v: std::option::Option<T>) -> Self
2163        where
2164            T: std::convert::Into<crate::model::PhraseSet>,
2165        {
2166            self.0.request.phrase_set = v.map(|x| x.into());
2167            self
2168        }
2169
2170        /// Sets the value of [validate_only][crate::model::CreatePhraseSetRequest::validate_only].
2171        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2172            self.0.request.validate_only = v.into();
2173            self
2174        }
2175
2176        /// Sets the value of [phrase_set_id][crate::model::CreatePhraseSetRequest::phrase_set_id].
2177        pub fn set_phrase_set_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2178            self.0.request.phrase_set_id = v.into();
2179            self
2180        }
2181
2182        /// Sets the value of [parent][crate::model::CreatePhraseSetRequest::parent].
2183        ///
2184        /// This is a **required** field for requests.
2185        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2186            self.0.request.parent = v.into();
2187            self
2188        }
2189    }
2190
2191    #[doc(hidden)]
2192    impl crate::RequestBuilder for CreatePhraseSet {
2193        fn request_options(&mut self) -> &mut crate::RequestOptions {
2194            &mut self.0.options
2195        }
2196    }
2197
2198    /// The request builder for [Speech::list_phrase_sets][crate::client::Speech::list_phrase_sets] calls.
2199    ///
2200    /// # Example
2201    /// ```
2202    /// # use google_cloud_speech_v2::builder::speech::ListPhraseSets;
2203    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
2204    /// use google_cloud_gax::paginator::ItemPaginator;
2205    ///
2206    /// let builder = prepare_request_builder();
2207    /// let mut items = builder.by_item();
2208    /// while let Some(result) = items.next().await {
2209    ///   let item = result?;
2210    /// }
2211    /// # Ok(()) }
2212    ///
2213    /// fn prepare_request_builder() -> ListPhraseSets {
2214    ///   # panic!();
2215    ///   // ... details omitted ...
2216    /// }
2217    /// ```
2218    #[derive(Clone, Debug)]
2219    pub struct ListPhraseSets(RequestBuilder<crate::model::ListPhraseSetsRequest>);
2220
2221    impl ListPhraseSets {
2222        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2223            Self(RequestBuilder::new(stub))
2224        }
2225
2226        /// Sets the full request, replacing any prior values.
2227        pub fn with_request<V: Into<crate::model::ListPhraseSetsRequest>>(mut self, v: V) -> Self {
2228            self.0.request = v.into();
2229            self
2230        }
2231
2232        /// Sets all the options, replacing any prior values.
2233        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2234            self.0.options = v.into();
2235            self
2236        }
2237
2238        /// Sends the request.
2239        pub async fn send(self) -> Result<crate::model::ListPhraseSetsResponse> {
2240            (*self.0.stub)
2241                .list_phrase_sets(self.0.request, self.0.options)
2242                .await
2243                .map(crate::Response::into_body)
2244        }
2245
2246        /// Streams each page in the collection.
2247        pub fn by_page(
2248            self,
2249        ) -> impl google_cloud_gax::paginator::Paginator<
2250            crate::model::ListPhraseSetsResponse,
2251            crate::Error,
2252        > {
2253            use std::clone::Clone;
2254            let token = self.0.request.page_token.clone();
2255            let execute = move |token: String| {
2256                let mut builder = self.clone();
2257                builder.0.request = builder.0.request.set_page_token(token);
2258                builder.send()
2259            };
2260            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2261        }
2262
2263        /// Streams each item in the collection.
2264        pub fn by_item(
2265            self,
2266        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2267            crate::model::ListPhraseSetsResponse,
2268            crate::Error,
2269        > {
2270            use google_cloud_gax::paginator::Paginator;
2271            self.by_page().items()
2272        }
2273
2274        /// Sets the value of [parent][crate::model::ListPhraseSetsRequest::parent].
2275        ///
2276        /// This is a **required** field for requests.
2277        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2278            self.0.request.parent = v.into();
2279            self
2280        }
2281
2282        /// Sets the value of [page_size][crate::model::ListPhraseSetsRequest::page_size].
2283        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2284            self.0.request.page_size = v.into();
2285            self
2286        }
2287
2288        /// Sets the value of [page_token][crate::model::ListPhraseSetsRequest::page_token].
2289        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2290            self.0.request.page_token = v.into();
2291            self
2292        }
2293
2294        /// Sets the value of [show_deleted][crate::model::ListPhraseSetsRequest::show_deleted].
2295        pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2296            self.0.request.show_deleted = v.into();
2297            self
2298        }
2299    }
2300
2301    #[doc(hidden)]
2302    impl crate::RequestBuilder for ListPhraseSets {
2303        fn request_options(&mut self) -> &mut crate::RequestOptions {
2304            &mut self.0.options
2305        }
2306    }
2307
2308    /// The request builder for [Speech::get_phrase_set][crate::client::Speech::get_phrase_set] calls.
2309    ///
2310    /// # Example
2311    /// ```
2312    /// # use google_cloud_speech_v2::builder::speech::GetPhraseSet;
2313    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
2314    ///
2315    /// let builder = prepare_request_builder();
2316    /// let response = builder.send().await?;
2317    /// # Ok(()) }
2318    ///
2319    /// fn prepare_request_builder() -> GetPhraseSet {
2320    ///   # panic!();
2321    ///   // ... details omitted ...
2322    /// }
2323    /// ```
2324    #[derive(Clone, Debug)]
2325    pub struct GetPhraseSet(RequestBuilder<crate::model::GetPhraseSetRequest>);
2326
2327    impl GetPhraseSet {
2328        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2329            Self(RequestBuilder::new(stub))
2330        }
2331
2332        /// Sets the full request, replacing any prior values.
2333        pub fn with_request<V: Into<crate::model::GetPhraseSetRequest>>(mut self, v: V) -> Self {
2334            self.0.request = v.into();
2335            self
2336        }
2337
2338        /// Sets all the options, replacing any prior values.
2339        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2340            self.0.options = v.into();
2341            self
2342        }
2343
2344        /// Sends the request.
2345        pub async fn send(self) -> Result<crate::model::PhraseSet> {
2346            (*self.0.stub)
2347                .get_phrase_set(self.0.request, self.0.options)
2348                .await
2349                .map(crate::Response::into_body)
2350        }
2351
2352        /// Sets the value of [name][crate::model::GetPhraseSetRequest::name].
2353        ///
2354        /// This is a **required** field for requests.
2355        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2356            self.0.request.name = v.into();
2357            self
2358        }
2359    }
2360
2361    #[doc(hidden)]
2362    impl crate::RequestBuilder for GetPhraseSet {
2363        fn request_options(&mut self) -> &mut crate::RequestOptions {
2364            &mut self.0.options
2365        }
2366    }
2367
2368    /// The request builder for [Speech::update_phrase_set][crate::client::Speech::update_phrase_set] calls.
2369    ///
2370    /// # Example
2371    /// ```
2372    /// # use google_cloud_speech_v2::builder::speech::UpdatePhraseSet;
2373    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
2374    /// use google_cloud_lro::Poller;
2375    ///
2376    /// let builder = prepare_request_builder();
2377    /// let response = builder.poller().until_done().await?;
2378    /// # Ok(()) }
2379    ///
2380    /// fn prepare_request_builder() -> UpdatePhraseSet {
2381    ///   # panic!();
2382    ///   // ... details omitted ...
2383    /// }
2384    /// ```
2385    #[derive(Clone, Debug)]
2386    pub struct UpdatePhraseSet(RequestBuilder<crate::model::UpdatePhraseSetRequest>);
2387
2388    impl UpdatePhraseSet {
2389        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2390            Self(RequestBuilder::new(stub))
2391        }
2392
2393        /// Sets the full request, replacing any prior values.
2394        pub fn with_request<V: Into<crate::model::UpdatePhraseSetRequest>>(mut self, v: V) -> Self {
2395            self.0.request = v.into();
2396            self
2397        }
2398
2399        /// Sets all the options, replacing any prior values.
2400        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2401            self.0.options = v.into();
2402            self
2403        }
2404
2405        /// Sends the request.
2406        ///
2407        /// # Long running operations
2408        ///
2409        /// This starts, but does not poll, a longrunning operation. More information
2410        /// on [update_phrase_set][crate::client::Speech::update_phrase_set].
2411        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2412            (*self.0.stub)
2413                .update_phrase_set(self.0.request, self.0.options)
2414                .await
2415                .map(crate::Response::into_body)
2416        }
2417
2418        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_phrase_set`.
2419        pub fn poller(
2420            self,
2421        ) -> impl google_cloud_lro::Poller<crate::model::PhraseSet, crate::model::OperationMetadata>
2422        {
2423            type Operation = google_cloud_lro::internal::Operation<
2424                crate::model::PhraseSet,
2425                crate::model::OperationMetadata,
2426            >;
2427            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2428            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2429            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2430            if let Some(ref mut details) = poller_options.tracing {
2431                details.method_name =
2432                    "google_cloud_speech_v2::client::Speech::update_phrase_set::until_done";
2433            }
2434
2435            let stub = self.0.stub.clone();
2436            let mut options = self.0.options.clone();
2437            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2438            let query = move |name| {
2439                let stub = stub.clone();
2440                let options = options.clone();
2441                async {
2442                    let op = GetOperation::new(stub)
2443                        .set_name(name)
2444                        .with_options(options)
2445                        .send()
2446                        .await?;
2447                    Ok(Operation::new(op))
2448                }
2449            };
2450
2451            let start = move || async {
2452                let op = self.send().await?;
2453                Ok(Operation::new(op))
2454            };
2455
2456            use google_cloud_lro::internal::PollerExt;
2457            {
2458                google_cloud_lro::internal::new_poller(
2459                    polling_error_policy,
2460                    polling_backoff_policy,
2461                    start,
2462                    query,
2463                )
2464            }
2465            .with_options(poller_options)
2466        }
2467
2468        /// Sets the value of [phrase_set][crate::model::UpdatePhraseSetRequest::phrase_set].
2469        ///
2470        /// This is a **required** field for requests.
2471        pub fn set_phrase_set<T>(mut self, v: T) -> Self
2472        where
2473            T: std::convert::Into<crate::model::PhraseSet>,
2474        {
2475            self.0.request.phrase_set = std::option::Option::Some(v.into());
2476            self
2477        }
2478
2479        /// Sets or clears the value of [phrase_set][crate::model::UpdatePhraseSetRequest::phrase_set].
2480        ///
2481        /// This is a **required** field for requests.
2482        pub fn set_or_clear_phrase_set<T>(mut self, v: std::option::Option<T>) -> Self
2483        where
2484            T: std::convert::Into<crate::model::PhraseSet>,
2485        {
2486            self.0.request.phrase_set = v.map(|x| x.into());
2487            self
2488        }
2489
2490        /// Sets the value of [update_mask][crate::model::UpdatePhraseSetRequest::update_mask].
2491        pub fn set_update_mask<T>(mut self, v: T) -> Self
2492        where
2493            T: std::convert::Into<wkt::FieldMask>,
2494        {
2495            self.0.request.update_mask = std::option::Option::Some(v.into());
2496            self
2497        }
2498
2499        /// Sets or clears the value of [update_mask][crate::model::UpdatePhraseSetRequest::update_mask].
2500        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2501        where
2502            T: std::convert::Into<wkt::FieldMask>,
2503        {
2504            self.0.request.update_mask = v.map(|x| x.into());
2505            self
2506        }
2507
2508        /// Sets the value of [validate_only][crate::model::UpdatePhraseSetRequest::validate_only].
2509        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2510            self.0.request.validate_only = v.into();
2511            self
2512        }
2513    }
2514
2515    #[doc(hidden)]
2516    impl crate::RequestBuilder for UpdatePhraseSet {
2517        fn request_options(&mut self) -> &mut crate::RequestOptions {
2518            &mut self.0.options
2519        }
2520    }
2521
2522    /// The request builder for [Speech::delete_phrase_set][crate::client::Speech::delete_phrase_set] calls.
2523    ///
2524    /// # Example
2525    /// ```
2526    /// # use google_cloud_speech_v2::builder::speech::DeletePhraseSet;
2527    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
2528    /// use google_cloud_lro::Poller;
2529    ///
2530    /// let builder = prepare_request_builder();
2531    /// let response = builder.poller().until_done().await?;
2532    /// # Ok(()) }
2533    ///
2534    /// fn prepare_request_builder() -> DeletePhraseSet {
2535    ///   # panic!();
2536    ///   // ... details omitted ...
2537    /// }
2538    /// ```
2539    #[derive(Clone, Debug)]
2540    pub struct DeletePhraseSet(RequestBuilder<crate::model::DeletePhraseSetRequest>);
2541
2542    impl DeletePhraseSet {
2543        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2544            Self(RequestBuilder::new(stub))
2545        }
2546
2547        /// Sets the full request, replacing any prior values.
2548        pub fn with_request<V: Into<crate::model::DeletePhraseSetRequest>>(mut self, v: V) -> Self {
2549            self.0.request = v.into();
2550            self
2551        }
2552
2553        /// Sets all the options, replacing any prior values.
2554        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2555            self.0.options = v.into();
2556            self
2557        }
2558
2559        /// Sends the request.
2560        ///
2561        /// # Long running operations
2562        ///
2563        /// This starts, but does not poll, a longrunning operation. More information
2564        /// on [delete_phrase_set][crate::client::Speech::delete_phrase_set].
2565        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2566            (*self.0.stub)
2567                .delete_phrase_set(self.0.request, self.0.options)
2568                .await
2569                .map(crate::Response::into_body)
2570        }
2571
2572        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_phrase_set`.
2573        pub fn poller(
2574            self,
2575        ) -> impl google_cloud_lro::Poller<crate::model::PhraseSet, crate::model::OperationMetadata>
2576        {
2577            type Operation = google_cloud_lro::internal::Operation<
2578                crate::model::PhraseSet,
2579                crate::model::OperationMetadata,
2580            >;
2581            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2582            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2583            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2584            if let Some(ref mut details) = poller_options.tracing {
2585                details.method_name =
2586                    "google_cloud_speech_v2::client::Speech::delete_phrase_set::until_done";
2587            }
2588
2589            let stub = self.0.stub.clone();
2590            let mut options = self.0.options.clone();
2591            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2592            let query = move |name| {
2593                let stub = stub.clone();
2594                let options = options.clone();
2595                async {
2596                    let op = GetOperation::new(stub)
2597                        .set_name(name)
2598                        .with_options(options)
2599                        .send()
2600                        .await?;
2601                    Ok(Operation::new(op))
2602                }
2603            };
2604
2605            let start = move || async {
2606                let op = self.send().await?;
2607                Ok(Operation::new(op))
2608            };
2609
2610            use google_cloud_lro::internal::PollerExt;
2611            {
2612                google_cloud_lro::internal::new_poller(
2613                    polling_error_policy,
2614                    polling_backoff_policy,
2615                    start,
2616                    query,
2617                )
2618            }
2619            .with_options(poller_options)
2620        }
2621
2622        /// Sets the value of [name][crate::model::DeletePhraseSetRequest::name].
2623        ///
2624        /// This is a **required** field for requests.
2625        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2626            self.0.request.name = v.into();
2627            self
2628        }
2629
2630        /// Sets the value of [validate_only][crate::model::DeletePhraseSetRequest::validate_only].
2631        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2632            self.0.request.validate_only = v.into();
2633            self
2634        }
2635
2636        /// Sets the value of [allow_missing][crate::model::DeletePhraseSetRequest::allow_missing].
2637        pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
2638            self.0.request.allow_missing = v.into();
2639            self
2640        }
2641
2642        /// Sets the value of [etag][crate::model::DeletePhraseSetRequest::etag].
2643        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2644            self.0.request.etag = v.into();
2645            self
2646        }
2647    }
2648
2649    #[doc(hidden)]
2650    impl crate::RequestBuilder for DeletePhraseSet {
2651        fn request_options(&mut self) -> &mut crate::RequestOptions {
2652            &mut self.0.options
2653        }
2654    }
2655
2656    /// The request builder for [Speech::undelete_phrase_set][crate::client::Speech::undelete_phrase_set] calls.
2657    ///
2658    /// # Example
2659    /// ```
2660    /// # use google_cloud_speech_v2::builder::speech::UndeletePhraseSet;
2661    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
2662    /// use google_cloud_lro::Poller;
2663    ///
2664    /// let builder = prepare_request_builder();
2665    /// let response = builder.poller().until_done().await?;
2666    /// # Ok(()) }
2667    ///
2668    /// fn prepare_request_builder() -> UndeletePhraseSet {
2669    ///   # panic!();
2670    ///   // ... details omitted ...
2671    /// }
2672    /// ```
2673    #[derive(Clone, Debug)]
2674    pub struct UndeletePhraseSet(RequestBuilder<crate::model::UndeletePhraseSetRequest>);
2675
2676    impl UndeletePhraseSet {
2677        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2678            Self(RequestBuilder::new(stub))
2679        }
2680
2681        /// Sets the full request, replacing any prior values.
2682        pub fn with_request<V: Into<crate::model::UndeletePhraseSetRequest>>(
2683            mut self,
2684            v: V,
2685        ) -> Self {
2686            self.0.request = v.into();
2687            self
2688        }
2689
2690        /// Sets all the options, replacing any prior values.
2691        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2692            self.0.options = v.into();
2693            self
2694        }
2695
2696        /// Sends the request.
2697        ///
2698        /// # Long running operations
2699        ///
2700        /// This starts, but does not poll, a longrunning operation. More information
2701        /// on [undelete_phrase_set][crate::client::Speech::undelete_phrase_set].
2702        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2703            (*self.0.stub)
2704                .undelete_phrase_set(self.0.request, self.0.options)
2705                .await
2706                .map(crate::Response::into_body)
2707        }
2708
2709        /// Creates a [Poller][google_cloud_lro::Poller] to work with `undelete_phrase_set`.
2710        pub fn poller(
2711            self,
2712        ) -> impl google_cloud_lro::Poller<crate::model::PhraseSet, crate::model::OperationMetadata>
2713        {
2714            type Operation = google_cloud_lro::internal::Operation<
2715                crate::model::PhraseSet,
2716                crate::model::OperationMetadata,
2717            >;
2718            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2719            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2720            let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2721            if let Some(ref mut details) = poller_options.tracing {
2722                details.method_name =
2723                    "google_cloud_speech_v2::client::Speech::undelete_phrase_set::until_done";
2724            }
2725
2726            let stub = self.0.stub.clone();
2727            let mut options = self.0.options.clone();
2728            options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2729            let query = move |name| {
2730                let stub = stub.clone();
2731                let options = options.clone();
2732                async {
2733                    let op = GetOperation::new(stub)
2734                        .set_name(name)
2735                        .with_options(options)
2736                        .send()
2737                        .await?;
2738                    Ok(Operation::new(op))
2739                }
2740            };
2741
2742            let start = move || async {
2743                let op = self.send().await?;
2744                Ok(Operation::new(op))
2745            };
2746
2747            use google_cloud_lro::internal::PollerExt;
2748            {
2749                google_cloud_lro::internal::new_poller(
2750                    polling_error_policy,
2751                    polling_backoff_policy,
2752                    start,
2753                    query,
2754                )
2755            }
2756            .with_options(poller_options)
2757        }
2758
2759        /// Sets the value of [name][crate::model::UndeletePhraseSetRequest::name].
2760        ///
2761        /// This is a **required** field for requests.
2762        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2763            self.0.request.name = v.into();
2764            self
2765        }
2766
2767        /// Sets the value of [validate_only][crate::model::UndeletePhraseSetRequest::validate_only].
2768        pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2769            self.0.request.validate_only = v.into();
2770            self
2771        }
2772
2773        /// Sets the value of [etag][crate::model::UndeletePhraseSetRequest::etag].
2774        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2775            self.0.request.etag = v.into();
2776            self
2777        }
2778    }
2779
2780    #[doc(hidden)]
2781    impl crate::RequestBuilder for UndeletePhraseSet {
2782        fn request_options(&mut self) -> &mut crate::RequestOptions {
2783            &mut self.0.options
2784        }
2785    }
2786
2787    /// The request builder for [Speech::list_locations][crate::client::Speech::list_locations] calls.
2788    ///
2789    /// # Example
2790    /// ```
2791    /// # use google_cloud_speech_v2::builder::speech::ListLocations;
2792    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
2793    /// use google_cloud_gax::paginator::ItemPaginator;
2794    ///
2795    /// let builder = prepare_request_builder();
2796    /// let mut items = builder.by_item();
2797    /// while let Some(result) = items.next().await {
2798    ///   let item = result?;
2799    /// }
2800    /// # Ok(()) }
2801    ///
2802    /// fn prepare_request_builder() -> ListLocations {
2803    ///   # panic!();
2804    ///   // ... details omitted ...
2805    /// }
2806    /// ```
2807    #[derive(Clone, Debug)]
2808    pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
2809
2810    impl ListLocations {
2811        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2812            Self(RequestBuilder::new(stub))
2813        }
2814
2815        /// Sets the full request, replacing any prior values.
2816        pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
2817            mut self,
2818            v: V,
2819        ) -> Self {
2820            self.0.request = v.into();
2821            self
2822        }
2823
2824        /// Sets all the options, replacing any prior values.
2825        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2826            self.0.options = v.into();
2827            self
2828        }
2829
2830        /// Sends the request.
2831        pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
2832            (*self.0.stub)
2833                .list_locations(self.0.request, self.0.options)
2834                .await
2835                .map(crate::Response::into_body)
2836        }
2837
2838        /// Streams each page in the collection.
2839        pub fn by_page(
2840            self,
2841        ) -> impl google_cloud_gax::paginator::Paginator<
2842            google_cloud_location::model::ListLocationsResponse,
2843            crate::Error,
2844        > {
2845            use std::clone::Clone;
2846            let token = self.0.request.page_token.clone();
2847            let execute = move |token: String| {
2848                let mut builder = self.clone();
2849                builder.0.request = builder.0.request.set_page_token(token);
2850                builder.send()
2851            };
2852            google_cloud_gax::paginator::internal::new_paginator(token, execute)
2853        }
2854
2855        /// Streams each item in the collection.
2856        pub fn by_item(
2857            self,
2858        ) -> impl google_cloud_gax::paginator::ItemPaginator<
2859            google_cloud_location::model::ListLocationsResponse,
2860            crate::Error,
2861        > {
2862            use google_cloud_gax::paginator::Paginator;
2863            self.by_page().items()
2864        }
2865
2866        /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
2867        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2868            self.0.request.name = v.into();
2869            self
2870        }
2871
2872        /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
2873        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2874            self.0.request.filter = v.into();
2875            self
2876        }
2877
2878        /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
2879        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2880            self.0.request.page_size = v.into();
2881            self
2882        }
2883
2884        /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
2885        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2886            self.0.request.page_token = v.into();
2887            self
2888        }
2889    }
2890
2891    #[doc(hidden)]
2892    impl crate::RequestBuilder for ListLocations {
2893        fn request_options(&mut self) -> &mut crate::RequestOptions {
2894            &mut self.0.options
2895        }
2896    }
2897
2898    /// The request builder for [Speech::get_location][crate::client::Speech::get_location] calls.
2899    ///
2900    /// # Example
2901    /// ```
2902    /// # use google_cloud_speech_v2::builder::speech::GetLocation;
2903    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
2904    ///
2905    /// let builder = prepare_request_builder();
2906    /// let response = builder.send().await?;
2907    /// # Ok(()) }
2908    ///
2909    /// fn prepare_request_builder() -> GetLocation {
2910    ///   # panic!();
2911    ///   // ... details omitted ...
2912    /// }
2913    /// ```
2914    #[derive(Clone, Debug)]
2915    pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
2916
2917    impl GetLocation {
2918        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2919            Self(RequestBuilder::new(stub))
2920        }
2921
2922        /// Sets the full request, replacing any prior values.
2923        pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
2924            mut self,
2925            v: V,
2926        ) -> Self {
2927            self.0.request = v.into();
2928            self
2929        }
2930
2931        /// Sets all the options, replacing any prior values.
2932        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2933            self.0.options = v.into();
2934            self
2935        }
2936
2937        /// Sends the request.
2938        pub async fn send(self) -> Result<google_cloud_location::model::Location> {
2939            (*self.0.stub)
2940                .get_location(self.0.request, self.0.options)
2941                .await
2942                .map(crate::Response::into_body)
2943        }
2944
2945        /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
2946        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2947            self.0.request.name = v.into();
2948            self
2949        }
2950    }
2951
2952    #[doc(hidden)]
2953    impl crate::RequestBuilder for GetLocation {
2954        fn request_options(&mut self) -> &mut crate::RequestOptions {
2955            &mut self.0.options
2956        }
2957    }
2958
2959    /// The request builder for [Speech::list_operations][crate::client::Speech::list_operations] calls.
2960    ///
2961    /// # Example
2962    /// ```
2963    /// # use google_cloud_speech_v2::builder::speech::ListOperations;
2964    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
2965    /// use google_cloud_gax::paginator::ItemPaginator;
2966    ///
2967    /// let builder = prepare_request_builder();
2968    /// let mut items = builder.by_item();
2969    /// while let Some(result) = items.next().await {
2970    ///   let item = result?;
2971    /// }
2972    /// # Ok(()) }
2973    ///
2974    /// fn prepare_request_builder() -> ListOperations {
2975    ///   # panic!();
2976    ///   // ... details omitted ...
2977    /// }
2978    /// ```
2979    #[derive(Clone, Debug)]
2980    pub struct ListOperations(
2981        RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2982    );
2983
2984    impl ListOperations {
2985        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2986            Self(RequestBuilder::new(stub))
2987        }
2988
2989        /// Sets the full request, replacing any prior values.
2990        pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2991            mut self,
2992            v: V,
2993        ) -> Self {
2994            self.0.request = v.into();
2995            self
2996        }
2997
2998        /// Sets all the options, replacing any prior values.
2999        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3000            self.0.options = v.into();
3001            self
3002        }
3003
3004        /// Sends the request.
3005        pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
3006            (*self.0.stub)
3007                .list_operations(self.0.request, self.0.options)
3008                .await
3009                .map(crate::Response::into_body)
3010        }
3011
3012        /// Streams each page in the collection.
3013        pub fn by_page(
3014            self,
3015        ) -> impl google_cloud_gax::paginator::Paginator<
3016            google_cloud_longrunning::model::ListOperationsResponse,
3017            crate::Error,
3018        > {
3019            use std::clone::Clone;
3020            let token = self.0.request.page_token.clone();
3021            let execute = move |token: String| {
3022                let mut builder = self.clone();
3023                builder.0.request = builder.0.request.set_page_token(token);
3024                builder.send()
3025            };
3026            google_cloud_gax::paginator::internal::new_paginator(token, execute)
3027        }
3028
3029        /// Streams each item in the collection.
3030        pub fn by_item(
3031            self,
3032        ) -> impl google_cloud_gax::paginator::ItemPaginator<
3033            google_cloud_longrunning::model::ListOperationsResponse,
3034            crate::Error,
3035        > {
3036            use google_cloud_gax::paginator::Paginator;
3037            self.by_page().items()
3038        }
3039
3040        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
3041        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3042            self.0.request.name = v.into();
3043            self
3044        }
3045
3046        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
3047        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3048            self.0.request.filter = v.into();
3049            self
3050        }
3051
3052        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
3053        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3054            self.0.request.page_size = v.into();
3055            self
3056        }
3057
3058        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
3059        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3060            self.0.request.page_token = v.into();
3061            self
3062        }
3063
3064        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
3065        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3066            self.0.request.return_partial_success = v.into();
3067            self
3068        }
3069    }
3070
3071    #[doc(hidden)]
3072    impl crate::RequestBuilder for ListOperations {
3073        fn request_options(&mut self) -> &mut crate::RequestOptions {
3074            &mut self.0.options
3075        }
3076    }
3077
3078    /// The request builder for [Speech::get_operation][crate::client::Speech::get_operation] calls.
3079    ///
3080    /// # Example
3081    /// ```
3082    /// # use google_cloud_speech_v2::builder::speech::GetOperation;
3083    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
3084    ///
3085    /// let builder = prepare_request_builder();
3086    /// let response = builder.send().await?;
3087    /// # Ok(()) }
3088    ///
3089    /// fn prepare_request_builder() -> GetOperation {
3090    ///   # panic!();
3091    ///   // ... details omitted ...
3092    /// }
3093    /// ```
3094    #[derive(Clone, Debug)]
3095    pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3096
3097    impl GetOperation {
3098        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
3099            Self(RequestBuilder::new(stub))
3100        }
3101
3102        /// Sets the full request, replacing any prior values.
3103        pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3104            mut self,
3105            v: V,
3106        ) -> Self {
3107            self.0.request = v.into();
3108            self
3109        }
3110
3111        /// Sets all the options, replacing any prior values.
3112        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3113            self.0.options = v.into();
3114            self
3115        }
3116
3117        /// Sends the request.
3118        pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3119            (*self.0.stub)
3120                .get_operation(self.0.request, self.0.options)
3121                .await
3122                .map(crate::Response::into_body)
3123        }
3124
3125        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
3126        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3127            self.0.request.name = v.into();
3128            self
3129        }
3130    }
3131
3132    #[doc(hidden)]
3133    impl crate::RequestBuilder for GetOperation {
3134        fn request_options(&mut self) -> &mut crate::RequestOptions {
3135            &mut self.0.options
3136        }
3137    }
3138
3139    /// The request builder for [Speech::delete_operation][crate::client::Speech::delete_operation] calls.
3140    ///
3141    /// # Example
3142    /// ```
3143    /// # use google_cloud_speech_v2::builder::speech::DeleteOperation;
3144    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
3145    ///
3146    /// let builder = prepare_request_builder();
3147    /// let response = builder.send().await?;
3148    /// # Ok(()) }
3149    ///
3150    /// fn prepare_request_builder() -> DeleteOperation {
3151    ///   # panic!();
3152    ///   // ... details omitted ...
3153    /// }
3154    /// ```
3155    #[derive(Clone, Debug)]
3156    pub struct DeleteOperation(
3157        RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
3158    );
3159
3160    impl DeleteOperation {
3161        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
3162            Self(RequestBuilder::new(stub))
3163        }
3164
3165        /// Sets the full request, replacing any prior values.
3166        pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
3167            mut self,
3168            v: V,
3169        ) -> Self {
3170            self.0.request = v.into();
3171            self
3172        }
3173
3174        /// Sets all the options, replacing any prior values.
3175        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3176            self.0.options = v.into();
3177            self
3178        }
3179
3180        /// Sends the request.
3181        pub async fn send(self) -> Result<()> {
3182            (*self.0.stub)
3183                .delete_operation(self.0.request, self.0.options)
3184                .await
3185                .map(crate::Response::into_body)
3186        }
3187
3188        /// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
3189        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3190            self.0.request.name = v.into();
3191            self
3192        }
3193    }
3194
3195    #[doc(hidden)]
3196    impl crate::RequestBuilder for DeleteOperation {
3197        fn request_options(&mut self) -> &mut crate::RequestOptions {
3198            &mut self.0.options
3199        }
3200    }
3201
3202    /// The request builder for [Speech::cancel_operation][crate::client::Speech::cancel_operation] calls.
3203    ///
3204    /// # Example
3205    /// ```
3206    /// # use google_cloud_speech_v2::builder::speech::CancelOperation;
3207    /// # async fn sample() -> google_cloud_speech_v2::Result<()> {
3208    ///
3209    /// let builder = prepare_request_builder();
3210    /// let response = builder.send().await?;
3211    /// # Ok(()) }
3212    ///
3213    /// fn prepare_request_builder() -> CancelOperation {
3214    ///   # panic!();
3215    ///   // ... details omitted ...
3216    /// }
3217    /// ```
3218    #[derive(Clone, Debug)]
3219    pub struct CancelOperation(
3220        RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
3221    );
3222
3223    impl CancelOperation {
3224        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
3225            Self(RequestBuilder::new(stub))
3226        }
3227
3228        /// Sets the full request, replacing any prior values.
3229        pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
3230            mut self,
3231            v: V,
3232        ) -> Self {
3233            self.0.request = v.into();
3234            self
3235        }
3236
3237        /// Sets all the options, replacing any prior values.
3238        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3239            self.0.options = v.into();
3240            self
3241        }
3242
3243        /// Sends the request.
3244        pub async fn send(self) -> Result<()> {
3245            (*self.0.stub)
3246                .cancel_operation(self.0.request, self.0.options)
3247                .await
3248                .map(crate::Response::into_body)
3249        }
3250
3251        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
3252        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3253            self.0.request.name = v.into();
3254            self
3255        }
3256    }
3257
3258    #[doc(hidden)]
3259    impl crate::RequestBuilder for CancelOperation {
3260        fn request_options(&mut self) -> &mut crate::RequestOptions {
3261            &mut self.0.options
3262        }
3263    }
3264}