Skip to main content

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