1pub mod speech {
18 use crate::Result;
19
20 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 #[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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
107 self.0.options = v.into();
108 self
109 }
110
111 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
251 self.0.options = v.into();
252 self
253 }
254
255 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
357 self.0.options = v.into();
358 self
359 }
360
361 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
421 self.0.options = v.into();
422 self
423 }
424
425 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
569 self.0.options = v.into();
570 self
571 }
572
573 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
697 self.0.options = v.into();
698 self
699 }
700
701 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
815 self.0.options = v.into();
816 self
817 }
818
819 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 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 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
944 self.0.options = v.into();
945 self
946 }
947
948 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 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 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 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 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1131 self.0.options = v.into();
1132 self
1133 }
1134
1135 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1191 self.0.options = v.into();
1192 self
1193 }
1194
1195 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1287 self.0.options = v.into();
1288 self
1289 }
1290
1291 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1434 self.0.options = v.into();
1435 self
1436 }
1437
1438 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1540 self.0.options = v.into();
1541 self
1542 }
1543
1544 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1604 self.0.options = v.into();
1605 self
1606 }
1607
1608 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1752 self.0.options = v.into();
1753 self
1754 }
1755
1756 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1880 self.0.options = v.into();
1881 self
1882 }
1883
1884 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1999 self.0.options = v.into();
2000 self
2001 }
2002
2003 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2143 self.0.options = v.into();
2144 self
2145 }
2146
2147 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2249 self.0.options = v.into();
2250 self
2251 }
2252
2253 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2310 self.0.options = v.into();
2311 self
2312 }
2313
2314 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2455 self.0.options = v.into();
2456 self
2457 }
2458
2459 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2583 self.0.options = v.into();
2584 self
2585 }
2586
2587 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2708 self.0.options = v.into();
2709 self
2710 }
2711
2712 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2815 self.0.options = v.into();
2816 self
2817 }
2818
2819 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2882 self.0.options = v.into();
2883 self
2884 }
2885
2886 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 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2995 self.0.options = v.into();
2996 self
2997 }
2998
2999 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3058 self.0.options = v.into();
3059 self
3060 }
3061
3062 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3121 self.0.options = v.into();
3122 self
3123 }
3124
3125 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 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}