Skip to main content

google_cloud_speech_v2/
builder.rs

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