1pub mod document_processor_service {
19 use crate::Result;
20
21 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 #[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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
108 self.0.options = v.into();
109 self
110 }
111
112 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 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 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 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 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 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 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 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 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 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 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 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 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 #[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 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 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
287 self.0.options = v.into();
288 self
289 }
290
291 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 pub fn poller(
306 self,
307 ) -> impl google_cloud_lro::Poller<
308 crate::model::BatchProcessResponse,
309 crate::model::BatchProcessMetadata,
310 > {
311 type Operation = google_cloud_lro::internal::Operation<
312 crate::model::BatchProcessResponse,
313 crate::model::BatchProcessMetadata,
314 >;
315 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
316 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
317 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
318 if let Some(ref mut details) = poller_options.tracing {
319 details.method_name = "google_cloud_documentai_v1::client::DocumentProcessorService::batch_process_documents::until_done";
320 }
321
322 let stub = self.0.stub.clone();
323 let mut options = self.0.options.clone();
324 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
325 let query = move |name| {
326 let stub = stub.clone();
327 let options = options.clone();
328 async {
329 let op = GetOperation::new(stub)
330 .set_name(name)
331 .with_options(options)
332 .send()
333 .await?;
334 Ok(Operation::new(op))
335 }
336 };
337
338 let start = move || async {
339 let op = self.send().await?;
340 Ok(Operation::new(op))
341 };
342
343 use google_cloud_lro::internal::PollerExt;
344 {
345 google_cloud_lro::internal::new_poller(
346 polling_error_policy,
347 polling_backoff_policy,
348 start,
349 query,
350 )
351 }
352 .with_options(poller_options)
353 }
354
355 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
359 self.0.request.name = v.into();
360 self
361 }
362
363 pub fn set_input_documents<T>(mut self, v: T) -> Self
365 where
366 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
367 {
368 self.0.request.input_documents = std::option::Option::Some(v.into());
369 self
370 }
371
372 pub fn set_or_clear_input_documents<T>(mut self, v: std::option::Option<T>) -> Self
374 where
375 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
376 {
377 self.0.request.input_documents = v.map(|x| x.into());
378 self
379 }
380
381 pub fn set_document_output_config<T>(mut self, v: T) -> Self
383 where
384 T: std::convert::Into<crate::model::DocumentOutputConfig>,
385 {
386 self.0.request.document_output_config = std::option::Option::Some(v.into());
387 self
388 }
389
390 pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
392 where
393 T: std::convert::Into<crate::model::DocumentOutputConfig>,
394 {
395 self.0.request.document_output_config = v.map(|x| x.into());
396 self
397 }
398
399 pub fn set_skip_human_review<T: Into<bool>>(mut self, v: T) -> Self {
401 self.0.request.skip_human_review = v.into();
402 self
403 }
404
405 pub fn set_process_options<T>(mut self, v: T) -> Self
407 where
408 T: std::convert::Into<crate::model::ProcessOptions>,
409 {
410 self.0.request.process_options = std::option::Option::Some(v.into());
411 self
412 }
413
414 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
416 where
417 T: std::convert::Into<crate::model::ProcessOptions>,
418 {
419 self.0.request.process_options = v.map(|x| x.into());
420 self
421 }
422
423 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
425 where
426 T: std::iter::IntoIterator<Item = (K, V)>,
427 K: std::convert::Into<std::string::String>,
428 V: std::convert::Into<std::string::String>,
429 {
430 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
431 self
432 }
433 }
434
435 #[doc(hidden)]
436 impl crate::RequestBuilder for BatchProcessDocuments {
437 fn request_options(&mut self) -> &mut crate::RequestOptions {
438 &mut self.0.options
439 }
440 }
441
442 #[derive(Clone, Debug)]
459 pub struct FetchProcessorTypes(RequestBuilder<crate::model::FetchProcessorTypesRequest>);
460
461 impl FetchProcessorTypes {
462 pub(crate) fn new(
463 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
464 ) -> Self {
465 Self(RequestBuilder::new(stub))
466 }
467
468 pub fn with_request<V: Into<crate::model::FetchProcessorTypesRequest>>(
470 mut self,
471 v: V,
472 ) -> Self {
473 self.0.request = v.into();
474 self
475 }
476
477 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
479 self.0.options = v.into();
480 self
481 }
482
483 pub async fn send(self) -> Result<crate::model::FetchProcessorTypesResponse> {
485 (*self.0.stub)
486 .fetch_processor_types(self.0.request, self.0.options)
487 .await
488 .map(crate::Response::into_body)
489 }
490
491 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
495 self.0.request.parent = v.into();
496 self
497 }
498 }
499
500 #[doc(hidden)]
501 impl crate::RequestBuilder for FetchProcessorTypes {
502 fn request_options(&mut self) -> &mut crate::RequestOptions {
503 &mut self.0.options
504 }
505 }
506
507 #[derive(Clone, Debug)]
528 pub struct ListProcessorTypes(RequestBuilder<crate::model::ListProcessorTypesRequest>);
529
530 impl ListProcessorTypes {
531 pub(crate) fn new(
532 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
533 ) -> Self {
534 Self(RequestBuilder::new(stub))
535 }
536
537 pub fn with_request<V: Into<crate::model::ListProcessorTypesRequest>>(
539 mut self,
540 v: V,
541 ) -> Self {
542 self.0.request = v.into();
543 self
544 }
545
546 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
548 self.0.options = v.into();
549 self
550 }
551
552 pub async fn send(self) -> Result<crate::model::ListProcessorTypesResponse> {
554 (*self.0.stub)
555 .list_processor_types(self.0.request, self.0.options)
556 .await
557 .map(crate::Response::into_body)
558 }
559
560 pub fn by_page(
562 self,
563 ) -> impl google_cloud_gax::paginator::Paginator<
564 crate::model::ListProcessorTypesResponse,
565 crate::Error,
566 > {
567 use std::clone::Clone;
568 let token = self.0.request.page_token.clone();
569 let execute = move |token: String| {
570 let mut builder = self.clone();
571 builder.0.request = builder.0.request.set_page_token(token);
572 builder.send()
573 };
574 google_cloud_gax::paginator::internal::new_paginator(token, execute)
575 }
576
577 pub fn by_item(
579 self,
580 ) -> impl google_cloud_gax::paginator::ItemPaginator<
581 crate::model::ListProcessorTypesResponse,
582 crate::Error,
583 > {
584 use google_cloud_gax::paginator::Paginator;
585 self.by_page().items()
586 }
587
588 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
592 self.0.request.parent = v.into();
593 self
594 }
595
596 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
598 self.0.request.page_size = v.into();
599 self
600 }
601
602 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
604 self.0.request.page_token = v.into();
605 self
606 }
607 }
608
609 #[doc(hidden)]
610 impl crate::RequestBuilder for ListProcessorTypes {
611 fn request_options(&mut self) -> &mut crate::RequestOptions {
612 &mut self.0.options
613 }
614 }
615
616 #[derive(Clone, Debug)]
633 pub struct GetProcessorType(RequestBuilder<crate::model::GetProcessorTypeRequest>);
634
635 impl GetProcessorType {
636 pub(crate) fn new(
637 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
638 ) -> Self {
639 Self(RequestBuilder::new(stub))
640 }
641
642 pub fn with_request<V: Into<crate::model::GetProcessorTypeRequest>>(
644 mut self,
645 v: V,
646 ) -> Self {
647 self.0.request = v.into();
648 self
649 }
650
651 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
653 self.0.options = v.into();
654 self
655 }
656
657 pub async fn send(self) -> Result<crate::model::ProcessorType> {
659 (*self.0.stub)
660 .get_processor_type(self.0.request, self.0.options)
661 .await
662 .map(crate::Response::into_body)
663 }
664
665 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
669 self.0.request.name = v.into();
670 self
671 }
672 }
673
674 #[doc(hidden)]
675 impl crate::RequestBuilder for GetProcessorType {
676 fn request_options(&mut self) -> &mut crate::RequestOptions {
677 &mut self.0.options
678 }
679 }
680
681 #[derive(Clone, Debug)]
702 pub struct ListProcessors(RequestBuilder<crate::model::ListProcessorsRequest>);
703
704 impl ListProcessors {
705 pub(crate) fn new(
706 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
707 ) -> Self {
708 Self(RequestBuilder::new(stub))
709 }
710
711 pub fn with_request<V: Into<crate::model::ListProcessorsRequest>>(mut self, v: V) -> Self {
713 self.0.request = v.into();
714 self
715 }
716
717 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
719 self.0.options = v.into();
720 self
721 }
722
723 pub async fn send(self) -> Result<crate::model::ListProcessorsResponse> {
725 (*self.0.stub)
726 .list_processors(self.0.request, self.0.options)
727 .await
728 .map(crate::Response::into_body)
729 }
730
731 pub fn by_page(
733 self,
734 ) -> impl google_cloud_gax::paginator::Paginator<
735 crate::model::ListProcessorsResponse,
736 crate::Error,
737 > {
738 use std::clone::Clone;
739 let token = self.0.request.page_token.clone();
740 let execute = move |token: String| {
741 let mut builder = self.clone();
742 builder.0.request = builder.0.request.set_page_token(token);
743 builder.send()
744 };
745 google_cloud_gax::paginator::internal::new_paginator(token, execute)
746 }
747
748 pub fn by_item(
750 self,
751 ) -> impl google_cloud_gax::paginator::ItemPaginator<
752 crate::model::ListProcessorsResponse,
753 crate::Error,
754 > {
755 use google_cloud_gax::paginator::Paginator;
756 self.by_page().items()
757 }
758
759 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
763 self.0.request.parent = v.into();
764 self
765 }
766
767 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
769 self.0.request.page_size = v.into();
770 self
771 }
772
773 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
775 self.0.request.page_token = v.into();
776 self
777 }
778 }
779
780 #[doc(hidden)]
781 impl crate::RequestBuilder for ListProcessors {
782 fn request_options(&mut self) -> &mut crate::RequestOptions {
783 &mut self.0.options
784 }
785 }
786
787 #[derive(Clone, Debug)]
804 pub struct GetProcessor(RequestBuilder<crate::model::GetProcessorRequest>);
805
806 impl GetProcessor {
807 pub(crate) fn new(
808 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
809 ) -> Self {
810 Self(RequestBuilder::new(stub))
811 }
812
813 pub fn with_request<V: Into<crate::model::GetProcessorRequest>>(mut self, v: V) -> Self {
815 self.0.request = v.into();
816 self
817 }
818
819 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
821 self.0.options = v.into();
822 self
823 }
824
825 pub async fn send(self) -> Result<crate::model::Processor> {
827 (*self.0.stub)
828 .get_processor(self.0.request, self.0.options)
829 .await
830 .map(crate::Response::into_body)
831 }
832
833 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
837 self.0.request.name = v.into();
838 self
839 }
840 }
841
842 #[doc(hidden)]
843 impl crate::RequestBuilder for GetProcessor {
844 fn request_options(&mut self) -> &mut crate::RequestOptions {
845 &mut self.0.options
846 }
847 }
848
849 #[derive(Clone, Debug)]
867 pub struct TrainProcessorVersion(RequestBuilder<crate::model::TrainProcessorVersionRequest>);
868
869 impl TrainProcessorVersion {
870 pub(crate) fn new(
871 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
872 ) -> Self {
873 Self(RequestBuilder::new(stub))
874 }
875
876 pub fn with_request<V: Into<crate::model::TrainProcessorVersionRequest>>(
878 mut self,
879 v: V,
880 ) -> Self {
881 self.0.request = v.into();
882 self
883 }
884
885 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
887 self.0.options = v.into();
888 self
889 }
890
891 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
898 (*self.0.stub)
899 .train_processor_version(self.0.request, self.0.options)
900 .await
901 .map(crate::Response::into_body)
902 }
903
904 pub fn poller(
906 self,
907 ) -> impl google_cloud_lro::Poller<
908 crate::model::TrainProcessorVersionResponse,
909 crate::model::TrainProcessorVersionMetadata,
910 > {
911 type Operation = google_cloud_lro::internal::Operation<
912 crate::model::TrainProcessorVersionResponse,
913 crate::model::TrainProcessorVersionMetadata,
914 >;
915 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
916 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
917 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
918 if let Some(ref mut details) = poller_options.tracing {
919 details.method_name = "google_cloud_documentai_v1::client::DocumentProcessorService::train_processor_version::until_done";
920 }
921
922 let stub = self.0.stub.clone();
923 let mut options = self.0.options.clone();
924 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
925 let query = move |name| {
926 let stub = stub.clone();
927 let options = options.clone();
928 async {
929 let op = GetOperation::new(stub)
930 .set_name(name)
931 .with_options(options)
932 .send()
933 .await?;
934 Ok(Operation::new(op))
935 }
936 };
937
938 let start = move || async {
939 let op = self.send().await?;
940 Ok(Operation::new(op))
941 };
942
943 use google_cloud_lro::internal::PollerExt;
944 {
945 google_cloud_lro::internal::new_poller(
946 polling_error_policy,
947 polling_backoff_policy,
948 start,
949 query,
950 )
951 }
952 .with_options(poller_options)
953 }
954
955 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
959 self.0.request.parent = v.into();
960 self
961 }
962
963 pub fn set_processor_version<T>(mut self, v: T) -> Self
967 where
968 T: std::convert::Into<crate::model::ProcessorVersion>,
969 {
970 self.0.request.processor_version = std::option::Option::Some(v.into());
971 self
972 }
973
974 pub fn set_or_clear_processor_version<T>(mut self, v: std::option::Option<T>) -> Self
978 where
979 T: std::convert::Into<crate::model::ProcessorVersion>,
980 {
981 self.0.request.processor_version = v.map(|x| x.into());
982 self
983 }
984
985 pub fn set_document_schema<T>(mut self, v: T) -> Self
987 where
988 T: std::convert::Into<crate::model::DocumentSchema>,
989 {
990 self.0.request.document_schema = std::option::Option::Some(v.into());
991 self
992 }
993
994 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
996 where
997 T: std::convert::Into<crate::model::DocumentSchema>,
998 {
999 self.0.request.document_schema = v.map(|x| x.into());
1000 self
1001 }
1002
1003 pub fn set_input_data<T>(mut self, v: T) -> Self
1005 where
1006 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
1007 {
1008 self.0.request.input_data = std::option::Option::Some(v.into());
1009 self
1010 }
1011
1012 pub fn set_or_clear_input_data<T>(mut self, v: std::option::Option<T>) -> Self
1014 where
1015 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
1016 {
1017 self.0.request.input_data = v.map(|x| x.into());
1018 self
1019 }
1020
1021 pub fn set_base_processor_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
1023 self.0.request.base_processor_version = v.into();
1024 self
1025 }
1026
1027 pub fn set_processor_flags<
1032 T: Into<Option<crate::model::train_processor_version_request::ProcessorFlags>>,
1033 >(
1034 mut self,
1035 v: T,
1036 ) -> Self {
1037 self.0.request.processor_flags = v.into();
1038 self
1039 }
1040
1041 pub fn set_custom_document_extraction_options<T: std::convert::Into<std::boxed::Box<crate::model::train_processor_version_request::CustomDocumentExtractionOptions>>>(mut self, v: T) -> Self{
1047 self.0.request = self.0.request.set_custom_document_extraction_options(v);
1048 self
1049 }
1050
1051 pub fn set_foundation_model_tuning_options<
1057 T: std::convert::Into<
1058 std::boxed::Box<
1059 crate::model::train_processor_version_request::FoundationModelTuningOptions,
1060 >,
1061 >,
1062 >(
1063 mut self,
1064 v: T,
1065 ) -> Self {
1066 self.0.request = self.0.request.set_foundation_model_tuning_options(v);
1067 self
1068 }
1069 }
1070
1071 #[doc(hidden)]
1072 impl crate::RequestBuilder for TrainProcessorVersion {
1073 fn request_options(&mut self) -> &mut crate::RequestOptions {
1074 &mut self.0.options
1075 }
1076 }
1077
1078 #[derive(Clone, Debug)]
1095 pub struct GetProcessorVersion(RequestBuilder<crate::model::GetProcessorVersionRequest>);
1096
1097 impl GetProcessorVersion {
1098 pub(crate) fn new(
1099 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1100 ) -> Self {
1101 Self(RequestBuilder::new(stub))
1102 }
1103
1104 pub fn with_request<V: Into<crate::model::GetProcessorVersionRequest>>(
1106 mut self,
1107 v: V,
1108 ) -> Self {
1109 self.0.request = v.into();
1110 self
1111 }
1112
1113 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1115 self.0.options = v.into();
1116 self
1117 }
1118
1119 pub async fn send(self) -> Result<crate::model::ProcessorVersion> {
1121 (*self.0.stub)
1122 .get_processor_version(self.0.request, self.0.options)
1123 .await
1124 .map(crate::Response::into_body)
1125 }
1126
1127 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1131 self.0.request.name = v.into();
1132 self
1133 }
1134 }
1135
1136 #[doc(hidden)]
1137 impl crate::RequestBuilder for GetProcessorVersion {
1138 fn request_options(&mut self) -> &mut crate::RequestOptions {
1139 &mut self.0.options
1140 }
1141 }
1142
1143 #[derive(Clone, Debug)]
1164 pub struct ListProcessorVersions(RequestBuilder<crate::model::ListProcessorVersionsRequest>);
1165
1166 impl ListProcessorVersions {
1167 pub(crate) fn new(
1168 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1169 ) -> Self {
1170 Self(RequestBuilder::new(stub))
1171 }
1172
1173 pub fn with_request<V: Into<crate::model::ListProcessorVersionsRequest>>(
1175 mut self,
1176 v: V,
1177 ) -> Self {
1178 self.0.request = v.into();
1179 self
1180 }
1181
1182 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1184 self.0.options = v.into();
1185 self
1186 }
1187
1188 pub async fn send(self) -> Result<crate::model::ListProcessorVersionsResponse> {
1190 (*self.0.stub)
1191 .list_processor_versions(self.0.request, self.0.options)
1192 .await
1193 .map(crate::Response::into_body)
1194 }
1195
1196 pub fn by_page(
1198 self,
1199 ) -> impl google_cloud_gax::paginator::Paginator<
1200 crate::model::ListProcessorVersionsResponse,
1201 crate::Error,
1202 > {
1203 use std::clone::Clone;
1204 let token = self.0.request.page_token.clone();
1205 let execute = move |token: String| {
1206 let mut builder = self.clone();
1207 builder.0.request = builder.0.request.set_page_token(token);
1208 builder.send()
1209 };
1210 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1211 }
1212
1213 pub fn by_item(
1215 self,
1216 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1217 crate::model::ListProcessorVersionsResponse,
1218 crate::Error,
1219 > {
1220 use google_cloud_gax::paginator::Paginator;
1221 self.by_page().items()
1222 }
1223
1224 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1228 self.0.request.parent = v.into();
1229 self
1230 }
1231
1232 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1234 self.0.request.page_size = v.into();
1235 self
1236 }
1237
1238 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1240 self.0.request.page_token = v.into();
1241 self
1242 }
1243 }
1244
1245 #[doc(hidden)]
1246 impl crate::RequestBuilder for ListProcessorVersions {
1247 fn request_options(&mut self) -> &mut crate::RequestOptions {
1248 &mut self.0.options
1249 }
1250 }
1251
1252 #[derive(Clone, Debug)]
1270 pub struct DeleteProcessorVersion(RequestBuilder<crate::model::DeleteProcessorVersionRequest>);
1271
1272 impl DeleteProcessorVersion {
1273 pub(crate) fn new(
1274 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1275 ) -> Self {
1276 Self(RequestBuilder::new(stub))
1277 }
1278
1279 pub fn with_request<V: Into<crate::model::DeleteProcessorVersionRequest>>(
1281 mut self,
1282 v: V,
1283 ) -> Self {
1284 self.0.request = v.into();
1285 self
1286 }
1287
1288 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1290 self.0.options = v.into();
1291 self
1292 }
1293
1294 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1301 (*self.0.stub)
1302 .delete_processor_version(self.0.request, self.0.options)
1303 .await
1304 .map(crate::Response::into_body)
1305 }
1306
1307 pub fn poller(
1309 self,
1310 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteProcessorVersionMetadata>
1311 {
1312 type Operation = google_cloud_lro::internal::Operation<
1313 wkt::Empty,
1314 crate::model::DeleteProcessorVersionMetadata,
1315 >;
1316 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1317 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1318 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1319 if let Some(ref mut details) = poller_options.tracing {
1320 details.method_name = "google_cloud_documentai_v1::client::DocumentProcessorService::delete_processor_version::until_done";
1321 }
1322
1323 let stub = self.0.stub.clone();
1324 let mut options = self.0.options.clone();
1325 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1326 let query = move |name| {
1327 let stub = stub.clone();
1328 let options = options.clone();
1329 async {
1330 let op = GetOperation::new(stub)
1331 .set_name(name)
1332 .with_options(options)
1333 .send()
1334 .await?;
1335 Ok(Operation::new(op))
1336 }
1337 };
1338
1339 let start = move || async {
1340 let op = self.send().await?;
1341 Ok(Operation::new(op))
1342 };
1343
1344 use google_cloud_lro::internal::PollerExt;
1345 {
1346 google_cloud_lro::internal::new_unit_response_poller(
1347 polling_error_policy,
1348 polling_backoff_policy,
1349 start,
1350 query,
1351 )
1352 }
1353 .with_options(poller_options)
1354 }
1355
1356 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1360 self.0.request.name = v.into();
1361 self
1362 }
1363 }
1364
1365 #[doc(hidden)]
1366 impl crate::RequestBuilder for DeleteProcessorVersion {
1367 fn request_options(&mut self) -> &mut crate::RequestOptions {
1368 &mut self.0.options
1369 }
1370 }
1371
1372 #[derive(Clone, Debug)]
1390 pub struct DeployProcessorVersion(RequestBuilder<crate::model::DeployProcessorVersionRequest>);
1391
1392 impl DeployProcessorVersion {
1393 pub(crate) fn new(
1394 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1395 ) -> Self {
1396 Self(RequestBuilder::new(stub))
1397 }
1398
1399 pub fn with_request<V: Into<crate::model::DeployProcessorVersionRequest>>(
1401 mut self,
1402 v: V,
1403 ) -> Self {
1404 self.0.request = v.into();
1405 self
1406 }
1407
1408 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1410 self.0.options = v.into();
1411 self
1412 }
1413
1414 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1421 (*self.0.stub)
1422 .deploy_processor_version(self.0.request, self.0.options)
1423 .await
1424 .map(crate::Response::into_body)
1425 }
1426
1427 pub fn poller(
1429 self,
1430 ) -> impl google_cloud_lro::Poller<
1431 crate::model::DeployProcessorVersionResponse,
1432 crate::model::DeployProcessorVersionMetadata,
1433 > {
1434 type Operation = google_cloud_lro::internal::Operation<
1435 crate::model::DeployProcessorVersionResponse,
1436 crate::model::DeployProcessorVersionMetadata,
1437 >;
1438 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1439 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1440 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1441 if let Some(ref mut details) = poller_options.tracing {
1442 details.method_name = "google_cloud_documentai_v1::client::DocumentProcessorService::deploy_processor_version::until_done";
1443 }
1444
1445 let stub = self.0.stub.clone();
1446 let mut options = self.0.options.clone();
1447 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1448 let query = move |name| {
1449 let stub = stub.clone();
1450 let options = options.clone();
1451 async {
1452 let op = GetOperation::new(stub)
1453 .set_name(name)
1454 .with_options(options)
1455 .send()
1456 .await?;
1457 Ok(Operation::new(op))
1458 }
1459 };
1460
1461 let start = move || async {
1462 let op = self.send().await?;
1463 Ok(Operation::new(op))
1464 };
1465
1466 use google_cloud_lro::internal::PollerExt;
1467 {
1468 google_cloud_lro::internal::new_poller(
1469 polling_error_policy,
1470 polling_backoff_policy,
1471 start,
1472 query,
1473 )
1474 }
1475 .with_options(poller_options)
1476 }
1477
1478 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1482 self.0.request.name = v.into();
1483 self
1484 }
1485 }
1486
1487 #[doc(hidden)]
1488 impl crate::RequestBuilder for DeployProcessorVersion {
1489 fn request_options(&mut self) -> &mut crate::RequestOptions {
1490 &mut self.0.options
1491 }
1492 }
1493
1494 #[derive(Clone, Debug)]
1512 pub struct UndeployProcessorVersion(
1513 RequestBuilder<crate::model::UndeployProcessorVersionRequest>,
1514 );
1515
1516 impl UndeployProcessorVersion {
1517 pub(crate) fn new(
1518 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1519 ) -> Self {
1520 Self(RequestBuilder::new(stub))
1521 }
1522
1523 pub fn with_request<V: Into<crate::model::UndeployProcessorVersionRequest>>(
1525 mut self,
1526 v: V,
1527 ) -> Self {
1528 self.0.request = v.into();
1529 self
1530 }
1531
1532 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1534 self.0.options = v.into();
1535 self
1536 }
1537
1538 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1545 (*self.0.stub)
1546 .undeploy_processor_version(self.0.request, self.0.options)
1547 .await
1548 .map(crate::Response::into_body)
1549 }
1550
1551 pub fn poller(
1553 self,
1554 ) -> impl google_cloud_lro::Poller<
1555 crate::model::UndeployProcessorVersionResponse,
1556 crate::model::UndeployProcessorVersionMetadata,
1557 > {
1558 type Operation = google_cloud_lro::internal::Operation<
1559 crate::model::UndeployProcessorVersionResponse,
1560 crate::model::UndeployProcessorVersionMetadata,
1561 >;
1562 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1563 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1564 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1565 if let Some(ref mut details) = poller_options.tracing {
1566 details.method_name = "google_cloud_documentai_v1::client::DocumentProcessorService::undeploy_processor_version::until_done";
1567 }
1568
1569 let stub = self.0.stub.clone();
1570 let mut options = self.0.options.clone();
1571 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1572 let query = move |name| {
1573 let stub = stub.clone();
1574 let options = options.clone();
1575 async {
1576 let op = GetOperation::new(stub)
1577 .set_name(name)
1578 .with_options(options)
1579 .send()
1580 .await?;
1581 Ok(Operation::new(op))
1582 }
1583 };
1584
1585 let start = move || async {
1586 let op = self.send().await?;
1587 Ok(Operation::new(op))
1588 };
1589
1590 use google_cloud_lro::internal::PollerExt;
1591 {
1592 google_cloud_lro::internal::new_poller(
1593 polling_error_policy,
1594 polling_backoff_policy,
1595 start,
1596 query,
1597 )
1598 }
1599 .with_options(poller_options)
1600 }
1601
1602 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1606 self.0.request.name = v.into();
1607 self
1608 }
1609 }
1610
1611 #[doc(hidden)]
1612 impl crate::RequestBuilder for UndeployProcessorVersion {
1613 fn request_options(&mut self) -> &mut crate::RequestOptions {
1614 &mut self.0.options
1615 }
1616 }
1617
1618 #[derive(Clone, Debug)]
1635 pub struct CreateProcessor(RequestBuilder<crate::model::CreateProcessorRequest>);
1636
1637 impl CreateProcessor {
1638 pub(crate) fn new(
1639 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1640 ) -> Self {
1641 Self(RequestBuilder::new(stub))
1642 }
1643
1644 pub fn with_request<V: Into<crate::model::CreateProcessorRequest>>(mut self, v: V) -> Self {
1646 self.0.request = v.into();
1647 self
1648 }
1649
1650 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1652 self.0.options = v.into();
1653 self
1654 }
1655
1656 pub async fn send(self) -> Result<crate::model::Processor> {
1658 (*self.0.stub)
1659 .create_processor(self.0.request, self.0.options)
1660 .await
1661 .map(crate::Response::into_body)
1662 }
1663
1664 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1668 self.0.request.parent = v.into();
1669 self
1670 }
1671
1672 pub fn set_processor<T>(mut self, v: T) -> Self
1676 where
1677 T: std::convert::Into<crate::model::Processor>,
1678 {
1679 self.0.request.processor = std::option::Option::Some(v.into());
1680 self
1681 }
1682
1683 pub fn set_or_clear_processor<T>(mut self, v: std::option::Option<T>) -> Self
1687 where
1688 T: std::convert::Into<crate::model::Processor>,
1689 {
1690 self.0.request.processor = v.map(|x| x.into());
1691 self
1692 }
1693 }
1694
1695 #[doc(hidden)]
1696 impl crate::RequestBuilder for CreateProcessor {
1697 fn request_options(&mut self) -> &mut crate::RequestOptions {
1698 &mut self.0.options
1699 }
1700 }
1701
1702 #[derive(Clone, Debug)]
1720 pub struct DeleteProcessor(RequestBuilder<crate::model::DeleteProcessorRequest>);
1721
1722 impl DeleteProcessor {
1723 pub(crate) fn new(
1724 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1725 ) -> Self {
1726 Self(RequestBuilder::new(stub))
1727 }
1728
1729 pub fn with_request<V: Into<crate::model::DeleteProcessorRequest>>(mut self, v: V) -> Self {
1731 self.0.request = v.into();
1732 self
1733 }
1734
1735 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1737 self.0.options = v.into();
1738 self
1739 }
1740
1741 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1748 (*self.0.stub)
1749 .delete_processor(self.0.request, self.0.options)
1750 .await
1751 .map(crate::Response::into_body)
1752 }
1753
1754 pub fn poller(
1756 self,
1757 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteProcessorMetadata> {
1758 type Operation = google_cloud_lro::internal::Operation<
1759 wkt::Empty,
1760 crate::model::DeleteProcessorMetadata,
1761 >;
1762 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1763 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1764 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1765 if let Some(ref mut details) = poller_options.tracing {
1766 details.method_name = "google_cloud_documentai_v1::client::DocumentProcessorService::delete_processor::until_done";
1767 }
1768
1769 let stub = self.0.stub.clone();
1770 let mut options = self.0.options.clone();
1771 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1772 let query = move |name| {
1773 let stub = stub.clone();
1774 let options = options.clone();
1775 async {
1776 let op = GetOperation::new(stub)
1777 .set_name(name)
1778 .with_options(options)
1779 .send()
1780 .await?;
1781 Ok(Operation::new(op))
1782 }
1783 };
1784
1785 let start = move || async {
1786 let op = self.send().await?;
1787 Ok(Operation::new(op))
1788 };
1789
1790 use google_cloud_lro::internal::PollerExt;
1791 {
1792 google_cloud_lro::internal::new_unit_response_poller(
1793 polling_error_policy,
1794 polling_backoff_policy,
1795 start,
1796 query,
1797 )
1798 }
1799 .with_options(poller_options)
1800 }
1801
1802 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1806 self.0.request.name = v.into();
1807 self
1808 }
1809 }
1810
1811 #[doc(hidden)]
1812 impl crate::RequestBuilder for DeleteProcessor {
1813 fn request_options(&mut self) -> &mut crate::RequestOptions {
1814 &mut self.0.options
1815 }
1816 }
1817
1818 #[derive(Clone, Debug)]
1836 pub struct EnableProcessor(RequestBuilder<crate::model::EnableProcessorRequest>);
1837
1838 impl EnableProcessor {
1839 pub(crate) fn new(
1840 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1841 ) -> Self {
1842 Self(RequestBuilder::new(stub))
1843 }
1844
1845 pub fn with_request<V: Into<crate::model::EnableProcessorRequest>>(mut self, v: V) -> Self {
1847 self.0.request = v.into();
1848 self
1849 }
1850
1851 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1853 self.0.options = v.into();
1854 self
1855 }
1856
1857 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1864 (*self.0.stub)
1865 .enable_processor(self.0.request, self.0.options)
1866 .await
1867 .map(crate::Response::into_body)
1868 }
1869
1870 pub fn poller(
1872 self,
1873 ) -> impl google_cloud_lro::Poller<
1874 crate::model::EnableProcessorResponse,
1875 crate::model::EnableProcessorMetadata,
1876 > {
1877 type Operation = google_cloud_lro::internal::Operation<
1878 crate::model::EnableProcessorResponse,
1879 crate::model::EnableProcessorMetadata,
1880 >;
1881 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1882 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1883 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1884 if let Some(ref mut details) = poller_options.tracing {
1885 details.method_name = "google_cloud_documentai_v1::client::DocumentProcessorService::enable_processor::until_done";
1886 }
1887
1888 let stub = self.0.stub.clone();
1889 let mut options = self.0.options.clone();
1890 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1891 let query = move |name| {
1892 let stub = stub.clone();
1893 let options = options.clone();
1894 async {
1895 let op = GetOperation::new(stub)
1896 .set_name(name)
1897 .with_options(options)
1898 .send()
1899 .await?;
1900 Ok(Operation::new(op))
1901 }
1902 };
1903
1904 let start = move || async {
1905 let op = self.send().await?;
1906 Ok(Operation::new(op))
1907 };
1908
1909 use google_cloud_lro::internal::PollerExt;
1910 {
1911 google_cloud_lro::internal::new_poller(
1912 polling_error_policy,
1913 polling_backoff_policy,
1914 start,
1915 query,
1916 )
1917 }
1918 .with_options(poller_options)
1919 }
1920
1921 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1925 self.0.request.name = v.into();
1926 self
1927 }
1928 }
1929
1930 #[doc(hidden)]
1931 impl crate::RequestBuilder for EnableProcessor {
1932 fn request_options(&mut self) -> &mut crate::RequestOptions {
1933 &mut self.0.options
1934 }
1935 }
1936
1937 #[derive(Clone, Debug)]
1955 pub struct DisableProcessor(RequestBuilder<crate::model::DisableProcessorRequest>);
1956
1957 impl DisableProcessor {
1958 pub(crate) fn new(
1959 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1960 ) -> Self {
1961 Self(RequestBuilder::new(stub))
1962 }
1963
1964 pub fn with_request<V: Into<crate::model::DisableProcessorRequest>>(
1966 mut self,
1967 v: V,
1968 ) -> Self {
1969 self.0.request = v.into();
1970 self
1971 }
1972
1973 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1975 self.0.options = v.into();
1976 self
1977 }
1978
1979 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1986 (*self.0.stub)
1987 .disable_processor(self.0.request, self.0.options)
1988 .await
1989 .map(crate::Response::into_body)
1990 }
1991
1992 pub fn poller(
1994 self,
1995 ) -> impl google_cloud_lro::Poller<
1996 crate::model::DisableProcessorResponse,
1997 crate::model::DisableProcessorMetadata,
1998 > {
1999 type Operation = google_cloud_lro::internal::Operation<
2000 crate::model::DisableProcessorResponse,
2001 crate::model::DisableProcessorMetadata,
2002 >;
2003 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2004 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2005 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2006 if let Some(ref mut details) = poller_options.tracing {
2007 details.method_name = "google_cloud_documentai_v1::client::DocumentProcessorService::disable_processor::until_done";
2008 }
2009
2010 let stub = self.0.stub.clone();
2011 let mut options = self.0.options.clone();
2012 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2013 let query = move |name| {
2014 let stub = stub.clone();
2015 let options = options.clone();
2016 async {
2017 let op = GetOperation::new(stub)
2018 .set_name(name)
2019 .with_options(options)
2020 .send()
2021 .await?;
2022 Ok(Operation::new(op))
2023 }
2024 };
2025
2026 let start = move || async {
2027 let op = self.send().await?;
2028 Ok(Operation::new(op))
2029 };
2030
2031 use google_cloud_lro::internal::PollerExt;
2032 {
2033 google_cloud_lro::internal::new_poller(
2034 polling_error_policy,
2035 polling_backoff_policy,
2036 start,
2037 query,
2038 )
2039 }
2040 .with_options(poller_options)
2041 }
2042
2043 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2047 self.0.request.name = v.into();
2048 self
2049 }
2050 }
2051
2052 #[doc(hidden)]
2053 impl crate::RequestBuilder for DisableProcessor {
2054 fn request_options(&mut self) -> &mut crate::RequestOptions {
2055 &mut self.0.options
2056 }
2057 }
2058
2059 #[derive(Clone, Debug)]
2077 pub struct SetDefaultProcessorVersion(
2078 RequestBuilder<crate::model::SetDefaultProcessorVersionRequest>,
2079 );
2080
2081 impl SetDefaultProcessorVersion {
2082 pub(crate) fn new(
2083 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2084 ) -> Self {
2085 Self(RequestBuilder::new(stub))
2086 }
2087
2088 pub fn with_request<V: Into<crate::model::SetDefaultProcessorVersionRequest>>(
2090 mut self,
2091 v: V,
2092 ) -> Self {
2093 self.0.request = v.into();
2094 self
2095 }
2096
2097 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2099 self.0.options = v.into();
2100 self
2101 }
2102
2103 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2110 (*self.0.stub)
2111 .set_default_processor_version(self.0.request, self.0.options)
2112 .await
2113 .map(crate::Response::into_body)
2114 }
2115
2116 pub fn poller(
2118 self,
2119 ) -> impl google_cloud_lro::Poller<
2120 crate::model::SetDefaultProcessorVersionResponse,
2121 crate::model::SetDefaultProcessorVersionMetadata,
2122 > {
2123 type Operation = google_cloud_lro::internal::Operation<
2124 crate::model::SetDefaultProcessorVersionResponse,
2125 crate::model::SetDefaultProcessorVersionMetadata,
2126 >;
2127 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2128 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2129 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2130 if let Some(ref mut details) = poller_options.tracing {
2131 details.method_name = "google_cloud_documentai_v1::client::DocumentProcessorService::set_default_processor_version::until_done";
2132 }
2133
2134 let stub = self.0.stub.clone();
2135 let mut options = self.0.options.clone();
2136 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2137 let query = move |name| {
2138 let stub = stub.clone();
2139 let options = options.clone();
2140 async {
2141 let op = GetOperation::new(stub)
2142 .set_name(name)
2143 .with_options(options)
2144 .send()
2145 .await?;
2146 Ok(Operation::new(op))
2147 }
2148 };
2149
2150 let start = move || async {
2151 let op = self.send().await?;
2152 Ok(Operation::new(op))
2153 };
2154
2155 use google_cloud_lro::internal::PollerExt;
2156 {
2157 google_cloud_lro::internal::new_poller(
2158 polling_error_policy,
2159 polling_backoff_policy,
2160 start,
2161 query,
2162 )
2163 }
2164 .with_options(poller_options)
2165 }
2166
2167 pub fn set_processor<T: Into<std::string::String>>(mut self, v: T) -> Self {
2171 self.0.request.processor = v.into();
2172 self
2173 }
2174
2175 pub fn set_default_processor_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
2179 self.0.request.default_processor_version = v.into();
2180 self
2181 }
2182 }
2183
2184 #[doc(hidden)]
2185 impl crate::RequestBuilder for SetDefaultProcessorVersion {
2186 fn request_options(&mut self) -> &mut crate::RequestOptions {
2187 &mut self.0.options
2188 }
2189 }
2190
2191 #[derive(Clone, Debug)]
2209 pub struct ReviewDocument(RequestBuilder<crate::model::ReviewDocumentRequest>);
2210
2211 impl ReviewDocument {
2212 pub(crate) fn new(
2213 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2214 ) -> Self {
2215 Self(RequestBuilder::new(stub))
2216 }
2217
2218 pub fn with_request<V: Into<crate::model::ReviewDocumentRequest>>(mut self, v: V) -> Self {
2220 self.0.request = v.into();
2221 self
2222 }
2223
2224 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2226 self.0.options = v.into();
2227 self
2228 }
2229
2230 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2237 (*self.0.stub)
2238 .review_document(self.0.request, self.0.options)
2239 .await
2240 .map(crate::Response::into_body)
2241 }
2242
2243 pub fn poller(
2245 self,
2246 ) -> impl google_cloud_lro::Poller<
2247 crate::model::ReviewDocumentResponse,
2248 crate::model::ReviewDocumentOperationMetadata,
2249 > {
2250 type Operation = google_cloud_lro::internal::Operation<
2251 crate::model::ReviewDocumentResponse,
2252 crate::model::ReviewDocumentOperationMetadata,
2253 >;
2254 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2255 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2256 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2257 if let Some(ref mut details) = poller_options.tracing {
2258 details.method_name = "google_cloud_documentai_v1::client::DocumentProcessorService::review_document::until_done";
2259 }
2260
2261 let stub = self.0.stub.clone();
2262 let mut options = self.0.options.clone();
2263 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2264 let query = move |name| {
2265 let stub = stub.clone();
2266 let options = options.clone();
2267 async {
2268 let op = GetOperation::new(stub)
2269 .set_name(name)
2270 .with_options(options)
2271 .send()
2272 .await?;
2273 Ok(Operation::new(op))
2274 }
2275 };
2276
2277 let start = move || async {
2278 let op = self.send().await?;
2279 Ok(Operation::new(op))
2280 };
2281
2282 use google_cloud_lro::internal::PollerExt;
2283 {
2284 google_cloud_lro::internal::new_poller(
2285 polling_error_policy,
2286 polling_backoff_policy,
2287 start,
2288 query,
2289 )
2290 }
2291 .with_options(poller_options)
2292 }
2293
2294 pub fn set_human_review_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2298 self.0.request.human_review_config = v.into();
2299 self
2300 }
2301
2302 pub fn set_enable_schema_validation<T: Into<bool>>(mut self, v: T) -> Self {
2304 self.0.request.enable_schema_validation = v.into();
2305 self
2306 }
2307
2308 pub fn set_priority<T: Into<crate::model::review_document_request::Priority>>(
2310 mut self,
2311 v: T,
2312 ) -> Self {
2313 self.0.request.priority = v.into();
2314 self
2315 }
2316
2317 pub fn set_document_schema<T>(mut self, v: T) -> Self
2319 where
2320 T: std::convert::Into<crate::model::DocumentSchema>,
2321 {
2322 self.0.request.document_schema = std::option::Option::Some(v.into());
2323 self
2324 }
2325
2326 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
2328 where
2329 T: std::convert::Into<crate::model::DocumentSchema>,
2330 {
2331 self.0.request.document_schema = v.map(|x| x.into());
2332 self
2333 }
2334
2335 pub fn set_source<T: Into<Option<crate::model::review_document_request::Source>>>(
2340 mut self,
2341 v: T,
2342 ) -> Self {
2343 self.0.request.source = v.into();
2344 self
2345 }
2346
2347 pub fn set_inline_document<
2353 T: std::convert::Into<std::boxed::Box<crate::model::Document>>,
2354 >(
2355 mut self,
2356 v: T,
2357 ) -> Self {
2358 self.0.request = self.0.request.set_inline_document(v);
2359 self
2360 }
2361 }
2362
2363 #[doc(hidden)]
2364 impl crate::RequestBuilder for ReviewDocument {
2365 fn request_options(&mut self) -> &mut crate::RequestOptions {
2366 &mut self.0.options
2367 }
2368 }
2369
2370 #[derive(Clone, Debug)]
2388 pub struct EvaluateProcessorVersion(
2389 RequestBuilder<crate::model::EvaluateProcessorVersionRequest>,
2390 );
2391
2392 impl EvaluateProcessorVersion {
2393 pub(crate) fn new(
2394 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2395 ) -> Self {
2396 Self(RequestBuilder::new(stub))
2397 }
2398
2399 pub fn with_request<V: Into<crate::model::EvaluateProcessorVersionRequest>>(
2401 mut self,
2402 v: V,
2403 ) -> Self {
2404 self.0.request = v.into();
2405 self
2406 }
2407
2408 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2410 self.0.options = v.into();
2411 self
2412 }
2413
2414 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2421 (*self.0.stub)
2422 .evaluate_processor_version(self.0.request, self.0.options)
2423 .await
2424 .map(crate::Response::into_body)
2425 }
2426
2427 pub fn poller(
2429 self,
2430 ) -> impl google_cloud_lro::Poller<
2431 crate::model::EvaluateProcessorVersionResponse,
2432 crate::model::EvaluateProcessorVersionMetadata,
2433 > {
2434 type Operation = google_cloud_lro::internal::Operation<
2435 crate::model::EvaluateProcessorVersionResponse,
2436 crate::model::EvaluateProcessorVersionMetadata,
2437 >;
2438 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2439 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2440 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
2441 if let Some(ref mut details) = poller_options.tracing {
2442 details.method_name = "google_cloud_documentai_v1::client::DocumentProcessorService::evaluate_processor_version::until_done";
2443 }
2444
2445 let stub = self.0.stub.clone();
2446 let mut options = self.0.options.clone();
2447 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2448 let query = move |name| {
2449 let stub = stub.clone();
2450 let options = options.clone();
2451 async {
2452 let op = GetOperation::new(stub)
2453 .set_name(name)
2454 .with_options(options)
2455 .send()
2456 .await?;
2457 Ok(Operation::new(op))
2458 }
2459 };
2460
2461 let start = move || async {
2462 let op = self.send().await?;
2463 Ok(Operation::new(op))
2464 };
2465
2466 use google_cloud_lro::internal::PollerExt;
2467 {
2468 google_cloud_lro::internal::new_poller(
2469 polling_error_policy,
2470 polling_backoff_policy,
2471 start,
2472 query,
2473 )
2474 }
2475 .with_options(poller_options)
2476 }
2477
2478 pub fn set_processor_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
2482 self.0.request.processor_version = v.into();
2483 self
2484 }
2485
2486 pub fn set_evaluation_documents<T>(mut self, v: T) -> Self
2488 where
2489 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
2490 {
2491 self.0.request.evaluation_documents = std::option::Option::Some(v.into());
2492 self
2493 }
2494
2495 pub fn set_or_clear_evaluation_documents<T>(mut self, v: std::option::Option<T>) -> Self
2497 where
2498 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
2499 {
2500 self.0.request.evaluation_documents = v.map(|x| x.into());
2501 self
2502 }
2503 }
2504
2505 #[doc(hidden)]
2506 impl crate::RequestBuilder for EvaluateProcessorVersion {
2507 fn request_options(&mut self) -> &mut crate::RequestOptions {
2508 &mut self.0.options
2509 }
2510 }
2511
2512 #[derive(Clone, Debug)]
2529 pub struct GetEvaluation(RequestBuilder<crate::model::GetEvaluationRequest>);
2530
2531 impl GetEvaluation {
2532 pub(crate) fn new(
2533 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2534 ) -> Self {
2535 Self(RequestBuilder::new(stub))
2536 }
2537
2538 pub fn with_request<V: Into<crate::model::GetEvaluationRequest>>(mut self, v: V) -> Self {
2540 self.0.request = v.into();
2541 self
2542 }
2543
2544 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2546 self.0.options = v.into();
2547 self
2548 }
2549
2550 pub async fn send(self) -> Result<crate::model::Evaluation> {
2552 (*self.0.stub)
2553 .get_evaluation(self.0.request, self.0.options)
2554 .await
2555 .map(crate::Response::into_body)
2556 }
2557
2558 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2562 self.0.request.name = v.into();
2563 self
2564 }
2565 }
2566
2567 #[doc(hidden)]
2568 impl crate::RequestBuilder for GetEvaluation {
2569 fn request_options(&mut self) -> &mut crate::RequestOptions {
2570 &mut self.0.options
2571 }
2572 }
2573
2574 #[derive(Clone, Debug)]
2595 pub struct ListEvaluations(RequestBuilder<crate::model::ListEvaluationsRequest>);
2596
2597 impl ListEvaluations {
2598 pub(crate) fn new(
2599 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2600 ) -> Self {
2601 Self(RequestBuilder::new(stub))
2602 }
2603
2604 pub fn with_request<V: Into<crate::model::ListEvaluationsRequest>>(mut self, v: V) -> Self {
2606 self.0.request = v.into();
2607 self
2608 }
2609
2610 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2612 self.0.options = v.into();
2613 self
2614 }
2615
2616 pub async fn send(self) -> Result<crate::model::ListEvaluationsResponse> {
2618 (*self.0.stub)
2619 .list_evaluations(self.0.request, self.0.options)
2620 .await
2621 .map(crate::Response::into_body)
2622 }
2623
2624 pub fn by_page(
2626 self,
2627 ) -> impl google_cloud_gax::paginator::Paginator<
2628 crate::model::ListEvaluationsResponse,
2629 crate::Error,
2630 > {
2631 use std::clone::Clone;
2632 let token = self.0.request.page_token.clone();
2633 let execute = move |token: String| {
2634 let mut builder = self.clone();
2635 builder.0.request = builder.0.request.set_page_token(token);
2636 builder.send()
2637 };
2638 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2639 }
2640
2641 pub fn by_item(
2643 self,
2644 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2645 crate::model::ListEvaluationsResponse,
2646 crate::Error,
2647 > {
2648 use google_cloud_gax::paginator::Paginator;
2649 self.by_page().items()
2650 }
2651
2652 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2656 self.0.request.parent = v.into();
2657 self
2658 }
2659
2660 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2662 self.0.request.page_size = v.into();
2663 self
2664 }
2665
2666 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2668 self.0.request.page_token = v.into();
2669 self
2670 }
2671 }
2672
2673 #[doc(hidden)]
2674 impl crate::RequestBuilder for ListEvaluations {
2675 fn request_options(&mut self) -> &mut crate::RequestOptions {
2676 &mut self.0.options
2677 }
2678 }
2679
2680 #[derive(Clone, Debug)]
2701 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
2702
2703 impl ListLocations {
2704 pub(crate) fn new(
2705 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2706 ) -> Self {
2707 Self(RequestBuilder::new(stub))
2708 }
2709
2710 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
2712 mut self,
2713 v: V,
2714 ) -> Self {
2715 self.0.request = v.into();
2716 self
2717 }
2718
2719 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2721 self.0.options = v.into();
2722 self
2723 }
2724
2725 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
2727 (*self.0.stub)
2728 .list_locations(self.0.request, self.0.options)
2729 .await
2730 .map(crate::Response::into_body)
2731 }
2732
2733 pub fn by_page(
2735 self,
2736 ) -> impl google_cloud_gax::paginator::Paginator<
2737 google_cloud_location::model::ListLocationsResponse,
2738 crate::Error,
2739 > {
2740 use std::clone::Clone;
2741 let token = self.0.request.page_token.clone();
2742 let execute = move |token: String| {
2743 let mut builder = self.clone();
2744 builder.0.request = builder.0.request.set_page_token(token);
2745 builder.send()
2746 };
2747 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2748 }
2749
2750 pub fn by_item(
2752 self,
2753 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2754 google_cloud_location::model::ListLocationsResponse,
2755 crate::Error,
2756 > {
2757 use google_cloud_gax::paginator::Paginator;
2758 self.by_page().items()
2759 }
2760
2761 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2763 self.0.request.name = v.into();
2764 self
2765 }
2766
2767 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2769 self.0.request.filter = v.into();
2770 self
2771 }
2772
2773 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2775 self.0.request.page_size = v.into();
2776 self
2777 }
2778
2779 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2781 self.0.request.page_token = v.into();
2782 self
2783 }
2784 }
2785
2786 #[doc(hidden)]
2787 impl crate::RequestBuilder for ListLocations {
2788 fn request_options(&mut self) -> &mut crate::RequestOptions {
2789 &mut self.0.options
2790 }
2791 }
2792
2793 #[derive(Clone, Debug)]
2810 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
2811
2812 impl GetLocation {
2813 pub(crate) fn new(
2814 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2815 ) -> Self {
2816 Self(RequestBuilder::new(stub))
2817 }
2818
2819 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
2821 mut self,
2822 v: V,
2823 ) -> Self {
2824 self.0.request = v.into();
2825 self
2826 }
2827
2828 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2830 self.0.options = v.into();
2831 self
2832 }
2833
2834 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
2836 (*self.0.stub)
2837 .get_location(self.0.request, self.0.options)
2838 .await
2839 .map(crate::Response::into_body)
2840 }
2841
2842 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2844 self.0.request.name = v.into();
2845 self
2846 }
2847 }
2848
2849 #[doc(hidden)]
2850 impl crate::RequestBuilder for GetLocation {
2851 fn request_options(&mut self) -> &mut crate::RequestOptions {
2852 &mut self.0.options
2853 }
2854 }
2855
2856 #[derive(Clone, Debug)]
2877 pub struct ListOperations(
2878 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2879 );
2880
2881 impl ListOperations {
2882 pub(crate) fn new(
2883 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2884 ) -> Self {
2885 Self(RequestBuilder::new(stub))
2886 }
2887
2888 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2890 mut self,
2891 v: V,
2892 ) -> Self {
2893 self.0.request = v.into();
2894 self
2895 }
2896
2897 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2899 self.0.options = v.into();
2900 self
2901 }
2902
2903 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2905 (*self.0.stub)
2906 .list_operations(self.0.request, self.0.options)
2907 .await
2908 .map(crate::Response::into_body)
2909 }
2910
2911 pub fn by_page(
2913 self,
2914 ) -> impl google_cloud_gax::paginator::Paginator<
2915 google_cloud_longrunning::model::ListOperationsResponse,
2916 crate::Error,
2917 > {
2918 use std::clone::Clone;
2919 let token = self.0.request.page_token.clone();
2920 let execute = move |token: String| {
2921 let mut builder = self.clone();
2922 builder.0.request = builder.0.request.set_page_token(token);
2923 builder.send()
2924 };
2925 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2926 }
2927
2928 pub fn by_item(
2930 self,
2931 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2932 google_cloud_longrunning::model::ListOperationsResponse,
2933 crate::Error,
2934 > {
2935 use google_cloud_gax::paginator::Paginator;
2936 self.by_page().items()
2937 }
2938
2939 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2941 self.0.request.name = v.into();
2942 self
2943 }
2944
2945 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2947 self.0.request.filter = v.into();
2948 self
2949 }
2950
2951 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2953 self.0.request.page_size = v.into();
2954 self
2955 }
2956
2957 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2959 self.0.request.page_token = v.into();
2960 self
2961 }
2962
2963 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2965 self.0.request.return_partial_success = v.into();
2966 self
2967 }
2968 }
2969
2970 #[doc(hidden)]
2971 impl crate::RequestBuilder for ListOperations {
2972 fn request_options(&mut self) -> &mut crate::RequestOptions {
2973 &mut self.0.options
2974 }
2975 }
2976
2977 #[derive(Clone, Debug)]
2994 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2995
2996 impl GetOperation {
2997 pub(crate) fn new(
2998 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2999 ) -> Self {
3000 Self(RequestBuilder::new(stub))
3001 }
3002
3003 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3005 mut self,
3006 v: V,
3007 ) -> Self {
3008 self.0.request = v.into();
3009 self
3010 }
3011
3012 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3014 self.0.options = v.into();
3015 self
3016 }
3017
3018 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3020 (*self.0.stub)
3021 .get_operation(self.0.request, self.0.options)
3022 .await
3023 .map(crate::Response::into_body)
3024 }
3025
3026 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3028 self.0.request.name = v.into();
3029 self
3030 }
3031 }
3032
3033 #[doc(hidden)]
3034 impl crate::RequestBuilder for GetOperation {
3035 fn request_options(&mut self) -> &mut crate::RequestOptions {
3036 &mut self.0.options
3037 }
3038 }
3039
3040 #[derive(Clone, Debug)]
3057 pub struct CancelOperation(
3058 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
3059 );
3060
3061 impl CancelOperation {
3062 pub(crate) fn new(
3063 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
3064 ) -> Self {
3065 Self(RequestBuilder::new(stub))
3066 }
3067
3068 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
3070 mut self,
3071 v: V,
3072 ) -> Self {
3073 self.0.request = v.into();
3074 self
3075 }
3076
3077 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3079 self.0.options = v.into();
3080 self
3081 }
3082
3083 pub async fn send(self) -> Result<()> {
3085 (*self.0.stub)
3086 .cancel_operation(self.0.request, self.0.options)
3087 .await
3088 .map(crate::Response::into_body)
3089 }
3090
3091 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3093 self.0.request.name = v.into();
3094 self
3095 }
3096 }
3097
3098 #[doc(hidden)]
3099 impl crate::RequestBuilder for CancelOperation {
3100 fn request_options(&mut self) -> &mut crate::RequestOptions {
3101 &mut self.0.options
3102 }
3103 }
3104}