1pub mod analytics_service {
19 use crate::Result;
20
21 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::AnalyticsService;
38 pub struct Factory;
39 impl crate::ClientFactory for Factory {
40 type Client = AnalyticsService;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> crate::ClientBuilderResult<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
55 request: R,
56 options: crate::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: crate::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
92 pub struct ExportAnalyticsMetrics(RequestBuilder<crate::model::ExportAnalyticsMetricsRequest>);
93
94 impl ExportAnalyticsMetrics {
95 pub(crate) fn new(
96 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
97 ) -> Self {
98 Self(RequestBuilder::new(stub))
99 }
100
101 pub fn with_request<V: Into<crate::model::ExportAnalyticsMetricsRequest>>(
103 mut self,
104 v: V,
105 ) -> Self {
106 self.0.request = v.into();
107 self
108 }
109
110 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
112 self.0.options = v.into();
113 self
114 }
115
116 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
123 (*self.0.stub)
124 .export_analytics_metrics(self.0.request, self.0.options)
125 .await
126 .map(crate::Response::into_body)
127 }
128
129 pub fn poller(
131 self,
132 ) -> impl google_cloud_lro::Poller<
133 crate::model::ExportAnalyticsMetricsResponse,
134 crate::model::ExportMetadata,
135 > {
136 type Operation = google_cloud_lro::internal::Operation<
137 crate::model::ExportAnalyticsMetricsResponse,
138 crate::model::ExportMetadata,
139 >;
140 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
141 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
142
143 let stub = self.0.stub.clone();
144 let mut options = self.0.options.clone();
145 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
146 let query = move |name| {
147 let stub = stub.clone();
148 let options = options.clone();
149 async {
150 let op = GetOperation::new(stub)
151 .set_name(name)
152 .with_options(options)
153 .send()
154 .await?;
155 Ok(Operation::new(op))
156 }
157 };
158
159 let start = move || async {
160 let op = self.send().await?;
161 Ok(Operation::new(op))
162 };
163
164 google_cloud_lro::internal::new_poller(
165 polling_error_policy,
166 polling_backoff_policy,
167 start,
168 query,
169 )
170 }
171
172 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
176 self.0.request.catalog = v.into();
177 self
178 }
179
180 pub fn set_output_config<T>(mut self, v: T) -> Self
184 where
185 T: std::convert::Into<crate::model::OutputConfig>,
186 {
187 self.0.request.output_config = std::option::Option::Some(v.into());
188 self
189 }
190
191 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
195 where
196 T: std::convert::Into<crate::model::OutputConfig>,
197 {
198 self.0.request.output_config = v.map(|x| x.into());
199 self
200 }
201
202 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
204 self.0.request.filter = v.into();
205 self
206 }
207 }
208
209 #[doc(hidden)]
210 impl crate::RequestBuilder for ExportAnalyticsMetrics {
211 fn request_options(&mut self) -> &mut crate::RequestOptions {
212 &mut self.0.options
213 }
214 }
215
216 #[derive(Clone, Debug)]
237 pub struct ListOperations(
238 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
239 );
240
241 impl ListOperations {
242 pub(crate) fn new(
243 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
244 ) -> Self {
245 Self(RequestBuilder::new(stub))
246 }
247
248 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
250 mut self,
251 v: V,
252 ) -> Self {
253 self.0.request = v.into();
254 self
255 }
256
257 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
259 self.0.options = v.into();
260 self
261 }
262
263 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
265 (*self.0.stub)
266 .list_operations(self.0.request, self.0.options)
267 .await
268 .map(crate::Response::into_body)
269 }
270
271 pub fn by_page(
273 self,
274 ) -> impl google_cloud_gax::paginator::Paginator<
275 google_cloud_longrunning::model::ListOperationsResponse,
276 crate::Error,
277 > {
278 use std::clone::Clone;
279 let token = self.0.request.page_token.clone();
280 let execute = move |token: String| {
281 let mut builder = self.clone();
282 builder.0.request = builder.0.request.set_page_token(token);
283 builder.send()
284 };
285 google_cloud_gax::paginator::internal::new_paginator(token, execute)
286 }
287
288 pub fn by_item(
290 self,
291 ) -> impl google_cloud_gax::paginator::ItemPaginator<
292 google_cloud_longrunning::model::ListOperationsResponse,
293 crate::Error,
294 > {
295 use google_cloud_gax::paginator::Paginator;
296 self.by_page().items()
297 }
298
299 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
301 self.0.request.name = v.into();
302 self
303 }
304
305 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
307 self.0.request.filter = v.into();
308 self
309 }
310
311 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
313 self.0.request.page_size = v.into();
314 self
315 }
316
317 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
319 self.0.request.page_token = v.into();
320 self
321 }
322
323 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
325 self.0.request.return_partial_success = v.into();
326 self
327 }
328 }
329
330 #[doc(hidden)]
331 impl crate::RequestBuilder for ListOperations {
332 fn request_options(&mut self) -> &mut crate::RequestOptions {
333 &mut self.0.options
334 }
335 }
336
337 #[derive(Clone, Debug)]
354 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
355
356 impl GetOperation {
357 pub(crate) fn new(
358 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
359 ) -> Self {
360 Self(RequestBuilder::new(stub))
361 }
362
363 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
365 mut self,
366 v: V,
367 ) -> Self {
368 self.0.request = v.into();
369 self
370 }
371
372 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
374 self.0.options = v.into();
375 self
376 }
377
378 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
380 (*self.0.stub)
381 .get_operation(self.0.request, self.0.options)
382 .await
383 .map(crate::Response::into_body)
384 }
385
386 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
388 self.0.request.name = v.into();
389 self
390 }
391 }
392
393 #[doc(hidden)]
394 impl crate::RequestBuilder for GetOperation {
395 fn request_options(&mut self) -> &mut crate::RequestOptions {
396 &mut self.0.options
397 }
398 }
399}
400
401pub mod catalog_service {
403 use crate::Result;
404
405 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
419
420 pub(crate) mod client {
421 use super::super::super::client::CatalogService;
422 pub struct Factory;
423 impl crate::ClientFactory for Factory {
424 type Client = CatalogService;
425 type Credentials = gaxi::options::Credentials;
426 async fn build(
427 self,
428 config: gaxi::options::ClientConfig,
429 ) -> crate::ClientBuilderResult<Self::Client> {
430 Self::Client::new(config).await
431 }
432 }
433 }
434
435 #[derive(Clone, Debug)]
437 pub(crate) struct RequestBuilder<R: std::default::Default> {
438 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
439 request: R,
440 options: crate::RequestOptions,
441 }
442
443 impl<R> RequestBuilder<R>
444 where
445 R: std::default::Default,
446 {
447 pub(crate) fn new(
448 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
449 ) -> Self {
450 Self {
451 stub,
452 request: R::default(),
453 options: crate::RequestOptions::default(),
454 }
455 }
456 }
457
458 #[derive(Clone, Debug)]
479 pub struct ListCatalogs(RequestBuilder<crate::model::ListCatalogsRequest>);
480
481 impl ListCatalogs {
482 pub(crate) fn new(
483 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
484 ) -> Self {
485 Self(RequestBuilder::new(stub))
486 }
487
488 pub fn with_request<V: Into<crate::model::ListCatalogsRequest>>(mut self, v: V) -> Self {
490 self.0.request = v.into();
491 self
492 }
493
494 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
496 self.0.options = v.into();
497 self
498 }
499
500 pub async fn send(self) -> Result<crate::model::ListCatalogsResponse> {
502 (*self.0.stub)
503 .list_catalogs(self.0.request, self.0.options)
504 .await
505 .map(crate::Response::into_body)
506 }
507
508 pub fn by_page(
510 self,
511 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListCatalogsResponse, crate::Error>
512 {
513 use std::clone::Clone;
514 let token = self.0.request.page_token.clone();
515 let execute = move |token: String| {
516 let mut builder = self.clone();
517 builder.0.request = builder.0.request.set_page_token(token);
518 builder.send()
519 };
520 google_cloud_gax::paginator::internal::new_paginator(token, execute)
521 }
522
523 pub fn by_item(
525 self,
526 ) -> impl google_cloud_gax::paginator::ItemPaginator<
527 crate::model::ListCatalogsResponse,
528 crate::Error,
529 > {
530 use google_cloud_gax::paginator::Paginator;
531 self.by_page().items()
532 }
533
534 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
538 self.0.request.parent = v.into();
539 self
540 }
541
542 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
544 self.0.request.page_size = v.into();
545 self
546 }
547
548 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
550 self.0.request.page_token = v.into();
551 self
552 }
553 }
554
555 #[doc(hidden)]
556 impl crate::RequestBuilder for ListCatalogs {
557 fn request_options(&mut self) -> &mut crate::RequestOptions {
558 &mut self.0.options
559 }
560 }
561
562 #[derive(Clone, Debug)]
579 pub struct UpdateCatalog(RequestBuilder<crate::model::UpdateCatalogRequest>);
580
581 impl UpdateCatalog {
582 pub(crate) fn new(
583 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
584 ) -> Self {
585 Self(RequestBuilder::new(stub))
586 }
587
588 pub fn with_request<V: Into<crate::model::UpdateCatalogRequest>>(mut self, v: V) -> Self {
590 self.0.request = v.into();
591 self
592 }
593
594 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
596 self.0.options = v.into();
597 self
598 }
599
600 pub async fn send(self) -> Result<crate::model::Catalog> {
602 (*self.0.stub)
603 .update_catalog(self.0.request, self.0.options)
604 .await
605 .map(crate::Response::into_body)
606 }
607
608 pub fn set_catalog<T>(mut self, v: T) -> Self
612 where
613 T: std::convert::Into<crate::model::Catalog>,
614 {
615 self.0.request.catalog = std::option::Option::Some(v.into());
616 self
617 }
618
619 pub fn set_or_clear_catalog<T>(mut self, v: std::option::Option<T>) -> Self
623 where
624 T: std::convert::Into<crate::model::Catalog>,
625 {
626 self.0.request.catalog = v.map(|x| x.into());
627 self
628 }
629
630 pub fn set_update_mask<T>(mut self, v: T) -> Self
632 where
633 T: std::convert::Into<wkt::FieldMask>,
634 {
635 self.0.request.update_mask = std::option::Option::Some(v.into());
636 self
637 }
638
639 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
641 where
642 T: std::convert::Into<wkt::FieldMask>,
643 {
644 self.0.request.update_mask = v.map(|x| x.into());
645 self
646 }
647 }
648
649 #[doc(hidden)]
650 impl crate::RequestBuilder for UpdateCatalog {
651 fn request_options(&mut self) -> &mut crate::RequestOptions {
652 &mut self.0.options
653 }
654 }
655
656 #[derive(Clone, Debug)]
673 pub struct SetDefaultBranch(RequestBuilder<crate::model::SetDefaultBranchRequest>);
674
675 impl SetDefaultBranch {
676 pub(crate) fn new(
677 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
678 ) -> Self {
679 Self(RequestBuilder::new(stub))
680 }
681
682 pub fn with_request<V: Into<crate::model::SetDefaultBranchRequest>>(
684 mut self,
685 v: V,
686 ) -> Self {
687 self.0.request = v.into();
688 self
689 }
690
691 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
693 self.0.options = v.into();
694 self
695 }
696
697 pub async fn send(self) -> Result<()> {
699 (*self.0.stub)
700 .set_default_branch(self.0.request, self.0.options)
701 .await
702 .map(crate::Response::into_body)
703 }
704
705 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
707 self.0.request.catalog = v.into();
708 self
709 }
710
711 pub fn set_branch_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
713 self.0.request.branch_id = v.into();
714 self
715 }
716
717 pub fn set_note<T: Into<std::string::String>>(mut self, v: T) -> Self {
719 self.0.request.note = v.into();
720 self
721 }
722
723 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
725 self.0.request.force = v.into();
726 self
727 }
728 }
729
730 #[doc(hidden)]
731 impl crate::RequestBuilder for SetDefaultBranch {
732 fn request_options(&mut self) -> &mut crate::RequestOptions {
733 &mut self.0.options
734 }
735 }
736
737 #[derive(Clone, Debug)]
754 pub struct GetDefaultBranch(RequestBuilder<crate::model::GetDefaultBranchRequest>);
755
756 impl GetDefaultBranch {
757 pub(crate) fn new(
758 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
759 ) -> Self {
760 Self(RequestBuilder::new(stub))
761 }
762
763 pub fn with_request<V: Into<crate::model::GetDefaultBranchRequest>>(
765 mut self,
766 v: V,
767 ) -> Self {
768 self.0.request = v.into();
769 self
770 }
771
772 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
774 self.0.options = v.into();
775 self
776 }
777
778 pub async fn send(self) -> Result<crate::model::GetDefaultBranchResponse> {
780 (*self.0.stub)
781 .get_default_branch(self.0.request, self.0.options)
782 .await
783 .map(crate::Response::into_body)
784 }
785
786 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
788 self.0.request.catalog = v.into();
789 self
790 }
791 }
792
793 #[doc(hidden)]
794 impl crate::RequestBuilder for GetDefaultBranch {
795 fn request_options(&mut self) -> &mut crate::RequestOptions {
796 &mut self.0.options
797 }
798 }
799
800 #[derive(Clone, Debug)]
817 pub struct GetCompletionConfig(RequestBuilder<crate::model::GetCompletionConfigRequest>);
818
819 impl GetCompletionConfig {
820 pub(crate) fn new(
821 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
822 ) -> Self {
823 Self(RequestBuilder::new(stub))
824 }
825
826 pub fn with_request<V: Into<crate::model::GetCompletionConfigRequest>>(
828 mut self,
829 v: V,
830 ) -> Self {
831 self.0.request = v.into();
832 self
833 }
834
835 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
837 self.0.options = v.into();
838 self
839 }
840
841 pub async fn send(self) -> Result<crate::model::CompletionConfig> {
843 (*self.0.stub)
844 .get_completion_config(self.0.request, self.0.options)
845 .await
846 .map(crate::Response::into_body)
847 }
848
849 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
853 self.0.request.name = v.into();
854 self
855 }
856 }
857
858 #[doc(hidden)]
859 impl crate::RequestBuilder for GetCompletionConfig {
860 fn request_options(&mut self) -> &mut crate::RequestOptions {
861 &mut self.0.options
862 }
863 }
864
865 #[derive(Clone, Debug)]
882 pub struct UpdateCompletionConfig(RequestBuilder<crate::model::UpdateCompletionConfigRequest>);
883
884 impl UpdateCompletionConfig {
885 pub(crate) fn new(
886 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
887 ) -> Self {
888 Self(RequestBuilder::new(stub))
889 }
890
891 pub fn with_request<V: Into<crate::model::UpdateCompletionConfigRequest>>(
893 mut self,
894 v: V,
895 ) -> Self {
896 self.0.request = v.into();
897 self
898 }
899
900 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
902 self.0.options = v.into();
903 self
904 }
905
906 pub async fn send(self) -> Result<crate::model::CompletionConfig> {
908 (*self.0.stub)
909 .update_completion_config(self.0.request, self.0.options)
910 .await
911 .map(crate::Response::into_body)
912 }
913
914 pub fn set_completion_config<T>(mut self, v: T) -> Self
918 where
919 T: std::convert::Into<crate::model::CompletionConfig>,
920 {
921 self.0.request.completion_config = std::option::Option::Some(v.into());
922 self
923 }
924
925 pub fn set_or_clear_completion_config<T>(mut self, v: std::option::Option<T>) -> Self
929 where
930 T: std::convert::Into<crate::model::CompletionConfig>,
931 {
932 self.0.request.completion_config = v.map(|x| x.into());
933 self
934 }
935
936 pub fn set_update_mask<T>(mut self, v: T) -> Self
938 where
939 T: std::convert::Into<wkt::FieldMask>,
940 {
941 self.0.request.update_mask = std::option::Option::Some(v.into());
942 self
943 }
944
945 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
947 where
948 T: std::convert::Into<wkt::FieldMask>,
949 {
950 self.0.request.update_mask = v.map(|x| x.into());
951 self
952 }
953 }
954
955 #[doc(hidden)]
956 impl crate::RequestBuilder for UpdateCompletionConfig {
957 fn request_options(&mut self) -> &mut crate::RequestOptions {
958 &mut self.0.options
959 }
960 }
961
962 #[derive(Clone, Debug)]
979 pub struct GetAttributesConfig(RequestBuilder<crate::model::GetAttributesConfigRequest>);
980
981 impl GetAttributesConfig {
982 pub(crate) fn new(
983 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
984 ) -> Self {
985 Self(RequestBuilder::new(stub))
986 }
987
988 pub fn with_request<V: Into<crate::model::GetAttributesConfigRequest>>(
990 mut self,
991 v: V,
992 ) -> Self {
993 self.0.request = v.into();
994 self
995 }
996
997 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
999 self.0.options = v.into();
1000 self
1001 }
1002
1003 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1005 (*self.0.stub)
1006 .get_attributes_config(self.0.request, self.0.options)
1007 .await
1008 .map(crate::Response::into_body)
1009 }
1010
1011 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1015 self.0.request.name = v.into();
1016 self
1017 }
1018 }
1019
1020 #[doc(hidden)]
1021 impl crate::RequestBuilder for GetAttributesConfig {
1022 fn request_options(&mut self) -> &mut crate::RequestOptions {
1023 &mut self.0.options
1024 }
1025 }
1026
1027 #[derive(Clone, Debug)]
1044 pub struct UpdateAttributesConfig(RequestBuilder<crate::model::UpdateAttributesConfigRequest>);
1045
1046 impl UpdateAttributesConfig {
1047 pub(crate) fn new(
1048 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1049 ) -> Self {
1050 Self(RequestBuilder::new(stub))
1051 }
1052
1053 pub fn with_request<V: Into<crate::model::UpdateAttributesConfigRequest>>(
1055 mut self,
1056 v: V,
1057 ) -> Self {
1058 self.0.request = v.into();
1059 self
1060 }
1061
1062 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1064 self.0.options = v.into();
1065 self
1066 }
1067
1068 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1070 (*self.0.stub)
1071 .update_attributes_config(self.0.request, self.0.options)
1072 .await
1073 .map(crate::Response::into_body)
1074 }
1075
1076 pub fn set_attributes_config<T>(mut self, v: T) -> Self
1080 where
1081 T: std::convert::Into<crate::model::AttributesConfig>,
1082 {
1083 self.0.request.attributes_config = std::option::Option::Some(v.into());
1084 self
1085 }
1086
1087 pub fn set_or_clear_attributes_config<T>(mut self, v: std::option::Option<T>) -> Self
1091 where
1092 T: std::convert::Into<crate::model::AttributesConfig>,
1093 {
1094 self.0.request.attributes_config = v.map(|x| x.into());
1095 self
1096 }
1097
1098 pub fn set_update_mask<T>(mut self, v: T) -> Self
1100 where
1101 T: std::convert::Into<wkt::FieldMask>,
1102 {
1103 self.0.request.update_mask = std::option::Option::Some(v.into());
1104 self
1105 }
1106
1107 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1109 where
1110 T: std::convert::Into<wkt::FieldMask>,
1111 {
1112 self.0.request.update_mask = v.map(|x| x.into());
1113 self
1114 }
1115 }
1116
1117 #[doc(hidden)]
1118 impl crate::RequestBuilder for UpdateAttributesConfig {
1119 fn request_options(&mut self) -> &mut crate::RequestOptions {
1120 &mut self.0.options
1121 }
1122 }
1123
1124 #[derive(Clone, Debug)]
1141 pub struct AddCatalogAttribute(RequestBuilder<crate::model::AddCatalogAttributeRequest>);
1142
1143 impl AddCatalogAttribute {
1144 pub(crate) fn new(
1145 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1146 ) -> Self {
1147 Self(RequestBuilder::new(stub))
1148 }
1149
1150 pub fn with_request<V: Into<crate::model::AddCatalogAttributeRequest>>(
1152 mut self,
1153 v: V,
1154 ) -> Self {
1155 self.0.request = v.into();
1156 self
1157 }
1158
1159 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1161 self.0.options = v.into();
1162 self
1163 }
1164
1165 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1167 (*self.0.stub)
1168 .add_catalog_attribute(self.0.request, self.0.options)
1169 .await
1170 .map(crate::Response::into_body)
1171 }
1172
1173 pub fn set_attributes_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
1177 self.0.request.attributes_config = v.into();
1178 self
1179 }
1180
1181 pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
1185 where
1186 T: std::convert::Into<crate::model::CatalogAttribute>,
1187 {
1188 self.0.request.catalog_attribute = std::option::Option::Some(v.into());
1189 self
1190 }
1191
1192 pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
1196 where
1197 T: std::convert::Into<crate::model::CatalogAttribute>,
1198 {
1199 self.0.request.catalog_attribute = v.map(|x| x.into());
1200 self
1201 }
1202 }
1203
1204 #[doc(hidden)]
1205 impl crate::RequestBuilder for AddCatalogAttribute {
1206 fn request_options(&mut self) -> &mut crate::RequestOptions {
1207 &mut self.0.options
1208 }
1209 }
1210
1211 #[derive(Clone, Debug)]
1228 pub struct RemoveCatalogAttribute(RequestBuilder<crate::model::RemoveCatalogAttributeRequest>);
1229
1230 impl RemoveCatalogAttribute {
1231 pub(crate) fn new(
1232 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1233 ) -> Self {
1234 Self(RequestBuilder::new(stub))
1235 }
1236
1237 pub fn with_request<V: Into<crate::model::RemoveCatalogAttributeRequest>>(
1239 mut self,
1240 v: V,
1241 ) -> Self {
1242 self.0.request = v.into();
1243 self
1244 }
1245
1246 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1248 self.0.options = v.into();
1249 self
1250 }
1251
1252 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1254 (*self.0.stub)
1255 .remove_catalog_attribute(self.0.request, self.0.options)
1256 .await
1257 .map(crate::Response::into_body)
1258 }
1259
1260 pub fn set_attributes_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
1264 self.0.request.attributes_config = v.into();
1265 self
1266 }
1267
1268 pub fn set_key<T: Into<std::string::String>>(mut self, v: T) -> Self {
1272 self.0.request.key = v.into();
1273 self
1274 }
1275 }
1276
1277 #[doc(hidden)]
1278 impl crate::RequestBuilder for RemoveCatalogAttribute {
1279 fn request_options(&mut self) -> &mut crate::RequestOptions {
1280 &mut self.0.options
1281 }
1282 }
1283
1284 #[derive(Clone, Debug)]
1301 pub struct ReplaceCatalogAttribute(
1302 RequestBuilder<crate::model::ReplaceCatalogAttributeRequest>,
1303 );
1304
1305 impl ReplaceCatalogAttribute {
1306 pub(crate) fn new(
1307 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1308 ) -> Self {
1309 Self(RequestBuilder::new(stub))
1310 }
1311
1312 pub fn with_request<V: Into<crate::model::ReplaceCatalogAttributeRequest>>(
1314 mut self,
1315 v: V,
1316 ) -> Self {
1317 self.0.request = v.into();
1318 self
1319 }
1320
1321 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1323 self.0.options = v.into();
1324 self
1325 }
1326
1327 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1329 (*self.0.stub)
1330 .replace_catalog_attribute(self.0.request, self.0.options)
1331 .await
1332 .map(crate::Response::into_body)
1333 }
1334
1335 pub fn set_attributes_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
1339 self.0.request.attributes_config = v.into();
1340 self
1341 }
1342
1343 pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
1347 where
1348 T: std::convert::Into<crate::model::CatalogAttribute>,
1349 {
1350 self.0.request.catalog_attribute = std::option::Option::Some(v.into());
1351 self
1352 }
1353
1354 pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
1358 where
1359 T: std::convert::Into<crate::model::CatalogAttribute>,
1360 {
1361 self.0.request.catalog_attribute = v.map(|x| x.into());
1362 self
1363 }
1364
1365 pub fn set_update_mask<T>(mut self, v: T) -> Self
1367 where
1368 T: std::convert::Into<wkt::FieldMask>,
1369 {
1370 self.0.request.update_mask = std::option::Option::Some(v.into());
1371 self
1372 }
1373
1374 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1376 where
1377 T: std::convert::Into<wkt::FieldMask>,
1378 {
1379 self.0.request.update_mask = v.map(|x| x.into());
1380 self
1381 }
1382 }
1383
1384 #[doc(hidden)]
1385 impl crate::RequestBuilder for ReplaceCatalogAttribute {
1386 fn request_options(&mut self) -> &mut crate::RequestOptions {
1387 &mut self.0.options
1388 }
1389 }
1390
1391 #[derive(Clone, Debug)]
1412 pub struct ListOperations(
1413 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1414 );
1415
1416 impl ListOperations {
1417 pub(crate) fn new(
1418 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1419 ) -> Self {
1420 Self(RequestBuilder::new(stub))
1421 }
1422
1423 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1425 mut self,
1426 v: V,
1427 ) -> Self {
1428 self.0.request = v.into();
1429 self
1430 }
1431
1432 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1434 self.0.options = v.into();
1435 self
1436 }
1437
1438 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1440 (*self.0.stub)
1441 .list_operations(self.0.request, self.0.options)
1442 .await
1443 .map(crate::Response::into_body)
1444 }
1445
1446 pub fn by_page(
1448 self,
1449 ) -> impl google_cloud_gax::paginator::Paginator<
1450 google_cloud_longrunning::model::ListOperationsResponse,
1451 crate::Error,
1452 > {
1453 use std::clone::Clone;
1454 let token = self.0.request.page_token.clone();
1455 let execute = move |token: String| {
1456 let mut builder = self.clone();
1457 builder.0.request = builder.0.request.set_page_token(token);
1458 builder.send()
1459 };
1460 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1461 }
1462
1463 pub fn by_item(
1465 self,
1466 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1467 google_cloud_longrunning::model::ListOperationsResponse,
1468 crate::Error,
1469 > {
1470 use google_cloud_gax::paginator::Paginator;
1471 self.by_page().items()
1472 }
1473
1474 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1476 self.0.request.name = v.into();
1477 self
1478 }
1479
1480 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1482 self.0.request.filter = v.into();
1483 self
1484 }
1485
1486 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1488 self.0.request.page_size = v.into();
1489 self
1490 }
1491
1492 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1494 self.0.request.page_token = v.into();
1495 self
1496 }
1497
1498 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1500 self.0.request.return_partial_success = v.into();
1501 self
1502 }
1503 }
1504
1505 #[doc(hidden)]
1506 impl crate::RequestBuilder for ListOperations {
1507 fn request_options(&mut self) -> &mut crate::RequestOptions {
1508 &mut self.0.options
1509 }
1510 }
1511
1512 #[derive(Clone, Debug)]
1529 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1530
1531 impl GetOperation {
1532 pub(crate) fn new(
1533 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1534 ) -> Self {
1535 Self(RequestBuilder::new(stub))
1536 }
1537
1538 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1540 mut self,
1541 v: V,
1542 ) -> Self {
1543 self.0.request = v.into();
1544 self
1545 }
1546
1547 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1549 self.0.options = v.into();
1550 self
1551 }
1552
1553 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1555 (*self.0.stub)
1556 .get_operation(self.0.request, self.0.options)
1557 .await
1558 .map(crate::Response::into_body)
1559 }
1560
1561 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1563 self.0.request.name = v.into();
1564 self
1565 }
1566 }
1567
1568 #[doc(hidden)]
1569 impl crate::RequestBuilder for GetOperation {
1570 fn request_options(&mut self) -> &mut crate::RequestOptions {
1571 &mut self.0.options
1572 }
1573 }
1574}
1575
1576pub mod completion_service {
1578 use crate::Result;
1579
1580 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1594
1595 pub(crate) mod client {
1596 use super::super::super::client::CompletionService;
1597 pub struct Factory;
1598 impl crate::ClientFactory for Factory {
1599 type Client = CompletionService;
1600 type Credentials = gaxi::options::Credentials;
1601 async fn build(
1602 self,
1603 config: gaxi::options::ClientConfig,
1604 ) -> crate::ClientBuilderResult<Self::Client> {
1605 Self::Client::new(config).await
1606 }
1607 }
1608 }
1609
1610 #[derive(Clone, Debug)]
1612 pub(crate) struct RequestBuilder<R: std::default::Default> {
1613 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1614 request: R,
1615 options: crate::RequestOptions,
1616 }
1617
1618 impl<R> RequestBuilder<R>
1619 where
1620 R: std::default::Default,
1621 {
1622 pub(crate) fn new(
1623 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1624 ) -> Self {
1625 Self {
1626 stub,
1627 request: R::default(),
1628 options: crate::RequestOptions::default(),
1629 }
1630 }
1631 }
1632
1633 #[derive(Clone, Debug)]
1650 pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1651
1652 impl CompleteQuery {
1653 pub(crate) fn new(
1654 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1655 ) -> Self {
1656 Self(RequestBuilder::new(stub))
1657 }
1658
1659 pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1661 self.0.request = v.into();
1662 self
1663 }
1664
1665 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1667 self.0.options = v.into();
1668 self
1669 }
1670
1671 pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1673 (*self.0.stub)
1674 .complete_query(self.0.request, self.0.options)
1675 .await
1676 .map(crate::Response::into_body)
1677 }
1678
1679 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
1683 self.0.request.catalog = v.into();
1684 self
1685 }
1686
1687 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1691 self.0.request.query = v.into();
1692 self
1693 }
1694
1695 pub fn set_visitor_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1697 self.0.request.visitor_id = v.into();
1698 self
1699 }
1700
1701 pub fn set_language_codes<T, V>(mut self, v: T) -> Self
1703 where
1704 T: std::iter::IntoIterator<Item = V>,
1705 V: std::convert::Into<std::string::String>,
1706 {
1707 use std::iter::Iterator;
1708 self.0.request.language_codes = v.into_iter().map(|i| i.into()).collect();
1709 self
1710 }
1711
1712 pub fn set_device_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
1714 self.0.request.device_type = v.into();
1715 self
1716 }
1717
1718 pub fn set_dataset<T: Into<std::string::String>>(mut self, v: T) -> Self {
1720 self.0.request.dataset = v.into();
1721 self
1722 }
1723
1724 pub fn set_max_suggestions<T: Into<i32>>(mut self, v: T) -> Self {
1726 self.0.request.max_suggestions = v.into();
1727 self
1728 }
1729
1730 pub fn set_enable_attribute_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1732 self.0.request.enable_attribute_suggestions = v.into();
1733 self
1734 }
1735
1736 pub fn set_entity<T: Into<std::string::String>>(mut self, v: T) -> Self {
1738 self.0.request.entity = v.into();
1739 self
1740 }
1741 }
1742
1743 #[doc(hidden)]
1744 impl crate::RequestBuilder for CompleteQuery {
1745 fn request_options(&mut self) -> &mut crate::RequestOptions {
1746 &mut self.0.options
1747 }
1748 }
1749
1750 #[derive(Clone, Debug)]
1768 pub struct ImportCompletionData(RequestBuilder<crate::model::ImportCompletionDataRequest>);
1769
1770 impl ImportCompletionData {
1771 pub(crate) fn new(
1772 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1773 ) -> Self {
1774 Self(RequestBuilder::new(stub))
1775 }
1776
1777 pub fn with_request<V: Into<crate::model::ImportCompletionDataRequest>>(
1779 mut self,
1780 v: V,
1781 ) -> Self {
1782 self.0.request = v.into();
1783 self
1784 }
1785
1786 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1788 self.0.options = v.into();
1789 self
1790 }
1791
1792 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1799 (*self.0.stub)
1800 .import_completion_data(self.0.request, self.0.options)
1801 .await
1802 .map(crate::Response::into_body)
1803 }
1804
1805 pub fn poller(
1807 self,
1808 ) -> impl google_cloud_lro::Poller<
1809 crate::model::ImportCompletionDataResponse,
1810 crate::model::ImportMetadata,
1811 > {
1812 type Operation = google_cloud_lro::internal::Operation<
1813 crate::model::ImportCompletionDataResponse,
1814 crate::model::ImportMetadata,
1815 >;
1816 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1817 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1818
1819 let stub = self.0.stub.clone();
1820 let mut options = self.0.options.clone();
1821 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1822 let query = move |name| {
1823 let stub = stub.clone();
1824 let options = options.clone();
1825 async {
1826 let op = GetOperation::new(stub)
1827 .set_name(name)
1828 .with_options(options)
1829 .send()
1830 .await?;
1831 Ok(Operation::new(op))
1832 }
1833 };
1834
1835 let start = move || async {
1836 let op = self.send().await?;
1837 Ok(Operation::new(op))
1838 };
1839
1840 google_cloud_lro::internal::new_poller(
1841 polling_error_policy,
1842 polling_backoff_policy,
1843 start,
1844 query,
1845 )
1846 }
1847
1848 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1852 self.0.request.parent = v.into();
1853 self
1854 }
1855
1856 pub fn set_input_config<T>(mut self, v: T) -> Self
1860 where
1861 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
1862 {
1863 self.0.request.input_config = std::option::Option::Some(v.into());
1864 self
1865 }
1866
1867 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
1871 where
1872 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
1873 {
1874 self.0.request.input_config = v.map(|x| x.into());
1875 self
1876 }
1877
1878 pub fn set_notification_pubsub_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
1880 self.0.request.notification_pubsub_topic = v.into();
1881 self
1882 }
1883 }
1884
1885 #[doc(hidden)]
1886 impl crate::RequestBuilder for ImportCompletionData {
1887 fn request_options(&mut self) -> &mut crate::RequestOptions {
1888 &mut self.0.options
1889 }
1890 }
1891
1892 #[derive(Clone, Debug)]
1913 pub struct ListOperations(
1914 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1915 );
1916
1917 impl ListOperations {
1918 pub(crate) fn new(
1919 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1920 ) -> Self {
1921 Self(RequestBuilder::new(stub))
1922 }
1923
1924 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1926 mut self,
1927 v: V,
1928 ) -> Self {
1929 self.0.request = v.into();
1930 self
1931 }
1932
1933 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1935 self.0.options = v.into();
1936 self
1937 }
1938
1939 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1941 (*self.0.stub)
1942 .list_operations(self.0.request, self.0.options)
1943 .await
1944 .map(crate::Response::into_body)
1945 }
1946
1947 pub fn by_page(
1949 self,
1950 ) -> impl google_cloud_gax::paginator::Paginator<
1951 google_cloud_longrunning::model::ListOperationsResponse,
1952 crate::Error,
1953 > {
1954 use std::clone::Clone;
1955 let token = self.0.request.page_token.clone();
1956 let execute = move |token: String| {
1957 let mut builder = self.clone();
1958 builder.0.request = builder.0.request.set_page_token(token);
1959 builder.send()
1960 };
1961 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1962 }
1963
1964 pub fn by_item(
1966 self,
1967 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1968 google_cloud_longrunning::model::ListOperationsResponse,
1969 crate::Error,
1970 > {
1971 use google_cloud_gax::paginator::Paginator;
1972 self.by_page().items()
1973 }
1974
1975 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1977 self.0.request.name = v.into();
1978 self
1979 }
1980
1981 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1983 self.0.request.filter = v.into();
1984 self
1985 }
1986
1987 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1989 self.0.request.page_size = v.into();
1990 self
1991 }
1992
1993 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1995 self.0.request.page_token = v.into();
1996 self
1997 }
1998
1999 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2001 self.0.request.return_partial_success = v.into();
2002 self
2003 }
2004 }
2005
2006 #[doc(hidden)]
2007 impl crate::RequestBuilder for ListOperations {
2008 fn request_options(&mut self) -> &mut crate::RequestOptions {
2009 &mut self.0.options
2010 }
2011 }
2012
2013 #[derive(Clone, Debug)]
2030 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2031
2032 impl GetOperation {
2033 pub(crate) fn new(
2034 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
2035 ) -> Self {
2036 Self(RequestBuilder::new(stub))
2037 }
2038
2039 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2041 mut self,
2042 v: V,
2043 ) -> Self {
2044 self.0.request = v.into();
2045 self
2046 }
2047
2048 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2050 self.0.options = v.into();
2051 self
2052 }
2053
2054 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2056 (*self.0.stub)
2057 .get_operation(self.0.request, self.0.options)
2058 .await
2059 .map(crate::Response::into_body)
2060 }
2061
2062 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2064 self.0.request.name = v.into();
2065 self
2066 }
2067 }
2068
2069 #[doc(hidden)]
2070 impl crate::RequestBuilder for GetOperation {
2071 fn request_options(&mut self) -> &mut crate::RequestOptions {
2072 &mut self.0.options
2073 }
2074 }
2075}
2076
2077pub mod control_service {
2079 use crate::Result;
2080
2081 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2095
2096 pub(crate) mod client {
2097 use super::super::super::client::ControlService;
2098 pub struct Factory;
2099 impl crate::ClientFactory for Factory {
2100 type Client = ControlService;
2101 type Credentials = gaxi::options::Credentials;
2102 async fn build(
2103 self,
2104 config: gaxi::options::ClientConfig,
2105 ) -> crate::ClientBuilderResult<Self::Client> {
2106 Self::Client::new(config).await
2107 }
2108 }
2109 }
2110
2111 #[derive(Clone, Debug)]
2113 pub(crate) struct RequestBuilder<R: std::default::Default> {
2114 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2115 request: R,
2116 options: crate::RequestOptions,
2117 }
2118
2119 impl<R> RequestBuilder<R>
2120 where
2121 R: std::default::Default,
2122 {
2123 pub(crate) fn new(
2124 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2125 ) -> Self {
2126 Self {
2127 stub,
2128 request: R::default(),
2129 options: crate::RequestOptions::default(),
2130 }
2131 }
2132 }
2133
2134 #[derive(Clone, Debug)]
2151 pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2152
2153 impl CreateControl {
2154 pub(crate) fn new(
2155 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2156 ) -> Self {
2157 Self(RequestBuilder::new(stub))
2158 }
2159
2160 pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2162 self.0.request = v.into();
2163 self
2164 }
2165
2166 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2168 self.0.options = v.into();
2169 self
2170 }
2171
2172 pub async fn send(self) -> Result<crate::model::Control> {
2174 (*self.0.stub)
2175 .create_control(self.0.request, self.0.options)
2176 .await
2177 .map(crate::Response::into_body)
2178 }
2179
2180 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2184 self.0.request.parent = v.into();
2185 self
2186 }
2187
2188 pub fn set_control<T>(mut self, v: T) -> Self
2192 where
2193 T: std::convert::Into<crate::model::Control>,
2194 {
2195 self.0.request.control = std::option::Option::Some(v.into());
2196 self
2197 }
2198
2199 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2203 where
2204 T: std::convert::Into<crate::model::Control>,
2205 {
2206 self.0.request.control = v.map(|x| x.into());
2207 self
2208 }
2209
2210 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2214 self.0.request.control_id = v.into();
2215 self
2216 }
2217 }
2218
2219 #[doc(hidden)]
2220 impl crate::RequestBuilder for CreateControl {
2221 fn request_options(&mut self) -> &mut crate::RequestOptions {
2222 &mut self.0.options
2223 }
2224 }
2225
2226 #[derive(Clone, Debug)]
2243 pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2244
2245 impl DeleteControl {
2246 pub(crate) fn new(
2247 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2248 ) -> Self {
2249 Self(RequestBuilder::new(stub))
2250 }
2251
2252 pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2254 self.0.request = v.into();
2255 self
2256 }
2257
2258 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2260 self.0.options = v.into();
2261 self
2262 }
2263
2264 pub async fn send(self) -> Result<()> {
2266 (*self.0.stub)
2267 .delete_control(self.0.request, self.0.options)
2268 .await
2269 .map(crate::Response::into_body)
2270 }
2271
2272 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2276 self.0.request.name = v.into();
2277 self
2278 }
2279 }
2280
2281 #[doc(hidden)]
2282 impl crate::RequestBuilder for DeleteControl {
2283 fn request_options(&mut self) -> &mut crate::RequestOptions {
2284 &mut self.0.options
2285 }
2286 }
2287
2288 #[derive(Clone, Debug)]
2305 pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2306
2307 impl UpdateControl {
2308 pub(crate) fn new(
2309 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2310 ) -> Self {
2311 Self(RequestBuilder::new(stub))
2312 }
2313
2314 pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2316 self.0.request = v.into();
2317 self
2318 }
2319
2320 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2322 self.0.options = v.into();
2323 self
2324 }
2325
2326 pub async fn send(self) -> Result<crate::model::Control> {
2328 (*self.0.stub)
2329 .update_control(self.0.request, self.0.options)
2330 .await
2331 .map(crate::Response::into_body)
2332 }
2333
2334 pub fn set_control<T>(mut self, v: T) -> Self
2338 where
2339 T: std::convert::Into<crate::model::Control>,
2340 {
2341 self.0.request.control = std::option::Option::Some(v.into());
2342 self
2343 }
2344
2345 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2349 where
2350 T: std::convert::Into<crate::model::Control>,
2351 {
2352 self.0.request.control = v.map(|x| x.into());
2353 self
2354 }
2355
2356 pub fn set_update_mask<T>(mut self, v: T) -> Self
2358 where
2359 T: std::convert::Into<wkt::FieldMask>,
2360 {
2361 self.0.request.update_mask = std::option::Option::Some(v.into());
2362 self
2363 }
2364
2365 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2367 where
2368 T: std::convert::Into<wkt::FieldMask>,
2369 {
2370 self.0.request.update_mask = v.map(|x| x.into());
2371 self
2372 }
2373 }
2374
2375 #[doc(hidden)]
2376 impl crate::RequestBuilder for UpdateControl {
2377 fn request_options(&mut self) -> &mut crate::RequestOptions {
2378 &mut self.0.options
2379 }
2380 }
2381
2382 #[derive(Clone, Debug)]
2399 pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2400
2401 impl GetControl {
2402 pub(crate) fn new(
2403 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2404 ) -> Self {
2405 Self(RequestBuilder::new(stub))
2406 }
2407
2408 pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2410 self.0.request = v.into();
2411 self
2412 }
2413
2414 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2416 self.0.options = v.into();
2417 self
2418 }
2419
2420 pub async fn send(self) -> Result<crate::model::Control> {
2422 (*self.0.stub)
2423 .get_control(self.0.request, self.0.options)
2424 .await
2425 .map(crate::Response::into_body)
2426 }
2427
2428 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2432 self.0.request.name = v.into();
2433 self
2434 }
2435 }
2436
2437 #[doc(hidden)]
2438 impl crate::RequestBuilder for GetControl {
2439 fn request_options(&mut self) -> &mut crate::RequestOptions {
2440 &mut self.0.options
2441 }
2442 }
2443
2444 #[derive(Clone, Debug)]
2465 pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2466
2467 impl ListControls {
2468 pub(crate) fn new(
2469 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2470 ) -> Self {
2471 Self(RequestBuilder::new(stub))
2472 }
2473
2474 pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2476 self.0.request = v.into();
2477 self
2478 }
2479
2480 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2482 self.0.options = v.into();
2483 self
2484 }
2485
2486 pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2488 (*self.0.stub)
2489 .list_controls(self.0.request, self.0.options)
2490 .await
2491 .map(crate::Response::into_body)
2492 }
2493
2494 pub fn by_page(
2496 self,
2497 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListControlsResponse, crate::Error>
2498 {
2499 use std::clone::Clone;
2500 let token = self.0.request.page_token.clone();
2501 let execute = move |token: String| {
2502 let mut builder = self.clone();
2503 builder.0.request = builder.0.request.set_page_token(token);
2504 builder.send()
2505 };
2506 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2507 }
2508
2509 pub fn by_item(
2511 self,
2512 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2513 crate::model::ListControlsResponse,
2514 crate::Error,
2515 > {
2516 use google_cloud_gax::paginator::Paginator;
2517 self.by_page().items()
2518 }
2519
2520 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2524 self.0.request.parent = v.into();
2525 self
2526 }
2527
2528 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2530 self.0.request.page_size = v.into();
2531 self
2532 }
2533
2534 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2536 self.0.request.page_token = v.into();
2537 self
2538 }
2539
2540 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2542 self.0.request.filter = v.into();
2543 self
2544 }
2545 }
2546
2547 #[doc(hidden)]
2548 impl crate::RequestBuilder for ListControls {
2549 fn request_options(&mut self) -> &mut crate::RequestOptions {
2550 &mut self.0.options
2551 }
2552 }
2553
2554 #[derive(Clone, Debug)]
2575 pub struct ListOperations(
2576 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2577 );
2578
2579 impl ListOperations {
2580 pub(crate) fn new(
2581 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2582 ) -> Self {
2583 Self(RequestBuilder::new(stub))
2584 }
2585
2586 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2588 mut self,
2589 v: V,
2590 ) -> Self {
2591 self.0.request = v.into();
2592 self
2593 }
2594
2595 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2597 self.0.options = v.into();
2598 self
2599 }
2600
2601 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2603 (*self.0.stub)
2604 .list_operations(self.0.request, self.0.options)
2605 .await
2606 .map(crate::Response::into_body)
2607 }
2608
2609 pub fn by_page(
2611 self,
2612 ) -> impl google_cloud_gax::paginator::Paginator<
2613 google_cloud_longrunning::model::ListOperationsResponse,
2614 crate::Error,
2615 > {
2616 use std::clone::Clone;
2617 let token = self.0.request.page_token.clone();
2618 let execute = move |token: String| {
2619 let mut builder = self.clone();
2620 builder.0.request = builder.0.request.set_page_token(token);
2621 builder.send()
2622 };
2623 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2624 }
2625
2626 pub fn by_item(
2628 self,
2629 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2630 google_cloud_longrunning::model::ListOperationsResponse,
2631 crate::Error,
2632 > {
2633 use google_cloud_gax::paginator::Paginator;
2634 self.by_page().items()
2635 }
2636
2637 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2639 self.0.request.name = v.into();
2640 self
2641 }
2642
2643 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2645 self.0.request.filter = v.into();
2646 self
2647 }
2648
2649 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2651 self.0.request.page_size = v.into();
2652 self
2653 }
2654
2655 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2657 self.0.request.page_token = v.into();
2658 self
2659 }
2660
2661 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2663 self.0.request.return_partial_success = v.into();
2664 self
2665 }
2666 }
2667
2668 #[doc(hidden)]
2669 impl crate::RequestBuilder for ListOperations {
2670 fn request_options(&mut self) -> &mut crate::RequestOptions {
2671 &mut self.0.options
2672 }
2673 }
2674
2675 #[derive(Clone, Debug)]
2692 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2693
2694 impl GetOperation {
2695 pub(crate) fn new(
2696 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2697 ) -> Self {
2698 Self(RequestBuilder::new(stub))
2699 }
2700
2701 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2703 mut self,
2704 v: V,
2705 ) -> Self {
2706 self.0.request = v.into();
2707 self
2708 }
2709
2710 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2712 self.0.options = v.into();
2713 self
2714 }
2715
2716 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2718 (*self.0.stub)
2719 .get_operation(self.0.request, self.0.options)
2720 .await
2721 .map(crate::Response::into_body)
2722 }
2723
2724 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2726 self.0.request.name = v.into();
2727 self
2728 }
2729 }
2730
2731 #[doc(hidden)]
2732 impl crate::RequestBuilder for GetOperation {
2733 fn request_options(&mut self) -> &mut crate::RequestOptions {
2734 &mut self.0.options
2735 }
2736 }
2737}
2738
2739pub mod conversational_search_service {
2741 use crate::Result;
2742
2743 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2757
2758 pub(crate) mod client {
2759 use super::super::super::client::ConversationalSearchService;
2760 pub struct Factory;
2761 impl crate::ClientFactory for Factory {
2762 type Client = ConversationalSearchService;
2763 type Credentials = gaxi::options::Credentials;
2764 async fn build(
2765 self,
2766 config: gaxi::options::ClientConfig,
2767 ) -> crate::ClientBuilderResult<Self::Client> {
2768 Self::Client::new(config).await
2769 }
2770 }
2771 }
2772
2773 #[derive(Clone, Debug)]
2775 pub(crate) struct RequestBuilder<R: std::default::Default> {
2776 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2777 request: R,
2778 options: crate::RequestOptions,
2779 }
2780
2781 impl<R> RequestBuilder<R>
2782 where
2783 R: std::default::Default,
2784 {
2785 pub(crate) fn new(
2786 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2787 ) -> Self {
2788 Self {
2789 stub,
2790 request: R::default(),
2791 options: crate::RequestOptions::default(),
2792 }
2793 }
2794 }
2795
2796 #[derive(Clone, Debug)]
2817 pub struct ListOperations(
2818 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2819 );
2820
2821 impl ListOperations {
2822 pub(crate) fn new(
2823 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2824 ) -> Self {
2825 Self(RequestBuilder::new(stub))
2826 }
2827
2828 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2830 mut self,
2831 v: V,
2832 ) -> Self {
2833 self.0.request = v.into();
2834 self
2835 }
2836
2837 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2839 self.0.options = v.into();
2840 self
2841 }
2842
2843 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2845 (*self.0.stub)
2846 .list_operations(self.0.request, self.0.options)
2847 .await
2848 .map(crate::Response::into_body)
2849 }
2850
2851 pub fn by_page(
2853 self,
2854 ) -> impl google_cloud_gax::paginator::Paginator<
2855 google_cloud_longrunning::model::ListOperationsResponse,
2856 crate::Error,
2857 > {
2858 use std::clone::Clone;
2859 let token = self.0.request.page_token.clone();
2860 let execute = move |token: String| {
2861 let mut builder = self.clone();
2862 builder.0.request = builder.0.request.set_page_token(token);
2863 builder.send()
2864 };
2865 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2866 }
2867
2868 pub fn by_item(
2870 self,
2871 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2872 google_cloud_longrunning::model::ListOperationsResponse,
2873 crate::Error,
2874 > {
2875 use google_cloud_gax::paginator::Paginator;
2876 self.by_page().items()
2877 }
2878
2879 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2881 self.0.request.name = v.into();
2882 self
2883 }
2884
2885 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2887 self.0.request.filter = v.into();
2888 self
2889 }
2890
2891 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2893 self.0.request.page_size = v.into();
2894 self
2895 }
2896
2897 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2899 self.0.request.page_token = v.into();
2900 self
2901 }
2902
2903 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2905 self.0.request.return_partial_success = v.into();
2906 self
2907 }
2908 }
2909
2910 #[doc(hidden)]
2911 impl crate::RequestBuilder for ListOperations {
2912 fn request_options(&mut self) -> &mut crate::RequestOptions {
2913 &mut self.0.options
2914 }
2915 }
2916
2917 #[derive(Clone, Debug)]
2934 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2935
2936 impl GetOperation {
2937 pub(crate) fn new(
2938 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2939 ) -> Self {
2940 Self(RequestBuilder::new(stub))
2941 }
2942
2943 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2945 mut self,
2946 v: V,
2947 ) -> Self {
2948 self.0.request = v.into();
2949 self
2950 }
2951
2952 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2954 self.0.options = v.into();
2955 self
2956 }
2957
2958 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2960 (*self.0.stub)
2961 .get_operation(self.0.request, self.0.options)
2962 .await
2963 .map(crate::Response::into_body)
2964 }
2965
2966 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2968 self.0.request.name = v.into();
2969 self
2970 }
2971 }
2972
2973 #[doc(hidden)]
2974 impl crate::RequestBuilder for GetOperation {
2975 fn request_options(&mut self) -> &mut crate::RequestOptions {
2976 &mut self.0.options
2977 }
2978 }
2979}
2980
2981pub mod generative_question_service {
2983 use crate::Result;
2984
2985 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2999
3000 pub(crate) mod client {
3001 use super::super::super::client::GenerativeQuestionService;
3002 pub struct Factory;
3003 impl crate::ClientFactory for Factory {
3004 type Client = GenerativeQuestionService;
3005 type Credentials = gaxi::options::Credentials;
3006 async fn build(
3007 self,
3008 config: gaxi::options::ClientConfig,
3009 ) -> crate::ClientBuilderResult<Self::Client> {
3010 Self::Client::new(config).await
3011 }
3012 }
3013 }
3014
3015 #[derive(Clone, Debug)]
3017 pub(crate) struct RequestBuilder<R: std::default::Default> {
3018 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3019 request: R,
3020 options: crate::RequestOptions,
3021 }
3022
3023 impl<R> RequestBuilder<R>
3024 where
3025 R: std::default::Default,
3026 {
3027 pub(crate) fn new(
3028 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3029 ) -> Self {
3030 Self {
3031 stub,
3032 request: R::default(),
3033 options: crate::RequestOptions::default(),
3034 }
3035 }
3036 }
3037
3038 #[derive(Clone, Debug)]
3055 pub struct UpdateGenerativeQuestionsFeatureConfig(
3056 RequestBuilder<crate::model::UpdateGenerativeQuestionsFeatureConfigRequest>,
3057 );
3058
3059 impl UpdateGenerativeQuestionsFeatureConfig {
3060 pub(crate) fn new(
3061 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3062 ) -> Self {
3063 Self(RequestBuilder::new(stub))
3064 }
3065
3066 pub fn with_request<
3068 V: Into<crate::model::UpdateGenerativeQuestionsFeatureConfigRequest>,
3069 >(
3070 mut self,
3071 v: V,
3072 ) -> Self {
3073 self.0.request = v.into();
3074 self
3075 }
3076
3077 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3079 self.0.options = v.into();
3080 self
3081 }
3082
3083 pub async fn send(self) -> Result<crate::model::GenerativeQuestionsFeatureConfig> {
3085 (*self.0.stub)
3086 .update_generative_questions_feature_config(self.0.request, self.0.options)
3087 .await
3088 .map(crate::Response::into_body)
3089 }
3090
3091 pub fn set_generative_questions_feature_config<T>(mut self, v: T) -> Self
3095 where
3096 T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
3097 {
3098 self.0.request.generative_questions_feature_config =
3099 std::option::Option::Some(v.into());
3100 self
3101 }
3102
3103 pub fn set_or_clear_generative_questions_feature_config<T>(
3107 mut self,
3108 v: std::option::Option<T>,
3109 ) -> Self
3110 where
3111 T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
3112 {
3113 self.0.request.generative_questions_feature_config = v.map(|x| x.into());
3114 self
3115 }
3116
3117 pub fn set_update_mask<T>(mut self, v: T) -> Self
3119 where
3120 T: std::convert::Into<wkt::FieldMask>,
3121 {
3122 self.0.request.update_mask = std::option::Option::Some(v.into());
3123 self
3124 }
3125
3126 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3128 where
3129 T: std::convert::Into<wkt::FieldMask>,
3130 {
3131 self.0.request.update_mask = v.map(|x| x.into());
3132 self
3133 }
3134 }
3135
3136 #[doc(hidden)]
3137 impl crate::RequestBuilder for UpdateGenerativeQuestionsFeatureConfig {
3138 fn request_options(&mut self) -> &mut crate::RequestOptions {
3139 &mut self.0.options
3140 }
3141 }
3142
3143 #[derive(Clone, Debug)]
3160 pub struct GetGenerativeQuestionsFeatureConfig(
3161 RequestBuilder<crate::model::GetGenerativeQuestionsFeatureConfigRequest>,
3162 );
3163
3164 impl GetGenerativeQuestionsFeatureConfig {
3165 pub(crate) fn new(
3166 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3167 ) -> Self {
3168 Self(RequestBuilder::new(stub))
3169 }
3170
3171 pub fn with_request<V: Into<crate::model::GetGenerativeQuestionsFeatureConfigRequest>>(
3173 mut self,
3174 v: V,
3175 ) -> Self {
3176 self.0.request = v.into();
3177 self
3178 }
3179
3180 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3182 self.0.options = v.into();
3183 self
3184 }
3185
3186 pub async fn send(self) -> Result<crate::model::GenerativeQuestionsFeatureConfig> {
3188 (*self.0.stub)
3189 .get_generative_questions_feature_config(self.0.request, self.0.options)
3190 .await
3191 .map(crate::Response::into_body)
3192 }
3193
3194 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
3198 self.0.request.catalog = v.into();
3199 self
3200 }
3201 }
3202
3203 #[doc(hidden)]
3204 impl crate::RequestBuilder for GetGenerativeQuestionsFeatureConfig {
3205 fn request_options(&mut self) -> &mut crate::RequestOptions {
3206 &mut self.0.options
3207 }
3208 }
3209
3210 #[derive(Clone, Debug)]
3227 pub struct ListGenerativeQuestionConfigs(
3228 RequestBuilder<crate::model::ListGenerativeQuestionConfigsRequest>,
3229 );
3230
3231 impl ListGenerativeQuestionConfigs {
3232 pub(crate) fn new(
3233 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3234 ) -> Self {
3235 Self(RequestBuilder::new(stub))
3236 }
3237
3238 pub fn with_request<V: Into<crate::model::ListGenerativeQuestionConfigsRequest>>(
3240 mut self,
3241 v: V,
3242 ) -> Self {
3243 self.0.request = v.into();
3244 self
3245 }
3246
3247 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3249 self.0.options = v.into();
3250 self
3251 }
3252
3253 pub async fn send(self) -> Result<crate::model::ListGenerativeQuestionConfigsResponse> {
3255 (*self.0.stub)
3256 .list_generative_question_configs(self.0.request, self.0.options)
3257 .await
3258 .map(crate::Response::into_body)
3259 }
3260
3261 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3265 self.0.request.parent = v.into();
3266 self
3267 }
3268 }
3269
3270 #[doc(hidden)]
3271 impl crate::RequestBuilder for ListGenerativeQuestionConfigs {
3272 fn request_options(&mut self) -> &mut crate::RequestOptions {
3273 &mut self.0.options
3274 }
3275 }
3276
3277 #[derive(Clone, Debug)]
3294 pub struct UpdateGenerativeQuestionConfig(
3295 RequestBuilder<crate::model::UpdateGenerativeQuestionConfigRequest>,
3296 );
3297
3298 impl UpdateGenerativeQuestionConfig {
3299 pub(crate) fn new(
3300 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3301 ) -> Self {
3302 Self(RequestBuilder::new(stub))
3303 }
3304
3305 pub fn with_request<V: Into<crate::model::UpdateGenerativeQuestionConfigRequest>>(
3307 mut self,
3308 v: V,
3309 ) -> Self {
3310 self.0.request = v.into();
3311 self
3312 }
3313
3314 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3316 self.0.options = v.into();
3317 self
3318 }
3319
3320 pub async fn send(self) -> Result<crate::model::GenerativeQuestionConfig> {
3322 (*self.0.stub)
3323 .update_generative_question_config(self.0.request, self.0.options)
3324 .await
3325 .map(crate::Response::into_body)
3326 }
3327
3328 pub fn set_generative_question_config<T>(mut self, v: T) -> Self
3332 where
3333 T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
3334 {
3335 self.0.request.generative_question_config = std::option::Option::Some(v.into());
3336 self
3337 }
3338
3339 pub fn set_or_clear_generative_question_config<T>(
3343 mut self,
3344 v: std::option::Option<T>,
3345 ) -> Self
3346 where
3347 T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
3348 {
3349 self.0.request.generative_question_config = v.map(|x| x.into());
3350 self
3351 }
3352
3353 pub fn set_update_mask<T>(mut self, v: T) -> Self
3355 where
3356 T: std::convert::Into<wkt::FieldMask>,
3357 {
3358 self.0.request.update_mask = std::option::Option::Some(v.into());
3359 self
3360 }
3361
3362 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3364 where
3365 T: std::convert::Into<wkt::FieldMask>,
3366 {
3367 self.0.request.update_mask = v.map(|x| x.into());
3368 self
3369 }
3370 }
3371
3372 #[doc(hidden)]
3373 impl crate::RequestBuilder for UpdateGenerativeQuestionConfig {
3374 fn request_options(&mut self) -> &mut crate::RequestOptions {
3375 &mut self.0.options
3376 }
3377 }
3378
3379 #[derive(Clone, Debug)]
3396 pub struct BatchUpdateGenerativeQuestionConfigs(
3397 RequestBuilder<crate::model::BatchUpdateGenerativeQuestionConfigsRequest>,
3398 );
3399
3400 impl BatchUpdateGenerativeQuestionConfigs {
3401 pub(crate) fn new(
3402 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3403 ) -> Self {
3404 Self(RequestBuilder::new(stub))
3405 }
3406
3407 pub fn with_request<V: Into<crate::model::BatchUpdateGenerativeQuestionConfigsRequest>>(
3409 mut self,
3410 v: V,
3411 ) -> Self {
3412 self.0.request = v.into();
3413 self
3414 }
3415
3416 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3418 self.0.options = v.into();
3419 self
3420 }
3421
3422 pub async fn send(
3424 self,
3425 ) -> Result<crate::model::BatchUpdateGenerativeQuestionConfigsResponse> {
3426 (*self.0.stub)
3427 .batch_update_generative_question_configs(self.0.request, self.0.options)
3428 .await
3429 .map(crate::Response::into_body)
3430 }
3431
3432 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3434 self.0.request.parent = v.into();
3435 self
3436 }
3437
3438 pub fn set_requests<T, V>(mut self, v: T) -> Self
3442 where
3443 T: std::iter::IntoIterator<Item = V>,
3444 V: std::convert::Into<crate::model::UpdateGenerativeQuestionConfigRequest>,
3445 {
3446 use std::iter::Iterator;
3447 self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
3448 self
3449 }
3450 }
3451
3452 #[doc(hidden)]
3453 impl crate::RequestBuilder for BatchUpdateGenerativeQuestionConfigs {
3454 fn request_options(&mut self) -> &mut crate::RequestOptions {
3455 &mut self.0.options
3456 }
3457 }
3458
3459 #[derive(Clone, Debug)]
3480 pub struct ListOperations(
3481 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
3482 );
3483
3484 impl ListOperations {
3485 pub(crate) fn new(
3486 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3487 ) -> Self {
3488 Self(RequestBuilder::new(stub))
3489 }
3490
3491 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
3493 mut self,
3494 v: V,
3495 ) -> Self {
3496 self.0.request = v.into();
3497 self
3498 }
3499
3500 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3502 self.0.options = v.into();
3503 self
3504 }
3505
3506 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
3508 (*self.0.stub)
3509 .list_operations(self.0.request, self.0.options)
3510 .await
3511 .map(crate::Response::into_body)
3512 }
3513
3514 pub fn by_page(
3516 self,
3517 ) -> impl google_cloud_gax::paginator::Paginator<
3518 google_cloud_longrunning::model::ListOperationsResponse,
3519 crate::Error,
3520 > {
3521 use std::clone::Clone;
3522 let token = self.0.request.page_token.clone();
3523 let execute = move |token: String| {
3524 let mut builder = self.clone();
3525 builder.0.request = builder.0.request.set_page_token(token);
3526 builder.send()
3527 };
3528 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3529 }
3530
3531 pub fn by_item(
3533 self,
3534 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3535 google_cloud_longrunning::model::ListOperationsResponse,
3536 crate::Error,
3537 > {
3538 use google_cloud_gax::paginator::Paginator;
3539 self.by_page().items()
3540 }
3541
3542 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3544 self.0.request.name = v.into();
3545 self
3546 }
3547
3548 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3550 self.0.request.filter = v.into();
3551 self
3552 }
3553
3554 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3556 self.0.request.page_size = v.into();
3557 self
3558 }
3559
3560 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3562 self.0.request.page_token = v.into();
3563 self
3564 }
3565
3566 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3568 self.0.request.return_partial_success = v.into();
3569 self
3570 }
3571 }
3572
3573 #[doc(hidden)]
3574 impl crate::RequestBuilder for ListOperations {
3575 fn request_options(&mut self) -> &mut crate::RequestOptions {
3576 &mut self.0.options
3577 }
3578 }
3579
3580 #[derive(Clone, Debug)]
3597 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
3598
3599 impl GetOperation {
3600 pub(crate) fn new(
3601 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3602 ) -> Self {
3603 Self(RequestBuilder::new(stub))
3604 }
3605
3606 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
3608 mut self,
3609 v: V,
3610 ) -> Self {
3611 self.0.request = v.into();
3612 self
3613 }
3614
3615 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3617 self.0.options = v.into();
3618 self
3619 }
3620
3621 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3623 (*self.0.stub)
3624 .get_operation(self.0.request, self.0.options)
3625 .await
3626 .map(crate::Response::into_body)
3627 }
3628
3629 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3631 self.0.request.name = v.into();
3632 self
3633 }
3634 }
3635
3636 #[doc(hidden)]
3637 impl crate::RequestBuilder for GetOperation {
3638 fn request_options(&mut self) -> &mut crate::RequestOptions {
3639 &mut self.0.options
3640 }
3641 }
3642}
3643
3644pub mod model_service {
3646 use crate::Result;
3647
3648 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3662
3663 pub(crate) mod client {
3664 use super::super::super::client::ModelService;
3665 pub struct Factory;
3666 impl crate::ClientFactory for Factory {
3667 type Client = ModelService;
3668 type Credentials = gaxi::options::Credentials;
3669 async fn build(
3670 self,
3671 config: gaxi::options::ClientConfig,
3672 ) -> crate::ClientBuilderResult<Self::Client> {
3673 Self::Client::new(config).await
3674 }
3675 }
3676 }
3677
3678 #[derive(Clone, Debug)]
3680 pub(crate) struct RequestBuilder<R: std::default::Default> {
3681 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3682 request: R,
3683 options: crate::RequestOptions,
3684 }
3685
3686 impl<R> RequestBuilder<R>
3687 where
3688 R: std::default::Default,
3689 {
3690 pub(crate) fn new(
3691 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3692 ) -> Self {
3693 Self {
3694 stub,
3695 request: R::default(),
3696 options: crate::RequestOptions::default(),
3697 }
3698 }
3699 }
3700
3701 #[derive(Clone, Debug)]
3719 pub struct CreateModel(RequestBuilder<crate::model::CreateModelRequest>);
3720
3721 impl CreateModel {
3722 pub(crate) fn new(
3723 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3724 ) -> Self {
3725 Self(RequestBuilder::new(stub))
3726 }
3727
3728 pub fn with_request<V: Into<crate::model::CreateModelRequest>>(mut self, v: V) -> Self {
3730 self.0.request = v.into();
3731 self
3732 }
3733
3734 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3736 self.0.options = v.into();
3737 self
3738 }
3739
3740 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
3747 (*self.0.stub)
3748 .create_model(self.0.request, self.0.options)
3749 .await
3750 .map(crate::Response::into_body)
3751 }
3752
3753 pub fn poller(
3755 self,
3756 ) -> impl google_cloud_lro::Poller<crate::model::Model, crate::model::CreateModelMetadata>
3757 {
3758 type Operation = google_cloud_lro::internal::Operation<
3759 crate::model::Model,
3760 crate::model::CreateModelMetadata,
3761 >;
3762 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3763 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3764
3765 let stub = self.0.stub.clone();
3766 let mut options = self.0.options.clone();
3767 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
3768 let query = move |name| {
3769 let stub = stub.clone();
3770 let options = options.clone();
3771 async {
3772 let op = GetOperation::new(stub)
3773 .set_name(name)
3774 .with_options(options)
3775 .send()
3776 .await?;
3777 Ok(Operation::new(op))
3778 }
3779 };
3780
3781 let start = move || async {
3782 let op = self.send().await?;
3783 Ok(Operation::new(op))
3784 };
3785
3786 google_cloud_lro::internal::new_poller(
3787 polling_error_policy,
3788 polling_backoff_policy,
3789 start,
3790 query,
3791 )
3792 }
3793
3794 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3798 self.0.request.parent = v.into();
3799 self
3800 }
3801
3802 pub fn set_model<T>(mut self, v: T) -> Self
3806 where
3807 T: std::convert::Into<crate::model::Model>,
3808 {
3809 self.0.request.model = std::option::Option::Some(v.into());
3810 self
3811 }
3812
3813 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
3817 where
3818 T: std::convert::Into<crate::model::Model>,
3819 {
3820 self.0.request.model = v.map(|x| x.into());
3821 self
3822 }
3823
3824 pub fn set_dry_run<T: Into<bool>>(mut self, v: T) -> Self {
3826 self.0.request.dry_run = v.into();
3827 self
3828 }
3829 }
3830
3831 #[doc(hidden)]
3832 impl crate::RequestBuilder for CreateModel {
3833 fn request_options(&mut self) -> &mut crate::RequestOptions {
3834 &mut self.0.options
3835 }
3836 }
3837
3838 #[derive(Clone, Debug)]
3855 pub struct GetModel(RequestBuilder<crate::model::GetModelRequest>);
3856
3857 impl GetModel {
3858 pub(crate) fn new(
3859 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3860 ) -> Self {
3861 Self(RequestBuilder::new(stub))
3862 }
3863
3864 pub fn with_request<V: Into<crate::model::GetModelRequest>>(mut self, v: V) -> Self {
3866 self.0.request = v.into();
3867 self
3868 }
3869
3870 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3872 self.0.options = v.into();
3873 self
3874 }
3875
3876 pub async fn send(self) -> Result<crate::model::Model> {
3878 (*self.0.stub)
3879 .get_model(self.0.request, self.0.options)
3880 .await
3881 .map(crate::Response::into_body)
3882 }
3883
3884 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3888 self.0.request.name = v.into();
3889 self
3890 }
3891 }
3892
3893 #[doc(hidden)]
3894 impl crate::RequestBuilder for GetModel {
3895 fn request_options(&mut self) -> &mut crate::RequestOptions {
3896 &mut self.0.options
3897 }
3898 }
3899
3900 #[derive(Clone, Debug)]
3917 pub struct PauseModel(RequestBuilder<crate::model::PauseModelRequest>);
3918
3919 impl PauseModel {
3920 pub(crate) fn new(
3921 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3922 ) -> Self {
3923 Self(RequestBuilder::new(stub))
3924 }
3925
3926 pub fn with_request<V: Into<crate::model::PauseModelRequest>>(mut self, v: V) -> Self {
3928 self.0.request = v.into();
3929 self
3930 }
3931
3932 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3934 self.0.options = v.into();
3935 self
3936 }
3937
3938 pub async fn send(self) -> Result<crate::model::Model> {
3940 (*self.0.stub)
3941 .pause_model(self.0.request, self.0.options)
3942 .await
3943 .map(crate::Response::into_body)
3944 }
3945
3946 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3950 self.0.request.name = v.into();
3951 self
3952 }
3953 }
3954
3955 #[doc(hidden)]
3956 impl crate::RequestBuilder for PauseModel {
3957 fn request_options(&mut self) -> &mut crate::RequestOptions {
3958 &mut self.0.options
3959 }
3960 }
3961
3962 #[derive(Clone, Debug)]
3979 pub struct ResumeModel(RequestBuilder<crate::model::ResumeModelRequest>);
3980
3981 impl ResumeModel {
3982 pub(crate) fn new(
3983 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3984 ) -> Self {
3985 Self(RequestBuilder::new(stub))
3986 }
3987
3988 pub fn with_request<V: Into<crate::model::ResumeModelRequest>>(mut self, v: V) -> Self {
3990 self.0.request = v.into();
3991 self
3992 }
3993
3994 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3996 self.0.options = v.into();
3997 self
3998 }
3999
4000 pub async fn send(self) -> Result<crate::model::Model> {
4002 (*self.0.stub)
4003 .resume_model(self.0.request, self.0.options)
4004 .await
4005 .map(crate::Response::into_body)
4006 }
4007
4008 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4012 self.0.request.name = v.into();
4013 self
4014 }
4015 }
4016
4017 #[doc(hidden)]
4018 impl crate::RequestBuilder for ResumeModel {
4019 fn request_options(&mut self) -> &mut crate::RequestOptions {
4020 &mut self.0.options
4021 }
4022 }
4023
4024 #[derive(Clone, Debug)]
4041 pub struct DeleteModel(RequestBuilder<crate::model::DeleteModelRequest>);
4042
4043 impl DeleteModel {
4044 pub(crate) fn new(
4045 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4046 ) -> Self {
4047 Self(RequestBuilder::new(stub))
4048 }
4049
4050 pub fn with_request<V: Into<crate::model::DeleteModelRequest>>(mut self, v: V) -> Self {
4052 self.0.request = v.into();
4053 self
4054 }
4055
4056 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4058 self.0.options = v.into();
4059 self
4060 }
4061
4062 pub async fn send(self) -> Result<()> {
4064 (*self.0.stub)
4065 .delete_model(self.0.request, self.0.options)
4066 .await
4067 .map(crate::Response::into_body)
4068 }
4069
4070 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4074 self.0.request.name = v.into();
4075 self
4076 }
4077 }
4078
4079 #[doc(hidden)]
4080 impl crate::RequestBuilder for DeleteModel {
4081 fn request_options(&mut self) -> &mut crate::RequestOptions {
4082 &mut self.0.options
4083 }
4084 }
4085
4086 #[derive(Clone, Debug)]
4107 pub struct ListModels(RequestBuilder<crate::model::ListModelsRequest>);
4108
4109 impl ListModels {
4110 pub(crate) fn new(
4111 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4112 ) -> Self {
4113 Self(RequestBuilder::new(stub))
4114 }
4115
4116 pub fn with_request<V: Into<crate::model::ListModelsRequest>>(mut self, v: V) -> Self {
4118 self.0.request = v.into();
4119 self
4120 }
4121
4122 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4124 self.0.options = v.into();
4125 self
4126 }
4127
4128 pub async fn send(self) -> Result<crate::model::ListModelsResponse> {
4130 (*self.0.stub)
4131 .list_models(self.0.request, self.0.options)
4132 .await
4133 .map(crate::Response::into_body)
4134 }
4135
4136 pub fn by_page(
4138 self,
4139 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListModelsResponse, crate::Error>
4140 {
4141 use std::clone::Clone;
4142 let token = self.0.request.page_token.clone();
4143 let execute = move |token: String| {
4144 let mut builder = self.clone();
4145 builder.0.request = builder.0.request.set_page_token(token);
4146 builder.send()
4147 };
4148 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4149 }
4150
4151 pub fn by_item(
4153 self,
4154 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4155 crate::model::ListModelsResponse,
4156 crate::Error,
4157 > {
4158 use google_cloud_gax::paginator::Paginator;
4159 self.by_page().items()
4160 }
4161
4162 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4166 self.0.request.parent = v.into();
4167 self
4168 }
4169
4170 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4172 self.0.request.page_size = v.into();
4173 self
4174 }
4175
4176 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4178 self.0.request.page_token = v.into();
4179 self
4180 }
4181 }
4182
4183 #[doc(hidden)]
4184 impl crate::RequestBuilder for ListModels {
4185 fn request_options(&mut self) -> &mut crate::RequestOptions {
4186 &mut self.0.options
4187 }
4188 }
4189
4190 #[derive(Clone, Debug)]
4207 pub struct UpdateModel(RequestBuilder<crate::model::UpdateModelRequest>);
4208
4209 impl UpdateModel {
4210 pub(crate) fn new(
4211 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4212 ) -> Self {
4213 Self(RequestBuilder::new(stub))
4214 }
4215
4216 pub fn with_request<V: Into<crate::model::UpdateModelRequest>>(mut self, v: V) -> Self {
4218 self.0.request = v.into();
4219 self
4220 }
4221
4222 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4224 self.0.options = v.into();
4225 self
4226 }
4227
4228 pub async fn send(self) -> Result<crate::model::Model> {
4230 (*self.0.stub)
4231 .update_model(self.0.request, self.0.options)
4232 .await
4233 .map(crate::Response::into_body)
4234 }
4235
4236 pub fn set_model<T>(mut self, v: T) -> Self
4240 where
4241 T: std::convert::Into<crate::model::Model>,
4242 {
4243 self.0.request.model = std::option::Option::Some(v.into());
4244 self
4245 }
4246
4247 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
4251 where
4252 T: std::convert::Into<crate::model::Model>,
4253 {
4254 self.0.request.model = v.map(|x| x.into());
4255 self
4256 }
4257
4258 pub fn set_update_mask<T>(mut self, v: T) -> Self
4260 where
4261 T: std::convert::Into<wkt::FieldMask>,
4262 {
4263 self.0.request.update_mask = std::option::Option::Some(v.into());
4264 self
4265 }
4266
4267 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4269 where
4270 T: std::convert::Into<wkt::FieldMask>,
4271 {
4272 self.0.request.update_mask = v.map(|x| x.into());
4273 self
4274 }
4275 }
4276
4277 #[doc(hidden)]
4278 impl crate::RequestBuilder for UpdateModel {
4279 fn request_options(&mut self) -> &mut crate::RequestOptions {
4280 &mut self.0.options
4281 }
4282 }
4283
4284 #[derive(Clone, Debug)]
4302 pub struct TuneModel(RequestBuilder<crate::model::TuneModelRequest>);
4303
4304 impl TuneModel {
4305 pub(crate) fn new(
4306 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4307 ) -> Self {
4308 Self(RequestBuilder::new(stub))
4309 }
4310
4311 pub fn with_request<V: Into<crate::model::TuneModelRequest>>(mut self, v: V) -> Self {
4313 self.0.request = v.into();
4314 self
4315 }
4316
4317 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4319 self.0.options = v.into();
4320 self
4321 }
4322
4323 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4330 (*self.0.stub)
4331 .tune_model(self.0.request, self.0.options)
4332 .await
4333 .map(crate::Response::into_body)
4334 }
4335
4336 pub fn poller(
4338 self,
4339 ) -> impl google_cloud_lro::Poller<
4340 crate::model::TuneModelResponse,
4341 crate::model::TuneModelMetadata,
4342 > {
4343 type Operation = google_cloud_lro::internal::Operation<
4344 crate::model::TuneModelResponse,
4345 crate::model::TuneModelMetadata,
4346 >;
4347 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4348 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4349
4350 let stub = self.0.stub.clone();
4351 let mut options = self.0.options.clone();
4352 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4353 let query = move |name| {
4354 let stub = stub.clone();
4355 let options = options.clone();
4356 async {
4357 let op = GetOperation::new(stub)
4358 .set_name(name)
4359 .with_options(options)
4360 .send()
4361 .await?;
4362 Ok(Operation::new(op))
4363 }
4364 };
4365
4366 let start = move || async {
4367 let op = self.send().await?;
4368 Ok(Operation::new(op))
4369 };
4370
4371 google_cloud_lro::internal::new_poller(
4372 polling_error_policy,
4373 polling_backoff_policy,
4374 start,
4375 query,
4376 )
4377 }
4378
4379 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4383 self.0.request.name = v.into();
4384 self
4385 }
4386 }
4387
4388 #[doc(hidden)]
4389 impl crate::RequestBuilder for TuneModel {
4390 fn request_options(&mut self) -> &mut crate::RequestOptions {
4391 &mut self.0.options
4392 }
4393 }
4394
4395 #[derive(Clone, Debug)]
4416 pub struct ListOperations(
4417 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4418 );
4419
4420 impl ListOperations {
4421 pub(crate) fn new(
4422 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4423 ) -> Self {
4424 Self(RequestBuilder::new(stub))
4425 }
4426
4427 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4429 mut self,
4430 v: V,
4431 ) -> Self {
4432 self.0.request = v.into();
4433 self
4434 }
4435
4436 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4438 self.0.options = v.into();
4439 self
4440 }
4441
4442 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4444 (*self.0.stub)
4445 .list_operations(self.0.request, self.0.options)
4446 .await
4447 .map(crate::Response::into_body)
4448 }
4449
4450 pub fn by_page(
4452 self,
4453 ) -> impl google_cloud_gax::paginator::Paginator<
4454 google_cloud_longrunning::model::ListOperationsResponse,
4455 crate::Error,
4456 > {
4457 use std::clone::Clone;
4458 let token = self.0.request.page_token.clone();
4459 let execute = move |token: String| {
4460 let mut builder = self.clone();
4461 builder.0.request = builder.0.request.set_page_token(token);
4462 builder.send()
4463 };
4464 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4465 }
4466
4467 pub fn by_item(
4469 self,
4470 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4471 google_cloud_longrunning::model::ListOperationsResponse,
4472 crate::Error,
4473 > {
4474 use google_cloud_gax::paginator::Paginator;
4475 self.by_page().items()
4476 }
4477
4478 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4480 self.0.request.name = v.into();
4481 self
4482 }
4483
4484 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4486 self.0.request.filter = v.into();
4487 self
4488 }
4489
4490 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4492 self.0.request.page_size = v.into();
4493 self
4494 }
4495
4496 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4498 self.0.request.page_token = v.into();
4499 self
4500 }
4501
4502 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4504 self.0.request.return_partial_success = v.into();
4505 self
4506 }
4507 }
4508
4509 #[doc(hidden)]
4510 impl crate::RequestBuilder for ListOperations {
4511 fn request_options(&mut self) -> &mut crate::RequestOptions {
4512 &mut self.0.options
4513 }
4514 }
4515
4516 #[derive(Clone, Debug)]
4533 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4534
4535 impl GetOperation {
4536 pub(crate) fn new(
4537 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4538 ) -> Self {
4539 Self(RequestBuilder::new(stub))
4540 }
4541
4542 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4544 mut self,
4545 v: V,
4546 ) -> Self {
4547 self.0.request = v.into();
4548 self
4549 }
4550
4551 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4553 self.0.options = v.into();
4554 self
4555 }
4556
4557 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4559 (*self.0.stub)
4560 .get_operation(self.0.request, self.0.options)
4561 .await
4562 .map(crate::Response::into_body)
4563 }
4564
4565 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4567 self.0.request.name = v.into();
4568 self
4569 }
4570 }
4571
4572 #[doc(hidden)]
4573 impl crate::RequestBuilder for GetOperation {
4574 fn request_options(&mut self) -> &mut crate::RequestOptions {
4575 &mut self.0.options
4576 }
4577 }
4578}
4579
4580pub mod prediction_service {
4582 use crate::Result;
4583
4584 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4598
4599 pub(crate) mod client {
4600 use super::super::super::client::PredictionService;
4601 pub struct Factory;
4602 impl crate::ClientFactory for Factory {
4603 type Client = PredictionService;
4604 type Credentials = gaxi::options::Credentials;
4605 async fn build(
4606 self,
4607 config: gaxi::options::ClientConfig,
4608 ) -> crate::ClientBuilderResult<Self::Client> {
4609 Self::Client::new(config).await
4610 }
4611 }
4612 }
4613
4614 #[derive(Clone, Debug)]
4616 pub(crate) struct RequestBuilder<R: std::default::Default> {
4617 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4618 request: R,
4619 options: crate::RequestOptions,
4620 }
4621
4622 impl<R> RequestBuilder<R>
4623 where
4624 R: std::default::Default,
4625 {
4626 pub(crate) fn new(
4627 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4628 ) -> Self {
4629 Self {
4630 stub,
4631 request: R::default(),
4632 options: crate::RequestOptions::default(),
4633 }
4634 }
4635 }
4636
4637 #[derive(Clone, Debug)]
4654 pub struct Predict(RequestBuilder<crate::model::PredictRequest>);
4655
4656 impl Predict {
4657 pub(crate) fn new(
4658 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4659 ) -> Self {
4660 Self(RequestBuilder::new(stub))
4661 }
4662
4663 pub fn with_request<V: Into<crate::model::PredictRequest>>(mut self, v: V) -> Self {
4665 self.0.request = v.into();
4666 self
4667 }
4668
4669 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4671 self.0.options = v.into();
4672 self
4673 }
4674
4675 pub async fn send(self) -> Result<crate::model::PredictResponse> {
4677 (*self.0.stub)
4678 .predict(self.0.request, self.0.options)
4679 .await
4680 .map(crate::Response::into_body)
4681 }
4682
4683 pub fn set_placement<T: Into<std::string::String>>(mut self, v: T) -> Self {
4687 self.0.request.placement = v.into();
4688 self
4689 }
4690
4691 pub fn set_user_event<T>(mut self, v: T) -> Self
4695 where
4696 T: std::convert::Into<crate::model::UserEvent>,
4697 {
4698 self.0.request.user_event = std::option::Option::Some(v.into());
4699 self
4700 }
4701
4702 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
4706 where
4707 T: std::convert::Into<crate::model::UserEvent>,
4708 {
4709 self.0.request.user_event = v.map(|x| x.into());
4710 self
4711 }
4712
4713 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4715 self.0.request.page_size = v.into();
4716 self
4717 }
4718
4719 #[deprecated]
4721 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4722 self.0.request.page_token = v.into();
4723 self
4724 }
4725
4726 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4728 self.0.request.filter = v.into();
4729 self
4730 }
4731
4732 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4734 self.0.request.validate_only = v.into();
4735 self
4736 }
4737
4738 pub fn set_params<T, K, V>(mut self, v: T) -> Self
4740 where
4741 T: std::iter::IntoIterator<Item = (K, V)>,
4742 K: std::convert::Into<std::string::String>,
4743 V: std::convert::Into<wkt::Value>,
4744 {
4745 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4746 self
4747 }
4748
4749 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4751 where
4752 T: std::iter::IntoIterator<Item = (K, V)>,
4753 K: std::convert::Into<std::string::String>,
4754 V: std::convert::Into<std::string::String>,
4755 {
4756 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4757 self
4758 }
4759 }
4760
4761 #[doc(hidden)]
4762 impl crate::RequestBuilder for Predict {
4763 fn request_options(&mut self) -> &mut crate::RequestOptions {
4764 &mut self.0.options
4765 }
4766 }
4767
4768 #[derive(Clone, Debug)]
4789 pub struct ListOperations(
4790 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4791 );
4792
4793 impl ListOperations {
4794 pub(crate) fn new(
4795 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4796 ) -> Self {
4797 Self(RequestBuilder::new(stub))
4798 }
4799
4800 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4802 mut self,
4803 v: V,
4804 ) -> Self {
4805 self.0.request = v.into();
4806 self
4807 }
4808
4809 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4811 self.0.options = v.into();
4812 self
4813 }
4814
4815 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4817 (*self.0.stub)
4818 .list_operations(self.0.request, self.0.options)
4819 .await
4820 .map(crate::Response::into_body)
4821 }
4822
4823 pub fn by_page(
4825 self,
4826 ) -> impl google_cloud_gax::paginator::Paginator<
4827 google_cloud_longrunning::model::ListOperationsResponse,
4828 crate::Error,
4829 > {
4830 use std::clone::Clone;
4831 let token = self.0.request.page_token.clone();
4832 let execute = move |token: String| {
4833 let mut builder = self.clone();
4834 builder.0.request = builder.0.request.set_page_token(token);
4835 builder.send()
4836 };
4837 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4838 }
4839
4840 pub fn by_item(
4842 self,
4843 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4844 google_cloud_longrunning::model::ListOperationsResponse,
4845 crate::Error,
4846 > {
4847 use google_cloud_gax::paginator::Paginator;
4848 self.by_page().items()
4849 }
4850
4851 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4853 self.0.request.name = v.into();
4854 self
4855 }
4856
4857 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4859 self.0.request.filter = v.into();
4860 self
4861 }
4862
4863 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4865 self.0.request.page_size = v.into();
4866 self
4867 }
4868
4869 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4871 self.0.request.page_token = v.into();
4872 self
4873 }
4874
4875 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4877 self.0.request.return_partial_success = v.into();
4878 self
4879 }
4880 }
4881
4882 #[doc(hidden)]
4883 impl crate::RequestBuilder for ListOperations {
4884 fn request_options(&mut self) -> &mut crate::RequestOptions {
4885 &mut self.0.options
4886 }
4887 }
4888
4889 #[derive(Clone, Debug)]
4906 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4907
4908 impl GetOperation {
4909 pub(crate) fn new(
4910 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4911 ) -> Self {
4912 Self(RequestBuilder::new(stub))
4913 }
4914
4915 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4917 mut self,
4918 v: V,
4919 ) -> Self {
4920 self.0.request = v.into();
4921 self
4922 }
4923
4924 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4926 self.0.options = v.into();
4927 self
4928 }
4929
4930 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4932 (*self.0.stub)
4933 .get_operation(self.0.request, self.0.options)
4934 .await
4935 .map(crate::Response::into_body)
4936 }
4937
4938 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4940 self.0.request.name = v.into();
4941 self
4942 }
4943 }
4944
4945 #[doc(hidden)]
4946 impl crate::RequestBuilder for GetOperation {
4947 fn request_options(&mut self) -> &mut crate::RequestOptions {
4948 &mut self.0.options
4949 }
4950 }
4951}
4952
4953pub mod product_service {
4955 use crate::Result;
4956
4957 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4971
4972 pub(crate) mod client {
4973 use super::super::super::client::ProductService;
4974 pub struct Factory;
4975 impl crate::ClientFactory for Factory {
4976 type Client = ProductService;
4977 type Credentials = gaxi::options::Credentials;
4978 async fn build(
4979 self,
4980 config: gaxi::options::ClientConfig,
4981 ) -> crate::ClientBuilderResult<Self::Client> {
4982 Self::Client::new(config).await
4983 }
4984 }
4985 }
4986
4987 #[derive(Clone, Debug)]
4989 pub(crate) struct RequestBuilder<R: std::default::Default> {
4990 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
4991 request: R,
4992 options: crate::RequestOptions,
4993 }
4994
4995 impl<R> RequestBuilder<R>
4996 where
4997 R: std::default::Default,
4998 {
4999 pub(crate) fn new(
5000 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5001 ) -> Self {
5002 Self {
5003 stub,
5004 request: R::default(),
5005 options: crate::RequestOptions::default(),
5006 }
5007 }
5008 }
5009
5010 #[derive(Clone, Debug)]
5027 pub struct CreateProduct(RequestBuilder<crate::model::CreateProductRequest>);
5028
5029 impl CreateProduct {
5030 pub(crate) fn new(
5031 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5032 ) -> Self {
5033 Self(RequestBuilder::new(stub))
5034 }
5035
5036 pub fn with_request<V: Into<crate::model::CreateProductRequest>>(mut self, v: V) -> Self {
5038 self.0.request = v.into();
5039 self
5040 }
5041
5042 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5044 self.0.options = v.into();
5045 self
5046 }
5047
5048 pub async fn send(self) -> Result<crate::model::Product> {
5050 (*self.0.stub)
5051 .create_product(self.0.request, self.0.options)
5052 .await
5053 .map(crate::Response::into_body)
5054 }
5055
5056 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5060 self.0.request.parent = v.into();
5061 self
5062 }
5063
5064 pub fn set_product<T>(mut self, v: T) -> Self
5068 where
5069 T: std::convert::Into<crate::model::Product>,
5070 {
5071 self.0.request.product = std::option::Option::Some(v.into());
5072 self
5073 }
5074
5075 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
5079 where
5080 T: std::convert::Into<crate::model::Product>,
5081 {
5082 self.0.request.product = v.map(|x| x.into());
5083 self
5084 }
5085
5086 pub fn set_product_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5090 self.0.request.product_id = v.into();
5091 self
5092 }
5093 }
5094
5095 #[doc(hidden)]
5096 impl crate::RequestBuilder for CreateProduct {
5097 fn request_options(&mut self) -> &mut crate::RequestOptions {
5098 &mut self.0.options
5099 }
5100 }
5101
5102 #[derive(Clone, Debug)]
5119 pub struct GetProduct(RequestBuilder<crate::model::GetProductRequest>);
5120
5121 impl GetProduct {
5122 pub(crate) fn new(
5123 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5124 ) -> Self {
5125 Self(RequestBuilder::new(stub))
5126 }
5127
5128 pub fn with_request<V: Into<crate::model::GetProductRequest>>(mut self, v: V) -> Self {
5130 self.0.request = v.into();
5131 self
5132 }
5133
5134 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5136 self.0.options = v.into();
5137 self
5138 }
5139
5140 pub async fn send(self) -> Result<crate::model::Product> {
5142 (*self.0.stub)
5143 .get_product(self.0.request, self.0.options)
5144 .await
5145 .map(crate::Response::into_body)
5146 }
5147
5148 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5152 self.0.request.name = v.into();
5153 self
5154 }
5155 }
5156
5157 #[doc(hidden)]
5158 impl crate::RequestBuilder for GetProduct {
5159 fn request_options(&mut self) -> &mut crate::RequestOptions {
5160 &mut self.0.options
5161 }
5162 }
5163
5164 #[derive(Clone, Debug)]
5185 pub struct ListProducts(RequestBuilder<crate::model::ListProductsRequest>);
5186
5187 impl ListProducts {
5188 pub(crate) fn new(
5189 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5190 ) -> Self {
5191 Self(RequestBuilder::new(stub))
5192 }
5193
5194 pub fn with_request<V: Into<crate::model::ListProductsRequest>>(mut self, v: V) -> Self {
5196 self.0.request = v.into();
5197 self
5198 }
5199
5200 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5202 self.0.options = v.into();
5203 self
5204 }
5205
5206 pub async fn send(self) -> Result<crate::model::ListProductsResponse> {
5208 (*self.0.stub)
5209 .list_products(self.0.request, self.0.options)
5210 .await
5211 .map(crate::Response::into_body)
5212 }
5213
5214 pub fn by_page(
5216 self,
5217 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListProductsResponse, crate::Error>
5218 {
5219 use std::clone::Clone;
5220 let token = self.0.request.page_token.clone();
5221 let execute = move |token: String| {
5222 let mut builder = self.clone();
5223 builder.0.request = builder.0.request.set_page_token(token);
5224 builder.send()
5225 };
5226 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5227 }
5228
5229 pub fn by_item(
5231 self,
5232 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5233 crate::model::ListProductsResponse,
5234 crate::Error,
5235 > {
5236 use google_cloud_gax::paginator::Paginator;
5237 self.by_page().items()
5238 }
5239
5240 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5244 self.0.request.parent = v.into();
5245 self
5246 }
5247
5248 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5250 self.0.request.page_size = v.into();
5251 self
5252 }
5253
5254 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5256 self.0.request.page_token = v.into();
5257 self
5258 }
5259
5260 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5262 self.0.request.filter = v.into();
5263 self
5264 }
5265
5266 pub fn set_read_mask<T>(mut self, v: T) -> Self
5268 where
5269 T: std::convert::Into<wkt::FieldMask>,
5270 {
5271 self.0.request.read_mask = std::option::Option::Some(v.into());
5272 self
5273 }
5274
5275 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
5277 where
5278 T: std::convert::Into<wkt::FieldMask>,
5279 {
5280 self.0.request.read_mask = v.map(|x| x.into());
5281 self
5282 }
5283 }
5284
5285 #[doc(hidden)]
5286 impl crate::RequestBuilder for ListProducts {
5287 fn request_options(&mut self) -> &mut crate::RequestOptions {
5288 &mut self.0.options
5289 }
5290 }
5291
5292 #[derive(Clone, Debug)]
5309 pub struct UpdateProduct(RequestBuilder<crate::model::UpdateProductRequest>);
5310
5311 impl UpdateProduct {
5312 pub(crate) fn new(
5313 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5314 ) -> Self {
5315 Self(RequestBuilder::new(stub))
5316 }
5317
5318 pub fn with_request<V: Into<crate::model::UpdateProductRequest>>(mut self, v: V) -> Self {
5320 self.0.request = v.into();
5321 self
5322 }
5323
5324 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5326 self.0.options = v.into();
5327 self
5328 }
5329
5330 pub async fn send(self) -> Result<crate::model::Product> {
5332 (*self.0.stub)
5333 .update_product(self.0.request, self.0.options)
5334 .await
5335 .map(crate::Response::into_body)
5336 }
5337
5338 pub fn set_product<T>(mut self, v: T) -> Self
5342 where
5343 T: std::convert::Into<crate::model::Product>,
5344 {
5345 self.0.request.product = std::option::Option::Some(v.into());
5346 self
5347 }
5348
5349 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
5353 where
5354 T: std::convert::Into<crate::model::Product>,
5355 {
5356 self.0.request.product = v.map(|x| x.into());
5357 self
5358 }
5359
5360 pub fn set_update_mask<T>(mut self, v: T) -> Self
5362 where
5363 T: std::convert::Into<wkt::FieldMask>,
5364 {
5365 self.0.request.update_mask = std::option::Option::Some(v.into());
5366 self
5367 }
5368
5369 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5371 where
5372 T: std::convert::Into<wkt::FieldMask>,
5373 {
5374 self.0.request.update_mask = v.map(|x| x.into());
5375 self
5376 }
5377
5378 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5380 self.0.request.allow_missing = v.into();
5381 self
5382 }
5383 }
5384
5385 #[doc(hidden)]
5386 impl crate::RequestBuilder for UpdateProduct {
5387 fn request_options(&mut self) -> &mut crate::RequestOptions {
5388 &mut self.0.options
5389 }
5390 }
5391
5392 #[derive(Clone, Debug)]
5409 pub struct DeleteProduct(RequestBuilder<crate::model::DeleteProductRequest>);
5410
5411 impl DeleteProduct {
5412 pub(crate) fn new(
5413 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5414 ) -> Self {
5415 Self(RequestBuilder::new(stub))
5416 }
5417
5418 pub fn with_request<V: Into<crate::model::DeleteProductRequest>>(mut self, v: V) -> Self {
5420 self.0.request = v.into();
5421 self
5422 }
5423
5424 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5426 self.0.options = v.into();
5427 self
5428 }
5429
5430 pub async fn send(self) -> Result<()> {
5432 (*self.0.stub)
5433 .delete_product(self.0.request, self.0.options)
5434 .await
5435 .map(crate::Response::into_body)
5436 }
5437
5438 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5442 self.0.request.name = v.into();
5443 self
5444 }
5445 }
5446
5447 #[doc(hidden)]
5448 impl crate::RequestBuilder for DeleteProduct {
5449 fn request_options(&mut self) -> &mut crate::RequestOptions {
5450 &mut self.0.options
5451 }
5452 }
5453
5454 #[derive(Clone, Debug)]
5472 pub struct PurgeProducts(RequestBuilder<crate::model::PurgeProductsRequest>);
5473
5474 impl PurgeProducts {
5475 pub(crate) fn new(
5476 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5477 ) -> Self {
5478 Self(RequestBuilder::new(stub))
5479 }
5480
5481 pub fn with_request<V: Into<crate::model::PurgeProductsRequest>>(mut self, v: V) -> Self {
5483 self.0.request = v.into();
5484 self
5485 }
5486
5487 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5489 self.0.options = v.into();
5490 self
5491 }
5492
5493 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5500 (*self.0.stub)
5501 .purge_products(self.0.request, self.0.options)
5502 .await
5503 .map(crate::Response::into_body)
5504 }
5505
5506 pub fn poller(
5508 self,
5509 ) -> impl google_cloud_lro::Poller<
5510 crate::model::PurgeProductsResponse,
5511 crate::model::PurgeProductsMetadata,
5512 > {
5513 type Operation = google_cloud_lro::internal::Operation<
5514 crate::model::PurgeProductsResponse,
5515 crate::model::PurgeProductsMetadata,
5516 >;
5517 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5518 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5519
5520 let stub = self.0.stub.clone();
5521 let mut options = self.0.options.clone();
5522 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5523 let query = move |name| {
5524 let stub = stub.clone();
5525 let options = options.clone();
5526 async {
5527 let op = GetOperation::new(stub)
5528 .set_name(name)
5529 .with_options(options)
5530 .send()
5531 .await?;
5532 Ok(Operation::new(op))
5533 }
5534 };
5535
5536 let start = move || async {
5537 let op = self.send().await?;
5538 Ok(Operation::new(op))
5539 };
5540
5541 google_cloud_lro::internal::new_poller(
5542 polling_error_policy,
5543 polling_backoff_policy,
5544 start,
5545 query,
5546 )
5547 }
5548
5549 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5553 self.0.request.parent = v.into();
5554 self
5555 }
5556
5557 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5561 self.0.request.filter = v.into();
5562 self
5563 }
5564
5565 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
5567 self.0.request.force = v.into();
5568 self
5569 }
5570 }
5571
5572 #[doc(hidden)]
5573 impl crate::RequestBuilder for PurgeProducts {
5574 fn request_options(&mut self) -> &mut crate::RequestOptions {
5575 &mut self.0.options
5576 }
5577 }
5578
5579 #[derive(Clone, Debug)]
5597 pub struct ImportProducts(RequestBuilder<crate::model::ImportProductsRequest>);
5598
5599 impl ImportProducts {
5600 pub(crate) fn new(
5601 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5602 ) -> Self {
5603 Self(RequestBuilder::new(stub))
5604 }
5605
5606 pub fn with_request<V: Into<crate::model::ImportProductsRequest>>(mut self, v: V) -> Self {
5608 self.0.request = v.into();
5609 self
5610 }
5611
5612 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5614 self.0.options = v.into();
5615 self
5616 }
5617
5618 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5625 (*self.0.stub)
5626 .import_products(self.0.request, self.0.options)
5627 .await
5628 .map(crate::Response::into_body)
5629 }
5630
5631 pub fn poller(
5633 self,
5634 ) -> impl google_cloud_lro::Poller<
5635 crate::model::ImportProductsResponse,
5636 crate::model::ImportMetadata,
5637 > {
5638 type Operation = google_cloud_lro::internal::Operation<
5639 crate::model::ImportProductsResponse,
5640 crate::model::ImportMetadata,
5641 >;
5642 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5643 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5644
5645 let stub = self.0.stub.clone();
5646 let mut options = self.0.options.clone();
5647 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5648 let query = move |name| {
5649 let stub = stub.clone();
5650 let options = options.clone();
5651 async {
5652 let op = GetOperation::new(stub)
5653 .set_name(name)
5654 .with_options(options)
5655 .send()
5656 .await?;
5657 Ok(Operation::new(op))
5658 }
5659 };
5660
5661 let start = move || async {
5662 let op = self.send().await?;
5663 Ok(Operation::new(op))
5664 };
5665
5666 google_cloud_lro::internal::new_poller(
5667 polling_error_policy,
5668 polling_backoff_policy,
5669 start,
5670 query,
5671 )
5672 }
5673
5674 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5678 self.0.request.parent = v.into();
5679 self
5680 }
5681
5682 #[deprecated]
5684 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5685 self.0.request.request_id = v.into();
5686 self
5687 }
5688
5689 pub fn set_input_config<T>(mut self, v: T) -> Self
5693 where
5694 T: std::convert::Into<crate::model::ProductInputConfig>,
5695 {
5696 self.0.request.input_config = std::option::Option::Some(v.into());
5697 self
5698 }
5699
5700 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
5704 where
5705 T: std::convert::Into<crate::model::ProductInputConfig>,
5706 {
5707 self.0.request.input_config = v.map(|x| x.into());
5708 self
5709 }
5710
5711 pub fn set_errors_config<T>(mut self, v: T) -> Self
5713 where
5714 T: std::convert::Into<crate::model::ImportErrorsConfig>,
5715 {
5716 self.0.request.errors_config = std::option::Option::Some(v.into());
5717 self
5718 }
5719
5720 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
5722 where
5723 T: std::convert::Into<crate::model::ImportErrorsConfig>,
5724 {
5725 self.0.request.errors_config = v.map(|x| x.into());
5726 self
5727 }
5728
5729 pub fn set_update_mask<T>(mut self, v: T) -> Self
5731 where
5732 T: std::convert::Into<wkt::FieldMask>,
5733 {
5734 self.0.request.update_mask = std::option::Option::Some(v.into());
5735 self
5736 }
5737
5738 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5740 where
5741 T: std::convert::Into<wkt::FieldMask>,
5742 {
5743 self.0.request.update_mask = v.map(|x| x.into());
5744 self
5745 }
5746
5747 pub fn set_reconciliation_mode<
5749 T: Into<crate::model::import_products_request::ReconciliationMode>,
5750 >(
5751 mut self,
5752 v: T,
5753 ) -> Self {
5754 self.0.request.reconciliation_mode = v.into();
5755 self
5756 }
5757
5758 pub fn set_notification_pubsub_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
5760 self.0.request.notification_pubsub_topic = v.into();
5761 self
5762 }
5763 }
5764
5765 #[doc(hidden)]
5766 impl crate::RequestBuilder for ImportProducts {
5767 fn request_options(&mut self) -> &mut crate::RequestOptions {
5768 &mut self.0.options
5769 }
5770 }
5771
5772 #[derive(Clone, Debug)]
5790 pub struct SetInventory(RequestBuilder<crate::model::SetInventoryRequest>);
5791
5792 impl SetInventory {
5793 pub(crate) fn new(
5794 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5795 ) -> Self {
5796 Self(RequestBuilder::new(stub))
5797 }
5798
5799 pub fn with_request<V: Into<crate::model::SetInventoryRequest>>(mut self, v: V) -> Self {
5801 self.0.request = v.into();
5802 self
5803 }
5804
5805 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5807 self.0.options = v.into();
5808 self
5809 }
5810
5811 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5818 (*self.0.stub)
5819 .set_inventory(self.0.request, self.0.options)
5820 .await
5821 .map(crate::Response::into_body)
5822 }
5823
5824 pub fn poller(
5826 self,
5827 ) -> impl google_cloud_lro::Poller<
5828 crate::model::SetInventoryResponse,
5829 crate::model::SetInventoryMetadata,
5830 > {
5831 type Operation = google_cloud_lro::internal::Operation<
5832 crate::model::SetInventoryResponse,
5833 crate::model::SetInventoryMetadata,
5834 >;
5835 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5836 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5837
5838 let stub = self.0.stub.clone();
5839 let mut options = self.0.options.clone();
5840 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5841 let query = move |name| {
5842 let stub = stub.clone();
5843 let options = options.clone();
5844 async {
5845 let op = GetOperation::new(stub)
5846 .set_name(name)
5847 .with_options(options)
5848 .send()
5849 .await?;
5850 Ok(Operation::new(op))
5851 }
5852 };
5853
5854 let start = move || async {
5855 let op = self.send().await?;
5856 Ok(Operation::new(op))
5857 };
5858
5859 google_cloud_lro::internal::new_poller(
5860 polling_error_policy,
5861 polling_backoff_policy,
5862 start,
5863 query,
5864 )
5865 }
5866
5867 pub fn set_inventory<T>(mut self, v: T) -> Self
5871 where
5872 T: std::convert::Into<crate::model::Product>,
5873 {
5874 self.0.request.inventory = std::option::Option::Some(v.into());
5875 self
5876 }
5877
5878 pub fn set_or_clear_inventory<T>(mut self, v: std::option::Option<T>) -> Self
5882 where
5883 T: std::convert::Into<crate::model::Product>,
5884 {
5885 self.0.request.inventory = v.map(|x| x.into());
5886 self
5887 }
5888
5889 pub fn set_set_mask<T>(mut self, v: T) -> Self
5891 where
5892 T: std::convert::Into<wkt::FieldMask>,
5893 {
5894 self.0.request.set_mask = std::option::Option::Some(v.into());
5895 self
5896 }
5897
5898 pub fn set_or_clear_set_mask<T>(mut self, v: std::option::Option<T>) -> Self
5900 where
5901 T: std::convert::Into<wkt::FieldMask>,
5902 {
5903 self.0.request.set_mask = v.map(|x| x.into());
5904 self
5905 }
5906
5907 pub fn set_set_time<T>(mut self, v: T) -> Self
5909 where
5910 T: std::convert::Into<wkt::Timestamp>,
5911 {
5912 self.0.request.set_time = std::option::Option::Some(v.into());
5913 self
5914 }
5915
5916 pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
5918 where
5919 T: std::convert::Into<wkt::Timestamp>,
5920 {
5921 self.0.request.set_time = v.map(|x| x.into());
5922 self
5923 }
5924
5925 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5927 self.0.request.allow_missing = v.into();
5928 self
5929 }
5930 }
5931
5932 #[doc(hidden)]
5933 impl crate::RequestBuilder for SetInventory {
5934 fn request_options(&mut self) -> &mut crate::RequestOptions {
5935 &mut self.0.options
5936 }
5937 }
5938
5939 #[derive(Clone, Debug)]
5957 pub struct AddFulfillmentPlaces(RequestBuilder<crate::model::AddFulfillmentPlacesRequest>);
5958
5959 impl AddFulfillmentPlaces {
5960 pub(crate) fn new(
5961 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5962 ) -> Self {
5963 Self(RequestBuilder::new(stub))
5964 }
5965
5966 pub fn with_request<V: Into<crate::model::AddFulfillmentPlacesRequest>>(
5968 mut self,
5969 v: V,
5970 ) -> Self {
5971 self.0.request = v.into();
5972 self
5973 }
5974
5975 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5977 self.0.options = v.into();
5978 self
5979 }
5980
5981 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5988 (*self.0.stub)
5989 .add_fulfillment_places(self.0.request, self.0.options)
5990 .await
5991 .map(crate::Response::into_body)
5992 }
5993
5994 pub fn poller(
5996 self,
5997 ) -> impl google_cloud_lro::Poller<
5998 crate::model::AddFulfillmentPlacesResponse,
5999 crate::model::AddFulfillmentPlacesMetadata,
6000 > {
6001 type Operation = google_cloud_lro::internal::Operation<
6002 crate::model::AddFulfillmentPlacesResponse,
6003 crate::model::AddFulfillmentPlacesMetadata,
6004 >;
6005 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6006 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6007
6008 let stub = self.0.stub.clone();
6009 let mut options = self.0.options.clone();
6010 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6011 let query = move |name| {
6012 let stub = stub.clone();
6013 let options = options.clone();
6014 async {
6015 let op = GetOperation::new(stub)
6016 .set_name(name)
6017 .with_options(options)
6018 .send()
6019 .await?;
6020 Ok(Operation::new(op))
6021 }
6022 };
6023
6024 let start = move || async {
6025 let op = self.send().await?;
6026 Ok(Operation::new(op))
6027 };
6028
6029 google_cloud_lro::internal::new_poller(
6030 polling_error_policy,
6031 polling_backoff_policy,
6032 start,
6033 query,
6034 )
6035 }
6036
6037 pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6041 self.0.request.product = v.into();
6042 self
6043 }
6044
6045 pub fn set_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
6049 self.0.request.r#type = v.into();
6050 self
6051 }
6052
6053 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
6057 where
6058 T: std::iter::IntoIterator<Item = V>,
6059 V: std::convert::Into<std::string::String>,
6060 {
6061 use std::iter::Iterator;
6062 self.0.request.place_ids = v.into_iter().map(|i| i.into()).collect();
6063 self
6064 }
6065
6066 pub fn set_add_time<T>(mut self, v: T) -> Self
6068 where
6069 T: std::convert::Into<wkt::Timestamp>,
6070 {
6071 self.0.request.add_time = std::option::Option::Some(v.into());
6072 self
6073 }
6074
6075 pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
6077 where
6078 T: std::convert::Into<wkt::Timestamp>,
6079 {
6080 self.0.request.add_time = v.map(|x| x.into());
6081 self
6082 }
6083
6084 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6086 self.0.request.allow_missing = v.into();
6087 self
6088 }
6089 }
6090
6091 #[doc(hidden)]
6092 impl crate::RequestBuilder for AddFulfillmentPlaces {
6093 fn request_options(&mut self) -> &mut crate::RequestOptions {
6094 &mut self.0.options
6095 }
6096 }
6097
6098 #[derive(Clone, Debug)]
6116 pub struct RemoveFulfillmentPlaces(
6117 RequestBuilder<crate::model::RemoveFulfillmentPlacesRequest>,
6118 );
6119
6120 impl RemoveFulfillmentPlaces {
6121 pub(crate) fn new(
6122 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6123 ) -> Self {
6124 Self(RequestBuilder::new(stub))
6125 }
6126
6127 pub fn with_request<V: Into<crate::model::RemoveFulfillmentPlacesRequest>>(
6129 mut self,
6130 v: V,
6131 ) -> Self {
6132 self.0.request = v.into();
6133 self
6134 }
6135
6136 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6138 self.0.options = v.into();
6139 self
6140 }
6141
6142 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6149 (*self.0.stub)
6150 .remove_fulfillment_places(self.0.request, self.0.options)
6151 .await
6152 .map(crate::Response::into_body)
6153 }
6154
6155 pub fn poller(
6157 self,
6158 ) -> impl google_cloud_lro::Poller<
6159 crate::model::RemoveFulfillmentPlacesResponse,
6160 crate::model::RemoveFulfillmentPlacesMetadata,
6161 > {
6162 type Operation = google_cloud_lro::internal::Operation<
6163 crate::model::RemoveFulfillmentPlacesResponse,
6164 crate::model::RemoveFulfillmentPlacesMetadata,
6165 >;
6166 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6167 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6168
6169 let stub = self.0.stub.clone();
6170 let mut options = self.0.options.clone();
6171 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6172 let query = move |name| {
6173 let stub = stub.clone();
6174 let options = options.clone();
6175 async {
6176 let op = GetOperation::new(stub)
6177 .set_name(name)
6178 .with_options(options)
6179 .send()
6180 .await?;
6181 Ok(Operation::new(op))
6182 }
6183 };
6184
6185 let start = move || async {
6186 let op = self.send().await?;
6187 Ok(Operation::new(op))
6188 };
6189
6190 google_cloud_lro::internal::new_poller(
6191 polling_error_policy,
6192 polling_backoff_policy,
6193 start,
6194 query,
6195 )
6196 }
6197
6198 pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6202 self.0.request.product = v.into();
6203 self
6204 }
6205
6206 pub fn set_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
6210 self.0.request.r#type = v.into();
6211 self
6212 }
6213
6214 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
6218 where
6219 T: std::iter::IntoIterator<Item = V>,
6220 V: std::convert::Into<std::string::String>,
6221 {
6222 use std::iter::Iterator;
6223 self.0.request.place_ids = v.into_iter().map(|i| i.into()).collect();
6224 self
6225 }
6226
6227 pub fn set_remove_time<T>(mut self, v: T) -> Self
6229 where
6230 T: std::convert::Into<wkt::Timestamp>,
6231 {
6232 self.0.request.remove_time = std::option::Option::Some(v.into());
6233 self
6234 }
6235
6236 pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
6238 where
6239 T: std::convert::Into<wkt::Timestamp>,
6240 {
6241 self.0.request.remove_time = v.map(|x| x.into());
6242 self
6243 }
6244
6245 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6247 self.0.request.allow_missing = v.into();
6248 self
6249 }
6250 }
6251
6252 #[doc(hidden)]
6253 impl crate::RequestBuilder for RemoveFulfillmentPlaces {
6254 fn request_options(&mut self) -> &mut crate::RequestOptions {
6255 &mut self.0.options
6256 }
6257 }
6258
6259 #[derive(Clone, Debug)]
6277 pub struct AddLocalInventories(RequestBuilder<crate::model::AddLocalInventoriesRequest>);
6278
6279 impl AddLocalInventories {
6280 pub(crate) fn new(
6281 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6282 ) -> Self {
6283 Self(RequestBuilder::new(stub))
6284 }
6285
6286 pub fn with_request<V: Into<crate::model::AddLocalInventoriesRequest>>(
6288 mut self,
6289 v: V,
6290 ) -> Self {
6291 self.0.request = v.into();
6292 self
6293 }
6294
6295 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6297 self.0.options = v.into();
6298 self
6299 }
6300
6301 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6308 (*self.0.stub)
6309 .add_local_inventories(self.0.request, self.0.options)
6310 .await
6311 .map(crate::Response::into_body)
6312 }
6313
6314 pub fn poller(
6316 self,
6317 ) -> impl google_cloud_lro::Poller<
6318 crate::model::AddLocalInventoriesResponse,
6319 crate::model::AddLocalInventoriesMetadata,
6320 > {
6321 type Operation = google_cloud_lro::internal::Operation<
6322 crate::model::AddLocalInventoriesResponse,
6323 crate::model::AddLocalInventoriesMetadata,
6324 >;
6325 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6326 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6327
6328 let stub = self.0.stub.clone();
6329 let mut options = self.0.options.clone();
6330 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6331 let query = move |name| {
6332 let stub = stub.clone();
6333 let options = options.clone();
6334 async {
6335 let op = GetOperation::new(stub)
6336 .set_name(name)
6337 .with_options(options)
6338 .send()
6339 .await?;
6340 Ok(Operation::new(op))
6341 }
6342 };
6343
6344 let start = move || async {
6345 let op = self.send().await?;
6346 Ok(Operation::new(op))
6347 };
6348
6349 google_cloud_lro::internal::new_poller(
6350 polling_error_policy,
6351 polling_backoff_policy,
6352 start,
6353 query,
6354 )
6355 }
6356
6357 pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6361 self.0.request.product = v.into();
6362 self
6363 }
6364
6365 pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
6369 where
6370 T: std::iter::IntoIterator<Item = V>,
6371 V: std::convert::Into<crate::model::LocalInventory>,
6372 {
6373 use std::iter::Iterator;
6374 self.0.request.local_inventories = v.into_iter().map(|i| i.into()).collect();
6375 self
6376 }
6377
6378 pub fn set_add_mask<T>(mut self, v: T) -> Self
6380 where
6381 T: std::convert::Into<wkt::FieldMask>,
6382 {
6383 self.0.request.add_mask = std::option::Option::Some(v.into());
6384 self
6385 }
6386
6387 pub fn set_or_clear_add_mask<T>(mut self, v: std::option::Option<T>) -> Self
6389 where
6390 T: std::convert::Into<wkt::FieldMask>,
6391 {
6392 self.0.request.add_mask = v.map(|x| x.into());
6393 self
6394 }
6395
6396 pub fn set_add_time<T>(mut self, v: T) -> Self
6398 where
6399 T: std::convert::Into<wkt::Timestamp>,
6400 {
6401 self.0.request.add_time = std::option::Option::Some(v.into());
6402 self
6403 }
6404
6405 pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
6407 where
6408 T: std::convert::Into<wkt::Timestamp>,
6409 {
6410 self.0.request.add_time = v.map(|x| x.into());
6411 self
6412 }
6413
6414 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6416 self.0.request.allow_missing = v.into();
6417 self
6418 }
6419 }
6420
6421 #[doc(hidden)]
6422 impl crate::RequestBuilder for AddLocalInventories {
6423 fn request_options(&mut self) -> &mut crate::RequestOptions {
6424 &mut self.0.options
6425 }
6426 }
6427
6428 #[derive(Clone, Debug)]
6446 pub struct RemoveLocalInventories(RequestBuilder<crate::model::RemoveLocalInventoriesRequest>);
6447
6448 impl RemoveLocalInventories {
6449 pub(crate) fn new(
6450 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6451 ) -> Self {
6452 Self(RequestBuilder::new(stub))
6453 }
6454
6455 pub fn with_request<V: Into<crate::model::RemoveLocalInventoriesRequest>>(
6457 mut self,
6458 v: V,
6459 ) -> Self {
6460 self.0.request = v.into();
6461 self
6462 }
6463
6464 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6466 self.0.options = v.into();
6467 self
6468 }
6469
6470 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6477 (*self.0.stub)
6478 .remove_local_inventories(self.0.request, self.0.options)
6479 .await
6480 .map(crate::Response::into_body)
6481 }
6482
6483 pub fn poller(
6485 self,
6486 ) -> impl google_cloud_lro::Poller<
6487 crate::model::RemoveLocalInventoriesResponse,
6488 crate::model::RemoveLocalInventoriesMetadata,
6489 > {
6490 type Operation = google_cloud_lro::internal::Operation<
6491 crate::model::RemoveLocalInventoriesResponse,
6492 crate::model::RemoveLocalInventoriesMetadata,
6493 >;
6494 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6495 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6496
6497 let stub = self.0.stub.clone();
6498 let mut options = self.0.options.clone();
6499 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6500 let query = move |name| {
6501 let stub = stub.clone();
6502 let options = options.clone();
6503 async {
6504 let op = GetOperation::new(stub)
6505 .set_name(name)
6506 .with_options(options)
6507 .send()
6508 .await?;
6509 Ok(Operation::new(op))
6510 }
6511 };
6512
6513 let start = move || async {
6514 let op = self.send().await?;
6515 Ok(Operation::new(op))
6516 };
6517
6518 google_cloud_lro::internal::new_poller(
6519 polling_error_policy,
6520 polling_backoff_policy,
6521 start,
6522 query,
6523 )
6524 }
6525
6526 pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6530 self.0.request.product = v.into();
6531 self
6532 }
6533
6534 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
6538 where
6539 T: std::iter::IntoIterator<Item = V>,
6540 V: std::convert::Into<std::string::String>,
6541 {
6542 use std::iter::Iterator;
6543 self.0.request.place_ids = v.into_iter().map(|i| i.into()).collect();
6544 self
6545 }
6546
6547 pub fn set_remove_time<T>(mut self, v: T) -> Self
6549 where
6550 T: std::convert::Into<wkt::Timestamp>,
6551 {
6552 self.0.request.remove_time = std::option::Option::Some(v.into());
6553 self
6554 }
6555
6556 pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
6558 where
6559 T: std::convert::Into<wkt::Timestamp>,
6560 {
6561 self.0.request.remove_time = v.map(|x| x.into());
6562 self
6563 }
6564
6565 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6567 self.0.request.allow_missing = v.into();
6568 self
6569 }
6570 }
6571
6572 #[doc(hidden)]
6573 impl crate::RequestBuilder for RemoveLocalInventories {
6574 fn request_options(&mut self) -> &mut crate::RequestOptions {
6575 &mut self.0.options
6576 }
6577 }
6578
6579 #[derive(Clone, Debug)]
6600 pub struct ListOperations(
6601 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6602 );
6603
6604 impl ListOperations {
6605 pub(crate) fn new(
6606 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6607 ) -> Self {
6608 Self(RequestBuilder::new(stub))
6609 }
6610
6611 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6613 mut self,
6614 v: V,
6615 ) -> Self {
6616 self.0.request = v.into();
6617 self
6618 }
6619
6620 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6622 self.0.options = v.into();
6623 self
6624 }
6625
6626 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6628 (*self.0.stub)
6629 .list_operations(self.0.request, self.0.options)
6630 .await
6631 .map(crate::Response::into_body)
6632 }
6633
6634 pub fn by_page(
6636 self,
6637 ) -> impl google_cloud_gax::paginator::Paginator<
6638 google_cloud_longrunning::model::ListOperationsResponse,
6639 crate::Error,
6640 > {
6641 use std::clone::Clone;
6642 let token = self.0.request.page_token.clone();
6643 let execute = move |token: String| {
6644 let mut builder = self.clone();
6645 builder.0.request = builder.0.request.set_page_token(token);
6646 builder.send()
6647 };
6648 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6649 }
6650
6651 pub fn by_item(
6653 self,
6654 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6655 google_cloud_longrunning::model::ListOperationsResponse,
6656 crate::Error,
6657 > {
6658 use google_cloud_gax::paginator::Paginator;
6659 self.by_page().items()
6660 }
6661
6662 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6664 self.0.request.name = v.into();
6665 self
6666 }
6667
6668 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6670 self.0.request.filter = v.into();
6671 self
6672 }
6673
6674 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6676 self.0.request.page_size = v.into();
6677 self
6678 }
6679
6680 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6682 self.0.request.page_token = v.into();
6683 self
6684 }
6685
6686 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6688 self.0.request.return_partial_success = v.into();
6689 self
6690 }
6691 }
6692
6693 #[doc(hidden)]
6694 impl crate::RequestBuilder for ListOperations {
6695 fn request_options(&mut self) -> &mut crate::RequestOptions {
6696 &mut self.0.options
6697 }
6698 }
6699
6700 #[derive(Clone, Debug)]
6717 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6718
6719 impl GetOperation {
6720 pub(crate) fn new(
6721 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6722 ) -> Self {
6723 Self(RequestBuilder::new(stub))
6724 }
6725
6726 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6728 mut self,
6729 v: V,
6730 ) -> Self {
6731 self.0.request = v.into();
6732 self
6733 }
6734
6735 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6737 self.0.options = v.into();
6738 self
6739 }
6740
6741 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6743 (*self.0.stub)
6744 .get_operation(self.0.request, self.0.options)
6745 .await
6746 .map(crate::Response::into_body)
6747 }
6748
6749 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6751 self.0.request.name = v.into();
6752 self
6753 }
6754 }
6755
6756 #[doc(hidden)]
6757 impl crate::RequestBuilder for GetOperation {
6758 fn request_options(&mut self) -> &mut crate::RequestOptions {
6759 &mut self.0.options
6760 }
6761 }
6762}
6763
6764pub mod search_service {
6766 use crate::Result;
6767
6768 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6782
6783 pub(crate) mod client {
6784 use super::super::super::client::SearchService;
6785 pub struct Factory;
6786 impl crate::ClientFactory for Factory {
6787 type Client = SearchService;
6788 type Credentials = gaxi::options::Credentials;
6789 async fn build(
6790 self,
6791 config: gaxi::options::ClientConfig,
6792 ) -> crate::ClientBuilderResult<Self::Client> {
6793 Self::Client::new(config).await
6794 }
6795 }
6796 }
6797
6798 #[derive(Clone, Debug)]
6800 pub(crate) struct RequestBuilder<R: std::default::Default> {
6801 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
6802 request: R,
6803 options: crate::RequestOptions,
6804 }
6805
6806 impl<R> RequestBuilder<R>
6807 where
6808 R: std::default::Default,
6809 {
6810 pub(crate) fn new(
6811 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
6812 ) -> Self {
6813 Self {
6814 stub,
6815 request: R::default(),
6816 options: crate::RequestOptions::default(),
6817 }
6818 }
6819 }
6820
6821 #[derive(Clone, Debug)]
6842 pub struct Search(RequestBuilder<crate::model::SearchRequest>);
6843
6844 impl Search {
6845 pub(crate) fn new(
6846 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
6847 ) -> Self {
6848 Self(RequestBuilder::new(stub))
6849 }
6850
6851 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
6853 self.0.request = v.into();
6854 self
6855 }
6856
6857 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6859 self.0.options = v.into();
6860 self
6861 }
6862
6863 pub async fn send(self) -> Result<crate::model::SearchResponse> {
6865 (*self.0.stub)
6866 .search(self.0.request, self.0.options)
6867 .await
6868 .map(crate::Response::into_body)
6869 }
6870
6871 pub fn by_page(
6873 self,
6874 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
6875 {
6876 use std::clone::Clone;
6877 let token = self.0.request.page_token.clone();
6878 let execute = move |token: String| {
6879 let mut builder = self.clone();
6880 builder.0.request = builder.0.request.set_page_token(token);
6881 builder.send()
6882 };
6883 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6884 }
6885
6886 pub fn by_item(
6888 self,
6889 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
6890 {
6891 use google_cloud_gax::paginator::Paginator;
6892 self.by_page().items()
6893 }
6894
6895 pub fn set_placement<T: Into<std::string::String>>(mut self, v: T) -> Self {
6899 self.0.request.placement = v.into();
6900 self
6901 }
6902
6903 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
6905 self.0.request.branch = v.into();
6906 self
6907 }
6908
6909 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
6911 self.0.request.query = v.into();
6912 self
6913 }
6914
6915 pub fn set_visitor_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6919 self.0.request.visitor_id = v.into();
6920 self
6921 }
6922
6923 pub fn set_user_info<T>(mut self, v: T) -> Self
6925 where
6926 T: std::convert::Into<crate::model::UserInfo>,
6927 {
6928 self.0.request.user_info = std::option::Option::Some(v.into());
6929 self
6930 }
6931
6932 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
6934 where
6935 T: std::convert::Into<crate::model::UserInfo>,
6936 {
6937 self.0.request.user_info = v.map(|x| x.into());
6938 self
6939 }
6940
6941 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6943 self.0.request.page_size = v.into();
6944 self
6945 }
6946
6947 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6949 self.0.request.page_token = v.into();
6950 self
6951 }
6952
6953 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
6955 self.0.request.offset = v.into();
6956 self
6957 }
6958
6959 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6961 self.0.request.filter = v.into();
6962 self
6963 }
6964
6965 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6967 self.0.request.canonical_filter = v.into();
6968 self
6969 }
6970
6971 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
6973 self.0.request.order_by = v.into();
6974 self
6975 }
6976
6977 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
6979 where
6980 T: std::iter::IntoIterator<Item = V>,
6981 V: std::convert::Into<crate::model::search_request::FacetSpec>,
6982 {
6983 use std::iter::Iterator;
6984 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
6985 self
6986 }
6987
6988 #[deprecated]
6990 pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
6991 where
6992 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
6993 {
6994 self.0.request.dynamic_facet_spec = std::option::Option::Some(v.into());
6995 self
6996 }
6997
6998 #[deprecated]
7000 pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
7001 where
7002 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
7003 {
7004 self.0.request.dynamic_facet_spec = v.map(|x| x.into());
7005 self
7006 }
7007
7008 pub fn set_boost_spec<T>(mut self, v: T) -> Self
7010 where
7011 T: std::convert::Into<crate::model::search_request::BoostSpec>,
7012 {
7013 self.0.request.boost_spec = std::option::Option::Some(v.into());
7014 self
7015 }
7016
7017 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
7019 where
7020 T: std::convert::Into<crate::model::search_request::BoostSpec>,
7021 {
7022 self.0.request.boost_spec = v.map(|x| x.into());
7023 self
7024 }
7025
7026 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
7028 where
7029 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
7030 {
7031 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
7032 self
7033 }
7034
7035 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
7037 where
7038 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
7039 {
7040 self.0.request.query_expansion_spec = v.map(|x| x.into());
7041 self
7042 }
7043
7044 pub fn set_variant_rollup_keys<T, V>(mut self, v: T) -> Self
7046 where
7047 T: std::iter::IntoIterator<Item = V>,
7048 V: std::convert::Into<std::string::String>,
7049 {
7050 use std::iter::Iterator;
7051 self.0.request.variant_rollup_keys = v.into_iter().map(|i| i.into()).collect();
7052 self
7053 }
7054
7055 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
7057 where
7058 T: std::iter::IntoIterator<Item = V>,
7059 V: std::convert::Into<std::string::String>,
7060 {
7061 use std::iter::Iterator;
7062 self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
7063 self
7064 }
7065
7066 pub fn set_search_mode<T: Into<crate::model::search_request::SearchMode>>(
7068 mut self,
7069 v: T,
7070 ) -> Self {
7071 self.0.request.search_mode = v.into();
7072 self
7073 }
7074
7075 pub fn set_personalization_spec<T>(mut self, v: T) -> Self
7077 where
7078 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
7079 {
7080 self.0.request.personalization_spec = std::option::Option::Some(v.into());
7081 self
7082 }
7083
7084 pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
7086 where
7087 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
7088 {
7089 self.0.request.personalization_spec = v.map(|x| x.into());
7090 self
7091 }
7092
7093 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7095 where
7096 T: std::iter::IntoIterator<Item = (K, V)>,
7097 K: std::convert::Into<std::string::String>,
7098 V: std::convert::Into<std::string::String>,
7099 {
7100 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7101 self
7102 }
7103
7104 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
7106 where
7107 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
7108 {
7109 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
7110 self
7111 }
7112
7113 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
7115 where
7116 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
7117 {
7118 self.0.request.spell_correction_spec = v.map(|x| x.into());
7119 self
7120 }
7121
7122 pub fn set_entity<T: Into<std::string::String>>(mut self, v: T) -> Self {
7124 self.0.request.entity = v.into();
7125 self
7126 }
7127
7128 pub fn set_conversational_search_spec<T>(mut self, v: T) -> Self
7130 where
7131 T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
7132 {
7133 self.0.request.conversational_search_spec = std::option::Option::Some(v.into());
7134 self
7135 }
7136
7137 pub fn set_or_clear_conversational_search_spec<T>(
7139 mut self,
7140 v: std::option::Option<T>,
7141 ) -> Self
7142 where
7143 T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
7144 {
7145 self.0.request.conversational_search_spec = v.map(|x| x.into());
7146 self
7147 }
7148
7149 pub fn set_tile_navigation_spec<T>(mut self, v: T) -> Self
7151 where
7152 T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
7153 {
7154 self.0.request.tile_navigation_spec = std::option::Option::Some(v.into());
7155 self
7156 }
7157
7158 pub fn set_or_clear_tile_navigation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7160 where
7161 T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
7162 {
7163 self.0.request.tile_navigation_spec = v.map(|x| x.into());
7164 self
7165 }
7166
7167 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
7169 self.0.request.language_code = v.into();
7170 self
7171 }
7172
7173 pub fn set_region_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
7175 self.0.request.region_code = v.into();
7176 self
7177 }
7178
7179 pub fn set_place_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7181 self.0.request.place_id = v.into();
7182 self
7183 }
7184
7185 pub fn set_user_attributes<T, K, V>(mut self, v: T) -> Self
7187 where
7188 T: std::iter::IntoIterator<Item = (K, V)>,
7189 K: std::convert::Into<std::string::String>,
7190 V: std::convert::Into<crate::model::StringList>,
7191 {
7192 self.0.request.user_attributes =
7193 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7194 self
7195 }
7196 }
7197
7198 #[doc(hidden)]
7199 impl crate::RequestBuilder for Search {
7200 fn request_options(&mut self) -> &mut crate::RequestOptions {
7201 &mut self.0.options
7202 }
7203 }
7204
7205 #[derive(Clone, Debug)]
7226 pub struct ListOperations(
7227 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7228 );
7229
7230 impl ListOperations {
7231 pub(crate) fn new(
7232 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
7233 ) -> Self {
7234 Self(RequestBuilder::new(stub))
7235 }
7236
7237 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7239 mut self,
7240 v: V,
7241 ) -> Self {
7242 self.0.request = v.into();
7243 self
7244 }
7245
7246 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7248 self.0.options = v.into();
7249 self
7250 }
7251
7252 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7254 (*self.0.stub)
7255 .list_operations(self.0.request, self.0.options)
7256 .await
7257 .map(crate::Response::into_body)
7258 }
7259
7260 pub fn by_page(
7262 self,
7263 ) -> impl google_cloud_gax::paginator::Paginator<
7264 google_cloud_longrunning::model::ListOperationsResponse,
7265 crate::Error,
7266 > {
7267 use std::clone::Clone;
7268 let token = self.0.request.page_token.clone();
7269 let execute = move |token: String| {
7270 let mut builder = self.clone();
7271 builder.0.request = builder.0.request.set_page_token(token);
7272 builder.send()
7273 };
7274 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7275 }
7276
7277 pub fn by_item(
7279 self,
7280 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7281 google_cloud_longrunning::model::ListOperationsResponse,
7282 crate::Error,
7283 > {
7284 use google_cloud_gax::paginator::Paginator;
7285 self.by_page().items()
7286 }
7287
7288 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7290 self.0.request.name = v.into();
7291 self
7292 }
7293
7294 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7296 self.0.request.filter = v.into();
7297 self
7298 }
7299
7300 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7302 self.0.request.page_size = v.into();
7303 self
7304 }
7305
7306 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7308 self.0.request.page_token = v.into();
7309 self
7310 }
7311
7312 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7314 self.0.request.return_partial_success = v.into();
7315 self
7316 }
7317 }
7318
7319 #[doc(hidden)]
7320 impl crate::RequestBuilder for ListOperations {
7321 fn request_options(&mut self) -> &mut crate::RequestOptions {
7322 &mut self.0.options
7323 }
7324 }
7325
7326 #[derive(Clone, Debug)]
7343 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7344
7345 impl GetOperation {
7346 pub(crate) fn new(
7347 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
7348 ) -> Self {
7349 Self(RequestBuilder::new(stub))
7350 }
7351
7352 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7354 mut self,
7355 v: V,
7356 ) -> Self {
7357 self.0.request = v.into();
7358 self
7359 }
7360
7361 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7363 self.0.options = v.into();
7364 self
7365 }
7366
7367 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7369 (*self.0.stub)
7370 .get_operation(self.0.request, self.0.options)
7371 .await
7372 .map(crate::Response::into_body)
7373 }
7374
7375 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7377 self.0.request.name = v.into();
7378 self
7379 }
7380 }
7381
7382 #[doc(hidden)]
7383 impl crate::RequestBuilder for GetOperation {
7384 fn request_options(&mut self) -> &mut crate::RequestOptions {
7385 &mut self.0.options
7386 }
7387 }
7388}
7389
7390pub mod serving_config_service {
7392 use crate::Result;
7393
7394 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7408
7409 pub(crate) mod client {
7410 use super::super::super::client::ServingConfigService;
7411 pub struct Factory;
7412 impl crate::ClientFactory for Factory {
7413 type Client = ServingConfigService;
7414 type Credentials = gaxi::options::Credentials;
7415 async fn build(
7416 self,
7417 config: gaxi::options::ClientConfig,
7418 ) -> crate::ClientBuilderResult<Self::Client> {
7419 Self::Client::new(config).await
7420 }
7421 }
7422 }
7423
7424 #[derive(Clone, Debug)]
7426 pub(crate) struct RequestBuilder<R: std::default::Default> {
7427 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7428 request: R,
7429 options: crate::RequestOptions,
7430 }
7431
7432 impl<R> RequestBuilder<R>
7433 where
7434 R: std::default::Default,
7435 {
7436 pub(crate) fn new(
7437 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7438 ) -> Self {
7439 Self {
7440 stub,
7441 request: R::default(),
7442 options: crate::RequestOptions::default(),
7443 }
7444 }
7445 }
7446
7447 #[derive(Clone, Debug)]
7464 pub struct CreateServingConfig(RequestBuilder<crate::model::CreateServingConfigRequest>);
7465
7466 impl CreateServingConfig {
7467 pub(crate) fn new(
7468 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7469 ) -> Self {
7470 Self(RequestBuilder::new(stub))
7471 }
7472
7473 pub fn with_request<V: Into<crate::model::CreateServingConfigRequest>>(
7475 mut self,
7476 v: V,
7477 ) -> Self {
7478 self.0.request = v.into();
7479 self
7480 }
7481
7482 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7484 self.0.options = v.into();
7485 self
7486 }
7487
7488 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7490 (*self.0.stub)
7491 .create_serving_config(self.0.request, self.0.options)
7492 .await
7493 .map(crate::Response::into_body)
7494 }
7495
7496 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7500 self.0.request.parent = v.into();
7501 self
7502 }
7503
7504 pub fn set_serving_config<T>(mut self, v: T) -> Self
7508 where
7509 T: std::convert::Into<crate::model::ServingConfig>,
7510 {
7511 self.0.request.serving_config = std::option::Option::Some(v.into());
7512 self
7513 }
7514
7515 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
7519 where
7520 T: std::convert::Into<crate::model::ServingConfig>,
7521 {
7522 self.0.request.serving_config = v.map(|x| x.into());
7523 self
7524 }
7525
7526 pub fn set_serving_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7530 self.0.request.serving_config_id = v.into();
7531 self
7532 }
7533 }
7534
7535 #[doc(hidden)]
7536 impl crate::RequestBuilder for CreateServingConfig {
7537 fn request_options(&mut self) -> &mut crate::RequestOptions {
7538 &mut self.0.options
7539 }
7540 }
7541
7542 #[derive(Clone, Debug)]
7559 pub struct DeleteServingConfig(RequestBuilder<crate::model::DeleteServingConfigRequest>);
7560
7561 impl DeleteServingConfig {
7562 pub(crate) fn new(
7563 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7564 ) -> Self {
7565 Self(RequestBuilder::new(stub))
7566 }
7567
7568 pub fn with_request<V: Into<crate::model::DeleteServingConfigRequest>>(
7570 mut self,
7571 v: V,
7572 ) -> Self {
7573 self.0.request = v.into();
7574 self
7575 }
7576
7577 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7579 self.0.options = v.into();
7580 self
7581 }
7582
7583 pub async fn send(self) -> Result<()> {
7585 (*self.0.stub)
7586 .delete_serving_config(self.0.request, self.0.options)
7587 .await
7588 .map(crate::Response::into_body)
7589 }
7590
7591 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7595 self.0.request.name = v.into();
7596 self
7597 }
7598 }
7599
7600 #[doc(hidden)]
7601 impl crate::RequestBuilder for DeleteServingConfig {
7602 fn request_options(&mut self) -> &mut crate::RequestOptions {
7603 &mut self.0.options
7604 }
7605 }
7606
7607 #[derive(Clone, Debug)]
7624 pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
7625
7626 impl UpdateServingConfig {
7627 pub(crate) fn new(
7628 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7629 ) -> Self {
7630 Self(RequestBuilder::new(stub))
7631 }
7632
7633 pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
7635 mut self,
7636 v: V,
7637 ) -> Self {
7638 self.0.request = v.into();
7639 self
7640 }
7641
7642 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7644 self.0.options = v.into();
7645 self
7646 }
7647
7648 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7650 (*self.0.stub)
7651 .update_serving_config(self.0.request, self.0.options)
7652 .await
7653 .map(crate::Response::into_body)
7654 }
7655
7656 pub fn set_serving_config<T>(mut self, v: T) -> Self
7660 where
7661 T: std::convert::Into<crate::model::ServingConfig>,
7662 {
7663 self.0.request.serving_config = std::option::Option::Some(v.into());
7664 self
7665 }
7666
7667 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
7671 where
7672 T: std::convert::Into<crate::model::ServingConfig>,
7673 {
7674 self.0.request.serving_config = v.map(|x| x.into());
7675 self
7676 }
7677
7678 pub fn set_update_mask<T>(mut self, v: T) -> Self
7680 where
7681 T: std::convert::Into<wkt::FieldMask>,
7682 {
7683 self.0.request.update_mask = std::option::Option::Some(v.into());
7684 self
7685 }
7686
7687 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7689 where
7690 T: std::convert::Into<wkt::FieldMask>,
7691 {
7692 self.0.request.update_mask = v.map(|x| x.into());
7693 self
7694 }
7695 }
7696
7697 #[doc(hidden)]
7698 impl crate::RequestBuilder for UpdateServingConfig {
7699 fn request_options(&mut self) -> &mut crate::RequestOptions {
7700 &mut self.0.options
7701 }
7702 }
7703
7704 #[derive(Clone, Debug)]
7721 pub struct GetServingConfig(RequestBuilder<crate::model::GetServingConfigRequest>);
7722
7723 impl GetServingConfig {
7724 pub(crate) fn new(
7725 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7726 ) -> Self {
7727 Self(RequestBuilder::new(stub))
7728 }
7729
7730 pub fn with_request<V: Into<crate::model::GetServingConfigRequest>>(
7732 mut self,
7733 v: V,
7734 ) -> Self {
7735 self.0.request = v.into();
7736 self
7737 }
7738
7739 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7741 self.0.options = v.into();
7742 self
7743 }
7744
7745 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7747 (*self.0.stub)
7748 .get_serving_config(self.0.request, self.0.options)
7749 .await
7750 .map(crate::Response::into_body)
7751 }
7752
7753 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7757 self.0.request.name = v.into();
7758 self
7759 }
7760 }
7761
7762 #[doc(hidden)]
7763 impl crate::RequestBuilder for GetServingConfig {
7764 fn request_options(&mut self) -> &mut crate::RequestOptions {
7765 &mut self.0.options
7766 }
7767 }
7768
7769 #[derive(Clone, Debug)]
7790 pub struct ListServingConfigs(RequestBuilder<crate::model::ListServingConfigsRequest>);
7791
7792 impl ListServingConfigs {
7793 pub(crate) fn new(
7794 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7795 ) -> Self {
7796 Self(RequestBuilder::new(stub))
7797 }
7798
7799 pub fn with_request<V: Into<crate::model::ListServingConfigsRequest>>(
7801 mut self,
7802 v: V,
7803 ) -> Self {
7804 self.0.request = v.into();
7805 self
7806 }
7807
7808 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7810 self.0.options = v.into();
7811 self
7812 }
7813
7814 pub async fn send(self) -> Result<crate::model::ListServingConfigsResponse> {
7816 (*self.0.stub)
7817 .list_serving_configs(self.0.request, self.0.options)
7818 .await
7819 .map(crate::Response::into_body)
7820 }
7821
7822 pub fn by_page(
7824 self,
7825 ) -> impl google_cloud_gax::paginator::Paginator<
7826 crate::model::ListServingConfigsResponse,
7827 crate::Error,
7828 > {
7829 use std::clone::Clone;
7830 let token = self.0.request.page_token.clone();
7831 let execute = move |token: String| {
7832 let mut builder = self.clone();
7833 builder.0.request = builder.0.request.set_page_token(token);
7834 builder.send()
7835 };
7836 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7837 }
7838
7839 pub fn by_item(
7841 self,
7842 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7843 crate::model::ListServingConfigsResponse,
7844 crate::Error,
7845 > {
7846 use google_cloud_gax::paginator::Paginator;
7847 self.by_page().items()
7848 }
7849
7850 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7854 self.0.request.parent = v.into();
7855 self
7856 }
7857
7858 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7860 self.0.request.page_size = v.into();
7861 self
7862 }
7863
7864 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7866 self.0.request.page_token = v.into();
7867 self
7868 }
7869 }
7870
7871 #[doc(hidden)]
7872 impl crate::RequestBuilder for ListServingConfigs {
7873 fn request_options(&mut self) -> &mut crate::RequestOptions {
7874 &mut self.0.options
7875 }
7876 }
7877
7878 #[derive(Clone, Debug)]
7895 pub struct AddControl(RequestBuilder<crate::model::AddControlRequest>);
7896
7897 impl AddControl {
7898 pub(crate) fn new(
7899 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7900 ) -> Self {
7901 Self(RequestBuilder::new(stub))
7902 }
7903
7904 pub fn with_request<V: Into<crate::model::AddControlRequest>>(mut self, v: V) -> Self {
7906 self.0.request = v.into();
7907 self
7908 }
7909
7910 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7912 self.0.options = v.into();
7913 self
7914 }
7915
7916 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7918 (*self.0.stub)
7919 .add_control(self.0.request, self.0.options)
7920 .await
7921 .map(crate::Response::into_body)
7922 }
7923
7924 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7928 self.0.request.serving_config = v.into();
7929 self
7930 }
7931
7932 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7936 self.0.request.control_id = v.into();
7937 self
7938 }
7939 }
7940
7941 #[doc(hidden)]
7942 impl crate::RequestBuilder for AddControl {
7943 fn request_options(&mut self) -> &mut crate::RequestOptions {
7944 &mut self.0.options
7945 }
7946 }
7947
7948 #[derive(Clone, Debug)]
7965 pub struct RemoveControl(RequestBuilder<crate::model::RemoveControlRequest>);
7966
7967 impl RemoveControl {
7968 pub(crate) fn new(
7969 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7970 ) -> Self {
7971 Self(RequestBuilder::new(stub))
7972 }
7973
7974 pub fn with_request<V: Into<crate::model::RemoveControlRequest>>(mut self, v: V) -> Self {
7976 self.0.request = v.into();
7977 self
7978 }
7979
7980 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7982 self.0.options = v.into();
7983 self
7984 }
7985
7986 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7988 (*self.0.stub)
7989 .remove_control(self.0.request, self.0.options)
7990 .await
7991 .map(crate::Response::into_body)
7992 }
7993
7994 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7998 self.0.request.serving_config = v.into();
7999 self
8000 }
8001
8002 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8006 self.0.request.control_id = v.into();
8007 self
8008 }
8009 }
8010
8011 #[doc(hidden)]
8012 impl crate::RequestBuilder for RemoveControl {
8013 fn request_options(&mut self) -> &mut crate::RequestOptions {
8014 &mut self.0.options
8015 }
8016 }
8017
8018 #[derive(Clone, Debug)]
8039 pub struct ListOperations(
8040 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8041 );
8042
8043 impl ListOperations {
8044 pub(crate) fn new(
8045 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
8046 ) -> Self {
8047 Self(RequestBuilder::new(stub))
8048 }
8049
8050 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8052 mut self,
8053 v: V,
8054 ) -> Self {
8055 self.0.request = v.into();
8056 self
8057 }
8058
8059 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8061 self.0.options = v.into();
8062 self
8063 }
8064
8065 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8067 (*self.0.stub)
8068 .list_operations(self.0.request, self.0.options)
8069 .await
8070 .map(crate::Response::into_body)
8071 }
8072
8073 pub fn by_page(
8075 self,
8076 ) -> impl google_cloud_gax::paginator::Paginator<
8077 google_cloud_longrunning::model::ListOperationsResponse,
8078 crate::Error,
8079 > {
8080 use std::clone::Clone;
8081 let token = self.0.request.page_token.clone();
8082 let execute = move |token: String| {
8083 let mut builder = self.clone();
8084 builder.0.request = builder.0.request.set_page_token(token);
8085 builder.send()
8086 };
8087 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8088 }
8089
8090 pub fn by_item(
8092 self,
8093 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8094 google_cloud_longrunning::model::ListOperationsResponse,
8095 crate::Error,
8096 > {
8097 use google_cloud_gax::paginator::Paginator;
8098 self.by_page().items()
8099 }
8100
8101 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8103 self.0.request.name = v.into();
8104 self
8105 }
8106
8107 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8109 self.0.request.filter = v.into();
8110 self
8111 }
8112
8113 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8115 self.0.request.page_size = v.into();
8116 self
8117 }
8118
8119 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8121 self.0.request.page_token = v.into();
8122 self
8123 }
8124
8125 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8127 self.0.request.return_partial_success = v.into();
8128 self
8129 }
8130 }
8131
8132 #[doc(hidden)]
8133 impl crate::RequestBuilder for ListOperations {
8134 fn request_options(&mut self) -> &mut crate::RequestOptions {
8135 &mut self.0.options
8136 }
8137 }
8138
8139 #[derive(Clone, Debug)]
8156 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8157
8158 impl GetOperation {
8159 pub(crate) fn new(
8160 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
8161 ) -> Self {
8162 Self(RequestBuilder::new(stub))
8163 }
8164
8165 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8167 mut self,
8168 v: V,
8169 ) -> Self {
8170 self.0.request = v.into();
8171 self
8172 }
8173
8174 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8176 self.0.options = v.into();
8177 self
8178 }
8179
8180 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8182 (*self.0.stub)
8183 .get_operation(self.0.request, self.0.options)
8184 .await
8185 .map(crate::Response::into_body)
8186 }
8187
8188 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8190 self.0.request.name = v.into();
8191 self
8192 }
8193 }
8194
8195 #[doc(hidden)]
8196 impl crate::RequestBuilder for GetOperation {
8197 fn request_options(&mut self) -> &mut crate::RequestOptions {
8198 &mut self.0.options
8199 }
8200 }
8201}
8202
8203pub mod user_event_service {
8205 use crate::Result;
8206
8207 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8221
8222 pub(crate) mod client {
8223 use super::super::super::client::UserEventService;
8224 pub struct Factory;
8225 impl crate::ClientFactory for Factory {
8226 type Client = UserEventService;
8227 type Credentials = gaxi::options::Credentials;
8228 async fn build(
8229 self,
8230 config: gaxi::options::ClientConfig,
8231 ) -> crate::ClientBuilderResult<Self::Client> {
8232 Self::Client::new(config).await
8233 }
8234 }
8235 }
8236
8237 #[derive(Clone, Debug)]
8239 pub(crate) struct RequestBuilder<R: std::default::Default> {
8240 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8241 request: R,
8242 options: crate::RequestOptions,
8243 }
8244
8245 impl<R> RequestBuilder<R>
8246 where
8247 R: std::default::Default,
8248 {
8249 pub(crate) fn new(
8250 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8251 ) -> Self {
8252 Self {
8253 stub,
8254 request: R::default(),
8255 options: crate::RequestOptions::default(),
8256 }
8257 }
8258 }
8259
8260 #[derive(Clone, Debug)]
8277 pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
8278
8279 impl WriteUserEvent {
8280 pub(crate) fn new(
8281 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8282 ) -> Self {
8283 Self(RequestBuilder::new(stub))
8284 }
8285
8286 pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
8288 self.0.request = v.into();
8289 self
8290 }
8291
8292 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8294 self.0.options = v.into();
8295 self
8296 }
8297
8298 pub async fn send(self) -> Result<crate::model::UserEvent> {
8300 (*self.0.stub)
8301 .write_user_event(self.0.request, self.0.options)
8302 .await
8303 .map(crate::Response::into_body)
8304 }
8305
8306 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8310 self.0.request.parent = v.into();
8311 self
8312 }
8313
8314 pub fn set_user_event<T>(mut self, v: T) -> Self
8318 where
8319 T: std::convert::Into<crate::model::UserEvent>,
8320 {
8321 self.0.request.user_event = std::option::Option::Some(v.into());
8322 self
8323 }
8324
8325 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
8329 where
8330 T: std::convert::Into<crate::model::UserEvent>,
8331 {
8332 self.0.request.user_event = v.map(|x| x.into());
8333 self
8334 }
8335
8336 pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
8338 self.0.request.write_async = v.into();
8339 self
8340 }
8341 }
8342
8343 #[doc(hidden)]
8344 impl crate::RequestBuilder for WriteUserEvent {
8345 fn request_options(&mut self) -> &mut crate::RequestOptions {
8346 &mut self.0.options
8347 }
8348 }
8349
8350 #[derive(Clone, Debug)]
8367 pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
8368
8369 impl CollectUserEvent {
8370 pub(crate) fn new(
8371 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8372 ) -> Self {
8373 Self(RequestBuilder::new(stub))
8374 }
8375
8376 pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
8378 mut self,
8379 v: V,
8380 ) -> Self {
8381 self.0.request = v.into();
8382 self
8383 }
8384
8385 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8387 self.0.options = v.into();
8388 self
8389 }
8390
8391 pub async fn send(self) -> Result<google_cloud_api::model::HttpBody> {
8393 (*self.0.stub)
8394 .collect_user_event(self.0.request, self.0.options)
8395 .await
8396 .map(crate::Response::into_body)
8397 }
8398
8399 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8403 self.0.request.parent = v.into();
8404 self
8405 }
8406
8407 pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
8411 self.0.request.user_event = v.into();
8412 self
8413 }
8414
8415 pub fn set_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
8417 self.0.request.uri = v.into();
8418 self
8419 }
8420
8421 pub fn set_ets<T: Into<i64>>(mut self, v: T) -> Self {
8423 self.0.request.ets = v.into();
8424 self
8425 }
8426
8427 pub fn set_raw_json<T: Into<std::string::String>>(mut self, v: T) -> Self {
8429 self.0.request.raw_json = v.into();
8430 self
8431 }
8432
8433 pub fn set_conversion_rule<
8438 T: Into<Option<crate::model::collect_user_event_request::ConversionRule>>,
8439 >(
8440 mut self,
8441 v: T,
8442 ) -> Self {
8443 self.0.request.conversion_rule = v.into();
8444 self
8445 }
8446
8447 pub fn set_prebuilt_rule<T: std::convert::Into<std::string::String>>(
8453 mut self,
8454 v: T,
8455 ) -> Self {
8456 self.0.request = self.0.request.set_prebuilt_rule(v);
8457 self
8458 }
8459 }
8460
8461 #[doc(hidden)]
8462 impl crate::RequestBuilder for CollectUserEvent {
8463 fn request_options(&mut self) -> &mut crate::RequestOptions {
8464 &mut self.0.options
8465 }
8466 }
8467
8468 #[derive(Clone, Debug)]
8486 pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
8487
8488 impl PurgeUserEvents {
8489 pub(crate) fn new(
8490 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8491 ) -> Self {
8492 Self(RequestBuilder::new(stub))
8493 }
8494
8495 pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
8497 self.0.request = v.into();
8498 self
8499 }
8500
8501 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8503 self.0.options = v.into();
8504 self
8505 }
8506
8507 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8514 (*self.0.stub)
8515 .purge_user_events(self.0.request, self.0.options)
8516 .await
8517 .map(crate::Response::into_body)
8518 }
8519
8520 pub fn poller(
8522 self,
8523 ) -> impl google_cloud_lro::Poller<
8524 crate::model::PurgeUserEventsResponse,
8525 crate::model::PurgeMetadata,
8526 > {
8527 type Operation = google_cloud_lro::internal::Operation<
8528 crate::model::PurgeUserEventsResponse,
8529 crate::model::PurgeMetadata,
8530 >;
8531 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8532 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8533
8534 let stub = self.0.stub.clone();
8535 let mut options = self.0.options.clone();
8536 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8537 let query = move |name| {
8538 let stub = stub.clone();
8539 let options = options.clone();
8540 async {
8541 let op = GetOperation::new(stub)
8542 .set_name(name)
8543 .with_options(options)
8544 .send()
8545 .await?;
8546 Ok(Operation::new(op))
8547 }
8548 };
8549
8550 let start = move || async {
8551 let op = self.send().await?;
8552 Ok(Operation::new(op))
8553 };
8554
8555 google_cloud_lro::internal::new_poller(
8556 polling_error_policy,
8557 polling_backoff_policy,
8558 start,
8559 query,
8560 )
8561 }
8562
8563 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8567 self.0.request.parent = v.into();
8568 self
8569 }
8570
8571 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8575 self.0.request.filter = v.into();
8576 self
8577 }
8578
8579 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
8581 self.0.request.force = v.into();
8582 self
8583 }
8584 }
8585
8586 #[doc(hidden)]
8587 impl crate::RequestBuilder for PurgeUserEvents {
8588 fn request_options(&mut self) -> &mut crate::RequestOptions {
8589 &mut self.0.options
8590 }
8591 }
8592
8593 #[derive(Clone, Debug)]
8611 pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
8612
8613 impl ImportUserEvents {
8614 pub(crate) fn new(
8615 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8616 ) -> Self {
8617 Self(RequestBuilder::new(stub))
8618 }
8619
8620 pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
8622 mut self,
8623 v: V,
8624 ) -> Self {
8625 self.0.request = v.into();
8626 self
8627 }
8628
8629 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8631 self.0.options = v.into();
8632 self
8633 }
8634
8635 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8642 (*self.0.stub)
8643 .import_user_events(self.0.request, self.0.options)
8644 .await
8645 .map(crate::Response::into_body)
8646 }
8647
8648 pub fn poller(
8650 self,
8651 ) -> impl google_cloud_lro::Poller<
8652 crate::model::ImportUserEventsResponse,
8653 crate::model::ImportMetadata,
8654 > {
8655 type Operation = google_cloud_lro::internal::Operation<
8656 crate::model::ImportUserEventsResponse,
8657 crate::model::ImportMetadata,
8658 >;
8659 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8660 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8661
8662 let stub = self.0.stub.clone();
8663 let mut options = self.0.options.clone();
8664 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8665 let query = move |name| {
8666 let stub = stub.clone();
8667 let options = options.clone();
8668 async {
8669 let op = GetOperation::new(stub)
8670 .set_name(name)
8671 .with_options(options)
8672 .send()
8673 .await?;
8674 Ok(Operation::new(op))
8675 }
8676 };
8677
8678 let start = move || async {
8679 let op = self.send().await?;
8680 Ok(Operation::new(op))
8681 };
8682
8683 google_cloud_lro::internal::new_poller(
8684 polling_error_policy,
8685 polling_backoff_policy,
8686 start,
8687 query,
8688 )
8689 }
8690
8691 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8695 self.0.request.parent = v.into();
8696 self
8697 }
8698
8699 pub fn set_input_config<T>(mut self, v: T) -> Self
8703 where
8704 T: std::convert::Into<crate::model::UserEventInputConfig>,
8705 {
8706 self.0.request.input_config = std::option::Option::Some(v.into());
8707 self
8708 }
8709
8710 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
8714 where
8715 T: std::convert::Into<crate::model::UserEventInputConfig>,
8716 {
8717 self.0.request.input_config = v.map(|x| x.into());
8718 self
8719 }
8720
8721 pub fn set_errors_config<T>(mut self, v: T) -> Self
8723 where
8724 T: std::convert::Into<crate::model::ImportErrorsConfig>,
8725 {
8726 self.0.request.errors_config = std::option::Option::Some(v.into());
8727 self
8728 }
8729
8730 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
8732 where
8733 T: std::convert::Into<crate::model::ImportErrorsConfig>,
8734 {
8735 self.0.request.errors_config = v.map(|x| x.into());
8736 self
8737 }
8738 }
8739
8740 #[doc(hidden)]
8741 impl crate::RequestBuilder for ImportUserEvents {
8742 fn request_options(&mut self) -> &mut crate::RequestOptions {
8743 &mut self.0.options
8744 }
8745 }
8746
8747 #[derive(Clone, Debug)]
8765 pub struct RejoinUserEvents(RequestBuilder<crate::model::RejoinUserEventsRequest>);
8766
8767 impl RejoinUserEvents {
8768 pub(crate) fn new(
8769 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8770 ) -> Self {
8771 Self(RequestBuilder::new(stub))
8772 }
8773
8774 pub fn with_request<V: Into<crate::model::RejoinUserEventsRequest>>(
8776 mut self,
8777 v: V,
8778 ) -> Self {
8779 self.0.request = v.into();
8780 self
8781 }
8782
8783 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8785 self.0.options = v.into();
8786 self
8787 }
8788
8789 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8796 (*self.0.stub)
8797 .rejoin_user_events(self.0.request, self.0.options)
8798 .await
8799 .map(crate::Response::into_body)
8800 }
8801
8802 pub fn poller(
8804 self,
8805 ) -> impl google_cloud_lro::Poller<
8806 crate::model::RejoinUserEventsResponse,
8807 crate::model::RejoinUserEventsMetadata,
8808 > {
8809 type Operation = google_cloud_lro::internal::Operation<
8810 crate::model::RejoinUserEventsResponse,
8811 crate::model::RejoinUserEventsMetadata,
8812 >;
8813 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8814 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8815
8816 let stub = self.0.stub.clone();
8817 let mut options = self.0.options.clone();
8818 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8819 let query = move |name| {
8820 let stub = stub.clone();
8821 let options = options.clone();
8822 async {
8823 let op = GetOperation::new(stub)
8824 .set_name(name)
8825 .with_options(options)
8826 .send()
8827 .await?;
8828 Ok(Operation::new(op))
8829 }
8830 };
8831
8832 let start = move || async {
8833 let op = self.send().await?;
8834 Ok(Operation::new(op))
8835 };
8836
8837 google_cloud_lro::internal::new_poller(
8838 polling_error_policy,
8839 polling_backoff_policy,
8840 start,
8841 query,
8842 )
8843 }
8844
8845 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8849 self.0.request.parent = v.into();
8850 self
8851 }
8852
8853 pub fn set_user_event_rejoin_scope<
8855 T: Into<crate::model::rejoin_user_events_request::UserEventRejoinScope>,
8856 >(
8857 mut self,
8858 v: T,
8859 ) -> Self {
8860 self.0.request.user_event_rejoin_scope = v.into();
8861 self
8862 }
8863 }
8864
8865 #[doc(hidden)]
8866 impl crate::RequestBuilder for RejoinUserEvents {
8867 fn request_options(&mut self) -> &mut crate::RequestOptions {
8868 &mut self.0.options
8869 }
8870 }
8871
8872 #[derive(Clone, Debug)]
8893 pub struct ListOperations(
8894 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8895 );
8896
8897 impl ListOperations {
8898 pub(crate) fn new(
8899 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8900 ) -> Self {
8901 Self(RequestBuilder::new(stub))
8902 }
8903
8904 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8906 mut self,
8907 v: V,
8908 ) -> Self {
8909 self.0.request = v.into();
8910 self
8911 }
8912
8913 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8915 self.0.options = v.into();
8916 self
8917 }
8918
8919 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8921 (*self.0.stub)
8922 .list_operations(self.0.request, self.0.options)
8923 .await
8924 .map(crate::Response::into_body)
8925 }
8926
8927 pub fn by_page(
8929 self,
8930 ) -> impl google_cloud_gax::paginator::Paginator<
8931 google_cloud_longrunning::model::ListOperationsResponse,
8932 crate::Error,
8933 > {
8934 use std::clone::Clone;
8935 let token = self.0.request.page_token.clone();
8936 let execute = move |token: String| {
8937 let mut builder = self.clone();
8938 builder.0.request = builder.0.request.set_page_token(token);
8939 builder.send()
8940 };
8941 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8942 }
8943
8944 pub fn by_item(
8946 self,
8947 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8948 google_cloud_longrunning::model::ListOperationsResponse,
8949 crate::Error,
8950 > {
8951 use google_cloud_gax::paginator::Paginator;
8952 self.by_page().items()
8953 }
8954
8955 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8957 self.0.request.name = v.into();
8958 self
8959 }
8960
8961 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8963 self.0.request.filter = v.into();
8964 self
8965 }
8966
8967 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8969 self.0.request.page_size = v.into();
8970 self
8971 }
8972
8973 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8975 self.0.request.page_token = v.into();
8976 self
8977 }
8978
8979 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8981 self.0.request.return_partial_success = v.into();
8982 self
8983 }
8984 }
8985
8986 #[doc(hidden)]
8987 impl crate::RequestBuilder for ListOperations {
8988 fn request_options(&mut self) -> &mut crate::RequestOptions {
8989 &mut self.0.options
8990 }
8991 }
8992
8993 #[derive(Clone, Debug)]
9010 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9011
9012 impl GetOperation {
9013 pub(crate) fn new(
9014 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
9015 ) -> Self {
9016 Self(RequestBuilder::new(stub))
9017 }
9018
9019 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9021 mut self,
9022 v: V,
9023 ) -> Self {
9024 self.0.request = v.into();
9025 self
9026 }
9027
9028 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9030 self.0.options = v.into();
9031 self
9032 }
9033
9034 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9036 (*self.0.stub)
9037 .get_operation(self.0.request, self.0.options)
9038 .await
9039 .map(crate::Response::into_body)
9040 }
9041
9042 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9044 self.0.request.name = v.into();
9045 self
9046 }
9047 }
9048
9049 #[doc(hidden)]
9050 impl crate::RequestBuilder for GetOperation {
9051 fn request_options(&mut self) -> &mut crate::RequestOptions {
9052 &mut self.0.options
9053 }
9054 }
9055}