Skip to main content

google_cloud_documentai_v1/
builder.rs

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