1pub mod document_processor_service {
18 use crate::Result;
19
20 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::DocumentProcessorService;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = DocumentProcessorService;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
55 request: R,
56 options: gax::options::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
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<gax::options::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(gax::response::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 gax::options::internal::RequestBuilder for ProcessDocument {
247 fn request_options(&mut self) -> &mut gax::options::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<gax::options::RequestOptions>>(mut self, v: V) -> Self {
287 self.0.options = v.into();
288 self
289 }
290
291 pub async fn send(self) -> Result<longrunning::model::Operation> {
298 (*self.0.stub)
299 .batch_process_documents(self.0.request, self.0.options)
300 .await
301 .map(gax::response::Response::into_body)
302 }
303
304 pub fn poller(
306 self,
307 ) -> impl lro::Poller<crate::model::BatchProcessResponse, crate::model::BatchProcessMetadata>
308 {
309 type Operation = lro::internal::Operation<
310 crate::model::BatchProcessResponse,
311 crate::model::BatchProcessMetadata,
312 >;
313 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
314 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
315
316 let stub = self.0.stub.clone();
317 let mut options = self.0.options.clone();
318 options.set_retry_policy(gax::retry_policy::NeverRetry);
319 let query = move |name| {
320 let stub = stub.clone();
321 let options = options.clone();
322 async {
323 let op = GetOperation::new(stub)
324 .set_name(name)
325 .with_options(options)
326 .send()
327 .await?;
328 Ok(Operation::new(op))
329 }
330 };
331
332 let start = move || async {
333 let op = self.send().await?;
334 Ok(Operation::new(op))
335 };
336
337 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
338 }
339
340 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
344 self.0.request.name = v.into();
345 self
346 }
347
348 pub fn set_input_documents<T>(mut self, v: T) -> Self
350 where
351 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
352 {
353 self.0.request.input_documents = std::option::Option::Some(v.into());
354 self
355 }
356
357 pub fn set_or_clear_input_documents<T>(mut self, v: std::option::Option<T>) -> Self
359 where
360 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
361 {
362 self.0.request.input_documents = v.map(|x| x.into());
363 self
364 }
365
366 pub fn set_document_output_config<T>(mut self, v: T) -> Self
368 where
369 T: std::convert::Into<crate::model::DocumentOutputConfig>,
370 {
371 self.0.request.document_output_config = std::option::Option::Some(v.into());
372 self
373 }
374
375 pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
377 where
378 T: std::convert::Into<crate::model::DocumentOutputConfig>,
379 {
380 self.0.request.document_output_config = v.map(|x| x.into());
381 self
382 }
383
384 pub fn set_skip_human_review<T: Into<bool>>(mut self, v: T) -> Self {
386 self.0.request.skip_human_review = v.into();
387 self
388 }
389
390 pub fn set_process_options<T>(mut self, v: T) -> Self
392 where
393 T: std::convert::Into<crate::model::ProcessOptions>,
394 {
395 self.0.request.process_options = std::option::Option::Some(v.into());
396 self
397 }
398
399 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
401 where
402 T: std::convert::Into<crate::model::ProcessOptions>,
403 {
404 self.0.request.process_options = v.map(|x| x.into());
405 self
406 }
407
408 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
410 where
411 T: std::iter::IntoIterator<Item = (K, V)>,
412 K: std::convert::Into<std::string::String>,
413 V: std::convert::Into<std::string::String>,
414 {
415 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
416 self
417 }
418 }
419
420 #[doc(hidden)]
421 impl gax::options::internal::RequestBuilder for BatchProcessDocuments {
422 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
423 &mut self.0.options
424 }
425 }
426
427 #[derive(Clone, Debug)]
444 pub struct FetchProcessorTypes(RequestBuilder<crate::model::FetchProcessorTypesRequest>);
445
446 impl FetchProcessorTypes {
447 pub(crate) fn new(
448 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
449 ) -> Self {
450 Self(RequestBuilder::new(stub))
451 }
452
453 pub fn with_request<V: Into<crate::model::FetchProcessorTypesRequest>>(
455 mut self,
456 v: V,
457 ) -> Self {
458 self.0.request = v.into();
459 self
460 }
461
462 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
464 self.0.options = v.into();
465 self
466 }
467
468 pub async fn send(self) -> Result<crate::model::FetchProcessorTypesResponse> {
470 (*self.0.stub)
471 .fetch_processor_types(self.0.request, self.0.options)
472 .await
473 .map(gax::response::Response::into_body)
474 }
475
476 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
480 self.0.request.parent = v.into();
481 self
482 }
483 }
484
485 #[doc(hidden)]
486 impl gax::options::internal::RequestBuilder for FetchProcessorTypes {
487 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
488 &mut self.0.options
489 }
490 }
491
492 #[derive(Clone, Debug)]
513 pub struct ListProcessorTypes(RequestBuilder<crate::model::ListProcessorTypesRequest>);
514
515 impl ListProcessorTypes {
516 pub(crate) fn new(
517 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
518 ) -> Self {
519 Self(RequestBuilder::new(stub))
520 }
521
522 pub fn with_request<V: Into<crate::model::ListProcessorTypesRequest>>(
524 mut self,
525 v: V,
526 ) -> Self {
527 self.0.request = v.into();
528 self
529 }
530
531 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
533 self.0.options = v.into();
534 self
535 }
536
537 pub async fn send(self) -> Result<crate::model::ListProcessorTypesResponse> {
539 (*self.0.stub)
540 .list_processor_types(self.0.request, self.0.options)
541 .await
542 .map(gax::response::Response::into_body)
543 }
544
545 pub fn by_page(
547 self,
548 ) -> impl gax::paginator::Paginator<crate::model::ListProcessorTypesResponse, gax::error::Error>
549 {
550 use std::clone::Clone;
551 let token = self.0.request.page_token.clone();
552 let execute = move |token: String| {
553 let mut builder = self.clone();
554 builder.0.request = builder.0.request.set_page_token(token);
555 builder.send()
556 };
557 gax::paginator::internal::new_paginator(token, execute)
558 }
559
560 pub fn by_item(
562 self,
563 ) -> impl gax::paginator::ItemPaginator<
564 crate::model::ListProcessorTypesResponse,
565 gax::error::Error,
566 > {
567 use gax::paginator::Paginator;
568 self.by_page().items()
569 }
570
571 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
575 self.0.request.parent = v.into();
576 self
577 }
578
579 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
581 self.0.request.page_size = v.into();
582 self
583 }
584
585 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
587 self.0.request.page_token = v.into();
588 self
589 }
590 }
591
592 #[doc(hidden)]
593 impl gax::options::internal::RequestBuilder for ListProcessorTypes {
594 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
595 &mut self.0.options
596 }
597 }
598
599 #[derive(Clone, Debug)]
616 pub struct GetProcessorType(RequestBuilder<crate::model::GetProcessorTypeRequest>);
617
618 impl GetProcessorType {
619 pub(crate) fn new(
620 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
621 ) -> Self {
622 Self(RequestBuilder::new(stub))
623 }
624
625 pub fn with_request<V: Into<crate::model::GetProcessorTypeRequest>>(
627 mut self,
628 v: V,
629 ) -> Self {
630 self.0.request = v.into();
631 self
632 }
633
634 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
636 self.0.options = v.into();
637 self
638 }
639
640 pub async fn send(self) -> Result<crate::model::ProcessorType> {
642 (*self.0.stub)
643 .get_processor_type(self.0.request, self.0.options)
644 .await
645 .map(gax::response::Response::into_body)
646 }
647
648 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
652 self.0.request.name = v.into();
653 self
654 }
655 }
656
657 #[doc(hidden)]
658 impl gax::options::internal::RequestBuilder for GetProcessorType {
659 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
660 &mut self.0.options
661 }
662 }
663
664 #[derive(Clone, Debug)]
685 pub struct ListProcessors(RequestBuilder<crate::model::ListProcessorsRequest>);
686
687 impl ListProcessors {
688 pub(crate) fn new(
689 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
690 ) -> Self {
691 Self(RequestBuilder::new(stub))
692 }
693
694 pub fn with_request<V: Into<crate::model::ListProcessorsRequest>>(mut self, v: V) -> Self {
696 self.0.request = v.into();
697 self
698 }
699
700 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
702 self.0.options = v.into();
703 self
704 }
705
706 pub async fn send(self) -> Result<crate::model::ListProcessorsResponse> {
708 (*self.0.stub)
709 .list_processors(self.0.request, self.0.options)
710 .await
711 .map(gax::response::Response::into_body)
712 }
713
714 pub fn by_page(
716 self,
717 ) -> impl gax::paginator::Paginator<crate::model::ListProcessorsResponse, gax::error::Error>
718 {
719 use std::clone::Clone;
720 let token = self.0.request.page_token.clone();
721 let execute = move |token: String| {
722 let mut builder = self.clone();
723 builder.0.request = builder.0.request.set_page_token(token);
724 builder.send()
725 };
726 gax::paginator::internal::new_paginator(token, execute)
727 }
728
729 pub fn by_item(
731 self,
732 ) -> impl gax::paginator::ItemPaginator<crate::model::ListProcessorsResponse, gax::error::Error>
733 {
734 use gax::paginator::Paginator;
735 self.by_page().items()
736 }
737
738 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
742 self.0.request.parent = v.into();
743 self
744 }
745
746 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
748 self.0.request.page_size = v.into();
749 self
750 }
751
752 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
754 self.0.request.page_token = v.into();
755 self
756 }
757 }
758
759 #[doc(hidden)]
760 impl gax::options::internal::RequestBuilder for ListProcessors {
761 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
762 &mut self.0.options
763 }
764 }
765
766 #[derive(Clone, Debug)]
783 pub struct GetProcessor(RequestBuilder<crate::model::GetProcessorRequest>);
784
785 impl GetProcessor {
786 pub(crate) fn new(
787 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
788 ) -> Self {
789 Self(RequestBuilder::new(stub))
790 }
791
792 pub fn with_request<V: Into<crate::model::GetProcessorRequest>>(mut self, v: V) -> Self {
794 self.0.request = v.into();
795 self
796 }
797
798 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
800 self.0.options = v.into();
801 self
802 }
803
804 pub async fn send(self) -> Result<crate::model::Processor> {
806 (*self.0.stub)
807 .get_processor(self.0.request, self.0.options)
808 .await
809 .map(gax::response::Response::into_body)
810 }
811
812 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
816 self.0.request.name = v.into();
817 self
818 }
819 }
820
821 #[doc(hidden)]
822 impl gax::options::internal::RequestBuilder for GetProcessor {
823 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
824 &mut self.0.options
825 }
826 }
827
828 #[derive(Clone, Debug)]
846 pub struct TrainProcessorVersion(RequestBuilder<crate::model::TrainProcessorVersionRequest>);
847
848 impl TrainProcessorVersion {
849 pub(crate) fn new(
850 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
851 ) -> Self {
852 Self(RequestBuilder::new(stub))
853 }
854
855 pub fn with_request<V: Into<crate::model::TrainProcessorVersionRequest>>(
857 mut self,
858 v: V,
859 ) -> Self {
860 self.0.request = v.into();
861 self
862 }
863
864 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
866 self.0.options = v.into();
867 self
868 }
869
870 pub async fn send(self) -> Result<longrunning::model::Operation> {
877 (*self.0.stub)
878 .train_processor_version(self.0.request, self.0.options)
879 .await
880 .map(gax::response::Response::into_body)
881 }
882
883 pub fn poller(
885 self,
886 ) -> impl lro::Poller<
887 crate::model::TrainProcessorVersionResponse,
888 crate::model::TrainProcessorVersionMetadata,
889 > {
890 type Operation = lro::internal::Operation<
891 crate::model::TrainProcessorVersionResponse,
892 crate::model::TrainProcessorVersionMetadata,
893 >;
894 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
895 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
896
897 let stub = self.0.stub.clone();
898 let mut options = self.0.options.clone();
899 options.set_retry_policy(gax::retry_policy::NeverRetry);
900 let query = move |name| {
901 let stub = stub.clone();
902 let options = options.clone();
903 async {
904 let op = GetOperation::new(stub)
905 .set_name(name)
906 .with_options(options)
907 .send()
908 .await?;
909 Ok(Operation::new(op))
910 }
911 };
912
913 let start = move || async {
914 let op = self.send().await?;
915 Ok(Operation::new(op))
916 };
917
918 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
919 }
920
921 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
925 self.0.request.parent = v.into();
926 self
927 }
928
929 pub fn set_processor_version<T>(mut self, v: T) -> Self
933 where
934 T: std::convert::Into<crate::model::ProcessorVersion>,
935 {
936 self.0.request.processor_version = std::option::Option::Some(v.into());
937 self
938 }
939
940 pub fn set_or_clear_processor_version<T>(mut self, v: std::option::Option<T>) -> Self
944 where
945 T: std::convert::Into<crate::model::ProcessorVersion>,
946 {
947 self.0.request.processor_version = v.map(|x| x.into());
948 self
949 }
950
951 pub fn set_document_schema<T>(mut self, v: T) -> Self
953 where
954 T: std::convert::Into<crate::model::DocumentSchema>,
955 {
956 self.0.request.document_schema = std::option::Option::Some(v.into());
957 self
958 }
959
960 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
962 where
963 T: std::convert::Into<crate::model::DocumentSchema>,
964 {
965 self.0.request.document_schema = v.map(|x| x.into());
966 self
967 }
968
969 pub fn set_input_data<T>(mut self, v: T) -> Self
971 where
972 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
973 {
974 self.0.request.input_data = std::option::Option::Some(v.into());
975 self
976 }
977
978 pub fn set_or_clear_input_data<T>(mut self, v: std::option::Option<T>) -> Self
980 where
981 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
982 {
983 self.0.request.input_data = v.map(|x| x.into());
984 self
985 }
986
987 pub fn set_base_processor_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
989 self.0.request.base_processor_version = v.into();
990 self
991 }
992
993 pub fn set_processor_flags<
998 T: Into<Option<crate::model::train_processor_version_request::ProcessorFlags>>,
999 >(
1000 mut self,
1001 v: T,
1002 ) -> Self {
1003 self.0.request.processor_flags = v.into();
1004 self
1005 }
1006
1007 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{
1013 self.0.request = self.0.request.set_custom_document_extraction_options(v);
1014 self
1015 }
1016
1017 pub fn set_foundation_model_tuning_options<
1023 T: std::convert::Into<
1024 std::boxed::Box<
1025 crate::model::train_processor_version_request::FoundationModelTuningOptions,
1026 >,
1027 >,
1028 >(
1029 mut self,
1030 v: T,
1031 ) -> Self {
1032 self.0.request = self.0.request.set_foundation_model_tuning_options(v);
1033 self
1034 }
1035 }
1036
1037 #[doc(hidden)]
1038 impl gax::options::internal::RequestBuilder for TrainProcessorVersion {
1039 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1040 &mut self.0.options
1041 }
1042 }
1043
1044 #[derive(Clone, Debug)]
1061 pub struct GetProcessorVersion(RequestBuilder<crate::model::GetProcessorVersionRequest>);
1062
1063 impl GetProcessorVersion {
1064 pub(crate) fn new(
1065 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1066 ) -> Self {
1067 Self(RequestBuilder::new(stub))
1068 }
1069
1070 pub fn with_request<V: Into<crate::model::GetProcessorVersionRequest>>(
1072 mut self,
1073 v: V,
1074 ) -> Self {
1075 self.0.request = v.into();
1076 self
1077 }
1078
1079 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1081 self.0.options = v.into();
1082 self
1083 }
1084
1085 pub async fn send(self) -> Result<crate::model::ProcessorVersion> {
1087 (*self.0.stub)
1088 .get_processor_version(self.0.request, self.0.options)
1089 .await
1090 .map(gax::response::Response::into_body)
1091 }
1092
1093 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1097 self.0.request.name = v.into();
1098 self
1099 }
1100 }
1101
1102 #[doc(hidden)]
1103 impl gax::options::internal::RequestBuilder for GetProcessorVersion {
1104 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1105 &mut self.0.options
1106 }
1107 }
1108
1109 #[derive(Clone, Debug)]
1130 pub struct ListProcessorVersions(RequestBuilder<crate::model::ListProcessorVersionsRequest>);
1131
1132 impl ListProcessorVersions {
1133 pub(crate) fn new(
1134 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1135 ) -> Self {
1136 Self(RequestBuilder::new(stub))
1137 }
1138
1139 pub fn with_request<V: Into<crate::model::ListProcessorVersionsRequest>>(
1141 mut self,
1142 v: V,
1143 ) -> Self {
1144 self.0.request = v.into();
1145 self
1146 }
1147
1148 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1150 self.0.options = v.into();
1151 self
1152 }
1153
1154 pub async fn send(self) -> Result<crate::model::ListProcessorVersionsResponse> {
1156 (*self.0.stub)
1157 .list_processor_versions(self.0.request, self.0.options)
1158 .await
1159 .map(gax::response::Response::into_body)
1160 }
1161
1162 pub fn by_page(
1164 self,
1165 ) -> impl gax::paginator::Paginator<crate::model::ListProcessorVersionsResponse, gax::error::Error>
1166 {
1167 use std::clone::Clone;
1168 let token = self.0.request.page_token.clone();
1169 let execute = move |token: String| {
1170 let mut builder = self.clone();
1171 builder.0.request = builder.0.request.set_page_token(token);
1172 builder.send()
1173 };
1174 gax::paginator::internal::new_paginator(token, execute)
1175 }
1176
1177 pub fn by_item(
1179 self,
1180 ) -> impl gax::paginator::ItemPaginator<
1181 crate::model::ListProcessorVersionsResponse,
1182 gax::error::Error,
1183 > {
1184 use gax::paginator::Paginator;
1185 self.by_page().items()
1186 }
1187
1188 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1192 self.0.request.parent = v.into();
1193 self
1194 }
1195
1196 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1198 self.0.request.page_size = v.into();
1199 self
1200 }
1201
1202 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1204 self.0.request.page_token = v.into();
1205 self
1206 }
1207 }
1208
1209 #[doc(hidden)]
1210 impl gax::options::internal::RequestBuilder for ListProcessorVersions {
1211 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1212 &mut self.0.options
1213 }
1214 }
1215
1216 #[derive(Clone, Debug)]
1234 pub struct DeleteProcessorVersion(RequestBuilder<crate::model::DeleteProcessorVersionRequest>);
1235
1236 impl DeleteProcessorVersion {
1237 pub(crate) fn new(
1238 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1239 ) -> Self {
1240 Self(RequestBuilder::new(stub))
1241 }
1242
1243 pub fn with_request<V: Into<crate::model::DeleteProcessorVersionRequest>>(
1245 mut self,
1246 v: V,
1247 ) -> Self {
1248 self.0.request = v.into();
1249 self
1250 }
1251
1252 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1254 self.0.options = v.into();
1255 self
1256 }
1257
1258 pub async fn send(self) -> Result<longrunning::model::Operation> {
1265 (*self.0.stub)
1266 .delete_processor_version(self.0.request, self.0.options)
1267 .await
1268 .map(gax::response::Response::into_body)
1269 }
1270
1271 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteProcessorVersionMetadata> {
1273 type Operation =
1274 lro::internal::Operation<wkt::Empty, crate::model::DeleteProcessorVersionMetadata>;
1275 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1276 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1277
1278 let stub = self.0.stub.clone();
1279 let mut options = self.0.options.clone();
1280 options.set_retry_policy(gax::retry_policy::NeverRetry);
1281 let query = move |name| {
1282 let stub = stub.clone();
1283 let options = options.clone();
1284 async {
1285 let op = GetOperation::new(stub)
1286 .set_name(name)
1287 .with_options(options)
1288 .send()
1289 .await?;
1290 Ok(Operation::new(op))
1291 }
1292 };
1293
1294 let start = move || async {
1295 let op = self.send().await?;
1296 Ok(Operation::new(op))
1297 };
1298
1299 lro::internal::new_unit_response_poller(
1300 polling_error_policy,
1301 polling_backoff_policy,
1302 start,
1303 query,
1304 )
1305 }
1306
1307 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1311 self.0.request.name = v.into();
1312 self
1313 }
1314 }
1315
1316 #[doc(hidden)]
1317 impl gax::options::internal::RequestBuilder for DeleteProcessorVersion {
1318 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1319 &mut self.0.options
1320 }
1321 }
1322
1323 #[derive(Clone, Debug)]
1341 pub struct DeployProcessorVersion(RequestBuilder<crate::model::DeployProcessorVersionRequest>);
1342
1343 impl DeployProcessorVersion {
1344 pub(crate) fn new(
1345 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1346 ) -> Self {
1347 Self(RequestBuilder::new(stub))
1348 }
1349
1350 pub fn with_request<V: Into<crate::model::DeployProcessorVersionRequest>>(
1352 mut self,
1353 v: V,
1354 ) -> Self {
1355 self.0.request = v.into();
1356 self
1357 }
1358
1359 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1361 self.0.options = v.into();
1362 self
1363 }
1364
1365 pub async fn send(self) -> Result<longrunning::model::Operation> {
1372 (*self.0.stub)
1373 .deploy_processor_version(self.0.request, self.0.options)
1374 .await
1375 .map(gax::response::Response::into_body)
1376 }
1377
1378 pub fn poller(
1380 self,
1381 ) -> impl lro::Poller<
1382 crate::model::DeployProcessorVersionResponse,
1383 crate::model::DeployProcessorVersionMetadata,
1384 > {
1385 type Operation = lro::internal::Operation<
1386 crate::model::DeployProcessorVersionResponse,
1387 crate::model::DeployProcessorVersionMetadata,
1388 >;
1389 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1390 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1391
1392 let stub = self.0.stub.clone();
1393 let mut options = self.0.options.clone();
1394 options.set_retry_policy(gax::retry_policy::NeverRetry);
1395 let query = move |name| {
1396 let stub = stub.clone();
1397 let options = options.clone();
1398 async {
1399 let op = GetOperation::new(stub)
1400 .set_name(name)
1401 .with_options(options)
1402 .send()
1403 .await?;
1404 Ok(Operation::new(op))
1405 }
1406 };
1407
1408 let start = move || async {
1409 let op = self.send().await?;
1410 Ok(Operation::new(op))
1411 };
1412
1413 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1414 }
1415
1416 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1420 self.0.request.name = v.into();
1421 self
1422 }
1423 }
1424
1425 #[doc(hidden)]
1426 impl gax::options::internal::RequestBuilder for DeployProcessorVersion {
1427 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1428 &mut self.0.options
1429 }
1430 }
1431
1432 #[derive(Clone, Debug)]
1450 pub struct UndeployProcessorVersion(
1451 RequestBuilder<crate::model::UndeployProcessorVersionRequest>,
1452 );
1453
1454 impl UndeployProcessorVersion {
1455 pub(crate) fn new(
1456 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1457 ) -> Self {
1458 Self(RequestBuilder::new(stub))
1459 }
1460
1461 pub fn with_request<V: Into<crate::model::UndeployProcessorVersionRequest>>(
1463 mut self,
1464 v: V,
1465 ) -> Self {
1466 self.0.request = v.into();
1467 self
1468 }
1469
1470 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1472 self.0.options = v.into();
1473 self
1474 }
1475
1476 pub async fn send(self) -> Result<longrunning::model::Operation> {
1483 (*self.0.stub)
1484 .undeploy_processor_version(self.0.request, self.0.options)
1485 .await
1486 .map(gax::response::Response::into_body)
1487 }
1488
1489 pub fn poller(
1491 self,
1492 ) -> impl lro::Poller<
1493 crate::model::UndeployProcessorVersionResponse,
1494 crate::model::UndeployProcessorVersionMetadata,
1495 > {
1496 type Operation = lro::internal::Operation<
1497 crate::model::UndeployProcessorVersionResponse,
1498 crate::model::UndeployProcessorVersionMetadata,
1499 >;
1500 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1501 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1502
1503 let stub = self.0.stub.clone();
1504 let mut options = self.0.options.clone();
1505 options.set_retry_policy(gax::retry_policy::NeverRetry);
1506 let query = move |name| {
1507 let stub = stub.clone();
1508 let options = options.clone();
1509 async {
1510 let op = GetOperation::new(stub)
1511 .set_name(name)
1512 .with_options(options)
1513 .send()
1514 .await?;
1515 Ok(Operation::new(op))
1516 }
1517 };
1518
1519 let start = move || async {
1520 let op = self.send().await?;
1521 Ok(Operation::new(op))
1522 };
1523
1524 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1525 }
1526
1527 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1531 self.0.request.name = v.into();
1532 self
1533 }
1534 }
1535
1536 #[doc(hidden)]
1537 impl gax::options::internal::RequestBuilder for UndeployProcessorVersion {
1538 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1539 &mut self.0.options
1540 }
1541 }
1542
1543 #[derive(Clone, Debug)]
1560 pub struct CreateProcessor(RequestBuilder<crate::model::CreateProcessorRequest>);
1561
1562 impl CreateProcessor {
1563 pub(crate) fn new(
1564 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1565 ) -> Self {
1566 Self(RequestBuilder::new(stub))
1567 }
1568
1569 pub fn with_request<V: Into<crate::model::CreateProcessorRequest>>(mut self, v: V) -> Self {
1571 self.0.request = v.into();
1572 self
1573 }
1574
1575 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1577 self.0.options = v.into();
1578 self
1579 }
1580
1581 pub async fn send(self) -> Result<crate::model::Processor> {
1583 (*self.0.stub)
1584 .create_processor(self.0.request, self.0.options)
1585 .await
1586 .map(gax::response::Response::into_body)
1587 }
1588
1589 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1593 self.0.request.parent = v.into();
1594 self
1595 }
1596
1597 pub fn set_processor<T>(mut self, v: T) -> Self
1601 where
1602 T: std::convert::Into<crate::model::Processor>,
1603 {
1604 self.0.request.processor = std::option::Option::Some(v.into());
1605 self
1606 }
1607
1608 pub fn set_or_clear_processor<T>(mut self, v: std::option::Option<T>) -> Self
1612 where
1613 T: std::convert::Into<crate::model::Processor>,
1614 {
1615 self.0.request.processor = v.map(|x| x.into());
1616 self
1617 }
1618 }
1619
1620 #[doc(hidden)]
1621 impl gax::options::internal::RequestBuilder for CreateProcessor {
1622 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1623 &mut self.0.options
1624 }
1625 }
1626
1627 #[derive(Clone, Debug)]
1645 pub struct DeleteProcessor(RequestBuilder<crate::model::DeleteProcessorRequest>);
1646
1647 impl DeleteProcessor {
1648 pub(crate) fn new(
1649 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1650 ) -> Self {
1651 Self(RequestBuilder::new(stub))
1652 }
1653
1654 pub fn with_request<V: Into<crate::model::DeleteProcessorRequest>>(mut self, v: V) -> Self {
1656 self.0.request = v.into();
1657 self
1658 }
1659
1660 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1662 self.0.options = v.into();
1663 self
1664 }
1665
1666 pub async fn send(self) -> Result<longrunning::model::Operation> {
1673 (*self.0.stub)
1674 .delete_processor(self.0.request, self.0.options)
1675 .await
1676 .map(gax::response::Response::into_body)
1677 }
1678
1679 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteProcessorMetadata> {
1681 type Operation =
1682 lro::internal::Operation<wkt::Empty, crate::model::DeleteProcessorMetadata>;
1683 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1684 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1685
1686 let stub = self.0.stub.clone();
1687 let mut options = self.0.options.clone();
1688 options.set_retry_policy(gax::retry_policy::NeverRetry);
1689 let query = move |name| {
1690 let stub = stub.clone();
1691 let options = options.clone();
1692 async {
1693 let op = GetOperation::new(stub)
1694 .set_name(name)
1695 .with_options(options)
1696 .send()
1697 .await?;
1698 Ok(Operation::new(op))
1699 }
1700 };
1701
1702 let start = move || async {
1703 let op = self.send().await?;
1704 Ok(Operation::new(op))
1705 };
1706
1707 lro::internal::new_unit_response_poller(
1708 polling_error_policy,
1709 polling_backoff_policy,
1710 start,
1711 query,
1712 )
1713 }
1714
1715 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1719 self.0.request.name = v.into();
1720 self
1721 }
1722 }
1723
1724 #[doc(hidden)]
1725 impl gax::options::internal::RequestBuilder for DeleteProcessor {
1726 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1727 &mut self.0.options
1728 }
1729 }
1730
1731 #[derive(Clone, Debug)]
1749 pub struct EnableProcessor(RequestBuilder<crate::model::EnableProcessorRequest>);
1750
1751 impl EnableProcessor {
1752 pub(crate) fn new(
1753 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1754 ) -> Self {
1755 Self(RequestBuilder::new(stub))
1756 }
1757
1758 pub fn with_request<V: Into<crate::model::EnableProcessorRequest>>(mut self, v: V) -> Self {
1760 self.0.request = v.into();
1761 self
1762 }
1763
1764 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1766 self.0.options = v.into();
1767 self
1768 }
1769
1770 pub async fn send(self) -> Result<longrunning::model::Operation> {
1777 (*self.0.stub)
1778 .enable_processor(self.0.request, self.0.options)
1779 .await
1780 .map(gax::response::Response::into_body)
1781 }
1782
1783 pub fn poller(
1785 self,
1786 ) -> impl lro::Poller<crate::model::EnableProcessorResponse, crate::model::EnableProcessorMetadata>
1787 {
1788 type Operation = lro::internal::Operation<
1789 crate::model::EnableProcessorResponse,
1790 crate::model::EnableProcessorMetadata,
1791 >;
1792 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1793 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1794
1795 let stub = self.0.stub.clone();
1796 let mut options = self.0.options.clone();
1797 options.set_retry_policy(gax::retry_policy::NeverRetry);
1798 let query = move |name| {
1799 let stub = stub.clone();
1800 let options = options.clone();
1801 async {
1802 let op = GetOperation::new(stub)
1803 .set_name(name)
1804 .with_options(options)
1805 .send()
1806 .await?;
1807 Ok(Operation::new(op))
1808 }
1809 };
1810
1811 let start = move || async {
1812 let op = self.send().await?;
1813 Ok(Operation::new(op))
1814 };
1815
1816 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1817 }
1818
1819 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1823 self.0.request.name = v.into();
1824 self
1825 }
1826 }
1827
1828 #[doc(hidden)]
1829 impl gax::options::internal::RequestBuilder for EnableProcessor {
1830 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1831 &mut self.0.options
1832 }
1833 }
1834
1835 #[derive(Clone, Debug)]
1853 pub struct DisableProcessor(RequestBuilder<crate::model::DisableProcessorRequest>);
1854
1855 impl DisableProcessor {
1856 pub(crate) fn new(
1857 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1858 ) -> Self {
1859 Self(RequestBuilder::new(stub))
1860 }
1861
1862 pub fn with_request<V: Into<crate::model::DisableProcessorRequest>>(
1864 mut self,
1865 v: V,
1866 ) -> Self {
1867 self.0.request = v.into();
1868 self
1869 }
1870
1871 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1873 self.0.options = v.into();
1874 self
1875 }
1876
1877 pub async fn send(self) -> Result<longrunning::model::Operation> {
1884 (*self.0.stub)
1885 .disable_processor(self.0.request, self.0.options)
1886 .await
1887 .map(gax::response::Response::into_body)
1888 }
1889
1890 pub fn poller(
1892 self,
1893 ) -> impl lro::Poller<
1894 crate::model::DisableProcessorResponse,
1895 crate::model::DisableProcessorMetadata,
1896 > {
1897 type Operation = lro::internal::Operation<
1898 crate::model::DisableProcessorResponse,
1899 crate::model::DisableProcessorMetadata,
1900 >;
1901 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1902 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1903
1904 let stub = self.0.stub.clone();
1905 let mut options = self.0.options.clone();
1906 options.set_retry_policy(gax::retry_policy::NeverRetry);
1907 let query = move |name| {
1908 let stub = stub.clone();
1909 let options = options.clone();
1910 async {
1911 let op = GetOperation::new(stub)
1912 .set_name(name)
1913 .with_options(options)
1914 .send()
1915 .await?;
1916 Ok(Operation::new(op))
1917 }
1918 };
1919
1920 let start = move || async {
1921 let op = self.send().await?;
1922 Ok(Operation::new(op))
1923 };
1924
1925 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1926 }
1927
1928 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1932 self.0.request.name = v.into();
1933 self
1934 }
1935 }
1936
1937 #[doc(hidden)]
1938 impl gax::options::internal::RequestBuilder for DisableProcessor {
1939 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1940 &mut self.0.options
1941 }
1942 }
1943
1944 #[derive(Clone, Debug)]
1962 pub struct SetDefaultProcessorVersion(
1963 RequestBuilder<crate::model::SetDefaultProcessorVersionRequest>,
1964 );
1965
1966 impl SetDefaultProcessorVersion {
1967 pub(crate) fn new(
1968 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
1969 ) -> Self {
1970 Self(RequestBuilder::new(stub))
1971 }
1972
1973 pub fn with_request<V: Into<crate::model::SetDefaultProcessorVersionRequest>>(
1975 mut self,
1976 v: V,
1977 ) -> Self {
1978 self.0.request = v.into();
1979 self
1980 }
1981
1982 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1984 self.0.options = v.into();
1985 self
1986 }
1987
1988 pub async fn send(self) -> Result<longrunning::model::Operation> {
1995 (*self.0.stub)
1996 .set_default_processor_version(self.0.request, self.0.options)
1997 .await
1998 .map(gax::response::Response::into_body)
1999 }
2000
2001 pub fn poller(
2003 self,
2004 ) -> impl lro::Poller<
2005 crate::model::SetDefaultProcessorVersionResponse,
2006 crate::model::SetDefaultProcessorVersionMetadata,
2007 > {
2008 type Operation = lro::internal::Operation<
2009 crate::model::SetDefaultProcessorVersionResponse,
2010 crate::model::SetDefaultProcessorVersionMetadata,
2011 >;
2012 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2013 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2014
2015 let stub = self.0.stub.clone();
2016 let mut options = self.0.options.clone();
2017 options.set_retry_policy(gax::retry_policy::NeverRetry);
2018 let query = move |name| {
2019 let stub = stub.clone();
2020 let options = options.clone();
2021 async {
2022 let op = GetOperation::new(stub)
2023 .set_name(name)
2024 .with_options(options)
2025 .send()
2026 .await?;
2027 Ok(Operation::new(op))
2028 }
2029 };
2030
2031 let start = move || async {
2032 let op = self.send().await?;
2033 Ok(Operation::new(op))
2034 };
2035
2036 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2037 }
2038
2039 pub fn set_processor<T: Into<std::string::String>>(mut self, v: T) -> Self {
2043 self.0.request.processor = v.into();
2044 self
2045 }
2046
2047 pub fn set_default_processor_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
2051 self.0.request.default_processor_version = v.into();
2052 self
2053 }
2054 }
2055
2056 #[doc(hidden)]
2057 impl gax::options::internal::RequestBuilder for SetDefaultProcessorVersion {
2058 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2059 &mut self.0.options
2060 }
2061 }
2062
2063 #[derive(Clone, Debug)]
2081 pub struct ReviewDocument(RequestBuilder<crate::model::ReviewDocumentRequest>);
2082
2083 impl ReviewDocument {
2084 pub(crate) fn new(
2085 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2086 ) -> Self {
2087 Self(RequestBuilder::new(stub))
2088 }
2089
2090 pub fn with_request<V: Into<crate::model::ReviewDocumentRequest>>(mut self, v: V) -> Self {
2092 self.0.request = v.into();
2093 self
2094 }
2095
2096 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2098 self.0.options = v.into();
2099 self
2100 }
2101
2102 pub async fn send(self) -> Result<longrunning::model::Operation> {
2109 (*self.0.stub)
2110 .review_document(self.0.request, self.0.options)
2111 .await
2112 .map(gax::response::Response::into_body)
2113 }
2114
2115 pub fn poller(
2117 self,
2118 ) -> impl lro::Poller<
2119 crate::model::ReviewDocumentResponse,
2120 crate::model::ReviewDocumentOperationMetadata,
2121 > {
2122 type Operation = lro::internal::Operation<
2123 crate::model::ReviewDocumentResponse,
2124 crate::model::ReviewDocumentOperationMetadata,
2125 >;
2126 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2127 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2128
2129 let stub = self.0.stub.clone();
2130 let mut options = self.0.options.clone();
2131 options.set_retry_policy(gax::retry_policy::NeverRetry);
2132 let query = move |name| {
2133 let stub = stub.clone();
2134 let options = options.clone();
2135 async {
2136 let op = GetOperation::new(stub)
2137 .set_name(name)
2138 .with_options(options)
2139 .send()
2140 .await?;
2141 Ok(Operation::new(op))
2142 }
2143 };
2144
2145 let start = move || async {
2146 let op = self.send().await?;
2147 Ok(Operation::new(op))
2148 };
2149
2150 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2151 }
2152
2153 pub fn set_human_review_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2157 self.0.request.human_review_config = v.into();
2158 self
2159 }
2160
2161 pub fn set_enable_schema_validation<T: Into<bool>>(mut self, v: T) -> Self {
2163 self.0.request.enable_schema_validation = v.into();
2164 self
2165 }
2166
2167 pub fn set_priority<T: Into<crate::model::review_document_request::Priority>>(
2169 mut self,
2170 v: T,
2171 ) -> Self {
2172 self.0.request.priority = v.into();
2173 self
2174 }
2175
2176 pub fn set_document_schema<T>(mut self, v: T) -> Self
2178 where
2179 T: std::convert::Into<crate::model::DocumentSchema>,
2180 {
2181 self.0.request.document_schema = std::option::Option::Some(v.into());
2182 self
2183 }
2184
2185 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
2187 where
2188 T: std::convert::Into<crate::model::DocumentSchema>,
2189 {
2190 self.0.request.document_schema = v.map(|x| x.into());
2191 self
2192 }
2193
2194 pub fn set_source<T: Into<Option<crate::model::review_document_request::Source>>>(
2199 mut self,
2200 v: T,
2201 ) -> Self {
2202 self.0.request.source = v.into();
2203 self
2204 }
2205
2206 pub fn set_inline_document<
2212 T: std::convert::Into<std::boxed::Box<crate::model::Document>>,
2213 >(
2214 mut self,
2215 v: T,
2216 ) -> Self {
2217 self.0.request = self.0.request.set_inline_document(v);
2218 self
2219 }
2220 }
2221
2222 #[doc(hidden)]
2223 impl gax::options::internal::RequestBuilder for ReviewDocument {
2224 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2225 &mut self.0.options
2226 }
2227 }
2228
2229 #[derive(Clone, Debug)]
2247 pub struct EvaluateProcessorVersion(
2248 RequestBuilder<crate::model::EvaluateProcessorVersionRequest>,
2249 );
2250
2251 impl EvaluateProcessorVersion {
2252 pub(crate) fn new(
2253 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2254 ) -> Self {
2255 Self(RequestBuilder::new(stub))
2256 }
2257
2258 pub fn with_request<V: Into<crate::model::EvaluateProcessorVersionRequest>>(
2260 mut self,
2261 v: V,
2262 ) -> Self {
2263 self.0.request = v.into();
2264 self
2265 }
2266
2267 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2269 self.0.options = v.into();
2270 self
2271 }
2272
2273 pub async fn send(self) -> Result<longrunning::model::Operation> {
2280 (*self.0.stub)
2281 .evaluate_processor_version(self.0.request, self.0.options)
2282 .await
2283 .map(gax::response::Response::into_body)
2284 }
2285
2286 pub fn poller(
2288 self,
2289 ) -> impl lro::Poller<
2290 crate::model::EvaluateProcessorVersionResponse,
2291 crate::model::EvaluateProcessorVersionMetadata,
2292 > {
2293 type Operation = lro::internal::Operation<
2294 crate::model::EvaluateProcessorVersionResponse,
2295 crate::model::EvaluateProcessorVersionMetadata,
2296 >;
2297 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2298 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2299
2300 let stub = self.0.stub.clone();
2301 let mut options = self.0.options.clone();
2302 options.set_retry_policy(gax::retry_policy::NeverRetry);
2303 let query = move |name| {
2304 let stub = stub.clone();
2305 let options = options.clone();
2306 async {
2307 let op = GetOperation::new(stub)
2308 .set_name(name)
2309 .with_options(options)
2310 .send()
2311 .await?;
2312 Ok(Operation::new(op))
2313 }
2314 };
2315
2316 let start = move || async {
2317 let op = self.send().await?;
2318 Ok(Operation::new(op))
2319 };
2320
2321 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2322 }
2323
2324 pub fn set_processor_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
2328 self.0.request.processor_version = v.into();
2329 self
2330 }
2331
2332 pub fn set_evaluation_documents<T>(mut self, v: T) -> Self
2334 where
2335 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
2336 {
2337 self.0.request.evaluation_documents = std::option::Option::Some(v.into());
2338 self
2339 }
2340
2341 pub fn set_or_clear_evaluation_documents<T>(mut self, v: std::option::Option<T>) -> Self
2343 where
2344 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
2345 {
2346 self.0.request.evaluation_documents = v.map(|x| x.into());
2347 self
2348 }
2349 }
2350
2351 #[doc(hidden)]
2352 impl gax::options::internal::RequestBuilder for EvaluateProcessorVersion {
2353 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2354 &mut self.0.options
2355 }
2356 }
2357
2358 #[derive(Clone, Debug)]
2375 pub struct GetEvaluation(RequestBuilder<crate::model::GetEvaluationRequest>);
2376
2377 impl GetEvaluation {
2378 pub(crate) fn new(
2379 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2380 ) -> Self {
2381 Self(RequestBuilder::new(stub))
2382 }
2383
2384 pub fn with_request<V: Into<crate::model::GetEvaluationRequest>>(mut self, v: V) -> Self {
2386 self.0.request = v.into();
2387 self
2388 }
2389
2390 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2392 self.0.options = v.into();
2393 self
2394 }
2395
2396 pub async fn send(self) -> Result<crate::model::Evaluation> {
2398 (*self.0.stub)
2399 .get_evaluation(self.0.request, self.0.options)
2400 .await
2401 .map(gax::response::Response::into_body)
2402 }
2403
2404 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2408 self.0.request.name = v.into();
2409 self
2410 }
2411 }
2412
2413 #[doc(hidden)]
2414 impl gax::options::internal::RequestBuilder for GetEvaluation {
2415 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2416 &mut self.0.options
2417 }
2418 }
2419
2420 #[derive(Clone, Debug)]
2441 pub struct ListEvaluations(RequestBuilder<crate::model::ListEvaluationsRequest>);
2442
2443 impl ListEvaluations {
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::ListEvaluationsRequest>>(mut self, v: V) -> Self {
2452 self.0.request = v.into();
2453 self
2454 }
2455
2456 pub fn with_options<V: Into<gax::options::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::ListEvaluationsResponse> {
2464 (*self.0.stub)
2465 .list_evaluations(self.0.request, self.0.options)
2466 .await
2467 .map(gax::response::Response::into_body)
2468 }
2469
2470 pub fn by_page(
2472 self,
2473 ) -> impl gax::paginator::Paginator<crate::model::ListEvaluationsResponse, gax::error::Error>
2474 {
2475 use std::clone::Clone;
2476 let token = self.0.request.page_token.clone();
2477 let execute = move |token: String| {
2478 let mut builder = self.clone();
2479 builder.0.request = builder.0.request.set_page_token(token);
2480 builder.send()
2481 };
2482 gax::paginator::internal::new_paginator(token, execute)
2483 }
2484
2485 pub fn by_item(
2487 self,
2488 ) -> impl gax::paginator::ItemPaginator<crate::model::ListEvaluationsResponse, gax::error::Error>
2489 {
2490 use gax::paginator::Paginator;
2491 self.by_page().items()
2492 }
2493
2494 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2498 self.0.request.parent = v.into();
2499 self
2500 }
2501
2502 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2504 self.0.request.page_size = v.into();
2505 self
2506 }
2507
2508 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2510 self.0.request.page_token = v.into();
2511 self
2512 }
2513 }
2514
2515 #[doc(hidden)]
2516 impl gax::options::internal::RequestBuilder for ListEvaluations {
2517 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2518 &mut self.0.options
2519 }
2520 }
2521
2522 #[derive(Clone, Debug)]
2543 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
2544
2545 impl ListLocations {
2546 pub(crate) fn new(
2547 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2548 ) -> Self {
2549 Self(RequestBuilder::new(stub))
2550 }
2551
2552 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
2554 mut self,
2555 v: V,
2556 ) -> Self {
2557 self.0.request = v.into();
2558 self
2559 }
2560
2561 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2563 self.0.options = v.into();
2564 self
2565 }
2566
2567 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
2569 (*self.0.stub)
2570 .list_locations(self.0.request, self.0.options)
2571 .await
2572 .map(gax::response::Response::into_body)
2573 }
2574
2575 pub fn by_page(
2577 self,
2578 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
2579 {
2580 use std::clone::Clone;
2581 let token = self.0.request.page_token.clone();
2582 let execute = move |token: String| {
2583 let mut builder = self.clone();
2584 builder.0.request = builder.0.request.set_page_token(token);
2585 builder.send()
2586 };
2587 gax::paginator::internal::new_paginator(token, execute)
2588 }
2589
2590 pub fn by_item(
2592 self,
2593 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
2594 {
2595 use gax::paginator::Paginator;
2596 self.by_page().items()
2597 }
2598
2599 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2601 self.0.request.name = v.into();
2602 self
2603 }
2604
2605 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2607 self.0.request.filter = v.into();
2608 self
2609 }
2610
2611 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2613 self.0.request.page_size = v.into();
2614 self
2615 }
2616
2617 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2619 self.0.request.page_token = v.into();
2620 self
2621 }
2622 }
2623
2624 #[doc(hidden)]
2625 impl gax::options::internal::RequestBuilder for ListLocations {
2626 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2627 &mut self.0.options
2628 }
2629 }
2630
2631 #[derive(Clone, Debug)]
2648 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
2649
2650 impl GetLocation {
2651 pub(crate) fn new(
2652 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2653 ) -> Self {
2654 Self(RequestBuilder::new(stub))
2655 }
2656
2657 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
2659 self.0.request = v.into();
2660 self
2661 }
2662
2663 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2665 self.0.options = v.into();
2666 self
2667 }
2668
2669 pub async fn send(self) -> Result<location::model::Location> {
2671 (*self.0.stub)
2672 .get_location(self.0.request, self.0.options)
2673 .await
2674 .map(gax::response::Response::into_body)
2675 }
2676
2677 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2679 self.0.request.name = v.into();
2680 self
2681 }
2682 }
2683
2684 #[doc(hidden)]
2685 impl gax::options::internal::RequestBuilder for GetLocation {
2686 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2687 &mut self.0.options
2688 }
2689 }
2690
2691 #[derive(Clone, Debug)]
2712 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2713
2714 impl ListOperations {
2715 pub(crate) fn new(
2716 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2717 ) -> Self {
2718 Self(RequestBuilder::new(stub))
2719 }
2720
2721 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2723 mut self,
2724 v: V,
2725 ) -> Self {
2726 self.0.request = v.into();
2727 self
2728 }
2729
2730 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2732 self.0.options = v.into();
2733 self
2734 }
2735
2736 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2738 (*self.0.stub)
2739 .list_operations(self.0.request, self.0.options)
2740 .await
2741 .map(gax::response::Response::into_body)
2742 }
2743
2744 pub fn by_page(
2746 self,
2747 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2748 {
2749 use std::clone::Clone;
2750 let token = self.0.request.page_token.clone();
2751 let execute = move |token: String| {
2752 let mut builder = self.clone();
2753 builder.0.request = builder.0.request.set_page_token(token);
2754 builder.send()
2755 };
2756 gax::paginator::internal::new_paginator(token, execute)
2757 }
2758
2759 pub fn by_item(
2761 self,
2762 ) -> impl gax::paginator::ItemPaginator<
2763 longrunning::model::ListOperationsResponse,
2764 gax::error::Error,
2765 > {
2766 use gax::paginator::Paginator;
2767 self.by_page().items()
2768 }
2769
2770 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2772 self.0.request.name = v.into();
2773 self
2774 }
2775
2776 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2778 self.0.request.filter = v.into();
2779 self
2780 }
2781
2782 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2784 self.0.request.page_size = v.into();
2785 self
2786 }
2787
2788 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2790 self.0.request.page_token = v.into();
2791 self
2792 }
2793
2794 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2796 self.0.request.return_partial_success = v.into();
2797 self
2798 }
2799 }
2800
2801 #[doc(hidden)]
2802 impl gax::options::internal::RequestBuilder for ListOperations {
2803 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2804 &mut self.0.options
2805 }
2806 }
2807
2808 #[derive(Clone, Debug)]
2825 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2826
2827 impl GetOperation {
2828 pub(crate) fn new(
2829 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2830 ) -> Self {
2831 Self(RequestBuilder::new(stub))
2832 }
2833
2834 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2836 mut self,
2837 v: V,
2838 ) -> Self {
2839 self.0.request = v.into();
2840 self
2841 }
2842
2843 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2845 self.0.options = v.into();
2846 self
2847 }
2848
2849 pub async fn send(self) -> Result<longrunning::model::Operation> {
2851 (*self.0.stub)
2852 .get_operation(self.0.request, self.0.options)
2853 .await
2854 .map(gax::response::Response::into_body)
2855 }
2856
2857 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2859 self.0.request.name = v.into();
2860 self
2861 }
2862 }
2863
2864 #[doc(hidden)]
2865 impl gax::options::internal::RequestBuilder for GetOperation {
2866 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2867 &mut self.0.options
2868 }
2869 }
2870
2871 #[derive(Clone, Debug)]
2888 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2889
2890 impl CancelOperation {
2891 pub(crate) fn new(
2892 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentProcessorService>,
2893 ) -> Self {
2894 Self(RequestBuilder::new(stub))
2895 }
2896
2897 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2899 mut self,
2900 v: V,
2901 ) -> Self {
2902 self.0.request = v.into();
2903 self
2904 }
2905
2906 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2908 self.0.options = v.into();
2909 self
2910 }
2911
2912 pub async fn send(self) -> Result<()> {
2914 (*self.0.stub)
2915 .cancel_operation(self.0.request, self.0.options)
2916 .await
2917 .map(gax::response::Response::into_body)
2918 }
2919
2920 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2922 self.0.request.name = v.into();
2923 self
2924 }
2925 }
2926
2927 #[doc(hidden)]
2928 impl gax::options::internal::RequestBuilder for CancelOperation {
2929 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2930 &mut self.0.options
2931 }
2932 }
2933}