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