1pub mod translation_service {
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::TranslationService;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = TranslationService;
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::TranslationService>,
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(
63 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
64 ) -> Self {
65 Self {
66 stub,
67 request: R::default(),
68 options: crate::RequestOptions::default(),
69 }
70 }
71 }
72
73 #[derive(Clone, Debug)]
90 pub struct TranslateText(RequestBuilder<crate::model::TranslateTextRequest>);
91
92 impl TranslateText {
93 pub(crate) fn new(
94 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
95 ) -> Self {
96 Self(RequestBuilder::new(stub))
97 }
98
99 pub fn with_request<V: Into<crate::model::TranslateTextRequest>>(mut self, v: V) -> 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<crate::model::TranslateTextResponse> {
113 (*self.0.stub)
114 .translate_text(self.0.request, self.0.options)
115 .await
116 .map(crate::Response::into_body)
117 }
118
119 pub fn set_contents<T, V>(mut self, v: T) -> Self
123 where
124 T: std::iter::IntoIterator<Item = V>,
125 V: std::convert::Into<std::string::String>,
126 {
127 use std::iter::Iterator;
128 self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
129 self
130 }
131
132 pub fn set_mime_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
134 self.0.request.mime_type = v.into();
135 self
136 }
137
138 pub fn set_source_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
140 self.0.request.source_language_code = v.into();
141 self
142 }
143
144 pub fn set_target_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
148 self.0.request.target_language_code = v.into();
149 self
150 }
151
152 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
156 self.0.request.parent = v.into();
157 self
158 }
159
160 pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
162 self.0.request.model = v.into();
163 self
164 }
165
166 pub fn set_glossary_config<T>(mut self, v: T) -> Self
168 where
169 T: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
170 {
171 self.0.request.glossary_config = std::option::Option::Some(v.into());
172 self
173 }
174
175 pub fn set_or_clear_glossary_config<T>(mut self, v: std::option::Option<T>) -> Self
177 where
178 T: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
179 {
180 self.0.request.glossary_config = v.map(|x| x.into());
181 self
182 }
183
184 pub fn set_transliteration_config<T>(mut self, v: T) -> Self
186 where
187 T: std::convert::Into<crate::model::TransliterationConfig>,
188 {
189 self.0.request.transliteration_config = std::option::Option::Some(v.into());
190 self
191 }
192
193 pub fn set_or_clear_transliteration_config<T>(mut self, v: std::option::Option<T>) -> Self
195 where
196 T: std::convert::Into<crate::model::TransliterationConfig>,
197 {
198 self.0.request.transliteration_config = v.map(|x| x.into());
199 self
200 }
201
202 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
204 where
205 T: std::iter::IntoIterator<Item = (K, V)>,
206 K: std::convert::Into<std::string::String>,
207 V: std::convert::Into<std::string::String>,
208 {
209 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
210 self
211 }
212 }
213
214 #[doc(hidden)]
215 impl crate::RequestBuilder for TranslateText {
216 fn request_options(&mut self) -> &mut crate::RequestOptions {
217 &mut self.0.options
218 }
219 }
220
221 #[derive(Clone, Debug)]
238 pub struct RomanizeText(RequestBuilder<crate::model::RomanizeTextRequest>);
239
240 impl RomanizeText {
241 pub(crate) fn new(
242 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
243 ) -> Self {
244 Self(RequestBuilder::new(stub))
245 }
246
247 pub fn with_request<V: Into<crate::model::RomanizeTextRequest>>(mut self, v: V) -> Self {
249 self.0.request = v.into();
250 self
251 }
252
253 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
255 self.0.options = v.into();
256 self
257 }
258
259 pub async fn send(self) -> Result<crate::model::RomanizeTextResponse> {
261 (*self.0.stub)
262 .romanize_text(self.0.request, self.0.options)
263 .await
264 .map(crate::Response::into_body)
265 }
266
267 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
271 self.0.request.parent = v.into();
272 self
273 }
274
275 pub fn set_contents<T, V>(mut self, v: T) -> Self
279 where
280 T: std::iter::IntoIterator<Item = V>,
281 V: std::convert::Into<std::string::String>,
282 {
283 use std::iter::Iterator;
284 self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
285 self
286 }
287
288 pub fn set_source_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
290 self.0.request.source_language_code = v.into();
291 self
292 }
293 }
294
295 #[doc(hidden)]
296 impl crate::RequestBuilder for RomanizeText {
297 fn request_options(&mut self) -> &mut crate::RequestOptions {
298 &mut self.0.options
299 }
300 }
301
302 #[derive(Clone, Debug)]
319 pub struct DetectLanguage(RequestBuilder<crate::model::DetectLanguageRequest>);
320
321 impl DetectLanguage {
322 pub(crate) fn new(
323 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
324 ) -> Self {
325 Self(RequestBuilder::new(stub))
326 }
327
328 pub fn with_request<V: Into<crate::model::DetectLanguageRequest>>(mut self, v: V) -> Self {
330 self.0.request = v.into();
331 self
332 }
333
334 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
336 self.0.options = v.into();
337 self
338 }
339
340 pub async fn send(self) -> Result<crate::model::DetectLanguageResponse> {
342 (*self.0.stub)
343 .detect_language(self.0.request, self.0.options)
344 .await
345 .map(crate::Response::into_body)
346 }
347
348 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
352 self.0.request.parent = v.into();
353 self
354 }
355
356 pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
358 self.0.request.model = v.into();
359 self
360 }
361
362 pub fn set_mime_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
364 self.0.request.mime_type = v.into();
365 self
366 }
367
368 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
370 where
371 T: std::iter::IntoIterator<Item = (K, V)>,
372 K: std::convert::Into<std::string::String>,
373 V: std::convert::Into<std::string::String>,
374 {
375 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
376 self
377 }
378
379 pub fn set_source<T: Into<Option<crate::model::detect_language_request::Source>>>(
384 mut self,
385 v: T,
386 ) -> Self {
387 self.0.request.source = v.into();
388 self
389 }
390
391 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
397 self.0.request = self.0.request.set_content(v);
398 self
399 }
400 }
401
402 #[doc(hidden)]
403 impl crate::RequestBuilder for DetectLanguage {
404 fn request_options(&mut self) -> &mut crate::RequestOptions {
405 &mut self.0.options
406 }
407 }
408
409 #[derive(Clone, Debug)]
426 pub struct GetSupportedLanguages(RequestBuilder<crate::model::GetSupportedLanguagesRequest>);
427
428 impl GetSupportedLanguages {
429 pub(crate) fn new(
430 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
431 ) -> Self {
432 Self(RequestBuilder::new(stub))
433 }
434
435 pub fn with_request<V: Into<crate::model::GetSupportedLanguagesRequest>>(
437 mut self,
438 v: V,
439 ) -> Self {
440 self.0.request = v.into();
441 self
442 }
443
444 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
446 self.0.options = v.into();
447 self
448 }
449
450 pub async fn send(self) -> Result<crate::model::SupportedLanguages> {
452 (*self.0.stub)
453 .get_supported_languages(self.0.request, self.0.options)
454 .await
455 .map(crate::Response::into_body)
456 }
457
458 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
462 self.0.request.parent = v.into();
463 self
464 }
465
466 pub fn set_display_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
468 self.0.request.display_language_code = v.into();
469 self
470 }
471
472 pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
474 self.0.request.model = v.into();
475 self
476 }
477 }
478
479 #[doc(hidden)]
480 impl crate::RequestBuilder for GetSupportedLanguages {
481 fn request_options(&mut self) -> &mut crate::RequestOptions {
482 &mut self.0.options
483 }
484 }
485
486 #[derive(Clone, Debug)]
503 pub struct TranslateDocument(RequestBuilder<crate::model::TranslateDocumentRequest>);
504
505 impl TranslateDocument {
506 pub(crate) fn new(
507 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
508 ) -> Self {
509 Self(RequestBuilder::new(stub))
510 }
511
512 pub fn with_request<V: Into<crate::model::TranslateDocumentRequest>>(
514 mut self,
515 v: V,
516 ) -> Self {
517 self.0.request = v.into();
518 self
519 }
520
521 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
523 self.0.options = v.into();
524 self
525 }
526
527 pub async fn send(self) -> Result<crate::model::TranslateDocumentResponse> {
529 (*self.0.stub)
530 .translate_document(self.0.request, self.0.options)
531 .await
532 .map(crate::Response::into_body)
533 }
534
535 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
539 self.0.request.parent = v.into();
540 self
541 }
542
543 pub fn set_source_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
545 self.0.request.source_language_code = v.into();
546 self
547 }
548
549 pub fn set_target_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
553 self.0.request.target_language_code = v.into();
554 self
555 }
556
557 pub fn set_document_input_config<T>(mut self, v: T) -> Self
561 where
562 T: std::convert::Into<crate::model::DocumentInputConfig>,
563 {
564 self.0.request.document_input_config = std::option::Option::Some(v.into());
565 self
566 }
567
568 pub fn set_or_clear_document_input_config<T>(mut self, v: std::option::Option<T>) -> Self
572 where
573 T: std::convert::Into<crate::model::DocumentInputConfig>,
574 {
575 self.0.request.document_input_config = v.map(|x| x.into());
576 self
577 }
578
579 pub fn set_document_output_config<T>(mut self, v: T) -> Self
581 where
582 T: std::convert::Into<crate::model::DocumentOutputConfig>,
583 {
584 self.0.request.document_output_config = std::option::Option::Some(v.into());
585 self
586 }
587
588 pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
590 where
591 T: std::convert::Into<crate::model::DocumentOutputConfig>,
592 {
593 self.0.request.document_output_config = v.map(|x| x.into());
594 self
595 }
596
597 pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
599 self.0.request.model = v.into();
600 self
601 }
602
603 pub fn set_glossary_config<T>(mut self, v: T) -> Self
605 where
606 T: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
607 {
608 self.0.request.glossary_config = std::option::Option::Some(v.into());
609 self
610 }
611
612 pub fn set_or_clear_glossary_config<T>(mut self, v: std::option::Option<T>) -> Self
614 where
615 T: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
616 {
617 self.0.request.glossary_config = v.map(|x| x.into());
618 self
619 }
620
621 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
623 where
624 T: std::iter::IntoIterator<Item = (K, V)>,
625 K: std::convert::Into<std::string::String>,
626 V: std::convert::Into<std::string::String>,
627 {
628 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
629 self
630 }
631
632 pub fn set_customized_attribution<T: Into<std::string::String>>(mut self, v: T) -> Self {
634 self.0.request.customized_attribution = v.into();
635 self
636 }
637
638 pub fn set_is_translate_native_pdf_only<T: Into<bool>>(mut self, v: T) -> Self {
640 self.0.request.is_translate_native_pdf_only = v.into();
641 self
642 }
643
644 pub fn set_enable_shadow_removal_native_pdf<T: Into<bool>>(mut self, v: T) -> Self {
646 self.0.request.enable_shadow_removal_native_pdf = v.into();
647 self
648 }
649
650 pub fn set_enable_rotation_correction<T: Into<bool>>(mut self, v: T) -> Self {
652 self.0.request.enable_rotation_correction = v.into();
653 self
654 }
655 }
656
657 #[doc(hidden)]
658 impl crate::RequestBuilder for TranslateDocument {
659 fn request_options(&mut self) -> &mut crate::RequestOptions {
660 &mut self.0.options
661 }
662 }
663
664 #[derive(Clone, Debug)]
682 pub struct BatchTranslateText(RequestBuilder<crate::model::BatchTranslateTextRequest>);
683
684 impl BatchTranslateText {
685 pub(crate) fn new(
686 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
687 ) -> Self {
688 Self(RequestBuilder::new(stub))
689 }
690
691 pub fn with_request<V: Into<crate::model::BatchTranslateTextRequest>>(
693 mut self,
694 v: V,
695 ) -> Self {
696 self.0.request = v.into();
697 self
698 }
699
700 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
702 self.0.options = v.into();
703 self
704 }
705
706 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
713 (*self.0.stub)
714 .batch_translate_text(self.0.request, self.0.options)
715 .await
716 .map(crate::Response::into_body)
717 }
718
719 pub fn poller(
721 self,
722 ) -> impl google_cloud_lro::Poller<
723 crate::model::BatchTranslateResponse,
724 crate::model::BatchTranslateMetadata,
725 > {
726 type Operation = google_cloud_lro::internal::Operation<
727 crate::model::BatchTranslateResponse,
728 crate::model::BatchTranslateMetadata,
729 >;
730 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
731 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
732
733 let stub = self.0.stub.clone();
734 let mut options = self.0.options.clone();
735 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
736 let query = move |name| {
737 let stub = stub.clone();
738 let options = options.clone();
739 async {
740 let op = GetOperation::new(stub)
741 .set_name(name)
742 .with_options(options)
743 .send()
744 .await?;
745 Ok(Operation::new(op))
746 }
747 };
748
749 let start = move || async {
750 let op = self.send().await?;
751 Ok(Operation::new(op))
752 };
753
754 google_cloud_lro::internal::new_poller(
755 polling_error_policy,
756 polling_backoff_policy,
757 start,
758 query,
759 )
760 }
761
762 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
766 self.0.request.parent = v.into();
767 self
768 }
769
770 pub fn set_source_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
774 self.0.request.source_language_code = v.into();
775 self
776 }
777
778 pub fn set_target_language_codes<T, V>(mut self, v: T) -> Self
782 where
783 T: std::iter::IntoIterator<Item = V>,
784 V: std::convert::Into<std::string::String>,
785 {
786 use std::iter::Iterator;
787 self.0.request.target_language_codes = v.into_iter().map(|i| i.into()).collect();
788 self
789 }
790
791 pub fn set_models<T, K, V>(mut self, v: T) -> Self
793 where
794 T: std::iter::IntoIterator<Item = (K, V)>,
795 K: std::convert::Into<std::string::String>,
796 V: std::convert::Into<std::string::String>,
797 {
798 self.0.request.models = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
799 self
800 }
801
802 pub fn set_input_configs<T, V>(mut self, v: T) -> Self
806 where
807 T: std::iter::IntoIterator<Item = V>,
808 V: std::convert::Into<crate::model::InputConfig>,
809 {
810 use std::iter::Iterator;
811 self.0.request.input_configs = v.into_iter().map(|i| i.into()).collect();
812 self
813 }
814
815 pub fn set_output_config<T>(mut self, v: T) -> Self
819 where
820 T: std::convert::Into<crate::model::OutputConfig>,
821 {
822 self.0.request.output_config = std::option::Option::Some(v.into());
823 self
824 }
825
826 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
830 where
831 T: std::convert::Into<crate::model::OutputConfig>,
832 {
833 self.0.request.output_config = v.map(|x| x.into());
834 self
835 }
836
837 pub fn set_glossaries<T, K, V>(mut self, v: T) -> Self
839 where
840 T: std::iter::IntoIterator<Item = (K, V)>,
841 K: std::convert::Into<std::string::String>,
842 V: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
843 {
844 self.0.request.glossaries = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
845 self
846 }
847
848 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
850 where
851 T: std::iter::IntoIterator<Item = (K, V)>,
852 K: std::convert::Into<std::string::String>,
853 V: std::convert::Into<std::string::String>,
854 {
855 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
856 self
857 }
858 }
859
860 #[doc(hidden)]
861 impl crate::RequestBuilder for BatchTranslateText {
862 fn request_options(&mut self) -> &mut crate::RequestOptions {
863 &mut self.0.options
864 }
865 }
866
867 #[derive(Clone, Debug)]
885 pub struct BatchTranslateDocument(RequestBuilder<crate::model::BatchTranslateDocumentRequest>);
886
887 impl BatchTranslateDocument {
888 pub(crate) fn new(
889 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
890 ) -> Self {
891 Self(RequestBuilder::new(stub))
892 }
893
894 pub fn with_request<V: Into<crate::model::BatchTranslateDocumentRequest>>(
896 mut self,
897 v: V,
898 ) -> Self {
899 self.0.request = v.into();
900 self
901 }
902
903 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
905 self.0.options = v.into();
906 self
907 }
908
909 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
916 (*self.0.stub)
917 .batch_translate_document(self.0.request, self.0.options)
918 .await
919 .map(crate::Response::into_body)
920 }
921
922 pub fn poller(
924 self,
925 ) -> impl google_cloud_lro::Poller<
926 crate::model::BatchTranslateDocumentResponse,
927 crate::model::BatchTranslateDocumentMetadata,
928 > {
929 type Operation = google_cloud_lro::internal::Operation<
930 crate::model::BatchTranslateDocumentResponse,
931 crate::model::BatchTranslateDocumentMetadata,
932 >;
933 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
934 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
935
936 let stub = self.0.stub.clone();
937 let mut options = self.0.options.clone();
938 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
939 let query = move |name| {
940 let stub = stub.clone();
941 let options = options.clone();
942 async {
943 let op = GetOperation::new(stub)
944 .set_name(name)
945 .with_options(options)
946 .send()
947 .await?;
948 Ok(Operation::new(op))
949 }
950 };
951
952 let start = move || async {
953 let op = self.send().await?;
954 Ok(Operation::new(op))
955 };
956
957 google_cloud_lro::internal::new_poller(
958 polling_error_policy,
959 polling_backoff_policy,
960 start,
961 query,
962 )
963 }
964
965 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
969 self.0.request.parent = v.into();
970 self
971 }
972
973 pub fn set_source_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
977 self.0.request.source_language_code = v.into();
978 self
979 }
980
981 pub fn set_target_language_codes<T, V>(mut self, v: T) -> Self
985 where
986 T: std::iter::IntoIterator<Item = V>,
987 V: std::convert::Into<std::string::String>,
988 {
989 use std::iter::Iterator;
990 self.0.request.target_language_codes = v.into_iter().map(|i| i.into()).collect();
991 self
992 }
993
994 pub fn set_input_configs<T, V>(mut self, v: T) -> Self
998 where
999 T: std::iter::IntoIterator<Item = V>,
1000 V: std::convert::Into<crate::model::BatchDocumentInputConfig>,
1001 {
1002 use std::iter::Iterator;
1003 self.0.request.input_configs = v.into_iter().map(|i| i.into()).collect();
1004 self
1005 }
1006
1007 pub fn set_output_config<T>(mut self, v: T) -> Self
1011 where
1012 T: std::convert::Into<crate::model::BatchDocumentOutputConfig>,
1013 {
1014 self.0.request.output_config = std::option::Option::Some(v.into());
1015 self
1016 }
1017
1018 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
1022 where
1023 T: std::convert::Into<crate::model::BatchDocumentOutputConfig>,
1024 {
1025 self.0.request.output_config = v.map(|x| x.into());
1026 self
1027 }
1028
1029 pub fn set_models<T, K, V>(mut self, v: T) -> Self
1031 where
1032 T: std::iter::IntoIterator<Item = (K, V)>,
1033 K: std::convert::Into<std::string::String>,
1034 V: std::convert::Into<std::string::String>,
1035 {
1036 self.0.request.models = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1037 self
1038 }
1039
1040 pub fn set_glossaries<T, K, V>(mut self, v: T) -> Self
1042 where
1043 T: std::iter::IntoIterator<Item = (K, V)>,
1044 K: std::convert::Into<std::string::String>,
1045 V: std::convert::Into<crate::model::TranslateTextGlossaryConfig>,
1046 {
1047 self.0.request.glossaries = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1048 self
1049 }
1050
1051 pub fn set_format_conversions<T, K, V>(mut self, v: T) -> Self
1053 where
1054 T: std::iter::IntoIterator<Item = (K, V)>,
1055 K: std::convert::Into<std::string::String>,
1056 V: std::convert::Into<std::string::String>,
1057 {
1058 self.0.request.format_conversions =
1059 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1060 self
1061 }
1062
1063 pub fn set_customized_attribution<T: Into<std::string::String>>(mut self, v: T) -> Self {
1065 self.0.request.customized_attribution = v.into();
1066 self
1067 }
1068
1069 pub fn set_enable_shadow_removal_native_pdf<T: Into<bool>>(mut self, v: T) -> Self {
1071 self.0.request.enable_shadow_removal_native_pdf = v.into();
1072 self
1073 }
1074
1075 pub fn set_enable_rotation_correction<T: Into<bool>>(mut self, v: T) -> Self {
1077 self.0.request.enable_rotation_correction = v.into();
1078 self
1079 }
1080 }
1081
1082 #[doc(hidden)]
1083 impl crate::RequestBuilder for BatchTranslateDocument {
1084 fn request_options(&mut self) -> &mut crate::RequestOptions {
1085 &mut self.0.options
1086 }
1087 }
1088
1089 #[derive(Clone, Debug)]
1107 pub struct CreateGlossary(RequestBuilder<crate::model::CreateGlossaryRequest>);
1108
1109 impl CreateGlossary {
1110 pub(crate) fn new(
1111 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
1112 ) -> Self {
1113 Self(RequestBuilder::new(stub))
1114 }
1115
1116 pub fn with_request<V: Into<crate::model::CreateGlossaryRequest>>(mut self, v: V) -> Self {
1118 self.0.request = v.into();
1119 self
1120 }
1121
1122 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1124 self.0.options = v.into();
1125 self
1126 }
1127
1128 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1135 (*self.0.stub)
1136 .create_glossary(self.0.request, self.0.options)
1137 .await
1138 .map(crate::Response::into_body)
1139 }
1140
1141 pub fn poller(
1143 self,
1144 ) -> impl google_cloud_lro::Poller<crate::model::Glossary, crate::model::CreateGlossaryMetadata>
1145 {
1146 type Operation = google_cloud_lro::internal::Operation<
1147 crate::model::Glossary,
1148 crate::model::CreateGlossaryMetadata,
1149 >;
1150 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1151 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1152
1153 let stub = self.0.stub.clone();
1154 let mut options = self.0.options.clone();
1155 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1156 let query = move |name| {
1157 let stub = stub.clone();
1158 let options = options.clone();
1159 async {
1160 let op = GetOperation::new(stub)
1161 .set_name(name)
1162 .with_options(options)
1163 .send()
1164 .await?;
1165 Ok(Operation::new(op))
1166 }
1167 };
1168
1169 let start = move || async {
1170 let op = self.send().await?;
1171 Ok(Operation::new(op))
1172 };
1173
1174 google_cloud_lro::internal::new_poller(
1175 polling_error_policy,
1176 polling_backoff_policy,
1177 start,
1178 query,
1179 )
1180 }
1181
1182 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1186 self.0.request.parent = v.into();
1187 self
1188 }
1189
1190 pub fn set_glossary<T>(mut self, v: T) -> Self
1194 where
1195 T: std::convert::Into<crate::model::Glossary>,
1196 {
1197 self.0.request.glossary = std::option::Option::Some(v.into());
1198 self
1199 }
1200
1201 pub fn set_or_clear_glossary<T>(mut self, v: std::option::Option<T>) -> Self
1205 where
1206 T: std::convert::Into<crate::model::Glossary>,
1207 {
1208 self.0.request.glossary = v.map(|x| x.into());
1209 self
1210 }
1211 }
1212
1213 #[doc(hidden)]
1214 impl crate::RequestBuilder for CreateGlossary {
1215 fn request_options(&mut self) -> &mut crate::RequestOptions {
1216 &mut self.0.options
1217 }
1218 }
1219
1220 #[derive(Clone, Debug)]
1238 pub struct UpdateGlossary(RequestBuilder<crate::model::UpdateGlossaryRequest>);
1239
1240 impl UpdateGlossary {
1241 pub(crate) fn new(
1242 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
1243 ) -> Self {
1244 Self(RequestBuilder::new(stub))
1245 }
1246
1247 pub fn with_request<V: Into<crate::model::UpdateGlossaryRequest>>(mut self, v: V) -> Self {
1249 self.0.request = v.into();
1250 self
1251 }
1252
1253 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1255 self.0.options = v.into();
1256 self
1257 }
1258
1259 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1266 (*self.0.stub)
1267 .update_glossary(self.0.request, self.0.options)
1268 .await
1269 .map(crate::Response::into_body)
1270 }
1271
1272 pub fn poller(
1274 self,
1275 ) -> impl google_cloud_lro::Poller<crate::model::Glossary, crate::model::UpdateGlossaryMetadata>
1276 {
1277 type Operation = google_cloud_lro::internal::Operation<
1278 crate::model::Glossary,
1279 crate::model::UpdateGlossaryMetadata,
1280 >;
1281 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1282 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1283
1284 let stub = self.0.stub.clone();
1285 let mut options = self.0.options.clone();
1286 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1287 let query = move |name| {
1288 let stub = stub.clone();
1289 let options = options.clone();
1290 async {
1291 let op = GetOperation::new(stub)
1292 .set_name(name)
1293 .with_options(options)
1294 .send()
1295 .await?;
1296 Ok(Operation::new(op))
1297 }
1298 };
1299
1300 let start = move || async {
1301 let op = self.send().await?;
1302 Ok(Operation::new(op))
1303 };
1304
1305 google_cloud_lro::internal::new_poller(
1306 polling_error_policy,
1307 polling_backoff_policy,
1308 start,
1309 query,
1310 )
1311 }
1312
1313 pub fn set_glossary<T>(mut self, v: T) -> Self
1317 where
1318 T: std::convert::Into<crate::model::Glossary>,
1319 {
1320 self.0.request.glossary = std::option::Option::Some(v.into());
1321 self
1322 }
1323
1324 pub fn set_or_clear_glossary<T>(mut self, v: std::option::Option<T>) -> Self
1328 where
1329 T: std::convert::Into<crate::model::Glossary>,
1330 {
1331 self.0.request.glossary = v.map(|x| x.into());
1332 self
1333 }
1334
1335 pub fn set_update_mask<T>(mut self, v: T) -> Self
1337 where
1338 T: std::convert::Into<wkt::FieldMask>,
1339 {
1340 self.0.request.update_mask = std::option::Option::Some(v.into());
1341 self
1342 }
1343
1344 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1346 where
1347 T: std::convert::Into<wkt::FieldMask>,
1348 {
1349 self.0.request.update_mask = v.map(|x| x.into());
1350 self
1351 }
1352 }
1353
1354 #[doc(hidden)]
1355 impl crate::RequestBuilder for UpdateGlossary {
1356 fn request_options(&mut self) -> &mut crate::RequestOptions {
1357 &mut self.0.options
1358 }
1359 }
1360
1361 #[derive(Clone, Debug)]
1382 pub struct ListGlossaries(RequestBuilder<crate::model::ListGlossariesRequest>);
1383
1384 impl ListGlossaries {
1385 pub(crate) fn new(
1386 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
1387 ) -> Self {
1388 Self(RequestBuilder::new(stub))
1389 }
1390
1391 pub fn with_request<V: Into<crate::model::ListGlossariesRequest>>(mut self, v: V) -> Self {
1393 self.0.request = v.into();
1394 self
1395 }
1396
1397 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1399 self.0.options = v.into();
1400 self
1401 }
1402
1403 pub async fn send(self) -> Result<crate::model::ListGlossariesResponse> {
1405 (*self.0.stub)
1406 .list_glossaries(self.0.request, self.0.options)
1407 .await
1408 .map(crate::Response::into_body)
1409 }
1410
1411 pub fn by_page(
1413 self,
1414 ) -> impl google_cloud_gax::paginator::Paginator<
1415 crate::model::ListGlossariesResponse,
1416 crate::Error,
1417 > {
1418 use std::clone::Clone;
1419 let token = self.0.request.page_token.clone();
1420 let execute = move |token: String| {
1421 let mut builder = self.clone();
1422 builder.0.request = builder.0.request.set_page_token(token);
1423 builder.send()
1424 };
1425 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1426 }
1427
1428 pub fn by_item(
1430 self,
1431 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1432 crate::model::ListGlossariesResponse,
1433 crate::Error,
1434 > {
1435 use google_cloud_gax::paginator::Paginator;
1436 self.by_page().items()
1437 }
1438
1439 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1443 self.0.request.parent = v.into();
1444 self
1445 }
1446
1447 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1449 self.0.request.page_size = v.into();
1450 self
1451 }
1452
1453 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1455 self.0.request.page_token = v.into();
1456 self
1457 }
1458
1459 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1461 self.0.request.filter = v.into();
1462 self
1463 }
1464 }
1465
1466 #[doc(hidden)]
1467 impl crate::RequestBuilder for ListGlossaries {
1468 fn request_options(&mut self) -> &mut crate::RequestOptions {
1469 &mut self.0.options
1470 }
1471 }
1472
1473 #[derive(Clone, Debug)]
1490 pub struct GetGlossary(RequestBuilder<crate::model::GetGlossaryRequest>);
1491
1492 impl GetGlossary {
1493 pub(crate) fn new(
1494 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
1495 ) -> Self {
1496 Self(RequestBuilder::new(stub))
1497 }
1498
1499 pub fn with_request<V: Into<crate::model::GetGlossaryRequest>>(mut self, v: V) -> Self {
1501 self.0.request = v.into();
1502 self
1503 }
1504
1505 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1507 self.0.options = v.into();
1508 self
1509 }
1510
1511 pub async fn send(self) -> Result<crate::model::Glossary> {
1513 (*self.0.stub)
1514 .get_glossary(self.0.request, self.0.options)
1515 .await
1516 .map(crate::Response::into_body)
1517 }
1518
1519 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1523 self.0.request.name = v.into();
1524 self
1525 }
1526 }
1527
1528 #[doc(hidden)]
1529 impl crate::RequestBuilder for GetGlossary {
1530 fn request_options(&mut self) -> &mut crate::RequestOptions {
1531 &mut self.0.options
1532 }
1533 }
1534
1535 #[derive(Clone, Debug)]
1553 pub struct DeleteGlossary(RequestBuilder<crate::model::DeleteGlossaryRequest>);
1554
1555 impl DeleteGlossary {
1556 pub(crate) fn new(
1557 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
1558 ) -> Self {
1559 Self(RequestBuilder::new(stub))
1560 }
1561
1562 pub fn with_request<V: Into<crate::model::DeleteGlossaryRequest>>(mut self, v: V) -> Self {
1564 self.0.request = v.into();
1565 self
1566 }
1567
1568 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1570 self.0.options = v.into();
1571 self
1572 }
1573
1574 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1581 (*self.0.stub)
1582 .delete_glossary(self.0.request, self.0.options)
1583 .await
1584 .map(crate::Response::into_body)
1585 }
1586
1587 pub fn poller(
1589 self,
1590 ) -> impl google_cloud_lro::Poller<
1591 crate::model::DeleteGlossaryResponse,
1592 crate::model::DeleteGlossaryMetadata,
1593 > {
1594 type Operation = google_cloud_lro::internal::Operation<
1595 crate::model::DeleteGlossaryResponse,
1596 crate::model::DeleteGlossaryMetadata,
1597 >;
1598 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1599 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1600
1601 let stub = self.0.stub.clone();
1602 let mut options = self.0.options.clone();
1603 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1604 let query = move |name| {
1605 let stub = stub.clone();
1606 let options = options.clone();
1607 async {
1608 let op = GetOperation::new(stub)
1609 .set_name(name)
1610 .with_options(options)
1611 .send()
1612 .await?;
1613 Ok(Operation::new(op))
1614 }
1615 };
1616
1617 let start = move || async {
1618 let op = self.send().await?;
1619 Ok(Operation::new(op))
1620 };
1621
1622 google_cloud_lro::internal::new_poller(
1623 polling_error_policy,
1624 polling_backoff_policy,
1625 start,
1626 query,
1627 )
1628 }
1629
1630 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1634 self.0.request.name = v.into();
1635 self
1636 }
1637 }
1638
1639 #[doc(hidden)]
1640 impl crate::RequestBuilder for DeleteGlossary {
1641 fn request_options(&mut self) -> &mut crate::RequestOptions {
1642 &mut self.0.options
1643 }
1644 }
1645
1646 #[derive(Clone, Debug)]
1663 pub struct GetGlossaryEntry(RequestBuilder<crate::model::GetGlossaryEntryRequest>);
1664
1665 impl GetGlossaryEntry {
1666 pub(crate) fn new(
1667 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
1668 ) -> Self {
1669 Self(RequestBuilder::new(stub))
1670 }
1671
1672 pub fn with_request<V: Into<crate::model::GetGlossaryEntryRequest>>(
1674 mut self,
1675 v: V,
1676 ) -> Self {
1677 self.0.request = v.into();
1678 self
1679 }
1680
1681 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1683 self.0.options = v.into();
1684 self
1685 }
1686
1687 pub async fn send(self) -> Result<crate::model::GlossaryEntry> {
1689 (*self.0.stub)
1690 .get_glossary_entry(self.0.request, self.0.options)
1691 .await
1692 .map(crate::Response::into_body)
1693 }
1694
1695 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1699 self.0.request.name = v.into();
1700 self
1701 }
1702 }
1703
1704 #[doc(hidden)]
1705 impl crate::RequestBuilder for GetGlossaryEntry {
1706 fn request_options(&mut self) -> &mut crate::RequestOptions {
1707 &mut self.0.options
1708 }
1709 }
1710
1711 #[derive(Clone, Debug)]
1732 pub struct ListGlossaryEntries(RequestBuilder<crate::model::ListGlossaryEntriesRequest>);
1733
1734 impl ListGlossaryEntries {
1735 pub(crate) fn new(
1736 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
1737 ) -> Self {
1738 Self(RequestBuilder::new(stub))
1739 }
1740
1741 pub fn with_request<V: Into<crate::model::ListGlossaryEntriesRequest>>(
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<crate::model::ListGlossaryEntriesResponse> {
1758 (*self.0.stub)
1759 .list_glossary_entries(self.0.request, self.0.options)
1760 .await
1761 .map(crate::Response::into_body)
1762 }
1763
1764 pub fn by_page(
1766 self,
1767 ) -> impl google_cloud_gax::paginator::Paginator<
1768 crate::model::ListGlossaryEntriesResponse,
1769 crate::Error,
1770 > {
1771 use std::clone::Clone;
1772 let token = self.0.request.page_token.clone();
1773 let execute = move |token: String| {
1774 let mut builder = self.clone();
1775 builder.0.request = builder.0.request.set_page_token(token);
1776 builder.send()
1777 };
1778 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1779 }
1780
1781 pub fn by_item(
1783 self,
1784 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1785 crate::model::ListGlossaryEntriesResponse,
1786 crate::Error,
1787 > {
1788 use google_cloud_gax::paginator::Paginator;
1789 self.by_page().items()
1790 }
1791
1792 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1796 self.0.request.parent = v.into();
1797 self
1798 }
1799
1800 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1802 self.0.request.page_size = v.into();
1803 self
1804 }
1805
1806 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1808 self.0.request.page_token = v.into();
1809 self
1810 }
1811 }
1812
1813 #[doc(hidden)]
1814 impl crate::RequestBuilder for ListGlossaryEntries {
1815 fn request_options(&mut self) -> &mut crate::RequestOptions {
1816 &mut self.0.options
1817 }
1818 }
1819
1820 #[derive(Clone, Debug)]
1837 pub struct CreateGlossaryEntry(RequestBuilder<crate::model::CreateGlossaryEntryRequest>);
1838
1839 impl CreateGlossaryEntry {
1840 pub(crate) fn new(
1841 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
1842 ) -> Self {
1843 Self(RequestBuilder::new(stub))
1844 }
1845
1846 pub fn with_request<V: Into<crate::model::CreateGlossaryEntryRequest>>(
1848 mut self,
1849 v: V,
1850 ) -> Self {
1851 self.0.request = v.into();
1852 self
1853 }
1854
1855 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1857 self.0.options = v.into();
1858 self
1859 }
1860
1861 pub async fn send(self) -> Result<crate::model::GlossaryEntry> {
1863 (*self.0.stub)
1864 .create_glossary_entry(self.0.request, self.0.options)
1865 .await
1866 .map(crate::Response::into_body)
1867 }
1868
1869 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1873 self.0.request.parent = v.into();
1874 self
1875 }
1876
1877 pub fn set_glossary_entry<T>(mut self, v: T) -> Self
1881 where
1882 T: std::convert::Into<crate::model::GlossaryEntry>,
1883 {
1884 self.0.request.glossary_entry = std::option::Option::Some(v.into());
1885 self
1886 }
1887
1888 pub fn set_or_clear_glossary_entry<T>(mut self, v: std::option::Option<T>) -> Self
1892 where
1893 T: std::convert::Into<crate::model::GlossaryEntry>,
1894 {
1895 self.0.request.glossary_entry = v.map(|x| x.into());
1896 self
1897 }
1898 }
1899
1900 #[doc(hidden)]
1901 impl crate::RequestBuilder for CreateGlossaryEntry {
1902 fn request_options(&mut self) -> &mut crate::RequestOptions {
1903 &mut self.0.options
1904 }
1905 }
1906
1907 #[derive(Clone, Debug)]
1924 pub struct UpdateGlossaryEntry(RequestBuilder<crate::model::UpdateGlossaryEntryRequest>);
1925
1926 impl UpdateGlossaryEntry {
1927 pub(crate) fn new(
1928 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
1929 ) -> Self {
1930 Self(RequestBuilder::new(stub))
1931 }
1932
1933 pub fn with_request<V: Into<crate::model::UpdateGlossaryEntryRequest>>(
1935 mut self,
1936 v: V,
1937 ) -> Self {
1938 self.0.request = v.into();
1939 self
1940 }
1941
1942 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1944 self.0.options = v.into();
1945 self
1946 }
1947
1948 pub async fn send(self) -> Result<crate::model::GlossaryEntry> {
1950 (*self.0.stub)
1951 .update_glossary_entry(self.0.request, self.0.options)
1952 .await
1953 .map(crate::Response::into_body)
1954 }
1955
1956 pub fn set_glossary_entry<T>(mut self, v: T) -> Self
1960 where
1961 T: std::convert::Into<crate::model::GlossaryEntry>,
1962 {
1963 self.0.request.glossary_entry = std::option::Option::Some(v.into());
1964 self
1965 }
1966
1967 pub fn set_or_clear_glossary_entry<T>(mut self, v: std::option::Option<T>) -> Self
1971 where
1972 T: std::convert::Into<crate::model::GlossaryEntry>,
1973 {
1974 self.0.request.glossary_entry = v.map(|x| x.into());
1975 self
1976 }
1977 }
1978
1979 #[doc(hidden)]
1980 impl crate::RequestBuilder for UpdateGlossaryEntry {
1981 fn request_options(&mut self) -> &mut crate::RequestOptions {
1982 &mut self.0.options
1983 }
1984 }
1985
1986 #[derive(Clone, Debug)]
2003 pub struct DeleteGlossaryEntry(RequestBuilder<crate::model::DeleteGlossaryEntryRequest>);
2004
2005 impl DeleteGlossaryEntry {
2006 pub(crate) fn new(
2007 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
2008 ) -> Self {
2009 Self(RequestBuilder::new(stub))
2010 }
2011
2012 pub fn with_request<V: Into<crate::model::DeleteGlossaryEntryRequest>>(
2014 mut self,
2015 v: V,
2016 ) -> Self {
2017 self.0.request = v.into();
2018 self
2019 }
2020
2021 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2023 self.0.options = v.into();
2024 self
2025 }
2026
2027 pub async fn send(self) -> Result<()> {
2029 (*self.0.stub)
2030 .delete_glossary_entry(self.0.request, self.0.options)
2031 .await
2032 .map(crate::Response::into_body)
2033 }
2034
2035 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2039 self.0.request.name = v.into();
2040 self
2041 }
2042 }
2043
2044 #[doc(hidden)]
2045 impl crate::RequestBuilder for DeleteGlossaryEntry {
2046 fn request_options(&mut self) -> &mut crate::RequestOptions {
2047 &mut self.0.options
2048 }
2049 }
2050
2051 #[derive(Clone, Debug)]
2069 pub struct CreateDataset(RequestBuilder<crate::model::CreateDatasetRequest>);
2070
2071 impl CreateDataset {
2072 pub(crate) fn new(
2073 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
2074 ) -> Self {
2075 Self(RequestBuilder::new(stub))
2076 }
2077
2078 pub fn with_request<V: Into<crate::model::CreateDatasetRequest>>(mut self, v: V) -> Self {
2080 self.0.request = v.into();
2081 self
2082 }
2083
2084 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2086 self.0.options = v.into();
2087 self
2088 }
2089
2090 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2097 (*self.0.stub)
2098 .create_dataset(self.0.request, self.0.options)
2099 .await
2100 .map(crate::Response::into_body)
2101 }
2102
2103 pub fn poller(
2105 self,
2106 ) -> impl google_cloud_lro::Poller<crate::model::Dataset, crate::model::CreateDatasetMetadata>
2107 {
2108 type Operation = google_cloud_lro::internal::Operation<
2109 crate::model::Dataset,
2110 crate::model::CreateDatasetMetadata,
2111 >;
2112 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2113 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
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 google_cloud_lro::internal::new_poller(
2137 polling_error_policy,
2138 polling_backoff_policy,
2139 start,
2140 query,
2141 )
2142 }
2143
2144 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2148 self.0.request.parent = v.into();
2149 self
2150 }
2151
2152 pub fn set_dataset<T>(mut self, v: T) -> Self
2156 where
2157 T: std::convert::Into<crate::model::Dataset>,
2158 {
2159 self.0.request.dataset = std::option::Option::Some(v.into());
2160 self
2161 }
2162
2163 pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
2167 where
2168 T: std::convert::Into<crate::model::Dataset>,
2169 {
2170 self.0.request.dataset = v.map(|x| x.into());
2171 self
2172 }
2173 }
2174
2175 #[doc(hidden)]
2176 impl crate::RequestBuilder for CreateDataset {
2177 fn request_options(&mut self) -> &mut crate::RequestOptions {
2178 &mut self.0.options
2179 }
2180 }
2181
2182 #[derive(Clone, Debug)]
2199 pub struct GetDataset(RequestBuilder<crate::model::GetDatasetRequest>);
2200
2201 impl GetDataset {
2202 pub(crate) fn new(
2203 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
2204 ) -> Self {
2205 Self(RequestBuilder::new(stub))
2206 }
2207
2208 pub fn with_request<V: Into<crate::model::GetDatasetRequest>>(mut self, v: V) -> Self {
2210 self.0.request = v.into();
2211 self
2212 }
2213
2214 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2216 self.0.options = v.into();
2217 self
2218 }
2219
2220 pub async fn send(self) -> Result<crate::model::Dataset> {
2222 (*self.0.stub)
2223 .get_dataset(self.0.request, self.0.options)
2224 .await
2225 .map(crate::Response::into_body)
2226 }
2227
2228 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2232 self.0.request.name = v.into();
2233 self
2234 }
2235 }
2236
2237 #[doc(hidden)]
2238 impl crate::RequestBuilder for GetDataset {
2239 fn request_options(&mut self) -> &mut crate::RequestOptions {
2240 &mut self.0.options
2241 }
2242 }
2243
2244 #[derive(Clone, Debug)]
2265 pub struct ListDatasets(RequestBuilder<crate::model::ListDatasetsRequest>);
2266
2267 impl ListDatasets {
2268 pub(crate) fn new(
2269 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
2270 ) -> Self {
2271 Self(RequestBuilder::new(stub))
2272 }
2273
2274 pub fn with_request<V: Into<crate::model::ListDatasetsRequest>>(mut self, v: V) -> Self {
2276 self.0.request = v.into();
2277 self
2278 }
2279
2280 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2282 self.0.options = v.into();
2283 self
2284 }
2285
2286 pub async fn send(self) -> Result<crate::model::ListDatasetsResponse> {
2288 (*self.0.stub)
2289 .list_datasets(self.0.request, self.0.options)
2290 .await
2291 .map(crate::Response::into_body)
2292 }
2293
2294 pub fn by_page(
2296 self,
2297 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDatasetsResponse, crate::Error>
2298 {
2299 use std::clone::Clone;
2300 let token = self.0.request.page_token.clone();
2301 let execute = move |token: String| {
2302 let mut builder = self.clone();
2303 builder.0.request = builder.0.request.set_page_token(token);
2304 builder.send()
2305 };
2306 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2307 }
2308
2309 pub fn by_item(
2311 self,
2312 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2313 crate::model::ListDatasetsResponse,
2314 crate::Error,
2315 > {
2316 use google_cloud_gax::paginator::Paginator;
2317 self.by_page().items()
2318 }
2319
2320 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2324 self.0.request.parent = v.into();
2325 self
2326 }
2327
2328 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2330 self.0.request.page_size = v.into();
2331 self
2332 }
2333
2334 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2336 self.0.request.page_token = v.into();
2337 self
2338 }
2339 }
2340
2341 #[doc(hidden)]
2342 impl crate::RequestBuilder for ListDatasets {
2343 fn request_options(&mut self) -> &mut crate::RequestOptions {
2344 &mut self.0.options
2345 }
2346 }
2347
2348 #[derive(Clone, Debug)]
2366 pub struct DeleteDataset(RequestBuilder<crate::model::DeleteDatasetRequest>);
2367
2368 impl DeleteDataset {
2369 pub(crate) fn new(
2370 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
2371 ) -> Self {
2372 Self(RequestBuilder::new(stub))
2373 }
2374
2375 pub fn with_request<V: Into<crate::model::DeleteDatasetRequest>>(mut self, v: V) -> Self {
2377 self.0.request = v.into();
2378 self
2379 }
2380
2381 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2383 self.0.options = v.into();
2384 self
2385 }
2386
2387 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2394 (*self.0.stub)
2395 .delete_dataset(self.0.request, self.0.options)
2396 .await
2397 .map(crate::Response::into_body)
2398 }
2399
2400 pub fn poller(
2402 self,
2403 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteDatasetMetadata> {
2404 type Operation = google_cloud_lro::internal::Operation<
2405 wkt::Empty,
2406 crate::model::DeleteDatasetMetadata,
2407 >;
2408 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2409 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2410
2411 let stub = self.0.stub.clone();
2412 let mut options = self.0.options.clone();
2413 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2414 let query = move |name| {
2415 let stub = stub.clone();
2416 let options = options.clone();
2417 async {
2418 let op = GetOperation::new(stub)
2419 .set_name(name)
2420 .with_options(options)
2421 .send()
2422 .await?;
2423 Ok(Operation::new(op))
2424 }
2425 };
2426
2427 let start = move || async {
2428 let op = self.send().await?;
2429 Ok(Operation::new(op))
2430 };
2431
2432 google_cloud_lro::internal::new_unit_response_poller(
2433 polling_error_policy,
2434 polling_backoff_policy,
2435 start,
2436 query,
2437 )
2438 }
2439
2440 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2444 self.0.request.name = v.into();
2445 self
2446 }
2447 }
2448
2449 #[doc(hidden)]
2450 impl crate::RequestBuilder for DeleteDataset {
2451 fn request_options(&mut self) -> &mut crate::RequestOptions {
2452 &mut self.0.options
2453 }
2454 }
2455
2456 #[derive(Clone, Debug)]
2473 pub struct CreateAdaptiveMtDataset(
2474 RequestBuilder<crate::model::CreateAdaptiveMtDatasetRequest>,
2475 );
2476
2477 impl CreateAdaptiveMtDataset {
2478 pub(crate) fn new(
2479 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
2480 ) -> Self {
2481 Self(RequestBuilder::new(stub))
2482 }
2483
2484 pub fn with_request<V: Into<crate::model::CreateAdaptiveMtDatasetRequest>>(
2486 mut self,
2487 v: V,
2488 ) -> Self {
2489 self.0.request = v.into();
2490 self
2491 }
2492
2493 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2495 self.0.options = v.into();
2496 self
2497 }
2498
2499 pub async fn send(self) -> Result<crate::model::AdaptiveMtDataset> {
2501 (*self.0.stub)
2502 .create_adaptive_mt_dataset(self.0.request, self.0.options)
2503 .await
2504 .map(crate::Response::into_body)
2505 }
2506
2507 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2511 self.0.request.parent = v.into();
2512 self
2513 }
2514
2515 pub fn set_adaptive_mt_dataset<T>(mut self, v: T) -> Self
2519 where
2520 T: std::convert::Into<crate::model::AdaptiveMtDataset>,
2521 {
2522 self.0.request.adaptive_mt_dataset = std::option::Option::Some(v.into());
2523 self
2524 }
2525
2526 pub fn set_or_clear_adaptive_mt_dataset<T>(mut self, v: std::option::Option<T>) -> Self
2530 where
2531 T: std::convert::Into<crate::model::AdaptiveMtDataset>,
2532 {
2533 self.0.request.adaptive_mt_dataset = v.map(|x| x.into());
2534 self
2535 }
2536 }
2537
2538 #[doc(hidden)]
2539 impl crate::RequestBuilder for CreateAdaptiveMtDataset {
2540 fn request_options(&mut self) -> &mut crate::RequestOptions {
2541 &mut self.0.options
2542 }
2543 }
2544
2545 #[derive(Clone, Debug)]
2562 pub struct DeleteAdaptiveMtDataset(
2563 RequestBuilder<crate::model::DeleteAdaptiveMtDatasetRequest>,
2564 );
2565
2566 impl DeleteAdaptiveMtDataset {
2567 pub(crate) fn new(
2568 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
2569 ) -> Self {
2570 Self(RequestBuilder::new(stub))
2571 }
2572
2573 pub fn with_request<V: Into<crate::model::DeleteAdaptiveMtDatasetRequest>>(
2575 mut self,
2576 v: V,
2577 ) -> Self {
2578 self.0.request = v.into();
2579 self
2580 }
2581
2582 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2584 self.0.options = v.into();
2585 self
2586 }
2587
2588 pub async fn send(self) -> Result<()> {
2590 (*self.0.stub)
2591 .delete_adaptive_mt_dataset(self.0.request, self.0.options)
2592 .await
2593 .map(crate::Response::into_body)
2594 }
2595
2596 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2600 self.0.request.name = v.into();
2601 self
2602 }
2603 }
2604
2605 #[doc(hidden)]
2606 impl crate::RequestBuilder for DeleteAdaptiveMtDataset {
2607 fn request_options(&mut self) -> &mut crate::RequestOptions {
2608 &mut self.0.options
2609 }
2610 }
2611
2612 #[derive(Clone, Debug)]
2629 pub struct GetAdaptiveMtDataset(RequestBuilder<crate::model::GetAdaptiveMtDatasetRequest>);
2630
2631 impl GetAdaptiveMtDataset {
2632 pub(crate) fn new(
2633 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
2634 ) -> Self {
2635 Self(RequestBuilder::new(stub))
2636 }
2637
2638 pub fn with_request<V: Into<crate::model::GetAdaptiveMtDatasetRequest>>(
2640 mut self,
2641 v: V,
2642 ) -> Self {
2643 self.0.request = v.into();
2644 self
2645 }
2646
2647 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2649 self.0.options = v.into();
2650 self
2651 }
2652
2653 pub async fn send(self) -> Result<crate::model::AdaptiveMtDataset> {
2655 (*self.0.stub)
2656 .get_adaptive_mt_dataset(self.0.request, self.0.options)
2657 .await
2658 .map(crate::Response::into_body)
2659 }
2660
2661 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2665 self.0.request.name = v.into();
2666 self
2667 }
2668 }
2669
2670 #[doc(hidden)]
2671 impl crate::RequestBuilder for GetAdaptiveMtDataset {
2672 fn request_options(&mut self) -> &mut crate::RequestOptions {
2673 &mut self.0.options
2674 }
2675 }
2676
2677 #[derive(Clone, Debug)]
2698 pub struct ListAdaptiveMtDatasets(RequestBuilder<crate::model::ListAdaptiveMtDatasetsRequest>);
2699
2700 impl ListAdaptiveMtDatasets {
2701 pub(crate) fn new(
2702 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
2703 ) -> Self {
2704 Self(RequestBuilder::new(stub))
2705 }
2706
2707 pub fn with_request<V: Into<crate::model::ListAdaptiveMtDatasetsRequest>>(
2709 mut self,
2710 v: V,
2711 ) -> Self {
2712 self.0.request = v.into();
2713 self
2714 }
2715
2716 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2718 self.0.options = v.into();
2719 self
2720 }
2721
2722 pub async fn send(self) -> Result<crate::model::ListAdaptiveMtDatasetsResponse> {
2724 (*self.0.stub)
2725 .list_adaptive_mt_datasets(self.0.request, self.0.options)
2726 .await
2727 .map(crate::Response::into_body)
2728 }
2729
2730 pub fn by_page(
2732 self,
2733 ) -> impl google_cloud_gax::paginator::Paginator<
2734 crate::model::ListAdaptiveMtDatasetsResponse,
2735 crate::Error,
2736 > {
2737 use std::clone::Clone;
2738 let token = self.0.request.page_token.clone();
2739 let execute = move |token: String| {
2740 let mut builder = self.clone();
2741 builder.0.request = builder.0.request.set_page_token(token);
2742 builder.send()
2743 };
2744 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2745 }
2746
2747 pub fn by_item(
2749 self,
2750 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2751 crate::model::ListAdaptiveMtDatasetsResponse,
2752 crate::Error,
2753 > {
2754 use google_cloud_gax::paginator::Paginator;
2755 self.by_page().items()
2756 }
2757
2758 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2762 self.0.request.parent = v.into();
2763 self
2764 }
2765
2766 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2768 self.0.request.page_size = v.into();
2769 self
2770 }
2771
2772 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2774 self.0.request.page_token = v.into();
2775 self
2776 }
2777
2778 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2780 self.0.request.filter = v.into();
2781 self
2782 }
2783 }
2784
2785 #[doc(hidden)]
2786 impl crate::RequestBuilder for ListAdaptiveMtDatasets {
2787 fn request_options(&mut self) -> &mut crate::RequestOptions {
2788 &mut self.0.options
2789 }
2790 }
2791
2792 #[derive(Clone, Debug)]
2809 pub struct AdaptiveMtTranslate(RequestBuilder<crate::model::AdaptiveMtTranslateRequest>);
2810
2811 impl AdaptiveMtTranslate {
2812 pub(crate) fn new(
2813 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
2814 ) -> Self {
2815 Self(RequestBuilder::new(stub))
2816 }
2817
2818 pub fn with_request<V: Into<crate::model::AdaptiveMtTranslateRequest>>(
2820 mut self,
2821 v: V,
2822 ) -> Self {
2823 self.0.request = v.into();
2824 self
2825 }
2826
2827 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2829 self.0.options = v.into();
2830 self
2831 }
2832
2833 pub async fn send(self) -> Result<crate::model::AdaptiveMtTranslateResponse> {
2835 (*self.0.stub)
2836 .adaptive_mt_translate(self.0.request, self.0.options)
2837 .await
2838 .map(crate::Response::into_body)
2839 }
2840
2841 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2845 self.0.request.parent = v.into();
2846 self
2847 }
2848
2849 pub fn set_dataset<T: Into<std::string::String>>(mut self, v: T) -> Self {
2853 self.0.request.dataset = v.into();
2854 self
2855 }
2856
2857 pub fn set_content<T, V>(mut self, v: T) -> Self
2861 where
2862 T: std::iter::IntoIterator<Item = V>,
2863 V: std::convert::Into<std::string::String>,
2864 {
2865 use std::iter::Iterator;
2866 self.0.request.content = v.into_iter().map(|i| i.into()).collect();
2867 self
2868 }
2869
2870 pub fn set_reference_sentence_config<T>(mut self, v: T) -> Self
2872 where
2873 T: std::convert::Into<
2874 crate::model::adaptive_mt_translate_request::ReferenceSentenceConfig,
2875 >,
2876 {
2877 self.0.request.reference_sentence_config = std::option::Option::Some(v.into());
2878 self
2879 }
2880
2881 pub fn set_or_clear_reference_sentence_config<T>(
2883 mut self,
2884 v: std::option::Option<T>,
2885 ) -> Self
2886 where
2887 T: std::convert::Into<
2888 crate::model::adaptive_mt_translate_request::ReferenceSentenceConfig,
2889 >,
2890 {
2891 self.0.request.reference_sentence_config = v.map(|x| x.into());
2892 self
2893 }
2894
2895 pub fn set_glossary_config<T>(mut self, v: T) -> Self
2897 where
2898 T: std::convert::Into<crate::model::adaptive_mt_translate_request::GlossaryConfig>,
2899 {
2900 self.0.request.glossary_config = std::option::Option::Some(v.into());
2901 self
2902 }
2903
2904 pub fn set_or_clear_glossary_config<T>(mut self, v: std::option::Option<T>) -> Self
2906 where
2907 T: std::convert::Into<crate::model::adaptive_mt_translate_request::GlossaryConfig>,
2908 {
2909 self.0.request.glossary_config = v.map(|x| x.into());
2910 self
2911 }
2912 }
2913
2914 #[doc(hidden)]
2915 impl crate::RequestBuilder for AdaptiveMtTranslate {
2916 fn request_options(&mut self) -> &mut crate::RequestOptions {
2917 &mut self.0.options
2918 }
2919 }
2920
2921 #[derive(Clone, Debug)]
2938 pub struct GetAdaptiveMtFile(RequestBuilder<crate::model::GetAdaptiveMtFileRequest>);
2939
2940 impl GetAdaptiveMtFile {
2941 pub(crate) fn new(
2942 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
2943 ) -> Self {
2944 Self(RequestBuilder::new(stub))
2945 }
2946
2947 pub fn with_request<V: Into<crate::model::GetAdaptiveMtFileRequest>>(
2949 mut self,
2950 v: V,
2951 ) -> Self {
2952 self.0.request = v.into();
2953 self
2954 }
2955
2956 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2958 self.0.options = v.into();
2959 self
2960 }
2961
2962 pub async fn send(self) -> Result<crate::model::AdaptiveMtFile> {
2964 (*self.0.stub)
2965 .get_adaptive_mt_file(self.0.request, self.0.options)
2966 .await
2967 .map(crate::Response::into_body)
2968 }
2969
2970 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2974 self.0.request.name = v.into();
2975 self
2976 }
2977 }
2978
2979 #[doc(hidden)]
2980 impl crate::RequestBuilder for GetAdaptiveMtFile {
2981 fn request_options(&mut self) -> &mut crate::RequestOptions {
2982 &mut self.0.options
2983 }
2984 }
2985
2986 #[derive(Clone, Debug)]
3003 pub struct DeleteAdaptiveMtFile(RequestBuilder<crate::model::DeleteAdaptiveMtFileRequest>);
3004
3005 impl DeleteAdaptiveMtFile {
3006 pub(crate) fn new(
3007 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
3008 ) -> Self {
3009 Self(RequestBuilder::new(stub))
3010 }
3011
3012 pub fn with_request<V: Into<crate::model::DeleteAdaptiveMtFileRequest>>(
3014 mut self,
3015 v: V,
3016 ) -> Self {
3017 self.0.request = v.into();
3018 self
3019 }
3020
3021 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3023 self.0.options = v.into();
3024 self
3025 }
3026
3027 pub async fn send(self) -> Result<()> {
3029 (*self.0.stub)
3030 .delete_adaptive_mt_file(self.0.request, self.0.options)
3031 .await
3032 .map(crate::Response::into_body)
3033 }
3034
3035 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3039 self.0.request.name = v.into();
3040 self
3041 }
3042 }
3043
3044 #[doc(hidden)]
3045 impl crate::RequestBuilder for DeleteAdaptiveMtFile {
3046 fn request_options(&mut self) -> &mut crate::RequestOptions {
3047 &mut self.0.options
3048 }
3049 }
3050
3051 #[derive(Clone, Debug)]
3068 pub struct ImportAdaptiveMtFile(RequestBuilder<crate::model::ImportAdaptiveMtFileRequest>);
3069
3070 impl ImportAdaptiveMtFile {
3071 pub(crate) fn new(
3072 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
3073 ) -> Self {
3074 Self(RequestBuilder::new(stub))
3075 }
3076
3077 pub fn with_request<V: Into<crate::model::ImportAdaptiveMtFileRequest>>(
3079 mut self,
3080 v: V,
3081 ) -> Self {
3082 self.0.request = v.into();
3083 self
3084 }
3085
3086 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3088 self.0.options = v.into();
3089 self
3090 }
3091
3092 pub async fn send(self) -> Result<crate::model::ImportAdaptiveMtFileResponse> {
3094 (*self.0.stub)
3095 .import_adaptive_mt_file(self.0.request, self.0.options)
3096 .await
3097 .map(crate::Response::into_body)
3098 }
3099
3100 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3104 self.0.request.parent = v.into();
3105 self
3106 }
3107
3108 pub fn set_source<
3113 T: Into<Option<crate::model::import_adaptive_mt_file_request::Source>>,
3114 >(
3115 mut self,
3116 v: T,
3117 ) -> Self {
3118 self.0.request.source = v.into();
3119 self
3120 }
3121
3122 pub fn set_file_input_source<
3128 T: std::convert::Into<std::boxed::Box<crate::model::FileInputSource>>,
3129 >(
3130 mut self,
3131 v: T,
3132 ) -> Self {
3133 self.0.request = self.0.request.set_file_input_source(v);
3134 self
3135 }
3136
3137 pub fn set_gcs_input_source<
3143 T: std::convert::Into<std::boxed::Box<crate::model::GcsInputSource>>,
3144 >(
3145 mut self,
3146 v: T,
3147 ) -> Self {
3148 self.0.request = self.0.request.set_gcs_input_source(v);
3149 self
3150 }
3151 }
3152
3153 #[doc(hidden)]
3154 impl crate::RequestBuilder for ImportAdaptiveMtFile {
3155 fn request_options(&mut self) -> &mut crate::RequestOptions {
3156 &mut self.0.options
3157 }
3158 }
3159
3160 #[derive(Clone, Debug)]
3181 pub struct ListAdaptiveMtFiles(RequestBuilder<crate::model::ListAdaptiveMtFilesRequest>);
3182
3183 impl ListAdaptiveMtFiles {
3184 pub(crate) fn new(
3185 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
3186 ) -> Self {
3187 Self(RequestBuilder::new(stub))
3188 }
3189
3190 pub fn with_request<V: Into<crate::model::ListAdaptiveMtFilesRequest>>(
3192 mut self,
3193 v: V,
3194 ) -> Self {
3195 self.0.request = v.into();
3196 self
3197 }
3198
3199 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3201 self.0.options = v.into();
3202 self
3203 }
3204
3205 pub async fn send(self) -> Result<crate::model::ListAdaptiveMtFilesResponse> {
3207 (*self.0.stub)
3208 .list_adaptive_mt_files(self.0.request, self.0.options)
3209 .await
3210 .map(crate::Response::into_body)
3211 }
3212
3213 pub fn by_page(
3215 self,
3216 ) -> impl google_cloud_gax::paginator::Paginator<
3217 crate::model::ListAdaptiveMtFilesResponse,
3218 crate::Error,
3219 > {
3220 use std::clone::Clone;
3221 let token = self.0.request.page_token.clone();
3222 let execute = move |token: String| {
3223 let mut builder = self.clone();
3224 builder.0.request = builder.0.request.set_page_token(token);
3225 builder.send()
3226 };
3227 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3228 }
3229
3230 pub fn by_item(
3232 self,
3233 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3234 crate::model::ListAdaptiveMtFilesResponse,
3235 crate::Error,
3236 > {
3237 use google_cloud_gax::paginator::Paginator;
3238 self.by_page().items()
3239 }
3240
3241 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3245 self.0.request.parent = v.into();
3246 self
3247 }
3248
3249 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3251 self.0.request.page_size = v.into();
3252 self
3253 }
3254
3255 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3257 self.0.request.page_token = v.into();
3258 self
3259 }
3260 }
3261
3262 #[doc(hidden)]
3263 impl crate::RequestBuilder for ListAdaptiveMtFiles {
3264 fn request_options(&mut self) -> &mut crate::RequestOptions {
3265 &mut self.0.options
3266 }
3267 }
3268
3269 #[derive(Clone, Debug)]
3290 pub struct ListAdaptiveMtSentences(
3291 RequestBuilder<crate::model::ListAdaptiveMtSentencesRequest>,
3292 );
3293
3294 impl ListAdaptiveMtSentences {
3295 pub(crate) fn new(
3296 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
3297 ) -> Self {
3298 Self(RequestBuilder::new(stub))
3299 }
3300
3301 pub fn with_request<V: Into<crate::model::ListAdaptiveMtSentencesRequest>>(
3303 mut self,
3304 v: V,
3305 ) -> Self {
3306 self.0.request = v.into();
3307 self
3308 }
3309
3310 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3312 self.0.options = v.into();
3313 self
3314 }
3315
3316 pub async fn send(self) -> Result<crate::model::ListAdaptiveMtSentencesResponse> {
3318 (*self.0.stub)
3319 .list_adaptive_mt_sentences(self.0.request, self.0.options)
3320 .await
3321 .map(crate::Response::into_body)
3322 }
3323
3324 pub fn by_page(
3326 self,
3327 ) -> impl google_cloud_gax::paginator::Paginator<
3328 crate::model::ListAdaptiveMtSentencesResponse,
3329 crate::Error,
3330 > {
3331 use std::clone::Clone;
3332 let token = self.0.request.page_token.clone();
3333 let execute = move |token: String| {
3334 let mut builder = self.clone();
3335 builder.0.request = builder.0.request.set_page_token(token);
3336 builder.send()
3337 };
3338 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3339 }
3340
3341 pub fn by_item(
3343 self,
3344 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3345 crate::model::ListAdaptiveMtSentencesResponse,
3346 crate::Error,
3347 > {
3348 use google_cloud_gax::paginator::Paginator;
3349 self.by_page().items()
3350 }
3351
3352 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3356 self.0.request.parent = v.into();
3357 self
3358 }
3359
3360 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3362 self.0.request.page_size = v.into();
3363 self
3364 }
3365
3366 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3368 self.0.request.page_token = v.into();
3369 self
3370 }
3371 }
3372
3373 #[doc(hidden)]
3374 impl crate::RequestBuilder for ListAdaptiveMtSentences {
3375 fn request_options(&mut self) -> &mut crate::RequestOptions {
3376 &mut self.0.options
3377 }
3378 }
3379
3380 #[derive(Clone, Debug)]
3398 pub struct ImportData(RequestBuilder<crate::model::ImportDataRequest>);
3399
3400 impl ImportData {
3401 pub(crate) fn new(
3402 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
3403 ) -> Self {
3404 Self(RequestBuilder::new(stub))
3405 }
3406
3407 pub fn with_request<V: Into<crate::model::ImportDataRequest>>(mut self, v: V) -> Self {
3409 self.0.request = v.into();
3410 self
3411 }
3412
3413 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3415 self.0.options = v.into();
3416 self
3417 }
3418
3419 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3426 (*self.0.stub)
3427 .import_data(self.0.request, self.0.options)
3428 .await
3429 .map(crate::Response::into_body)
3430 }
3431
3432 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::ImportDataMetadata> {
3434 type Operation =
3435 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::ImportDataMetadata>;
3436 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3437 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3438
3439 let stub = self.0.stub.clone();
3440 let mut options = self.0.options.clone();
3441 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3442 let query = move |name| {
3443 let stub = stub.clone();
3444 let options = options.clone();
3445 async {
3446 let op = GetOperation::new(stub)
3447 .set_name(name)
3448 .with_options(options)
3449 .send()
3450 .await?;
3451 Ok(Operation::new(op))
3452 }
3453 };
3454
3455 let start = move || async {
3456 let op = self.send().await?;
3457 Ok(Operation::new(op))
3458 };
3459
3460 google_cloud_lro::internal::new_unit_response_poller(
3461 polling_error_policy,
3462 polling_backoff_policy,
3463 start,
3464 query,
3465 )
3466 }
3467
3468 pub fn set_dataset<T: Into<std::string::String>>(mut self, v: T) -> Self {
3472 self.0.request.dataset = v.into();
3473 self
3474 }
3475
3476 pub fn set_input_config<T>(mut self, v: T) -> Self
3480 where
3481 T: std::convert::Into<crate::model::DatasetInputConfig>,
3482 {
3483 self.0.request.input_config = std::option::Option::Some(v.into());
3484 self
3485 }
3486
3487 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
3491 where
3492 T: std::convert::Into<crate::model::DatasetInputConfig>,
3493 {
3494 self.0.request.input_config = v.map(|x| x.into());
3495 self
3496 }
3497 }
3498
3499 #[doc(hidden)]
3500 impl crate::RequestBuilder for ImportData {
3501 fn request_options(&mut self) -> &mut crate::RequestOptions {
3502 &mut self.0.options
3503 }
3504 }
3505
3506 #[derive(Clone, Debug)]
3524 pub struct ExportData(RequestBuilder<crate::model::ExportDataRequest>);
3525
3526 impl ExportData {
3527 pub(crate) fn new(
3528 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
3529 ) -> Self {
3530 Self(RequestBuilder::new(stub))
3531 }
3532
3533 pub fn with_request<V: Into<crate::model::ExportDataRequest>>(mut self, v: V) -> Self {
3535 self.0.request = v.into();
3536 self
3537 }
3538
3539 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3541 self.0.options = v.into();
3542 self
3543 }
3544
3545 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3552 (*self.0.stub)
3553 .export_data(self.0.request, self.0.options)
3554 .await
3555 .map(crate::Response::into_body)
3556 }
3557
3558 pub fn poller(self) -> impl google_cloud_lro::Poller<(), crate::model::ExportDataMetadata> {
3560 type Operation =
3561 google_cloud_lro::internal::Operation<wkt::Empty, crate::model::ExportDataMetadata>;
3562 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3563 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3564
3565 let stub = self.0.stub.clone();
3566 let mut options = self.0.options.clone();
3567 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3568 let query = move |name| {
3569 let stub = stub.clone();
3570 let options = options.clone();
3571 async {
3572 let op = GetOperation::new(stub)
3573 .set_name(name)
3574 .with_options(options)
3575 .send()
3576 .await?;
3577 Ok(Operation::new(op))
3578 }
3579 };
3580
3581 let start = move || async {
3582 let op = self.send().await?;
3583 Ok(Operation::new(op))
3584 };
3585
3586 google_cloud_lro::internal::new_unit_response_poller(
3587 polling_error_policy,
3588 polling_backoff_policy,
3589 start,
3590 query,
3591 )
3592 }
3593
3594 pub fn set_dataset<T: Into<std::string::String>>(mut self, v: T) -> Self {
3598 self.0.request.dataset = v.into();
3599 self
3600 }
3601
3602 pub fn set_output_config<T>(mut self, v: T) -> Self
3606 where
3607 T: std::convert::Into<crate::model::DatasetOutputConfig>,
3608 {
3609 self.0.request.output_config = std::option::Option::Some(v.into());
3610 self
3611 }
3612
3613 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
3617 where
3618 T: std::convert::Into<crate::model::DatasetOutputConfig>,
3619 {
3620 self.0.request.output_config = v.map(|x| x.into());
3621 self
3622 }
3623 }
3624
3625 #[doc(hidden)]
3626 impl crate::RequestBuilder for ExportData {
3627 fn request_options(&mut self) -> &mut crate::RequestOptions {
3628 &mut self.0.options
3629 }
3630 }
3631
3632 #[derive(Clone, Debug)]
3653 pub struct ListExamples(RequestBuilder<crate::model::ListExamplesRequest>);
3654
3655 impl ListExamples {
3656 pub(crate) fn new(
3657 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
3658 ) -> Self {
3659 Self(RequestBuilder::new(stub))
3660 }
3661
3662 pub fn with_request<V: Into<crate::model::ListExamplesRequest>>(mut self, v: V) -> Self {
3664 self.0.request = v.into();
3665 self
3666 }
3667
3668 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3670 self.0.options = v.into();
3671 self
3672 }
3673
3674 pub async fn send(self) -> Result<crate::model::ListExamplesResponse> {
3676 (*self.0.stub)
3677 .list_examples(self.0.request, self.0.options)
3678 .await
3679 .map(crate::Response::into_body)
3680 }
3681
3682 pub fn by_page(
3684 self,
3685 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListExamplesResponse, crate::Error>
3686 {
3687 use std::clone::Clone;
3688 let token = self.0.request.page_token.clone();
3689 let execute = move |token: String| {
3690 let mut builder = self.clone();
3691 builder.0.request = builder.0.request.set_page_token(token);
3692 builder.send()
3693 };
3694 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3695 }
3696
3697 pub fn by_item(
3699 self,
3700 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3701 crate::model::ListExamplesResponse,
3702 crate::Error,
3703 > {
3704 use google_cloud_gax::paginator::Paginator;
3705 self.by_page().items()
3706 }
3707
3708 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3712 self.0.request.parent = v.into();
3713 self
3714 }
3715
3716 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3718 self.0.request.filter = v.into();
3719 self
3720 }
3721
3722 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3724 self.0.request.page_size = v.into();
3725 self
3726 }
3727
3728 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3730 self.0.request.page_token = v.into();
3731 self
3732 }
3733 }
3734
3735 #[doc(hidden)]
3736 impl crate::RequestBuilder for ListExamples {
3737 fn request_options(&mut self) -> &mut crate::RequestOptions {
3738 &mut self.0.options
3739 }
3740 }
3741
3742 #[derive(Clone, Debug)]
3760 pub struct CreateModel(RequestBuilder<crate::model::CreateModelRequest>);
3761
3762 impl CreateModel {
3763 pub(crate) fn new(
3764 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
3765 ) -> Self {
3766 Self(RequestBuilder::new(stub))
3767 }
3768
3769 pub fn with_request<V: Into<crate::model::CreateModelRequest>>(mut self, v: V) -> Self {
3771 self.0.request = v.into();
3772 self
3773 }
3774
3775 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3777 self.0.options = v.into();
3778 self
3779 }
3780
3781 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3788 (*self.0.stub)
3789 .create_model(self.0.request, self.0.options)
3790 .await
3791 .map(crate::Response::into_body)
3792 }
3793
3794 pub fn poller(
3796 self,
3797 ) -> impl google_cloud_lro::Poller<crate::model::Model, crate::model::CreateModelMetadata>
3798 {
3799 type Operation = google_cloud_lro::internal::Operation<
3800 crate::model::Model,
3801 crate::model::CreateModelMetadata,
3802 >;
3803 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3804 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3805
3806 let stub = self.0.stub.clone();
3807 let mut options = self.0.options.clone();
3808 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3809 let query = move |name| {
3810 let stub = stub.clone();
3811 let options = options.clone();
3812 async {
3813 let op = GetOperation::new(stub)
3814 .set_name(name)
3815 .with_options(options)
3816 .send()
3817 .await?;
3818 Ok(Operation::new(op))
3819 }
3820 };
3821
3822 let start = move || async {
3823 let op = self.send().await?;
3824 Ok(Operation::new(op))
3825 };
3826
3827 google_cloud_lro::internal::new_poller(
3828 polling_error_policy,
3829 polling_backoff_policy,
3830 start,
3831 query,
3832 )
3833 }
3834
3835 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3839 self.0.request.parent = v.into();
3840 self
3841 }
3842
3843 pub fn set_model<T>(mut self, v: T) -> Self
3847 where
3848 T: std::convert::Into<crate::model::Model>,
3849 {
3850 self.0.request.model = std::option::Option::Some(v.into());
3851 self
3852 }
3853
3854 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
3858 where
3859 T: std::convert::Into<crate::model::Model>,
3860 {
3861 self.0.request.model = v.map(|x| x.into());
3862 self
3863 }
3864 }
3865
3866 #[doc(hidden)]
3867 impl crate::RequestBuilder for CreateModel {
3868 fn request_options(&mut self) -> &mut crate::RequestOptions {
3869 &mut self.0.options
3870 }
3871 }
3872
3873 #[derive(Clone, Debug)]
3894 pub struct ListModels(RequestBuilder<crate::model::ListModelsRequest>);
3895
3896 impl ListModels {
3897 pub(crate) fn new(
3898 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
3899 ) -> Self {
3900 Self(RequestBuilder::new(stub))
3901 }
3902
3903 pub fn with_request<V: Into<crate::model::ListModelsRequest>>(mut self, v: V) -> Self {
3905 self.0.request = v.into();
3906 self
3907 }
3908
3909 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3911 self.0.options = v.into();
3912 self
3913 }
3914
3915 pub async fn send(self) -> Result<crate::model::ListModelsResponse> {
3917 (*self.0.stub)
3918 .list_models(self.0.request, self.0.options)
3919 .await
3920 .map(crate::Response::into_body)
3921 }
3922
3923 pub fn by_page(
3925 self,
3926 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListModelsResponse, crate::Error>
3927 {
3928 use std::clone::Clone;
3929 let token = self.0.request.page_token.clone();
3930 let execute = move |token: String| {
3931 let mut builder = self.clone();
3932 builder.0.request = builder.0.request.set_page_token(token);
3933 builder.send()
3934 };
3935 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3936 }
3937
3938 pub fn by_item(
3940 self,
3941 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3942 crate::model::ListModelsResponse,
3943 crate::Error,
3944 > {
3945 use google_cloud_gax::paginator::Paginator;
3946 self.by_page().items()
3947 }
3948
3949 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3953 self.0.request.parent = v.into();
3954 self
3955 }
3956
3957 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3959 self.0.request.filter = v.into();
3960 self
3961 }
3962
3963 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3965 self.0.request.page_size = v.into();
3966 self
3967 }
3968
3969 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3971 self.0.request.page_token = v.into();
3972 self
3973 }
3974 }
3975
3976 #[doc(hidden)]
3977 impl crate::RequestBuilder for ListModels {
3978 fn request_options(&mut self) -> &mut crate::RequestOptions {
3979 &mut self.0.options
3980 }
3981 }
3982
3983 #[derive(Clone, Debug)]
4000 pub struct GetModel(RequestBuilder<crate::model::GetModelRequest>);
4001
4002 impl GetModel {
4003 pub(crate) fn new(
4004 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
4005 ) -> Self {
4006 Self(RequestBuilder::new(stub))
4007 }
4008
4009 pub fn with_request<V: Into<crate::model::GetModelRequest>>(mut self, v: V) -> Self {
4011 self.0.request = v.into();
4012 self
4013 }
4014
4015 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4017 self.0.options = v.into();
4018 self
4019 }
4020
4021 pub async fn send(self) -> Result<crate::model::Model> {
4023 (*self.0.stub)
4024 .get_model(self.0.request, self.0.options)
4025 .await
4026 .map(crate::Response::into_body)
4027 }
4028
4029 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4033 self.0.request.name = v.into();
4034 self
4035 }
4036 }
4037
4038 #[doc(hidden)]
4039 impl crate::RequestBuilder for GetModel {
4040 fn request_options(&mut self) -> &mut crate::RequestOptions {
4041 &mut self.0.options
4042 }
4043 }
4044
4045 #[derive(Clone, Debug)]
4063 pub struct DeleteModel(RequestBuilder<crate::model::DeleteModelRequest>);
4064
4065 impl DeleteModel {
4066 pub(crate) fn new(
4067 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
4068 ) -> Self {
4069 Self(RequestBuilder::new(stub))
4070 }
4071
4072 pub fn with_request<V: Into<crate::model::DeleteModelRequest>>(mut self, v: V) -> Self {
4074 self.0.request = v.into();
4075 self
4076 }
4077
4078 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4080 self.0.options = v.into();
4081 self
4082 }
4083
4084 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4091 (*self.0.stub)
4092 .delete_model(self.0.request, self.0.options)
4093 .await
4094 .map(crate::Response::into_body)
4095 }
4096
4097 pub fn poller(
4099 self,
4100 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteModelMetadata> {
4101 type Operation = google_cloud_lro::internal::Operation<
4102 wkt::Empty,
4103 crate::model::DeleteModelMetadata,
4104 >;
4105 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4106 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4107
4108 let stub = self.0.stub.clone();
4109 let mut options = self.0.options.clone();
4110 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4111 let query = move |name| {
4112 let stub = stub.clone();
4113 let options = options.clone();
4114 async {
4115 let op = GetOperation::new(stub)
4116 .set_name(name)
4117 .with_options(options)
4118 .send()
4119 .await?;
4120 Ok(Operation::new(op))
4121 }
4122 };
4123
4124 let start = move || async {
4125 let op = self.send().await?;
4126 Ok(Operation::new(op))
4127 };
4128
4129 google_cloud_lro::internal::new_unit_response_poller(
4130 polling_error_policy,
4131 polling_backoff_policy,
4132 start,
4133 query,
4134 )
4135 }
4136
4137 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4141 self.0.request.name = v.into();
4142 self
4143 }
4144 }
4145
4146 #[doc(hidden)]
4147 impl crate::RequestBuilder for DeleteModel {
4148 fn request_options(&mut self) -> &mut crate::RequestOptions {
4149 &mut self.0.options
4150 }
4151 }
4152
4153 #[derive(Clone, Debug)]
4174 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
4175
4176 impl ListLocations {
4177 pub(crate) fn new(
4178 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
4179 ) -> Self {
4180 Self(RequestBuilder::new(stub))
4181 }
4182
4183 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
4185 mut self,
4186 v: V,
4187 ) -> Self {
4188 self.0.request = v.into();
4189 self
4190 }
4191
4192 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4194 self.0.options = v.into();
4195 self
4196 }
4197
4198 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
4200 (*self.0.stub)
4201 .list_locations(self.0.request, self.0.options)
4202 .await
4203 .map(crate::Response::into_body)
4204 }
4205
4206 pub fn by_page(
4208 self,
4209 ) -> impl google_cloud_gax::paginator::Paginator<
4210 google_cloud_location::model::ListLocationsResponse,
4211 crate::Error,
4212 > {
4213 use std::clone::Clone;
4214 let token = self.0.request.page_token.clone();
4215 let execute = move |token: String| {
4216 let mut builder = self.clone();
4217 builder.0.request = builder.0.request.set_page_token(token);
4218 builder.send()
4219 };
4220 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4221 }
4222
4223 pub fn by_item(
4225 self,
4226 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4227 google_cloud_location::model::ListLocationsResponse,
4228 crate::Error,
4229 > {
4230 use google_cloud_gax::paginator::Paginator;
4231 self.by_page().items()
4232 }
4233
4234 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4236 self.0.request.name = v.into();
4237 self
4238 }
4239
4240 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4242 self.0.request.filter = v.into();
4243 self
4244 }
4245
4246 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4248 self.0.request.page_size = v.into();
4249 self
4250 }
4251
4252 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4254 self.0.request.page_token = v.into();
4255 self
4256 }
4257 }
4258
4259 #[doc(hidden)]
4260 impl crate::RequestBuilder for ListLocations {
4261 fn request_options(&mut self) -> &mut crate::RequestOptions {
4262 &mut self.0.options
4263 }
4264 }
4265
4266 #[derive(Clone, Debug)]
4283 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
4284
4285 impl GetLocation {
4286 pub(crate) fn new(
4287 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
4288 ) -> Self {
4289 Self(RequestBuilder::new(stub))
4290 }
4291
4292 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
4294 mut self,
4295 v: V,
4296 ) -> Self {
4297 self.0.request = v.into();
4298 self
4299 }
4300
4301 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4303 self.0.options = v.into();
4304 self
4305 }
4306
4307 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
4309 (*self.0.stub)
4310 .get_location(self.0.request, self.0.options)
4311 .await
4312 .map(crate::Response::into_body)
4313 }
4314
4315 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4317 self.0.request.name = v.into();
4318 self
4319 }
4320 }
4321
4322 #[doc(hidden)]
4323 impl crate::RequestBuilder for GetLocation {
4324 fn request_options(&mut self) -> &mut crate::RequestOptions {
4325 &mut self.0.options
4326 }
4327 }
4328
4329 #[derive(Clone, Debug)]
4350 pub struct ListOperations(
4351 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4352 );
4353
4354 impl ListOperations {
4355 pub(crate) fn new(
4356 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
4357 ) -> Self {
4358 Self(RequestBuilder::new(stub))
4359 }
4360
4361 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4363 mut self,
4364 v: V,
4365 ) -> Self {
4366 self.0.request = v.into();
4367 self
4368 }
4369
4370 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4372 self.0.options = v.into();
4373 self
4374 }
4375
4376 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4378 (*self.0.stub)
4379 .list_operations(self.0.request, self.0.options)
4380 .await
4381 .map(crate::Response::into_body)
4382 }
4383
4384 pub fn by_page(
4386 self,
4387 ) -> impl google_cloud_gax::paginator::Paginator<
4388 google_cloud_longrunning::model::ListOperationsResponse,
4389 crate::Error,
4390 > {
4391 use std::clone::Clone;
4392 let token = self.0.request.page_token.clone();
4393 let execute = move |token: String| {
4394 let mut builder = self.clone();
4395 builder.0.request = builder.0.request.set_page_token(token);
4396 builder.send()
4397 };
4398 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4399 }
4400
4401 pub fn by_item(
4403 self,
4404 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4405 google_cloud_longrunning::model::ListOperationsResponse,
4406 crate::Error,
4407 > {
4408 use google_cloud_gax::paginator::Paginator;
4409 self.by_page().items()
4410 }
4411
4412 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4414 self.0.request.name = v.into();
4415 self
4416 }
4417
4418 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4420 self.0.request.filter = v.into();
4421 self
4422 }
4423
4424 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4426 self.0.request.page_size = v.into();
4427 self
4428 }
4429
4430 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4432 self.0.request.page_token = v.into();
4433 self
4434 }
4435
4436 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4438 self.0.request.return_partial_success = v.into();
4439 self
4440 }
4441 }
4442
4443 #[doc(hidden)]
4444 impl crate::RequestBuilder for ListOperations {
4445 fn request_options(&mut self) -> &mut crate::RequestOptions {
4446 &mut self.0.options
4447 }
4448 }
4449
4450 #[derive(Clone, Debug)]
4467 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4468
4469 impl GetOperation {
4470 pub(crate) fn new(
4471 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
4472 ) -> Self {
4473 Self(RequestBuilder::new(stub))
4474 }
4475
4476 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4478 mut self,
4479 v: V,
4480 ) -> Self {
4481 self.0.request = v.into();
4482 self
4483 }
4484
4485 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4487 self.0.options = v.into();
4488 self
4489 }
4490
4491 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4493 (*self.0.stub)
4494 .get_operation(self.0.request, self.0.options)
4495 .await
4496 .map(crate::Response::into_body)
4497 }
4498
4499 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4501 self.0.request.name = v.into();
4502 self
4503 }
4504 }
4505
4506 #[doc(hidden)]
4507 impl crate::RequestBuilder for GetOperation {
4508 fn request_options(&mut self) -> &mut crate::RequestOptions {
4509 &mut self.0.options
4510 }
4511 }
4512
4513 #[derive(Clone, Debug)]
4530 pub struct DeleteOperation(
4531 RequestBuilder<google_cloud_longrunning::model::DeleteOperationRequest>,
4532 );
4533
4534 impl DeleteOperation {
4535 pub(crate) fn new(
4536 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
4537 ) -> Self {
4538 Self(RequestBuilder::new(stub))
4539 }
4540
4541 pub fn with_request<V: Into<google_cloud_longrunning::model::DeleteOperationRequest>>(
4543 mut self,
4544 v: V,
4545 ) -> Self {
4546 self.0.request = v.into();
4547 self
4548 }
4549
4550 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4552 self.0.options = v.into();
4553 self
4554 }
4555
4556 pub async fn send(self) -> Result<()> {
4558 (*self.0.stub)
4559 .delete_operation(self.0.request, self.0.options)
4560 .await
4561 .map(crate::Response::into_body)
4562 }
4563
4564 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4566 self.0.request.name = v.into();
4567 self
4568 }
4569 }
4570
4571 #[doc(hidden)]
4572 impl crate::RequestBuilder for DeleteOperation {
4573 fn request_options(&mut self) -> &mut crate::RequestOptions {
4574 &mut self.0.options
4575 }
4576 }
4577
4578 #[derive(Clone, Debug)]
4595 pub struct CancelOperation(
4596 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
4597 );
4598
4599 impl CancelOperation {
4600 pub(crate) fn new(
4601 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
4602 ) -> Self {
4603 Self(RequestBuilder::new(stub))
4604 }
4605
4606 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
4608 mut self,
4609 v: V,
4610 ) -> Self {
4611 self.0.request = v.into();
4612 self
4613 }
4614
4615 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4617 self.0.options = v.into();
4618 self
4619 }
4620
4621 pub async fn send(self) -> Result<()> {
4623 (*self.0.stub)
4624 .cancel_operation(self.0.request, self.0.options)
4625 .await
4626 .map(crate::Response::into_body)
4627 }
4628
4629 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4631 self.0.request.name = v.into();
4632 self
4633 }
4634 }
4635
4636 #[doc(hidden)]
4637 impl crate::RequestBuilder for CancelOperation {
4638 fn request_options(&mut self) -> &mut crate::RequestOptions {
4639 &mut self.0.options
4640 }
4641 }
4642
4643 #[derive(Clone, Debug)]
4660 pub struct WaitOperation(RequestBuilder<google_cloud_longrunning::model::WaitOperationRequest>);
4661
4662 impl WaitOperation {
4663 pub(crate) fn new(
4664 stub: std::sync::Arc<dyn super::super::stub::dynamic::TranslationService>,
4665 ) -> Self {
4666 Self(RequestBuilder::new(stub))
4667 }
4668
4669 pub fn with_request<V: Into<google_cloud_longrunning::model::WaitOperationRequest>>(
4671 mut self,
4672 v: V,
4673 ) -> Self {
4674 self.0.request = v.into();
4675 self
4676 }
4677
4678 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4680 self.0.options = v.into();
4681 self
4682 }
4683
4684 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4686 (*self.0.stub)
4687 .wait_operation(self.0.request, self.0.options)
4688 .await
4689 .map(crate::Response::into_body)
4690 }
4691
4692 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4694 self.0.request.name = v.into();
4695 self
4696 }
4697
4698 pub fn set_timeout<T>(mut self, v: T) -> Self
4700 where
4701 T: std::convert::Into<wkt::Duration>,
4702 {
4703 self.0.request.timeout = std::option::Option::Some(v.into());
4704 self
4705 }
4706
4707 pub fn set_or_clear_timeout<T>(mut self, v: std::option::Option<T>) -> Self
4709 where
4710 T: std::convert::Into<wkt::Duration>,
4711 {
4712 self.0.request.timeout = v.map(|x| x.into());
4713 self
4714 }
4715 }
4716
4717 #[doc(hidden)]
4718 impl crate::RequestBuilder for WaitOperation {
4719 fn request_options(&mut self) -> &mut crate::RequestOptions {
4720 &mut self.0.options
4721 }
4722 }
4723}