1pub mod document_processor_service {
18 use crate::Result;
19
20 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::DocumentProcessorService;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = DocumentProcessorService;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
55 request: R,
56 options: gax::options::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
92 pub struct ProcessDocument(RequestBuilder<crate::model::ProcessRequest>);
93
94 impl ProcessDocument {
95 pub(crate) fn new(
96 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
97 ) -> Self {
98 Self(RequestBuilder::new(stub))
99 }
100
101 pub fn with_request<V: Into<crate::model::ProcessRequest>>(mut self, v: V) -> Self {
103 self.0.request = v.into();
104 self
105 }
106
107 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
109 self.0.options = v.into();
110 self
111 }
112
113 pub async fn send(self) -> Result<crate::model::ProcessResponse> {
115 (*self.0.stub)
116 .process_document(self.0.request, self.0.options)
117 .await
118 .map(gax::response::Response::into_body)
119 }
120
121 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
125 self.0.request.name = v.into();
126 self
127 }
128
129 pub fn set_skip_human_review<T: Into<bool>>(mut self, v: T) -> Self {
131 self.0.request.skip_human_review = v.into();
132 self
133 }
134
135 pub fn set_field_mask<T>(mut self, v: T) -> Self
137 where
138 T: std::convert::Into<wkt::FieldMask>,
139 {
140 self.0.request.field_mask = std::option::Option::Some(v.into());
141 self
142 }
143
144 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
146 where
147 T: std::convert::Into<wkt::FieldMask>,
148 {
149 self.0.request.field_mask = v.map(|x| x.into());
150 self
151 }
152
153 pub fn set_process_options<T>(mut self, v: T) -> Self
155 where
156 T: std::convert::Into<crate::model::ProcessOptions>,
157 {
158 self.0.request.process_options = std::option::Option::Some(v.into());
159 self
160 }
161
162 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
164 where
165 T: std::convert::Into<crate::model::ProcessOptions>,
166 {
167 self.0.request.process_options = v.map(|x| x.into());
168 self
169 }
170
171 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
173 where
174 T: std::iter::IntoIterator<Item = (K, V)>,
175 K: std::convert::Into<std::string::String>,
176 V: std::convert::Into<std::string::String>,
177 {
178 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
179 self
180 }
181
182 pub fn set_imageless_mode<T: Into<bool>>(mut self, v: T) -> Self {
184 self.0.request.imageless_mode = v.into();
185 self
186 }
187
188 pub fn set_source<T: Into<Option<crate::model::process_request::Source>>>(
193 mut self,
194 v: T,
195 ) -> Self {
196 self.0.request.source = v.into();
197 self
198 }
199
200 pub fn set_inline_document<
206 T: std::convert::Into<std::boxed::Box<crate::model::Document>>,
207 >(
208 mut self,
209 v: T,
210 ) -> Self {
211 self.0.request = self.0.request.set_inline_document(v);
212 self
213 }
214
215 pub fn set_raw_document<
221 T: std::convert::Into<std::boxed::Box<crate::model::RawDocument>>,
222 >(
223 mut self,
224 v: T,
225 ) -> Self {
226 self.0.request = self.0.request.set_raw_document(v);
227 self
228 }
229
230 pub fn set_gcs_document<
236 T: std::convert::Into<std::boxed::Box<crate::model::GcsDocument>>,
237 >(
238 mut self,
239 v: T,
240 ) -> Self {
241 self.0.request = self.0.request.set_gcs_document(v);
242 self
243 }
244 }
245
246 #[doc(hidden)]
247 impl gax::options::internal::RequestBuilder for ProcessDocument {
248 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
249 &mut self.0.options
250 }
251 }
252
253 #[derive(Clone, Debug)]
272 pub struct BatchProcessDocuments(RequestBuilder<crate::model::BatchProcessRequest>);
273
274 impl BatchProcessDocuments {
275 pub(crate) fn new(
276 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
277 ) -> Self {
278 Self(RequestBuilder::new(stub))
279 }
280
281 pub fn with_request<V: Into<crate::model::BatchProcessRequest>>(mut self, v: V) -> Self {
283 self.0.request = v.into();
284 self
285 }
286
287 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
289 self.0.options = v.into();
290 self
291 }
292
293 pub async fn send(self) -> Result<longrunning::model::Operation> {
300 (*self.0.stub)
301 .batch_process_documents(self.0.request, self.0.options)
302 .await
303 .map(gax::response::Response::into_body)
304 }
305
306 pub fn poller(
308 self,
309 ) -> impl lro::Poller<crate::model::BatchProcessResponse, crate::model::BatchProcessMetadata>
310 {
311 type Operation = lro::internal::Operation<
312 crate::model::BatchProcessResponse,
313 crate::model::BatchProcessMetadata,
314 >;
315 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
316 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
317
318 let stub = self.0.stub.clone();
319 let mut options = self.0.options.clone();
320 options.set_retry_policy(gax::retry_policy::NeverRetry);
321 let query = move |name| {
322 let stub = stub.clone();
323 let options = options.clone();
324 async {
325 let op = GetOperation::new(stub)
326 .set_name(name)
327 .with_options(options)
328 .send()
329 .await?;
330 Ok(Operation::new(op))
331 }
332 };
333
334 let start = move || async {
335 let op = self.send().await?;
336 Ok(Operation::new(op))
337 };
338
339 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
340 }
341
342 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
346 self.0.request.name = v.into();
347 self
348 }
349
350 pub fn set_input_documents<T>(mut self, v: T) -> Self
352 where
353 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
354 {
355 self.0.request.input_documents = std::option::Option::Some(v.into());
356 self
357 }
358
359 pub fn set_or_clear_input_documents<T>(mut self, v: std::option::Option<T>) -> Self
361 where
362 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
363 {
364 self.0.request.input_documents = v.map(|x| x.into());
365 self
366 }
367
368 pub fn set_document_output_config<T>(mut self, v: T) -> Self
370 where
371 T: std::convert::Into<crate::model::DocumentOutputConfig>,
372 {
373 self.0.request.document_output_config = std::option::Option::Some(v.into());
374 self
375 }
376
377 pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
379 where
380 T: std::convert::Into<crate::model::DocumentOutputConfig>,
381 {
382 self.0.request.document_output_config = v.map(|x| x.into());
383 self
384 }
385
386 pub fn set_skip_human_review<T: Into<bool>>(mut self, v: T) -> Self {
388 self.0.request.skip_human_review = v.into();
389 self
390 }
391
392 pub fn set_process_options<T>(mut self, v: T) -> Self
394 where
395 T: std::convert::Into<crate::model::ProcessOptions>,
396 {
397 self.0.request.process_options = std::option::Option::Some(v.into());
398 self
399 }
400
401 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
403 where
404 T: std::convert::Into<crate::model::ProcessOptions>,
405 {
406 self.0.request.process_options = v.map(|x| x.into());
407 self
408 }
409
410 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
412 where
413 T: std::iter::IntoIterator<Item = (K, V)>,
414 K: std::convert::Into<std::string::String>,
415 V: std::convert::Into<std::string::String>,
416 {
417 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
418 self
419 }
420 }
421
422 #[doc(hidden)]
423 impl gax::options::internal::RequestBuilder for BatchProcessDocuments {
424 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
425 &mut self.0.options
426 }
427 }
428
429 #[derive(Clone, Debug)]
447 pub struct FetchProcessorTypes(RequestBuilder<crate::model::FetchProcessorTypesRequest>);
448
449 impl FetchProcessorTypes {
450 pub(crate) fn new(
451 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
452 ) -> Self {
453 Self(RequestBuilder::new(stub))
454 }
455
456 pub fn with_request<V: Into<crate::model::FetchProcessorTypesRequest>>(
458 mut self,
459 v: V,
460 ) -> Self {
461 self.0.request = v.into();
462 self
463 }
464
465 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
467 self.0.options = v.into();
468 self
469 }
470
471 pub async fn send(self) -> Result<crate::model::FetchProcessorTypesResponse> {
473 (*self.0.stub)
474 .fetch_processor_types(self.0.request, self.0.options)
475 .await
476 .map(gax::response::Response::into_body)
477 }
478
479 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
483 self.0.request.parent = v.into();
484 self
485 }
486 }
487
488 #[doc(hidden)]
489 impl gax::options::internal::RequestBuilder for FetchProcessorTypes {
490 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
491 &mut self.0.options
492 }
493 }
494
495 #[derive(Clone, Debug)]
517 pub struct ListProcessorTypes(RequestBuilder<crate::model::ListProcessorTypesRequest>);
518
519 impl ListProcessorTypes {
520 pub(crate) fn new(
521 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
522 ) -> Self {
523 Self(RequestBuilder::new(stub))
524 }
525
526 pub fn with_request<V: Into<crate::model::ListProcessorTypesRequest>>(
528 mut self,
529 v: V,
530 ) -> Self {
531 self.0.request = v.into();
532 self
533 }
534
535 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
537 self.0.options = v.into();
538 self
539 }
540
541 pub async fn send(self) -> Result<crate::model::ListProcessorTypesResponse> {
543 (*self.0.stub)
544 .list_processor_types(self.0.request, self.0.options)
545 .await
546 .map(gax::response::Response::into_body)
547 }
548
549 pub fn by_page(
551 self,
552 ) -> impl gax::paginator::Paginator<crate::model::ListProcessorTypesResponse, gax::error::Error>
553 {
554 use std::clone::Clone;
555 let token = self.0.request.page_token.clone();
556 let execute = move |token: String| {
557 let mut builder = self.clone();
558 builder.0.request = builder.0.request.set_page_token(token);
559 builder.send()
560 };
561 gax::paginator::internal::new_paginator(token, execute)
562 }
563
564 pub fn by_item(
566 self,
567 ) -> impl gax::paginator::ItemPaginator<
568 crate::model::ListProcessorTypesResponse,
569 gax::error::Error,
570 > {
571 use gax::paginator::Paginator;
572 self.by_page().items()
573 }
574
575 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
579 self.0.request.parent = v.into();
580 self
581 }
582
583 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
585 self.0.request.page_size = v.into();
586 self
587 }
588
589 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
591 self.0.request.page_token = v.into();
592 self
593 }
594 }
595
596 #[doc(hidden)]
597 impl gax::options::internal::RequestBuilder for ListProcessorTypes {
598 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
599 &mut self.0.options
600 }
601 }
602
603 #[derive(Clone, Debug)]
621 pub struct GetProcessorType(RequestBuilder<crate::model::GetProcessorTypeRequest>);
622
623 impl GetProcessorType {
624 pub(crate) fn new(
625 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
626 ) -> Self {
627 Self(RequestBuilder::new(stub))
628 }
629
630 pub fn with_request<V: Into<crate::model::GetProcessorTypeRequest>>(
632 mut self,
633 v: V,
634 ) -> Self {
635 self.0.request = v.into();
636 self
637 }
638
639 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
641 self.0.options = v.into();
642 self
643 }
644
645 pub async fn send(self) -> Result<crate::model::ProcessorType> {
647 (*self.0.stub)
648 .get_processor_type(self.0.request, self.0.options)
649 .await
650 .map(gax::response::Response::into_body)
651 }
652
653 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
657 self.0.request.name = v.into();
658 self
659 }
660 }
661
662 #[doc(hidden)]
663 impl gax::options::internal::RequestBuilder for GetProcessorType {
664 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
665 &mut self.0.options
666 }
667 }
668
669 #[derive(Clone, Debug)]
691 pub struct ListProcessors(RequestBuilder<crate::model::ListProcessorsRequest>);
692
693 impl ListProcessors {
694 pub(crate) fn new(
695 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
696 ) -> Self {
697 Self(RequestBuilder::new(stub))
698 }
699
700 pub fn with_request<V: Into<crate::model::ListProcessorsRequest>>(mut self, v: V) -> Self {
702 self.0.request = v.into();
703 self
704 }
705
706 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
708 self.0.options = v.into();
709 self
710 }
711
712 pub async fn send(self) -> Result<crate::model::ListProcessorsResponse> {
714 (*self.0.stub)
715 .list_processors(self.0.request, self.0.options)
716 .await
717 .map(gax::response::Response::into_body)
718 }
719
720 pub fn by_page(
722 self,
723 ) -> impl gax::paginator::Paginator<crate::model::ListProcessorsResponse, gax::error::Error>
724 {
725 use std::clone::Clone;
726 let token = self.0.request.page_token.clone();
727 let execute = move |token: String| {
728 let mut builder = self.clone();
729 builder.0.request = builder.0.request.set_page_token(token);
730 builder.send()
731 };
732 gax::paginator::internal::new_paginator(token, execute)
733 }
734
735 pub fn by_item(
737 self,
738 ) -> impl gax::paginator::ItemPaginator<crate::model::ListProcessorsResponse, gax::error::Error>
739 {
740 use gax::paginator::Paginator;
741 self.by_page().items()
742 }
743
744 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
748 self.0.request.parent = v.into();
749 self
750 }
751
752 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
754 self.0.request.page_size = v.into();
755 self
756 }
757
758 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
760 self.0.request.page_token = v.into();
761 self
762 }
763 }
764
765 #[doc(hidden)]
766 impl gax::options::internal::RequestBuilder for ListProcessors {
767 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
768 &mut self.0.options
769 }
770 }
771
772 #[derive(Clone, Debug)]
790 pub struct GetProcessor(RequestBuilder<crate::model::GetProcessorRequest>);
791
792 impl GetProcessor {
793 pub(crate) fn new(
794 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
795 ) -> Self {
796 Self(RequestBuilder::new(stub))
797 }
798
799 pub fn with_request<V: Into<crate::model::GetProcessorRequest>>(mut self, v: V) -> Self {
801 self.0.request = v.into();
802 self
803 }
804
805 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
807 self.0.options = v.into();
808 self
809 }
810
811 pub async fn send(self) -> Result<crate::model::Processor> {
813 (*self.0.stub)
814 .get_processor(self.0.request, self.0.options)
815 .await
816 .map(gax::response::Response::into_body)
817 }
818
819 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
823 self.0.request.name = v.into();
824 self
825 }
826 }
827
828 #[doc(hidden)]
829 impl gax::options::internal::RequestBuilder for GetProcessor {
830 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
831 &mut self.0.options
832 }
833 }
834
835 #[derive(Clone, Debug)]
854 pub struct TrainProcessorVersion(RequestBuilder<crate::model::TrainProcessorVersionRequest>);
855
856 impl TrainProcessorVersion {
857 pub(crate) fn new(
858 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
859 ) -> Self {
860 Self(RequestBuilder::new(stub))
861 }
862
863 pub fn with_request<V: Into<crate::model::TrainProcessorVersionRequest>>(
865 mut self,
866 v: V,
867 ) -> Self {
868 self.0.request = v.into();
869 self
870 }
871
872 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
874 self.0.options = v.into();
875 self
876 }
877
878 pub async fn send(self) -> Result<longrunning::model::Operation> {
885 (*self.0.stub)
886 .train_processor_version(self.0.request, self.0.options)
887 .await
888 .map(gax::response::Response::into_body)
889 }
890
891 pub fn poller(
893 self,
894 ) -> impl lro::Poller<
895 crate::model::TrainProcessorVersionResponse,
896 crate::model::TrainProcessorVersionMetadata,
897 > {
898 type Operation = lro::internal::Operation<
899 crate::model::TrainProcessorVersionResponse,
900 crate::model::TrainProcessorVersionMetadata,
901 >;
902 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
903 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
904
905 let stub = self.0.stub.clone();
906 let mut options = self.0.options.clone();
907 options.set_retry_policy(gax::retry_policy::NeverRetry);
908 let query = move |name| {
909 let stub = stub.clone();
910 let options = options.clone();
911 async {
912 let op = GetOperation::new(stub)
913 .set_name(name)
914 .with_options(options)
915 .send()
916 .await?;
917 Ok(Operation::new(op))
918 }
919 };
920
921 let start = move || async {
922 let op = self.send().await?;
923 Ok(Operation::new(op))
924 };
925
926 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
927 }
928
929 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
933 self.0.request.parent = v.into();
934 self
935 }
936
937 pub fn set_processor_version<T>(mut self, v: T) -> Self
941 where
942 T: std::convert::Into<crate::model::ProcessorVersion>,
943 {
944 self.0.request.processor_version = std::option::Option::Some(v.into());
945 self
946 }
947
948 pub fn set_or_clear_processor_version<T>(mut self, v: std::option::Option<T>) -> Self
952 where
953 T: std::convert::Into<crate::model::ProcessorVersion>,
954 {
955 self.0.request.processor_version = v.map(|x| x.into());
956 self
957 }
958
959 pub fn set_document_schema<T>(mut self, v: T) -> Self
961 where
962 T: std::convert::Into<crate::model::DocumentSchema>,
963 {
964 self.0.request.document_schema = std::option::Option::Some(v.into());
965 self
966 }
967
968 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
970 where
971 T: std::convert::Into<crate::model::DocumentSchema>,
972 {
973 self.0.request.document_schema = v.map(|x| x.into());
974 self
975 }
976
977 pub fn set_input_data<T>(mut self, v: T) -> Self
979 where
980 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
981 {
982 self.0.request.input_data = std::option::Option::Some(v.into());
983 self
984 }
985
986 pub fn set_or_clear_input_data<T>(mut self, v: std::option::Option<T>) -> Self
988 where
989 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
990 {
991 self.0.request.input_data = v.map(|x| x.into());
992 self
993 }
994
995 pub fn set_base_processor_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
997 self.0.request.base_processor_version = v.into();
998 self
999 }
1000
1001 pub fn set_processor_flags<
1006 T: Into<Option<crate::model::train_processor_version_request::ProcessorFlags>>,
1007 >(
1008 mut self,
1009 v: T,
1010 ) -> Self {
1011 self.0.request.processor_flags = v.into();
1012 self
1013 }
1014
1015 pub fn set_custom_document_extraction_options<T: std::convert::Into<std::boxed::Box<crate::model::train_processor_version_request::CustomDocumentExtractionOptions>>>(mut self, v: T) -> Self{
1021 self.0.request = self.0.request.set_custom_document_extraction_options(v);
1022 self
1023 }
1024
1025 pub fn set_foundation_model_tuning_options<
1031 T: std::convert::Into<
1032 std::boxed::Box<
1033 crate::model::train_processor_version_request::FoundationModelTuningOptions,
1034 >,
1035 >,
1036 >(
1037 mut self,
1038 v: T,
1039 ) -> Self {
1040 self.0.request = self.0.request.set_foundation_model_tuning_options(v);
1041 self
1042 }
1043 }
1044
1045 #[doc(hidden)]
1046 impl gax::options::internal::RequestBuilder for TrainProcessorVersion {
1047 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1048 &mut self.0.options
1049 }
1050 }
1051
1052 #[derive(Clone, Debug)]
1070 pub struct GetProcessorVersion(RequestBuilder<crate::model::GetProcessorVersionRequest>);
1071
1072 impl GetProcessorVersion {
1073 pub(crate) fn new(
1074 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1075 ) -> Self {
1076 Self(RequestBuilder::new(stub))
1077 }
1078
1079 pub fn with_request<V: Into<crate::model::GetProcessorVersionRequest>>(
1081 mut self,
1082 v: V,
1083 ) -> Self {
1084 self.0.request = v.into();
1085 self
1086 }
1087
1088 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1090 self.0.options = v.into();
1091 self
1092 }
1093
1094 pub async fn send(self) -> Result<crate::model::ProcessorVersion> {
1096 (*self.0.stub)
1097 .get_processor_version(self.0.request, self.0.options)
1098 .await
1099 .map(gax::response::Response::into_body)
1100 }
1101
1102 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1106 self.0.request.name = v.into();
1107 self
1108 }
1109 }
1110
1111 #[doc(hidden)]
1112 impl gax::options::internal::RequestBuilder for GetProcessorVersion {
1113 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1114 &mut self.0.options
1115 }
1116 }
1117
1118 #[derive(Clone, Debug)]
1140 pub struct ListProcessorVersions(RequestBuilder<crate::model::ListProcessorVersionsRequest>);
1141
1142 impl ListProcessorVersions {
1143 pub(crate) fn new(
1144 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1145 ) -> Self {
1146 Self(RequestBuilder::new(stub))
1147 }
1148
1149 pub fn with_request<V: Into<crate::model::ListProcessorVersionsRequest>>(
1151 mut self,
1152 v: V,
1153 ) -> Self {
1154 self.0.request = v.into();
1155 self
1156 }
1157
1158 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1160 self.0.options = v.into();
1161 self
1162 }
1163
1164 pub async fn send(self) -> Result<crate::model::ListProcessorVersionsResponse> {
1166 (*self.0.stub)
1167 .list_processor_versions(self.0.request, self.0.options)
1168 .await
1169 .map(gax::response::Response::into_body)
1170 }
1171
1172 pub fn by_page(
1174 self,
1175 ) -> impl gax::paginator::Paginator<crate::model::ListProcessorVersionsResponse, gax::error::Error>
1176 {
1177 use std::clone::Clone;
1178 let token = self.0.request.page_token.clone();
1179 let execute = move |token: String| {
1180 let mut builder = self.clone();
1181 builder.0.request = builder.0.request.set_page_token(token);
1182 builder.send()
1183 };
1184 gax::paginator::internal::new_paginator(token, execute)
1185 }
1186
1187 pub fn by_item(
1189 self,
1190 ) -> impl gax::paginator::ItemPaginator<
1191 crate::model::ListProcessorVersionsResponse,
1192 gax::error::Error,
1193 > {
1194 use gax::paginator::Paginator;
1195 self.by_page().items()
1196 }
1197
1198 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1202 self.0.request.parent = v.into();
1203 self
1204 }
1205
1206 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1208 self.0.request.page_size = v.into();
1209 self
1210 }
1211
1212 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1214 self.0.request.page_token = v.into();
1215 self
1216 }
1217 }
1218
1219 #[doc(hidden)]
1220 impl gax::options::internal::RequestBuilder for ListProcessorVersions {
1221 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1222 &mut self.0.options
1223 }
1224 }
1225
1226 #[derive(Clone, Debug)]
1245 pub struct DeleteProcessorVersion(RequestBuilder<crate::model::DeleteProcessorVersionRequest>);
1246
1247 impl DeleteProcessorVersion {
1248 pub(crate) fn new(
1249 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1250 ) -> Self {
1251 Self(RequestBuilder::new(stub))
1252 }
1253
1254 pub fn with_request<V: Into<crate::model::DeleteProcessorVersionRequest>>(
1256 mut self,
1257 v: V,
1258 ) -> Self {
1259 self.0.request = v.into();
1260 self
1261 }
1262
1263 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1265 self.0.options = v.into();
1266 self
1267 }
1268
1269 pub async fn send(self) -> Result<longrunning::model::Operation> {
1276 (*self.0.stub)
1277 .delete_processor_version(self.0.request, self.0.options)
1278 .await
1279 .map(gax::response::Response::into_body)
1280 }
1281
1282 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteProcessorVersionMetadata> {
1284 type Operation =
1285 lro::internal::Operation<wkt::Empty, crate::model::DeleteProcessorVersionMetadata>;
1286 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1287 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1288
1289 let stub = self.0.stub.clone();
1290 let mut options = self.0.options.clone();
1291 options.set_retry_policy(gax::retry_policy::NeverRetry);
1292 let query = move |name| {
1293 let stub = stub.clone();
1294 let options = options.clone();
1295 async {
1296 let op = GetOperation::new(stub)
1297 .set_name(name)
1298 .with_options(options)
1299 .send()
1300 .await?;
1301 Ok(Operation::new(op))
1302 }
1303 };
1304
1305 let start = move || async {
1306 let op = self.send().await?;
1307 Ok(Operation::new(op))
1308 };
1309
1310 lro::internal::new_unit_response_poller(
1311 polling_error_policy,
1312 polling_backoff_policy,
1313 start,
1314 query,
1315 )
1316 }
1317
1318 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1322 self.0.request.name = v.into();
1323 self
1324 }
1325 }
1326
1327 #[doc(hidden)]
1328 impl gax::options::internal::RequestBuilder for DeleteProcessorVersion {
1329 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1330 &mut self.0.options
1331 }
1332 }
1333
1334 #[derive(Clone, Debug)]
1353 pub struct DeployProcessorVersion(RequestBuilder<crate::model::DeployProcessorVersionRequest>);
1354
1355 impl DeployProcessorVersion {
1356 pub(crate) fn new(
1357 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1358 ) -> Self {
1359 Self(RequestBuilder::new(stub))
1360 }
1361
1362 pub fn with_request<V: Into<crate::model::DeployProcessorVersionRequest>>(
1364 mut self,
1365 v: V,
1366 ) -> Self {
1367 self.0.request = v.into();
1368 self
1369 }
1370
1371 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1373 self.0.options = v.into();
1374 self
1375 }
1376
1377 pub async fn send(self) -> Result<longrunning::model::Operation> {
1384 (*self.0.stub)
1385 .deploy_processor_version(self.0.request, self.0.options)
1386 .await
1387 .map(gax::response::Response::into_body)
1388 }
1389
1390 pub fn poller(
1392 self,
1393 ) -> impl lro::Poller<
1394 crate::model::DeployProcessorVersionResponse,
1395 crate::model::DeployProcessorVersionMetadata,
1396 > {
1397 type Operation = lro::internal::Operation<
1398 crate::model::DeployProcessorVersionResponse,
1399 crate::model::DeployProcessorVersionMetadata,
1400 >;
1401 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1402 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1403
1404 let stub = self.0.stub.clone();
1405 let mut options = self.0.options.clone();
1406 options.set_retry_policy(gax::retry_policy::NeverRetry);
1407 let query = move |name| {
1408 let stub = stub.clone();
1409 let options = options.clone();
1410 async {
1411 let op = GetOperation::new(stub)
1412 .set_name(name)
1413 .with_options(options)
1414 .send()
1415 .await?;
1416 Ok(Operation::new(op))
1417 }
1418 };
1419
1420 let start = move || async {
1421 let op = self.send().await?;
1422 Ok(Operation::new(op))
1423 };
1424
1425 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1426 }
1427
1428 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1432 self.0.request.name = v.into();
1433 self
1434 }
1435 }
1436
1437 #[doc(hidden)]
1438 impl gax::options::internal::RequestBuilder for DeployProcessorVersion {
1439 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1440 &mut self.0.options
1441 }
1442 }
1443
1444 #[derive(Clone, Debug)]
1463 pub struct UndeployProcessorVersion(
1464 RequestBuilder<crate::model::UndeployProcessorVersionRequest>,
1465 );
1466
1467 impl UndeployProcessorVersion {
1468 pub(crate) fn new(
1469 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1470 ) -> Self {
1471 Self(RequestBuilder::new(stub))
1472 }
1473
1474 pub fn with_request<V: Into<crate::model::UndeployProcessorVersionRequest>>(
1476 mut self,
1477 v: V,
1478 ) -> Self {
1479 self.0.request = v.into();
1480 self
1481 }
1482
1483 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1485 self.0.options = v.into();
1486 self
1487 }
1488
1489 pub async fn send(self) -> Result<longrunning::model::Operation> {
1496 (*self.0.stub)
1497 .undeploy_processor_version(self.0.request, self.0.options)
1498 .await
1499 .map(gax::response::Response::into_body)
1500 }
1501
1502 pub fn poller(
1504 self,
1505 ) -> impl lro::Poller<
1506 crate::model::UndeployProcessorVersionResponse,
1507 crate::model::UndeployProcessorVersionMetadata,
1508 > {
1509 type Operation = lro::internal::Operation<
1510 crate::model::UndeployProcessorVersionResponse,
1511 crate::model::UndeployProcessorVersionMetadata,
1512 >;
1513 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1514 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1515
1516 let stub = self.0.stub.clone();
1517 let mut options = self.0.options.clone();
1518 options.set_retry_policy(gax::retry_policy::NeverRetry);
1519 let query = move |name| {
1520 let stub = stub.clone();
1521 let options = options.clone();
1522 async {
1523 let op = GetOperation::new(stub)
1524 .set_name(name)
1525 .with_options(options)
1526 .send()
1527 .await?;
1528 Ok(Operation::new(op))
1529 }
1530 };
1531
1532 let start = move || async {
1533 let op = self.send().await?;
1534 Ok(Operation::new(op))
1535 };
1536
1537 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1538 }
1539
1540 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1544 self.0.request.name = v.into();
1545 self
1546 }
1547 }
1548
1549 #[doc(hidden)]
1550 impl gax::options::internal::RequestBuilder for UndeployProcessorVersion {
1551 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1552 &mut self.0.options
1553 }
1554 }
1555
1556 #[derive(Clone, Debug)]
1574 pub struct CreateProcessor(RequestBuilder<crate::model::CreateProcessorRequest>);
1575
1576 impl CreateProcessor {
1577 pub(crate) fn new(
1578 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1579 ) -> Self {
1580 Self(RequestBuilder::new(stub))
1581 }
1582
1583 pub fn with_request<V: Into<crate::model::CreateProcessorRequest>>(mut self, v: V) -> Self {
1585 self.0.request = v.into();
1586 self
1587 }
1588
1589 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1591 self.0.options = v.into();
1592 self
1593 }
1594
1595 pub async fn send(self) -> Result<crate::model::Processor> {
1597 (*self.0.stub)
1598 .create_processor(self.0.request, self.0.options)
1599 .await
1600 .map(gax::response::Response::into_body)
1601 }
1602
1603 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1607 self.0.request.parent = v.into();
1608 self
1609 }
1610
1611 pub fn set_processor<T>(mut self, v: T) -> Self
1615 where
1616 T: std::convert::Into<crate::model::Processor>,
1617 {
1618 self.0.request.processor = std::option::Option::Some(v.into());
1619 self
1620 }
1621
1622 pub fn set_or_clear_processor<T>(mut self, v: std::option::Option<T>) -> Self
1626 where
1627 T: std::convert::Into<crate::model::Processor>,
1628 {
1629 self.0.request.processor = v.map(|x| x.into());
1630 self
1631 }
1632 }
1633
1634 #[doc(hidden)]
1635 impl gax::options::internal::RequestBuilder for CreateProcessor {
1636 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1637 &mut self.0.options
1638 }
1639 }
1640
1641 #[derive(Clone, Debug)]
1660 pub struct DeleteProcessor(RequestBuilder<crate::model::DeleteProcessorRequest>);
1661
1662 impl DeleteProcessor {
1663 pub(crate) fn new(
1664 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1665 ) -> Self {
1666 Self(RequestBuilder::new(stub))
1667 }
1668
1669 pub fn with_request<V: Into<crate::model::DeleteProcessorRequest>>(mut self, v: V) -> Self {
1671 self.0.request = v.into();
1672 self
1673 }
1674
1675 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1677 self.0.options = v.into();
1678 self
1679 }
1680
1681 pub async fn send(self) -> Result<longrunning::model::Operation> {
1688 (*self.0.stub)
1689 .delete_processor(self.0.request, self.0.options)
1690 .await
1691 .map(gax::response::Response::into_body)
1692 }
1693
1694 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteProcessorMetadata> {
1696 type Operation =
1697 lro::internal::Operation<wkt::Empty, crate::model::DeleteProcessorMetadata>;
1698 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1699 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1700
1701 let stub = self.0.stub.clone();
1702 let mut options = self.0.options.clone();
1703 options.set_retry_policy(gax::retry_policy::NeverRetry);
1704 let query = move |name| {
1705 let stub = stub.clone();
1706 let options = options.clone();
1707 async {
1708 let op = GetOperation::new(stub)
1709 .set_name(name)
1710 .with_options(options)
1711 .send()
1712 .await?;
1713 Ok(Operation::new(op))
1714 }
1715 };
1716
1717 let start = move || async {
1718 let op = self.send().await?;
1719 Ok(Operation::new(op))
1720 };
1721
1722 lro::internal::new_unit_response_poller(
1723 polling_error_policy,
1724 polling_backoff_policy,
1725 start,
1726 query,
1727 )
1728 }
1729
1730 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1734 self.0.request.name = v.into();
1735 self
1736 }
1737 }
1738
1739 #[doc(hidden)]
1740 impl gax::options::internal::RequestBuilder for DeleteProcessor {
1741 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1742 &mut self.0.options
1743 }
1744 }
1745
1746 #[derive(Clone, Debug)]
1765 pub struct EnableProcessor(RequestBuilder<crate::model::EnableProcessorRequest>);
1766
1767 impl EnableProcessor {
1768 pub(crate) fn new(
1769 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1770 ) -> Self {
1771 Self(RequestBuilder::new(stub))
1772 }
1773
1774 pub fn with_request<V: Into<crate::model::EnableProcessorRequest>>(mut self, v: V) -> Self {
1776 self.0.request = v.into();
1777 self
1778 }
1779
1780 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1782 self.0.options = v.into();
1783 self
1784 }
1785
1786 pub async fn send(self) -> Result<longrunning::model::Operation> {
1793 (*self.0.stub)
1794 .enable_processor(self.0.request, self.0.options)
1795 .await
1796 .map(gax::response::Response::into_body)
1797 }
1798
1799 pub fn poller(
1801 self,
1802 ) -> impl lro::Poller<crate::model::EnableProcessorResponse, crate::model::EnableProcessorMetadata>
1803 {
1804 type Operation = lro::internal::Operation<
1805 crate::model::EnableProcessorResponse,
1806 crate::model::EnableProcessorMetadata,
1807 >;
1808 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1809 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1810
1811 let stub = self.0.stub.clone();
1812 let mut options = self.0.options.clone();
1813 options.set_retry_policy(gax::retry_policy::NeverRetry);
1814 let query = move |name| {
1815 let stub = stub.clone();
1816 let options = options.clone();
1817 async {
1818 let op = GetOperation::new(stub)
1819 .set_name(name)
1820 .with_options(options)
1821 .send()
1822 .await?;
1823 Ok(Operation::new(op))
1824 }
1825 };
1826
1827 let start = move || async {
1828 let op = self.send().await?;
1829 Ok(Operation::new(op))
1830 };
1831
1832 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1833 }
1834
1835 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1839 self.0.request.name = v.into();
1840 self
1841 }
1842 }
1843
1844 #[doc(hidden)]
1845 impl gax::options::internal::RequestBuilder for EnableProcessor {
1846 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1847 &mut self.0.options
1848 }
1849 }
1850
1851 #[derive(Clone, Debug)]
1870 pub struct DisableProcessor(RequestBuilder<crate::model::DisableProcessorRequest>);
1871
1872 impl DisableProcessor {
1873 pub(crate) fn new(
1874 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1875 ) -> Self {
1876 Self(RequestBuilder::new(stub))
1877 }
1878
1879 pub fn with_request<V: Into<crate::model::DisableProcessorRequest>>(
1881 mut self,
1882 v: V,
1883 ) -> Self {
1884 self.0.request = v.into();
1885 self
1886 }
1887
1888 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1890 self.0.options = v.into();
1891 self
1892 }
1893
1894 pub async fn send(self) -> Result<longrunning::model::Operation> {
1901 (*self.0.stub)
1902 .disable_processor(self.0.request, self.0.options)
1903 .await
1904 .map(gax::response::Response::into_body)
1905 }
1906
1907 pub fn poller(
1909 self,
1910 ) -> impl lro::Poller<
1911 crate::model::DisableProcessorResponse,
1912 crate::model::DisableProcessorMetadata,
1913 > {
1914 type Operation = lro::internal::Operation<
1915 crate::model::DisableProcessorResponse,
1916 crate::model::DisableProcessorMetadata,
1917 >;
1918 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1919 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1920
1921 let stub = self.0.stub.clone();
1922 let mut options = self.0.options.clone();
1923 options.set_retry_policy(gax::retry_policy::NeverRetry);
1924 let query = move |name| {
1925 let stub = stub.clone();
1926 let options = options.clone();
1927 async {
1928 let op = GetOperation::new(stub)
1929 .set_name(name)
1930 .with_options(options)
1931 .send()
1932 .await?;
1933 Ok(Operation::new(op))
1934 }
1935 };
1936
1937 let start = move || async {
1938 let op = self.send().await?;
1939 Ok(Operation::new(op))
1940 };
1941
1942 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1943 }
1944
1945 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1949 self.0.request.name = v.into();
1950 self
1951 }
1952 }
1953
1954 #[doc(hidden)]
1955 impl gax::options::internal::RequestBuilder for DisableProcessor {
1956 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1957 &mut self.0.options
1958 }
1959 }
1960
1961 #[derive(Clone, Debug)]
1980 pub struct SetDefaultProcessorVersion(
1981 RequestBuilder<crate::model::SetDefaultProcessorVersionRequest>,
1982 );
1983
1984 impl SetDefaultProcessorVersion {
1985 pub(crate) fn new(
1986 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1987 ) -> Self {
1988 Self(RequestBuilder::new(stub))
1989 }
1990
1991 pub fn with_request<V: Into<crate::model::SetDefaultProcessorVersionRequest>>(
1993 mut self,
1994 v: V,
1995 ) -> Self {
1996 self.0.request = v.into();
1997 self
1998 }
1999
2000 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2002 self.0.options = v.into();
2003 self
2004 }
2005
2006 pub async fn send(self) -> Result<longrunning::model::Operation> {
2013 (*self.0.stub)
2014 .set_default_processor_version(self.0.request, self.0.options)
2015 .await
2016 .map(gax::response::Response::into_body)
2017 }
2018
2019 pub fn poller(
2021 self,
2022 ) -> impl lro::Poller<
2023 crate::model::SetDefaultProcessorVersionResponse,
2024 crate::model::SetDefaultProcessorVersionMetadata,
2025 > {
2026 type Operation = lro::internal::Operation<
2027 crate::model::SetDefaultProcessorVersionResponse,
2028 crate::model::SetDefaultProcessorVersionMetadata,
2029 >;
2030 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2031 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2032
2033 let stub = self.0.stub.clone();
2034 let mut options = self.0.options.clone();
2035 options.set_retry_policy(gax::retry_policy::NeverRetry);
2036 let query = move |name| {
2037 let stub = stub.clone();
2038 let options = options.clone();
2039 async {
2040 let op = GetOperation::new(stub)
2041 .set_name(name)
2042 .with_options(options)
2043 .send()
2044 .await?;
2045 Ok(Operation::new(op))
2046 }
2047 };
2048
2049 let start = move || async {
2050 let op = self.send().await?;
2051 Ok(Operation::new(op))
2052 };
2053
2054 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2055 }
2056
2057 pub fn set_processor<T: Into<std::string::String>>(mut self, v: T) -> Self {
2061 self.0.request.processor = v.into();
2062 self
2063 }
2064
2065 pub fn set_default_processor_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
2069 self.0.request.default_processor_version = v.into();
2070 self
2071 }
2072 }
2073
2074 #[doc(hidden)]
2075 impl gax::options::internal::RequestBuilder for SetDefaultProcessorVersion {
2076 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2077 &mut self.0.options
2078 }
2079 }
2080
2081 #[derive(Clone, Debug)]
2100 pub struct ReviewDocument(RequestBuilder<crate::model::ReviewDocumentRequest>);
2101
2102 impl ReviewDocument {
2103 pub(crate) fn new(
2104 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2105 ) -> Self {
2106 Self(RequestBuilder::new(stub))
2107 }
2108
2109 pub fn with_request<V: Into<crate::model::ReviewDocumentRequest>>(mut self, v: V) -> Self {
2111 self.0.request = v.into();
2112 self
2113 }
2114
2115 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2117 self.0.options = v.into();
2118 self
2119 }
2120
2121 pub async fn send(self) -> Result<longrunning::model::Operation> {
2128 (*self.0.stub)
2129 .review_document(self.0.request, self.0.options)
2130 .await
2131 .map(gax::response::Response::into_body)
2132 }
2133
2134 pub fn poller(
2136 self,
2137 ) -> impl lro::Poller<
2138 crate::model::ReviewDocumentResponse,
2139 crate::model::ReviewDocumentOperationMetadata,
2140 > {
2141 type Operation = lro::internal::Operation<
2142 crate::model::ReviewDocumentResponse,
2143 crate::model::ReviewDocumentOperationMetadata,
2144 >;
2145 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2146 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2147
2148 let stub = self.0.stub.clone();
2149 let mut options = self.0.options.clone();
2150 options.set_retry_policy(gax::retry_policy::NeverRetry);
2151 let query = move |name| {
2152 let stub = stub.clone();
2153 let options = options.clone();
2154 async {
2155 let op = GetOperation::new(stub)
2156 .set_name(name)
2157 .with_options(options)
2158 .send()
2159 .await?;
2160 Ok(Operation::new(op))
2161 }
2162 };
2163
2164 let start = move || async {
2165 let op = self.send().await?;
2166 Ok(Operation::new(op))
2167 };
2168
2169 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2170 }
2171
2172 pub fn set_human_review_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2176 self.0.request.human_review_config = v.into();
2177 self
2178 }
2179
2180 pub fn set_enable_schema_validation<T: Into<bool>>(mut self, v: T) -> Self {
2182 self.0.request.enable_schema_validation = v.into();
2183 self
2184 }
2185
2186 pub fn set_priority<T: Into<crate::model::review_document_request::Priority>>(
2188 mut self,
2189 v: T,
2190 ) -> Self {
2191 self.0.request.priority = v.into();
2192 self
2193 }
2194
2195 pub fn set_document_schema<T>(mut self, v: T) -> Self
2197 where
2198 T: std::convert::Into<crate::model::DocumentSchema>,
2199 {
2200 self.0.request.document_schema = std::option::Option::Some(v.into());
2201 self
2202 }
2203
2204 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
2206 where
2207 T: std::convert::Into<crate::model::DocumentSchema>,
2208 {
2209 self.0.request.document_schema = v.map(|x| x.into());
2210 self
2211 }
2212
2213 pub fn set_source<T: Into<Option<crate::model::review_document_request::Source>>>(
2218 mut self,
2219 v: T,
2220 ) -> Self {
2221 self.0.request.source = v.into();
2222 self
2223 }
2224
2225 pub fn set_inline_document<
2231 T: std::convert::Into<std::boxed::Box<crate::model::Document>>,
2232 >(
2233 mut self,
2234 v: T,
2235 ) -> Self {
2236 self.0.request = self.0.request.set_inline_document(v);
2237 self
2238 }
2239 }
2240
2241 #[doc(hidden)]
2242 impl gax::options::internal::RequestBuilder for ReviewDocument {
2243 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2244 &mut self.0.options
2245 }
2246 }
2247
2248 #[derive(Clone, Debug)]
2267 pub struct EvaluateProcessorVersion(
2268 RequestBuilder<crate::model::EvaluateProcessorVersionRequest>,
2269 );
2270
2271 impl EvaluateProcessorVersion {
2272 pub(crate) fn new(
2273 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2274 ) -> Self {
2275 Self(RequestBuilder::new(stub))
2276 }
2277
2278 pub fn with_request<V: Into<crate::model::EvaluateProcessorVersionRequest>>(
2280 mut self,
2281 v: V,
2282 ) -> Self {
2283 self.0.request = v.into();
2284 self
2285 }
2286
2287 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2289 self.0.options = v.into();
2290 self
2291 }
2292
2293 pub async fn send(self) -> Result<longrunning::model::Operation> {
2300 (*self.0.stub)
2301 .evaluate_processor_version(self.0.request, self.0.options)
2302 .await
2303 .map(gax::response::Response::into_body)
2304 }
2305
2306 pub fn poller(
2308 self,
2309 ) -> impl lro::Poller<
2310 crate::model::EvaluateProcessorVersionResponse,
2311 crate::model::EvaluateProcessorVersionMetadata,
2312 > {
2313 type Operation = lro::internal::Operation<
2314 crate::model::EvaluateProcessorVersionResponse,
2315 crate::model::EvaluateProcessorVersionMetadata,
2316 >;
2317 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2318 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2319
2320 let stub = self.0.stub.clone();
2321 let mut options = self.0.options.clone();
2322 options.set_retry_policy(gax::retry_policy::NeverRetry);
2323 let query = move |name| {
2324 let stub = stub.clone();
2325 let options = options.clone();
2326 async {
2327 let op = GetOperation::new(stub)
2328 .set_name(name)
2329 .with_options(options)
2330 .send()
2331 .await?;
2332 Ok(Operation::new(op))
2333 }
2334 };
2335
2336 let start = move || async {
2337 let op = self.send().await?;
2338 Ok(Operation::new(op))
2339 };
2340
2341 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2342 }
2343
2344 pub fn set_processor_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
2348 self.0.request.processor_version = v.into();
2349 self
2350 }
2351
2352 pub fn set_evaluation_documents<T>(mut self, v: T) -> Self
2354 where
2355 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
2356 {
2357 self.0.request.evaluation_documents = std::option::Option::Some(v.into());
2358 self
2359 }
2360
2361 pub fn set_or_clear_evaluation_documents<T>(mut self, v: std::option::Option<T>) -> Self
2363 where
2364 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
2365 {
2366 self.0.request.evaluation_documents = v.map(|x| x.into());
2367 self
2368 }
2369 }
2370
2371 #[doc(hidden)]
2372 impl gax::options::internal::RequestBuilder for EvaluateProcessorVersion {
2373 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2374 &mut self.0.options
2375 }
2376 }
2377
2378 #[derive(Clone, Debug)]
2396 pub struct GetEvaluation(RequestBuilder<crate::model::GetEvaluationRequest>);
2397
2398 impl GetEvaluation {
2399 pub(crate) fn new(
2400 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2401 ) -> Self {
2402 Self(RequestBuilder::new(stub))
2403 }
2404
2405 pub fn with_request<V: Into<crate::model::GetEvaluationRequest>>(mut self, v: V) -> Self {
2407 self.0.request = v.into();
2408 self
2409 }
2410
2411 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2413 self.0.options = v.into();
2414 self
2415 }
2416
2417 pub async fn send(self) -> Result<crate::model::Evaluation> {
2419 (*self.0.stub)
2420 .get_evaluation(self.0.request, self.0.options)
2421 .await
2422 .map(gax::response::Response::into_body)
2423 }
2424
2425 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2429 self.0.request.name = v.into();
2430 self
2431 }
2432 }
2433
2434 #[doc(hidden)]
2435 impl gax::options::internal::RequestBuilder for GetEvaluation {
2436 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2437 &mut self.0.options
2438 }
2439 }
2440
2441 #[derive(Clone, Debug)]
2463 pub struct ListEvaluations(RequestBuilder<crate::model::ListEvaluationsRequest>);
2464
2465 impl ListEvaluations {
2466 pub(crate) fn new(
2467 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2468 ) -> Self {
2469 Self(RequestBuilder::new(stub))
2470 }
2471
2472 pub fn with_request<V: Into<crate::model::ListEvaluationsRequest>>(mut self, v: V) -> Self {
2474 self.0.request = v.into();
2475 self
2476 }
2477
2478 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2480 self.0.options = v.into();
2481 self
2482 }
2483
2484 pub async fn send(self) -> Result<crate::model::ListEvaluationsResponse> {
2486 (*self.0.stub)
2487 .list_evaluations(self.0.request, self.0.options)
2488 .await
2489 .map(gax::response::Response::into_body)
2490 }
2491
2492 pub fn by_page(
2494 self,
2495 ) -> impl gax::paginator::Paginator<crate::model::ListEvaluationsResponse, gax::error::Error>
2496 {
2497 use std::clone::Clone;
2498 let token = self.0.request.page_token.clone();
2499 let execute = move |token: String| {
2500 let mut builder = self.clone();
2501 builder.0.request = builder.0.request.set_page_token(token);
2502 builder.send()
2503 };
2504 gax::paginator::internal::new_paginator(token, execute)
2505 }
2506
2507 pub fn by_item(
2509 self,
2510 ) -> impl gax::paginator::ItemPaginator<crate::model::ListEvaluationsResponse, gax::error::Error>
2511 {
2512 use gax::paginator::Paginator;
2513 self.by_page().items()
2514 }
2515
2516 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2520 self.0.request.parent = v.into();
2521 self
2522 }
2523
2524 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2526 self.0.request.page_size = v.into();
2527 self
2528 }
2529
2530 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2532 self.0.request.page_token = v.into();
2533 self
2534 }
2535 }
2536
2537 #[doc(hidden)]
2538 impl gax::options::internal::RequestBuilder for ListEvaluations {
2539 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2540 &mut self.0.options
2541 }
2542 }
2543
2544 #[derive(Clone, Debug)]
2566 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
2567
2568 impl ListLocations {
2569 pub(crate) fn new(
2570 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2571 ) -> Self {
2572 Self(RequestBuilder::new(stub))
2573 }
2574
2575 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
2577 mut self,
2578 v: V,
2579 ) -> Self {
2580 self.0.request = v.into();
2581 self
2582 }
2583
2584 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2586 self.0.options = v.into();
2587 self
2588 }
2589
2590 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
2592 (*self.0.stub)
2593 .list_locations(self.0.request, self.0.options)
2594 .await
2595 .map(gax::response::Response::into_body)
2596 }
2597
2598 pub fn by_page(
2600 self,
2601 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
2602 {
2603 use std::clone::Clone;
2604 let token = self.0.request.page_token.clone();
2605 let execute = move |token: String| {
2606 let mut builder = self.clone();
2607 builder.0.request = builder.0.request.set_page_token(token);
2608 builder.send()
2609 };
2610 gax::paginator::internal::new_paginator(token, execute)
2611 }
2612
2613 pub fn by_item(
2615 self,
2616 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
2617 {
2618 use gax::paginator::Paginator;
2619 self.by_page().items()
2620 }
2621
2622 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2624 self.0.request.name = v.into();
2625 self
2626 }
2627
2628 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2630 self.0.request.filter = v.into();
2631 self
2632 }
2633
2634 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2636 self.0.request.page_size = v.into();
2637 self
2638 }
2639
2640 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2642 self.0.request.page_token = v.into();
2643 self
2644 }
2645 }
2646
2647 #[doc(hidden)]
2648 impl gax::options::internal::RequestBuilder for ListLocations {
2649 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2650 &mut self.0.options
2651 }
2652 }
2653
2654 #[derive(Clone, Debug)]
2672 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
2673
2674 impl GetLocation {
2675 pub(crate) fn new(
2676 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2677 ) -> Self {
2678 Self(RequestBuilder::new(stub))
2679 }
2680
2681 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
2683 self.0.request = v.into();
2684 self
2685 }
2686
2687 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2689 self.0.options = v.into();
2690 self
2691 }
2692
2693 pub async fn send(self) -> Result<location::model::Location> {
2695 (*self.0.stub)
2696 .get_location(self.0.request, self.0.options)
2697 .await
2698 .map(gax::response::Response::into_body)
2699 }
2700
2701 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2703 self.0.request.name = v.into();
2704 self
2705 }
2706 }
2707
2708 #[doc(hidden)]
2709 impl gax::options::internal::RequestBuilder for GetLocation {
2710 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2711 &mut self.0.options
2712 }
2713 }
2714
2715 #[derive(Clone, Debug)]
2737 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2738
2739 impl ListOperations {
2740 pub(crate) fn new(
2741 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2742 ) -> Self {
2743 Self(RequestBuilder::new(stub))
2744 }
2745
2746 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2748 mut self,
2749 v: V,
2750 ) -> Self {
2751 self.0.request = v.into();
2752 self
2753 }
2754
2755 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2757 self.0.options = v.into();
2758 self
2759 }
2760
2761 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2763 (*self.0.stub)
2764 .list_operations(self.0.request, self.0.options)
2765 .await
2766 .map(gax::response::Response::into_body)
2767 }
2768
2769 pub fn by_page(
2771 self,
2772 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2773 {
2774 use std::clone::Clone;
2775 let token = self.0.request.page_token.clone();
2776 let execute = move |token: String| {
2777 let mut builder = self.clone();
2778 builder.0.request = builder.0.request.set_page_token(token);
2779 builder.send()
2780 };
2781 gax::paginator::internal::new_paginator(token, execute)
2782 }
2783
2784 pub fn by_item(
2786 self,
2787 ) -> impl gax::paginator::ItemPaginator<
2788 longrunning::model::ListOperationsResponse,
2789 gax::error::Error,
2790 > {
2791 use gax::paginator::Paginator;
2792 self.by_page().items()
2793 }
2794
2795 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2797 self.0.request.name = v.into();
2798 self
2799 }
2800
2801 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2803 self.0.request.filter = v.into();
2804 self
2805 }
2806
2807 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2809 self.0.request.page_size = v.into();
2810 self
2811 }
2812
2813 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2815 self.0.request.page_token = v.into();
2816 self
2817 }
2818
2819 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2821 self.0.request.return_partial_success = v.into();
2822 self
2823 }
2824 }
2825
2826 #[doc(hidden)]
2827 impl gax::options::internal::RequestBuilder for ListOperations {
2828 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2829 &mut self.0.options
2830 }
2831 }
2832
2833 #[derive(Clone, Debug)]
2851 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2852
2853 impl GetOperation {
2854 pub(crate) fn new(
2855 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2856 ) -> Self {
2857 Self(RequestBuilder::new(stub))
2858 }
2859
2860 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2862 mut self,
2863 v: V,
2864 ) -> Self {
2865 self.0.request = v.into();
2866 self
2867 }
2868
2869 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2871 self.0.options = v.into();
2872 self
2873 }
2874
2875 pub async fn send(self) -> Result<longrunning::model::Operation> {
2877 (*self.0.stub)
2878 .get_operation(self.0.request, self.0.options)
2879 .await
2880 .map(gax::response::Response::into_body)
2881 }
2882
2883 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2885 self.0.request.name = v.into();
2886 self
2887 }
2888 }
2889
2890 #[doc(hidden)]
2891 impl gax::options::internal::RequestBuilder for GetOperation {
2892 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2893 &mut self.0.options
2894 }
2895 }
2896
2897 #[derive(Clone, Debug)]
2915 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2916
2917 impl CancelOperation {
2918 pub(crate) fn new(
2919 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2920 ) -> Self {
2921 Self(RequestBuilder::new(stub))
2922 }
2923
2924 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2926 mut self,
2927 v: V,
2928 ) -> Self {
2929 self.0.request = v.into();
2930 self
2931 }
2932
2933 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2935 self.0.options = v.into();
2936 self
2937 }
2938
2939 pub async fn send(self) -> Result<()> {
2941 (*self.0.stub)
2942 .cancel_operation(self.0.request, self.0.options)
2943 .await
2944 .map(gax::response::Response::into_body)
2945 }
2946
2947 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2949 self.0.request.name = v.into();
2950 self
2951 }
2952 }
2953
2954 #[doc(hidden)]
2955 impl gax::options::internal::RequestBuilder for CancelOperation {
2956 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2957 &mut self.0.options
2958 }
2959 }
2960}