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