Skip to main content

google_cloud_translation_v3/
builder.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17pub mod translation_service {
18    use crate::Result;
19
20    /// A builder for [TranslationService][crate::client::TranslationService].
21    ///
22    /// ```
23    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
24    /// # use google_cloud_translation_v3::*;
25    /// # use builder::translation_service::ClientBuilder;
26    /// # use client::TranslationService;
27    /// let builder : ClientBuilder = TranslationService::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://translate.googleapis.com")
30    ///     .build().await?;
31    /// # Ok(()) }
32    /// ```
33    pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35    pub(crate) mod client {
36        use super::super::super::client::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    /// Common implementation for [crate::client::TranslationService] request builders.
51    #[derive(Clone, Debug)]
52    pub(crate) struct RequestBuilder<R: std::default::Default> {
53        stub: std::sync::Arc<dyn super::super::stub::dynamic::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    /// The request builder for [TranslationService::translate_text][crate::client::TranslationService::translate_text] calls.
74    ///
75    /// # Example
76    /// ```
77    /// # use google_cloud_translation_v3::builder::translation_service::TranslateText;
78    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
79    ///
80    /// let builder = prepare_request_builder();
81    /// let response = builder.send().await?;
82    /// # Ok(()) }
83    ///
84    /// fn prepare_request_builder() -> TranslateText {
85    ///   # panic!();
86    ///   // ... details omitted ...
87    /// }
88    /// ```
89    #[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        /// Sets the full request, replacing any prior values.
100        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        /// Sets all the options, replacing any prior values.
106        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
107            self.0.options = v.into();
108            self
109        }
110
111        /// Sends the request.
112        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        /// Sets the value of [contents][crate::model::TranslateTextRequest::contents].
120        ///
121        /// This is a **required** field for requests.
122        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        /// Sets the value of [mime_type][crate::model::TranslateTextRequest::mime_type].
133        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        /// Sets the value of [source_language_code][crate::model::TranslateTextRequest::source_language_code].
139        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        /// Sets the value of [target_language_code][crate::model::TranslateTextRequest::target_language_code].
145        ///
146        /// This is a **required** field for requests.
147        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        /// Sets the value of [parent][crate::model::TranslateTextRequest::parent].
153        ///
154        /// This is a **required** field for requests.
155        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        /// Sets the value of [model][crate::model::TranslateTextRequest::model].
161        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        /// Sets the value of [glossary_config][crate::model::TranslateTextRequest::glossary_config].
167        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        /// Sets or clears the value of [glossary_config][crate::model::TranslateTextRequest::glossary_config].
176        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        /// Sets the value of [transliteration_config][crate::model::TranslateTextRequest::transliteration_config].
185        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        /// Sets or clears the value of [transliteration_config][crate::model::TranslateTextRequest::transliteration_config].
194        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        /// Sets the value of [labels][crate::model::TranslateTextRequest::labels].
203        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    /// The request builder for [TranslationService::romanize_text][crate::client::TranslationService::romanize_text] calls.
222    ///
223    /// # Example
224    /// ```
225    /// # use google_cloud_translation_v3::builder::translation_service::RomanizeText;
226    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
227    ///
228    /// let builder = prepare_request_builder();
229    /// let response = builder.send().await?;
230    /// # Ok(()) }
231    ///
232    /// fn prepare_request_builder() -> RomanizeText {
233    ///   # panic!();
234    ///   // ... details omitted ...
235    /// }
236    /// ```
237    #[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        /// Sets the full request, replacing any prior values.
248        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        /// Sets all the options, replacing any prior values.
254        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
255            self.0.options = v.into();
256            self
257        }
258
259        /// Sends the request.
260        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        /// Sets the value of [parent][crate::model::RomanizeTextRequest::parent].
268        ///
269        /// This is a **required** field for requests.
270        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        /// Sets the value of [contents][crate::model::RomanizeTextRequest::contents].
276        ///
277        /// This is a **required** field for requests.
278        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        /// Sets the value of [source_language_code][crate::model::RomanizeTextRequest::source_language_code].
289        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    /// The request builder for [TranslationService::detect_language][crate::client::TranslationService::detect_language] calls.
303    ///
304    /// # Example
305    /// ```
306    /// # use google_cloud_translation_v3::builder::translation_service::DetectLanguage;
307    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
308    ///
309    /// let builder = prepare_request_builder();
310    /// let response = builder.send().await?;
311    /// # Ok(()) }
312    ///
313    /// fn prepare_request_builder() -> DetectLanguage {
314    ///   # panic!();
315    ///   // ... details omitted ...
316    /// }
317    /// ```
318    #[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        /// Sets the full request, replacing any prior values.
329        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        /// Sets all the options, replacing any prior values.
335        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
336            self.0.options = v.into();
337            self
338        }
339
340        /// Sends the request.
341        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        /// Sets the value of [parent][crate::model::DetectLanguageRequest::parent].
349        ///
350        /// This is a **required** field for requests.
351        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        /// Sets the value of [model][crate::model::DetectLanguageRequest::model].
357        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        /// Sets the value of [mime_type][crate::model::DetectLanguageRequest::mime_type].
363        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        /// Sets the value of [labels][crate::model::DetectLanguageRequest::labels].
369        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        /// Sets the value of [source][crate::model::DetectLanguageRequest::source].
380        ///
381        /// Note that all the setters affecting `source` are
382        /// mutually exclusive.
383        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        /// Sets the value of [source][crate::model::DetectLanguageRequest::source]
392        /// to hold a `Content`.
393        ///
394        /// Note that all the setters affecting `source` are
395        /// mutually exclusive.
396        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    /// The request builder for [TranslationService::get_supported_languages][crate::client::TranslationService::get_supported_languages] calls.
410    ///
411    /// # Example
412    /// ```
413    /// # use google_cloud_translation_v3::builder::translation_service::GetSupportedLanguages;
414    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
415    ///
416    /// let builder = prepare_request_builder();
417    /// let response = builder.send().await?;
418    /// # Ok(()) }
419    ///
420    /// fn prepare_request_builder() -> GetSupportedLanguages {
421    ///   # panic!();
422    ///   // ... details omitted ...
423    /// }
424    /// ```
425    #[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        /// Sets the full request, replacing any prior values.
436        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        /// Sets all the options, replacing any prior values.
445        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
446            self.0.options = v.into();
447            self
448        }
449
450        /// Sends the request.
451        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        /// Sets the value of [parent][crate::model::GetSupportedLanguagesRequest::parent].
459        ///
460        /// This is a **required** field for requests.
461        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        /// Sets the value of [display_language_code][crate::model::GetSupportedLanguagesRequest::display_language_code].
467        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        /// Sets the value of [model][crate::model::GetSupportedLanguagesRequest::model].
473        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    /// The request builder for [TranslationService::translate_document][crate::client::TranslationService::translate_document] calls.
487    ///
488    /// # Example
489    /// ```
490    /// # use google_cloud_translation_v3::builder::translation_service::TranslateDocument;
491    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
492    ///
493    /// let builder = prepare_request_builder();
494    /// let response = builder.send().await?;
495    /// # Ok(()) }
496    ///
497    /// fn prepare_request_builder() -> TranslateDocument {
498    ///   # panic!();
499    ///   // ... details omitted ...
500    /// }
501    /// ```
502    #[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        /// Sets the full request, replacing any prior values.
513        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        /// Sets all the options, replacing any prior values.
522        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
523            self.0.options = v.into();
524            self
525        }
526
527        /// Sends the request.
528        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        /// Sets the value of [parent][crate::model::TranslateDocumentRequest::parent].
536        ///
537        /// This is a **required** field for requests.
538        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        /// Sets the value of [source_language_code][crate::model::TranslateDocumentRequest::source_language_code].
544        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        /// Sets the value of [target_language_code][crate::model::TranslateDocumentRequest::target_language_code].
550        ///
551        /// This is a **required** field for requests.
552        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        /// Sets the value of [document_input_config][crate::model::TranslateDocumentRequest::document_input_config].
558        ///
559        /// This is a **required** field for requests.
560        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        /// Sets or clears the value of [document_input_config][crate::model::TranslateDocumentRequest::document_input_config].
569        ///
570        /// This is a **required** field for requests.
571        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        /// Sets the value of [document_output_config][crate::model::TranslateDocumentRequest::document_output_config].
580        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        /// Sets or clears the value of [document_output_config][crate::model::TranslateDocumentRequest::document_output_config].
589        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        /// Sets the value of [model][crate::model::TranslateDocumentRequest::model].
598        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        /// Sets the value of [glossary_config][crate::model::TranslateDocumentRequest::glossary_config].
604        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        /// Sets or clears the value of [glossary_config][crate::model::TranslateDocumentRequest::glossary_config].
613        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        /// Sets the value of [labels][crate::model::TranslateDocumentRequest::labels].
622        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        /// Sets the value of [customized_attribution][crate::model::TranslateDocumentRequest::customized_attribution].
633        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        /// Sets the value of [is_translate_native_pdf_only][crate::model::TranslateDocumentRequest::is_translate_native_pdf_only].
639        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        /// Sets the value of [enable_shadow_removal_native_pdf][crate::model::TranslateDocumentRequest::enable_shadow_removal_native_pdf].
645        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        /// Sets the value of [enable_rotation_correction][crate::model::TranslateDocumentRequest::enable_rotation_correction].
651        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    /// The request builder for [TranslationService::batch_translate_text][crate::client::TranslationService::batch_translate_text] calls.
665    ///
666    /// # Example
667    /// ```
668    /// # use google_cloud_translation_v3::builder::translation_service::BatchTranslateText;
669    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
670    /// use google_cloud_lro::Poller;
671    ///
672    /// let builder = prepare_request_builder();
673    /// let response = builder.poller().until_done().await?;
674    /// # Ok(()) }
675    ///
676    /// fn prepare_request_builder() -> BatchTranslateText {
677    ///   # panic!();
678    ///   // ... details omitted ...
679    /// }
680    /// ```
681    #[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        /// Sets the full request, replacing any prior values.
692        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        /// Sets all the options, replacing any prior values.
701        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
702            self.0.options = v.into();
703            self
704        }
705
706        /// Sends the request.
707        ///
708        /// # Long running operations
709        ///
710        /// This starts, but does not poll, a longrunning operation. More information
711        /// on [batch_translate_text][crate::client::TranslationService::batch_translate_text].
712        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        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_translate_text`.
720        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        /// Sets the value of [parent][crate::model::BatchTranslateTextRequest::parent].
763        ///
764        /// This is a **required** field for requests.
765        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        /// Sets the value of [source_language_code][crate::model::BatchTranslateTextRequest::source_language_code].
771        ///
772        /// This is a **required** field for requests.
773        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        /// Sets the value of [target_language_codes][crate::model::BatchTranslateTextRequest::target_language_codes].
779        ///
780        /// This is a **required** field for requests.
781        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        /// Sets the value of [models][crate::model::BatchTranslateTextRequest::models].
792        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        /// Sets the value of [input_configs][crate::model::BatchTranslateTextRequest::input_configs].
803        ///
804        /// This is a **required** field for requests.
805        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        /// Sets the value of [output_config][crate::model::BatchTranslateTextRequest::output_config].
816        ///
817        /// This is a **required** field for requests.
818        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        /// Sets or clears the value of [output_config][crate::model::BatchTranslateTextRequest::output_config].
827        ///
828        /// This is a **required** field for requests.
829        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        /// Sets the value of [glossaries][crate::model::BatchTranslateTextRequest::glossaries].
838        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        /// Sets the value of [labels][crate::model::BatchTranslateTextRequest::labels].
849        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    /// The request builder for [TranslationService::batch_translate_document][crate::client::TranslationService::batch_translate_document] calls.
868    ///
869    /// # Example
870    /// ```
871    /// # use google_cloud_translation_v3::builder::translation_service::BatchTranslateDocument;
872    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
873    /// use google_cloud_lro::Poller;
874    ///
875    /// let builder = prepare_request_builder();
876    /// let response = builder.poller().until_done().await?;
877    /// # Ok(()) }
878    ///
879    /// fn prepare_request_builder() -> BatchTranslateDocument {
880    ///   # panic!();
881    ///   // ... details omitted ...
882    /// }
883    /// ```
884    #[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        /// Sets the full request, replacing any prior values.
895        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        /// Sets all the options, replacing any prior values.
904        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
905            self.0.options = v.into();
906            self
907        }
908
909        /// Sends the request.
910        ///
911        /// # Long running operations
912        ///
913        /// This starts, but does not poll, a longrunning operation. More information
914        /// on [batch_translate_document][crate::client::TranslationService::batch_translate_document].
915        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        /// Creates a [Poller][google_cloud_lro::Poller] to work with `batch_translate_document`.
923        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        /// Sets the value of [parent][crate::model::BatchTranslateDocumentRequest::parent].
966        ///
967        /// This is a **required** field for requests.
968        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        /// Sets the value of [source_language_code][crate::model::BatchTranslateDocumentRequest::source_language_code].
974        ///
975        /// This is a **required** field for requests.
976        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        /// Sets the value of [target_language_codes][crate::model::BatchTranslateDocumentRequest::target_language_codes].
982        ///
983        /// This is a **required** field for requests.
984        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        /// Sets the value of [input_configs][crate::model::BatchTranslateDocumentRequest::input_configs].
995        ///
996        /// This is a **required** field for requests.
997        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        /// Sets the value of [output_config][crate::model::BatchTranslateDocumentRequest::output_config].
1008        ///
1009        /// This is a **required** field for requests.
1010        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        /// Sets or clears the value of [output_config][crate::model::BatchTranslateDocumentRequest::output_config].
1019        ///
1020        /// This is a **required** field for requests.
1021        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        /// Sets the value of [models][crate::model::BatchTranslateDocumentRequest::models].
1030        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        /// Sets the value of [glossaries][crate::model::BatchTranslateDocumentRequest::glossaries].
1041        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        /// Sets the value of [format_conversions][crate::model::BatchTranslateDocumentRequest::format_conversions].
1052        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        /// Sets the value of [customized_attribution][crate::model::BatchTranslateDocumentRequest::customized_attribution].
1064        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        /// Sets the value of [enable_shadow_removal_native_pdf][crate::model::BatchTranslateDocumentRequest::enable_shadow_removal_native_pdf].
1070        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        /// Sets the value of [enable_rotation_correction][crate::model::BatchTranslateDocumentRequest::enable_rotation_correction].
1076        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    /// The request builder for [TranslationService::create_glossary][crate::client::TranslationService::create_glossary] calls.
1090    ///
1091    /// # Example
1092    /// ```
1093    /// # use google_cloud_translation_v3::builder::translation_service::CreateGlossary;
1094    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
1095    /// use google_cloud_lro::Poller;
1096    ///
1097    /// let builder = prepare_request_builder();
1098    /// let response = builder.poller().until_done().await?;
1099    /// # Ok(()) }
1100    ///
1101    /// fn prepare_request_builder() -> CreateGlossary {
1102    ///   # panic!();
1103    ///   // ... details omitted ...
1104    /// }
1105    /// ```
1106    #[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        /// Sets the full request, replacing any prior values.
1117        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        /// Sets all the options, replacing any prior values.
1123        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1124            self.0.options = v.into();
1125            self
1126        }
1127
1128        /// Sends the request.
1129        ///
1130        /// # Long running operations
1131        ///
1132        /// This starts, but does not poll, a longrunning operation. More information
1133        /// on [create_glossary][crate::client::TranslationService::create_glossary].
1134        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        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_glossary`.
1142        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        /// Sets the value of [parent][crate::model::CreateGlossaryRequest::parent].
1183        ///
1184        /// This is a **required** field for requests.
1185        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        /// Sets the value of [glossary][crate::model::CreateGlossaryRequest::glossary].
1191        ///
1192        /// This is a **required** field for requests.
1193        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        /// Sets or clears the value of [glossary][crate::model::CreateGlossaryRequest::glossary].
1202        ///
1203        /// This is a **required** field for requests.
1204        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    /// The request builder for [TranslationService::update_glossary][crate::client::TranslationService::update_glossary] calls.
1221    ///
1222    /// # Example
1223    /// ```
1224    /// # use google_cloud_translation_v3::builder::translation_service::UpdateGlossary;
1225    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
1226    /// use google_cloud_lro::Poller;
1227    ///
1228    /// let builder = prepare_request_builder();
1229    /// let response = builder.poller().until_done().await?;
1230    /// # Ok(()) }
1231    ///
1232    /// fn prepare_request_builder() -> UpdateGlossary {
1233    ///   # panic!();
1234    ///   // ... details omitted ...
1235    /// }
1236    /// ```
1237    #[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        /// Sets the full request, replacing any prior values.
1248        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        /// Sets all the options, replacing any prior values.
1254        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1255            self.0.options = v.into();
1256            self
1257        }
1258
1259        /// Sends the request.
1260        ///
1261        /// # Long running operations
1262        ///
1263        /// This starts, but does not poll, a longrunning operation. More information
1264        /// on [update_glossary][crate::client::TranslationService::update_glossary].
1265        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        /// Creates a [Poller][google_cloud_lro::Poller] to work with `update_glossary`.
1273        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        /// Sets the value of [glossary][crate::model::UpdateGlossaryRequest::glossary].
1314        ///
1315        /// This is a **required** field for requests.
1316        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        /// Sets or clears the value of [glossary][crate::model::UpdateGlossaryRequest::glossary].
1325        ///
1326        /// This is a **required** field for requests.
1327        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        /// Sets the value of [update_mask][crate::model::UpdateGlossaryRequest::update_mask].
1336        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        /// Sets or clears the value of [update_mask][crate::model::UpdateGlossaryRequest::update_mask].
1345        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    /// The request builder for [TranslationService::list_glossaries][crate::client::TranslationService::list_glossaries] calls.
1362    ///
1363    /// # Example
1364    /// ```
1365    /// # use google_cloud_translation_v3::builder::translation_service::ListGlossaries;
1366    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
1367    /// use google_cloud_gax::paginator::ItemPaginator;
1368    ///
1369    /// let builder = prepare_request_builder();
1370    /// let mut items = builder.by_item();
1371    /// while let Some(result) = items.next().await {
1372    ///   let item = result?;
1373    /// }
1374    /// # Ok(()) }
1375    ///
1376    /// fn prepare_request_builder() -> ListGlossaries {
1377    ///   # panic!();
1378    ///   // ... details omitted ...
1379    /// }
1380    /// ```
1381    #[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        /// Sets the full request, replacing any prior values.
1392        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        /// Sets all the options, replacing any prior values.
1398        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1399            self.0.options = v.into();
1400            self
1401        }
1402
1403        /// Sends the request.
1404        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        /// Streams each page in the collection.
1412        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        /// Streams each item in the collection.
1429        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        /// Sets the value of [parent][crate::model::ListGlossariesRequest::parent].
1440        ///
1441        /// This is a **required** field for requests.
1442        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        /// Sets the value of [page_size][crate::model::ListGlossariesRequest::page_size].
1448        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        /// Sets the value of [page_token][crate::model::ListGlossariesRequest::page_token].
1454        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        /// Sets the value of [filter][crate::model::ListGlossariesRequest::filter].
1460        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    /// The request builder for [TranslationService::get_glossary][crate::client::TranslationService::get_glossary] calls.
1474    ///
1475    /// # Example
1476    /// ```
1477    /// # use google_cloud_translation_v3::builder::translation_service::GetGlossary;
1478    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
1479    ///
1480    /// let builder = prepare_request_builder();
1481    /// let response = builder.send().await?;
1482    /// # Ok(()) }
1483    ///
1484    /// fn prepare_request_builder() -> GetGlossary {
1485    ///   # panic!();
1486    ///   // ... details omitted ...
1487    /// }
1488    /// ```
1489    #[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        /// Sets the full request, replacing any prior values.
1500        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        /// Sets all the options, replacing any prior values.
1506        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1507            self.0.options = v.into();
1508            self
1509        }
1510
1511        /// Sends the request.
1512        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        /// Sets the value of [name][crate::model::GetGlossaryRequest::name].
1520        ///
1521        /// This is a **required** field for requests.
1522        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    /// The request builder for [TranslationService::delete_glossary][crate::client::TranslationService::delete_glossary] calls.
1536    ///
1537    /// # Example
1538    /// ```
1539    /// # use google_cloud_translation_v3::builder::translation_service::DeleteGlossary;
1540    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
1541    /// use google_cloud_lro::Poller;
1542    ///
1543    /// let builder = prepare_request_builder();
1544    /// let response = builder.poller().until_done().await?;
1545    /// # Ok(()) }
1546    ///
1547    /// fn prepare_request_builder() -> DeleteGlossary {
1548    ///   # panic!();
1549    ///   // ... details omitted ...
1550    /// }
1551    /// ```
1552    #[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        /// Sets the full request, replacing any prior values.
1563        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        /// Sets all the options, replacing any prior values.
1569        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1570            self.0.options = v.into();
1571            self
1572        }
1573
1574        /// Sends the request.
1575        ///
1576        /// # Long running operations
1577        ///
1578        /// This starts, but does not poll, a longrunning operation. More information
1579        /// on [delete_glossary][crate::client::TranslationService::delete_glossary].
1580        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        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_glossary`.
1588        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        /// Sets the value of [name][crate::model::DeleteGlossaryRequest::name].
1631        ///
1632        /// This is a **required** field for requests.
1633        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    /// The request builder for [TranslationService::get_glossary_entry][crate::client::TranslationService::get_glossary_entry] calls.
1647    ///
1648    /// # Example
1649    /// ```
1650    /// # use google_cloud_translation_v3::builder::translation_service::GetGlossaryEntry;
1651    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
1652    ///
1653    /// let builder = prepare_request_builder();
1654    /// let response = builder.send().await?;
1655    /// # Ok(()) }
1656    ///
1657    /// fn prepare_request_builder() -> GetGlossaryEntry {
1658    ///   # panic!();
1659    ///   // ... details omitted ...
1660    /// }
1661    /// ```
1662    #[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        /// Sets the full request, replacing any prior values.
1673        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        /// Sets all the options, replacing any prior values.
1682        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1683            self.0.options = v.into();
1684            self
1685        }
1686
1687        /// Sends the request.
1688        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        /// Sets the value of [name][crate::model::GetGlossaryEntryRequest::name].
1696        ///
1697        /// This is a **required** field for requests.
1698        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    /// The request builder for [TranslationService::list_glossary_entries][crate::client::TranslationService::list_glossary_entries] calls.
1712    ///
1713    /// # Example
1714    /// ```
1715    /// # use google_cloud_translation_v3::builder::translation_service::ListGlossaryEntries;
1716    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
1717    /// use google_cloud_gax::paginator::ItemPaginator;
1718    ///
1719    /// let builder = prepare_request_builder();
1720    /// let mut items = builder.by_item();
1721    /// while let Some(result) = items.next().await {
1722    ///   let item = result?;
1723    /// }
1724    /// # Ok(()) }
1725    ///
1726    /// fn prepare_request_builder() -> ListGlossaryEntries {
1727    ///   # panic!();
1728    ///   // ... details omitted ...
1729    /// }
1730    /// ```
1731    #[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        /// Sets the full request, replacing any prior values.
1742        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        /// Sets all the options, replacing any prior values.
1751        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1752            self.0.options = v.into();
1753            self
1754        }
1755
1756        /// Sends the request.
1757        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        /// Streams each page in the collection.
1765        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        /// Streams each item in the collection.
1782        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        /// Sets the value of [parent][crate::model::ListGlossaryEntriesRequest::parent].
1793        ///
1794        /// This is a **required** field for requests.
1795        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        /// Sets the value of [page_size][crate::model::ListGlossaryEntriesRequest::page_size].
1801        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        /// Sets the value of [page_token][crate::model::ListGlossaryEntriesRequest::page_token].
1807        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    /// The request builder for [TranslationService::create_glossary_entry][crate::client::TranslationService::create_glossary_entry] calls.
1821    ///
1822    /// # Example
1823    /// ```
1824    /// # use google_cloud_translation_v3::builder::translation_service::CreateGlossaryEntry;
1825    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
1826    ///
1827    /// let builder = prepare_request_builder();
1828    /// let response = builder.send().await?;
1829    /// # Ok(()) }
1830    ///
1831    /// fn prepare_request_builder() -> CreateGlossaryEntry {
1832    ///   # panic!();
1833    ///   // ... details omitted ...
1834    /// }
1835    /// ```
1836    #[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        /// Sets the full request, replacing any prior values.
1847        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        /// Sets all the options, replacing any prior values.
1856        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1857            self.0.options = v.into();
1858            self
1859        }
1860
1861        /// Sends the request.
1862        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        /// Sets the value of [parent][crate::model::CreateGlossaryEntryRequest::parent].
1870        ///
1871        /// This is a **required** field for requests.
1872        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        /// Sets the value of [glossary_entry][crate::model::CreateGlossaryEntryRequest::glossary_entry].
1878        ///
1879        /// This is a **required** field for requests.
1880        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        /// Sets or clears the value of [glossary_entry][crate::model::CreateGlossaryEntryRequest::glossary_entry].
1889        ///
1890        /// This is a **required** field for requests.
1891        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    /// The request builder for [TranslationService::update_glossary_entry][crate::client::TranslationService::update_glossary_entry] calls.
1908    ///
1909    /// # Example
1910    /// ```
1911    /// # use google_cloud_translation_v3::builder::translation_service::UpdateGlossaryEntry;
1912    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
1913    ///
1914    /// let builder = prepare_request_builder();
1915    /// let response = builder.send().await?;
1916    /// # Ok(()) }
1917    ///
1918    /// fn prepare_request_builder() -> UpdateGlossaryEntry {
1919    ///   # panic!();
1920    ///   // ... details omitted ...
1921    /// }
1922    /// ```
1923    #[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        /// Sets the full request, replacing any prior values.
1934        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        /// Sets all the options, replacing any prior values.
1943        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1944            self.0.options = v.into();
1945            self
1946        }
1947
1948        /// Sends the request.
1949        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        /// Sets the value of [glossary_entry][crate::model::UpdateGlossaryEntryRequest::glossary_entry].
1957        ///
1958        /// This is a **required** field for requests.
1959        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        /// Sets or clears the value of [glossary_entry][crate::model::UpdateGlossaryEntryRequest::glossary_entry].
1968        ///
1969        /// This is a **required** field for requests.
1970        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    /// The request builder for [TranslationService::delete_glossary_entry][crate::client::TranslationService::delete_glossary_entry] calls.
1987    ///
1988    /// # Example
1989    /// ```
1990    /// # use google_cloud_translation_v3::builder::translation_service::DeleteGlossaryEntry;
1991    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
1992    ///
1993    /// let builder = prepare_request_builder();
1994    /// let response = builder.send().await?;
1995    /// # Ok(()) }
1996    ///
1997    /// fn prepare_request_builder() -> DeleteGlossaryEntry {
1998    ///   # panic!();
1999    ///   // ... details omitted ...
2000    /// }
2001    /// ```
2002    #[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        /// Sets the full request, replacing any prior values.
2013        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        /// Sets all the options, replacing any prior values.
2022        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2023            self.0.options = v.into();
2024            self
2025        }
2026
2027        /// Sends the request.
2028        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        /// Sets the value of [name][crate::model::DeleteGlossaryEntryRequest::name].
2036        ///
2037        /// This is a **required** field for requests.
2038        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    /// The request builder for [TranslationService::create_dataset][crate::client::TranslationService::create_dataset] calls.
2052    ///
2053    /// # Example
2054    /// ```
2055    /// # use google_cloud_translation_v3::builder::translation_service::CreateDataset;
2056    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
2057    /// use google_cloud_lro::Poller;
2058    ///
2059    /// let builder = prepare_request_builder();
2060    /// let response = builder.poller().until_done().await?;
2061    /// # Ok(()) }
2062    ///
2063    /// fn prepare_request_builder() -> CreateDataset {
2064    ///   # panic!();
2065    ///   // ... details omitted ...
2066    /// }
2067    /// ```
2068    #[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        /// Sets the full request, replacing any prior values.
2079        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        /// Sets all the options, replacing any prior values.
2085        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2086            self.0.options = v.into();
2087            self
2088        }
2089
2090        /// Sends the request.
2091        ///
2092        /// # Long running operations
2093        ///
2094        /// This starts, but does not poll, a longrunning operation. More information
2095        /// on [create_dataset][crate::client::TranslationService::create_dataset].
2096        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        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_dataset`.
2104        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        /// Sets the value of [parent][crate::model::CreateDatasetRequest::parent].
2145        ///
2146        /// This is a **required** field for requests.
2147        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        /// Sets the value of [dataset][crate::model::CreateDatasetRequest::dataset].
2153        ///
2154        /// This is a **required** field for requests.
2155        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        /// Sets or clears the value of [dataset][crate::model::CreateDatasetRequest::dataset].
2164        ///
2165        /// This is a **required** field for requests.
2166        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    /// The request builder for [TranslationService::get_dataset][crate::client::TranslationService::get_dataset] calls.
2183    ///
2184    /// # Example
2185    /// ```
2186    /// # use google_cloud_translation_v3::builder::translation_service::GetDataset;
2187    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
2188    ///
2189    /// let builder = prepare_request_builder();
2190    /// let response = builder.send().await?;
2191    /// # Ok(()) }
2192    ///
2193    /// fn prepare_request_builder() -> GetDataset {
2194    ///   # panic!();
2195    ///   // ... details omitted ...
2196    /// }
2197    /// ```
2198    #[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        /// Sets the full request, replacing any prior values.
2209        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        /// Sets all the options, replacing any prior values.
2215        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2216            self.0.options = v.into();
2217            self
2218        }
2219
2220        /// Sends the request.
2221        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        /// Sets the value of [name][crate::model::GetDatasetRequest::name].
2229        ///
2230        /// This is a **required** field for requests.
2231        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    /// The request builder for [TranslationService::list_datasets][crate::client::TranslationService::list_datasets] calls.
2245    ///
2246    /// # Example
2247    /// ```
2248    /// # use google_cloud_translation_v3::builder::translation_service::ListDatasets;
2249    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
2250    /// use google_cloud_gax::paginator::ItemPaginator;
2251    ///
2252    /// let builder = prepare_request_builder();
2253    /// let mut items = builder.by_item();
2254    /// while let Some(result) = items.next().await {
2255    ///   let item = result?;
2256    /// }
2257    /// # Ok(()) }
2258    ///
2259    /// fn prepare_request_builder() -> ListDatasets {
2260    ///   # panic!();
2261    ///   // ... details omitted ...
2262    /// }
2263    /// ```
2264    #[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        /// Sets the full request, replacing any prior values.
2275        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        /// Sets all the options, replacing any prior values.
2281        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2282            self.0.options = v.into();
2283            self
2284        }
2285
2286        /// Sends the request.
2287        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        /// Streams each page in the collection.
2295        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        /// Streams each item in the collection.
2310        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        /// Sets the value of [parent][crate::model::ListDatasetsRequest::parent].
2321        ///
2322        /// This is a **required** field for requests.
2323        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        /// Sets the value of [page_size][crate::model::ListDatasetsRequest::page_size].
2329        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        /// Sets the value of [page_token][crate::model::ListDatasetsRequest::page_token].
2335        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    /// The request builder for [TranslationService::delete_dataset][crate::client::TranslationService::delete_dataset] calls.
2349    ///
2350    /// # Example
2351    /// ```
2352    /// # use google_cloud_translation_v3::builder::translation_service::DeleteDataset;
2353    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
2354    /// use google_cloud_lro::Poller;
2355    ///
2356    /// let builder = prepare_request_builder();
2357    /// let response = builder.poller().until_done().await?;
2358    /// # Ok(()) }
2359    ///
2360    /// fn prepare_request_builder() -> DeleteDataset {
2361    ///   # panic!();
2362    ///   // ... details omitted ...
2363    /// }
2364    /// ```
2365    #[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        /// Sets the full request, replacing any prior values.
2376        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        /// Sets all the options, replacing any prior values.
2382        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2383            self.0.options = v.into();
2384            self
2385        }
2386
2387        /// Sends the request.
2388        ///
2389        /// # Long running operations
2390        ///
2391        /// This starts, but does not poll, a longrunning operation. More information
2392        /// on [delete_dataset][crate::client::TranslationService::delete_dataset].
2393        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        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_dataset`.
2401        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        /// Sets the value of [name][crate::model::DeleteDatasetRequest::name].
2441        ///
2442        /// This is a **required** field for requests.
2443        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    /// The request builder for [TranslationService::create_adaptive_mt_dataset][crate::client::TranslationService::create_adaptive_mt_dataset] calls.
2457    ///
2458    /// # Example
2459    /// ```
2460    /// # use google_cloud_translation_v3::builder::translation_service::CreateAdaptiveMtDataset;
2461    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
2462    ///
2463    /// let builder = prepare_request_builder();
2464    /// let response = builder.send().await?;
2465    /// # Ok(()) }
2466    ///
2467    /// fn prepare_request_builder() -> CreateAdaptiveMtDataset {
2468    ///   # panic!();
2469    ///   // ... details omitted ...
2470    /// }
2471    /// ```
2472    #[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        /// Sets the full request, replacing any prior values.
2485        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        /// Sets all the options, replacing any prior values.
2494        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2495            self.0.options = v.into();
2496            self
2497        }
2498
2499        /// Sends the request.
2500        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        /// Sets the value of [parent][crate::model::CreateAdaptiveMtDatasetRequest::parent].
2508        ///
2509        /// This is a **required** field for requests.
2510        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        /// Sets the value of [adaptive_mt_dataset][crate::model::CreateAdaptiveMtDatasetRequest::adaptive_mt_dataset].
2516        ///
2517        /// This is a **required** field for requests.
2518        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        /// Sets or clears the value of [adaptive_mt_dataset][crate::model::CreateAdaptiveMtDatasetRequest::adaptive_mt_dataset].
2527        ///
2528        /// This is a **required** field for requests.
2529        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    /// The request builder for [TranslationService::delete_adaptive_mt_dataset][crate::client::TranslationService::delete_adaptive_mt_dataset] calls.
2546    ///
2547    /// # Example
2548    /// ```
2549    /// # use google_cloud_translation_v3::builder::translation_service::DeleteAdaptiveMtDataset;
2550    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
2551    ///
2552    /// let builder = prepare_request_builder();
2553    /// let response = builder.send().await?;
2554    /// # Ok(()) }
2555    ///
2556    /// fn prepare_request_builder() -> DeleteAdaptiveMtDataset {
2557    ///   # panic!();
2558    ///   // ... details omitted ...
2559    /// }
2560    /// ```
2561    #[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        /// Sets the full request, replacing any prior values.
2574        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        /// Sets all the options, replacing any prior values.
2583        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2584            self.0.options = v.into();
2585            self
2586        }
2587
2588        /// Sends the request.
2589        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        /// Sets the value of [name][crate::model::DeleteAdaptiveMtDatasetRequest::name].
2597        ///
2598        /// This is a **required** field for requests.
2599        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    /// The request builder for [TranslationService::get_adaptive_mt_dataset][crate::client::TranslationService::get_adaptive_mt_dataset] calls.
2613    ///
2614    /// # Example
2615    /// ```
2616    /// # use google_cloud_translation_v3::builder::translation_service::GetAdaptiveMtDataset;
2617    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
2618    ///
2619    /// let builder = prepare_request_builder();
2620    /// let response = builder.send().await?;
2621    /// # Ok(()) }
2622    ///
2623    /// fn prepare_request_builder() -> GetAdaptiveMtDataset {
2624    ///   # panic!();
2625    ///   // ... details omitted ...
2626    /// }
2627    /// ```
2628    #[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        /// Sets the full request, replacing any prior values.
2639        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        /// Sets all the options, replacing any prior values.
2648        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2649            self.0.options = v.into();
2650            self
2651        }
2652
2653        /// Sends the request.
2654        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        /// Sets the value of [name][crate::model::GetAdaptiveMtDatasetRequest::name].
2662        ///
2663        /// This is a **required** field for requests.
2664        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    /// The request builder for [TranslationService::list_adaptive_mt_datasets][crate::client::TranslationService::list_adaptive_mt_datasets] calls.
2678    ///
2679    /// # Example
2680    /// ```
2681    /// # use google_cloud_translation_v3::builder::translation_service::ListAdaptiveMtDatasets;
2682    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
2683    /// use google_cloud_gax::paginator::ItemPaginator;
2684    ///
2685    /// let builder = prepare_request_builder();
2686    /// let mut items = builder.by_item();
2687    /// while let Some(result) = items.next().await {
2688    ///   let item = result?;
2689    /// }
2690    /// # Ok(()) }
2691    ///
2692    /// fn prepare_request_builder() -> ListAdaptiveMtDatasets {
2693    ///   # panic!();
2694    ///   // ... details omitted ...
2695    /// }
2696    /// ```
2697    #[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        /// Sets the full request, replacing any prior values.
2708        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        /// Sets all the options, replacing any prior values.
2717        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2718            self.0.options = v.into();
2719            self
2720        }
2721
2722        /// Sends the request.
2723        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        /// Streams each page in the collection.
2731        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        /// Streams each item in the collection.
2748        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        /// Sets the value of [parent][crate::model::ListAdaptiveMtDatasetsRequest::parent].
2759        ///
2760        /// This is a **required** field for requests.
2761        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        /// Sets the value of [page_size][crate::model::ListAdaptiveMtDatasetsRequest::page_size].
2767        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        /// Sets the value of [page_token][crate::model::ListAdaptiveMtDatasetsRequest::page_token].
2773        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        /// Sets the value of [filter][crate::model::ListAdaptiveMtDatasetsRequest::filter].
2779        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    /// The request builder for [TranslationService::adaptive_mt_translate][crate::client::TranslationService::adaptive_mt_translate] calls.
2793    ///
2794    /// # Example
2795    /// ```
2796    /// # use google_cloud_translation_v3::builder::translation_service::AdaptiveMtTranslate;
2797    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
2798    ///
2799    /// let builder = prepare_request_builder();
2800    /// let response = builder.send().await?;
2801    /// # Ok(()) }
2802    ///
2803    /// fn prepare_request_builder() -> AdaptiveMtTranslate {
2804    ///   # panic!();
2805    ///   // ... details omitted ...
2806    /// }
2807    /// ```
2808    #[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        /// Sets the full request, replacing any prior values.
2819        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        /// Sets all the options, replacing any prior values.
2828        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2829            self.0.options = v.into();
2830            self
2831        }
2832
2833        /// Sends the request.
2834        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        /// Sets the value of [parent][crate::model::AdaptiveMtTranslateRequest::parent].
2842        ///
2843        /// This is a **required** field for requests.
2844        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        /// Sets the value of [dataset][crate::model::AdaptiveMtTranslateRequest::dataset].
2850        ///
2851        /// This is a **required** field for requests.
2852        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        /// Sets the value of [content][crate::model::AdaptiveMtTranslateRequest::content].
2858        ///
2859        /// This is a **required** field for requests.
2860        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        /// Sets the value of [reference_sentence_config][crate::model::AdaptiveMtTranslateRequest::reference_sentence_config].
2871        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        /// Sets or clears the value of [reference_sentence_config][crate::model::AdaptiveMtTranslateRequest::reference_sentence_config].
2882        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        /// Sets the value of [glossary_config][crate::model::AdaptiveMtTranslateRequest::glossary_config].
2896        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        /// Sets or clears the value of [glossary_config][crate::model::AdaptiveMtTranslateRequest::glossary_config].
2905        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    /// The request builder for [TranslationService::get_adaptive_mt_file][crate::client::TranslationService::get_adaptive_mt_file] calls.
2922    ///
2923    /// # Example
2924    /// ```
2925    /// # use google_cloud_translation_v3::builder::translation_service::GetAdaptiveMtFile;
2926    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
2927    ///
2928    /// let builder = prepare_request_builder();
2929    /// let response = builder.send().await?;
2930    /// # Ok(()) }
2931    ///
2932    /// fn prepare_request_builder() -> GetAdaptiveMtFile {
2933    ///   # panic!();
2934    ///   // ... details omitted ...
2935    /// }
2936    /// ```
2937    #[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        /// Sets the full request, replacing any prior values.
2948        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        /// Sets all the options, replacing any prior values.
2957        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2958            self.0.options = v.into();
2959            self
2960        }
2961
2962        /// Sends the request.
2963        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        /// Sets the value of [name][crate::model::GetAdaptiveMtFileRequest::name].
2971        ///
2972        /// This is a **required** field for requests.
2973        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    /// The request builder for [TranslationService::delete_adaptive_mt_file][crate::client::TranslationService::delete_adaptive_mt_file] calls.
2987    ///
2988    /// # Example
2989    /// ```
2990    /// # use google_cloud_translation_v3::builder::translation_service::DeleteAdaptiveMtFile;
2991    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
2992    ///
2993    /// let builder = prepare_request_builder();
2994    /// let response = builder.send().await?;
2995    /// # Ok(()) }
2996    ///
2997    /// fn prepare_request_builder() -> DeleteAdaptiveMtFile {
2998    ///   # panic!();
2999    ///   // ... details omitted ...
3000    /// }
3001    /// ```
3002    #[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        /// Sets the full request, replacing any prior values.
3013        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        /// Sets all the options, replacing any prior values.
3022        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3023            self.0.options = v.into();
3024            self
3025        }
3026
3027        /// Sends the request.
3028        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        /// Sets the value of [name][crate::model::DeleteAdaptiveMtFileRequest::name].
3036        ///
3037        /// This is a **required** field for requests.
3038        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    /// The request builder for [TranslationService::import_adaptive_mt_file][crate::client::TranslationService::import_adaptive_mt_file] calls.
3052    ///
3053    /// # Example
3054    /// ```
3055    /// # use google_cloud_translation_v3::builder::translation_service::ImportAdaptiveMtFile;
3056    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
3057    ///
3058    /// let builder = prepare_request_builder();
3059    /// let response = builder.send().await?;
3060    /// # Ok(()) }
3061    ///
3062    /// fn prepare_request_builder() -> ImportAdaptiveMtFile {
3063    ///   # panic!();
3064    ///   // ... details omitted ...
3065    /// }
3066    /// ```
3067    #[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        /// Sets the full request, replacing any prior values.
3078        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        /// Sets all the options, replacing any prior values.
3087        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3088            self.0.options = v.into();
3089            self
3090        }
3091
3092        /// Sends the request.
3093        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        /// Sets the value of [parent][crate::model::ImportAdaptiveMtFileRequest::parent].
3101        ///
3102        /// This is a **required** field for requests.
3103        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        /// Sets the value of [source][crate::model::ImportAdaptiveMtFileRequest::source].
3109        ///
3110        /// Note that all the setters affecting `source` are
3111        /// mutually exclusive.
3112        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        /// Sets the value of [source][crate::model::ImportAdaptiveMtFileRequest::source]
3123        /// to hold a `FileInputSource`.
3124        ///
3125        /// Note that all the setters affecting `source` are
3126        /// mutually exclusive.
3127        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        /// Sets the value of [source][crate::model::ImportAdaptiveMtFileRequest::source]
3138        /// to hold a `GcsInputSource`.
3139        ///
3140        /// Note that all the setters affecting `source` are
3141        /// mutually exclusive.
3142        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    /// The request builder for [TranslationService::list_adaptive_mt_files][crate::client::TranslationService::list_adaptive_mt_files] calls.
3161    ///
3162    /// # Example
3163    /// ```
3164    /// # use google_cloud_translation_v3::builder::translation_service::ListAdaptiveMtFiles;
3165    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
3166    /// use google_cloud_gax::paginator::ItemPaginator;
3167    ///
3168    /// let builder = prepare_request_builder();
3169    /// let mut items = builder.by_item();
3170    /// while let Some(result) = items.next().await {
3171    ///   let item = result?;
3172    /// }
3173    /// # Ok(()) }
3174    ///
3175    /// fn prepare_request_builder() -> ListAdaptiveMtFiles {
3176    ///   # panic!();
3177    ///   // ... details omitted ...
3178    /// }
3179    /// ```
3180    #[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        /// Sets the full request, replacing any prior values.
3191        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        /// Sets all the options, replacing any prior values.
3200        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3201            self.0.options = v.into();
3202            self
3203        }
3204
3205        /// Sends the request.
3206        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        /// Streams each page in the collection.
3214        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        /// Streams each item in the collection.
3231        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        /// Sets the value of [parent][crate::model::ListAdaptiveMtFilesRequest::parent].
3242        ///
3243        /// This is a **required** field for requests.
3244        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        /// Sets the value of [page_size][crate::model::ListAdaptiveMtFilesRequest::page_size].
3250        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        /// Sets the value of [page_token][crate::model::ListAdaptiveMtFilesRequest::page_token].
3256        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    /// The request builder for [TranslationService::list_adaptive_mt_sentences][crate::client::TranslationService::list_adaptive_mt_sentences] calls.
3270    ///
3271    /// # Example
3272    /// ```
3273    /// # use google_cloud_translation_v3::builder::translation_service::ListAdaptiveMtSentences;
3274    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
3275    /// use google_cloud_gax::paginator::ItemPaginator;
3276    ///
3277    /// let builder = prepare_request_builder();
3278    /// let mut items = builder.by_item();
3279    /// while let Some(result) = items.next().await {
3280    ///   let item = result?;
3281    /// }
3282    /// # Ok(()) }
3283    ///
3284    /// fn prepare_request_builder() -> ListAdaptiveMtSentences {
3285    ///   # panic!();
3286    ///   // ... details omitted ...
3287    /// }
3288    /// ```
3289    #[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        /// Sets the full request, replacing any prior values.
3302        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        /// Sets all the options, replacing any prior values.
3311        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3312            self.0.options = v.into();
3313            self
3314        }
3315
3316        /// Sends the request.
3317        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        /// Streams each page in the collection.
3325        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        /// Streams each item in the collection.
3342        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        /// Sets the value of [parent][crate::model::ListAdaptiveMtSentencesRequest::parent].
3353        ///
3354        /// This is a **required** field for requests.
3355        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        /// Sets the value of [page_size][crate::model::ListAdaptiveMtSentencesRequest::page_size].
3361        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        /// Sets the value of [page_token][crate::model::ListAdaptiveMtSentencesRequest::page_token].
3367        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    /// The request builder for [TranslationService::import_data][crate::client::TranslationService::import_data] calls.
3381    ///
3382    /// # Example
3383    /// ```
3384    /// # use google_cloud_translation_v3::builder::translation_service::ImportData;
3385    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
3386    /// use google_cloud_lro::Poller;
3387    ///
3388    /// let builder = prepare_request_builder();
3389    /// let response = builder.poller().until_done().await?;
3390    /// # Ok(()) }
3391    ///
3392    /// fn prepare_request_builder() -> ImportData {
3393    ///   # panic!();
3394    ///   // ... details omitted ...
3395    /// }
3396    /// ```
3397    #[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        /// Sets the full request, replacing any prior values.
3408        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        /// Sets all the options, replacing any prior values.
3414        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3415            self.0.options = v.into();
3416            self
3417        }
3418
3419        /// Sends the request.
3420        ///
3421        /// # Long running operations
3422        ///
3423        /// This starts, but does not poll, a longrunning operation. More information
3424        /// on [import_data][crate::client::TranslationService::import_data].
3425        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        /// Creates a [Poller][google_cloud_lro::Poller] to work with `import_data`.
3433        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        /// Sets the value of [dataset][crate::model::ImportDataRequest::dataset].
3469        ///
3470        /// This is a **required** field for requests.
3471        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        /// Sets the value of [input_config][crate::model::ImportDataRequest::input_config].
3477        ///
3478        /// This is a **required** field for requests.
3479        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        /// Sets or clears the value of [input_config][crate::model::ImportDataRequest::input_config].
3488        ///
3489        /// This is a **required** field for requests.
3490        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    /// The request builder for [TranslationService::export_data][crate::client::TranslationService::export_data] calls.
3507    ///
3508    /// # Example
3509    /// ```
3510    /// # use google_cloud_translation_v3::builder::translation_service::ExportData;
3511    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
3512    /// use google_cloud_lro::Poller;
3513    ///
3514    /// let builder = prepare_request_builder();
3515    /// let response = builder.poller().until_done().await?;
3516    /// # Ok(()) }
3517    ///
3518    /// fn prepare_request_builder() -> ExportData {
3519    ///   # panic!();
3520    ///   // ... details omitted ...
3521    /// }
3522    /// ```
3523    #[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        /// Sets the full request, replacing any prior values.
3534        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        /// Sets all the options, replacing any prior values.
3540        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3541            self.0.options = v.into();
3542            self
3543        }
3544
3545        /// Sends the request.
3546        ///
3547        /// # Long running operations
3548        ///
3549        /// This starts, but does not poll, a longrunning operation. More information
3550        /// on [export_data][crate::client::TranslationService::export_data].
3551        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        /// Creates a [Poller][google_cloud_lro::Poller] to work with `export_data`.
3559        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        /// Sets the value of [dataset][crate::model::ExportDataRequest::dataset].
3595        ///
3596        /// This is a **required** field for requests.
3597        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        /// Sets the value of [output_config][crate::model::ExportDataRequest::output_config].
3603        ///
3604        /// This is a **required** field for requests.
3605        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        /// Sets or clears the value of [output_config][crate::model::ExportDataRequest::output_config].
3614        ///
3615        /// This is a **required** field for requests.
3616        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    /// The request builder for [TranslationService::list_examples][crate::client::TranslationService::list_examples] calls.
3633    ///
3634    /// # Example
3635    /// ```
3636    /// # use google_cloud_translation_v3::builder::translation_service::ListExamples;
3637    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
3638    /// use google_cloud_gax::paginator::ItemPaginator;
3639    ///
3640    /// let builder = prepare_request_builder();
3641    /// let mut items = builder.by_item();
3642    /// while let Some(result) = items.next().await {
3643    ///   let item = result?;
3644    /// }
3645    /// # Ok(()) }
3646    ///
3647    /// fn prepare_request_builder() -> ListExamples {
3648    ///   # panic!();
3649    ///   // ... details omitted ...
3650    /// }
3651    /// ```
3652    #[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        /// Sets the full request, replacing any prior values.
3663        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        /// Sets all the options, replacing any prior values.
3669        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3670            self.0.options = v.into();
3671            self
3672        }
3673
3674        /// Sends the request.
3675        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        /// Streams each page in the collection.
3683        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        /// Streams each item in the collection.
3698        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        /// Sets the value of [parent][crate::model::ListExamplesRequest::parent].
3709        ///
3710        /// This is a **required** field for requests.
3711        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        /// Sets the value of [filter][crate::model::ListExamplesRequest::filter].
3717        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        /// Sets the value of [page_size][crate::model::ListExamplesRequest::page_size].
3723        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        /// Sets the value of [page_token][crate::model::ListExamplesRequest::page_token].
3729        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    /// The request builder for [TranslationService::create_model][crate::client::TranslationService::create_model] calls.
3743    ///
3744    /// # Example
3745    /// ```
3746    /// # use google_cloud_translation_v3::builder::translation_service::CreateModel;
3747    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
3748    /// use google_cloud_lro::Poller;
3749    ///
3750    /// let builder = prepare_request_builder();
3751    /// let response = builder.poller().until_done().await?;
3752    /// # Ok(()) }
3753    ///
3754    /// fn prepare_request_builder() -> CreateModel {
3755    ///   # panic!();
3756    ///   // ... details omitted ...
3757    /// }
3758    /// ```
3759    #[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        /// Sets the full request, replacing any prior values.
3770        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        /// Sets all the options, replacing any prior values.
3776        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3777            self.0.options = v.into();
3778            self
3779        }
3780
3781        /// Sends the request.
3782        ///
3783        /// # Long running operations
3784        ///
3785        /// This starts, but does not poll, a longrunning operation. More information
3786        /// on [create_model][crate::client::TranslationService::create_model].
3787        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        /// Creates a [Poller][google_cloud_lro::Poller] to work with `create_model`.
3795        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        /// Sets the value of [parent][crate::model::CreateModelRequest::parent].
3836        ///
3837        /// This is a **required** field for requests.
3838        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        /// Sets the value of [model][crate::model::CreateModelRequest::model].
3844        ///
3845        /// This is a **required** field for requests.
3846        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        /// Sets or clears the value of [model][crate::model::CreateModelRequest::model].
3855        ///
3856        /// This is a **required** field for requests.
3857        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    /// The request builder for [TranslationService::list_models][crate::client::TranslationService::list_models] calls.
3874    ///
3875    /// # Example
3876    /// ```
3877    /// # use google_cloud_translation_v3::builder::translation_service::ListModels;
3878    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
3879    /// use google_cloud_gax::paginator::ItemPaginator;
3880    ///
3881    /// let builder = prepare_request_builder();
3882    /// let mut items = builder.by_item();
3883    /// while let Some(result) = items.next().await {
3884    ///   let item = result?;
3885    /// }
3886    /// # Ok(()) }
3887    ///
3888    /// fn prepare_request_builder() -> ListModels {
3889    ///   # panic!();
3890    ///   // ... details omitted ...
3891    /// }
3892    /// ```
3893    #[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        /// Sets the full request, replacing any prior values.
3904        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        /// Sets all the options, replacing any prior values.
3910        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3911            self.0.options = v.into();
3912            self
3913        }
3914
3915        /// Sends the request.
3916        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        /// Streams each page in the collection.
3924        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        /// Streams each item in the collection.
3939        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        /// Sets the value of [parent][crate::model::ListModelsRequest::parent].
3950        ///
3951        /// This is a **required** field for requests.
3952        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        /// Sets the value of [filter][crate::model::ListModelsRequest::filter].
3958        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        /// Sets the value of [page_size][crate::model::ListModelsRequest::page_size].
3964        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        /// Sets the value of [page_token][crate::model::ListModelsRequest::page_token].
3970        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    /// The request builder for [TranslationService::get_model][crate::client::TranslationService::get_model] calls.
3984    ///
3985    /// # Example
3986    /// ```
3987    /// # use google_cloud_translation_v3::builder::translation_service::GetModel;
3988    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
3989    ///
3990    /// let builder = prepare_request_builder();
3991    /// let response = builder.send().await?;
3992    /// # Ok(()) }
3993    ///
3994    /// fn prepare_request_builder() -> GetModel {
3995    ///   # panic!();
3996    ///   // ... details omitted ...
3997    /// }
3998    /// ```
3999    #[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        /// Sets the full request, replacing any prior values.
4010        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        /// Sets all the options, replacing any prior values.
4016        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4017            self.0.options = v.into();
4018            self
4019        }
4020
4021        /// Sends the request.
4022        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        /// Sets the value of [name][crate::model::GetModelRequest::name].
4030        ///
4031        /// This is a **required** field for requests.
4032        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    /// The request builder for [TranslationService::delete_model][crate::client::TranslationService::delete_model] calls.
4046    ///
4047    /// # Example
4048    /// ```
4049    /// # use google_cloud_translation_v3::builder::translation_service::DeleteModel;
4050    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
4051    /// use google_cloud_lro::Poller;
4052    ///
4053    /// let builder = prepare_request_builder();
4054    /// let response = builder.poller().until_done().await?;
4055    /// # Ok(()) }
4056    ///
4057    /// fn prepare_request_builder() -> DeleteModel {
4058    ///   # panic!();
4059    ///   // ... details omitted ...
4060    /// }
4061    /// ```
4062    #[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        /// Sets the full request, replacing any prior values.
4073        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        /// Sets all the options, replacing any prior values.
4079        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4080            self.0.options = v.into();
4081            self
4082        }
4083
4084        /// Sends the request.
4085        ///
4086        /// # Long running operations
4087        ///
4088        /// This starts, but does not poll, a longrunning operation. More information
4089        /// on [delete_model][crate::client::TranslationService::delete_model].
4090        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        /// Creates a [Poller][google_cloud_lro::Poller] to work with `delete_model`.
4098        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        /// Sets the value of [name][crate::model::DeleteModelRequest::name].
4138        ///
4139        /// This is a **required** field for requests.
4140        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    /// The request builder for [TranslationService::list_locations][crate::client::TranslationService::list_locations] calls.
4154    ///
4155    /// # Example
4156    /// ```
4157    /// # use google_cloud_translation_v3::builder::translation_service::ListLocations;
4158    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
4159    /// use google_cloud_gax::paginator::ItemPaginator;
4160    ///
4161    /// let builder = prepare_request_builder();
4162    /// let mut items = builder.by_item();
4163    /// while let Some(result) = items.next().await {
4164    ///   let item = result?;
4165    /// }
4166    /// # Ok(()) }
4167    ///
4168    /// fn prepare_request_builder() -> ListLocations {
4169    ///   # panic!();
4170    ///   // ... details omitted ...
4171    /// }
4172    /// ```
4173    #[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        /// Sets the full request, replacing any prior values.
4184        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        /// Sets all the options, replacing any prior values.
4193        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4194            self.0.options = v.into();
4195            self
4196        }
4197
4198        /// Sends the request.
4199        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        /// Streams each page in the collection.
4207        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        /// Streams each item in the collection.
4224        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        /// Sets the value of [name][google_cloud_location::model::ListLocationsRequest::name].
4235        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        /// Sets the value of [filter][google_cloud_location::model::ListLocationsRequest::filter].
4241        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        /// Sets the value of [page_size][google_cloud_location::model::ListLocationsRequest::page_size].
4247        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        /// Sets the value of [page_token][google_cloud_location::model::ListLocationsRequest::page_token].
4253        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    /// The request builder for [TranslationService::get_location][crate::client::TranslationService::get_location] calls.
4267    ///
4268    /// # Example
4269    /// ```
4270    /// # use google_cloud_translation_v3::builder::translation_service::GetLocation;
4271    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
4272    ///
4273    /// let builder = prepare_request_builder();
4274    /// let response = builder.send().await?;
4275    /// # Ok(()) }
4276    ///
4277    /// fn prepare_request_builder() -> GetLocation {
4278    ///   # panic!();
4279    ///   // ... details omitted ...
4280    /// }
4281    /// ```
4282    #[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        /// Sets the full request, replacing any prior values.
4293        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        /// Sets all the options, replacing any prior values.
4302        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4303            self.0.options = v.into();
4304            self
4305        }
4306
4307        /// Sends the request.
4308        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        /// Sets the value of [name][google_cloud_location::model::GetLocationRequest::name].
4316        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    /// The request builder for [TranslationService::list_operations][crate::client::TranslationService::list_operations] calls.
4330    ///
4331    /// # Example
4332    /// ```
4333    /// # use google_cloud_translation_v3::builder::translation_service::ListOperations;
4334    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
4335    /// use google_cloud_gax::paginator::ItemPaginator;
4336    ///
4337    /// let builder = prepare_request_builder();
4338    /// let mut items = builder.by_item();
4339    /// while let Some(result) = items.next().await {
4340    ///   let item = result?;
4341    /// }
4342    /// # Ok(()) }
4343    ///
4344    /// fn prepare_request_builder() -> ListOperations {
4345    ///   # panic!();
4346    ///   // ... details omitted ...
4347    /// }
4348    /// ```
4349    #[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        /// Sets the full request, replacing any prior values.
4362        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        /// Sets all the options, replacing any prior values.
4371        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4372            self.0.options = v.into();
4373            self
4374        }
4375
4376        /// Sends the request.
4377        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        /// Streams each page in the collection.
4385        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        /// Streams each item in the collection.
4402        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        /// Sets the value of [name][google_cloud_longrunning::model::ListOperationsRequest::name].
4413        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        /// Sets the value of [filter][google_cloud_longrunning::model::ListOperationsRequest::filter].
4419        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        /// Sets the value of [page_size][google_cloud_longrunning::model::ListOperationsRequest::page_size].
4425        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        /// Sets the value of [page_token][google_cloud_longrunning::model::ListOperationsRequest::page_token].
4431        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        /// Sets the value of [return_partial_success][google_cloud_longrunning::model::ListOperationsRequest::return_partial_success].
4437        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    /// The request builder for [TranslationService::get_operation][crate::client::TranslationService::get_operation] calls.
4451    ///
4452    /// # Example
4453    /// ```
4454    /// # use google_cloud_translation_v3::builder::translation_service::GetOperation;
4455    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
4456    ///
4457    /// let builder = prepare_request_builder();
4458    /// let response = builder.send().await?;
4459    /// # Ok(()) }
4460    ///
4461    /// fn prepare_request_builder() -> GetOperation {
4462    ///   # panic!();
4463    ///   // ... details omitted ...
4464    /// }
4465    /// ```
4466    #[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        /// Sets the full request, replacing any prior values.
4477        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        /// Sets all the options, replacing any prior values.
4486        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4487            self.0.options = v.into();
4488            self
4489        }
4490
4491        /// Sends the request.
4492        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        /// Sets the value of [name][google_cloud_longrunning::model::GetOperationRequest::name].
4500        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    /// The request builder for [TranslationService::delete_operation][crate::client::TranslationService::delete_operation] calls.
4514    ///
4515    /// # Example
4516    /// ```
4517    /// # use google_cloud_translation_v3::builder::translation_service::DeleteOperation;
4518    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
4519    ///
4520    /// let builder = prepare_request_builder();
4521    /// let response = builder.send().await?;
4522    /// # Ok(()) }
4523    ///
4524    /// fn prepare_request_builder() -> DeleteOperation {
4525    ///   # panic!();
4526    ///   // ... details omitted ...
4527    /// }
4528    /// ```
4529    #[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        /// Sets the full request, replacing any prior values.
4542        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        /// Sets all the options, replacing any prior values.
4551        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4552            self.0.options = v.into();
4553            self
4554        }
4555
4556        /// Sends the request.
4557        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        /// Sets the value of [name][google_cloud_longrunning::model::DeleteOperationRequest::name].
4565        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    /// The request builder for [TranslationService::cancel_operation][crate::client::TranslationService::cancel_operation] calls.
4579    ///
4580    /// # Example
4581    /// ```
4582    /// # use google_cloud_translation_v3::builder::translation_service::CancelOperation;
4583    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
4584    ///
4585    /// let builder = prepare_request_builder();
4586    /// let response = builder.send().await?;
4587    /// # Ok(()) }
4588    ///
4589    /// fn prepare_request_builder() -> CancelOperation {
4590    ///   # panic!();
4591    ///   // ... details omitted ...
4592    /// }
4593    /// ```
4594    #[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        /// Sets the full request, replacing any prior values.
4607        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        /// Sets all the options, replacing any prior values.
4616        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4617            self.0.options = v.into();
4618            self
4619        }
4620
4621        /// Sends the request.
4622        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        /// Sets the value of [name][google_cloud_longrunning::model::CancelOperationRequest::name].
4630        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    /// The request builder for [TranslationService::wait_operation][crate::client::TranslationService::wait_operation] calls.
4644    ///
4645    /// # Example
4646    /// ```
4647    /// # use google_cloud_translation_v3::builder::translation_service::WaitOperation;
4648    /// # async fn sample() -> google_cloud_translation_v3::Result<()> {
4649    ///
4650    /// let builder = prepare_request_builder();
4651    /// let response = builder.send().await?;
4652    /// # Ok(()) }
4653    ///
4654    /// fn prepare_request_builder() -> WaitOperation {
4655    ///   # panic!();
4656    ///   // ... details omitted ...
4657    /// }
4658    /// ```
4659    #[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        /// Sets the full request, replacing any prior values.
4670        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        /// Sets all the options, replacing any prior values.
4679        pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4680            self.0.options = v.into();
4681            self
4682        }
4683
4684        /// Sends the request.
4685        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        /// Sets the value of [name][google_cloud_longrunning::model::WaitOperationRequest::name].
4693        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        /// Sets the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
4699        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        /// Sets or clears the value of [timeout][google_cloud_longrunning::model::WaitOperationRequest::timeout].
4708        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}