1pub mod analytics_service {
18 use crate::Result;
19
20 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
34
35 pub(crate) mod client {
36 use super::super::super::client::AnalyticsService;
37 pub struct Factory;
38 impl crate::ClientFactory for Factory {
39 type Client = AnalyticsService;
40 type Credentials = gaxi::options::Credentials;
41 async fn build(
42 self,
43 config: gaxi::options::ClientConfig,
44 ) -> crate::ClientBuilderResult<Self::Client> {
45 Self::Client::new(config).await
46 }
47 }
48 }
49
50 #[derive(Clone, Debug)]
52 pub(crate) struct RequestBuilder<R: std::default::Default> {
53 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
54 request: R,
55 options: crate::RequestOptions,
56 }
57
58 impl<R> RequestBuilder<R>
59 where
60 R: std::default::Default,
61 {
62 pub(crate) fn new(
63 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
64 ) -> Self {
65 Self {
66 stub,
67 request: R::default(),
68 options: crate::RequestOptions::default(),
69 }
70 }
71 }
72
73 #[derive(Clone, Debug)]
91 pub struct ExportAnalyticsMetrics(RequestBuilder<crate::model::ExportAnalyticsMetricsRequest>);
92
93 impl ExportAnalyticsMetrics {
94 pub(crate) fn new(
95 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
96 ) -> Self {
97 Self(RequestBuilder::new(stub))
98 }
99
100 pub fn with_request<V: Into<crate::model::ExportAnalyticsMetricsRequest>>(
102 mut self,
103 v: V,
104 ) -> Self {
105 self.0.request = v.into();
106 self
107 }
108
109 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
111 self.0.options = v.into();
112 self
113 }
114
115 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
122 (*self.0.stub)
123 .export_analytics_metrics(self.0.request, self.0.options)
124 .await
125 .map(crate::Response::into_body)
126 }
127
128 pub fn poller(
130 self,
131 ) -> impl google_cloud_lro::Poller<
132 crate::model::ExportAnalyticsMetricsResponse,
133 crate::model::ExportMetadata,
134 > {
135 type Operation = google_cloud_lro::internal::Operation<
136 crate::model::ExportAnalyticsMetricsResponse,
137 crate::model::ExportMetadata,
138 >;
139 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
140 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
141
142 let stub = self.0.stub.clone();
143 let mut options = self.0.options.clone();
144 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
145 let query = move |name| {
146 let stub = stub.clone();
147 let options = options.clone();
148 async {
149 let op = GetOperation::new(stub)
150 .set_name(name)
151 .with_options(options)
152 .send()
153 .await?;
154 Ok(Operation::new(op))
155 }
156 };
157
158 let start = move || async {
159 let op = self.send().await?;
160 Ok(Operation::new(op))
161 };
162
163 google_cloud_lro::internal::new_poller(
164 polling_error_policy,
165 polling_backoff_policy,
166 start,
167 query,
168 )
169 }
170
171 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
175 self.0.request.catalog = v.into();
176 self
177 }
178
179 pub fn set_output_config<T>(mut self, v: T) -> Self
183 where
184 T: std::convert::Into<crate::model::OutputConfig>,
185 {
186 self.0.request.output_config = std::option::Option::Some(v.into());
187 self
188 }
189
190 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
194 where
195 T: std::convert::Into<crate::model::OutputConfig>,
196 {
197 self.0.request.output_config = v.map(|x| x.into());
198 self
199 }
200
201 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
203 self.0.request.filter = v.into();
204 self
205 }
206 }
207
208 #[doc(hidden)]
209 impl crate::RequestBuilder for ExportAnalyticsMetrics {
210 fn request_options(&mut self) -> &mut crate::RequestOptions {
211 &mut self.0.options
212 }
213 }
214
215 #[derive(Clone, Debug)]
236 pub struct ListOperations(
237 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
238 );
239
240 impl ListOperations {
241 pub(crate) fn new(
242 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
243 ) -> Self {
244 Self(RequestBuilder::new(stub))
245 }
246
247 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
249 mut self,
250 v: V,
251 ) -> Self {
252 self.0.request = v.into();
253 self
254 }
255
256 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
258 self.0.options = v.into();
259 self
260 }
261
262 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
264 (*self.0.stub)
265 .list_operations(self.0.request, self.0.options)
266 .await
267 .map(crate::Response::into_body)
268 }
269
270 pub fn by_page(
272 self,
273 ) -> impl google_cloud_gax::paginator::Paginator<
274 google_cloud_longrunning::model::ListOperationsResponse,
275 crate::Error,
276 > {
277 use std::clone::Clone;
278 let token = self.0.request.page_token.clone();
279 let execute = move |token: String| {
280 let mut builder = self.clone();
281 builder.0.request = builder.0.request.set_page_token(token);
282 builder.send()
283 };
284 google_cloud_gax::paginator::internal::new_paginator(token, execute)
285 }
286
287 pub fn by_item(
289 self,
290 ) -> impl google_cloud_gax::paginator::ItemPaginator<
291 google_cloud_longrunning::model::ListOperationsResponse,
292 crate::Error,
293 > {
294 use google_cloud_gax::paginator::Paginator;
295 self.by_page().items()
296 }
297
298 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
300 self.0.request.name = v.into();
301 self
302 }
303
304 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
306 self.0.request.filter = v.into();
307 self
308 }
309
310 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
312 self.0.request.page_size = v.into();
313 self
314 }
315
316 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
318 self.0.request.page_token = v.into();
319 self
320 }
321
322 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
324 self.0.request.return_partial_success = v.into();
325 self
326 }
327 }
328
329 #[doc(hidden)]
330 impl crate::RequestBuilder for ListOperations {
331 fn request_options(&mut self) -> &mut crate::RequestOptions {
332 &mut self.0.options
333 }
334 }
335
336 #[derive(Clone, Debug)]
353 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
354
355 impl GetOperation {
356 pub(crate) fn new(
357 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
358 ) -> Self {
359 Self(RequestBuilder::new(stub))
360 }
361
362 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
364 mut self,
365 v: V,
366 ) -> Self {
367 self.0.request = v.into();
368 self
369 }
370
371 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
373 self.0.options = v.into();
374 self
375 }
376
377 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
379 (*self.0.stub)
380 .get_operation(self.0.request, self.0.options)
381 .await
382 .map(crate::Response::into_body)
383 }
384
385 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
387 self.0.request.name = v.into();
388 self
389 }
390 }
391
392 #[doc(hidden)]
393 impl crate::RequestBuilder for GetOperation {
394 fn request_options(&mut self) -> &mut crate::RequestOptions {
395 &mut self.0.options
396 }
397 }
398}
399
400pub mod catalog_service {
401 use crate::Result;
402
403 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
417
418 pub(crate) mod client {
419 use super::super::super::client::CatalogService;
420 pub struct Factory;
421 impl crate::ClientFactory for Factory {
422 type Client = CatalogService;
423 type Credentials = gaxi::options::Credentials;
424 async fn build(
425 self,
426 config: gaxi::options::ClientConfig,
427 ) -> crate::ClientBuilderResult<Self::Client> {
428 Self::Client::new(config).await
429 }
430 }
431 }
432
433 #[derive(Clone, Debug)]
435 pub(crate) struct RequestBuilder<R: std::default::Default> {
436 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
437 request: R,
438 options: crate::RequestOptions,
439 }
440
441 impl<R> RequestBuilder<R>
442 where
443 R: std::default::Default,
444 {
445 pub(crate) fn new(
446 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
447 ) -> Self {
448 Self {
449 stub,
450 request: R::default(),
451 options: crate::RequestOptions::default(),
452 }
453 }
454 }
455
456 #[derive(Clone, Debug)]
477 pub struct ListCatalogs(RequestBuilder<crate::model::ListCatalogsRequest>);
478
479 impl ListCatalogs {
480 pub(crate) fn new(
481 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
482 ) -> Self {
483 Self(RequestBuilder::new(stub))
484 }
485
486 pub fn with_request<V: Into<crate::model::ListCatalogsRequest>>(mut self, v: V) -> Self {
488 self.0.request = v.into();
489 self
490 }
491
492 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
494 self.0.options = v.into();
495 self
496 }
497
498 pub async fn send(self) -> Result<crate::model::ListCatalogsResponse> {
500 (*self.0.stub)
501 .list_catalogs(self.0.request, self.0.options)
502 .await
503 .map(crate::Response::into_body)
504 }
505
506 pub fn by_page(
508 self,
509 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListCatalogsResponse, crate::Error>
510 {
511 use std::clone::Clone;
512 let token = self.0.request.page_token.clone();
513 let execute = move |token: String| {
514 let mut builder = self.clone();
515 builder.0.request = builder.0.request.set_page_token(token);
516 builder.send()
517 };
518 google_cloud_gax::paginator::internal::new_paginator(token, execute)
519 }
520
521 pub fn by_item(
523 self,
524 ) -> impl google_cloud_gax::paginator::ItemPaginator<
525 crate::model::ListCatalogsResponse,
526 crate::Error,
527 > {
528 use google_cloud_gax::paginator::Paginator;
529 self.by_page().items()
530 }
531
532 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
536 self.0.request.parent = v.into();
537 self
538 }
539
540 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
542 self.0.request.page_size = v.into();
543 self
544 }
545
546 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
548 self.0.request.page_token = v.into();
549 self
550 }
551 }
552
553 #[doc(hidden)]
554 impl crate::RequestBuilder for ListCatalogs {
555 fn request_options(&mut self) -> &mut crate::RequestOptions {
556 &mut self.0.options
557 }
558 }
559
560 #[derive(Clone, Debug)]
577 pub struct UpdateCatalog(RequestBuilder<crate::model::UpdateCatalogRequest>);
578
579 impl UpdateCatalog {
580 pub(crate) fn new(
581 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
582 ) -> Self {
583 Self(RequestBuilder::new(stub))
584 }
585
586 pub fn with_request<V: Into<crate::model::UpdateCatalogRequest>>(mut self, v: V) -> Self {
588 self.0.request = v.into();
589 self
590 }
591
592 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
594 self.0.options = v.into();
595 self
596 }
597
598 pub async fn send(self) -> Result<crate::model::Catalog> {
600 (*self.0.stub)
601 .update_catalog(self.0.request, self.0.options)
602 .await
603 .map(crate::Response::into_body)
604 }
605
606 pub fn set_catalog<T>(mut self, v: T) -> Self
610 where
611 T: std::convert::Into<crate::model::Catalog>,
612 {
613 self.0.request.catalog = std::option::Option::Some(v.into());
614 self
615 }
616
617 pub fn set_or_clear_catalog<T>(mut self, v: std::option::Option<T>) -> Self
621 where
622 T: std::convert::Into<crate::model::Catalog>,
623 {
624 self.0.request.catalog = v.map(|x| x.into());
625 self
626 }
627
628 pub fn set_update_mask<T>(mut self, v: T) -> Self
630 where
631 T: std::convert::Into<wkt::FieldMask>,
632 {
633 self.0.request.update_mask = std::option::Option::Some(v.into());
634 self
635 }
636
637 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
639 where
640 T: std::convert::Into<wkt::FieldMask>,
641 {
642 self.0.request.update_mask = v.map(|x| x.into());
643 self
644 }
645 }
646
647 #[doc(hidden)]
648 impl crate::RequestBuilder for UpdateCatalog {
649 fn request_options(&mut self) -> &mut crate::RequestOptions {
650 &mut self.0.options
651 }
652 }
653
654 #[derive(Clone, Debug)]
671 pub struct SetDefaultBranch(RequestBuilder<crate::model::SetDefaultBranchRequest>);
672
673 impl SetDefaultBranch {
674 pub(crate) fn new(
675 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
676 ) -> Self {
677 Self(RequestBuilder::new(stub))
678 }
679
680 pub fn with_request<V: Into<crate::model::SetDefaultBranchRequest>>(
682 mut self,
683 v: V,
684 ) -> Self {
685 self.0.request = v.into();
686 self
687 }
688
689 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
691 self.0.options = v.into();
692 self
693 }
694
695 pub async fn send(self) -> Result<()> {
697 (*self.0.stub)
698 .set_default_branch(self.0.request, self.0.options)
699 .await
700 .map(crate::Response::into_body)
701 }
702
703 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
705 self.0.request.catalog = v.into();
706 self
707 }
708
709 pub fn set_branch_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
711 self.0.request.branch_id = v.into();
712 self
713 }
714
715 pub fn set_note<T: Into<std::string::String>>(mut self, v: T) -> Self {
717 self.0.request.note = v.into();
718 self
719 }
720
721 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
723 self.0.request.force = v.into();
724 self
725 }
726 }
727
728 #[doc(hidden)]
729 impl crate::RequestBuilder for SetDefaultBranch {
730 fn request_options(&mut self) -> &mut crate::RequestOptions {
731 &mut self.0.options
732 }
733 }
734
735 #[derive(Clone, Debug)]
752 pub struct GetDefaultBranch(RequestBuilder<crate::model::GetDefaultBranchRequest>);
753
754 impl GetDefaultBranch {
755 pub(crate) fn new(
756 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
757 ) -> Self {
758 Self(RequestBuilder::new(stub))
759 }
760
761 pub fn with_request<V: Into<crate::model::GetDefaultBranchRequest>>(
763 mut self,
764 v: V,
765 ) -> Self {
766 self.0.request = v.into();
767 self
768 }
769
770 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
772 self.0.options = v.into();
773 self
774 }
775
776 pub async fn send(self) -> Result<crate::model::GetDefaultBranchResponse> {
778 (*self.0.stub)
779 .get_default_branch(self.0.request, self.0.options)
780 .await
781 .map(crate::Response::into_body)
782 }
783
784 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
786 self.0.request.catalog = v.into();
787 self
788 }
789 }
790
791 #[doc(hidden)]
792 impl crate::RequestBuilder for GetDefaultBranch {
793 fn request_options(&mut self) -> &mut crate::RequestOptions {
794 &mut self.0.options
795 }
796 }
797
798 #[derive(Clone, Debug)]
815 pub struct GetCompletionConfig(RequestBuilder<crate::model::GetCompletionConfigRequest>);
816
817 impl GetCompletionConfig {
818 pub(crate) fn new(
819 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
820 ) -> Self {
821 Self(RequestBuilder::new(stub))
822 }
823
824 pub fn with_request<V: Into<crate::model::GetCompletionConfigRequest>>(
826 mut self,
827 v: V,
828 ) -> Self {
829 self.0.request = v.into();
830 self
831 }
832
833 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
835 self.0.options = v.into();
836 self
837 }
838
839 pub async fn send(self) -> Result<crate::model::CompletionConfig> {
841 (*self.0.stub)
842 .get_completion_config(self.0.request, self.0.options)
843 .await
844 .map(crate::Response::into_body)
845 }
846
847 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
851 self.0.request.name = v.into();
852 self
853 }
854 }
855
856 #[doc(hidden)]
857 impl crate::RequestBuilder for GetCompletionConfig {
858 fn request_options(&mut self) -> &mut crate::RequestOptions {
859 &mut self.0.options
860 }
861 }
862
863 #[derive(Clone, Debug)]
880 pub struct UpdateCompletionConfig(RequestBuilder<crate::model::UpdateCompletionConfigRequest>);
881
882 impl UpdateCompletionConfig {
883 pub(crate) fn new(
884 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
885 ) -> Self {
886 Self(RequestBuilder::new(stub))
887 }
888
889 pub fn with_request<V: Into<crate::model::UpdateCompletionConfigRequest>>(
891 mut self,
892 v: V,
893 ) -> Self {
894 self.0.request = v.into();
895 self
896 }
897
898 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
900 self.0.options = v.into();
901 self
902 }
903
904 pub async fn send(self) -> Result<crate::model::CompletionConfig> {
906 (*self.0.stub)
907 .update_completion_config(self.0.request, self.0.options)
908 .await
909 .map(crate::Response::into_body)
910 }
911
912 pub fn set_completion_config<T>(mut self, v: T) -> Self
916 where
917 T: std::convert::Into<crate::model::CompletionConfig>,
918 {
919 self.0.request.completion_config = std::option::Option::Some(v.into());
920 self
921 }
922
923 pub fn set_or_clear_completion_config<T>(mut self, v: std::option::Option<T>) -> Self
927 where
928 T: std::convert::Into<crate::model::CompletionConfig>,
929 {
930 self.0.request.completion_config = v.map(|x| x.into());
931 self
932 }
933
934 pub fn set_update_mask<T>(mut self, v: T) -> Self
936 where
937 T: std::convert::Into<wkt::FieldMask>,
938 {
939 self.0.request.update_mask = std::option::Option::Some(v.into());
940 self
941 }
942
943 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
945 where
946 T: std::convert::Into<wkt::FieldMask>,
947 {
948 self.0.request.update_mask = v.map(|x| x.into());
949 self
950 }
951 }
952
953 #[doc(hidden)]
954 impl crate::RequestBuilder for UpdateCompletionConfig {
955 fn request_options(&mut self) -> &mut crate::RequestOptions {
956 &mut self.0.options
957 }
958 }
959
960 #[derive(Clone, Debug)]
977 pub struct GetAttributesConfig(RequestBuilder<crate::model::GetAttributesConfigRequest>);
978
979 impl GetAttributesConfig {
980 pub(crate) fn new(
981 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
982 ) -> Self {
983 Self(RequestBuilder::new(stub))
984 }
985
986 pub fn with_request<V: Into<crate::model::GetAttributesConfigRequest>>(
988 mut self,
989 v: V,
990 ) -> Self {
991 self.0.request = v.into();
992 self
993 }
994
995 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
997 self.0.options = v.into();
998 self
999 }
1000
1001 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1003 (*self.0.stub)
1004 .get_attributes_config(self.0.request, self.0.options)
1005 .await
1006 .map(crate::Response::into_body)
1007 }
1008
1009 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1013 self.0.request.name = v.into();
1014 self
1015 }
1016 }
1017
1018 #[doc(hidden)]
1019 impl crate::RequestBuilder for GetAttributesConfig {
1020 fn request_options(&mut self) -> &mut crate::RequestOptions {
1021 &mut self.0.options
1022 }
1023 }
1024
1025 #[derive(Clone, Debug)]
1042 pub struct UpdateAttributesConfig(RequestBuilder<crate::model::UpdateAttributesConfigRequest>);
1043
1044 impl UpdateAttributesConfig {
1045 pub(crate) fn new(
1046 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1047 ) -> Self {
1048 Self(RequestBuilder::new(stub))
1049 }
1050
1051 pub fn with_request<V: Into<crate::model::UpdateAttributesConfigRequest>>(
1053 mut self,
1054 v: V,
1055 ) -> Self {
1056 self.0.request = v.into();
1057 self
1058 }
1059
1060 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1062 self.0.options = v.into();
1063 self
1064 }
1065
1066 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1068 (*self.0.stub)
1069 .update_attributes_config(self.0.request, self.0.options)
1070 .await
1071 .map(crate::Response::into_body)
1072 }
1073
1074 pub fn set_attributes_config<T>(mut self, v: T) -> Self
1078 where
1079 T: std::convert::Into<crate::model::AttributesConfig>,
1080 {
1081 self.0.request.attributes_config = std::option::Option::Some(v.into());
1082 self
1083 }
1084
1085 pub fn set_or_clear_attributes_config<T>(mut self, v: std::option::Option<T>) -> Self
1089 where
1090 T: std::convert::Into<crate::model::AttributesConfig>,
1091 {
1092 self.0.request.attributes_config = v.map(|x| x.into());
1093 self
1094 }
1095
1096 pub fn set_update_mask<T>(mut self, v: T) -> Self
1098 where
1099 T: std::convert::Into<wkt::FieldMask>,
1100 {
1101 self.0.request.update_mask = std::option::Option::Some(v.into());
1102 self
1103 }
1104
1105 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1107 where
1108 T: std::convert::Into<wkt::FieldMask>,
1109 {
1110 self.0.request.update_mask = v.map(|x| x.into());
1111 self
1112 }
1113 }
1114
1115 #[doc(hidden)]
1116 impl crate::RequestBuilder for UpdateAttributesConfig {
1117 fn request_options(&mut self) -> &mut crate::RequestOptions {
1118 &mut self.0.options
1119 }
1120 }
1121
1122 #[derive(Clone, Debug)]
1139 pub struct AddCatalogAttribute(RequestBuilder<crate::model::AddCatalogAttributeRequest>);
1140
1141 impl AddCatalogAttribute {
1142 pub(crate) fn new(
1143 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1144 ) -> Self {
1145 Self(RequestBuilder::new(stub))
1146 }
1147
1148 pub fn with_request<V: Into<crate::model::AddCatalogAttributeRequest>>(
1150 mut self,
1151 v: V,
1152 ) -> Self {
1153 self.0.request = v.into();
1154 self
1155 }
1156
1157 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1159 self.0.options = v.into();
1160 self
1161 }
1162
1163 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1165 (*self.0.stub)
1166 .add_catalog_attribute(self.0.request, self.0.options)
1167 .await
1168 .map(crate::Response::into_body)
1169 }
1170
1171 pub fn set_attributes_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
1175 self.0.request.attributes_config = v.into();
1176 self
1177 }
1178
1179 pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
1183 where
1184 T: std::convert::Into<crate::model::CatalogAttribute>,
1185 {
1186 self.0.request.catalog_attribute = std::option::Option::Some(v.into());
1187 self
1188 }
1189
1190 pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
1194 where
1195 T: std::convert::Into<crate::model::CatalogAttribute>,
1196 {
1197 self.0.request.catalog_attribute = v.map(|x| x.into());
1198 self
1199 }
1200 }
1201
1202 #[doc(hidden)]
1203 impl crate::RequestBuilder for AddCatalogAttribute {
1204 fn request_options(&mut self) -> &mut crate::RequestOptions {
1205 &mut self.0.options
1206 }
1207 }
1208
1209 #[derive(Clone, Debug)]
1226 pub struct RemoveCatalogAttribute(RequestBuilder<crate::model::RemoveCatalogAttributeRequest>);
1227
1228 impl RemoveCatalogAttribute {
1229 pub(crate) fn new(
1230 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1231 ) -> Self {
1232 Self(RequestBuilder::new(stub))
1233 }
1234
1235 pub fn with_request<V: Into<crate::model::RemoveCatalogAttributeRequest>>(
1237 mut self,
1238 v: V,
1239 ) -> Self {
1240 self.0.request = v.into();
1241 self
1242 }
1243
1244 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1246 self.0.options = v.into();
1247 self
1248 }
1249
1250 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1252 (*self.0.stub)
1253 .remove_catalog_attribute(self.0.request, self.0.options)
1254 .await
1255 .map(crate::Response::into_body)
1256 }
1257
1258 pub fn set_attributes_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
1262 self.0.request.attributes_config = v.into();
1263 self
1264 }
1265
1266 pub fn set_key<T: Into<std::string::String>>(mut self, v: T) -> Self {
1270 self.0.request.key = v.into();
1271 self
1272 }
1273 }
1274
1275 #[doc(hidden)]
1276 impl crate::RequestBuilder for RemoveCatalogAttribute {
1277 fn request_options(&mut self) -> &mut crate::RequestOptions {
1278 &mut self.0.options
1279 }
1280 }
1281
1282 #[derive(Clone, Debug)]
1299 pub struct ReplaceCatalogAttribute(
1300 RequestBuilder<crate::model::ReplaceCatalogAttributeRequest>,
1301 );
1302
1303 impl ReplaceCatalogAttribute {
1304 pub(crate) fn new(
1305 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1306 ) -> Self {
1307 Self(RequestBuilder::new(stub))
1308 }
1309
1310 pub fn with_request<V: Into<crate::model::ReplaceCatalogAttributeRequest>>(
1312 mut self,
1313 v: V,
1314 ) -> Self {
1315 self.0.request = v.into();
1316 self
1317 }
1318
1319 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1321 self.0.options = v.into();
1322 self
1323 }
1324
1325 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1327 (*self.0.stub)
1328 .replace_catalog_attribute(self.0.request, self.0.options)
1329 .await
1330 .map(crate::Response::into_body)
1331 }
1332
1333 pub fn set_attributes_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
1337 self.0.request.attributes_config = v.into();
1338 self
1339 }
1340
1341 pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
1345 where
1346 T: std::convert::Into<crate::model::CatalogAttribute>,
1347 {
1348 self.0.request.catalog_attribute = std::option::Option::Some(v.into());
1349 self
1350 }
1351
1352 pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
1356 where
1357 T: std::convert::Into<crate::model::CatalogAttribute>,
1358 {
1359 self.0.request.catalog_attribute = v.map(|x| x.into());
1360 self
1361 }
1362
1363 pub fn set_update_mask<T>(mut self, v: T) -> Self
1365 where
1366 T: std::convert::Into<wkt::FieldMask>,
1367 {
1368 self.0.request.update_mask = std::option::Option::Some(v.into());
1369 self
1370 }
1371
1372 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1374 where
1375 T: std::convert::Into<wkt::FieldMask>,
1376 {
1377 self.0.request.update_mask = v.map(|x| x.into());
1378 self
1379 }
1380 }
1381
1382 #[doc(hidden)]
1383 impl crate::RequestBuilder for ReplaceCatalogAttribute {
1384 fn request_options(&mut self) -> &mut crate::RequestOptions {
1385 &mut self.0.options
1386 }
1387 }
1388
1389 #[derive(Clone, Debug)]
1410 pub struct ListOperations(
1411 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1412 );
1413
1414 impl ListOperations {
1415 pub(crate) fn new(
1416 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1417 ) -> Self {
1418 Self(RequestBuilder::new(stub))
1419 }
1420
1421 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1423 mut self,
1424 v: V,
1425 ) -> Self {
1426 self.0.request = v.into();
1427 self
1428 }
1429
1430 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1432 self.0.options = v.into();
1433 self
1434 }
1435
1436 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1438 (*self.0.stub)
1439 .list_operations(self.0.request, self.0.options)
1440 .await
1441 .map(crate::Response::into_body)
1442 }
1443
1444 pub fn by_page(
1446 self,
1447 ) -> impl google_cloud_gax::paginator::Paginator<
1448 google_cloud_longrunning::model::ListOperationsResponse,
1449 crate::Error,
1450 > {
1451 use std::clone::Clone;
1452 let token = self.0.request.page_token.clone();
1453 let execute = move |token: String| {
1454 let mut builder = self.clone();
1455 builder.0.request = builder.0.request.set_page_token(token);
1456 builder.send()
1457 };
1458 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1459 }
1460
1461 pub fn by_item(
1463 self,
1464 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1465 google_cloud_longrunning::model::ListOperationsResponse,
1466 crate::Error,
1467 > {
1468 use google_cloud_gax::paginator::Paginator;
1469 self.by_page().items()
1470 }
1471
1472 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1474 self.0.request.name = v.into();
1475 self
1476 }
1477
1478 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1480 self.0.request.filter = v.into();
1481 self
1482 }
1483
1484 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1486 self.0.request.page_size = v.into();
1487 self
1488 }
1489
1490 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1492 self.0.request.page_token = v.into();
1493 self
1494 }
1495
1496 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1498 self.0.request.return_partial_success = v.into();
1499 self
1500 }
1501 }
1502
1503 #[doc(hidden)]
1504 impl crate::RequestBuilder for ListOperations {
1505 fn request_options(&mut self) -> &mut crate::RequestOptions {
1506 &mut self.0.options
1507 }
1508 }
1509
1510 #[derive(Clone, Debug)]
1527 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1528
1529 impl GetOperation {
1530 pub(crate) fn new(
1531 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1532 ) -> Self {
1533 Self(RequestBuilder::new(stub))
1534 }
1535
1536 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1538 mut self,
1539 v: V,
1540 ) -> Self {
1541 self.0.request = v.into();
1542 self
1543 }
1544
1545 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1547 self.0.options = v.into();
1548 self
1549 }
1550
1551 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1553 (*self.0.stub)
1554 .get_operation(self.0.request, self.0.options)
1555 .await
1556 .map(crate::Response::into_body)
1557 }
1558
1559 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1561 self.0.request.name = v.into();
1562 self
1563 }
1564 }
1565
1566 #[doc(hidden)]
1567 impl crate::RequestBuilder for GetOperation {
1568 fn request_options(&mut self) -> &mut crate::RequestOptions {
1569 &mut self.0.options
1570 }
1571 }
1572}
1573
1574pub mod completion_service {
1575 use crate::Result;
1576
1577 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1591
1592 pub(crate) mod client {
1593 use super::super::super::client::CompletionService;
1594 pub struct Factory;
1595 impl crate::ClientFactory for Factory {
1596 type Client = CompletionService;
1597 type Credentials = gaxi::options::Credentials;
1598 async fn build(
1599 self,
1600 config: gaxi::options::ClientConfig,
1601 ) -> crate::ClientBuilderResult<Self::Client> {
1602 Self::Client::new(config).await
1603 }
1604 }
1605 }
1606
1607 #[derive(Clone, Debug)]
1609 pub(crate) struct RequestBuilder<R: std::default::Default> {
1610 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1611 request: R,
1612 options: crate::RequestOptions,
1613 }
1614
1615 impl<R> RequestBuilder<R>
1616 where
1617 R: std::default::Default,
1618 {
1619 pub(crate) fn new(
1620 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1621 ) -> Self {
1622 Self {
1623 stub,
1624 request: R::default(),
1625 options: crate::RequestOptions::default(),
1626 }
1627 }
1628 }
1629
1630 #[derive(Clone, Debug)]
1647 pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1648
1649 impl CompleteQuery {
1650 pub(crate) fn new(
1651 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1652 ) -> Self {
1653 Self(RequestBuilder::new(stub))
1654 }
1655
1656 pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1658 self.0.request = v.into();
1659 self
1660 }
1661
1662 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1664 self.0.options = v.into();
1665 self
1666 }
1667
1668 pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1670 (*self.0.stub)
1671 .complete_query(self.0.request, self.0.options)
1672 .await
1673 .map(crate::Response::into_body)
1674 }
1675
1676 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
1680 self.0.request.catalog = v.into();
1681 self
1682 }
1683
1684 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1688 self.0.request.query = v.into();
1689 self
1690 }
1691
1692 pub fn set_visitor_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1694 self.0.request.visitor_id = v.into();
1695 self
1696 }
1697
1698 pub fn set_language_codes<T, V>(mut self, v: T) -> Self
1700 where
1701 T: std::iter::IntoIterator<Item = V>,
1702 V: std::convert::Into<std::string::String>,
1703 {
1704 use std::iter::Iterator;
1705 self.0.request.language_codes = v.into_iter().map(|i| i.into()).collect();
1706 self
1707 }
1708
1709 pub fn set_device_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
1711 self.0.request.device_type = v.into();
1712 self
1713 }
1714
1715 pub fn set_dataset<T: Into<std::string::String>>(mut self, v: T) -> Self {
1717 self.0.request.dataset = v.into();
1718 self
1719 }
1720
1721 pub fn set_max_suggestions<T: Into<i32>>(mut self, v: T) -> Self {
1723 self.0.request.max_suggestions = v.into();
1724 self
1725 }
1726
1727 pub fn set_enable_attribute_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1729 self.0.request.enable_attribute_suggestions = v.into();
1730 self
1731 }
1732
1733 pub fn set_entity<T: Into<std::string::String>>(mut self, v: T) -> Self {
1735 self.0.request.entity = v.into();
1736 self
1737 }
1738 }
1739
1740 #[doc(hidden)]
1741 impl crate::RequestBuilder for CompleteQuery {
1742 fn request_options(&mut self) -> &mut crate::RequestOptions {
1743 &mut self.0.options
1744 }
1745 }
1746
1747 #[derive(Clone, Debug)]
1765 pub struct ImportCompletionData(RequestBuilder<crate::model::ImportCompletionDataRequest>);
1766
1767 impl ImportCompletionData {
1768 pub(crate) fn new(
1769 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1770 ) -> Self {
1771 Self(RequestBuilder::new(stub))
1772 }
1773
1774 pub fn with_request<V: Into<crate::model::ImportCompletionDataRequest>>(
1776 mut self,
1777 v: V,
1778 ) -> Self {
1779 self.0.request = v.into();
1780 self
1781 }
1782
1783 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1785 self.0.options = v.into();
1786 self
1787 }
1788
1789 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1796 (*self.0.stub)
1797 .import_completion_data(self.0.request, self.0.options)
1798 .await
1799 .map(crate::Response::into_body)
1800 }
1801
1802 pub fn poller(
1804 self,
1805 ) -> impl google_cloud_lro::Poller<
1806 crate::model::ImportCompletionDataResponse,
1807 crate::model::ImportMetadata,
1808 > {
1809 type Operation = google_cloud_lro::internal::Operation<
1810 crate::model::ImportCompletionDataResponse,
1811 crate::model::ImportMetadata,
1812 >;
1813 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1814 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1815
1816 let stub = self.0.stub.clone();
1817 let mut options = self.0.options.clone();
1818 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1819 let query = move |name| {
1820 let stub = stub.clone();
1821 let options = options.clone();
1822 async {
1823 let op = GetOperation::new(stub)
1824 .set_name(name)
1825 .with_options(options)
1826 .send()
1827 .await?;
1828 Ok(Operation::new(op))
1829 }
1830 };
1831
1832 let start = move || async {
1833 let op = self.send().await?;
1834 Ok(Operation::new(op))
1835 };
1836
1837 google_cloud_lro::internal::new_poller(
1838 polling_error_policy,
1839 polling_backoff_policy,
1840 start,
1841 query,
1842 )
1843 }
1844
1845 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1849 self.0.request.parent = v.into();
1850 self
1851 }
1852
1853 pub fn set_input_config<T>(mut self, v: T) -> Self
1857 where
1858 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
1859 {
1860 self.0.request.input_config = std::option::Option::Some(v.into());
1861 self
1862 }
1863
1864 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
1868 where
1869 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
1870 {
1871 self.0.request.input_config = v.map(|x| x.into());
1872 self
1873 }
1874
1875 pub fn set_notification_pubsub_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
1877 self.0.request.notification_pubsub_topic = v.into();
1878 self
1879 }
1880 }
1881
1882 #[doc(hidden)]
1883 impl crate::RequestBuilder for ImportCompletionData {
1884 fn request_options(&mut self) -> &mut crate::RequestOptions {
1885 &mut self.0.options
1886 }
1887 }
1888
1889 #[derive(Clone, Debug)]
1910 pub struct ListOperations(
1911 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1912 );
1913
1914 impl ListOperations {
1915 pub(crate) fn new(
1916 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1917 ) -> Self {
1918 Self(RequestBuilder::new(stub))
1919 }
1920
1921 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1923 mut self,
1924 v: V,
1925 ) -> Self {
1926 self.0.request = v.into();
1927 self
1928 }
1929
1930 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1932 self.0.options = v.into();
1933 self
1934 }
1935
1936 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1938 (*self.0.stub)
1939 .list_operations(self.0.request, self.0.options)
1940 .await
1941 .map(crate::Response::into_body)
1942 }
1943
1944 pub fn by_page(
1946 self,
1947 ) -> impl google_cloud_gax::paginator::Paginator<
1948 google_cloud_longrunning::model::ListOperationsResponse,
1949 crate::Error,
1950 > {
1951 use std::clone::Clone;
1952 let token = self.0.request.page_token.clone();
1953 let execute = move |token: String| {
1954 let mut builder = self.clone();
1955 builder.0.request = builder.0.request.set_page_token(token);
1956 builder.send()
1957 };
1958 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1959 }
1960
1961 pub fn by_item(
1963 self,
1964 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1965 google_cloud_longrunning::model::ListOperationsResponse,
1966 crate::Error,
1967 > {
1968 use google_cloud_gax::paginator::Paginator;
1969 self.by_page().items()
1970 }
1971
1972 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1974 self.0.request.name = v.into();
1975 self
1976 }
1977
1978 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1980 self.0.request.filter = v.into();
1981 self
1982 }
1983
1984 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1986 self.0.request.page_size = v.into();
1987 self
1988 }
1989
1990 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1992 self.0.request.page_token = v.into();
1993 self
1994 }
1995
1996 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1998 self.0.request.return_partial_success = v.into();
1999 self
2000 }
2001 }
2002
2003 #[doc(hidden)]
2004 impl crate::RequestBuilder for ListOperations {
2005 fn request_options(&mut self) -> &mut crate::RequestOptions {
2006 &mut self.0.options
2007 }
2008 }
2009
2010 #[derive(Clone, Debug)]
2027 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2028
2029 impl GetOperation {
2030 pub(crate) fn new(
2031 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
2032 ) -> Self {
2033 Self(RequestBuilder::new(stub))
2034 }
2035
2036 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2038 mut self,
2039 v: V,
2040 ) -> Self {
2041 self.0.request = v.into();
2042 self
2043 }
2044
2045 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2047 self.0.options = v.into();
2048 self
2049 }
2050
2051 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2053 (*self.0.stub)
2054 .get_operation(self.0.request, self.0.options)
2055 .await
2056 .map(crate::Response::into_body)
2057 }
2058
2059 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2061 self.0.request.name = v.into();
2062 self
2063 }
2064 }
2065
2066 #[doc(hidden)]
2067 impl crate::RequestBuilder for GetOperation {
2068 fn request_options(&mut self) -> &mut crate::RequestOptions {
2069 &mut self.0.options
2070 }
2071 }
2072}
2073
2074pub mod control_service {
2075 use crate::Result;
2076
2077 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2091
2092 pub(crate) mod client {
2093 use super::super::super::client::ControlService;
2094 pub struct Factory;
2095 impl crate::ClientFactory for Factory {
2096 type Client = ControlService;
2097 type Credentials = gaxi::options::Credentials;
2098 async fn build(
2099 self,
2100 config: gaxi::options::ClientConfig,
2101 ) -> crate::ClientBuilderResult<Self::Client> {
2102 Self::Client::new(config).await
2103 }
2104 }
2105 }
2106
2107 #[derive(Clone, Debug)]
2109 pub(crate) struct RequestBuilder<R: std::default::Default> {
2110 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2111 request: R,
2112 options: crate::RequestOptions,
2113 }
2114
2115 impl<R> RequestBuilder<R>
2116 where
2117 R: std::default::Default,
2118 {
2119 pub(crate) fn new(
2120 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2121 ) -> Self {
2122 Self {
2123 stub,
2124 request: R::default(),
2125 options: crate::RequestOptions::default(),
2126 }
2127 }
2128 }
2129
2130 #[derive(Clone, Debug)]
2147 pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2148
2149 impl CreateControl {
2150 pub(crate) fn new(
2151 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2152 ) -> Self {
2153 Self(RequestBuilder::new(stub))
2154 }
2155
2156 pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2158 self.0.request = v.into();
2159 self
2160 }
2161
2162 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2164 self.0.options = v.into();
2165 self
2166 }
2167
2168 pub async fn send(self) -> Result<crate::model::Control> {
2170 (*self.0.stub)
2171 .create_control(self.0.request, self.0.options)
2172 .await
2173 .map(crate::Response::into_body)
2174 }
2175
2176 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2180 self.0.request.parent = v.into();
2181 self
2182 }
2183
2184 pub fn set_control<T>(mut self, v: T) -> Self
2188 where
2189 T: std::convert::Into<crate::model::Control>,
2190 {
2191 self.0.request.control = std::option::Option::Some(v.into());
2192 self
2193 }
2194
2195 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2199 where
2200 T: std::convert::Into<crate::model::Control>,
2201 {
2202 self.0.request.control = v.map(|x| x.into());
2203 self
2204 }
2205
2206 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2210 self.0.request.control_id = v.into();
2211 self
2212 }
2213 }
2214
2215 #[doc(hidden)]
2216 impl crate::RequestBuilder for CreateControl {
2217 fn request_options(&mut self) -> &mut crate::RequestOptions {
2218 &mut self.0.options
2219 }
2220 }
2221
2222 #[derive(Clone, Debug)]
2239 pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2240
2241 impl DeleteControl {
2242 pub(crate) fn new(
2243 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2244 ) -> Self {
2245 Self(RequestBuilder::new(stub))
2246 }
2247
2248 pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2250 self.0.request = v.into();
2251 self
2252 }
2253
2254 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2256 self.0.options = v.into();
2257 self
2258 }
2259
2260 pub async fn send(self) -> Result<()> {
2262 (*self.0.stub)
2263 .delete_control(self.0.request, self.0.options)
2264 .await
2265 .map(crate::Response::into_body)
2266 }
2267
2268 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2272 self.0.request.name = v.into();
2273 self
2274 }
2275 }
2276
2277 #[doc(hidden)]
2278 impl crate::RequestBuilder for DeleteControl {
2279 fn request_options(&mut self) -> &mut crate::RequestOptions {
2280 &mut self.0.options
2281 }
2282 }
2283
2284 #[derive(Clone, Debug)]
2301 pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2302
2303 impl UpdateControl {
2304 pub(crate) fn new(
2305 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2306 ) -> Self {
2307 Self(RequestBuilder::new(stub))
2308 }
2309
2310 pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2312 self.0.request = v.into();
2313 self
2314 }
2315
2316 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2318 self.0.options = v.into();
2319 self
2320 }
2321
2322 pub async fn send(self) -> Result<crate::model::Control> {
2324 (*self.0.stub)
2325 .update_control(self.0.request, self.0.options)
2326 .await
2327 .map(crate::Response::into_body)
2328 }
2329
2330 pub fn set_control<T>(mut self, v: T) -> Self
2334 where
2335 T: std::convert::Into<crate::model::Control>,
2336 {
2337 self.0.request.control = std::option::Option::Some(v.into());
2338 self
2339 }
2340
2341 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2345 where
2346 T: std::convert::Into<crate::model::Control>,
2347 {
2348 self.0.request.control = v.map(|x| x.into());
2349 self
2350 }
2351
2352 pub fn set_update_mask<T>(mut self, v: T) -> Self
2354 where
2355 T: std::convert::Into<wkt::FieldMask>,
2356 {
2357 self.0.request.update_mask = std::option::Option::Some(v.into());
2358 self
2359 }
2360
2361 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2363 where
2364 T: std::convert::Into<wkt::FieldMask>,
2365 {
2366 self.0.request.update_mask = v.map(|x| x.into());
2367 self
2368 }
2369 }
2370
2371 #[doc(hidden)]
2372 impl crate::RequestBuilder for UpdateControl {
2373 fn request_options(&mut self) -> &mut crate::RequestOptions {
2374 &mut self.0.options
2375 }
2376 }
2377
2378 #[derive(Clone, Debug)]
2395 pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2396
2397 impl GetControl {
2398 pub(crate) fn new(
2399 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2400 ) -> Self {
2401 Self(RequestBuilder::new(stub))
2402 }
2403
2404 pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2406 self.0.request = v.into();
2407 self
2408 }
2409
2410 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2412 self.0.options = v.into();
2413 self
2414 }
2415
2416 pub async fn send(self) -> Result<crate::model::Control> {
2418 (*self.0.stub)
2419 .get_control(self.0.request, self.0.options)
2420 .await
2421 .map(crate::Response::into_body)
2422 }
2423
2424 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2428 self.0.request.name = v.into();
2429 self
2430 }
2431 }
2432
2433 #[doc(hidden)]
2434 impl crate::RequestBuilder for GetControl {
2435 fn request_options(&mut self) -> &mut crate::RequestOptions {
2436 &mut self.0.options
2437 }
2438 }
2439
2440 #[derive(Clone, Debug)]
2461 pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2462
2463 impl ListControls {
2464 pub(crate) fn new(
2465 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2466 ) -> Self {
2467 Self(RequestBuilder::new(stub))
2468 }
2469
2470 pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2472 self.0.request = v.into();
2473 self
2474 }
2475
2476 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2478 self.0.options = v.into();
2479 self
2480 }
2481
2482 pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2484 (*self.0.stub)
2485 .list_controls(self.0.request, self.0.options)
2486 .await
2487 .map(crate::Response::into_body)
2488 }
2489
2490 pub fn by_page(
2492 self,
2493 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListControlsResponse, crate::Error>
2494 {
2495 use std::clone::Clone;
2496 let token = self.0.request.page_token.clone();
2497 let execute = move |token: String| {
2498 let mut builder = self.clone();
2499 builder.0.request = builder.0.request.set_page_token(token);
2500 builder.send()
2501 };
2502 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2503 }
2504
2505 pub fn by_item(
2507 self,
2508 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2509 crate::model::ListControlsResponse,
2510 crate::Error,
2511 > {
2512 use google_cloud_gax::paginator::Paginator;
2513 self.by_page().items()
2514 }
2515
2516 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2520 self.0.request.parent = v.into();
2521 self
2522 }
2523
2524 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2526 self.0.request.page_size = v.into();
2527 self
2528 }
2529
2530 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2532 self.0.request.page_token = v.into();
2533 self
2534 }
2535
2536 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2538 self.0.request.filter = v.into();
2539 self
2540 }
2541 }
2542
2543 #[doc(hidden)]
2544 impl crate::RequestBuilder for ListControls {
2545 fn request_options(&mut self) -> &mut crate::RequestOptions {
2546 &mut self.0.options
2547 }
2548 }
2549
2550 #[derive(Clone, Debug)]
2571 pub struct ListOperations(
2572 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2573 );
2574
2575 impl ListOperations {
2576 pub(crate) fn new(
2577 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2578 ) -> Self {
2579 Self(RequestBuilder::new(stub))
2580 }
2581
2582 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2584 mut self,
2585 v: V,
2586 ) -> Self {
2587 self.0.request = v.into();
2588 self
2589 }
2590
2591 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2593 self.0.options = v.into();
2594 self
2595 }
2596
2597 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2599 (*self.0.stub)
2600 .list_operations(self.0.request, self.0.options)
2601 .await
2602 .map(crate::Response::into_body)
2603 }
2604
2605 pub fn by_page(
2607 self,
2608 ) -> impl google_cloud_gax::paginator::Paginator<
2609 google_cloud_longrunning::model::ListOperationsResponse,
2610 crate::Error,
2611 > {
2612 use std::clone::Clone;
2613 let token = self.0.request.page_token.clone();
2614 let execute = move |token: String| {
2615 let mut builder = self.clone();
2616 builder.0.request = builder.0.request.set_page_token(token);
2617 builder.send()
2618 };
2619 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2620 }
2621
2622 pub fn by_item(
2624 self,
2625 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2626 google_cloud_longrunning::model::ListOperationsResponse,
2627 crate::Error,
2628 > {
2629 use google_cloud_gax::paginator::Paginator;
2630 self.by_page().items()
2631 }
2632
2633 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2635 self.0.request.name = v.into();
2636 self
2637 }
2638
2639 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2641 self.0.request.filter = v.into();
2642 self
2643 }
2644
2645 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2647 self.0.request.page_size = v.into();
2648 self
2649 }
2650
2651 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2653 self.0.request.page_token = v.into();
2654 self
2655 }
2656
2657 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2659 self.0.request.return_partial_success = v.into();
2660 self
2661 }
2662 }
2663
2664 #[doc(hidden)]
2665 impl crate::RequestBuilder for ListOperations {
2666 fn request_options(&mut self) -> &mut crate::RequestOptions {
2667 &mut self.0.options
2668 }
2669 }
2670
2671 #[derive(Clone, Debug)]
2688 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2689
2690 impl GetOperation {
2691 pub(crate) fn new(
2692 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2693 ) -> Self {
2694 Self(RequestBuilder::new(stub))
2695 }
2696
2697 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2699 mut self,
2700 v: V,
2701 ) -> Self {
2702 self.0.request = v.into();
2703 self
2704 }
2705
2706 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2708 self.0.options = v.into();
2709 self
2710 }
2711
2712 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2714 (*self.0.stub)
2715 .get_operation(self.0.request, self.0.options)
2716 .await
2717 .map(crate::Response::into_body)
2718 }
2719
2720 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2722 self.0.request.name = v.into();
2723 self
2724 }
2725 }
2726
2727 #[doc(hidden)]
2728 impl crate::RequestBuilder for GetOperation {
2729 fn request_options(&mut self) -> &mut crate::RequestOptions {
2730 &mut self.0.options
2731 }
2732 }
2733}
2734
2735pub mod conversational_search_service {
2736 use crate::Result;
2737
2738 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2752
2753 pub(crate) mod client {
2754 use super::super::super::client::ConversationalSearchService;
2755 pub struct Factory;
2756 impl crate::ClientFactory for Factory {
2757 type Client = ConversationalSearchService;
2758 type Credentials = gaxi::options::Credentials;
2759 async fn build(
2760 self,
2761 config: gaxi::options::ClientConfig,
2762 ) -> crate::ClientBuilderResult<Self::Client> {
2763 Self::Client::new(config).await
2764 }
2765 }
2766 }
2767
2768 #[derive(Clone, Debug)]
2770 pub(crate) struct RequestBuilder<R: std::default::Default> {
2771 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2772 request: R,
2773 options: crate::RequestOptions,
2774 }
2775
2776 impl<R> RequestBuilder<R>
2777 where
2778 R: std::default::Default,
2779 {
2780 pub(crate) fn new(
2781 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2782 ) -> Self {
2783 Self {
2784 stub,
2785 request: R::default(),
2786 options: crate::RequestOptions::default(),
2787 }
2788 }
2789 }
2790
2791 #[derive(Clone, Debug)]
2812 pub struct ListOperations(
2813 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2814 );
2815
2816 impl ListOperations {
2817 pub(crate) fn new(
2818 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2819 ) -> Self {
2820 Self(RequestBuilder::new(stub))
2821 }
2822
2823 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2825 mut self,
2826 v: V,
2827 ) -> Self {
2828 self.0.request = v.into();
2829 self
2830 }
2831
2832 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2834 self.0.options = v.into();
2835 self
2836 }
2837
2838 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2840 (*self.0.stub)
2841 .list_operations(self.0.request, self.0.options)
2842 .await
2843 .map(crate::Response::into_body)
2844 }
2845
2846 pub fn by_page(
2848 self,
2849 ) -> impl google_cloud_gax::paginator::Paginator<
2850 google_cloud_longrunning::model::ListOperationsResponse,
2851 crate::Error,
2852 > {
2853 use std::clone::Clone;
2854 let token = self.0.request.page_token.clone();
2855 let execute = move |token: String| {
2856 let mut builder = self.clone();
2857 builder.0.request = builder.0.request.set_page_token(token);
2858 builder.send()
2859 };
2860 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2861 }
2862
2863 pub fn by_item(
2865 self,
2866 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2867 google_cloud_longrunning::model::ListOperationsResponse,
2868 crate::Error,
2869 > {
2870 use google_cloud_gax::paginator::Paginator;
2871 self.by_page().items()
2872 }
2873
2874 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2876 self.0.request.name = v.into();
2877 self
2878 }
2879
2880 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2882 self.0.request.filter = v.into();
2883 self
2884 }
2885
2886 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2888 self.0.request.page_size = v.into();
2889 self
2890 }
2891
2892 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2894 self.0.request.page_token = v.into();
2895 self
2896 }
2897
2898 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2900 self.0.request.return_partial_success = v.into();
2901 self
2902 }
2903 }
2904
2905 #[doc(hidden)]
2906 impl crate::RequestBuilder for ListOperations {
2907 fn request_options(&mut self) -> &mut crate::RequestOptions {
2908 &mut self.0.options
2909 }
2910 }
2911
2912 #[derive(Clone, Debug)]
2929 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2930
2931 impl GetOperation {
2932 pub(crate) fn new(
2933 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2934 ) -> Self {
2935 Self(RequestBuilder::new(stub))
2936 }
2937
2938 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2940 mut self,
2941 v: V,
2942 ) -> Self {
2943 self.0.request = v.into();
2944 self
2945 }
2946
2947 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2949 self.0.options = v.into();
2950 self
2951 }
2952
2953 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2955 (*self.0.stub)
2956 .get_operation(self.0.request, self.0.options)
2957 .await
2958 .map(crate::Response::into_body)
2959 }
2960
2961 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2963 self.0.request.name = v.into();
2964 self
2965 }
2966 }
2967
2968 #[doc(hidden)]
2969 impl crate::RequestBuilder for GetOperation {
2970 fn request_options(&mut self) -> &mut crate::RequestOptions {
2971 &mut self.0.options
2972 }
2973 }
2974}
2975
2976pub mod generative_question_service {
2977 use crate::Result;
2978
2979 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2993
2994 pub(crate) mod client {
2995 use super::super::super::client::GenerativeQuestionService;
2996 pub struct Factory;
2997 impl crate::ClientFactory for Factory {
2998 type Client = GenerativeQuestionService;
2999 type Credentials = gaxi::options::Credentials;
3000 async fn build(
3001 self,
3002 config: gaxi::options::ClientConfig,
3003 ) -> crate::ClientBuilderResult<Self::Client> {
3004 Self::Client::new(config).await
3005 }
3006 }
3007 }
3008
3009 #[derive(Clone, Debug)]
3011 pub(crate) struct RequestBuilder<R: std::default::Default> {
3012 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3013 request: R,
3014 options: crate::RequestOptions,
3015 }
3016
3017 impl<R> RequestBuilder<R>
3018 where
3019 R: std::default::Default,
3020 {
3021 pub(crate) fn new(
3022 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3023 ) -> Self {
3024 Self {
3025 stub,
3026 request: R::default(),
3027 options: crate::RequestOptions::default(),
3028 }
3029 }
3030 }
3031
3032 #[derive(Clone, Debug)]
3049 pub struct UpdateGenerativeQuestionsFeatureConfig(
3050 RequestBuilder<crate::model::UpdateGenerativeQuestionsFeatureConfigRequest>,
3051 );
3052
3053 impl UpdateGenerativeQuestionsFeatureConfig {
3054 pub(crate) fn new(
3055 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3056 ) -> Self {
3057 Self(RequestBuilder::new(stub))
3058 }
3059
3060 pub fn with_request<
3062 V: Into<crate::model::UpdateGenerativeQuestionsFeatureConfigRequest>,
3063 >(
3064 mut self,
3065 v: V,
3066 ) -> Self {
3067 self.0.request = v.into();
3068 self
3069 }
3070
3071 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3073 self.0.options = v.into();
3074 self
3075 }
3076
3077 pub async fn send(self) -> Result<crate::model::GenerativeQuestionsFeatureConfig> {
3079 (*self.0.stub)
3080 .update_generative_questions_feature_config(self.0.request, self.0.options)
3081 .await
3082 .map(crate::Response::into_body)
3083 }
3084
3085 pub fn set_generative_questions_feature_config<T>(mut self, v: T) -> Self
3089 where
3090 T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
3091 {
3092 self.0.request.generative_questions_feature_config =
3093 std::option::Option::Some(v.into());
3094 self
3095 }
3096
3097 pub fn set_or_clear_generative_questions_feature_config<T>(
3101 mut self,
3102 v: std::option::Option<T>,
3103 ) -> Self
3104 where
3105 T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
3106 {
3107 self.0.request.generative_questions_feature_config = v.map(|x| x.into());
3108 self
3109 }
3110
3111 pub fn set_update_mask<T>(mut self, v: T) -> Self
3113 where
3114 T: std::convert::Into<wkt::FieldMask>,
3115 {
3116 self.0.request.update_mask = std::option::Option::Some(v.into());
3117 self
3118 }
3119
3120 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3122 where
3123 T: std::convert::Into<wkt::FieldMask>,
3124 {
3125 self.0.request.update_mask = v.map(|x| x.into());
3126 self
3127 }
3128 }
3129
3130 #[doc(hidden)]
3131 impl crate::RequestBuilder for UpdateGenerativeQuestionsFeatureConfig {
3132 fn request_options(&mut self) -> &mut crate::RequestOptions {
3133 &mut self.0.options
3134 }
3135 }
3136
3137 #[derive(Clone, Debug)]
3154 pub struct GetGenerativeQuestionsFeatureConfig(
3155 RequestBuilder<crate::model::GetGenerativeQuestionsFeatureConfigRequest>,
3156 );
3157
3158 impl GetGenerativeQuestionsFeatureConfig {
3159 pub(crate) fn new(
3160 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3161 ) -> Self {
3162 Self(RequestBuilder::new(stub))
3163 }
3164
3165 pub fn with_request<V: Into<crate::model::GetGenerativeQuestionsFeatureConfigRequest>>(
3167 mut self,
3168 v: V,
3169 ) -> Self {
3170 self.0.request = v.into();
3171 self
3172 }
3173
3174 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3176 self.0.options = v.into();
3177 self
3178 }
3179
3180 pub async fn send(self) -> Result<crate::model::GenerativeQuestionsFeatureConfig> {
3182 (*self.0.stub)
3183 .get_generative_questions_feature_config(self.0.request, self.0.options)
3184 .await
3185 .map(crate::Response::into_body)
3186 }
3187
3188 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
3192 self.0.request.catalog = v.into();
3193 self
3194 }
3195 }
3196
3197 #[doc(hidden)]
3198 impl crate::RequestBuilder for GetGenerativeQuestionsFeatureConfig {
3199 fn request_options(&mut self) -> &mut crate::RequestOptions {
3200 &mut self.0.options
3201 }
3202 }
3203
3204 #[derive(Clone, Debug)]
3221 pub struct ListGenerativeQuestionConfigs(
3222 RequestBuilder<crate::model::ListGenerativeQuestionConfigsRequest>,
3223 );
3224
3225 impl ListGenerativeQuestionConfigs {
3226 pub(crate) fn new(
3227 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3228 ) -> Self {
3229 Self(RequestBuilder::new(stub))
3230 }
3231
3232 pub fn with_request<V: Into<crate::model::ListGenerativeQuestionConfigsRequest>>(
3234 mut self,
3235 v: V,
3236 ) -> Self {
3237 self.0.request = v.into();
3238 self
3239 }
3240
3241 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3243 self.0.options = v.into();
3244 self
3245 }
3246
3247 pub async fn send(self) -> Result<crate::model::ListGenerativeQuestionConfigsResponse> {
3249 (*self.0.stub)
3250 .list_generative_question_configs(self.0.request, self.0.options)
3251 .await
3252 .map(crate::Response::into_body)
3253 }
3254
3255 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3259 self.0.request.parent = v.into();
3260 self
3261 }
3262 }
3263
3264 #[doc(hidden)]
3265 impl crate::RequestBuilder for ListGenerativeQuestionConfigs {
3266 fn request_options(&mut self) -> &mut crate::RequestOptions {
3267 &mut self.0.options
3268 }
3269 }
3270
3271 #[derive(Clone, Debug)]
3288 pub struct UpdateGenerativeQuestionConfig(
3289 RequestBuilder<crate::model::UpdateGenerativeQuestionConfigRequest>,
3290 );
3291
3292 impl UpdateGenerativeQuestionConfig {
3293 pub(crate) fn new(
3294 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3295 ) -> Self {
3296 Self(RequestBuilder::new(stub))
3297 }
3298
3299 pub fn with_request<V: Into<crate::model::UpdateGenerativeQuestionConfigRequest>>(
3301 mut self,
3302 v: V,
3303 ) -> Self {
3304 self.0.request = v.into();
3305 self
3306 }
3307
3308 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3310 self.0.options = v.into();
3311 self
3312 }
3313
3314 pub async fn send(self) -> Result<crate::model::GenerativeQuestionConfig> {
3316 (*self.0.stub)
3317 .update_generative_question_config(self.0.request, self.0.options)
3318 .await
3319 .map(crate::Response::into_body)
3320 }
3321
3322 pub fn set_generative_question_config<T>(mut self, v: T) -> Self
3326 where
3327 T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
3328 {
3329 self.0.request.generative_question_config = std::option::Option::Some(v.into());
3330 self
3331 }
3332
3333 pub fn set_or_clear_generative_question_config<T>(
3337 mut self,
3338 v: std::option::Option<T>,
3339 ) -> Self
3340 where
3341 T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
3342 {
3343 self.0.request.generative_question_config = v.map(|x| x.into());
3344 self
3345 }
3346
3347 pub fn set_update_mask<T>(mut self, v: T) -> Self
3349 where
3350 T: std::convert::Into<wkt::FieldMask>,
3351 {
3352 self.0.request.update_mask = std::option::Option::Some(v.into());
3353 self
3354 }
3355
3356 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3358 where
3359 T: std::convert::Into<wkt::FieldMask>,
3360 {
3361 self.0.request.update_mask = v.map(|x| x.into());
3362 self
3363 }
3364 }
3365
3366 #[doc(hidden)]
3367 impl crate::RequestBuilder for UpdateGenerativeQuestionConfig {
3368 fn request_options(&mut self) -> &mut crate::RequestOptions {
3369 &mut self.0.options
3370 }
3371 }
3372
3373 #[derive(Clone, Debug)]
3390 pub struct BatchUpdateGenerativeQuestionConfigs(
3391 RequestBuilder<crate::model::BatchUpdateGenerativeQuestionConfigsRequest>,
3392 );
3393
3394 impl BatchUpdateGenerativeQuestionConfigs {
3395 pub(crate) fn new(
3396 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3397 ) -> Self {
3398 Self(RequestBuilder::new(stub))
3399 }
3400
3401 pub fn with_request<V: Into<crate::model::BatchUpdateGenerativeQuestionConfigsRequest>>(
3403 mut self,
3404 v: V,
3405 ) -> Self {
3406 self.0.request = v.into();
3407 self
3408 }
3409
3410 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3412 self.0.options = v.into();
3413 self
3414 }
3415
3416 pub async fn send(
3418 self,
3419 ) -> Result<crate::model::BatchUpdateGenerativeQuestionConfigsResponse> {
3420 (*self.0.stub)
3421 .batch_update_generative_question_configs(self.0.request, self.0.options)
3422 .await
3423 .map(crate::Response::into_body)
3424 }
3425
3426 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3428 self.0.request.parent = v.into();
3429 self
3430 }
3431
3432 pub fn set_requests<T, V>(mut self, v: T) -> Self
3436 where
3437 T: std::iter::IntoIterator<Item = V>,
3438 V: std::convert::Into<crate::model::UpdateGenerativeQuestionConfigRequest>,
3439 {
3440 use std::iter::Iterator;
3441 self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
3442 self
3443 }
3444 }
3445
3446 #[doc(hidden)]
3447 impl crate::RequestBuilder for BatchUpdateGenerativeQuestionConfigs {
3448 fn request_options(&mut self) -> &mut crate::RequestOptions {
3449 &mut self.0.options
3450 }
3451 }
3452
3453 #[derive(Clone, Debug)]
3474 pub struct ListOperations(
3475 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
3476 );
3477
3478 impl ListOperations {
3479 pub(crate) fn new(
3480 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3481 ) -> Self {
3482 Self(RequestBuilder::new(stub))
3483 }
3484
3485 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
3487 mut self,
3488 v: V,
3489 ) -> Self {
3490 self.0.request = v.into();
3491 self
3492 }
3493
3494 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3496 self.0.options = v.into();
3497 self
3498 }
3499
3500 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
3502 (*self.0.stub)
3503 .list_operations(self.0.request, self.0.options)
3504 .await
3505 .map(crate::Response::into_body)
3506 }
3507
3508 pub fn by_page(
3510 self,
3511 ) -> impl google_cloud_gax::paginator::Paginator<
3512 google_cloud_longrunning::model::ListOperationsResponse,
3513 crate::Error,
3514 > {
3515 use std::clone::Clone;
3516 let token = self.0.request.page_token.clone();
3517 let execute = move |token: String| {
3518 let mut builder = self.clone();
3519 builder.0.request = builder.0.request.set_page_token(token);
3520 builder.send()
3521 };
3522 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3523 }
3524
3525 pub fn by_item(
3527 self,
3528 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3529 google_cloud_longrunning::model::ListOperationsResponse,
3530 crate::Error,
3531 > {
3532 use google_cloud_gax::paginator::Paginator;
3533 self.by_page().items()
3534 }
3535
3536 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3538 self.0.request.name = v.into();
3539 self
3540 }
3541
3542 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3544 self.0.request.filter = v.into();
3545 self
3546 }
3547
3548 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3550 self.0.request.page_size = v.into();
3551 self
3552 }
3553
3554 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3556 self.0.request.page_token = v.into();
3557 self
3558 }
3559
3560 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3562 self.0.request.return_partial_success = v.into();
3563 self
3564 }
3565 }
3566
3567 #[doc(hidden)]
3568 impl crate::RequestBuilder for ListOperations {
3569 fn request_options(&mut self) -> &mut crate::RequestOptions {
3570 &mut self.0.options
3571 }
3572 }
3573
3574 #[derive(Clone, Debug)]
3591 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3592
3593 impl GetOperation {
3594 pub(crate) fn new(
3595 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3596 ) -> Self {
3597 Self(RequestBuilder::new(stub))
3598 }
3599
3600 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3602 mut self,
3603 v: V,
3604 ) -> Self {
3605 self.0.request = v.into();
3606 self
3607 }
3608
3609 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3611 self.0.options = v.into();
3612 self
3613 }
3614
3615 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3617 (*self.0.stub)
3618 .get_operation(self.0.request, self.0.options)
3619 .await
3620 .map(crate::Response::into_body)
3621 }
3622
3623 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3625 self.0.request.name = v.into();
3626 self
3627 }
3628 }
3629
3630 #[doc(hidden)]
3631 impl crate::RequestBuilder for GetOperation {
3632 fn request_options(&mut self) -> &mut crate::RequestOptions {
3633 &mut self.0.options
3634 }
3635 }
3636}
3637
3638pub mod model_service {
3639 use crate::Result;
3640
3641 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3655
3656 pub(crate) mod client {
3657 use super::super::super::client::ModelService;
3658 pub struct Factory;
3659 impl crate::ClientFactory for Factory {
3660 type Client = ModelService;
3661 type Credentials = gaxi::options::Credentials;
3662 async fn build(
3663 self,
3664 config: gaxi::options::ClientConfig,
3665 ) -> crate::ClientBuilderResult<Self::Client> {
3666 Self::Client::new(config).await
3667 }
3668 }
3669 }
3670
3671 #[derive(Clone, Debug)]
3673 pub(crate) struct RequestBuilder<R: std::default::Default> {
3674 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3675 request: R,
3676 options: crate::RequestOptions,
3677 }
3678
3679 impl<R> RequestBuilder<R>
3680 where
3681 R: std::default::Default,
3682 {
3683 pub(crate) fn new(
3684 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3685 ) -> Self {
3686 Self {
3687 stub,
3688 request: R::default(),
3689 options: crate::RequestOptions::default(),
3690 }
3691 }
3692 }
3693
3694 #[derive(Clone, Debug)]
3712 pub struct CreateModel(RequestBuilder<crate::model::CreateModelRequest>);
3713
3714 impl CreateModel {
3715 pub(crate) fn new(
3716 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3717 ) -> Self {
3718 Self(RequestBuilder::new(stub))
3719 }
3720
3721 pub fn with_request<V: Into<crate::model::CreateModelRequest>>(mut self, v: V) -> Self {
3723 self.0.request = v.into();
3724 self
3725 }
3726
3727 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3729 self.0.options = v.into();
3730 self
3731 }
3732
3733 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3740 (*self.0.stub)
3741 .create_model(self.0.request, self.0.options)
3742 .await
3743 .map(crate::Response::into_body)
3744 }
3745
3746 pub fn poller(
3748 self,
3749 ) -> impl google_cloud_lro::Poller<crate::model::Model, crate::model::CreateModelMetadata>
3750 {
3751 type Operation = google_cloud_lro::internal::Operation<
3752 crate::model::Model,
3753 crate::model::CreateModelMetadata,
3754 >;
3755 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3756 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3757
3758 let stub = self.0.stub.clone();
3759 let mut options = self.0.options.clone();
3760 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3761 let query = move |name| {
3762 let stub = stub.clone();
3763 let options = options.clone();
3764 async {
3765 let op = GetOperation::new(stub)
3766 .set_name(name)
3767 .with_options(options)
3768 .send()
3769 .await?;
3770 Ok(Operation::new(op))
3771 }
3772 };
3773
3774 let start = move || async {
3775 let op = self.send().await?;
3776 Ok(Operation::new(op))
3777 };
3778
3779 google_cloud_lro::internal::new_poller(
3780 polling_error_policy,
3781 polling_backoff_policy,
3782 start,
3783 query,
3784 )
3785 }
3786
3787 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3791 self.0.request.parent = v.into();
3792 self
3793 }
3794
3795 pub fn set_model<T>(mut self, v: T) -> Self
3799 where
3800 T: std::convert::Into<crate::model::Model>,
3801 {
3802 self.0.request.model = std::option::Option::Some(v.into());
3803 self
3804 }
3805
3806 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
3810 where
3811 T: std::convert::Into<crate::model::Model>,
3812 {
3813 self.0.request.model = v.map(|x| x.into());
3814 self
3815 }
3816
3817 pub fn set_dry_run<T: Into<bool>>(mut self, v: T) -> Self {
3819 self.0.request.dry_run = v.into();
3820 self
3821 }
3822 }
3823
3824 #[doc(hidden)]
3825 impl crate::RequestBuilder for CreateModel {
3826 fn request_options(&mut self) -> &mut crate::RequestOptions {
3827 &mut self.0.options
3828 }
3829 }
3830
3831 #[derive(Clone, Debug)]
3848 pub struct GetModel(RequestBuilder<crate::model::GetModelRequest>);
3849
3850 impl GetModel {
3851 pub(crate) fn new(
3852 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3853 ) -> Self {
3854 Self(RequestBuilder::new(stub))
3855 }
3856
3857 pub fn with_request<V: Into<crate::model::GetModelRequest>>(mut self, v: V) -> Self {
3859 self.0.request = v.into();
3860 self
3861 }
3862
3863 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3865 self.0.options = v.into();
3866 self
3867 }
3868
3869 pub async fn send(self) -> Result<crate::model::Model> {
3871 (*self.0.stub)
3872 .get_model(self.0.request, self.0.options)
3873 .await
3874 .map(crate::Response::into_body)
3875 }
3876
3877 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3881 self.0.request.name = v.into();
3882 self
3883 }
3884 }
3885
3886 #[doc(hidden)]
3887 impl crate::RequestBuilder for GetModel {
3888 fn request_options(&mut self) -> &mut crate::RequestOptions {
3889 &mut self.0.options
3890 }
3891 }
3892
3893 #[derive(Clone, Debug)]
3910 pub struct PauseModel(RequestBuilder<crate::model::PauseModelRequest>);
3911
3912 impl PauseModel {
3913 pub(crate) fn new(
3914 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3915 ) -> Self {
3916 Self(RequestBuilder::new(stub))
3917 }
3918
3919 pub fn with_request<V: Into<crate::model::PauseModelRequest>>(mut self, v: V) -> Self {
3921 self.0.request = v.into();
3922 self
3923 }
3924
3925 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3927 self.0.options = v.into();
3928 self
3929 }
3930
3931 pub async fn send(self) -> Result<crate::model::Model> {
3933 (*self.0.stub)
3934 .pause_model(self.0.request, self.0.options)
3935 .await
3936 .map(crate::Response::into_body)
3937 }
3938
3939 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3943 self.0.request.name = v.into();
3944 self
3945 }
3946 }
3947
3948 #[doc(hidden)]
3949 impl crate::RequestBuilder for PauseModel {
3950 fn request_options(&mut self) -> &mut crate::RequestOptions {
3951 &mut self.0.options
3952 }
3953 }
3954
3955 #[derive(Clone, Debug)]
3972 pub struct ResumeModel(RequestBuilder<crate::model::ResumeModelRequest>);
3973
3974 impl ResumeModel {
3975 pub(crate) fn new(
3976 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3977 ) -> Self {
3978 Self(RequestBuilder::new(stub))
3979 }
3980
3981 pub fn with_request<V: Into<crate::model::ResumeModelRequest>>(mut self, v: V) -> Self {
3983 self.0.request = v.into();
3984 self
3985 }
3986
3987 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3989 self.0.options = v.into();
3990 self
3991 }
3992
3993 pub async fn send(self) -> Result<crate::model::Model> {
3995 (*self.0.stub)
3996 .resume_model(self.0.request, self.0.options)
3997 .await
3998 .map(crate::Response::into_body)
3999 }
4000
4001 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4005 self.0.request.name = v.into();
4006 self
4007 }
4008 }
4009
4010 #[doc(hidden)]
4011 impl crate::RequestBuilder for ResumeModel {
4012 fn request_options(&mut self) -> &mut crate::RequestOptions {
4013 &mut self.0.options
4014 }
4015 }
4016
4017 #[derive(Clone, Debug)]
4034 pub struct DeleteModel(RequestBuilder<crate::model::DeleteModelRequest>);
4035
4036 impl DeleteModel {
4037 pub(crate) fn new(
4038 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4039 ) -> Self {
4040 Self(RequestBuilder::new(stub))
4041 }
4042
4043 pub fn with_request<V: Into<crate::model::DeleteModelRequest>>(mut self, v: V) -> Self {
4045 self.0.request = v.into();
4046 self
4047 }
4048
4049 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4051 self.0.options = v.into();
4052 self
4053 }
4054
4055 pub async fn send(self) -> Result<()> {
4057 (*self.0.stub)
4058 .delete_model(self.0.request, self.0.options)
4059 .await
4060 .map(crate::Response::into_body)
4061 }
4062
4063 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4067 self.0.request.name = v.into();
4068 self
4069 }
4070 }
4071
4072 #[doc(hidden)]
4073 impl crate::RequestBuilder for DeleteModel {
4074 fn request_options(&mut self) -> &mut crate::RequestOptions {
4075 &mut self.0.options
4076 }
4077 }
4078
4079 #[derive(Clone, Debug)]
4100 pub struct ListModels(RequestBuilder<crate::model::ListModelsRequest>);
4101
4102 impl ListModels {
4103 pub(crate) fn new(
4104 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4105 ) -> Self {
4106 Self(RequestBuilder::new(stub))
4107 }
4108
4109 pub fn with_request<V: Into<crate::model::ListModelsRequest>>(mut self, v: V) -> Self {
4111 self.0.request = v.into();
4112 self
4113 }
4114
4115 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4117 self.0.options = v.into();
4118 self
4119 }
4120
4121 pub async fn send(self) -> Result<crate::model::ListModelsResponse> {
4123 (*self.0.stub)
4124 .list_models(self.0.request, self.0.options)
4125 .await
4126 .map(crate::Response::into_body)
4127 }
4128
4129 pub fn by_page(
4131 self,
4132 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListModelsResponse, crate::Error>
4133 {
4134 use std::clone::Clone;
4135 let token = self.0.request.page_token.clone();
4136 let execute = move |token: String| {
4137 let mut builder = self.clone();
4138 builder.0.request = builder.0.request.set_page_token(token);
4139 builder.send()
4140 };
4141 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4142 }
4143
4144 pub fn by_item(
4146 self,
4147 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4148 crate::model::ListModelsResponse,
4149 crate::Error,
4150 > {
4151 use google_cloud_gax::paginator::Paginator;
4152 self.by_page().items()
4153 }
4154
4155 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4159 self.0.request.parent = v.into();
4160 self
4161 }
4162
4163 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4165 self.0.request.page_size = v.into();
4166 self
4167 }
4168
4169 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4171 self.0.request.page_token = v.into();
4172 self
4173 }
4174 }
4175
4176 #[doc(hidden)]
4177 impl crate::RequestBuilder for ListModels {
4178 fn request_options(&mut self) -> &mut crate::RequestOptions {
4179 &mut self.0.options
4180 }
4181 }
4182
4183 #[derive(Clone, Debug)]
4200 pub struct UpdateModel(RequestBuilder<crate::model::UpdateModelRequest>);
4201
4202 impl UpdateModel {
4203 pub(crate) fn new(
4204 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4205 ) -> Self {
4206 Self(RequestBuilder::new(stub))
4207 }
4208
4209 pub fn with_request<V: Into<crate::model::UpdateModelRequest>>(mut self, v: V) -> Self {
4211 self.0.request = v.into();
4212 self
4213 }
4214
4215 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4217 self.0.options = v.into();
4218 self
4219 }
4220
4221 pub async fn send(self) -> Result<crate::model::Model> {
4223 (*self.0.stub)
4224 .update_model(self.0.request, self.0.options)
4225 .await
4226 .map(crate::Response::into_body)
4227 }
4228
4229 pub fn set_model<T>(mut self, v: T) -> Self
4233 where
4234 T: std::convert::Into<crate::model::Model>,
4235 {
4236 self.0.request.model = std::option::Option::Some(v.into());
4237 self
4238 }
4239
4240 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
4244 where
4245 T: std::convert::Into<crate::model::Model>,
4246 {
4247 self.0.request.model = v.map(|x| x.into());
4248 self
4249 }
4250
4251 pub fn set_update_mask<T>(mut self, v: T) -> Self
4253 where
4254 T: std::convert::Into<wkt::FieldMask>,
4255 {
4256 self.0.request.update_mask = std::option::Option::Some(v.into());
4257 self
4258 }
4259
4260 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4262 where
4263 T: std::convert::Into<wkt::FieldMask>,
4264 {
4265 self.0.request.update_mask = v.map(|x| x.into());
4266 self
4267 }
4268 }
4269
4270 #[doc(hidden)]
4271 impl crate::RequestBuilder for UpdateModel {
4272 fn request_options(&mut self) -> &mut crate::RequestOptions {
4273 &mut self.0.options
4274 }
4275 }
4276
4277 #[derive(Clone, Debug)]
4295 pub struct TuneModel(RequestBuilder<crate::model::TuneModelRequest>);
4296
4297 impl TuneModel {
4298 pub(crate) fn new(
4299 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4300 ) -> Self {
4301 Self(RequestBuilder::new(stub))
4302 }
4303
4304 pub fn with_request<V: Into<crate::model::TuneModelRequest>>(mut self, v: V) -> Self {
4306 self.0.request = v.into();
4307 self
4308 }
4309
4310 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4312 self.0.options = v.into();
4313 self
4314 }
4315
4316 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4323 (*self.0.stub)
4324 .tune_model(self.0.request, self.0.options)
4325 .await
4326 .map(crate::Response::into_body)
4327 }
4328
4329 pub fn poller(
4331 self,
4332 ) -> impl google_cloud_lro::Poller<
4333 crate::model::TuneModelResponse,
4334 crate::model::TuneModelMetadata,
4335 > {
4336 type Operation = google_cloud_lro::internal::Operation<
4337 crate::model::TuneModelResponse,
4338 crate::model::TuneModelMetadata,
4339 >;
4340 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4341 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4342
4343 let stub = self.0.stub.clone();
4344 let mut options = self.0.options.clone();
4345 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4346 let query = move |name| {
4347 let stub = stub.clone();
4348 let options = options.clone();
4349 async {
4350 let op = GetOperation::new(stub)
4351 .set_name(name)
4352 .with_options(options)
4353 .send()
4354 .await?;
4355 Ok(Operation::new(op))
4356 }
4357 };
4358
4359 let start = move || async {
4360 let op = self.send().await?;
4361 Ok(Operation::new(op))
4362 };
4363
4364 google_cloud_lro::internal::new_poller(
4365 polling_error_policy,
4366 polling_backoff_policy,
4367 start,
4368 query,
4369 )
4370 }
4371
4372 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4376 self.0.request.name = v.into();
4377 self
4378 }
4379 }
4380
4381 #[doc(hidden)]
4382 impl crate::RequestBuilder for TuneModel {
4383 fn request_options(&mut self) -> &mut crate::RequestOptions {
4384 &mut self.0.options
4385 }
4386 }
4387
4388 #[derive(Clone, Debug)]
4409 pub struct ListOperations(
4410 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4411 );
4412
4413 impl ListOperations {
4414 pub(crate) fn new(
4415 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4416 ) -> Self {
4417 Self(RequestBuilder::new(stub))
4418 }
4419
4420 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4422 mut self,
4423 v: V,
4424 ) -> Self {
4425 self.0.request = v.into();
4426 self
4427 }
4428
4429 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4431 self.0.options = v.into();
4432 self
4433 }
4434
4435 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4437 (*self.0.stub)
4438 .list_operations(self.0.request, self.0.options)
4439 .await
4440 .map(crate::Response::into_body)
4441 }
4442
4443 pub fn by_page(
4445 self,
4446 ) -> impl google_cloud_gax::paginator::Paginator<
4447 google_cloud_longrunning::model::ListOperationsResponse,
4448 crate::Error,
4449 > {
4450 use std::clone::Clone;
4451 let token = self.0.request.page_token.clone();
4452 let execute = move |token: String| {
4453 let mut builder = self.clone();
4454 builder.0.request = builder.0.request.set_page_token(token);
4455 builder.send()
4456 };
4457 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4458 }
4459
4460 pub fn by_item(
4462 self,
4463 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4464 google_cloud_longrunning::model::ListOperationsResponse,
4465 crate::Error,
4466 > {
4467 use google_cloud_gax::paginator::Paginator;
4468 self.by_page().items()
4469 }
4470
4471 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4473 self.0.request.name = v.into();
4474 self
4475 }
4476
4477 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4479 self.0.request.filter = v.into();
4480 self
4481 }
4482
4483 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4485 self.0.request.page_size = v.into();
4486 self
4487 }
4488
4489 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4491 self.0.request.page_token = v.into();
4492 self
4493 }
4494
4495 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4497 self.0.request.return_partial_success = v.into();
4498 self
4499 }
4500 }
4501
4502 #[doc(hidden)]
4503 impl crate::RequestBuilder for ListOperations {
4504 fn request_options(&mut self) -> &mut crate::RequestOptions {
4505 &mut self.0.options
4506 }
4507 }
4508
4509 #[derive(Clone, Debug)]
4526 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4527
4528 impl GetOperation {
4529 pub(crate) fn new(
4530 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4531 ) -> Self {
4532 Self(RequestBuilder::new(stub))
4533 }
4534
4535 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4537 mut self,
4538 v: V,
4539 ) -> Self {
4540 self.0.request = v.into();
4541 self
4542 }
4543
4544 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4546 self.0.options = v.into();
4547 self
4548 }
4549
4550 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4552 (*self.0.stub)
4553 .get_operation(self.0.request, self.0.options)
4554 .await
4555 .map(crate::Response::into_body)
4556 }
4557
4558 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4560 self.0.request.name = v.into();
4561 self
4562 }
4563 }
4564
4565 #[doc(hidden)]
4566 impl crate::RequestBuilder for GetOperation {
4567 fn request_options(&mut self) -> &mut crate::RequestOptions {
4568 &mut self.0.options
4569 }
4570 }
4571}
4572
4573pub mod prediction_service {
4574 use crate::Result;
4575
4576 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4590
4591 pub(crate) mod client {
4592 use super::super::super::client::PredictionService;
4593 pub struct Factory;
4594 impl crate::ClientFactory for Factory {
4595 type Client = PredictionService;
4596 type Credentials = gaxi::options::Credentials;
4597 async fn build(
4598 self,
4599 config: gaxi::options::ClientConfig,
4600 ) -> crate::ClientBuilderResult<Self::Client> {
4601 Self::Client::new(config).await
4602 }
4603 }
4604 }
4605
4606 #[derive(Clone, Debug)]
4608 pub(crate) struct RequestBuilder<R: std::default::Default> {
4609 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4610 request: R,
4611 options: crate::RequestOptions,
4612 }
4613
4614 impl<R> RequestBuilder<R>
4615 where
4616 R: std::default::Default,
4617 {
4618 pub(crate) fn new(
4619 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4620 ) -> Self {
4621 Self {
4622 stub,
4623 request: R::default(),
4624 options: crate::RequestOptions::default(),
4625 }
4626 }
4627 }
4628
4629 #[derive(Clone, Debug)]
4646 pub struct Predict(RequestBuilder<crate::model::PredictRequest>);
4647
4648 impl Predict {
4649 pub(crate) fn new(
4650 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4651 ) -> Self {
4652 Self(RequestBuilder::new(stub))
4653 }
4654
4655 pub fn with_request<V: Into<crate::model::PredictRequest>>(mut self, v: V) -> Self {
4657 self.0.request = v.into();
4658 self
4659 }
4660
4661 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4663 self.0.options = v.into();
4664 self
4665 }
4666
4667 pub async fn send(self) -> Result<crate::model::PredictResponse> {
4669 (*self.0.stub)
4670 .predict(self.0.request, self.0.options)
4671 .await
4672 .map(crate::Response::into_body)
4673 }
4674
4675 pub fn set_placement<T: Into<std::string::String>>(mut self, v: T) -> Self {
4679 self.0.request.placement = v.into();
4680 self
4681 }
4682
4683 pub fn set_user_event<T>(mut self, v: T) -> Self
4687 where
4688 T: std::convert::Into<crate::model::UserEvent>,
4689 {
4690 self.0.request.user_event = std::option::Option::Some(v.into());
4691 self
4692 }
4693
4694 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
4698 where
4699 T: std::convert::Into<crate::model::UserEvent>,
4700 {
4701 self.0.request.user_event = v.map(|x| x.into());
4702 self
4703 }
4704
4705 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4707 self.0.request.page_size = v.into();
4708 self
4709 }
4710
4711 #[deprecated]
4713 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4714 self.0.request.page_token = v.into();
4715 self
4716 }
4717
4718 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4720 self.0.request.filter = v.into();
4721 self
4722 }
4723
4724 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4726 self.0.request.validate_only = v.into();
4727 self
4728 }
4729
4730 pub fn set_params<T, K, V>(mut self, v: T) -> Self
4732 where
4733 T: std::iter::IntoIterator<Item = (K, V)>,
4734 K: std::convert::Into<std::string::String>,
4735 V: std::convert::Into<wkt::Value>,
4736 {
4737 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4738 self
4739 }
4740
4741 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4743 where
4744 T: std::iter::IntoIterator<Item = (K, V)>,
4745 K: std::convert::Into<std::string::String>,
4746 V: std::convert::Into<std::string::String>,
4747 {
4748 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4749 self
4750 }
4751 }
4752
4753 #[doc(hidden)]
4754 impl crate::RequestBuilder for Predict {
4755 fn request_options(&mut self) -> &mut crate::RequestOptions {
4756 &mut self.0.options
4757 }
4758 }
4759
4760 #[derive(Clone, Debug)]
4781 pub struct ListOperations(
4782 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4783 );
4784
4785 impl ListOperations {
4786 pub(crate) fn new(
4787 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4788 ) -> Self {
4789 Self(RequestBuilder::new(stub))
4790 }
4791
4792 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4794 mut self,
4795 v: V,
4796 ) -> Self {
4797 self.0.request = v.into();
4798 self
4799 }
4800
4801 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4803 self.0.options = v.into();
4804 self
4805 }
4806
4807 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4809 (*self.0.stub)
4810 .list_operations(self.0.request, self.0.options)
4811 .await
4812 .map(crate::Response::into_body)
4813 }
4814
4815 pub fn by_page(
4817 self,
4818 ) -> impl google_cloud_gax::paginator::Paginator<
4819 google_cloud_longrunning::model::ListOperationsResponse,
4820 crate::Error,
4821 > {
4822 use std::clone::Clone;
4823 let token = self.0.request.page_token.clone();
4824 let execute = move |token: String| {
4825 let mut builder = self.clone();
4826 builder.0.request = builder.0.request.set_page_token(token);
4827 builder.send()
4828 };
4829 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4830 }
4831
4832 pub fn by_item(
4834 self,
4835 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4836 google_cloud_longrunning::model::ListOperationsResponse,
4837 crate::Error,
4838 > {
4839 use google_cloud_gax::paginator::Paginator;
4840 self.by_page().items()
4841 }
4842
4843 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4845 self.0.request.name = v.into();
4846 self
4847 }
4848
4849 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4851 self.0.request.filter = v.into();
4852 self
4853 }
4854
4855 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4857 self.0.request.page_size = v.into();
4858 self
4859 }
4860
4861 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4863 self.0.request.page_token = v.into();
4864 self
4865 }
4866
4867 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4869 self.0.request.return_partial_success = v.into();
4870 self
4871 }
4872 }
4873
4874 #[doc(hidden)]
4875 impl crate::RequestBuilder for ListOperations {
4876 fn request_options(&mut self) -> &mut crate::RequestOptions {
4877 &mut self.0.options
4878 }
4879 }
4880
4881 #[derive(Clone, Debug)]
4898 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4899
4900 impl GetOperation {
4901 pub(crate) fn new(
4902 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4903 ) -> Self {
4904 Self(RequestBuilder::new(stub))
4905 }
4906
4907 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4909 mut self,
4910 v: V,
4911 ) -> Self {
4912 self.0.request = v.into();
4913 self
4914 }
4915
4916 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4918 self.0.options = v.into();
4919 self
4920 }
4921
4922 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4924 (*self.0.stub)
4925 .get_operation(self.0.request, self.0.options)
4926 .await
4927 .map(crate::Response::into_body)
4928 }
4929
4930 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4932 self.0.request.name = v.into();
4933 self
4934 }
4935 }
4936
4937 #[doc(hidden)]
4938 impl crate::RequestBuilder for GetOperation {
4939 fn request_options(&mut self) -> &mut crate::RequestOptions {
4940 &mut self.0.options
4941 }
4942 }
4943}
4944
4945pub mod product_service {
4946 use crate::Result;
4947
4948 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4962
4963 pub(crate) mod client {
4964 use super::super::super::client::ProductService;
4965 pub struct Factory;
4966 impl crate::ClientFactory for Factory {
4967 type Client = ProductService;
4968 type Credentials = gaxi::options::Credentials;
4969 async fn build(
4970 self,
4971 config: gaxi::options::ClientConfig,
4972 ) -> crate::ClientBuilderResult<Self::Client> {
4973 Self::Client::new(config).await
4974 }
4975 }
4976 }
4977
4978 #[derive(Clone, Debug)]
4980 pub(crate) struct RequestBuilder<R: std::default::Default> {
4981 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
4982 request: R,
4983 options: crate::RequestOptions,
4984 }
4985
4986 impl<R> RequestBuilder<R>
4987 where
4988 R: std::default::Default,
4989 {
4990 pub(crate) fn new(
4991 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
4992 ) -> Self {
4993 Self {
4994 stub,
4995 request: R::default(),
4996 options: crate::RequestOptions::default(),
4997 }
4998 }
4999 }
5000
5001 #[derive(Clone, Debug)]
5018 pub struct CreateProduct(RequestBuilder<crate::model::CreateProductRequest>);
5019
5020 impl CreateProduct {
5021 pub(crate) fn new(
5022 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5023 ) -> Self {
5024 Self(RequestBuilder::new(stub))
5025 }
5026
5027 pub fn with_request<V: Into<crate::model::CreateProductRequest>>(mut self, v: V) -> Self {
5029 self.0.request = v.into();
5030 self
5031 }
5032
5033 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5035 self.0.options = v.into();
5036 self
5037 }
5038
5039 pub async fn send(self) -> Result<crate::model::Product> {
5041 (*self.0.stub)
5042 .create_product(self.0.request, self.0.options)
5043 .await
5044 .map(crate::Response::into_body)
5045 }
5046
5047 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5051 self.0.request.parent = v.into();
5052 self
5053 }
5054
5055 pub fn set_product<T>(mut self, v: T) -> Self
5059 where
5060 T: std::convert::Into<crate::model::Product>,
5061 {
5062 self.0.request.product = std::option::Option::Some(v.into());
5063 self
5064 }
5065
5066 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
5070 where
5071 T: std::convert::Into<crate::model::Product>,
5072 {
5073 self.0.request.product = v.map(|x| x.into());
5074 self
5075 }
5076
5077 pub fn set_product_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5081 self.0.request.product_id = v.into();
5082 self
5083 }
5084 }
5085
5086 #[doc(hidden)]
5087 impl crate::RequestBuilder for CreateProduct {
5088 fn request_options(&mut self) -> &mut crate::RequestOptions {
5089 &mut self.0.options
5090 }
5091 }
5092
5093 #[derive(Clone, Debug)]
5110 pub struct GetProduct(RequestBuilder<crate::model::GetProductRequest>);
5111
5112 impl GetProduct {
5113 pub(crate) fn new(
5114 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5115 ) -> Self {
5116 Self(RequestBuilder::new(stub))
5117 }
5118
5119 pub fn with_request<V: Into<crate::model::GetProductRequest>>(mut self, v: V) -> Self {
5121 self.0.request = v.into();
5122 self
5123 }
5124
5125 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5127 self.0.options = v.into();
5128 self
5129 }
5130
5131 pub async fn send(self) -> Result<crate::model::Product> {
5133 (*self.0.stub)
5134 .get_product(self.0.request, self.0.options)
5135 .await
5136 .map(crate::Response::into_body)
5137 }
5138
5139 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5143 self.0.request.name = v.into();
5144 self
5145 }
5146 }
5147
5148 #[doc(hidden)]
5149 impl crate::RequestBuilder for GetProduct {
5150 fn request_options(&mut self) -> &mut crate::RequestOptions {
5151 &mut self.0.options
5152 }
5153 }
5154
5155 #[derive(Clone, Debug)]
5176 pub struct ListProducts(RequestBuilder<crate::model::ListProductsRequest>);
5177
5178 impl ListProducts {
5179 pub(crate) fn new(
5180 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5181 ) -> Self {
5182 Self(RequestBuilder::new(stub))
5183 }
5184
5185 pub fn with_request<V: Into<crate::model::ListProductsRequest>>(mut self, v: V) -> Self {
5187 self.0.request = v.into();
5188 self
5189 }
5190
5191 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5193 self.0.options = v.into();
5194 self
5195 }
5196
5197 pub async fn send(self) -> Result<crate::model::ListProductsResponse> {
5199 (*self.0.stub)
5200 .list_products(self.0.request, self.0.options)
5201 .await
5202 .map(crate::Response::into_body)
5203 }
5204
5205 pub fn by_page(
5207 self,
5208 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListProductsResponse, crate::Error>
5209 {
5210 use std::clone::Clone;
5211 let token = self.0.request.page_token.clone();
5212 let execute = move |token: String| {
5213 let mut builder = self.clone();
5214 builder.0.request = builder.0.request.set_page_token(token);
5215 builder.send()
5216 };
5217 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5218 }
5219
5220 pub fn by_item(
5222 self,
5223 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5224 crate::model::ListProductsResponse,
5225 crate::Error,
5226 > {
5227 use google_cloud_gax::paginator::Paginator;
5228 self.by_page().items()
5229 }
5230
5231 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5235 self.0.request.parent = v.into();
5236 self
5237 }
5238
5239 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5241 self.0.request.page_size = v.into();
5242 self
5243 }
5244
5245 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5247 self.0.request.page_token = v.into();
5248 self
5249 }
5250
5251 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5253 self.0.request.filter = v.into();
5254 self
5255 }
5256
5257 pub fn set_read_mask<T>(mut self, v: T) -> Self
5259 where
5260 T: std::convert::Into<wkt::FieldMask>,
5261 {
5262 self.0.request.read_mask = std::option::Option::Some(v.into());
5263 self
5264 }
5265
5266 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
5268 where
5269 T: std::convert::Into<wkt::FieldMask>,
5270 {
5271 self.0.request.read_mask = v.map(|x| x.into());
5272 self
5273 }
5274 }
5275
5276 #[doc(hidden)]
5277 impl crate::RequestBuilder for ListProducts {
5278 fn request_options(&mut self) -> &mut crate::RequestOptions {
5279 &mut self.0.options
5280 }
5281 }
5282
5283 #[derive(Clone, Debug)]
5300 pub struct UpdateProduct(RequestBuilder<crate::model::UpdateProductRequest>);
5301
5302 impl UpdateProduct {
5303 pub(crate) fn new(
5304 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5305 ) -> Self {
5306 Self(RequestBuilder::new(stub))
5307 }
5308
5309 pub fn with_request<V: Into<crate::model::UpdateProductRequest>>(mut self, v: V) -> Self {
5311 self.0.request = v.into();
5312 self
5313 }
5314
5315 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5317 self.0.options = v.into();
5318 self
5319 }
5320
5321 pub async fn send(self) -> Result<crate::model::Product> {
5323 (*self.0.stub)
5324 .update_product(self.0.request, self.0.options)
5325 .await
5326 .map(crate::Response::into_body)
5327 }
5328
5329 pub fn set_product<T>(mut self, v: T) -> Self
5333 where
5334 T: std::convert::Into<crate::model::Product>,
5335 {
5336 self.0.request.product = std::option::Option::Some(v.into());
5337 self
5338 }
5339
5340 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
5344 where
5345 T: std::convert::Into<crate::model::Product>,
5346 {
5347 self.0.request.product = v.map(|x| x.into());
5348 self
5349 }
5350
5351 pub fn set_update_mask<T>(mut self, v: T) -> Self
5353 where
5354 T: std::convert::Into<wkt::FieldMask>,
5355 {
5356 self.0.request.update_mask = std::option::Option::Some(v.into());
5357 self
5358 }
5359
5360 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5362 where
5363 T: std::convert::Into<wkt::FieldMask>,
5364 {
5365 self.0.request.update_mask = v.map(|x| x.into());
5366 self
5367 }
5368
5369 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5371 self.0.request.allow_missing = v.into();
5372 self
5373 }
5374 }
5375
5376 #[doc(hidden)]
5377 impl crate::RequestBuilder for UpdateProduct {
5378 fn request_options(&mut self) -> &mut crate::RequestOptions {
5379 &mut self.0.options
5380 }
5381 }
5382
5383 #[derive(Clone, Debug)]
5400 pub struct DeleteProduct(RequestBuilder<crate::model::DeleteProductRequest>);
5401
5402 impl DeleteProduct {
5403 pub(crate) fn new(
5404 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5405 ) -> Self {
5406 Self(RequestBuilder::new(stub))
5407 }
5408
5409 pub fn with_request<V: Into<crate::model::DeleteProductRequest>>(mut self, v: V) -> Self {
5411 self.0.request = v.into();
5412 self
5413 }
5414
5415 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5417 self.0.options = v.into();
5418 self
5419 }
5420
5421 pub async fn send(self) -> Result<()> {
5423 (*self.0.stub)
5424 .delete_product(self.0.request, self.0.options)
5425 .await
5426 .map(crate::Response::into_body)
5427 }
5428
5429 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5433 self.0.request.name = v.into();
5434 self
5435 }
5436 }
5437
5438 #[doc(hidden)]
5439 impl crate::RequestBuilder for DeleteProduct {
5440 fn request_options(&mut self) -> &mut crate::RequestOptions {
5441 &mut self.0.options
5442 }
5443 }
5444
5445 #[derive(Clone, Debug)]
5463 pub struct PurgeProducts(RequestBuilder<crate::model::PurgeProductsRequest>);
5464
5465 impl PurgeProducts {
5466 pub(crate) fn new(
5467 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5468 ) -> Self {
5469 Self(RequestBuilder::new(stub))
5470 }
5471
5472 pub fn with_request<V: Into<crate::model::PurgeProductsRequest>>(mut self, v: V) -> Self {
5474 self.0.request = v.into();
5475 self
5476 }
5477
5478 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5480 self.0.options = v.into();
5481 self
5482 }
5483
5484 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5491 (*self.0.stub)
5492 .purge_products(self.0.request, self.0.options)
5493 .await
5494 .map(crate::Response::into_body)
5495 }
5496
5497 pub fn poller(
5499 self,
5500 ) -> impl google_cloud_lro::Poller<
5501 crate::model::PurgeProductsResponse,
5502 crate::model::PurgeProductsMetadata,
5503 > {
5504 type Operation = google_cloud_lro::internal::Operation<
5505 crate::model::PurgeProductsResponse,
5506 crate::model::PurgeProductsMetadata,
5507 >;
5508 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5509 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5510
5511 let stub = self.0.stub.clone();
5512 let mut options = self.0.options.clone();
5513 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5514 let query = move |name| {
5515 let stub = stub.clone();
5516 let options = options.clone();
5517 async {
5518 let op = GetOperation::new(stub)
5519 .set_name(name)
5520 .with_options(options)
5521 .send()
5522 .await?;
5523 Ok(Operation::new(op))
5524 }
5525 };
5526
5527 let start = move || async {
5528 let op = self.send().await?;
5529 Ok(Operation::new(op))
5530 };
5531
5532 google_cloud_lro::internal::new_poller(
5533 polling_error_policy,
5534 polling_backoff_policy,
5535 start,
5536 query,
5537 )
5538 }
5539
5540 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5544 self.0.request.parent = v.into();
5545 self
5546 }
5547
5548 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5552 self.0.request.filter = v.into();
5553 self
5554 }
5555
5556 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
5558 self.0.request.force = v.into();
5559 self
5560 }
5561 }
5562
5563 #[doc(hidden)]
5564 impl crate::RequestBuilder for PurgeProducts {
5565 fn request_options(&mut self) -> &mut crate::RequestOptions {
5566 &mut self.0.options
5567 }
5568 }
5569
5570 #[derive(Clone, Debug)]
5588 pub struct ImportProducts(RequestBuilder<crate::model::ImportProductsRequest>);
5589
5590 impl ImportProducts {
5591 pub(crate) fn new(
5592 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5593 ) -> Self {
5594 Self(RequestBuilder::new(stub))
5595 }
5596
5597 pub fn with_request<V: Into<crate::model::ImportProductsRequest>>(mut self, v: V) -> Self {
5599 self.0.request = v.into();
5600 self
5601 }
5602
5603 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5605 self.0.options = v.into();
5606 self
5607 }
5608
5609 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5616 (*self.0.stub)
5617 .import_products(self.0.request, self.0.options)
5618 .await
5619 .map(crate::Response::into_body)
5620 }
5621
5622 pub fn poller(
5624 self,
5625 ) -> impl google_cloud_lro::Poller<
5626 crate::model::ImportProductsResponse,
5627 crate::model::ImportMetadata,
5628 > {
5629 type Operation = google_cloud_lro::internal::Operation<
5630 crate::model::ImportProductsResponse,
5631 crate::model::ImportMetadata,
5632 >;
5633 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5634 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5635
5636 let stub = self.0.stub.clone();
5637 let mut options = self.0.options.clone();
5638 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5639 let query = move |name| {
5640 let stub = stub.clone();
5641 let options = options.clone();
5642 async {
5643 let op = GetOperation::new(stub)
5644 .set_name(name)
5645 .with_options(options)
5646 .send()
5647 .await?;
5648 Ok(Operation::new(op))
5649 }
5650 };
5651
5652 let start = move || async {
5653 let op = self.send().await?;
5654 Ok(Operation::new(op))
5655 };
5656
5657 google_cloud_lro::internal::new_poller(
5658 polling_error_policy,
5659 polling_backoff_policy,
5660 start,
5661 query,
5662 )
5663 }
5664
5665 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5669 self.0.request.parent = v.into();
5670 self
5671 }
5672
5673 #[deprecated]
5675 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5676 self.0.request.request_id = v.into();
5677 self
5678 }
5679
5680 pub fn set_input_config<T>(mut self, v: T) -> Self
5684 where
5685 T: std::convert::Into<crate::model::ProductInputConfig>,
5686 {
5687 self.0.request.input_config = std::option::Option::Some(v.into());
5688 self
5689 }
5690
5691 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
5695 where
5696 T: std::convert::Into<crate::model::ProductInputConfig>,
5697 {
5698 self.0.request.input_config = v.map(|x| x.into());
5699 self
5700 }
5701
5702 pub fn set_errors_config<T>(mut self, v: T) -> Self
5704 where
5705 T: std::convert::Into<crate::model::ImportErrorsConfig>,
5706 {
5707 self.0.request.errors_config = std::option::Option::Some(v.into());
5708 self
5709 }
5710
5711 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
5713 where
5714 T: std::convert::Into<crate::model::ImportErrorsConfig>,
5715 {
5716 self.0.request.errors_config = v.map(|x| x.into());
5717 self
5718 }
5719
5720 pub fn set_update_mask<T>(mut self, v: T) -> Self
5722 where
5723 T: std::convert::Into<wkt::FieldMask>,
5724 {
5725 self.0.request.update_mask = std::option::Option::Some(v.into());
5726 self
5727 }
5728
5729 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5731 where
5732 T: std::convert::Into<wkt::FieldMask>,
5733 {
5734 self.0.request.update_mask = v.map(|x| x.into());
5735 self
5736 }
5737
5738 pub fn set_reconciliation_mode<
5740 T: Into<crate::model::import_products_request::ReconciliationMode>,
5741 >(
5742 mut self,
5743 v: T,
5744 ) -> Self {
5745 self.0.request.reconciliation_mode = v.into();
5746 self
5747 }
5748
5749 pub fn set_notification_pubsub_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
5751 self.0.request.notification_pubsub_topic = v.into();
5752 self
5753 }
5754 }
5755
5756 #[doc(hidden)]
5757 impl crate::RequestBuilder for ImportProducts {
5758 fn request_options(&mut self) -> &mut crate::RequestOptions {
5759 &mut self.0.options
5760 }
5761 }
5762
5763 #[derive(Clone, Debug)]
5781 pub struct SetInventory(RequestBuilder<crate::model::SetInventoryRequest>);
5782
5783 impl SetInventory {
5784 pub(crate) fn new(
5785 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5786 ) -> Self {
5787 Self(RequestBuilder::new(stub))
5788 }
5789
5790 pub fn with_request<V: Into<crate::model::SetInventoryRequest>>(mut self, v: V) -> Self {
5792 self.0.request = v.into();
5793 self
5794 }
5795
5796 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5798 self.0.options = v.into();
5799 self
5800 }
5801
5802 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5809 (*self.0.stub)
5810 .set_inventory(self.0.request, self.0.options)
5811 .await
5812 .map(crate::Response::into_body)
5813 }
5814
5815 pub fn poller(
5817 self,
5818 ) -> impl google_cloud_lro::Poller<
5819 crate::model::SetInventoryResponse,
5820 crate::model::SetInventoryMetadata,
5821 > {
5822 type Operation = google_cloud_lro::internal::Operation<
5823 crate::model::SetInventoryResponse,
5824 crate::model::SetInventoryMetadata,
5825 >;
5826 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5827 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5828
5829 let stub = self.0.stub.clone();
5830 let mut options = self.0.options.clone();
5831 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5832 let query = move |name| {
5833 let stub = stub.clone();
5834 let options = options.clone();
5835 async {
5836 let op = GetOperation::new(stub)
5837 .set_name(name)
5838 .with_options(options)
5839 .send()
5840 .await?;
5841 Ok(Operation::new(op))
5842 }
5843 };
5844
5845 let start = move || async {
5846 let op = self.send().await?;
5847 Ok(Operation::new(op))
5848 };
5849
5850 google_cloud_lro::internal::new_poller(
5851 polling_error_policy,
5852 polling_backoff_policy,
5853 start,
5854 query,
5855 )
5856 }
5857
5858 pub fn set_inventory<T>(mut self, v: T) -> Self
5862 where
5863 T: std::convert::Into<crate::model::Product>,
5864 {
5865 self.0.request.inventory = std::option::Option::Some(v.into());
5866 self
5867 }
5868
5869 pub fn set_or_clear_inventory<T>(mut self, v: std::option::Option<T>) -> Self
5873 where
5874 T: std::convert::Into<crate::model::Product>,
5875 {
5876 self.0.request.inventory = v.map(|x| x.into());
5877 self
5878 }
5879
5880 pub fn set_set_mask<T>(mut self, v: T) -> Self
5882 where
5883 T: std::convert::Into<wkt::FieldMask>,
5884 {
5885 self.0.request.set_mask = std::option::Option::Some(v.into());
5886 self
5887 }
5888
5889 pub fn set_or_clear_set_mask<T>(mut self, v: std::option::Option<T>) -> Self
5891 where
5892 T: std::convert::Into<wkt::FieldMask>,
5893 {
5894 self.0.request.set_mask = v.map(|x| x.into());
5895 self
5896 }
5897
5898 pub fn set_set_time<T>(mut self, v: T) -> Self
5900 where
5901 T: std::convert::Into<wkt::Timestamp>,
5902 {
5903 self.0.request.set_time = std::option::Option::Some(v.into());
5904 self
5905 }
5906
5907 pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
5909 where
5910 T: std::convert::Into<wkt::Timestamp>,
5911 {
5912 self.0.request.set_time = v.map(|x| x.into());
5913 self
5914 }
5915
5916 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5918 self.0.request.allow_missing = v.into();
5919 self
5920 }
5921 }
5922
5923 #[doc(hidden)]
5924 impl crate::RequestBuilder for SetInventory {
5925 fn request_options(&mut self) -> &mut crate::RequestOptions {
5926 &mut self.0.options
5927 }
5928 }
5929
5930 #[derive(Clone, Debug)]
5948 pub struct AddFulfillmentPlaces(RequestBuilder<crate::model::AddFulfillmentPlacesRequest>);
5949
5950 impl AddFulfillmentPlaces {
5951 pub(crate) fn new(
5952 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5953 ) -> Self {
5954 Self(RequestBuilder::new(stub))
5955 }
5956
5957 pub fn with_request<V: Into<crate::model::AddFulfillmentPlacesRequest>>(
5959 mut self,
5960 v: V,
5961 ) -> Self {
5962 self.0.request = v.into();
5963 self
5964 }
5965
5966 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5968 self.0.options = v.into();
5969 self
5970 }
5971
5972 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5979 (*self.0.stub)
5980 .add_fulfillment_places(self.0.request, self.0.options)
5981 .await
5982 .map(crate::Response::into_body)
5983 }
5984
5985 pub fn poller(
5987 self,
5988 ) -> impl google_cloud_lro::Poller<
5989 crate::model::AddFulfillmentPlacesResponse,
5990 crate::model::AddFulfillmentPlacesMetadata,
5991 > {
5992 type Operation = google_cloud_lro::internal::Operation<
5993 crate::model::AddFulfillmentPlacesResponse,
5994 crate::model::AddFulfillmentPlacesMetadata,
5995 >;
5996 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5997 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5998
5999 let stub = self.0.stub.clone();
6000 let mut options = self.0.options.clone();
6001 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6002 let query = move |name| {
6003 let stub = stub.clone();
6004 let options = options.clone();
6005 async {
6006 let op = GetOperation::new(stub)
6007 .set_name(name)
6008 .with_options(options)
6009 .send()
6010 .await?;
6011 Ok(Operation::new(op))
6012 }
6013 };
6014
6015 let start = move || async {
6016 let op = self.send().await?;
6017 Ok(Operation::new(op))
6018 };
6019
6020 google_cloud_lro::internal::new_poller(
6021 polling_error_policy,
6022 polling_backoff_policy,
6023 start,
6024 query,
6025 )
6026 }
6027
6028 pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6032 self.0.request.product = v.into();
6033 self
6034 }
6035
6036 pub fn set_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
6040 self.0.request.r#type = v.into();
6041 self
6042 }
6043
6044 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
6048 where
6049 T: std::iter::IntoIterator<Item = V>,
6050 V: std::convert::Into<std::string::String>,
6051 {
6052 use std::iter::Iterator;
6053 self.0.request.place_ids = v.into_iter().map(|i| i.into()).collect();
6054 self
6055 }
6056
6057 pub fn set_add_time<T>(mut self, v: T) -> Self
6059 where
6060 T: std::convert::Into<wkt::Timestamp>,
6061 {
6062 self.0.request.add_time = std::option::Option::Some(v.into());
6063 self
6064 }
6065
6066 pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
6068 where
6069 T: std::convert::Into<wkt::Timestamp>,
6070 {
6071 self.0.request.add_time = v.map(|x| x.into());
6072 self
6073 }
6074
6075 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6077 self.0.request.allow_missing = v.into();
6078 self
6079 }
6080 }
6081
6082 #[doc(hidden)]
6083 impl crate::RequestBuilder for AddFulfillmentPlaces {
6084 fn request_options(&mut self) -> &mut crate::RequestOptions {
6085 &mut self.0.options
6086 }
6087 }
6088
6089 #[derive(Clone, Debug)]
6107 pub struct RemoveFulfillmentPlaces(
6108 RequestBuilder<crate::model::RemoveFulfillmentPlacesRequest>,
6109 );
6110
6111 impl RemoveFulfillmentPlaces {
6112 pub(crate) fn new(
6113 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6114 ) -> Self {
6115 Self(RequestBuilder::new(stub))
6116 }
6117
6118 pub fn with_request<V: Into<crate::model::RemoveFulfillmentPlacesRequest>>(
6120 mut self,
6121 v: V,
6122 ) -> Self {
6123 self.0.request = v.into();
6124 self
6125 }
6126
6127 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6129 self.0.options = v.into();
6130 self
6131 }
6132
6133 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6140 (*self.0.stub)
6141 .remove_fulfillment_places(self.0.request, self.0.options)
6142 .await
6143 .map(crate::Response::into_body)
6144 }
6145
6146 pub fn poller(
6148 self,
6149 ) -> impl google_cloud_lro::Poller<
6150 crate::model::RemoveFulfillmentPlacesResponse,
6151 crate::model::RemoveFulfillmentPlacesMetadata,
6152 > {
6153 type Operation = google_cloud_lro::internal::Operation<
6154 crate::model::RemoveFulfillmentPlacesResponse,
6155 crate::model::RemoveFulfillmentPlacesMetadata,
6156 >;
6157 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6158 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6159
6160 let stub = self.0.stub.clone();
6161 let mut options = self.0.options.clone();
6162 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6163 let query = move |name| {
6164 let stub = stub.clone();
6165 let options = options.clone();
6166 async {
6167 let op = GetOperation::new(stub)
6168 .set_name(name)
6169 .with_options(options)
6170 .send()
6171 .await?;
6172 Ok(Operation::new(op))
6173 }
6174 };
6175
6176 let start = move || async {
6177 let op = self.send().await?;
6178 Ok(Operation::new(op))
6179 };
6180
6181 google_cloud_lro::internal::new_poller(
6182 polling_error_policy,
6183 polling_backoff_policy,
6184 start,
6185 query,
6186 )
6187 }
6188
6189 pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6193 self.0.request.product = v.into();
6194 self
6195 }
6196
6197 pub fn set_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
6201 self.0.request.r#type = v.into();
6202 self
6203 }
6204
6205 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
6209 where
6210 T: std::iter::IntoIterator<Item = V>,
6211 V: std::convert::Into<std::string::String>,
6212 {
6213 use std::iter::Iterator;
6214 self.0.request.place_ids = v.into_iter().map(|i| i.into()).collect();
6215 self
6216 }
6217
6218 pub fn set_remove_time<T>(mut self, v: T) -> Self
6220 where
6221 T: std::convert::Into<wkt::Timestamp>,
6222 {
6223 self.0.request.remove_time = std::option::Option::Some(v.into());
6224 self
6225 }
6226
6227 pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
6229 where
6230 T: std::convert::Into<wkt::Timestamp>,
6231 {
6232 self.0.request.remove_time = v.map(|x| x.into());
6233 self
6234 }
6235
6236 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6238 self.0.request.allow_missing = v.into();
6239 self
6240 }
6241 }
6242
6243 #[doc(hidden)]
6244 impl crate::RequestBuilder for RemoveFulfillmentPlaces {
6245 fn request_options(&mut self) -> &mut crate::RequestOptions {
6246 &mut self.0.options
6247 }
6248 }
6249
6250 #[derive(Clone, Debug)]
6268 pub struct AddLocalInventories(RequestBuilder<crate::model::AddLocalInventoriesRequest>);
6269
6270 impl AddLocalInventories {
6271 pub(crate) fn new(
6272 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6273 ) -> Self {
6274 Self(RequestBuilder::new(stub))
6275 }
6276
6277 pub fn with_request<V: Into<crate::model::AddLocalInventoriesRequest>>(
6279 mut self,
6280 v: V,
6281 ) -> Self {
6282 self.0.request = v.into();
6283 self
6284 }
6285
6286 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6288 self.0.options = v.into();
6289 self
6290 }
6291
6292 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6299 (*self.0.stub)
6300 .add_local_inventories(self.0.request, self.0.options)
6301 .await
6302 .map(crate::Response::into_body)
6303 }
6304
6305 pub fn poller(
6307 self,
6308 ) -> impl google_cloud_lro::Poller<
6309 crate::model::AddLocalInventoriesResponse,
6310 crate::model::AddLocalInventoriesMetadata,
6311 > {
6312 type Operation = google_cloud_lro::internal::Operation<
6313 crate::model::AddLocalInventoriesResponse,
6314 crate::model::AddLocalInventoriesMetadata,
6315 >;
6316 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6317 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6318
6319 let stub = self.0.stub.clone();
6320 let mut options = self.0.options.clone();
6321 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6322 let query = move |name| {
6323 let stub = stub.clone();
6324 let options = options.clone();
6325 async {
6326 let op = GetOperation::new(stub)
6327 .set_name(name)
6328 .with_options(options)
6329 .send()
6330 .await?;
6331 Ok(Operation::new(op))
6332 }
6333 };
6334
6335 let start = move || async {
6336 let op = self.send().await?;
6337 Ok(Operation::new(op))
6338 };
6339
6340 google_cloud_lro::internal::new_poller(
6341 polling_error_policy,
6342 polling_backoff_policy,
6343 start,
6344 query,
6345 )
6346 }
6347
6348 pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6352 self.0.request.product = v.into();
6353 self
6354 }
6355
6356 pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
6360 where
6361 T: std::iter::IntoIterator<Item = V>,
6362 V: std::convert::Into<crate::model::LocalInventory>,
6363 {
6364 use std::iter::Iterator;
6365 self.0.request.local_inventories = v.into_iter().map(|i| i.into()).collect();
6366 self
6367 }
6368
6369 pub fn set_add_mask<T>(mut self, v: T) -> Self
6371 where
6372 T: std::convert::Into<wkt::FieldMask>,
6373 {
6374 self.0.request.add_mask = std::option::Option::Some(v.into());
6375 self
6376 }
6377
6378 pub fn set_or_clear_add_mask<T>(mut self, v: std::option::Option<T>) -> Self
6380 where
6381 T: std::convert::Into<wkt::FieldMask>,
6382 {
6383 self.0.request.add_mask = v.map(|x| x.into());
6384 self
6385 }
6386
6387 pub fn set_add_time<T>(mut self, v: T) -> Self
6389 where
6390 T: std::convert::Into<wkt::Timestamp>,
6391 {
6392 self.0.request.add_time = std::option::Option::Some(v.into());
6393 self
6394 }
6395
6396 pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
6398 where
6399 T: std::convert::Into<wkt::Timestamp>,
6400 {
6401 self.0.request.add_time = v.map(|x| x.into());
6402 self
6403 }
6404
6405 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6407 self.0.request.allow_missing = v.into();
6408 self
6409 }
6410 }
6411
6412 #[doc(hidden)]
6413 impl crate::RequestBuilder for AddLocalInventories {
6414 fn request_options(&mut self) -> &mut crate::RequestOptions {
6415 &mut self.0.options
6416 }
6417 }
6418
6419 #[derive(Clone, Debug)]
6437 pub struct RemoveLocalInventories(RequestBuilder<crate::model::RemoveLocalInventoriesRequest>);
6438
6439 impl RemoveLocalInventories {
6440 pub(crate) fn new(
6441 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6442 ) -> Self {
6443 Self(RequestBuilder::new(stub))
6444 }
6445
6446 pub fn with_request<V: Into<crate::model::RemoveLocalInventoriesRequest>>(
6448 mut self,
6449 v: V,
6450 ) -> Self {
6451 self.0.request = v.into();
6452 self
6453 }
6454
6455 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6457 self.0.options = v.into();
6458 self
6459 }
6460
6461 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6468 (*self.0.stub)
6469 .remove_local_inventories(self.0.request, self.0.options)
6470 .await
6471 .map(crate::Response::into_body)
6472 }
6473
6474 pub fn poller(
6476 self,
6477 ) -> impl google_cloud_lro::Poller<
6478 crate::model::RemoveLocalInventoriesResponse,
6479 crate::model::RemoveLocalInventoriesMetadata,
6480 > {
6481 type Operation = google_cloud_lro::internal::Operation<
6482 crate::model::RemoveLocalInventoriesResponse,
6483 crate::model::RemoveLocalInventoriesMetadata,
6484 >;
6485 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6486 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6487
6488 let stub = self.0.stub.clone();
6489 let mut options = self.0.options.clone();
6490 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6491 let query = move |name| {
6492 let stub = stub.clone();
6493 let options = options.clone();
6494 async {
6495 let op = GetOperation::new(stub)
6496 .set_name(name)
6497 .with_options(options)
6498 .send()
6499 .await?;
6500 Ok(Operation::new(op))
6501 }
6502 };
6503
6504 let start = move || async {
6505 let op = self.send().await?;
6506 Ok(Operation::new(op))
6507 };
6508
6509 google_cloud_lro::internal::new_poller(
6510 polling_error_policy,
6511 polling_backoff_policy,
6512 start,
6513 query,
6514 )
6515 }
6516
6517 pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6521 self.0.request.product = v.into();
6522 self
6523 }
6524
6525 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
6529 where
6530 T: std::iter::IntoIterator<Item = V>,
6531 V: std::convert::Into<std::string::String>,
6532 {
6533 use std::iter::Iterator;
6534 self.0.request.place_ids = v.into_iter().map(|i| i.into()).collect();
6535 self
6536 }
6537
6538 pub fn set_remove_time<T>(mut self, v: T) -> Self
6540 where
6541 T: std::convert::Into<wkt::Timestamp>,
6542 {
6543 self.0.request.remove_time = std::option::Option::Some(v.into());
6544 self
6545 }
6546
6547 pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
6549 where
6550 T: std::convert::Into<wkt::Timestamp>,
6551 {
6552 self.0.request.remove_time = v.map(|x| x.into());
6553 self
6554 }
6555
6556 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6558 self.0.request.allow_missing = v.into();
6559 self
6560 }
6561 }
6562
6563 #[doc(hidden)]
6564 impl crate::RequestBuilder for RemoveLocalInventories {
6565 fn request_options(&mut self) -> &mut crate::RequestOptions {
6566 &mut self.0.options
6567 }
6568 }
6569
6570 #[derive(Clone, Debug)]
6591 pub struct ListOperations(
6592 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6593 );
6594
6595 impl ListOperations {
6596 pub(crate) fn new(
6597 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6598 ) -> Self {
6599 Self(RequestBuilder::new(stub))
6600 }
6601
6602 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6604 mut self,
6605 v: V,
6606 ) -> Self {
6607 self.0.request = v.into();
6608 self
6609 }
6610
6611 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6613 self.0.options = v.into();
6614 self
6615 }
6616
6617 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6619 (*self.0.stub)
6620 .list_operations(self.0.request, self.0.options)
6621 .await
6622 .map(crate::Response::into_body)
6623 }
6624
6625 pub fn by_page(
6627 self,
6628 ) -> impl google_cloud_gax::paginator::Paginator<
6629 google_cloud_longrunning::model::ListOperationsResponse,
6630 crate::Error,
6631 > {
6632 use std::clone::Clone;
6633 let token = self.0.request.page_token.clone();
6634 let execute = move |token: String| {
6635 let mut builder = self.clone();
6636 builder.0.request = builder.0.request.set_page_token(token);
6637 builder.send()
6638 };
6639 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6640 }
6641
6642 pub fn by_item(
6644 self,
6645 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6646 google_cloud_longrunning::model::ListOperationsResponse,
6647 crate::Error,
6648 > {
6649 use google_cloud_gax::paginator::Paginator;
6650 self.by_page().items()
6651 }
6652
6653 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6655 self.0.request.name = v.into();
6656 self
6657 }
6658
6659 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6661 self.0.request.filter = v.into();
6662 self
6663 }
6664
6665 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6667 self.0.request.page_size = v.into();
6668 self
6669 }
6670
6671 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6673 self.0.request.page_token = v.into();
6674 self
6675 }
6676
6677 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6679 self.0.request.return_partial_success = v.into();
6680 self
6681 }
6682 }
6683
6684 #[doc(hidden)]
6685 impl crate::RequestBuilder for ListOperations {
6686 fn request_options(&mut self) -> &mut crate::RequestOptions {
6687 &mut self.0.options
6688 }
6689 }
6690
6691 #[derive(Clone, Debug)]
6708 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6709
6710 impl GetOperation {
6711 pub(crate) fn new(
6712 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6713 ) -> Self {
6714 Self(RequestBuilder::new(stub))
6715 }
6716
6717 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6719 mut self,
6720 v: V,
6721 ) -> Self {
6722 self.0.request = v.into();
6723 self
6724 }
6725
6726 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6728 self.0.options = v.into();
6729 self
6730 }
6731
6732 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6734 (*self.0.stub)
6735 .get_operation(self.0.request, self.0.options)
6736 .await
6737 .map(crate::Response::into_body)
6738 }
6739
6740 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6742 self.0.request.name = v.into();
6743 self
6744 }
6745 }
6746
6747 #[doc(hidden)]
6748 impl crate::RequestBuilder for GetOperation {
6749 fn request_options(&mut self) -> &mut crate::RequestOptions {
6750 &mut self.0.options
6751 }
6752 }
6753}
6754
6755pub mod search_service {
6756 use crate::Result;
6757
6758 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6772
6773 pub(crate) mod client {
6774 use super::super::super::client::SearchService;
6775 pub struct Factory;
6776 impl crate::ClientFactory for Factory {
6777 type Client = SearchService;
6778 type Credentials = gaxi::options::Credentials;
6779 async fn build(
6780 self,
6781 config: gaxi::options::ClientConfig,
6782 ) -> crate::ClientBuilderResult<Self::Client> {
6783 Self::Client::new(config).await
6784 }
6785 }
6786 }
6787
6788 #[derive(Clone, Debug)]
6790 pub(crate) struct RequestBuilder<R: std::default::Default> {
6791 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
6792 request: R,
6793 options: crate::RequestOptions,
6794 }
6795
6796 impl<R> RequestBuilder<R>
6797 where
6798 R: std::default::Default,
6799 {
6800 pub(crate) fn new(
6801 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
6802 ) -> Self {
6803 Self {
6804 stub,
6805 request: R::default(),
6806 options: crate::RequestOptions::default(),
6807 }
6808 }
6809 }
6810
6811 #[derive(Clone, Debug)]
6832 pub struct Search(RequestBuilder<crate::model::SearchRequest>);
6833
6834 impl Search {
6835 pub(crate) fn new(
6836 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
6837 ) -> Self {
6838 Self(RequestBuilder::new(stub))
6839 }
6840
6841 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
6843 self.0.request = v.into();
6844 self
6845 }
6846
6847 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6849 self.0.options = v.into();
6850 self
6851 }
6852
6853 pub async fn send(self) -> Result<crate::model::SearchResponse> {
6855 (*self.0.stub)
6856 .search(self.0.request, self.0.options)
6857 .await
6858 .map(crate::Response::into_body)
6859 }
6860
6861 pub fn by_page(
6863 self,
6864 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
6865 {
6866 use std::clone::Clone;
6867 let token = self.0.request.page_token.clone();
6868 let execute = move |token: String| {
6869 let mut builder = self.clone();
6870 builder.0.request = builder.0.request.set_page_token(token);
6871 builder.send()
6872 };
6873 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6874 }
6875
6876 pub fn by_item(
6878 self,
6879 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
6880 {
6881 use google_cloud_gax::paginator::Paginator;
6882 self.by_page().items()
6883 }
6884
6885 pub fn set_placement<T: Into<std::string::String>>(mut self, v: T) -> Self {
6889 self.0.request.placement = v.into();
6890 self
6891 }
6892
6893 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
6895 self.0.request.branch = v.into();
6896 self
6897 }
6898
6899 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
6901 self.0.request.query = v.into();
6902 self
6903 }
6904
6905 pub fn set_visitor_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6909 self.0.request.visitor_id = v.into();
6910 self
6911 }
6912
6913 pub fn set_user_info<T>(mut self, v: T) -> Self
6915 where
6916 T: std::convert::Into<crate::model::UserInfo>,
6917 {
6918 self.0.request.user_info = std::option::Option::Some(v.into());
6919 self
6920 }
6921
6922 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
6924 where
6925 T: std::convert::Into<crate::model::UserInfo>,
6926 {
6927 self.0.request.user_info = v.map(|x| x.into());
6928 self
6929 }
6930
6931 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6933 self.0.request.page_size = v.into();
6934 self
6935 }
6936
6937 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6939 self.0.request.page_token = v.into();
6940 self
6941 }
6942
6943 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
6945 self.0.request.offset = v.into();
6946 self
6947 }
6948
6949 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6951 self.0.request.filter = v.into();
6952 self
6953 }
6954
6955 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6957 self.0.request.canonical_filter = v.into();
6958 self
6959 }
6960
6961 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
6963 self.0.request.order_by = v.into();
6964 self
6965 }
6966
6967 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
6969 where
6970 T: std::iter::IntoIterator<Item = V>,
6971 V: std::convert::Into<crate::model::search_request::FacetSpec>,
6972 {
6973 use std::iter::Iterator;
6974 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
6975 self
6976 }
6977
6978 #[deprecated]
6980 pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
6981 where
6982 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
6983 {
6984 self.0.request.dynamic_facet_spec = std::option::Option::Some(v.into());
6985 self
6986 }
6987
6988 #[deprecated]
6990 pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
6991 where
6992 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
6993 {
6994 self.0.request.dynamic_facet_spec = v.map(|x| x.into());
6995 self
6996 }
6997
6998 pub fn set_boost_spec<T>(mut self, v: T) -> Self
7000 where
7001 T: std::convert::Into<crate::model::search_request::BoostSpec>,
7002 {
7003 self.0.request.boost_spec = std::option::Option::Some(v.into());
7004 self
7005 }
7006
7007 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
7009 where
7010 T: std::convert::Into<crate::model::search_request::BoostSpec>,
7011 {
7012 self.0.request.boost_spec = v.map(|x| x.into());
7013 self
7014 }
7015
7016 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
7018 where
7019 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
7020 {
7021 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
7022 self
7023 }
7024
7025 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
7027 where
7028 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
7029 {
7030 self.0.request.query_expansion_spec = v.map(|x| x.into());
7031 self
7032 }
7033
7034 pub fn set_variant_rollup_keys<T, V>(mut self, v: T) -> Self
7036 where
7037 T: std::iter::IntoIterator<Item = V>,
7038 V: std::convert::Into<std::string::String>,
7039 {
7040 use std::iter::Iterator;
7041 self.0.request.variant_rollup_keys = v.into_iter().map(|i| i.into()).collect();
7042 self
7043 }
7044
7045 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
7047 where
7048 T: std::iter::IntoIterator<Item = V>,
7049 V: std::convert::Into<std::string::String>,
7050 {
7051 use std::iter::Iterator;
7052 self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
7053 self
7054 }
7055
7056 pub fn set_search_mode<T: Into<crate::model::search_request::SearchMode>>(
7058 mut self,
7059 v: T,
7060 ) -> Self {
7061 self.0.request.search_mode = v.into();
7062 self
7063 }
7064
7065 pub fn set_personalization_spec<T>(mut self, v: T) -> Self
7067 where
7068 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
7069 {
7070 self.0.request.personalization_spec = std::option::Option::Some(v.into());
7071 self
7072 }
7073
7074 pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
7076 where
7077 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
7078 {
7079 self.0.request.personalization_spec = v.map(|x| x.into());
7080 self
7081 }
7082
7083 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7085 where
7086 T: std::iter::IntoIterator<Item = (K, V)>,
7087 K: std::convert::Into<std::string::String>,
7088 V: std::convert::Into<std::string::String>,
7089 {
7090 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7091 self
7092 }
7093
7094 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
7096 where
7097 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
7098 {
7099 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
7100 self
7101 }
7102
7103 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
7105 where
7106 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
7107 {
7108 self.0.request.spell_correction_spec = v.map(|x| x.into());
7109 self
7110 }
7111
7112 pub fn set_entity<T: Into<std::string::String>>(mut self, v: T) -> Self {
7114 self.0.request.entity = v.into();
7115 self
7116 }
7117
7118 pub fn set_conversational_search_spec<T>(mut self, v: T) -> Self
7120 where
7121 T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
7122 {
7123 self.0.request.conversational_search_spec = std::option::Option::Some(v.into());
7124 self
7125 }
7126
7127 pub fn set_or_clear_conversational_search_spec<T>(
7129 mut self,
7130 v: std::option::Option<T>,
7131 ) -> Self
7132 where
7133 T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
7134 {
7135 self.0.request.conversational_search_spec = v.map(|x| x.into());
7136 self
7137 }
7138
7139 pub fn set_tile_navigation_spec<T>(mut self, v: T) -> Self
7141 where
7142 T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
7143 {
7144 self.0.request.tile_navigation_spec = std::option::Option::Some(v.into());
7145 self
7146 }
7147
7148 pub fn set_or_clear_tile_navigation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7150 where
7151 T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
7152 {
7153 self.0.request.tile_navigation_spec = v.map(|x| x.into());
7154 self
7155 }
7156
7157 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
7159 self.0.request.language_code = v.into();
7160 self
7161 }
7162
7163 pub fn set_region_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
7165 self.0.request.region_code = v.into();
7166 self
7167 }
7168
7169 pub fn set_place_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7171 self.0.request.place_id = v.into();
7172 self
7173 }
7174
7175 pub fn set_user_attributes<T, K, V>(mut self, v: T) -> Self
7177 where
7178 T: std::iter::IntoIterator<Item = (K, V)>,
7179 K: std::convert::Into<std::string::String>,
7180 V: std::convert::Into<crate::model::StringList>,
7181 {
7182 self.0.request.user_attributes =
7183 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7184 self
7185 }
7186 }
7187
7188 #[doc(hidden)]
7189 impl crate::RequestBuilder for Search {
7190 fn request_options(&mut self) -> &mut crate::RequestOptions {
7191 &mut self.0.options
7192 }
7193 }
7194
7195 #[derive(Clone, Debug)]
7216 pub struct ListOperations(
7217 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7218 );
7219
7220 impl ListOperations {
7221 pub(crate) fn new(
7222 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
7223 ) -> Self {
7224 Self(RequestBuilder::new(stub))
7225 }
7226
7227 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7229 mut self,
7230 v: V,
7231 ) -> Self {
7232 self.0.request = v.into();
7233 self
7234 }
7235
7236 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7238 self.0.options = v.into();
7239 self
7240 }
7241
7242 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7244 (*self.0.stub)
7245 .list_operations(self.0.request, self.0.options)
7246 .await
7247 .map(crate::Response::into_body)
7248 }
7249
7250 pub fn by_page(
7252 self,
7253 ) -> impl google_cloud_gax::paginator::Paginator<
7254 google_cloud_longrunning::model::ListOperationsResponse,
7255 crate::Error,
7256 > {
7257 use std::clone::Clone;
7258 let token = self.0.request.page_token.clone();
7259 let execute = move |token: String| {
7260 let mut builder = self.clone();
7261 builder.0.request = builder.0.request.set_page_token(token);
7262 builder.send()
7263 };
7264 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7265 }
7266
7267 pub fn by_item(
7269 self,
7270 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7271 google_cloud_longrunning::model::ListOperationsResponse,
7272 crate::Error,
7273 > {
7274 use google_cloud_gax::paginator::Paginator;
7275 self.by_page().items()
7276 }
7277
7278 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7280 self.0.request.name = v.into();
7281 self
7282 }
7283
7284 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7286 self.0.request.filter = v.into();
7287 self
7288 }
7289
7290 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7292 self.0.request.page_size = v.into();
7293 self
7294 }
7295
7296 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7298 self.0.request.page_token = v.into();
7299 self
7300 }
7301
7302 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7304 self.0.request.return_partial_success = v.into();
7305 self
7306 }
7307 }
7308
7309 #[doc(hidden)]
7310 impl crate::RequestBuilder for ListOperations {
7311 fn request_options(&mut self) -> &mut crate::RequestOptions {
7312 &mut self.0.options
7313 }
7314 }
7315
7316 #[derive(Clone, Debug)]
7333 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7334
7335 impl GetOperation {
7336 pub(crate) fn new(
7337 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
7338 ) -> Self {
7339 Self(RequestBuilder::new(stub))
7340 }
7341
7342 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7344 mut self,
7345 v: V,
7346 ) -> Self {
7347 self.0.request = v.into();
7348 self
7349 }
7350
7351 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7353 self.0.options = v.into();
7354 self
7355 }
7356
7357 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7359 (*self.0.stub)
7360 .get_operation(self.0.request, self.0.options)
7361 .await
7362 .map(crate::Response::into_body)
7363 }
7364
7365 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7367 self.0.request.name = v.into();
7368 self
7369 }
7370 }
7371
7372 #[doc(hidden)]
7373 impl crate::RequestBuilder for GetOperation {
7374 fn request_options(&mut self) -> &mut crate::RequestOptions {
7375 &mut self.0.options
7376 }
7377 }
7378}
7379
7380pub mod serving_config_service {
7381 use crate::Result;
7382
7383 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7397
7398 pub(crate) mod client {
7399 use super::super::super::client::ServingConfigService;
7400 pub struct Factory;
7401 impl crate::ClientFactory for Factory {
7402 type Client = ServingConfigService;
7403 type Credentials = gaxi::options::Credentials;
7404 async fn build(
7405 self,
7406 config: gaxi::options::ClientConfig,
7407 ) -> crate::ClientBuilderResult<Self::Client> {
7408 Self::Client::new(config).await
7409 }
7410 }
7411 }
7412
7413 #[derive(Clone, Debug)]
7415 pub(crate) struct RequestBuilder<R: std::default::Default> {
7416 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7417 request: R,
7418 options: crate::RequestOptions,
7419 }
7420
7421 impl<R> RequestBuilder<R>
7422 where
7423 R: std::default::Default,
7424 {
7425 pub(crate) fn new(
7426 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7427 ) -> Self {
7428 Self {
7429 stub,
7430 request: R::default(),
7431 options: crate::RequestOptions::default(),
7432 }
7433 }
7434 }
7435
7436 #[derive(Clone, Debug)]
7453 pub struct CreateServingConfig(RequestBuilder<crate::model::CreateServingConfigRequest>);
7454
7455 impl CreateServingConfig {
7456 pub(crate) fn new(
7457 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7458 ) -> Self {
7459 Self(RequestBuilder::new(stub))
7460 }
7461
7462 pub fn with_request<V: Into<crate::model::CreateServingConfigRequest>>(
7464 mut self,
7465 v: V,
7466 ) -> Self {
7467 self.0.request = v.into();
7468 self
7469 }
7470
7471 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7473 self.0.options = v.into();
7474 self
7475 }
7476
7477 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7479 (*self.0.stub)
7480 .create_serving_config(self.0.request, self.0.options)
7481 .await
7482 .map(crate::Response::into_body)
7483 }
7484
7485 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7489 self.0.request.parent = v.into();
7490 self
7491 }
7492
7493 pub fn set_serving_config<T>(mut self, v: T) -> Self
7497 where
7498 T: std::convert::Into<crate::model::ServingConfig>,
7499 {
7500 self.0.request.serving_config = std::option::Option::Some(v.into());
7501 self
7502 }
7503
7504 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
7508 where
7509 T: std::convert::Into<crate::model::ServingConfig>,
7510 {
7511 self.0.request.serving_config = v.map(|x| x.into());
7512 self
7513 }
7514
7515 pub fn set_serving_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7519 self.0.request.serving_config_id = v.into();
7520 self
7521 }
7522 }
7523
7524 #[doc(hidden)]
7525 impl crate::RequestBuilder for CreateServingConfig {
7526 fn request_options(&mut self) -> &mut crate::RequestOptions {
7527 &mut self.0.options
7528 }
7529 }
7530
7531 #[derive(Clone, Debug)]
7548 pub struct DeleteServingConfig(RequestBuilder<crate::model::DeleteServingConfigRequest>);
7549
7550 impl DeleteServingConfig {
7551 pub(crate) fn new(
7552 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7553 ) -> Self {
7554 Self(RequestBuilder::new(stub))
7555 }
7556
7557 pub fn with_request<V: Into<crate::model::DeleteServingConfigRequest>>(
7559 mut self,
7560 v: V,
7561 ) -> Self {
7562 self.0.request = v.into();
7563 self
7564 }
7565
7566 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7568 self.0.options = v.into();
7569 self
7570 }
7571
7572 pub async fn send(self) -> Result<()> {
7574 (*self.0.stub)
7575 .delete_serving_config(self.0.request, self.0.options)
7576 .await
7577 .map(crate::Response::into_body)
7578 }
7579
7580 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7584 self.0.request.name = v.into();
7585 self
7586 }
7587 }
7588
7589 #[doc(hidden)]
7590 impl crate::RequestBuilder for DeleteServingConfig {
7591 fn request_options(&mut self) -> &mut crate::RequestOptions {
7592 &mut self.0.options
7593 }
7594 }
7595
7596 #[derive(Clone, Debug)]
7613 pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
7614
7615 impl UpdateServingConfig {
7616 pub(crate) fn new(
7617 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7618 ) -> Self {
7619 Self(RequestBuilder::new(stub))
7620 }
7621
7622 pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
7624 mut self,
7625 v: V,
7626 ) -> Self {
7627 self.0.request = v.into();
7628 self
7629 }
7630
7631 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7633 self.0.options = v.into();
7634 self
7635 }
7636
7637 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7639 (*self.0.stub)
7640 .update_serving_config(self.0.request, self.0.options)
7641 .await
7642 .map(crate::Response::into_body)
7643 }
7644
7645 pub fn set_serving_config<T>(mut self, v: T) -> Self
7649 where
7650 T: std::convert::Into<crate::model::ServingConfig>,
7651 {
7652 self.0.request.serving_config = std::option::Option::Some(v.into());
7653 self
7654 }
7655
7656 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
7660 where
7661 T: std::convert::Into<crate::model::ServingConfig>,
7662 {
7663 self.0.request.serving_config = v.map(|x| x.into());
7664 self
7665 }
7666
7667 pub fn set_update_mask<T>(mut self, v: T) -> Self
7669 where
7670 T: std::convert::Into<wkt::FieldMask>,
7671 {
7672 self.0.request.update_mask = std::option::Option::Some(v.into());
7673 self
7674 }
7675
7676 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7678 where
7679 T: std::convert::Into<wkt::FieldMask>,
7680 {
7681 self.0.request.update_mask = v.map(|x| x.into());
7682 self
7683 }
7684 }
7685
7686 #[doc(hidden)]
7687 impl crate::RequestBuilder for UpdateServingConfig {
7688 fn request_options(&mut self) -> &mut crate::RequestOptions {
7689 &mut self.0.options
7690 }
7691 }
7692
7693 #[derive(Clone, Debug)]
7710 pub struct GetServingConfig(RequestBuilder<crate::model::GetServingConfigRequest>);
7711
7712 impl GetServingConfig {
7713 pub(crate) fn new(
7714 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7715 ) -> Self {
7716 Self(RequestBuilder::new(stub))
7717 }
7718
7719 pub fn with_request<V: Into<crate::model::GetServingConfigRequest>>(
7721 mut self,
7722 v: V,
7723 ) -> Self {
7724 self.0.request = v.into();
7725 self
7726 }
7727
7728 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7730 self.0.options = v.into();
7731 self
7732 }
7733
7734 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7736 (*self.0.stub)
7737 .get_serving_config(self.0.request, self.0.options)
7738 .await
7739 .map(crate::Response::into_body)
7740 }
7741
7742 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7746 self.0.request.name = v.into();
7747 self
7748 }
7749 }
7750
7751 #[doc(hidden)]
7752 impl crate::RequestBuilder for GetServingConfig {
7753 fn request_options(&mut self) -> &mut crate::RequestOptions {
7754 &mut self.0.options
7755 }
7756 }
7757
7758 #[derive(Clone, Debug)]
7779 pub struct ListServingConfigs(RequestBuilder<crate::model::ListServingConfigsRequest>);
7780
7781 impl ListServingConfigs {
7782 pub(crate) fn new(
7783 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7784 ) -> Self {
7785 Self(RequestBuilder::new(stub))
7786 }
7787
7788 pub fn with_request<V: Into<crate::model::ListServingConfigsRequest>>(
7790 mut self,
7791 v: V,
7792 ) -> Self {
7793 self.0.request = v.into();
7794 self
7795 }
7796
7797 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7799 self.0.options = v.into();
7800 self
7801 }
7802
7803 pub async fn send(self) -> Result<crate::model::ListServingConfigsResponse> {
7805 (*self.0.stub)
7806 .list_serving_configs(self.0.request, self.0.options)
7807 .await
7808 .map(crate::Response::into_body)
7809 }
7810
7811 pub fn by_page(
7813 self,
7814 ) -> impl google_cloud_gax::paginator::Paginator<
7815 crate::model::ListServingConfigsResponse,
7816 crate::Error,
7817 > {
7818 use std::clone::Clone;
7819 let token = self.0.request.page_token.clone();
7820 let execute = move |token: String| {
7821 let mut builder = self.clone();
7822 builder.0.request = builder.0.request.set_page_token(token);
7823 builder.send()
7824 };
7825 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7826 }
7827
7828 pub fn by_item(
7830 self,
7831 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7832 crate::model::ListServingConfigsResponse,
7833 crate::Error,
7834 > {
7835 use google_cloud_gax::paginator::Paginator;
7836 self.by_page().items()
7837 }
7838
7839 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7843 self.0.request.parent = v.into();
7844 self
7845 }
7846
7847 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7849 self.0.request.page_size = v.into();
7850 self
7851 }
7852
7853 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7855 self.0.request.page_token = v.into();
7856 self
7857 }
7858 }
7859
7860 #[doc(hidden)]
7861 impl crate::RequestBuilder for ListServingConfigs {
7862 fn request_options(&mut self) -> &mut crate::RequestOptions {
7863 &mut self.0.options
7864 }
7865 }
7866
7867 #[derive(Clone, Debug)]
7884 pub struct AddControl(RequestBuilder<crate::model::AddControlRequest>);
7885
7886 impl AddControl {
7887 pub(crate) fn new(
7888 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7889 ) -> Self {
7890 Self(RequestBuilder::new(stub))
7891 }
7892
7893 pub fn with_request<V: Into<crate::model::AddControlRequest>>(mut self, v: V) -> Self {
7895 self.0.request = v.into();
7896 self
7897 }
7898
7899 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7901 self.0.options = v.into();
7902 self
7903 }
7904
7905 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7907 (*self.0.stub)
7908 .add_control(self.0.request, self.0.options)
7909 .await
7910 .map(crate::Response::into_body)
7911 }
7912
7913 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7917 self.0.request.serving_config = v.into();
7918 self
7919 }
7920
7921 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7925 self.0.request.control_id = v.into();
7926 self
7927 }
7928 }
7929
7930 #[doc(hidden)]
7931 impl crate::RequestBuilder for AddControl {
7932 fn request_options(&mut self) -> &mut crate::RequestOptions {
7933 &mut self.0.options
7934 }
7935 }
7936
7937 #[derive(Clone, Debug)]
7954 pub struct RemoveControl(RequestBuilder<crate::model::RemoveControlRequest>);
7955
7956 impl RemoveControl {
7957 pub(crate) fn new(
7958 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7959 ) -> Self {
7960 Self(RequestBuilder::new(stub))
7961 }
7962
7963 pub fn with_request<V: Into<crate::model::RemoveControlRequest>>(mut self, v: V) -> Self {
7965 self.0.request = v.into();
7966 self
7967 }
7968
7969 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7971 self.0.options = v.into();
7972 self
7973 }
7974
7975 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7977 (*self.0.stub)
7978 .remove_control(self.0.request, self.0.options)
7979 .await
7980 .map(crate::Response::into_body)
7981 }
7982
7983 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7987 self.0.request.serving_config = v.into();
7988 self
7989 }
7990
7991 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7995 self.0.request.control_id = v.into();
7996 self
7997 }
7998 }
7999
8000 #[doc(hidden)]
8001 impl crate::RequestBuilder for RemoveControl {
8002 fn request_options(&mut self) -> &mut crate::RequestOptions {
8003 &mut self.0.options
8004 }
8005 }
8006
8007 #[derive(Clone, Debug)]
8028 pub struct ListOperations(
8029 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8030 );
8031
8032 impl ListOperations {
8033 pub(crate) fn new(
8034 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
8035 ) -> Self {
8036 Self(RequestBuilder::new(stub))
8037 }
8038
8039 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8041 mut self,
8042 v: V,
8043 ) -> Self {
8044 self.0.request = v.into();
8045 self
8046 }
8047
8048 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8050 self.0.options = v.into();
8051 self
8052 }
8053
8054 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8056 (*self.0.stub)
8057 .list_operations(self.0.request, self.0.options)
8058 .await
8059 .map(crate::Response::into_body)
8060 }
8061
8062 pub fn by_page(
8064 self,
8065 ) -> impl google_cloud_gax::paginator::Paginator<
8066 google_cloud_longrunning::model::ListOperationsResponse,
8067 crate::Error,
8068 > {
8069 use std::clone::Clone;
8070 let token = self.0.request.page_token.clone();
8071 let execute = move |token: String| {
8072 let mut builder = self.clone();
8073 builder.0.request = builder.0.request.set_page_token(token);
8074 builder.send()
8075 };
8076 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8077 }
8078
8079 pub fn by_item(
8081 self,
8082 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8083 google_cloud_longrunning::model::ListOperationsResponse,
8084 crate::Error,
8085 > {
8086 use google_cloud_gax::paginator::Paginator;
8087 self.by_page().items()
8088 }
8089
8090 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8092 self.0.request.name = v.into();
8093 self
8094 }
8095
8096 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8098 self.0.request.filter = v.into();
8099 self
8100 }
8101
8102 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8104 self.0.request.page_size = v.into();
8105 self
8106 }
8107
8108 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8110 self.0.request.page_token = v.into();
8111 self
8112 }
8113
8114 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8116 self.0.request.return_partial_success = v.into();
8117 self
8118 }
8119 }
8120
8121 #[doc(hidden)]
8122 impl crate::RequestBuilder for ListOperations {
8123 fn request_options(&mut self) -> &mut crate::RequestOptions {
8124 &mut self.0.options
8125 }
8126 }
8127
8128 #[derive(Clone, Debug)]
8145 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8146
8147 impl GetOperation {
8148 pub(crate) fn new(
8149 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
8150 ) -> Self {
8151 Self(RequestBuilder::new(stub))
8152 }
8153
8154 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8156 mut self,
8157 v: V,
8158 ) -> Self {
8159 self.0.request = v.into();
8160 self
8161 }
8162
8163 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8165 self.0.options = v.into();
8166 self
8167 }
8168
8169 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8171 (*self.0.stub)
8172 .get_operation(self.0.request, self.0.options)
8173 .await
8174 .map(crate::Response::into_body)
8175 }
8176
8177 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8179 self.0.request.name = v.into();
8180 self
8181 }
8182 }
8183
8184 #[doc(hidden)]
8185 impl crate::RequestBuilder for GetOperation {
8186 fn request_options(&mut self) -> &mut crate::RequestOptions {
8187 &mut self.0.options
8188 }
8189 }
8190}
8191
8192pub mod user_event_service {
8193 use crate::Result;
8194
8195 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8209
8210 pub(crate) mod client {
8211 use super::super::super::client::UserEventService;
8212 pub struct Factory;
8213 impl crate::ClientFactory for Factory {
8214 type Client = UserEventService;
8215 type Credentials = gaxi::options::Credentials;
8216 async fn build(
8217 self,
8218 config: gaxi::options::ClientConfig,
8219 ) -> crate::ClientBuilderResult<Self::Client> {
8220 Self::Client::new(config).await
8221 }
8222 }
8223 }
8224
8225 #[derive(Clone, Debug)]
8227 pub(crate) struct RequestBuilder<R: std::default::Default> {
8228 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8229 request: R,
8230 options: crate::RequestOptions,
8231 }
8232
8233 impl<R> RequestBuilder<R>
8234 where
8235 R: std::default::Default,
8236 {
8237 pub(crate) fn new(
8238 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8239 ) -> Self {
8240 Self {
8241 stub,
8242 request: R::default(),
8243 options: crate::RequestOptions::default(),
8244 }
8245 }
8246 }
8247
8248 #[derive(Clone, Debug)]
8265 pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
8266
8267 impl WriteUserEvent {
8268 pub(crate) fn new(
8269 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8270 ) -> Self {
8271 Self(RequestBuilder::new(stub))
8272 }
8273
8274 pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
8276 self.0.request = v.into();
8277 self
8278 }
8279
8280 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8282 self.0.options = v.into();
8283 self
8284 }
8285
8286 pub async fn send(self) -> Result<crate::model::UserEvent> {
8288 (*self.0.stub)
8289 .write_user_event(self.0.request, self.0.options)
8290 .await
8291 .map(crate::Response::into_body)
8292 }
8293
8294 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8298 self.0.request.parent = v.into();
8299 self
8300 }
8301
8302 pub fn set_user_event<T>(mut self, v: T) -> Self
8306 where
8307 T: std::convert::Into<crate::model::UserEvent>,
8308 {
8309 self.0.request.user_event = std::option::Option::Some(v.into());
8310 self
8311 }
8312
8313 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
8317 where
8318 T: std::convert::Into<crate::model::UserEvent>,
8319 {
8320 self.0.request.user_event = v.map(|x| x.into());
8321 self
8322 }
8323
8324 pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
8326 self.0.request.write_async = v.into();
8327 self
8328 }
8329 }
8330
8331 #[doc(hidden)]
8332 impl crate::RequestBuilder for WriteUserEvent {
8333 fn request_options(&mut self) -> &mut crate::RequestOptions {
8334 &mut self.0.options
8335 }
8336 }
8337
8338 #[derive(Clone, Debug)]
8355 pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
8356
8357 impl CollectUserEvent {
8358 pub(crate) fn new(
8359 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8360 ) -> Self {
8361 Self(RequestBuilder::new(stub))
8362 }
8363
8364 pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
8366 mut self,
8367 v: V,
8368 ) -> Self {
8369 self.0.request = v.into();
8370 self
8371 }
8372
8373 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8375 self.0.options = v.into();
8376 self
8377 }
8378
8379 pub async fn send(self) -> Result<google_cloud_api::model::HttpBody> {
8381 (*self.0.stub)
8382 .collect_user_event(self.0.request, self.0.options)
8383 .await
8384 .map(crate::Response::into_body)
8385 }
8386
8387 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8391 self.0.request.parent = v.into();
8392 self
8393 }
8394
8395 pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
8399 self.0.request.user_event = v.into();
8400 self
8401 }
8402
8403 pub fn set_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
8405 self.0.request.uri = v.into();
8406 self
8407 }
8408
8409 pub fn set_ets<T: Into<i64>>(mut self, v: T) -> Self {
8411 self.0.request.ets = v.into();
8412 self
8413 }
8414
8415 pub fn set_raw_json<T: Into<std::string::String>>(mut self, v: T) -> Self {
8417 self.0.request.raw_json = v.into();
8418 self
8419 }
8420
8421 pub fn set_conversion_rule<
8426 T: Into<Option<crate::model::collect_user_event_request::ConversionRule>>,
8427 >(
8428 mut self,
8429 v: T,
8430 ) -> Self {
8431 self.0.request.conversion_rule = v.into();
8432 self
8433 }
8434
8435 pub fn set_prebuilt_rule<T: std::convert::Into<std::string::String>>(
8441 mut self,
8442 v: T,
8443 ) -> Self {
8444 self.0.request = self.0.request.set_prebuilt_rule(v);
8445 self
8446 }
8447 }
8448
8449 #[doc(hidden)]
8450 impl crate::RequestBuilder for CollectUserEvent {
8451 fn request_options(&mut self) -> &mut crate::RequestOptions {
8452 &mut self.0.options
8453 }
8454 }
8455
8456 #[derive(Clone, Debug)]
8474 pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
8475
8476 impl PurgeUserEvents {
8477 pub(crate) fn new(
8478 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8479 ) -> Self {
8480 Self(RequestBuilder::new(stub))
8481 }
8482
8483 pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
8485 self.0.request = v.into();
8486 self
8487 }
8488
8489 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8491 self.0.options = v.into();
8492 self
8493 }
8494
8495 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8502 (*self.0.stub)
8503 .purge_user_events(self.0.request, self.0.options)
8504 .await
8505 .map(crate::Response::into_body)
8506 }
8507
8508 pub fn poller(
8510 self,
8511 ) -> impl google_cloud_lro::Poller<
8512 crate::model::PurgeUserEventsResponse,
8513 crate::model::PurgeMetadata,
8514 > {
8515 type Operation = google_cloud_lro::internal::Operation<
8516 crate::model::PurgeUserEventsResponse,
8517 crate::model::PurgeMetadata,
8518 >;
8519 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8520 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8521
8522 let stub = self.0.stub.clone();
8523 let mut options = self.0.options.clone();
8524 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8525 let query = move |name| {
8526 let stub = stub.clone();
8527 let options = options.clone();
8528 async {
8529 let op = GetOperation::new(stub)
8530 .set_name(name)
8531 .with_options(options)
8532 .send()
8533 .await?;
8534 Ok(Operation::new(op))
8535 }
8536 };
8537
8538 let start = move || async {
8539 let op = self.send().await?;
8540 Ok(Operation::new(op))
8541 };
8542
8543 google_cloud_lro::internal::new_poller(
8544 polling_error_policy,
8545 polling_backoff_policy,
8546 start,
8547 query,
8548 )
8549 }
8550
8551 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8555 self.0.request.parent = v.into();
8556 self
8557 }
8558
8559 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8563 self.0.request.filter = v.into();
8564 self
8565 }
8566
8567 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
8569 self.0.request.force = v.into();
8570 self
8571 }
8572 }
8573
8574 #[doc(hidden)]
8575 impl crate::RequestBuilder for PurgeUserEvents {
8576 fn request_options(&mut self) -> &mut crate::RequestOptions {
8577 &mut self.0.options
8578 }
8579 }
8580
8581 #[derive(Clone, Debug)]
8599 pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
8600
8601 impl ImportUserEvents {
8602 pub(crate) fn new(
8603 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8604 ) -> Self {
8605 Self(RequestBuilder::new(stub))
8606 }
8607
8608 pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
8610 mut self,
8611 v: V,
8612 ) -> Self {
8613 self.0.request = v.into();
8614 self
8615 }
8616
8617 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8619 self.0.options = v.into();
8620 self
8621 }
8622
8623 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8630 (*self.0.stub)
8631 .import_user_events(self.0.request, self.0.options)
8632 .await
8633 .map(crate::Response::into_body)
8634 }
8635
8636 pub fn poller(
8638 self,
8639 ) -> impl google_cloud_lro::Poller<
8640 crate::model::ImportUserEventsResponse,
8641 crate::model::ImportMetadata,
8642 > {
8643 type Operation = google_cloud_lro::internal::Operation<
8644 crate::model::ImportUserEventsResponse,
8645 crate::model::ImportMetadata,
8646 >;
8647 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8648 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8649
8650 let stub = self.0.stub.clone();
8651 let mut options = self.0.options.clone();
8652 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8653 let query = move |name| {
8654 let stub = stub.clone();
8655 let options = options.clone();
8656 async {
8657 let op = GetOperation::new(stub)
8658 .set_name(name)
8659 .with_options(options)
8660 .send()
8661 .await?;
8662 Ok(Operation::new(op))
8663 }
8664 };
8665
8666 let start = move || async {
8667 let op = self.send().await?;
8668 Ok(Operation::new(op))
8669 };
8670
8671 google_cloud_lro::internal::new_poller(
8672 polling_error_policy,
8673 polling_backoff_policy,
8674 start,
8675 query,
8676 )
8677 }
8678
8679 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8683 self.0.request.parent = v.into();
8684 self
8685 }
8686
8687 pub fn set_input_config<T>(mut self, v: T) -> Self
8691 where
8692 T: std::convert::Into<crate::model::UserEventInputConfig>,
8693 {
8694 self.0.request.input_config = std::option::Option::Some(v.into());
8695 self
8696 }
8697
8698 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
8702 where
8703 T: std::convert::Into<crate::model::UserEventInputConfig>,
8704 {
8705 self.0.request.input_config = v.map(|x| x.into());
8706 self
8707 }
8708
8709 pub fn set_errors_config<T>(mut self, v: T) -> Self
8711 where
8712 T: std::convert::Into<crate::model::ImportErrorsConfig>,
8713 {
8714 self.0.request.errors_config = std::option::Option::Some(v.into());
8715 self
8716 }
8717
8718 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
8720 where
8721 T: std::convert::Into<crate::model::ImportErrorsConfig>,
8722 {
8723 self.0.request.errors_config = v.map(|x| x.into());
8724 self
8725 }
8726 }
8727
8728 #[doc(hidden)]
8729 impl crate::RequestBuilder for ImportUserEvents {
8730 fn request_options(&mut self) -> &mut crate::RequestOptions {
8731 &mut self.0.options
8732 }
8733 }
8734
8735 #[derive(Clone, Debug)]
8753 pub struct RejoinUserEvents(RequestBuilder<crate::model::RejoinUserEventsRequest>);
8754
8755 impl RejoinUserEvents {
8756 pub(crate) fn new(
8757 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8758 ) -> Self {
8759 Self(RequestBuilder::new(stub))
8760 }
8761
8762 pub fn with_request<V: Into<crate::model::RejoinUserEventsRequest>>(
8764 mut self,
8765 v: V,
8766 ) -> Self {
8767 self.0.request = v.into();
8768 self
8769 }
8770
8771 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8773 self.0.options = v.into();
8774 self
8775 }
8776
8777 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8784 (*self.0.stub)
8785 .rejoin_user_events(self.0.request, self.0.options)
8786 .await
8787 .map(crate::Response::into_body)
8788 }
8789
8790 pub fn poller(
8792 self,
8793 ) -> impl google_cloud_lro::Poller<
8794 crate::model::RejoinUserEventsResponse,
8795 crate::model::RejoinUserEventsMetadata,
8796 > {
8797 type Operation = google_cloud_lro::internal::Operation<
8798 crate::model::RejoinUserEventsResponse,
8799 crate::model::RejoinUserEventsMetadata,
8800 >;
8801 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8802 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8803
8804 let stub = self.0.stub.clone();
8805 let mut options = self.0.options.clone();
8806 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8807 let query = move |name| {
8808 let stub = stub.clone();
8809 let options = options.clone();
8810 async {
8811 let op = GetOperation::new(stub)
8812 .set_name(name)
8813 .with_options(options)
8814 .send()
8815 .await?;
8816 Ok(Operation::new(op))
8817 }
8818 };
8819
8820 let start = move || async {
8821 let op = self.send().await?;
8822 Ok(Operation::new(op))
8823 };
8824
8825 google_cloud_lro::internal::new_poller(
8826 polling_error_policy,
8827 polling_backoff_policy,
8828 start,
8829 query,
8830 )
8831 }
8832
8833 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8837 self.0.request.parent = v.into();
8838 self
8839 }
8840
8841 pub fn set_user_event_rejoin_scope<
8843 T: Into<crate::model::rejoin_user_events_request::UserEventRejoinScope>,
8844 >(
8845 mut self,
8846 v: T,
8847 ) -> Self {
8848 self.0.request.user_event_rejoin_scope = v.into();
8849 self
8850 }
8851 }
8852
8853 #[doc(hidden)]
8854 impl crate::RequestBuilder for RejoinUserEvents {
8855 fn request_options(&mut self) -> &mut crate::RequestOptions {
8856 &mut self.0.options
8857 }
8858 }
8859
8860 #[derive(Clone, Debug)]
8881 pub struct ListOperations(
8882 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8883 );
8884
8885 impl ListOperations {
8886 pub(crate) fn new(
8887 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8888 ) -> Self {
8889 Self(RequestBuilder::new(stub))
8890 }
8891
8892 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8894 mut self,
8895 v: V,
8896 ) -> Self {
8897 self.0.request = v.into();
8898 self
8899 }
8900
8901 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8903 self.0.options = v.into();
8904 self
8905 }
8906
8907 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8909 (*self.0.stub)
8910 .list_operations(self.0.request, self.0.options)
8911 .await
8912 .map(crate::Response::into_body)
8913 }
8914
8915 pub fn by_page(
8917 self,
8918 ) -> impl google_cloud_gax::paginator::Paginator<
8919 google_cloud_longrunning::model::ListOperationsResponse,
8920 crate::Error,
8921 > {
8922 use std::clone::Clone;
8923 let token = self.0.request.page_token.clone();
8924 let execute = move |token: String| {
8925 let mut builder = self.clone();
8926 builder.0.request = builder.0.request.set_page_token(token);
8927 builder.send()
8928 };
8929 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8930 }
8931
8932 pub fn by_item(
8934 self,
8935 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8936 google_cloud_longrunning::model::ListOperationsResponse,
8937 crate::Error,
8938 > {
8939 use google_cloud_gax::paginator::Paginator;
8940 self.by_page().items()
8941 }
8942
8943 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8945 self.0.request.name = v.into();
8946 self
8947 }
8948
8949 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8951 self.0.request.filter = v.into();
8952 self
8953 }
8954
8955 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8957 self.0.request.page_size = v.into();
8958 self
8959 }
8960
8961 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8963 self.0.request.page_token = v.into();
8964 self
8965 }
8966
8967 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8969 self.0.request.return_partial_success = v.into();
8970 self
8971 }
8972 }
8973
8974 #[doc(hidden)]
8975 impl crate::RequestBuilder for ListOperations {
8976 fn request_options(&mut self) -> &mut crate::RequestOptions {
8977 &mut self.0.options
8978 }
8979 }
8980
8981 #[derive(Clone, Debug)]
8998 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8999
9000 impl GetOperation {
9001 pub(crate) fn new(
9002 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
9003 ) -> Self {
9004 Self(RequestBuilder::new(stub))
9005 }
9006
9007 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9009 mut self,
9010 v: V,
9011 ) -> Self {
9012 self.0.request = v.into();
9013 self
9014 }
9015
9016 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9018 self.0.options = v.into();
9019 self
9020 }
9021
9022 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9024 (*self.0.stub)
9025 .get_operation(self.0.request, self.0.options)
9026 .await
9027 .map(crate::Response::into_body)
9028 }
9029
9030 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9032 self.0.request.name = v.into();
9033 self
9034 }
9035 }
9036
9037 #[doc(hidden)]
9038 impl crate::RequestBuilder for GetOperation {
9039 fn request_options(&mut self) -> &mut crate::RequestOptions {
9040 &mut self.0.options
9041 }
9042 }
9043}