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