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