1pub mod speech {
19 use crate::Result;
20
21 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::Speech;
38 pub struct Factory;
39 impl crate::ClientFactory for Factory {
40 type Client = Speech;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> crate::ClientBuilderResult<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>,
55 request: R,
56 options: crate::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
64 Self {
65 stub,
66 request: R::default(),
67 options: crate::RequestOptions::default(),
68 }
69 }
70 }
71
72 #[derive(Clone, Debug)]
90 pub struct CreateRecognizer(RequestBuilder<crate::model::CreateRecognizerRequest>);
91
92 impl CreateRecognizer {
93 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
94 Self(RequestBuilder::new(stub))
95 }
96
97 pub fn with_request<V: Into<crate::model::CreateRecognizerRequest>>(
99 mut self,
100 v: V,
101 ) -> Self {
102 self.0.request = v.into();
103 self
104 }
105
106 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
108 self.0.options = v.into();
109 self
110 }
111
112 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
119 (*self.0.stub)
120 .create_recognizer(self.0.request, self.0.options)
121 .await
122 .map(crate::Response::into_body)
123 }
124
125 pub fn poller(
127 self,
128 ) -> impl google_cloud_lro::Poller<crate::model::Recognizer, crate::model::OperationMetadata>
129 {
130 type Operation = google_cloud_lro::internal::Operation<
131 crate::model::Recognizer,
132 crate::model::OperationMetadata,
133 >;
134 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
135 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
136 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
137 if let Some(ref mut details) = poller_options.tracing {
138 details.method_name =
139 "google_cloud_speech_v2::client::Speech::create_recognizer::until_done";
140 }
141
142 let stub = self.0.stub.clone();
143 let mut options = self.0.options.clone();
144 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
145 let query = move |name| {
146 let stub = stub.clone();
147 let options = options.clone();
148 async {
149 let op = GetOperation::new(stub)
150 .set_name(name)
151 .with_options(options)
152 .send()
153 .await?;
154 Ok(Operation::new(op))
155 }
156 };
157
158 let start = move || async {
159 let op = self.send().await?;
160 Ok(Operation::new(op))
161 };
162
163 use google_cloud_lro::internal::PollerExt;
164 {
165 google_cloud_lro::internal::new_poller(
166 polling_error_policy,
167 polling_backoff_policy,
168 start,
169 query,
170 )
171 }
172 .with_options(poller_options)
173 }
174
175 pub fn set_recognizer<T>(mut self, v: T) -> Self
179 where
180 T: std::convert::Into<crate::model::Recognizer>,
181 {
182 self.0.request.recognizer = std::option::Option::Some(v.into());
183 self
184 }
185
186 pub fn set_or_clear_recognizer<T>(mut self, v: std::option::Option<T>) -> Self
190 where
191 T: std::convert::Into<crate::model::Recognizer>,
192 {
193 self.0.request.recognizer = v.map(|x| x.into());
194 self
195 }
196
197 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
199 self.0.request.validate_only = v.into();
200 self
201 }
202
203 pub fn set_recognizer_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
205 self.0.request.recognizer_id = v.into();
206 self
207 }
208
209 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
213 self.0.request.parent = v.into();
214 self
215 }
216 }
217
218 #[doc(hidden)]
219 impl crate::RequestBuilder for CreateRecognizer {
220 fn request_options(&mut self) -> &mut crate::RequestOptions {
221 &mut self.0.options
222 }
223 }
224
225 #[derive(Clone, Debug)]
246 pub struct ListRecognizers(RequestBuilder<crate::model::ListRecognizersRequest>);
247
248 impl ListRecognizers {
249 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
250 Self(RequestBuilder::new(stub))
251 }
252
253 pub fn with_request<V: Into<crate::model::ListRecognizersRequest>>(mut self, v: V) -> Self {
255 self.0.request = v.into();
256 self
257 }
258
259 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
261 self.0.options = v.into();
262 self
263 }
264
265 pub async fn send(self) -> Result<crate::model::ListRecognizersResponse> {
267 (*self.0.stub)
268 .list_recognizers(self.0.request, self.0.options)
269 .await
270 .map(crate::Response::into_body)
271 }
272
273 pub fn by_page(
275 self,
276 ) -> impl google_cloud_gax::paginator::Paginator<
277 crate::model::ListRecognizersResponse,
278 crate::Error,
279 > {
280 use std::clone::Clone;
281 let token = self.0.request.page_token.clone();
282 let execute = move |token: String| {
283 let mut builder = self.clone();
284 builder.0.request = builder.0.request.set_page_token(token);
285 builder.send()
286 };
287 google_cloud_gax::paginator::internal::new_paginator(token, execute)
288 }
289
290 pub fn by_item(
292 self,
293 ) -> impl google_cloud_gax::paginator::ItemPaginator<
294 crate::model::ListRecognizersResponse,
295 crate::Error,
296 > {
297 use google_cloud_gax::paginator::Paginator;
298 self.by_page().items()
299 }
300
301 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
305 self.0.request.parent = v.into();
306 self
307 }
308
309 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
311 self.0.request.page_size = v.into();
312 self
313 }
314
315 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
317 self.0.request.page_token = v.into();
318 self
319 }
320
321 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
323 self.0.request.show_deleted = v.into();
324 self
325 }
326 }
327
328 #[doc(hidden)]
329 impl crate::RequestBuilder for ListRecognizers {
330 fn request_options(&mut self) -> &mut crate::RequestOptions {
331 &mut self.0.options
332 }
333 }
334
335 #[derive(Clone, Debug)]
352 pub struct GetRecognizer(RequestBuilder<crate::model::GetRecognizerRequest>);
353
354 impl GetRecognizer {
355 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
356 Self(RequestBuilder::new(stub))
357 }
358
359 pub fn with_request<V: Into<crate::model::GetRecognizerRequest>>(mut self, v: V) -> Self {
361 self.0.request = v.into();
362 self
363 }
364
365 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
367 self.0.options = v.into();
368 self
369 }
370
371 pub async fn send(self) -> Result<crate::model::Recognizer> {
373 (*self.0.stub)
374 .get_recognizer(self.0.request, self.0.options)
375 .await
376 .map(crate::Response::into_body)
377 }
378
379 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
383 self.0.request.name = v.into();
384 self
385 }
386 }
387
388 #[doc(hidden)]
389 impl crate::RequestBuilder for GetRecognizer {
390 fn request_options(&mut self) -> &mut crate::RequestOptions {
391 &mut self.0.options
392 }
393 }
394
395 #[derive(Clone, Debug)]
413 pub struct UpdateRecognizer(RequestBuilder<crate::model::UpdateRecognizerRequest>);
414
415 impl UpdateRecognizer {
416 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
417 Self(RequestBuilder::new(stub))
418 }
419
420 pub fn with_request<V: Into<crate::model::UpdateRecognizerRequest>>(
422 mut self,
423 v: V,
424 ) -> Self {
425 self.0.request = v.into();
426 self
427 }
428
429 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
431 self.0.options = v.into();
432 self
433 }
434
435 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
442 (*self.0.stub)
443 .update_recognizer(self.0.request, self.0.options)
444 .await
445 .map(crate::Response::into_body)
446 }
447
448 pub fn poller(
450 self,
451 ) -> impl google_cloud_lro::Poller<crate::model::Recognizer, crate::model::OperationMetadata>
452 {
453 type Operation = google_cloud_lro::internal::Operation<
454 crate::model::Recognizer,
455 crate::model::OperationMetadata,
456 >;
457 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
458 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
459 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
460 if let Some(ref mut details) = poller_options.tracing {
461 details.method_name =
462 "google_cloud_speech_v2::client::Speech::update_recognizer::until_done";
463 }
464
465 let stub = self.0.stub.clone();
466 let mut options = self.0.options.clone();
467 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
468 let query = move |name| {
469 let stub = stub.clone();
470 let options = options.clone();
471 async {
472 let op = GetOperation::new(stub)
473 .set_name(name)
474 .with_options(options)
475 .send()
476 .await?;
477 Ok(Operation::new(op))
478 }
479 };
480
481 let start = move || async {
482 let op = self.send().await?;
483 Ok(Operation::new(op))
484 };
485
486 use google_cloud_lro::internal::PollerExt;
487 {
488 google_cloud_lro::internal::new_poller(
489 polling_error_policy,
490 polling_backoff_policy,
491 start,
492 query,
493 )
494 }
495 .with_options(poller_options)
496 }
497
498 pub fn set_recognizer<T>(mut self, v: T) -> Self
502 where
503 T: std::convert::Into<crate::model::Recognizer>,
504 {
505 self.0.request.recognizer = std::option::Option::Some(v.into());
506 self
507 }
508
509 pub fn set_or_clear_recognizer<T>(mut self, v: std::option::Option<T>) -> Self
513 where
514 T: std::convert::Into<crate::model::Recognizer>,
515 {
516 self.0.request.recognizer = v.map(|x| x.into());
517 self
518 }
519
520 pub fn set_update_mask<T>(mut self, v: T) -> Self
522 where
523 T: std::convert::Into<wkt::FieldMask>,
524 {
525 self.0.request.update_mask = std::option::Option::Some(v.into());
526 self
527 }
528
529 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
531 where
532 T: std::convert::Into<wkt::FieldMask>,
533 {
534 self.0.request.update_mask = v.map(|x| x.into());
535 self
536 }
537
538 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
540 self.0.request.validate_only = v.into();
541 self
542 }
543 }
544
545 #[doc(hidden)]
546 impl crate::RequestBuilder for UpdateRecognizer {
547 fn request_options(&mut self) -> &mut crate::RequestOptions {
548 &mut self.0.options
549 }
550 }
551
552 #[derive(Clone, Debug)]
570 pub struct DeleteRecognizer(RequestBuilder<crate::model::DeleteRecognizerRequest>);
571
572 impl DeleteRecognizer {
573 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
574 Self(RequestBuilder::new(stub))
575 }
576
577 pub fn with_request<V: Into<crate::model::DeleteRecognizerRequest>>(
579 mut self,
580 v: V,
581 ) -> Self {
582 self.0.request = v.into();
583 self
584 }
585
586 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
588 self.0.options = v.into();
589 self
590 }
591
592 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
599 (*self.0.stub)
600 .delete_recognizer(self.0.request, self.0.options)
601 .await
602 .map(crate::Response::into_body)
603 }
604
605 pub fn poller(
607 self,
608 ) -> impl google_cloud_lro::Poller<crate::model::Recognizer, crate::model::OperationMetadata>
609 {
610 type Operation = google_cloud_lro::internal::Operation<
611 crate::model::Recognizer,
612 crate::model::OperationMetadata,
613 >;
614 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
615 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
616 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
617 if let Some(ref mut details) = poller_options.tracing {
618 details.method_name =
619 "google_cloud_speech_v2::client::Speech::delete_recognizer::until_done";
620 }
621
622 let stub = self.0.stub.clone();
623 let mut options = self.0.options.clone();
624 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
625 let query = move |name| {
626 let stub = stub.clone();
627 let options = options.clone();
628 async {
629 let op = GetOperation::new(stub)
630 .set_name(name)
631 .with_options(options)
632 .send()
633 .await?;
634 Ok(Operation::new(op))
635 }
636 };
637
638 let start = move || async {
639 let op = self.send().await?;
640 Ok(Operation::new(op))
641 };
642
643 use google_cloud_lro::internal::PollerExt;
644 {
645 google_cloud_lro::internal::new_poller(
646 polling_error_policy,
647 polling_backoff_policy,
648 start,
649 query,
650 )
651 }
652 .with_options(poller_options)
653 }
654
655 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
659 self.0.request.name = v.into();
660 self
661 }
662
663 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
665 self.0.request.validate_only = v.into();
666 self
667 }
668
669 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
671 self.0.request.allow_missing = v.into();
672 self
673 }
674
675 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
677 self.0.request.etag = v.into();
678 self
679 }
680 }
681
682 #[doc(hidden)]
683 impl crate::RequestBuilder for DeleteRecognizer {
684 fn request_options(&mut self) -> &mut crate::RequestOptions {
685 &mut self.0.options
686 }
687 }
688
689 #[derive(Clone, Debug)]
707 pub struct UndeleteRecognizer(RequestBuilder<crate::model::UndeleteRecognizerRequest>);
708
709 impl UndeleteRecognizer {
710 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
711 Self(RequestBuilder::new(stub))
712 }
713
714 pub fn with_request<V: Into<crate::model::UndeleteRecognizerRequest>>(
716 mut self,
717 v: V,
718 ) -> Self {
719 self.0.request = v.into();
720 self
721 }
722
723 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
725 self.0.options = v.into();
726 self
727 }
728
729 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
736 (*self.0.stub)
737 .undelete_recognizer(self.0.request, self.0.options)
738 .await
739 .map(crate::Response::into_body)
740 }
741
742 pub fn poller(
744 self,
745 ) -> impl google_cloud_lro::Poller<crate::model::Recognizer, crate::model::OperationMetadata>
746 {
747 type Operation = google_cloud_lro::internal::Operation<
748 crate::model::Recognizer,
749 crate::model::OperationMetadata,
750 >;
751 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
752 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
753 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
754 if let Some(ref mut details) = poller_options.tracing {
755 details.method_name =
756 "google_cloud_speech_v2::client::Speech::undelete_recognizer::until_done";
757 }
758
759 let stub = self.0.stub.clone();
760 let mut options = self.0.options.clone();
761 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
762 let query = move |name| {
763 let stub = stub.clone();
764 let options = options.clone();
765 async {
766 let op = GetOperation::new(stub)
767 .set_name(name)
768 .with_options(options)
769 .send()
770 .await?;
771 Ok(Operation::new(op))
772 }
773 };
774
775 let start = move || async {
776 let op = self.send().await?;
777 Ok(Operation::new(op))
778 };
779
780 use google_cloud_lro::internal::PollerExt;
781 {
782 google_cloud_lro::internal::new_poller(
783 polling_error_policy,
784 polling_backoff_policy,
785 start,
786 query,
787 )
788 }
789 .with_options(poller_options)
790 }
791
792 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
796 self.0.request.name = v.into();
797 self
798 }
799
800 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
802 self.0.request.validate_only = v.into();
803 self
804 }
805
806 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
808 self.0.request.etag = v.into();
809 self
810 }
811 }
812
813 #[doc(hidden)]
814 impl crate::RequestBuilder for UndeleteRecognizer {
815 fn request_options(&mut self) -> &mut crate::RequestOptions {
816 &mut self.0.options
817 }
818 }
819
820 #[derive(Clone, Debug)]
837 pub struct Recognize(RequestBuilder<crate::model::RecognizeRequest>);
838
839 impl Recognize {
840 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
841 Self(RequestBuilder::new(stub))
842 }
843
844 pub fn with_request<V: Into<crate::model::RecognizeRequest>>(mut self, v: V) -> Self {
846 self.0.request = v.into();
847 self
848 }
849
850 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
852 self.0.options = v.into();
853 self
854 }
855
856 pub async fn send(self) -> Result<crate::model::RecognizeResponse> {
858 (*self.0.stub)
859 .recognize(self.0.request, self.0.options)
860 .await
861 .map(crate::Response::into_body)
862 }
863
864 pub fn set_recognizer<T: Into<std::string::String>>(mut self, v: T) -> Self {
868 self.0.request.recognizer = v.into();
869 self
870 }
871
872 pub fn set_config<T>(mut self, v: T) -> Self
874 where
875 T: std::convert::Into<crate::model::RecognitionConfig>,
876 {
877 self.0.request.config = std::option::Option::Some(v.into());
878 self
879 }
880
881 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
883 where
884 T: std::convert::Into<crate::model::RecognitionConfig>,
885 {
886 self.0.request.config = v.map(|x| x.into());
887 self
888 }
889
890 pub fn set_config_mask<T>(mut self, v: T) -> Self
892 where
893 T: std::convert::Into<wkt::FieldMask>,
894 {
895 self.0.request.config_mask = std::option::Option::Some(v.into());
896 self
897 }
898
899 pub fn set_or_clear_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
901 where
902 T: std::convert::Into<wkt::FieldMask>,
903 {
904 self.0.request.config_mask = v.map(|x| x.into());
905 self
906 }
907
908 pub fn set_audio_source<T: Into<Option<crate::model::recognize_request::AudioSource>>>(
913 mut self,
914 v: T,
915 ) -> Self {
916 self.0.request.audio_source = v.into();
917 self
918 }
919
920 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
926 self.0.request = self.0.request.set_content(v);
927 self
928 }
929
930 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
936 self.0.request = self.0.request.set_uri(v);
937 self
938 }
939 }
940
941 #[doc(hidden)]
942 impl crate::RequestBuilder for Recognize {
943 fn request_options(&mut self) -> &mut crate::RequestOptions {
944 &mut self.0.options
945 }
946 }
947
948 #[derive(Clone, Debug)]
966 pub struct BatchRecognize(RequestBuilder<crate::model::BatchRecognizeRequest>);
967
968 impl BatchRecognize {
969 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
970 Self(RequestBuilder::new(stub))
971 }
972
973 pub fn with_request<V: Into<crate::model::BatchRecognizeRequest>>(mut self, v: V) -> Self {
975 self.0.request = v.into();
976 self
977 }
978
979 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
981 self.0.options = v.into();
982 self
983 }
984
985 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
992 (*self.0.stub)
993 .batch_recognize(self.0.request, self.0.options)
994 .await
995 .map(crate::Response::into_body)
996 }
997
998 pub fn poller(
1000 self,
1001 ) -> impl google_cloud_lro::Poller<
1002 crate::model::BatchRecognizeResponse,
1003 crate::model::OperationMetadata,
1004 > {
1005 type Operation = google_cloud_lro::internal::Operation<
1006 crate::model::BatchRecognizeResponse,
1007 crate::model::OperationMetadata,
1008 >;
1009 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1010 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1011 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1012 if let Some(ref mut details) = poller_options.tracing {
1013 details.method_name =
1014 "google_cloud_speech_v2::client::Speech::batch_recognize::until_done";
1015 }
1016
1017 let stub = self.0.stub.clone();
1018 let mut options = self.0.options.clone();
1019 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1020 let query = move |name| {
1021 let stub = stub.clone();
1022 let options = options.clone();
1023 async {
1024 let op = GetOperation::new(stub)
1025 .set_name(name)
1026 .with_options(options)
1027 .send()
1028 .await?;
1029 Ok(Operation::new(op))
1030 }
1031 };
1032
1033 let start = move || async {
1034 let op = self.send().await?;
1035 Ok(Operation::new(op))
1036 };
1037
1038 use google_cloud_lro::internal::PollerExt;
1039 {
1040 google_cloud_lro::internal::new_poller(
1041 polling_error_policy,
1042 polling_backoff_policy,
1043 start,
1044 query,
1045 )
1046 }
1047 .with_options(poller_options)
1048 }
1049
1050 pub fn set_recognizer<T: Into<std::string::String>>(mut self, v: T) -> Self {
1054 self.0.request.recognizer = v.into();
1055 self
1056 }
1057
1058 pub fn set_config<T>(mut self, v: T) -> Self
1060 where
1061 T: std::convert::Into<crate::model::RecognitionConfig>,
1062 {
1063 self.0.request.config = std::option::Option::Some(v.into());
1064 self
1065 }
1066
1067 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
1069 where
1070 T: std::convert::Into<crate::model::RecognitionConfig>,
1071 {
1072 self.0.request.config = v.map(|x| x.into());
1073 self
1074 }
1075
1076 pub fn set_config_mask<T>(mut self, v: T) -> Self
1078 where
1079 T: std::convert::Into<wkt::FieldMask>,
1080 {
1081 self.0.request.config_mask = std::option::Option::Some(v.into());
1082 self
1083 }
1084
1085 pub fn set_or_clear_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
1087 where
1088 T: std::convert::Into<wkt::FieldMask>,
1089 {
1090 self.0.request.config_mask = v.map(|x| x.into());
1091 self
1092 }
1093
1094 pub fn set_files<T, V>(mut self, v: T) -> Self
1096 where
1097 T: std::iter::IntoIterator<Item = V>,
1098 V: std::convert::Into<crate::model::BatchRecognizeFileMetadata>,
1099 {
1100 use std::iter::Iterator;
1101 self.0.request.files = v.into_iter().map(|i| i.into()).collect();
1102 self
1103 }
1104
1105 pub fn set_recognition_output_config<T>(mut self, v: T) -> Self
1107 where
1108 T: std::convert::Into<crate::model::RecognitionOutputConfig>,
1109 {
1110 self.0.request.recognition_output_config = std::option::Option::Some(v.into());
1111 self
1112 }
1113
1114 pub fn set_or_clear_recognition_output_config<T>(
1116 mut self,
1117 v: std::option::Option<T>,
1118 ) -> Self
1119 where
1120 T: std::convert::Into<crate::model::RecognitionOutputConfig>,
1121 {
1122 self.0.request.recognition_output_config = v.map(|x| x.into());
1123 self
1124 }
1125
1126 pub fn set_processing_strategy<
1128 T: Into<crate::model::batch_recognize_request::ProcessingStrategy>,
1129 >(
1130 mut self,
1131 v: T,
1132 ) -> Self {
1133 self.0.request.processing_strategy = v.into();
1134 self
1135 }
1136 }
1137
1138 #[doc(hidden)]
1139 impl crate::RequestBuilder for BatchRecognize {
1140 fn request_options(&mut self) -> &mut crate::RequestOptions {
1141 &mut self.0.options
1142 }
1143 }
1144
1145 #[derive(Clone, Debug)]
1162 pub struct GetConfig(RequestBuilder<crate::model::GetConfigRequest>);
1163
1164 impl GetConfig {
1165 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1166 Self(RequestBuilder::new(stub))
1167 }
1168
1169 pub fn with_request<V: Into<crate::model::GetConfigRequest>>(mut self, v: V) -> Self {
1171 self.0.request = v.into();
1172 self
1173 }
1174
1175 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1177 self.0.options = v.into();
1178 self
1179 }
1180
1181 pub async fn send(self) -> Result<crate::model::Config> {
1183 (*self.0.stub)
1184 .get_config(self.0.request, self.0.options)
1185 .await
1186 .map(crate::Response::into_body)
1187 }
1188
1189 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1193 self.0.request.name = v.into();
1194 self
1195 }
1196 }
1197
1198 #[doc(hidden)]
1199 impl crate::RequestBuilder for GetConfig {
1200 fn request_options(&mut self) -> &mut crate::RequestOptions {
1201 &mut self.0.options
1202 }
1203 }
1204
1205 #[derive(Clone, Debug)]
1222 pub struct UpdateConfig(RequestBuilder<crate::model::UpdateConfigRequest>);
1223
1224 impl UpdateConfig {
1225 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1226 Self(RequestBuilder::new(stub))
1227 }
1228
1229 pub fn with_request<V: Into<crate::model::UpdateConfigRequest>>(mut self, v: V) -> Self {
1231 self.0.request = v.into();
1232 self
1233 }
1234
1235 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1237 self.0.options = v.into();
1238 self
1239 }
1240
1241 pub async fn send(self) -> Result<crate::model::Config> {
1243 (*self.0.stub)
1244 .update_config(self.0.request, self.0.options)
1245 .await
1246 .map(crate::Response::into_body)
1247 }
1248
1249 pub fn set_config<T>(mut self, v: T) -> Self
1253 where
1254 T: std::convert::Into<crate::model::Config>,
1255 {
1256 self.0.request.config = std::option::Option::Some(v.into());
1257 self
1258 }
1259
1260 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
1264 where
1265 T: std::convert::Into<crate::model::Config>,
1266 {
1267 self.0.request.config = v.map(|x| x.into());
1268 self
1269 }
1270
1271 pub fn set_update_mask<T>(mut self, v: T) -> Self
1273 where
1274 T: std::convert::Into<wkt::FieldMask>,
1275 {
1276 self.0.request.update_mask = std::option::Option::Some(v.into());
1277 self
1278 }
1279
1280 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1282 where
1283 T: std::convert::Into<wkt::FieldMask>,
1284 {
1285 self.0.request.update_mask = v.map(|x| x.into());
1286 self
1287 }
1288 }
1289
1290 #[doc(hidden)]
1291 impl crate::RequestBuilder for UpdateConfig {
1292 fn request_options(&mut self) -> &mut crate::RequestOptions {
1293 &mut self.0.options
1294 }
1295 }
1296
1297 #[derive(Clone, Debug)]
1315 pub struct CreateCustomClass(RequestBuilder<crate::model::CreateCustomClassRequest>);
1316
1317 impl CreateCustomClass {
1318 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1319 Self(RequestBuilder::new(stub))
1320 }
1321
1322 pub fn with_request<V: Into<crate::model::CreateCustomClassRequest>>(
1324 mut self,
1325 v: V,
1326 ) -> Self {
1327 self.0.request = v.into();
1328 self
1329 }
1330
1331 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1333 self.0.options = v.into();
1334 self
1335 }
1336
1337 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1344 (*self.0.stub)
1345 .create_custom_class(self.0.request, self.0.options)
1346 .await
1347 .map(crate::Response::into_body)
1348 }
1349
1350 pub fn poller(
1352 self,
1353 ) -> impl google_cloud_lro::Poller<crate::model::CustomClass, crate::model::OperationMetadata>
1354 {
1355 type Operation = google_cloud_lro::internal::Operation<
1356 crate::model::CustomClass,
1357 crate::model::OperationMetadata,
1358 >;
1359 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1360 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1361 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1362 if let Some(ref mut details) = poller_options.tracing {
1363 details.method_name =
1364 "google_cloud_speech_v2::client::Speech::create_custom_class::until_done";
1365 }
1366
1367 let stub = self.0.stub.clone();
1368 let mut options = self.0.options.clone();
1369 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1370 let query = move |name| {
1371 let stub = stub.clone();
1372 let options = options.clone();
1373 async {
1374 let op = GetOperation::new(stub)
1375 .set_name(name)
1376 .with_options(options)
1377 .send()
1378 .await?;
1379 Ok(Operation::new(op))
1380 }
1381 };
1382
1383 let start = move || async {
1384 let op = self.send().await?;
1385 Ok(Operation::new(op))
1386 };
1387
1388 use google_cloud_lro::internal::PollerExt;
1389 {
1390 google_cloud_lro::internal::new_poller(
1391 polling_error_policy,
1392 polling_backoff_policy,
1393 start,
1394 query,
1395 )
1396 }
1397 .with_options(poller_options)
1398 }
1399
1400 pub fn set_custom_class<T>(mut self, v: T) -> Self
1404 where
1405 T: std::convert::Into<crate::model::CustomClass>,
1406 {
1407 self.0.request.custom_class = std::option::Option::Some(v.into());
1408 self
1409 }
1410
1411 pub fn set_or_clear_custom_class<T>(mut self, v: std::option::Option<T>) -> Self
1415 where
1416 T: std::convert::Into<crate::model::CustomClass>,
1417 {
1418 self.0.request.custom_class = v.map(|x| x.into());
1419 self
1420 }
1421
1422 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1424 self.0.request.validate_only = v.into();
1425 self
1426 }
1427
1428 pub fn set_custom_class_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1430 self.0.request.custom_class_id = v.into();
1431 self
1432 }
1433
1434 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1438 self.0.request.parent = v.into();
1439 self
1440 }
1441 }
1442
1443 #[doc(hidden)]
1444 impl crate::RequestBuilder for CreateCustomClass {
1445 fn request_options(&mut self) -> &mut crate::RequestOptions {
1446 &mut self.0.options
1447 }
1448 }
1449
1450 #[derive(Clone, Debug)]
1471 pub struct ListCustomClasses(RequestBuilder<crate::model::ListCustomClassesRequest>);
1472
1473 impl ListCustomClasses {
1474 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1475 Self(RequestBuilder::new(stub))
1476 }
1477
1478 pub fn with_request<V: Into<crate::model::ListCustomClassesRequest>>(
1480 mut self,
1481 v: V,
1482 ) -> Self {
1483 self.0.request = v.into();
1484 self
1485 }
1486
1487 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1489 self.0.options = v.into();
1490 self
1491 }
1492
1493 pub async fn send(self) -> Result<crate::model::ListCustomClassesResponse> {
1495 (*self.0.stub)
1496 .list_custom_classes(self.0.request, self.0.options)
1497 .await
1498 .map(crate::Response::into_body)
1499 }
1500
1501 pub fn by_page(
1503 self,
1504 ) -> impl google_cloud_gax::paginator::Paginator<
1505 crate::model::ListCustomClassesResponse,
1506 crate::Error,
1507 > {
1508 use std::clone::Clone;
1509 let token = self.0.request.page_token.clone();
1510 let execute = move |token: String| {
1511 let mut builder = self.clone();
1512 builder.0.request = builder.0.request.set_page_token(token);
1513 builder.send()
1514 };
1515 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1516 }
1517
1518 pub fn by_item(
1520 self,
1521 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1522 crate::model::ListCustomClassesResponse,
1523 crate::Error,
1524 > {
1525 use google_cloud_gax::paginator::Paginator;
1526 self.by_page().items()
1527 }
1528
1529 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1533 self.0.request.parent = v.into();
1534 self
1535 }
1536
1537 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1539 self.0.request.page_size = v.into();
1540 self
1541 }
1542
1543 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1545 self.0.request.page_token = v.into();
1546 self
1547 }
1548
1549 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
1551 self.0.request.show_deleted = v.into();
1552 self
1553 }
1554 }
1555
1556 #[doc(hidden)]
1557 impl crate::RequestBuilder for ListCustomClasses {
1558 fn request_options(&mut self) -> &mut crate::RequestOptions {
1559 &mut self.0.options
1560 }
1561 }
1562
1563 #[derive(Clone, Debug)]
1580 pub struct GetCustomClass(RequestBuilder<crate::model::GetCustomClassRequest>);
1581
1582 impl GetCustomClass {
1583 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1584 Self(RequestBuilder::new(stub))
1585 }
1586
1587 pub fn with_request<V: Into<crate::model::GetCustomClassRequest>>(mut self, v: V) -> Self {
1589 self.0.request = v.into();
1590 self
1591 }
1592
1593 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1595 self.0.options = v.into();
1596 self
1597 }
1598
1599 pub async fn send(self) -> Result<crate::model::CustomClass> {
1601 (*self.0.stub)
1602 .get_custom_class(self.0.request, self.0.options)
1603 .await
1604 .map(crate::Response::into_body)
1605 }
1606
1607 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1611 self.0.request.name = v.into();
1612 self
1613 }
1614 }
1615
1616 #[doc(hidden)]
1617 impl crate::RequestBuilder for GetCustomClass {
1618 fn request_options(&mut self) -> &mut crate::RequestOptions {
1619 &mut self.0.options
1620 }
1621 }
1622
1623 #[derive(Clone, Debug)]
1641 pub struct UpdateCustomClass(RequestBuilder<crate::model::UpdateCustomClassRequest>);
1642
1643 impl UpdateCustomClass {
1644 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1645 Self(RequestBuilder::new(stub))
1646 }
1647
1648 pub fn with_request<V: Into<crate::model::UpdateCustomClassRequest>>(
1650 mut self,
1651 v: V,
1652 ) -> Self {
1653 self.0.request = v.into();
1654 self
1655 }
1656
1657 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1659 self.0.options = v.into();
1660 self
1661 }
1662
1663 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1670 (*self.0.stub)
1671 .update_custom_class(self.0.request, self.0.options)
1672 .await
1673 .map(crate::Response::into_body)
1674 }
1675
1676 pub fn poller(
1678 self,
1679 ) -> impl google_cloud_lro::Poller<crate::model::CustomClass, crate::model::OperationMetadata>
1680 {
1681 type Operation = google_cloud_lro::internal::Operation<
1682 crate::model::CustomClass,
1683 crate::model::OperationMetadata,
1684 >;
1685 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1686 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1687 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1688 if let Some(ref mut details) = poller_options.tracing {
1689 details.method_name =
1690 "google_cloud_speech_v2::client::Speech::update_custom_class::until_done";
1691 }
1692
1693 let stub = self.0.stub.clone();
1694 let mut options = self.0.options.clone();
1695 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1696 let query = move |name| {
1697 let stub = stub.clone();
1698 let options = options.clone();
1699 async {
1700 let op = GetOperation::new(stub)
1701 .set_name(name)
1702 .with_options(options)
1703 .send()
1704 .await?;
1705 Ok(Operation::new(op))
1706 }
1707 };
1708
1709 let start = move || async {
1710 let op = self.send().await?;
1711 Ok(Operation::new(op))
1712 };
1713
1714 use google_cloud_lro::internal::PollerExt;
1715 {
1716 google_cloud_lro::internal::new_poller(
1717 polling_error_policy,
1718 polling_backoff_policy,
1719 start,
1720 query,
1721 )
1722 }
1723 .with_options(poller_options)
1724 }
1725
1726 pub fn set_custom_class<T>(mut self, v: T) -> Self
1730 where
1731 T: std::convert::Into<crate::model::CustomClass>,
1732 {
1733 self.0.request.custom_class = std::option::Option::Some(v.into());
1734 self
1735 }
1736
1737 pub fn set_or_clear_custom_class<T>(mut self, v: std::option::Option<T>) -> Self
1741 where
1742 T: std::convert::Into<crate::model::CustomClass>,
1743 {
1744 self.0.request.custom_class = v.map(|x| x.into());
1745 self
1746 }
1747
1748 pub fn set_update_mask<T>(mut self, v: T) -> Self
1750 where
1751 T: std::convert::Into<wkt::FieldMask>,
1752 {
1753 self.0.request.update_mask = std::option::Option::Some(v.into());
1754 self
1755 }
1756
1757 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1759 where
1760 T: std::convert::Into<wkt::FieldMask>,
1761 {
1762 self.0.request.update_mask = v.map(|x| x.into());
1763 self
1764 }
1765
1766 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1768 self.0.request.validate_only = v.into();
1769 self
1770 }
1771 }
1772
1773 #[doc(hidden)]
1774 impl crate::RequestBuilder for UpdateCustomClass {
1775 fn request_options(&mut self) -> &mut crate::RequestOptions {
1776 &mut self.0.options
1777 }
1778 }
1779
1780 #[derive(Clone, Debug)]
1798 pub struct DeleteCustomClass(RequestBuilder<crate::model::DeleteCustomClassRequest>);
1799
1800 impl DeleteCustomClass {
1801 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1802 Self(RequestBuilder::new(stub))
1803 }
1804
1805 pub fn with_request<V: Into<crate::model::DeleteCustomClassRequest>>(
1807 mut self,
1808 v: V,
1809 ) -> Self {
1810 self.0.request = v.into();
1811 self
1812 }
1813
1814 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1816 self.0.options = v.into();
1817 self
1818 }
1819
1820 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1827 (*self.0.stub)
1828 .delete_custom_class(self.0.request, self.0.options)
1829 .await
1830 .map(crate::Response::into_body)
1831 }
1832
1833 pub fn poller(
1835 self,
1836 ) -> impl google_cloud_lro::Poller<crate::model::CustomClass, crate::model::OperationMetadata>
1837 {
1838 type Operation = google_cloud_lro::internal::Operation<
1839 crate::model::CustomClass,
1840 crate::model::OperationMetadata,
1841 >;
1842 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1843 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1844 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1845 if let Some(ref mut details) = poller_options.tracing {
1846 details.method_name =
1847 "google_cloud_speech_v2::client::Speech::delete_custom_class::until_done";
1848 }
1849
1850 let stub = self.0.stub.clone();
1851 let mut options = self.0.options.clone();
1852 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1853 let query = move |name| {
1854 let stub = stub.clone();
1855 let options = options.clone();
1856 async {
1857 let op = GetOperation::new(stub)
1858 .set_name(name)
1859 .with_options(options)
1860 .send()
1861 .await?;
1862 Ok(Operation::new(op))
1863 }
1864 };
1865
1866 let start = move || async {
1867 let op = self.send().await?;
1868 Ok(Operation::new(op))
1869 };
1870
1871 use google_cloud_lro::internal::PollerExt;
1872 {
1873 google_cloud_lro::internal::new_poller(
1874 polling_error_policy,
1875 polling_backoff_policy,
1876 start,
1877 query,
1878 )
1879 }
1880 .with_options(poller_options)
1881 }
1882
1883 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1887 self.0.request.name = v.into();
1888 self
1889 }
1890
1891 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
1893 self.0.request.validate_only = v.into();
1894 self
1895 }
1896
1897 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
1899 self.0.request.allow_missing = v.into();
1900 self
1901 }
1902
1903 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1905 self.0.request.etag = v.into();
1906 self
1907 }
1908 }
1909
1910 #[doc(hidden)]
1911 impl crate::RequestBuilder for DeleteCustomClass {
1912 fn request_options(&mut self) -> &mut crate::RequestOptions {
1913 &mut self.0.options
1914 }
1915 }
1916
1917 #[derive(Clone, Debug)]
1935 pub struct UndeleteCustomClass(RequestBuilder<crate::model::UndeleteCustomClassRequest>);
1936
1937 impl UndeleteCustomClass {
1938 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
1939 Self(RequestBuilder::new(stub))
1940 }
1941
1942 pub fn with_request<V: Into<crate::model::UndeleteCustomClassRequest>>(
1944 mut self,
1945 v: V,
1946 ) -> Self {
1947 self.0.request = v.into();
1948 self
1949 }
1950
1951 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1953 self.0.options = v.into();
1954 self
1955 }
1956
1957 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1964 (*self.0.stub)
1965 .undelete_custom_class(self.0.request, self.0.options)
1966 .await
1967 .map(crate::Response::into_body)
1968 }
1969
1970 pub fn poller(
1972 self,
1973 ) -> impl google_cloud_lro::Poller<crate::model::CustomClass, crate::model::OperationMetadata>
1974 {
1975 type Operation = google_cloud_lro::internal::Operation<
1976 crate::model::CustomClass,
1977 crate::model::OperationMetadata,
1978 >;
1979 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1980 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1981 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1982 if let Some(ref mut details) = poller_options.tracing {
1983 details.method_name =
1984 "google_cloud_speech_v2::client::Speech::undelete_custom_class::until_done";
1985 }
1986
1987 let stub = self.0.stub.clone();
1988 let mut options = self.0.options.clone();
1989 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1990 let query = move |name| {
1991 let stub = stub.clone();
1992 let options = options.clone();
1993 async {
1994 let op = GetOperation::new(stub)
1995 .set_name(name)
1996 .with_options(options)
1997 .send()
1998 .await?;
1999 Ok(Operation::new(op))
2000 }
2001 };
2002
2003 let start = move || async {
2004 let op = self.send().await?;
2005 Ok(Operation::new(op))
2006 };
2007
2008 use google_cloud_lro::internal::PollerExt;
2009 {
2010 google_cloud_lro::internal::new_poller(
2011 polling_error_policy,
2012 polling_backoff_policy,
2013 start,
2014 query,
2015 )
2016 }
2017 .with_options(poller_options)
2018 }
2019
2020 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2024 self.0.request.name = v.into();
2025 self
2026 }
2027
2028 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2030 self.0.request.validate_only = v.into();
2031 self
2032 }
2033
2034 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2036 self.0.request.etag = v.into();
2037 self
2038 }
2039 }
2040
2041 #[doc(hidden)]
2042 impl crate::RequestBuilder for UndeleteCustomClass {
2043 fn request_options(&mut self) -> &mut crate::RequestOptions {
2044 &mut self.0.options
2045 }
2046 }
2047
2048 #[derive(Clone, Debug)]
2066 pub struct CreatePhraseSet(RequestBuilder<crate::model::CreatePhraseSetRequest>);
2067
2068 impl CreatePhraseSet {
2069 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2070 Self(RequestBuilder::new(stub))
2071 }
2072
2073 pub fn with_request<V: Into<crate::model::CreatePhraseSetRequest>>(mut self, v: V) -> Self {
2075 self.0.request = v.into();
2076 self
2077 }
2078
2079 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2081 self.0.options = v.into();
2082 self
2083 }
2084
2085 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2092 (*self.0.stub)
2093 .create_phrase_set(self.0.request, self.0.options)
2094 .await
2095 .map(crate::Response::into_body)
2096 }
2097
2098 pub fn poller(
2100 self,
2101 ) -> impl google_cloud_lro::Poller<crate::model::PhraseSet, crate::model::OperationMetadata>
2102 {
2103 type Operation = google_cloud_lro::internal::Operation<
2104 crate::model::PhraseSet,
2105 crate::model::OperationMetadata,
2106 >;
2107 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2108 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2109 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2110 if let Some(ref mut details) = poller_options.tracing {
2111 details.method_name =
2112 "google_cloud_speech_v2::client::Speech::create_phrase_set::until_done";
2113 }
2114
2115 let stub = self.0.stub.clone();
2116 let mut options = self.0.options.clone();
2117 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2118 let query = move |name| {
2119 let stub = stub.clone();
2120 let options = options.clone();
2121 async {
2122 let op = GetOperation::new(stub)
2123 .set_name(name)
2124 .with_options(options)
2125 .send()
2126 .await?;
2127 Ok(Operation::new(op))
2128 }
2129 };
2130
2131 let start = move || async {
2132 let op = self.send().await?;
2133 Ok(Operation::new(op))
2134 };
2135
2136 use google_cloud_lro::internal::PollerExt;
2137 {
2138 google_cloud_lro::internal::new_poller(
2139 polling_error_policy,
2140 polling_backoff_policy,
2141 start,
2142 query,
2143 )
2144 }
2145 .with_options(poller_options)
2146 }
2147
2148 pub fn set_phrase_set<T>(mut self, v: T) -> Self
2152 where
2153 T: std::convert::Into<crate::model::PhraseSet>,
2154 {
2155 self.0.request.phrase_set = std::option::Option::Some(v.into());
2156 self
2157 }
2158
2159 pub fn set_or_clear_phrase_set<T>(mut self, v: std::option::Option<T>) -> Self
2163 where
2164 T: std::convert::Into<crate::model::PhraseSet>,
2165 {
2166 self.0.request.phrase_set = v.map(|x| x.into());
2167 self
2168 }
2169
2170 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2172 self.0.request.validate_only = v.into();
2173 self
2174 }
2175
2176 pub fn set_phrase_set_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2178 self.0.request.phrase_set_id = v.into();
2179 self
2180 }
2181
2182 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2186 self.0.request.parent = v.into();
2187 self
2188 }
2189 }
2190
2191 #[doc(hidden)]
2192 impl crate::RequestBuilder for CreatePhraseSet {
2193 fn request_options(&mut self) -> &mut crate::RequestOptions {
2194 &mut self.0.options
2195 }
2196 }
2197
2198 #[derive(Clone, Debug)]
2219 pub struct ListPhraseSets(RequestBuilder<crate::model::ListPhraseSetsRequest>);
2220
2221 impl ListPhraseSets {
2222 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2223 Self(RequestBuilder::new(stub))
2224 }
2225
2226 pub fn with_request<V: Into<crate::model::ListPhraseSetsRequest>>(mut self, v: V) -> Self {
2228 self.0.request = v.into();
2229 self
2230 }
2231
2232 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2234 self.0.options = v.into();
2235 self
2236 }
2237
2238 pub async fn send(self) -> Result<crate::model::ListPhraseSetsResponse> {
2240 (*self.0.stub)
2241 .list_phrase_sets(self.0.request, self.0.options)
2242 .await
2243 .map(crate::Response::into_body)
2244 }
2245
2246 pub fn by_page(
2248 self,
2249 ) -> impl google_cloud_gax::paginator::Paginator<
2250 crate::model::ListPhraseSetsResponse,
2251 crate::Error,
2252 > {
2253 use std::clone::Clone;
2254 let token = self.0.request.page_token.clone();
2255 let execute = move |token: String| {
2256 let mut builder = self.clone();
2257 builder.0.request = builder.0.request.set_page_token(token);
2258 builder.send()
2259 };
2260 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2261 }
2262
2263 pub fn by_item(
2265 self,
2266 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2267 crate::model::ListPhraseSetsResponse,
2268 crate::Error,
2269 > {
2270 use google_cloud_gax::paginator::Paginator;
2271 self.by_page().items()
2272 }
2273
2274 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2278 self.0.request.parent = v.into();
2279 self
2280 }
2281
2282 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2284 self.0.request.page_size = v.into();
2285 self
2286 }
2287
2288 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2290 self.0.request.page_token = v.into();
2291 self
2292 }
2293
2294 pub fn set_show_deleted<T: Into<bool>>(mut self, v: T) -> Self {
2296 self.0.request.show_deleted = v.into();
2297 self
2298 }
2299 }
2300
2301 #[doc(hidden)]
2302 impl crate::RequestBuilder for ListPhraseSets {
2303 fn request_options(&mut self) -> &mut crate::RequestOptions {
2304 &mut self.0.options
2305 }
2306 }
2307
2308 #[derive(Clone, Debug)]
2325 pub struct GetPhraseSet(RequestBuilder<crate::model::GetPhraseSetRequest>);
2326
2327 impl GetPhraseSet {
2328 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2329 Self(RequestBuilder::new(stub))
2330 }
2331
2332 pub fn with_request<V: Into<crate::model::GetPhraseSetRequest>>(mut self, v: V) -> Self {
2334 self.0.request = v.into();
2335 self
2336 }
2337
2338 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2340 self.0.options = v.into();
2341 self
2342 }
2343
2344 pub async fn send(self) -> Result<crate::model::PhraseSet> {
2346 (*self.0.stub)
2347 .get_phrase_set(self.0.request, self.0.options)
2348 .await
2349 .map(crate::Response::into_body)
2350 }
2351
2352 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2356 self.0.request.name = v.into();
2357 self
2358 }
2359 }
2360
2361 #[doc(hidden)]
2362 impl crate::RequestBuilder for GetPhraseSet {
2363 fn request_options(&mut self) -> &mut crate::RequestOptions {
2364 &mut self.0.options
2365 }
2366 }
2367
2368 #[derive(Clone, Debug)]
2386 pub struct UpdatePhraseSet(RequestBuilder<crate::model::UpdatePhraseSetRequest>);
2387
2388 impl UpdatePhraseSet {
2389 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2390 Self(RequestBuilder::new(stub))
2391 }
2392
2393 pub fn with_request<V: Into<crate::model::UpdatePhraseSetRequest>>(mut self, v: V) -> Self {
2395 self.0.request = v.into();
2396 self
2397 }
2398
2399 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2401 self.0.options = v.into();
2402 self
2403 }
2404
2405 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2412 (*self.0.stub)
2413 .update_phrase_set(self.0.request, self.0.options)
2414 .await
2415 .map(crate::Response::into_body)
2416 }
2417
2418 pub fn poller(
2420 self,
2421 ) -> impl google_cloud_lro::Poller<crate::model::PhraseSet, crate::model::OperationMetadata>
2422 {
2423 type Operation = google_cloud_lro::internal::Operation<
2424 crate::model::PhraseSet,
2425 crate::model::OperationMetadata,
2426 >;
2427 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2428 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2429 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2430 if let Some(ref mut details) = poller_options.tracing {
2431 details.method_name =
2432 "google_cloud_speech_v2::client::Speech::update_phrase_set::until_done";
2433 }
2434
2435 let stub = self.0.stub.clone();
2436 let mut options = self.0.options.clone();
2437 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2438 let query = move |name| {
2439 let stub = stub.clone();
2440 let options = options.clone();
2441 async {
2442 let op = GetOperation::new(stub)
2443 .set_name(name)
2444 .with_options(options)
2445 .send()
2446 .await?;
2447 Ok(Operation::new(op))
2448 }
2449 };
2450
2451 let start = move || async {
2452 let op = self.send().await?;
2453 Ok(Operation::new(op))
2454 };
2455
2456 use google_cloud_lro::internal::PollerExt;
2457 {
2458 google_cloud_lro::internal::new_poller(
2459 polling_error_policy,
2460 polling_backoff_policy,
2461 start,
2462 query,
2463 )
2464 }
2465 .with_options(poller_options)
2466 }
2467
2468 pub fn set_phrase_set<T>(mut self, v: T) -> Self
2472 where
2473 T: std::convert::Into<crate::model::PhraseSet>,
2474 {
2475 self.0.request.phrase_set = std::option::Option::Some(v.into());
2476 self
2477 }
2478
2479 pub fn set_or_clear_phrase_set<T>(mut self, v: std::option::Option<T>) -> Self
2483 where
2484 T: std::convert::Into<crate::model::PhraseSet>,
2485 {
2486 self.0.request.phrase_set = v.map(|x| x.into());
2487 self
2488 }
2489
2490 pub fn set_update_mask<T>(mut self, v: T) -> Self
2492 where
2493 T: std::convert::Into<wkt::FieldMask>,
2494 {
2495 self.0.request.update_mask = std::option::Option::Some(v.into());
2496 self
2497 }
2498
2499 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2501 where
2502 T: std::convert::Into<wkt::FieldMask>,
2503 {
2504 self.0.request.update_mask = v.map(|x| x.into());
2505 self
2506 }
2507
2508 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2510 self.0.request.validate_only = v.into();
2511 self
2512 }
2513 }
2514
2515 #[doc(hidden)]
2516 impl crate::RequestBuilder for UpdatePhraseSet {
2517 fn request_options(&mut self) -> &mut crate::RequestOptions {
2518 &mut self.0.options
2519 }
2520 }
2521
2522 #[derive(Clone, Debug)]
2540 pub struct DeletePhraseSet(RequestBuilder<crate::model::DeletePhraseSetRequest>);
2541
2542 impl DeletePhraseSet {
2543 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2544 Self(RequestBuilder::new(stub))
2545 }
2546
2547 pub fn with_request<V: Into<crate::model::DeletePhraseSetRequest>>(mut self, v: V) -> Self {
2549 self.0.request = v.into();
2550 self
2551 }
2552
2553 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2555 self.0.options = v.into();
2556 self
2557 }
2558
2559 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2566 (*self.0.stub)
2567 .delete_phrase_set(self.0.request, self.0.options)
2568 .await
2569 .map(crate::Response::into_body)
2570 }
2571
2572 pub fn poller(
2574 self,
2575 ) -> impl google_cloud_lro::Poller<crate::model::PhraseSet, crate::model::OperationMetadata>
2576 {
2577 type Operation = google_cloud_lro::internal::Operation<
2578 crate::model::PhraseSet,
2579 crate::model::OperationMetadata,
2580 >;
2581 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2582 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2583 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2584 if let Some(ref mut details) = poller_options.tracing {
2585 details.method_name =
2586 "google_cloud_speech_v2::client::Speech::delete_phrase_set::until_done";
2587 }
2588
2589 let stub = self.0.stub.clone();
2590 let mut options = self.0.options.clone();
2591 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2592 let query = move |name| {
2593 let stub = stub.clone();
2594 let options = options.clone();
2595 async {
2596 let op = GetOperation::new(stub)
2597 .set_name(name)
2598 .with_options(options)
2599 .send()
2600 .await?;
2601 Ok(Operation::new(op))
2602 }
2603 };
2604
2605 let start = move || async {
2606 let op = self.send().await?;
2607 Ok(Operation::new(op))
2608 };
2609
2610 use google_cloud_lro::internal::PollerExt;
2611 {
2612 google_cloud_lro::internal::new_poller(
2613 polling_error_policy,
2614 polling_backoff_policy,
2615 start,
2616 query,
2617 )
2618 }
2619 .with_options(poller_options)
2620 }
2621
2622 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2626 self.0.request.name = v.into();
2627 self
2628 }
2629
2630 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2632 self.0.request.validate_only = v.into();
2633 self
2634 }
2635
2636 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
2638 self.0.request.allow_missing = v.into();
2639 self
2640 }
2641
2642 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2644 self.0.request.etag = v.into();
2645 self
2646 }
2647 }
2648
2649 #[doc(hidden)]
2650 impl crate::RequestBuilder for DeletePhraseSet {
2651 fn request_options(&mut self) -> &mut crate::RequestOptions {
2652 &mut self.0.options
2653 }
2654 }
2655
2656 #[derive(Clone, Debug)]
2674 pub struct UndeletePhraseSet(RequestBuilder<crate::model::UndeletePhraseSetRequest>);
2675
2676 impl UndeletePhraseSet {
2677 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2678 Self(RequestBuilder::new(stub))
2679 }
2680
2681 pub fn with_request<V: Into<crate::model::UndeletePhraseSetRequest>>(
2683 mut self,
2684 v: V,
2685 ) -> Self {
2686 self.0.request = v.into();
2687 self
2688 }
2689
2690 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2692 self.0.options = v.into();
2693 self
2694 }
2695
2696 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2703 (*self.0.stub)
2704 .undelete_phrase_set(self.0.request, self.0.options)
2705 .await
2706 .map(crate::Response::into_body)
2707 }
2708
2709 pub fn poller(
2711 self,
2712 ) -> impl google_cloud_lro::Poller<crate::model::PhraseSet, crate::model::OperationMetadata>
2713 {
2714 type Operation = google_cloud_lro::internal::Operation<
2715 crate::model::PhraseSet,
2716 crate::model::OperationMetadata,
2717 >;
2718 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2719 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2720 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2721 if let Some(ref mut details) = poller_options.tracing {
2722 details.method_name =
2723 "google_cloud_speech_v2::client::Speech::undelete_phrase_set::until_done";
2724 }
2725
2726 let stub = self.0.stub.clone();
2727 let mut options = self.0.options.clone();
2728 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2729 let query = move |name| {
2730 let stub = stub.clone();
2731 let options = options.clone();
2732 async {
2733 let op = GetOperation::new(stub)
2734 .set_name(name)
2735 .with_options(options)
2736 .send()
2737 .await?;
2738 Ok(Operation::new(op))
2739 }
2740 };
2741
2742 let start = move || async {
2743 let op = self.send().await?;
2744 Ok(Operation::new(op))
2745 };
2746
2747 use google_cloud_lro::internal::PollerExt;
2748 {
2749 google_cloud_lro::internal::new_poller(
2750 polling_error_policy,
2751 polling_backoff_policy,
2752 start,
2753 query,
2754 )
2755 }
2756 .with_options(poller_options)
2757 }
2758
2759 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2763 self.0.request.name = v.into();
2764 self
2765 }
2766
2767 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
2769 self.0.request.validate_only = v.into();
2770 self
2771 }
2772
2773 pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
2775 self.0.request.etag = v.into();
2776 self
2777 }
2778 }
2779
2780 #[doc(hidden)]
2781 impl crate::RequestBuilder for UndeletePhraseSet {
2782 fn request_options(&mut self) -> &mut crate::RequestOptions {
2783 &mut self.0.options
2784 }
2785 }
2786
2787 #[derive(Clone, Debug)]
2808 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
2809
2810 impl ListLocations {
2811 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2812 Self(RequestBuilder::new(stub))
2813 }
2814
2815 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
2817 mut self,
2818 v: V,
2819 ) -> Self {
2820 self.0.request = v.into();
2821 self
2822 }
2823
2824 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2826 self.0.options = v.into();
2827 self
2828 }
2829
2830 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
2832 (*self.0.stub)
2833 .list_locations(self.0.request, self.0.options)
2834 .await
2835 .map(crate::Response::into_body)
2836 }
2837
2838 pub fn by_page(
2840 self,
2841 ) -> impl google_cloud_gax::paginator::Paginator<
2842 google_cloud_location::model::ListLocationsResponse,
2843 crate::Error,
2844 > {
2845 use std::clone::Clone;
2846 let token = self.0.request.page_token.clone();
2847 let execute = move |token: String| {
2848 let mut builder = self.clone();
2849 builder.0.request = builder.0.request.set_page_token(token);
2850 builder.send()
2851 };
2852 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2853 }
2854
2855 pub fn by_item(
2857 self,
2858 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2859 google_cloud_location::model::ListLocationsResponse,
2860 crate::Error,
2861 > {
2862 use google_cloud_gax::paginator::Paginator;
2863 self.by_page().items()
2864 }
2865
2866 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2868 self.0.request.name = v.into();
2869 self
2870 }
2871
2872 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2874 self.0.request.filter = v.into();
2875 self
2876 }
2877
2878 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2880 self.0.request.page_size = v.into();
2881 self
2882 }
2883
2884 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2886 self.0.request.page_token = v.into();
2887 self
2888 }
2889 }
2890
2891 #[doc(hidden)]
2892 impl crate::RequestBuilder for ListLocations {
2893 fn request_options(&mut self) -> &mut crate::RequestOptions {
2894 &mut self.0.options
2895 }
2896 }
2897
2898 #[derive(Clone, Debug)]
2915 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
2916
2917 impl GetLocation {
2918 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2919 Self(RequestBuilder::new(stub))
2920 }
2921
2922 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
2924 mut self,
2925 v: V,
2926 ) -> Self {
2927 self.0.request = v.into();
2928 self
2929 }
2930
2931 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2933 self.0.options = v.into();
2934 self
2935 }
2936
2937 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
2939 (*self.0.stub)
2940 .get_location(self.0.request, self.0.options)
2941 .await
2942 .map(crate::Response::into_body)
2943 }
2944
2945 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2947 self.0.request.name = v.into();
2948 self
2949 }
2950 }
2951
2952 #[doc(hidden)]
2953 impl crate::RequestBuilder for GetLocation {
2954 fn request_options(&mut self) -> &mut crate::RequestOptions {
2955 &mut self.0.options
2956 }
2957 }
2958
2959 #[derive(Clone, Debug)]
2980 pub struct ListOperations(
2981 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2982 );
2983
2984 impl ListOperations {
2985 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
2986 Self(RequestBuilder::new(stub))
2987 }
2988
2989 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2991 mut self,
2992 v: V,
2993 ) -> Self {
2994 self.0.request = v.into();
2995 self
2996 }
2997
2998 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3000 self.0.options = v.into();
3001 self
3002 }
3003
3004 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
3006 (*self.0.stub)
3007 .list_operations(self.0.request, self.0.options)
3008 .await
3009 .map(crate::Response::into_body)
3010 }
3011
3012 pub fn by_page(
3014 self,
3015 ) -> impl google_cloud_gax::paginator::Paginator<
3016 google_cloud_longrunning::model::ListOperationsResponse,
3017 crate::Error,
3018 > {
3019 use std::clone::Clone;
3020 let token = self.0.request.page_token.clone();
3021 let execute = move |token: String| {
3022 let mut builder = self.clone();
3023 builder.0.request = builder.0.request.set_page_token(token);
3024 builder.send()
3025 };
3026 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3027 }
3028
3029 pub fn by_item(
3031 self,
3032 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3033 google_cloud_longrunning::model::ListOperationsResponse,
3034 crate::Error,
3035 > {
3036 use google_cloud_gax::paginator::Paginator;
3037 self.by_page().items()
3038 }
3039
3040 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3042 self.0.request.name = v.into();
3043 self
3044 }
3045
3046 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3048 self.0.request.filter = v.into();
3049 self
3050 }
3051
3052 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3054 self.0.request.page_size = v.into();
3055 self
3056 }
3057
3058 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3060 self.0.request.page_token = v.into();
3061 self
3062 }
3063
3064 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3066 self.0.request.return_partial_success = v.into();
3067 self
3068 }
3069 }
3070
3071 #[doc(hidden)]
3072 impl crate::RequestBuilder for ListOperations {
3073 fn request_options(&mut self) -> &mut crate::RequestOptions {
3074 &mut self.0.options
3075 }
3076 }
3077
3078 #[derive(Clone, Debug)]
3095 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3096
3097 impl GetOperation {
3098 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
3099 Self(RequestBuilder::new(stub))
3100 }
3101
3102 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3104 mut self,
3105 v: V,
3106 ) -> Self {
3107 self.0.request = v.into();
3108 self
3109 }
3110
3111 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3113 self.0.options = v.into();
3114 self
3115 }
3116
3117 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3119 (*self.0.stub)
3120 .get_operation(self.0.request, self.0.options)
3121 .await
3122 .map(crate::Response::into_body)
3123 }
3124
3125 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3127 self.0.request.name = v.into();
3128 self
3129 }
3130 }
3131
3132 #[doc(hidden)]
3133 impl crate::RequestBuilder for GetOperation {
3134 fn request_options(&mut self) -> &mut crate::RequestOptions {
3135 &mut self.0.options
3136 }
3137 }
3138
3139 #[derive(Clone, Debug)]
3156 pub struct DeleteOperation(
3157 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
3158 );
3159
3160 impl DeleteOperation {
3161 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
3162 Self(RequestBuilder::new(stub))
3163 }
3164
3165 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
3167 mut self,
3168 v: V,
3169 ) -> Self {
3170 self.0.request = v.into();
3171 self
3172 }
3173
3174 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3176 self.0.options = v.into();
3177 self
3178 }
3179
3180 pub async fn send(self) -> Result<()> {
3182 (*self.0.stub)
3183 .delete_operation(self.0.request, self.0.options)
3184 .await
3185 .map(crate::Response::into_body)
3186 }
3187
3188 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3190 self.0.request.name = v.into();
3191 self
3192 }
3193 }
3194
3195 #[doc(hidden)]
3196 impl crate::RequestBuilder for DeleteOperation {
3197 fn request_options(&mut self) -> &mut crate::RequestOptions {
3198 &mut self.0.options
3199 }
3200 }
3201
3202 #[derive(Clone, Debug)]
3219 pub struct CancelOperation(
3220 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
3221 );
3222
3223 impl CancelOperation {
3224 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Speech>) -> Self {
3225 Self(RequestBuilder::new(stub))
3226 }
3227
3228 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
3230 mut self,
3231 v: V,
3232 ) -> Self {
3233 self.0.request = v.into();
3234 self
3235 }
3236
3237 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3239 self.0.options = v.into();
3240 self
3241 }
3242
3243 pub async fn send(self) -> Result<()> {
3245 (*self.0.stub)
3246 .cancel_operation(self.0.request, self.0.options)
3247 .await
3248 .map(crate::Response::into_body)
3249 }
3250
3251 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3253 self.0.request.name = v.into();
3254 self
3255 }
3256 }
3257
3258 #[doc(hidden)]
3259 impl crate::RequestBuilder for CancelOperation {
3260 fn request_options(&mut self) -> &mut crate::RequestOptions {
3261 &mut self.0.options
3262 }
3263 }
3264}