1pub mod document_processor_service {
18 use crate::Result;
19
20 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35 pub(crate) mod client {
36 use super::super::super::client::DocumentProcessorService;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = DocumentProcessorService;
40 type Credentials = gaxi::options::Credentials;
41 async fn build(
42 self,
43 config: gaxi::options::ClientConfig,
44 ) -> crate::ClientBuilderResult<Self::Client> {
45 Self::Client::new(config).await
46 }
47 }
48 }
49
50 #[derive(Clone, Debug)]
52 pub(crate) struct RequestBuilder<R: std::default::Default> {
53 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
54 request: R,
55 options: crate::RequestOptions,
56 }
57
58 impl<R> RequestBuilder<R>
59 where
60 R: std::default::Default,
61 {
62 pub(crate) fn new(
63 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
64 ) -> Self {
65 Self {
66 stub,
67 request: R::default(),
68 options: crate::RequestOptions::default(),
69 }
70 }
71 }
72
73 #[derive(Clone, Debug)]
90 pub struct ProcessDocument(RequestBuilder<crate::model::ProcessRequest>);
91
92 impl ProcessDocument {
93 pub(crate) fn new(
94 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
95 ) -> Self {
96 Self(RequestBuilder::new(stub))
97 }
98
99 pub fn with_request<V: Into<crate::model::ProcessRequest>>(mut self, v: V) -> Self {
101 self.0.request = v.into();
102 self
103 }
104
105 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
107 self.0.options = v.into();
108 self
109 }
110
111 pub async fn send(self) -> Result<crate::model::ProcessResponse> {
113 (*self.0.stub)
114 .process_document(self.0.request, self.0.options)
115 .await
116 .map(crate::Response::into_body)
117 }
118
119 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
123 self.0.request.name = v.into();
124 self
125 }
126
127 pub fn set_skip_human_review<T: Into<bool>>(mut self, v: T) -> Self {
129 self.0.request.skip_human_review = v.into();
130 self
131 }
132
133 pub fn set_field_mask<T>(mut self, v: T) -> Self
135 where
136 T: std::convert::Into<wkt::FieldMask>,
137 {
138 self.0.request.field_mask = std::option::Option::Some(v.into());
139 self
140 }
141
142 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
144 where
145 T: std::convert::Into<wkt::FieldMask>,
146 {
147 self.0.request.field_mask = v.map(|x| x.into());
148 self
149 }
150
151 pub fn set_process_options<T>(mut self, v: T) -> Self
153 where
154 T: std::convert::Into<crate::model::ProcessOptions>,
155 {
156 self.0.request.process_options = std::option::Option::Some(v.into());
157 self
158 }
159
160 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
162 where
163 T: std::convert::Into<crate::model::ProcessOptions>,
164 {
165 self.0.request.process_options = v.map(|x| x.into());
166 self
167 }
168
169 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
171 where
172 T: std::iter::IntoIterator<Item = (K, V)>,
173 K: std::convert::Into<std::string::String>,
174 V: std::convert::Into<std::string::String>,
175 {
176 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
177 self
178 }
179
180 pub fn set_imageless_mode<T: Into<bool>>(mut self, v: T) -> Self {
182 self.0.request.imageless_mode = v.into();
183 self
184 }
185
186 pub fn set_source<T: Into<Option<crate::model::process_request::Source>>>(
191 mut self,
192 v: T,
193 ) -> Self {
194 self.0.request.source = v.into();
195 self
196 }
197
198 pub fn set_inline_document<
204 T: std::convert::Into<std::boxed::Box<crate::model::Document>>,
205 >(
206 mut self,
207 v: T,
208 ) -> Self {
209 self.0.request = self.0.request.set_inline_document(v);
210 self
211 }
212
213 pub fn set_raw_document<
219 T: std::convert::Into<std::boxed::Box<crate::model::RawDocument>>,
220 >(
221 mut self,
222 v: T,
223 ) -> Self {
224 self.0.request = self.0.request.set_raw_document(v);
225 self
226 }
227
228 pub fn set_gcs_document<
234 T: std::convert::Into<std::boxed::Box<crate::model::GcsDocument>>,
235 >(
236 mut self,
237 v: T,
238 ) -> Self {
239 self.0.request = self.0.request.set_gcs_document(v);
240 self
241 }
242 }
243
244 #[doc(hidden)]
245 impl crate::RequestBuilder for ProcessDocument {
246 fn request_options(&mut self) -> &mut crate::RequestOptions {
247 &mut self.0.options
248 }
249 }
250
251 #[derive(Clone, Debug)]
269 pub struct BatchProcessDocuments(RequestBuilder<crate::model::BatchProcessRequest>);
270
271 impl BatchProcessDocuments {
272 pub(crate) fn new(
273 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
274 ) -> Self {
275 Self(RequestBuilder::new(stub))
276 }
277
278 pub fn with_request<V: Into<crate::model::BatchProcessRequest>>(mut self, v: V) -> Self {
280 self.0.request = v.into();
281 self
282 }
283
284 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
286 self.0.options = v.into();
287 self
288 }
289
290 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
297 (*self.0.stub)
298 .batch_process_documents(self.0.request, self.0.options)
299 .await
300 .map(crate::Response::into_body)
301 }
302
303 pub fn poller(
305 self,
306 ) -> impl google_cloud_lro::Poller<
307 crate::model::BatchProcessResponse,
308 crate::model::BatchProcessMetadata,
309 > {
310 type Operation = google_cloud_lro::internal::Operation<
311 crate::model::BatchProcessResponse,
312 crate::model::BatchProcessMetadata,
313 >;
314 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
315 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
316
317 let stub = self.0.stub.clone();
318 let mut options = self.0.options.clone();
319 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
320 let query = move |name| {
321 let stub = stub.clone();
322 let options = options.clone();
323 async {
324 let op = GetOperation::new(stub)
325 .set_name(name)
326 .with_options(options)
327 .send()
328 .await?;
329 Ok(Operation::new(op))
330 }
331 };
332
333 let start = move || async {
334 let op = self.send().await?;
335 Ok(Operation::new(op))
336 };
337
338 google_cloud_lro::internal::new_poller(
339 polling_error_policy,
340 polling_backoff_policy,
341 start,
342 query,
343 )
344 }
345
346 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
350 self.0.request.name = v.into();
351 self
352 }
353
354 pub fn set_input_documents<T>(mut self, v: T) -> Self
356 where
357 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
358 {
359 self.0.request.input_documents = std::option::Option::Some(v.into());
360 self
361 }
362
363 pub fn set_or_clear_input_documents<T>(mut self, v: std::option::Option<T>) -> Self
365 where
366 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
367 {
368 self.0.request.input_documents = v.map(|x| x.into());
369 self
370 }
371
372 pub fn set_document_output_config<T>(mut self, v: T) -> Self
374 where
375 T: std::convert::Into<crate::model::DocumentOutputConfig>,
376 {
377 self.0.request.document_output_config = std::option::Option::Some(v.into());
378 self
379 }
380
381 pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
383 where
384 T: std::convert::Into<crate::model::DocumentOutputConfig>,
385 {
386 self.0.request.document_output_config = v.map(|x| x.into());
387 self
388 }
389
390 pub fn set_skip_human_review<T: Into<bool>>(mut self, v: T) -> Self {
392 self.0.request.skip_human_review = v.into();
393 self
394 }
395
396 pub fn set_process_options<T>(mut self, v: T) -> Self
398 where
399 T: std::convert::Into<crate::model::ProcessOptions>,
400 {
401 self.0.request.process_options = std::option::Option::Some(v.into());
402 self
403 }
404
405 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
407 where
408 T: std::convert::Into<crate::model::ProcessOptions>,
409 {
410 self.0.request.process_options = v.map(|x| x.into());
411 self
412 }
413
414 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
416 where
417 T: std::iter::IntoIterator<Item = (K, V)>,
418 K: std::convert::Into<std::string::String>,
419 V: std::convert::Into<std::string::String>,
420 {
421 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
422 self
423 }
424 }
425
426 #[doc(hidden)]
427 impl crate::RequestBuilder for BatchProcessDocuments {
428 fn request_options(&mut self) -> &mut crate::RequestOptions {
429 &mut self.0.options
430 }
431 }
432
433 #[derive(Clone, Debug)]
450 pub struct FetchProcessorTypes(RequestBuilder<crate::model::FetchProcessorTypesRequest>);
451
452 impl FetchProcessorTypes {
453 pub(crate) fn new(
454 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
455 ) -> Self {
456 Self(RequestBuilder::new(stub))
457 }
458
459 pub fn with_request<V: Into<crate::model::FetchProcessorTypesRequest>>(
461 mut self,
462 v: V,
463 ) -> Self {
464 self.0.request = v.into();
465 self
466 }
467
468 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
470 self.0.options = v.into();
471 self
472 }
473
474 pub async fn send(self) -> Result<crate::model::FetchProcessorTypesResponse> {
476 (*self.0.stub)
477 .fetch_processor_types(self.0.request, self.0.options)
478 .await
479 .map(crate::Response::into_body)
480 }
481
482 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
486 self.0.request.parent = v.into();
487 self
488 }
489 }
490
491 #[doc(hidden)]
492 impl crate::RequestBuilder for FetchProcessorTypes {
493 fn request_options(&mut self) -> &mut crate::RequestOptions {
494 &mut self.0.options
495 }
496 }
497
498 #[derive(Clone, Debug)]
519 pub struct ListProcessorTypes(RequestBuilder<crate::model::ListProcessorTypesRequest>);
520
521 impl ListProcessorTypes {
522 pub(crate) fn new(
523 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
524 ) -> Self {
525 Self(RequestBuilder::new(stub))
526 }
527
528 pub fn with_request<V: Into<crate::model::ListProcessorTypesRequest>>(
530 mut self,
531 v: V,
532 ) -> Self {
533 self.0.request = v.into();
534 self
535 }
536
537 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
539 self.0.options = v.into();
540 self
541 }
542
543 pub async fn send(self) -> Result<crate::model::ListProcessorTypesResponse> {
545 (*self.0.stub)
546 .list_processor_types(self.0.request, self.0.options)
547 .await
548 .map(crate::Response::into_body)
549 }
550
551 pub fn by_page(
553 self,
554 ) -> impl google_cloud_gax::paginator::Paginator<
555 crate::model::ListProcessorTypesResponse,
556 crate::Error,
557 > {
558 use std::clone::Clone;
559 let token = self.0.request.page_token.clone();
560 let execute = move |token: String| {
561 let mut builder = self.clone();
562 builder.0.request = builder.0.request.set_page_token(token);
563 builder.send()
564 };
565 google_cloud_gax::paginator::internal::new_paginator(token, execute)
566 }
567
568 pub fn by_item(
570 self,
571 ) -> impl google_cloud_gax::paginator::ItemPaginator<
572 crate::model::ListProcessorTypesResponse,
573 crate::Error,
574 > {
575 use google_cloud_gax::paginator::Paginator;
576 self.by_page().items()
577 }
578
579 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
583 self.0.request.parent = v.into();
584 self
585 }
586
587 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
589 self.0.request.page_size = v.into();
590 self
591 }
592
593 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
595 self.0.request.page_token = v.into();
596 self
597 }
598 }
599
600 #[doc(hidden)]
601 impl crate::RequestBuilder for ListProcessorTypes {
602 fn request_options(&mut self) -> &mut crate::RequestOptions {
603 &mut self.0.options
604 }
605 }
606
607 #[derive(Clone, Debug)]
624 pub struct GetProcessorType(RequestBuilder<crate::model::GetProcessorTypeRequest>);
625
626 impl GetProcessorType {
627 pub(crate) fn new(
628 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
629 ) -> Self {
630 Self(RequestBuilder::new(stub))
631 }
632
633 pub fn with_request<V: Into<crate::model::GetProcessorTypeRequest>>(
635 mut self,
636 v: V,
637 ) -> Self {
638 self.0.request = v.into();
639 self
640 }
641
642 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
644 self.0.options = v.into();
645 self
646 }
647
648 pub async fn send(self) -> Result<crate::model::ProcessorType> {
650 (*self.0.stub)
651 .get_processor_type(self.0.request, self.0.options)
652 .await
653 .map(crate::Response::into_body)
654 }
655
656 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
660 self.0.request.name = v.into();
661 self
662 }
663 }
664
665 #[doc(hidden)]
666 impl crate::RequestBuilder for GetProcessorType {
667 fn request_options(&mut self) -> &mut crate::RequestOptions {
668 &mut self.0.options
669 }
670 }
671
672 #[derive(Clone, Debug)]
693 pub struct ListProcessors(RequestBuilder<crate::model::ListProcessorsRequest>);
694
695 impl ListProcessors {
696 pub(crate) fn new(
697 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
698 ) -> Self {
699 Self(RequestBuilder::new(stub))
700 }
701
702 pub fn with_request<V: Into<crate::model::ListProcessorsRequest>>(mut self, v: V) -> Self {
704 self.0.request = v.into();
705 self
706 }
707
708 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
710 self.0.options = v.into();
711 self
712 }
713
714 pub async fn send(self) -> Result<crate::model::ListProcessorsResponse> {
716 (*self.0.stub)
717 .list_processors(self.0.request, self.0.options)
718 .await
719 .map(crate::Response::into_body)
720 }
721
722 pub fn by_page(
724 self,
725 ) -> impl google_cloud_gax::paginator::Paginator<
726 crate::model::ListProcessorsResponse,
727 crate::Error,
728 > {
729 use std::clone::Clone;
730 let token = self.0.request.page_token.clone();
731 let execute = move |token: String| {
732 let mut builder = self.clone();
733 builder.0.request = builder.0.request.set_page_token(token);
734 builder.send()
735 };
736 google_cloud_gax::paginator::internal::new_paginator(token, execute)
737 }
738
739 pub fn by_item(
741 self,
742 ) -> impl google_cloud_gax::paginator::ItemPaginator<
743 crate::model::ListProcessorsResponse,
744 crate::Error,
745 > {
746 use google_cloud_gax::paginator::Paginator;
747 self.by_page().items()
748 }
749
750 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
754 self.0.request.parent = v.into();
755 self
756 }
757
758 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
760 self.0.request.page_size = v.into();
761 self
762 }
763
764 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
766 self.0.request.page_token = v.into();
767 self
768 }
769 }
770
771 #[doc(hidden)]
772 impl crate::RequestBuilder for ListProcessors {
773 fn request_options(&mut self) -> &mut crate::RequestOptions {
774 &mut self.0.options
775 }
776 }
777
778 #[derive(Clone, Debug)]
795 pub struct GetProcessor(RequestBuilder<crate::model::GetProcessorRequest>);
796
797 impl GetProcessor {
798 pub(crate) fn new(
799 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
800 ) -> Self {
801 Self(RequestBuilder::new(stub))
802 }
803
804 pub fn with_request<V: Into<crate::model::GetProcessorRequest>>(mut self, v: V) -> Self {
806 self.0.request = v.into();
807 self
808 }
809
810 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
812 self.0.options = v.into();
813 self
814 }
815
816 pub async fn send(self) -> Result<crate::model::Processor> {
818 (*self.0.stub)
819 .get_processor(self.0.request, self.0.options)
820 .await
821 .map(crate::Response::into_body)
822 }
823
824 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
828 self.0.request.name = v.into();
829 self
830 }
831 }
832
833 #[doc(hidden)]
834 impl crate::RequestBuilder for GetProcessor {
835 fn request_options(&mut self) -> &mut crate::RequestOptions {
836 &mut self.0.options
837 }
838 }
839
840 #[derive(Clone, Debug)]
858 pub struct TrainProcessorVersion(RequestBuilder<crate::model::TrainProcessorVersionRequest>);
859
860 impl TrainProcessorVersion {
861 pub(crate) fn new(
862 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
863 ) -> Self {
864 Self(RequestBuilder::new(stub))
865 }
866
867 pub fn with_request<V: Into<crate::model::TrainProcessorVersionRequest>>(
869 mut self,
870 v: V,
871 ) -> Self {
872 self.0.request = v.into();
873 self
874 }
875
876 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
878 self.0.options = v.into();
879 self
880 }
881
882 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
889 (*self.0.stub)
890 .train_processor_version(self.0.request, self.0.options)
891 .await
892 .map(crate::Response::into_body)
893 }
894
895 pub fn poller(
897 self,
898 ) -> impl google_cloud_lro::Poller<
899 crate::model::TrainProcessorVersionResponse,
900 crate::model::TrainProcessorVersionMetadata,
901 > {
902 type Operation = google_cloud_lro::internal::Operation<
903 crate::model::TrainProcessorVersionResponse,
904 crate::model::TrainProcessorVersionMetadata,
905 >;
906 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
907 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
908
909 let stub = self.0.stub.clone();
910 let mut options = self.0.options.clone();
911 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
912 let query = move |name| {
913 let stub = stub.clone();
914 let options = options.clone();
915 async {
916 let op = GetOperation::new(stub)
917 .set_name(name)
918 .with_options(options)
919 .send()
920 .await?;
921 Ok(Operation::new(op))
922 }
923 };
924
925 let start = move || async {
926 let op = self.send().await?;
927 Ok(Operation::new(op))
928 };
929
930 google_cloud_lro::internal::new_poller(
931 polling_error_policy,
932 polling_backoff_policy,
933 start,
934 query,
935 )
936 }
937
938 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
942 self.0.request.parent = v.into();
943 self
944 }
945
946 pub fn set_processor_version<T>(mut self, v: T) -> Self
950 where
951 T: std::convert::Into<crate::model::ProcessorVersion>,
952 {
953 self.0.request.processor_version = std::option::Option::Some(v.into());
954 self
955 }
956
957 pub fn set_or_clear_processor_version<T>(mut self, v: std::option::Option<T>) -> Self
961 where
962 T: std::convert::Into<crate::model::ProcessorVersion>,
963 {
964 self.0.request.processor_version = v.map(|x| x.into());
965 self
966 }
967
968 pub fn set_document_schema<T>(mut self, v: T) -> Self
970 where
971 T: std::convert::Into<crate::model::DocumentSchema>,
972 {
973 self.0.request.document_schema = std::option::Option::Some(v.into());
974 self
975 }
976
977 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
979 where
980 T: std::convert::Into<crate::model::DocumentSchema>,
981 {
982 self.0.request.document_schema = v.map(|x| x.into());
983 self
984 }
985
986 pub fn set_input_data<T>(mut self, v: T) -> Self
988 where
989 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
990 {
991 self.0.request.input_data = std::option::Option::Some(v.into());
992 self
993 }
994
995 pub fn set_or_clear_input_data<T>(mut self, v: std::option::Option<T>) -> Self
997 where
998 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
999 {
1000 self.0.request.input_data = v.map(|x| x.into());
1001 self
1002 }
1003
1004 pub fn set_base_processor_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
1006 self.0.request.base_processor_version = v.into();
1007 self
1008 }
1009
1010 pub fn set_processor_flags<
1015 T: Into<Option<crate::model::train_processor_version_request::ProcessorFlags>>,
1016 >(
1017 mut self,
1018 v: T,
1019 ) -> Self {
1020 self.0.request.processor_flags = v.into();
1021 self
1022 }
1023
1024 pub fn set_custom_document_extraction_options<T: std::convert::Into<std::boxed::Box<crate::model::train_processor_version_request::CustomDocumentExtractionOptions>>>(mut self, v: T) -> Self{
1030 self.0.request = self.0.request.set_custom_document_extraction_options(v);
1031 self
1032 }
1033
1034 pub fn set_foundation_model_tuning_options<
1040 T: std::convert::Into<
1041 std::boxed::Box<
1042 crate::model::train_processor_version_request::FoundationModelTuningOptions,
1043 >,
1044 >,
1045 >(
1046 mut self,
1047 v: T,
1048 ) -> Self {
1049 self.0.request = self.0.request.set_foundation_model_tuning_options(v);
1050 self
1051 }
1052 }
1053
1054 #[doc(hidden)]
1055 impl crate::RequestBuilder for TrainProcessorVersion {
1056 fn request_options(&mut self) -> &mut crate::RequestOptions {
1057 &mut self.0.options
1058 }
1059 }
1060
1061 #[derive(Clone, Debug)]
1078 pub struct GetProcessorVersion(RequestBuilder<crate::model::GetProcessorVersionRequest>);
1079
1080 impl GetProcessorVersion {
1081 pub(crate) fn new(
1082 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1083 ) -> Self {
1084 Self(RequestBuilder::new(stub))
1085 }
1086
1087 pub fn with_request<V: Into<crate::model::GetProcessorVersionRequest>>(
1089 mut self,
1090 v: V,
1091 ) -> Self {
1092 self.0.request = v.into();
1093 self
1094 }
1095
1096 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1098 self.0.options = v.into();
1099 self
1100 }
1101
1102 pub async fn send(self) -> Result<crate::model::ProcessorVersion> {
1104 (*self.0.stub)
1105 .get_processor_version(self.0.request, self.0.options)
1106 .await
1107 .map(crate::Response::into_body)
1108 }
1109
1110 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1114 self.0.request.name = v.into();
1115 self
1116 }
1117 }
1118
1119 #[doc(hidden)]
1120 impl crate::RequestBuilder for GetProcessorVersion {
1121 fn request_options(&mut self) -> &mut crate::RequestOptions {
1122 &mut self.0.options
1123 }
1124 }
1125
1126 #[derive(Clone, Debug)]
1147 pub struct ListProcessorVersions(RequestBuilder<crate::model::ListProcessorVersionsRequest>);
1148
1149 impl ListProcessorVersions {
1150 pub(crate) fn new(
1151 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1152 ) -> Self {
1153 Self(RequestBuilder::new(stub))
1154 }
1155
1156 pub fn with_request<V: Into<crate::model::ListProcessorVersionsRequest>>(
1158 mut self,
1159 v: V,
1160 ) -> Self {
1161 self.0.request = v.into();
1162 self
1163 }
1164
1165 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1167 self.0.options = v.into();
1168 self
1169 }
1170
1171 pub async fn send(self) -> Result<crate::model::ListProcessorVersionsResponse> {
1173 (*self.0.stub)
1174 .list_processor_versions(self.0.request, self.0.options)
1175 .await
1176 .map(crate::Response::into_body)
1177 }
1178
1179 pub fn by_page(
1181 self,
1182 ) -> impl google_cloud_gax::paginator::Paginator<
1183 crate::model::ListProcessorVersionsResponse,
1184 crate::Error,
1185 > {
1186 use std::clone::Clone;
1187 let token = self.0.request.page_token.clone();
1188 let execute = move |token: String| {
1189 let mut builder = self.clone();
1190 builder.0.request = builder.0.request.set_page_token(token);
1191 builder.send()
1192 };
1193 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1194 }
1195
1196 pub fn by_item(
1198 self,
1199 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1200 crate::model::ListProcessorVersionsResponse,
1201 crate::Error,
1202 > {
1203 use google_cloud_gax::paginator::Paginator;
1204 self.by_page().items()
1205 }
1206
1207 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1211 self.0.request.parent = v.into();
1212 self
1213 }
1214
1215 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1217 self.0.request.page_size = v.into();
1218 self
1219 }
1220
1221 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1223 self.0.request.page_token = v.into();
1224 self
1225 }
1226 }
1227
1228 #[doc(hidden)]
1229 impl crate::RequestBuilder for ListProcessorVersions {
1230 fn request_options(&mut self) -> &mut crate::RequestOptions {
1231 &mut self.0.options
1232 }
1233 }
1234
1235 #[derive(Clone, Debug)]
1253 pub struct DeleteProcessorVersion(RequestBuilder<crate::model::DeleteProcessorVersionRequest>);
1254
1255 impl DeleteProcessorVersion {
1256 pub(crate) fn new(
1257 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1258 ) -> Self {
1259 Self(RequestBuilder::new(stub))
1260 }
1261
1262 pub fn with_request<V: Into<crate::model::DeleteProcessorVersionRequest>>(
1264 mut self,
1265 v: V,
1266 ) -> Self {
1267 self.0.request = v.into();
1268 self
1269 }
1270
1271 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1273 self.0.options = v.into();
1274 self
1275 }
1276
1277 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1284 (*self.0.stub)
1285 .delete_processor_version(self.0.request, self.0.options)
1286 .await
1287 .map(crate::Response::into_body)
1288 }
1289
1290 pub fn poller(
1292 self,
1293 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteProcessorVersionMetadata>
1294 {
1295 type Operation = google_cloud_lro::internal::Operation<
1296 wkt::Empty,
1297 crate::model::DeleteProcessorVersionMetadata,
1298 >;
1299 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1300 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1301
1302 let stub = self.0.stub.clone();
1303 let mut options = self.0.options.clone();
1304 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1305 let query = move |name| {
1306 let stub = stub.clone();
1307 let options = options.clone();
1308 async {
1309 let op = GetOperation::new(stub)
1310 .set_name(name)
1311 .with_options(options)
1312 .send()
1313 .await?;
1314 Ok(Operation::new(op))
1315 }
1316 };
1317
1318 let start = move || async {
1319 let op = self.send().await?;
1320 Ok(Operation::new(op))
1321 };
1322
1323 google_cloud_lro::internal::new_unit_response_poller(
1324 polling_error_policy,
1325 polling_backoff_policy,
1326 start,
1327 query,
1328 )
1329 }
1330
1331 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1335 self.0.request.name = v.into();
1336 self
1337 }
1338 }
1339
1340 #[doc(hidden)]
1341 impl crate::RequestBuilder for DeleteProcessorVersion {
1342 fn request_options(&mut self) -> &mut crate::RequestOptions {
1343 &mut self.0.options
1344 }
1345 }
1346
1347 #[derive(Clone, Debug)]
1365 pub struct DeployProcessorVersion(RequestBuilder<crate::model::DeployProcessorVersionRequest>);
1366
1367 impl DeployProcessorVersion {
1368 pub(crate) fn new(
1369 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1370 ) -> Self {
1371 Self(RequestBuilder::new(stub))
1372 }
1373
1374 pub fn with_request<V: Into<crate::model::DeployProcessorVersionRequest>>(
1376 mut self,
1377 v: V,
1378 ) -> Self {
1379 self.0.request = v.into();
1380 self
1381 }
1382
1383 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1385 self.0.options = v.into();
1386 self
1387 }
1388
1389 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1396 (*self.0.stub)
1397 .deploy_processor_version(self.0.request, self.0.options)
1398 .await
1399 .map(crate::Response::into_body)
1400 }
1401
1402 pub fn poller(
1404 self,
1405 ) -> impl google_cloud_lro::Poller<
1406 crate::model::DeployProcessorVersionResponse,
1407 crate::model::DeployProcessorVersionMetadata,
1408 > {
1409 type Operation = google_cloud_lro::internal::Operation<
1410 crate::model::DeployProcessorVersionResponse,
1411 crate::model::DeployProcessorVersionMetadata,
1412 >;
1413 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1414 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1415
1416 let stub = self.0.stub.clone();
1417 let mut options = self.0.options.clone();
1418 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1419 let query = move |name| {
1420 let stub = stub.clone();
1421 let options = options.clone();
1422 async {
1423 let op = GetOperation::new(stub)
1424 .set_name(name)
1425 .with_options(options)
1426 .send()
1427 .await?;
1428 Ok(Operation::new(op))
1429 }
1430 };
1431
1432 let start = move || async {
1433 let op = self.send().await?;
1434 Ok(Operation::new(op))
1435 };
1436
1437 google_cloud_lro::internal::new_poller(
1438 polling_error_policy,
1439 polling_backoff_policy,
1440 start,
1441 query,
1442 )
1443 }
1444
1445 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1449 self.0.request.name = v.into();
1450 self
1451 }
1452 }
1453
1454 #[doc(hidden)]
1455 impl crate::RequestBuilder for DeployProcessorVersion {
1456 fn request_options(&mut self) -> &mut crate::RequestOptions {
1457 &mut self.0.options
1458 }
1459 }
1460
1461 #[derive(Clone, Debug)]
1479 pub struct UndeployProcessorVersion(
1480 RequestBuilder<crate::model::UndeployProcessorVersionRequest>,
1481 );
1482
1483 impl UndeployProcessorVersion {
1484 pub(crate) fn new(
1485 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1486 ) -> Self {
1487 Self(RequestBuilder::new(stub))
1488 }
1489
1490 pub fn with_request<V: Into<crate::model::UndeployProcessorVersionRequest>>(
1492 mut self,
1493 v: V,
1494 ) -> Self {
1495 self.0.request = v.into();
1496 self
1497 }
1498
1499 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1501 self.0.options = v.into();
1502 self
1503 }
1504
1505 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1512 (*self.0.stub)
1513 .undeploy_processor_version(self.0.request, self.0.options)
1514 .await
1515 .map(crate::Response::into_body)
1516 }
1517
1518 pub fn poller(
1520 self,
1521 ) -> impl google_cloud_lro::Poller<
1522 crate::model::UndeployProcessorVersionResponse,
1523 crate::model::UndeployProcessorVersionMetadata,
1524 > {
1525 type Operation = google_cloud_lro::internal::Operation<
1526 crate::model::UndeployProcessorVersionResponse,
1527 crate::model::UndeployProcessorVersionMetadata,
1528 >;
1529 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1530 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1531
1532 let stub = self.0.stub.clone();
1533 let mut options = self.0.options.clone();
1534 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1535 let query = move |name| {
1536 let stub = stub.clone();
1537 let options = options.clone();
1538 async {
1539 let op = GetOperation::new(stub)
1540 .set_name(name)
1541 .with_options(options)
1542 .send()
1543 .await?;
1544 Ok(Operation::new(op))
1545 }
1546 };
1547
1548 let start = move || async {
1549 let op = self.send().await?;
1550 Ok(Operation::new(op))
1551 };
1552
1553 google_cloud_lro::internal::new_poller(
1554 polling_error_policy,
1555 polling_backoff_policy,
1556 start,
1557 query,
1558 )
1559 }
1560
1561 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1565 self.0.request.name = v.into();
1566 self
1567 }
1568 }
1569
1570 #[doc(hidden)]
1571 impl crate::RequestBuilder for UndeployProcessorVersion {
1572 fn request_options(&mut self) -> &mut crate::RequestOptions {
1573 &mut self.0.options
1574 }
1575 }
1576
1577 #[derive(Clone, Debug)]
1594 pub struct CreateProcessor(RequestBuilder<crate::model::CreateProcessorRequest>);
1595
1596 impl CreateProcessor {
1597 pub(crate) fn new(
1598 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1599 ) -> Self {
1600 Self(RequestBuilder::new(stub))
1601 }
1602
1603 pub fn with_request<V: Into<crate::model::CreateProcessorRequest>>(mut self, v: V) -> Self {
1605 self.0.request = v.into();
1606 self
1607 }
1608
1609 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1611 self.0.options = v.into();
1612 self
1613 }
1614
1615 pub async fn send(self) -> Result<crate::model::Processor> {
1617 (*self.0.stub)
1618 .create_processor(self.0.request, self.0.options)
1619 .await
1620 .map(crate::Response::into_body)
1621 }
1622
1623 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1627 self.0.request.parent = v.into();
1628 self
1629 }
1630
1631 pub fn set_processor<T>(mut self, v: T) -> Self
1635 where
1636 T: std::convert::Into<crate::model::Processor>,
1637 {
1638 self.0.request.processor = std::option::Option::Some(v.into());
1639 self
1640 }
1641
1642 pub fn set_or_clear_processor<T>(mut self, v: std::option::Option<T>) -> Self
1646 where
1647 T: std::convert::Into<crate::model::Processor>,
1648 {
1649 self.0.request.processor = v.map(|x| x.into());
1650 self
1651 }
1652 }
1653
1654 #[doc(hidden)]
1655 impl crate::RequestBuilder for CreateProcessor {
1656 fn request_options(&mut self) -> &mut crate::RequestOptions {
1657 &mut self.0.options
1658 }
1659 }
1660
1661 #[derive(Clone, Debug)]
1679 pub struct DeleteProcessor(RequestBuilder<crate::model::DeleteProcessorRequest>);
1680
1681 impl DeleteProcessor {
1682 pub(crate) fn new(
1683 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1684 ) -> Self {
1685 Self(RequestBuilder::new(stub))
1686 }
1687
1688 pub fn with_request<V: Into<crate::model::DeleteProcessorRequest>>(mut self, v: V) -> Self {
1690 self.0.request = v.into();
1691 self
1692 }
1693
1694 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1696 self.0.options = v.into();
1697 self
1698 }
1699
1700 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1707 (*self.0.stub)
1708 .delete_processor(self.0.request, self.0.options)
1709 .await
1710 .map(crate::Response::into_body)
1711 }
1712
1713 pub fn poller(
1715 self,
1716 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteProcessorMetadata> {
1717 type Operation = google_cloud_lro::internal::Operation<
1718 wkt::Empty,
1719 crate::model::DeleteProcessorMetadata,
1720 >;
1721 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1722 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1723
1724 let stub = self.0.stub.clone();
1725 let mut options = self.0.options.clone();
1726 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1727 let query = move |name| {
1728 let stub = stub.clone();
1729 let options = options.clone();
1730 async {
1731 let op = GetOperation::new(stub)
1732 .set_name(name)
1733 .with_options(options)
1734 .send()
1735 .await?;
1736 Ok(Operation::new(op))
1737 }
1738 };
1739
1740 let start = move || async {
1741 let op = self.send().await?;
1742 Ok(Operation::new(op))
1743 };
1744
1745 google_cloud_lro::internal::new_unit_response_poller(
1746 polling_error_policy,
1747 polling_backoff_policy,
1748 start,
1749 query,
1750 )
1751 }
1752
1753 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1757 self.0.request.name = v.into();
1758 self
1759 }
1760 }
1761
1762 #[doc(hidden)]
1763 impl crate::RequestBuilder for DeleteProcessor {
1764 fn request_options(&mut self) -> &mut crate::RequestOptions {
1765 &mut self.0.options
1766 }
1767 }
1768
1769 #[derive(Clone, Debug)]
1787 pub struct EnableProcessor(RequestBuilder<crate::model::EnableProcessorRequest>);
1788
1789 impl EnableProcessor {
1790 pub(crate) fn new(
1791 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1792 ) -> Self {
1793 Self(RequestBuilder::new(stub))
1794 }
1795
1796 pub fn with_request<V: Into<crate::model::EnableProcessorRequest>>(mut self, v: V) -> Self {
1798 self.0.request = v.into();
1799 self
1800 }
1801
1802 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1804 self.0.options = v.into();
1805 self
1806 }
1807
1808 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1815 (*self.0.stub)
1816 .enable_processor(self.0.request, self.0.options)
1817 .await
1818 .map(crate::Response::into_body)
1819 }
1820
1821 pub fn poller(
1823 self,
1824 ) -> impl google_cloud_lro::Poller<
1825 crate::model::EnableProcessorResponse,
1826 crate::model::EnableProcessorMetadata,
1827 > {
1828 type Operation = google_cloud_lro::internal::Operation<
1829 crate::model::EnableProcessorResponse,
1830 crate::model::EnableProcessorMetadata,
1831 >;
1832 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1833 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1834
1835 let stub = self.0.stub.clone();
1836 let mut options = self.0.options.clone();
1837 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1838 let query = move |name| {
1839 let stub = stub.clone();
1840 let options = options.clone();
1841 async {
1842 let op = GetOperation::new(stub)
1843 .set_name(name)
1844 .with_options(options)
1845 .send()
1846 .await?;
1847 Ok(Operation::new(op))
1848 }
1849 };
1850
1851 let start = move || async {
1852 let op = self.send().await?;
1853 Ok(Operation::new(op))
1854 };
1855
1856 google_cloud_lro::internal::new_poller(
1857 polling_error_policy,
1858 polling_backoff_policy,
1859 start,
1860 query,
1861 )
1862 }
1863
1864 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1868 self.0.request.name = v.into();
1869 self
1870 }
1871 }
1872
1873 #[doc(hidden)]
1874 impl crate::RequestBuilder for EnableProcessor {
1875 fn request_options(&mut self) -> &mut crate::RequestOptions {
1876 &mut self.0.options
1877 }
1878 }
1879
1880 #[derive(Clone, Debug)]
1898 pub struct DisableProcessor(RequestBuilder<crate::model::DisableProcessorRequest>);
1899
1900 impl DisableProcessor {
1901 pub(crate) fn new(
1902 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1903 ) -> Self {
1904 Self(RequestBuilder::new(stub))
1905 }
1906
1907 pub fn with_request<V: Into<crate::model::DisableProcessorRequest>>(
1909 mut self,
1910 v: V,
1911 ) -> Self {
1912 self.0.request = v.into();
1913 self
1914 }
1915
1916 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1918 self.0.options = v.into();
1919 self
1920 }
1921
1922 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1929 (*self.0.stub)
1930 .disable_processor(self.0.request, self.0.options)
1931 .await
1932 .map(crate::Response::into_body)
1933 }
1934
1935 pub fn poller(
1937 self,
1938 ) -> impl google_cloud_lro::Poller<
1939 crate::model::DisableProcessorResponse,
1940 crate::model::DisableProcessorMetadata,
1941 > {
1942 type Operation = google_cloud_lro::internal::Operation<
1943 crate::model::DisableProcessorResponse,
1944 crate::model::DisableProcessorMetadata,
1945 >;
1946 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1947 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1948
1949 let stub = self.0.stub.clone();
1950 let mut options = self.0.options.clone();
1951 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1952 let query = move |name| {
1953 let stub = stub.clone();
1954 let options = options.clone();
1955 async {
1956 let op = GetOperation::new(stub)
1957 .set_name(name)
1958 .with_options(options)
1959 .send()
1960 .await?;
1961 Ok(Operation::new(op))
1962 }
1963 };
1964
1965 let start = move || async {
1966 let op = self.send().await?;
1967 Ok(Operation::new(op))
1968 };
1969
1970 google_cloud_lro::internal::new_poller(
1971 polling_error_policy,
1972 polling_backoff_policy,
1973 start,
1974 query,
1975 )
1976 }
1977
1978 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1982 self.0.request.name = v.into();
1983 self
1984 }
1985 }
1986
1987 #[doc(hidden)]
1988 impl crate::RequestBuilder for DisableProcessor {
1989 fn request_options(&mut self) -> &mut crate::RequestOptions {
1990 &mut self.0.options
1991 }
1992 }
1993
1994 #[derive(Clone, Debug)]
2012 pub struct SetDefaultProcessorVersion(
2013 RequestBuilder<crate::model::SetDefaultProcessorVersionRequest>,
2014 );
2015
2016 impl SetDefaultProcessorVersion {
2017 pub(crate) fn new(
2018 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2019 ) -> Self {
2020 Self(RequestBuilder::new(stub))
2021 }
2022
2023 pub fn with_request<V: Into<crate::model::SetDefaultProcessorVersionRequest>>(
2025 mut self,
2026 v: V,
2027 ) -> Self {
2028 self.0.request = v.into();
2029 self
2030 }
2031
2032 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2034 self.0.options = v.into();
2035 self
2036 }
2037
2038 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2045 (*self.0.stub)
2046 .set_default_processor_version(self.0.request, self.0.options)
2047 .await
2048 .map(crate::Response::into_body)
2049 }
2050
2051 pub fn poller(
2053 self,
2054 ) -> impl google_cloud_lro::Poller<
2055 crate::model::SetDefaultProcessorVersionResponse,
2056 crate::model::SetDefaultProcessorVersionMetadata,
2057 > {
2058 type Operation = google_cloud_lro::internal::Operation<
2059 crate::model::SetDefaultProcessorVersionResponse,
2060 crate::model::SetDefaultProcessorVersionMetadata,
2061 >;
2062 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2063 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2064
2065 let stub = self.0.stub.clone();
2066 let mut options = self.0.options.clone();
2067 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2068 let query = move |name| {
2069 let stub = stub.clone();
2070 let options = options.clone();
2071 async {
2072 let op = GetOperation::new(stub)
2073 .set_name(name)
2074 .with_options(options)
2075 .send()
2076 .await?;
2077 Ok(Operation::new(op))
2078 }
2079 };
2080
2081 let start = move || async {
2082 let op = self.send().await?;
2083 Ok(Operation::new(op))
2084 };
2085
2086 google_cloud_lro::internal::new_poller(
2087 polling_error_policy,
2088 polling_backoff_policy,
2089 start,
2090 query,
2091 )
2092 }
2093
2094 pub fn set_processor<T: Into<std::string::String>>(mut self, v: T) -> Self {
2098 self.0.request.processor = v.into();
2099 self
2100 }
2101
2102 pub fn set_default_processor_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
2106 self.0.request.default_processor_version = v.into();
2107 self
2108 }
2109 }
2110
2111 #[doc(hidden)]
2112 impl crate::RequestBuilder for SetDefaultProcessorVersion {
2113 fn request_options(&mut self) -> &mut crate::RequestOptions {
2114 &mut self.0.options
2115 }
2116 }
2117
2118 #[derive(Clone, Debug)]
2136 pub struct ReviewDocument(RequestBuilder<crate::model::ReviewDocumentRequest>);
2137
2138 impl ReviewDocument {
2139 pub(crate) fn new(
2140 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2141 ) -> Self {
2142 Self(RequestBuilder::new(stub))
2143 }
2144
2145 pub fn with_request<V: Into<crate::model::ReviewDocumentRequest>>(mut self, v: V) -> Self {
2147 self.0.request = v.into();
2148 self
2149 }
2150
2151 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2153 self.0.options = v.into();
2154 self
2155 }
2156
2157 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2164 (*self.0.stub)
2165 .review_document(self.0.request, self.0.options)
2166 .await
2167 .map(crate::Response::into_body)
2168 }
2169
2170 pub fn poller(
2172 self,
2173 ) -> impl google_cloud_lro::Poller<
2174 crate::model::ReviewDocumentResponse,
2175 crate::model::ReviewDocumentOperationMetadata,
2176 > {
2177 type Operation = google_cloud_lro::internal::Operation<
2178 crate::model::ReviewDocumentResponse,
2179 crate::model::ReviewDocumentOperationMetadata,
2180 >;
2181 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2182 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2183
2184 let stub = self.0.stub.clone();
2185 let mut options = self.0.options.clone();
2186 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2187 let query = move |name| {
2188 let stub = stub.clone();
2189 let options = options.clone();
2190 async {
2191 let op = GetOperation::new(stub)
2192 .set_name(name)
2193 .with_options(options)
2194 .send()
2195 .await?;
2196 Ok(Operation::new(op))
2197 }
2198 };
2199
2200 let start = move || async {
2201 let op = self.send().await?;
2202 Ok(Operation::new(op))
2203 };
2204
2205 google_cloud_lro::internal::new_poller(
2206 polling_error_policy,
2207 polling_backoff_policy,
2208 start,
2209 query,
2210 )
2211 }
2212
2213 pub fn set_human_review_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2217 self.0.request.human_review_config = v.into();
2218 self
2219 }
2220
2221 pub fn set_enable_schema_validation<T: Into<bool>>(mut self, v: T) -> Self {
2223 self.0.request.enable_schema_validation = v.into();
2224 self
2225 }
2226
2227 pub fn set_priority<T: Into<crate::model::review_document_request::Priority>>(
2229 mut self,
2230 v: T,
2231 ) -> Self {
2232 self.0.request.priority = v.into();
2233 self
2234 }
2235
2236 pub fn set_document_schema<T>(mut self, v: T) -> Self
2238 where
2239 T: std::convert::Into<crate::model::DocumentSchema>,
2240 {
2241 self.0.request.document_schema = std::option::Option::Some(v.into());
2242 self
2243 }
2244
2245 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
2247 where
2248 T: std::convert::Into<crate::model::DocumentSchema>,
2249 {
2250 self.0.request.document_schema = v.map(|x| x.into());
2251 self
2252 }
2253
2254 pub fn set_source<T: Into<Option<crate::model::review_document_request::Source>>>(
2259 mut self,
2260 v: T,
2261 ) -> Self {
2262 self.0.request.source = v.into();
2263 self
2264 }
2265
2266 pub fn set_inline_document<
2272 T: std::convert::Into<std::boxed::Box<crate::model::Document>>,
2273 >(
2274 mut self,
2275 v: T,
2276 ) -> Self {
2277 self.0.request = self.0.request.set_inline_document(v);
2278 self
2279 }
2280 }
2281
2282 #[doc(hidden)]
2283 impl crate::RequestBuilder for ReviewDocument {
2284 fn request_options(&mut self) -> &mut crate::RequestOptions {
2285 &mut self.0.options
2286 }
2287 }
2288
2289 #[derive(Clone, Debug)]
2307 pub struct EvaluateProcessorVersion(
2308 RequestBuilder<crate::model::EvaluateProcessorVersionRequest>,
2309 );
2310
2311 impl EvaluateProcessorVersion {
2312 pub(crate) fn new(
2313 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2314 ) -> Self {
2315 Self(RequestBuilder::new(stub))
2316 }
2317
2318 pub fn with_request<V: Into<crate::model::EvaluateProcessorVersionRequest>>(
2320 mut self,
2321 v: V,
2322 ) -> Self {
2323 self.0.request = v.into();
2324 self
2325 }
2326
2327 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2329 self.0.options = v.into();
2330 self
2331 }
2332
2333 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2340 (*self.0.stub)
2341 .evaluate_processor_version(self.0.request, self.0.options)
2342 .await
2343 .map(crate::Response::into_body)
2344 }
2345
2346 pub fn poller(
2348 self,
2349 ) -> impl google_cloud_lro::Poller<
2350 crate::model::EvaluateProcessorVersionResponse,
2351 crate::model::EvaluateProcessorVersionMetadata,
2352 > {
2353 type Operation = google_cloud_lro::internal::Operation<
2354 crate::model::EvaluateProcessorVersionResponse,
2355 crate::model::EvaluateProcessorVersionMetadata,
2356 >;
2357 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2358 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2359
2360 let stub = self.0.stub.clone();
2361 let mut options = self.0.options.clone();
2362 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
2363 let query = move |name| {
2364 let stub = stub.clone();
2365 let options = options.clone();
2366 async {
2367 let op = GetOperation::new(stub)
2368 .set_name(name)
2369 .with_options(options)
2370 .send()
2371 .await?;
2372 Ok(Operation::new(op))
2373 }
2374 };
2375
2376 let start = move || async {
2377 let op = self.send().await?;
2378 Ok(Operation::new(op))
2379 };
2380
2381 google_cloud_lro::internal::new_poller(
2382 polling_error_policy,
2383 polling_backoff_policy,
2384 start,
2385 query,
2386 )
2387 }
2388
2389 pub fn set_processor_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
2393 self.0.request.processor_version = v.into();
2394 self
2395 }
2396
2397 pub fn set_evaluation_documents<T>(mut self, v: T) -> Self
2399 where
2400 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
2401 {
2402 self.0.request.evaluation_documents = std::option::Option::Some(v.into());
2403 self
2404 }
2405
2406 pub fn set_or_clear_evaluation_documents<T>(mut self, v: std::option::Option<T>) -> Self
2408 where
2409 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
2410 {
2411 self.0.request.evaluation_documents = v.map(|x| x.into());
2412 self
2413 }
2414 }
2415
2416 #[doc(hidden)]
2417 impl crate::RequestBuilder for EvaluateProcessorVersion {
2418 fn request_options(&mut self) -> &mut crate::RequestOptions {
2419 &mut self.0.options
2420 }
2421 }
2422
2423 #[derive(Clone, Debug)]
2440 pub struct GetEvaluation(RequestBuilder<crate::model::GetEvaluationRequest>);
2441
2442 impl GetEvaluation {
2443 pub(crate) fn new(
2444 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2445 ) -> Self {
2446 Self(RequestBuilder::new(stub))
2447 }
2448
2449 pub fn with_request<V: Into<crate::model::GetEvaluationRequest>>(mut self, v: V) -> Self {
2451 self.0.request = v.into();
2452 self
2453 }
2454
2455 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2457 self.0.options = v.into();
2458 self
2459 }
2460
2461 pub async fn send(self) -> Result<crate::model::Evaluation> {
2463 (*self.0.stub)
2464 .get_evaluation(self.0.request, self.0.options)
2465 .await
2466 .map(crate::Response::into_body)
2467 }
2468
2469 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2473 self.0.request.name = v.into();
2474 self
2475 }
2476 }
2477
2478 #[doc(hidden)]
2479 impl crate::RequestBuilder for GetEvaluation {
2480 fn request_options(&mut self) -> &mut crate::RequestOptions {
2481 &mut self.0.options
2482 }
2483 }
2484
2485 #[derive(Clone, Debug)]
2506 pub struct ListEvaluations(RequestBuilder<crate::model::ListEvaluationsRequest>);
2507
2508 impl ListEvaluations {
2509 pub(crate) fn new(
2510 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2511 ) -> Self {
2512 Self(RequestBuilder::new(stub))
2513 }
2514
2515 pub fn with_request<V: Into<crate::model::ListEvaluationsRequest>>(mut self, v: V) -> Self {
2517 self.0.request = v.into();
2518 self
2519 }
2520
2521 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2523 self.0.options = v.into();
2524 self
2525 }
2526
2527 pub async fn send(self) -> Result<crate::model::ListEvaluationsResponse> {
2529 (*self.0.stub)
2530 .list_evaluations(self.0.request, self.0.options)
2531 .await
2532 .map(crate::Response::into_body)
2533 }
2534
2535 pub fn by_page(
2537 self,
2538 ) -> impl google_cloud_gax::paginator::Paginator<
2539 crate::model::ListEvaluationsResponse,
2540 crate::Error,
2541 > {
2542 use std::clone::Clone;
2543 let token = self.0.request.page_token.clone();
2544 let execute = move |token: String| {
2545 let mut builder = self.clone();
2546 builder.0.request = builder.0.request.set_page_token(token);
2547 builder.send()
2548 };
2549 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2550 }
2551
2552 pub fn by_item(
2554 self,
2555 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2556 crate::model::ListEvaluationsResponse,
2557 crate::Error,
2558 > {
2559 use google_cloud_gax::paginator::Paginator;
2560 self.by_page().items()
2561 }
2562
2563 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2567 self.0.request.parent = v.into();
2568 self
2569 }
2570
2571 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2573 self.0.request.page_size = v.into();
2574 self
2575 }
2576
2577 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2579 self.0.request.page_token = v.into();
2580 self
2581 }
2582 }
2583
2584 #[doc(hidden)]
2585 impl crate::RequestBuilder for ListEvaluations {
2586 fn request_options(&mut self) -> &mut crate::RequestOptions {
2587 &mut self.0.options
2588 }
2589 }
2590
2591 #[derive(Clone, Debug)]
2612 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
2613
2614 impl ListLocations {
2615 pub(crate) fn new(
2616 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2617 ) -> Self {
2618 Self(RequestBuilder::new(stub))
2619 }
2620
2621 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
2623 mut self,
2624 v: V,
2625 ) -> Self {
2626 self.0.request = v.into();
2627 self
2628 }
2629
2630 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2632 self.0.options = v.into();
2633 self
2634 }
2635
2636 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
2638 (*self.0.stub)
2639 .list_locations(self.0.request, self.0.options)
2640 .await
2641 .map(crate::Response::into_body)
2642 }
2643
2644 pub fn by_page(
2646 self,
2647 ) -> impl google_cloud_gax::paginator::Paginator<
2648 google_cloud_location::model::ListLocationsResponse,
2649 crate::Error,
2650 > {
2651 use std::clone::Clone;
2652 let token = self.0.request.page_token.clone();
2653 let execute = move |token: String| {
2654 let mut builder = self.clone();
2655 builder.0.request = builder.0.request.set_page_token(token);
2656 builder.send()
2657 };
2658 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2659 }
2660
2661 pub fn by_item(
2663 self,
2664 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2665 google_cloud_location::model::ListLocationsResponse,
2666 crate::Error,
2667 > {
2668 use google_cloud_gax::paginator::Paginator;
2669 self.by_page().items()
2670 }
2671
2672 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2674 self.0.request.name = v.into();
2675 self
2676 }
2677
2678 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2680 self.0.request.filter = v.into();
2681 self
2682 }
2683
2684 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2686 self.0.request.page_size = v.into();
2687 self
2688 }
2689
2690 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2692 self.0.request.page_token = v.into();
2693 self
2694 }
2695 }
2696
2697 #[doc(hidden)]
2698 impl crate::RequestBuilder for ListLocations {
2699 fn request_options(&mut self) -> &mut crate::RequestOptions {
2700 &mut self.0.options
2701 }
2702 }
2703
2704 #[derive(Clone, Debug)]
2721 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
2722
2723 impl GetLocation {
2724 pub(crate) fn new(
2725 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2726 ) -> Self {
2727 Self(RequestBuilder::new(stub))
2728 }
2729
2730 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
2732 mut self,
2733 v: V,
2734 ) -> Self {
2735 self.0.request = v.into();
2736 self
2737 }
2738
2739 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2741 self.0.options = v.into();
2742 self
2743 }
2744
2745 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
2747 (*self.0.stub)
2748 .get_location(self.0.request, self.0.options)
2749 .await
2750 .map(crate::Response::into_body)
2751 }
2752
2753 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2755 self.0.request.name = v.into();
2756 self
2757 }
2758 }
2759
2760 #[doc(hidden)]
2761 impl crate::RequestBuilder for GetLocation {
2762 fn request_options(&mut self) -> &mut crate::RequestOptions {
2763 &mut self.0.options
2764 }
2765 }
2766
2767 #[derive(Clone, Debug)]
2788 pub struct ListOperations(
2789 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2790 );
2791
2792 impl ListOperations {
2793 pub(crate) fn new(
2794 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2795 ) -> Self {
2796 Self(RequestBuilder::new(stub))
2797 }
2798
2799 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2801 mut self,
2802 v: V,
2803 ) -> Self {
2804 self.0.request = v.into();
2805 self
2806 }
2807
2808 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2810 self.0.options = v.into();
2811 self
2812 }
2813
2814 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2816 (*self.0.stub)
2817 .list_operations(self.0.request, self.0.options)
2818 .await
2819 .map(crate::Response::into_body)
2820 }
2821
2822 pub fn by_page(
2824 self,
2825 ) -> impl google_cloud_gax::paginator::Paginator<
2826 google_cloud_longrunning::model::ListOperationsResponse,
2827 crate::Error,
2828 > {
2829 use std::clone::Clone;
2830 let token = self.0.request.page_token.clone();
2831 let execute = move |token: String| {
2832 let mut builder = self.clone();
2833 builder.0.request = builder.0.request.set_page_token(token);
2834 builder.send()
2835 };
2836 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2837 }
2838
2839 pub fn by_item(
2841 self,
2842 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2843 google_cloud_longrunning::model::ListOperationsResponse,
2844 crate::Error,
2845 > {
2846 use google_cloud_gax::paginator::Paginator;
2847 self.by_page().items()
2848 }
2849
2850 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2852 self.0.request.name = v.into();
2853 self
2854 }
2855
2856 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2858 self.0.request.filter = v.into();
2859 self
2860 }
2861
2862 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2864 self.0.request.page_size = v.into();
2865 self
2866 }
2867
2868 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2870 self.0.request.page_token = v.into();
2871 self
2872 }
2873
2874 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2876 self.0.request.return_partial_success = v.into();
2877 self
2878 }
2879 }
2880
2881 #[doc(hidden)]
2882 impl crate::RequestBuilder for ListOperations {
2883 fn request_options(&mut self) -> &mut crate::RequestOptions {
2884 &mut self.0.options
2885 }
2886 }
2887
2888 #[derive(Clone, Debug)]
2905 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2906
2907 impl GetOperation {
2908 pub(crate) fn new(
2909 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2910 ) -> Self {
2911 Self(RequestBuilder::new(stub))
2912 }
2913
2914 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2916 mut self,
2917 v: V,
2918 ) -> Self {
2919 self.0.request = v.into();
2920 self
2921 }
2922
2923 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2925 self.0.options = v.into();
2926 self
2927 }
2928
2929 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2931 (*self.0.stub)
2932 .get_operation(self.0.request, self.0.options)
2933 .await
2934 .map(crate::Response::into_body)
2935 }
2936
2937 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2939 self.0.request.name = v.into();
2940 self
2941 }
2942 }
2943
2944 #[doc(hidden)]
2945 impl crate::RequestBuilder for GetOperation {
2946 fn request_options(&mut self) -> &mut crate::RequestOptions {
2947 &mut self.0.options
2948 }
2949 }
2950
2951 #[derive(Clone, Debug)]
2968 pub struct CancelOperation(
2969 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2970 );
2971
2972 impl CancelOperation {
2973 pub(crate) fn new(
2974 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2975 ) -> Self {
2976 Self(RequestBuilder::new(stub))
2977 }
2978
2979 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2981 mut self,
2982 v: V,
2983 ) -> Self {
2984 self.0.request = v.into();
2985 self
2986 }
2987
2988 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2990 self.0.options = v.into();
2991 self
2992 }
2993
2994 pub async fn send(self) -> Result<()> {
2996 (*self.0.stub)
2997 .cancel_operation(self.0.request, self.0.options)
2998 .await
2999 .map(crate::Response::into_body)
3000 }
3001
3002 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3004 self.0.request.name = v.into();
3005 self
3006 }
3007 }
3008
3009 #[doc(hidden)]
3010 impl crate::RequestBuilder for CancelOperation {
3011 fn request_options(&mut self) -> &mut crate::RequestOptions {
3012 &mut self.0.options
3013 }
3014 }
3015}