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