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