1pub mod analytics_service {
18 use crate::Result;
19
20 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::AnalyticsService;
38 pub struct Factory;
39 impl gax::client_builder::internal::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 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
55 request: R,
56 options: gax::options::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
93 pub struct ExportAnalyticsMetrics(RequestBuilder<crate::model::ExportAnalyticsMetricsRequest>);
94
95 impl ExportAnalyticsMetrics {
96 pub(crate) fn new(
97 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
98 ) -> Self {
99 Self(RequestBuilder::new(stub))
100 }
101
102 pub fn with_request<V: Into<crate::model::ExportAnalyticsMetricsRequest>>(
104 mut self,
105 v: V,
106 ) -> Self {
107 self.0.request = v.into();
108 self
109 }
110
111 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
113 self.0.options = v.into();
114 self
115 }
116
117 pub async fn send(self) -> Result<longrunning::model::Operation> {
124 (*self.0.stub)
125 .export_analytics_metrics(self.0.request, self.0.options)
126 .await
127 .map(gax::response::Response::into_body)
128 }
129
130 pub fn poller(
132 self,
133 ) -> impl lro::Poller<crate::model::ExportAnalyticsMetricsResponse, crate::model::ExportMetadata>
134 {
135 type Operation = lro::internal::Operation<
136 crate::model::ExportAnalyticsMetricsResponse,
137 crate::model::ExportMetadata,
138 >;
139 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
140 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
141
142 let stub = self.0.stub.clone();
143 let mut options = self.0.options.clone();
144 options.set_retry_policy(gax::retry_policy::NeverRetry);
145 let query = move |name| {
146 let stub = stub.clone();
147 let options = options.clone();
148 async {
149 let op = GetOperation::new(stub)
150 .set_name(name)
151 .with_options(options)
152 .send()
153 .await?;
154 Ok(Operation::new(op))
155 }
156 };
157
158 let start = move || async {
159 let op = self.send().await?;
160 Ok(Operation::new(op))
161 };
162
163 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
164 }
165
166 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
170 self.0.request.catalog = v.into();
171 self
172 }
173
174 pub fn set_output_config<T>(mut self, v: T) -> Self
178 where
179 T: std::convert::Into<crate::model::OutputConfig>,
180 {
181 self.0.request.output_config = std::option::Option::Some(v.into());
182 self
183 }
184
185 pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
189 where
190 T: std::convert::Into<crate::model::OutputConfig>,
191 {
192 self.0.request.output_config = v.map(|x| x.into());
193 self
194 }
195
196 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
198 self.0.request.filter = v.into();
199 self
200 }
201 }
202
203 #[doc(hidden)]
204 impl gax::options::internal::RequestBuilder for ExportAnalyticsMetrics {
205 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
206 &mut self.0.options
207 }
208 }
209
210 #[derive(Clone, Debug)]
232 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
233
234 impl ListOperations {
235 pub(crate) fn new(
236 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
237 ) -> Self {
238 Self(RequestBuilder::new(stub))
239 }
240
241 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
243 mut self,
244 v: V,
245 ) -> Self {
246 self.0.request = v.into();
247 self
248 }
249
250 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
252 self.0.options = v.into();
253 self
254 }
255
256 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
258 (*self.0.stub)
259 .list_operations(self.0.request, self.0.options)
260 .await
261 .map(gax::response::Response::into_body)
262 }
263
264 pub fn by_page(
266 self,
267 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
268 {
269 use std::clone::Clone;
270 let token = self.0.request.page_token.clone();
271 let execute = move |token: String| {
272 let mut builder = self.clone();
273 builder.0.request = builder.0.request.set_page_token(token);
274 builder.send()
275 };
276 gax::paginator::internal::new_paginator(token, execute)
277 }
278
279 pub fn by_item(
281 self,
282 ) -> impl gax::paginator::ItemPaginator<
283 longrunning::model::ListOperationsResponse,
284 gax::error::Error,
285 > {
286 use gax::paginator::Paginator;
287 self.by_page().items()
288 }
289
290 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
292 self.0.request.name = v.into();
293 self
294 }
295
296 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
298 self.0.request.filter = v.into();
299 self
300 }
301
302 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
304 self.0.request.page_size = v.into();
305 self
306 }
307
308 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
310 self.0.request.page_token = v.into();
311 self
312 }
313
314 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
316 self.0.request.return_partial_success = v.into();
317 self
318 }
319 }
320
321 #[doc(hidden)]
322 impl gax::options::internal::RequestBuilder for ListOperations {
323 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
324 &mut self.0.options
325 }
326 }
327
328 #[derive(Clone, Debug)]
346 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
347
348 impl GetOperation {
349 pub(crate) fn new(
350 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnalyticsService>,
351 ) -> Self {
352 Self(RequestBuilder::new(stub))
353 }
354
355 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
357 mut self,
358 v: V,
359 ) -> Self {
360 self.0.request = v.into();
361 self
362 }
363
364 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
366 self.0.options = v.into();
367 self
368 }
369
370 pub async fn send(self) -> Result<longrunning::model::Operation> {
372 (*self.0.stub)
373 .get_operation(self.0.request, self.0.options)
374 .await
375 .map(gax::response::Response::into_body)
376 }
377
378 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
380 self.0.request.name = v.into();
381 self
382 }
383 }
384
385 #[doc(hidden)]
386 impl gax::options::internal::RequestBuilder for GetOperation {
387 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
388 &mut self.0.options
389 }
390 }
391}
392
393pub mod catalog_service {
394 use crate::Result;
395
396 pub type ClientBuilder =
410 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
411
412 pub(crate) mod client {
413 use super::super::super::client::CatalogService;
414 pub struct Factory;
415 impl gax::client_builder::internal::ClientFactory for Factory {
416 type Client = CatalogService;
417 type Credentials = gaxi::options::Credentials;
418 async fn build(
419 self,
420 config: gaxi::options::ClientConfig,
421 ) -> gax::client_builder::Result<Self::Client> {
422 Self::Client::new(config).await
423 }
424 }
425 }
426
427 #[derive(Clone, Debug)]
429 pub(crate) struct RequestBuilder<R: std::default::Default> {
430 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
431 request: R,
432 options: gax::options::RequestOptions,
433 }
434
435 impl<R> RequestBuilder<R>
436 where
437 R: std::default::Default,
438 {
439 pub(crate) fn new(
440 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
441 ) -> Self {
442 Self {
443 stub,
444 request: R::default(),
445 options: gax::options::RequestOptions::default(),
446 }
447 }
448 }
449
450 #[derive(Clone, Debug)]
472 pub struct ListCatalogs(RequestBuilder<crate::model::ListCatalogsRequest>);
473
474 impl ListCatalogs {
475 pub(crate) fn new(
476 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
477 ) -> Self {
478 Self(RequestBuilder::new(stub))
479 }
480
481 pub fn with_request<V: Into<crate::model::ListCatalogsRequest>>(mut self, v: V) -> Self {
483 self.0.request = v.into();
484 self
485 }
486
487 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
489 self.0.options = v.into();
490 self
491 }
492
493 pub async fn send(self) -> Result<crate::model::ListCatalogsResponse> {
495 (*self.0.stub)
496 .list_catalogs(self.0.request, self.0.options)
497 .await
498 .map(gax::response::Response::into_body)
499 }
500
501 pub fn by_page(
503 self,
504 ) -> impl gax::paginator::Paginator<crate::model::ListCatalogsResponse, gax::error::Error>
505 {
506 use std::clone::Clone;
507 let token = self.0.request.page_token.clone();
508 let execute = move |token: String| {
509 let mut builder = self.clone();
510 builder.0.request = builder.0.request.set_page_token(token);
511 builder.send()
512 };
513 gax::paginator::internal::new_paginator(token, execute)
514 }
515
516 pub fn by_item(
518 self,
519 ) -> impl gax::paginator::ItemPaginator<crate::model::ListCatalogsResponse, gax::error::Error>
520 {
521 use gax::paginator::Paginator;
522 self.by_page().items()
523 }
524
525 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
529 self.0.request.parent = v.into();
530 self
531 }
532
533 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
535 self.0.request.page_size = v.into();
536 self
537 }
538
539 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
541 self.0.request.page_token = v.into();
542 self
543 }
544 }
545
546 #[doc(hidden)]
547 impl gax::options::internal::RequestBuilder for ListCatalogs {
548 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
549 &mut self.0.options
550 }
551 }
552
553 #[derive(Clone, Debug)]
571 pub struct UpdateCatalog(RequestBuilder<crate::model::UpdateCatalogRequest>);
572
573 impl UpdateCatalog {
574 pub(crate) fn new(
575 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
576 ) -> Self {
577 Self(RequestBuilder::new(stub))
578 }
579
580 pub fn with_request<V: Into<crate::model::UpdateCatalogRequest>>(mut self, v: V) -> Self {
582 self.0.request = v.into();
583 self
584 }
585
586 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
588 self.0.options = v.into();
589 self
590 }
591
592 pub async fn send(self) -> Result<crate::model::Catalog> {
594 (*self.0.stub)
595 .update_catalog(self.0.request, self.0.options)
596 .await
597 .map(gax::response::Response::into_body)
598 }
599
600 pub fn set_catalog<T>(mut self, v: T) -> Self
604 where
605 T: std::convert::Into<crate::model::Catalog>,
606 {
607 self.0.request.catalog = std::option::Option::Some(v.into());
608 self
609 }
610
611 pub fn set_or_clear_catalog<T>(mut self, v: std::option::Option<T>) -> Self
615 where
616 T: std::convert::Into<crate::model::Catalog>,
617 {
618 self.0.request.catalog = v.map(|x| x.into());
619 self
620 }
621
622 pub fn set_update_mask<T>(mut self, v: T) -> Self
624 where
625 T: std::convert::Into<wkt::FieldMask>,
626 {
627 self.0.request.update_mask = std::option::Option::Some(v.into());
628 self
629 }
630
631 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
633 where
634 T: std::convert::Into<wkt::FieldMask>,
635 {
636 self.0.request.update_mask = v.map(|x| x.into());
637 self
638 }
639 }
640
641 #[doc(hidden)]
642 impl gax::options::internal::RequestBuilder for UpdateCatalog {
643 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
644 &mut self.0.options
645 }
646 }
647
648 #[derive(Clone, Debug)]
666 pub struct SetDefaultBranch(RequestBuilder<crate::model::SetDefaultBranchRequest>);
667
668 impl SetDefaultBranch {
669 pub(crate) fn new(
670 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
671 ) -> Self {
672 Self(RequestBuilder::new(stub))
673 }
674
675 pub fn with_request<V: Into<crate::model::SetDefaultBranchRequest>>(
677 mut self,
678 v: V,
679 ) -> Self {
680 self.0.request = v.into();
681 self
682 }
683
684 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
686 self.0.options = v.into();
687 self
688 }
689
690 pub async fn send(self) -> Result<()> {
692 (*self.0.stub)
693 .set_default_branch(self.0.request, self.0.options)
694 .await
695 .map(gax::response::Response::into_body)
696 }
697
698 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
700 self.0.request.catalog = v.into();
701 self
702 }
703
704 pub fn set_branch_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
706 self.0.request.branch_id = v.into();
707 self
708 }
709
710 pub fn set_note<T: Into<std::string::String>>(mut self, v: T) -> Self {
712 self.0.request.note = v.into();
713 self
714 }
715
716 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
718 self.0.request.force = v.into();
719 self
720 }
721 }
722
723 #[doc(hidden)]
724 impl gax::options::internal::RequestBuilder for SetDefaultBranch {
725 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
726 &mut self.0.options
727 }
728 }
729
730 #[derive(Clone, Debug)]
748 pub struct GetDefaultBranch(RequestBuilder<crate::model::GetDefaultBranchRequest>);
749
750 impl GetDefaultBranch {
751 pub(crate) fn new(
752 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
753 ) -> Self {
754 Self(RequestBuilder::new(stub))
755 }
756
757 pub fn with_request<V: Into<crate::model::GetDefaultBranchRequest>>(
759 mut self,
760 v: V,
761 ) -> Self {
762 self.0.request = v.into();
763 self
764 }
765
766 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
768 self.0.options = v.into();
769 self
770 }
771
772 pub async fn send(self) -> Result<crate::model::GetDefaultBranchResponse> {
774 (*self.0.stub)
775 .get_default_branch(self.0.request, self.0.options)
776 .await
777 .map(gax::response::Response::into_body)
778 }
779
780 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
782 self.0.request.catalog = v.into();
783 self
784 }
785 }
786
787 #[doc(hidden)]
788 impl gax::options::internal::RequestBuilder for GetDefaultBranch {
789 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
790 &mut self.0.options
791 }
792 }
793
794 #[derive(Clone, Debug)]
812 pub struct GetCompletionConfig(RequestBuilder<crate::model::GetCompletionConfigRequest>);
813
814 impl GetCompletionConfig {
815 pub(crate) fn new(
816 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
817 ) -> Self {
818 Self(RequestBuilder::new(stub))
819 }
820
821 pub fn with_request<V: Into<crate::model::GetCompletionConfigRequest>>(
823 mut self,
824 v: V,
825 ) -> Self {
826 self.0.request = v.into();
827 self
828 }
829
830 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
832 self.0.options = v.into();
833 self
834 }
835
836 pub async fn send(self) -> Result<crate::model::CompletionConfig> {
838 (*self.0.stub)
839 .get_completion_config(self.0.request, self.0.options)
840 .await
841 .map(gax::response::Response::into_body)
842 }
843
844 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
848 self.0.request.name = v.into();
849 self
850 }
851 }
852
853 #[doc(hidden)]
854 impl gax::options::internal::RequestBuilder for GetCompletionConfig {
855 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
856 &mut self.0.options
857 }
858 }
859
860 #[derive(Clone, Debug)]
878 pub struct UpdateCompletionConfig(RequestBuilder<crate::model::UpdateCompletionConfigRequest>);
879
880 impl UpdateCompletionConfig {
881 pub(crate) fn new(
882 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
883 ) -> Self {
884 Self(RequestBuilder::new(stub))
885 }
886
887 pub fn with_request<V: Into<crate::model::UpdateCompletionConfigRequest>>(
889 mut self,
890 v: V,
891 ) -> Self {
892 self.0.request = v.into();
893 self
894 }
895
896 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
898 self.0.options = v.into();
899 self
900 }
901
902 pub async fn send(self) -> Result<crate::model::CompletionConfig> {
904 (*self.0.stub)
905 .update_completion_config(self.0.request, self.0.options)
906 .await
907 .map(gax::response::Response::into_body)
908 }
909
910 pub fn set_completion_config<T>(mut self, v: T) -> Self
914 where
915 T: std::convert::Into<crate::model::CompletionConfig>,
916 {
917 self.0.request.completion_config = std::option::Option::Some(v.into());
918 self
919 }
920
921 pub fn set_or_clear_completion_config<T>(mut self, v: std::option::Option<T>) -> Self
925 where
926 T: std::convert::Into<crate::model::CompletionConfig>,
927 {
928 self.0.request.completion_config = v.map(|x| x.into());
929 self
930 }
931
932 pub fn set_update_mask<T>(mut self, v: T) -> Self
934 where
935 T: std::convert::Into<wkt::FieldMask>,
936 {
937 self.0.request.update_mask = std::option::Option::Some(v.into());
938 self
939 }
940
941 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
943 where
944 T: std::convert::Into<wkt::FieldMask>,
945 {
946 self.0.request.update_mask = v.map(|x| x.into());
947 self
948 }
949 }
950
951 #[doc(hidden)]
952 impl gax::options::internal::RequestBuilder for UpdateCompletionConfig {
953 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
954 &mut self.0.options
955 }
956 }
957
958 #[derive(Clone, Debug)]
976 pub struct GetAttributesConfig(RequestBuilder<crate::model::GetAttributesConfigRequest>);
977
978 impl GetAttributesConfig {
979 pub(crate) fn new(
980 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
981 ) -> Self {
982 Self(RequestBuilder::new(stub))
983 }
984
985 pub fn with_request<V: Into<crate::model::GetAttributesConfigRequest>>(
987 mut self,
988 v: V,
989 ) -> Self {
990 self.0.request = v.into();
991 self
992 }
993
994 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
996 self.0.options = v.into();
997 self
998 }
999
1000 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1002 (*self.0.stub)
1003 .get_attributes_config(self.0.request, self.0.options)
1004 .await
1005 .map(gax::response::Response::into_body)
1006 }
1007
1008 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1012 self.0.request.name = v.into();
1013 self
1014 }
1015 }
1016
1017 #[doc(hidden)]
1018 impl gax::options::internal::RequestBuilder for GetAttributesConfig {
1019 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1020 &mut self.0.options
1021 }
1022 }
1023
1024 #[derive(Clone, Debug)]
1042 pub struct UpdateAttributesConfig(RequestBuilder<crate::model::UpdateAttributesConfigRequest>);
1043
1044 impl UpdateAttributesConfig {
1045 pub(crate) fn new(
1046 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1047 ) -> Self {
1048 Self(RequestBuilder::new(stub))
1049 }
1050
1051 pub fn with_request<V: Into<crate::model::UpdateAttributesConfigRequest>>(
1053 mut self,
1054 v: V,
1055 ) -> Self {
1056 self.0.request = v.into();
1057 self
1058 }
1059
1060 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1062 self.0.options = v.into();
1063 self
1064 }
1065
1066 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1068 (*self.0.stub)
1069 .update_attributes_config(self.0.request, self.0.options)
1070 .await
1071 .map(gax::response::Response::into_body)
1072 }
1073
1074 pub fn set_attributes_config<T>(mut self, v: T) -> Self
1078 where
1079 T: std::convert::Into<crate::model::AttributesConfig>,
1080 {
1081 self.0.request.attributes_config = std::option::Option::Some(v.into());
1082 self
1083 }
1084
1085 pub fn set_or_clear_attributes_config<T>(mut self, v: std::option::Option<T>) -> Self
1089 where
1090 T: std::convert::Into<crate::model::AttributesConfig>,
1091 {
1092 self.0.request.attributes_config = v.map(|x| x.into());
1093 self
1094 }
1095
1096 pub fn set_update_mask<T>(mut self, v: T) -> Self
1098 where
1099 T: std::convert::Into<wkt::FieldMask>,
1100 {
1101 self.0.request.update_mask = std::option::Option::Some(v.into());
1102 self
1103 }
1104
1105 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1107 where
1108 T: std::convert::Into<wkt::FieldMask>,
1109 {
1110 self.0.request.update_mask = v.map(|x| x.into());
1111 self
1112 }
1113 }
1114
1115 #[doc(hidden)]
1116 impl gax::options::internal::RequestBuilder for UpdateAttributesConfig {
1117 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1118 &mut self.0.options
1119 }
1120 }
1121
1122 #[derive(Clone, Debug)]
1140 pub struct AddCatalogAttribute(RequestBuilder<crate::model::AddCatalogAttributeRequest>);
1141
1142 impl AddCatalogAttribute {
1143 pub(crate) fn new(
1144 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1145 ) -> Self {
1146 Self(RequestBuilder::new(stub))
1147 }
1148
1149 pub fn with_request<V: Into<crate::model::AddCatalogAttributeRequest>>(
1151 mut self,
1152 v: V,
1153 ) -> Self {
1154 self.0.request = v.into();
1155 self
1156 }
1157
1158 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1160 self.0.options = v.into();
1161 self
1162 }
1163
1164 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1166 (*self.0.stub)
1167 .add_catalog_attribute(self.0.request, self.0.options)
1168 .await
1169 .map(gax::response::Response::into_body)
1170 }
1171
1172 pub fn set_attributes_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
1176 self.0.request.attributes_config = v.into();
1177 self
1178 }
1179
1180 pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
1184 where
1185 T: std::convert::Into<crate::model::CatalogAttribute>,
1186 {
1187 self.0.request.catalog_attribute = std::option::Option::Some(v.into());
1188 self
1189 }
1190
1191 pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
1195 where
1196 T: std::convert::Into<crate::model::CatalogAttribute>,
1197 {
1198 self.0.request.catalog_attribute = v.map(|x| x.into());
1199 self
1200 }
1201 }
1202
1203 #[doc(hidden)]
1204 impl gax::options::internal::RequestBuilder for AddCatalogAttribute {
1205 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1206 &mut self.0.options
1207 }
1208 }
1209
1210 #[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<gax::options::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(gax::response::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 gax::options::internal::RequestBuilder for RemoveCatalogAttribute {
1279 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1280 &mut self.0.options
1281 }
1282 }
1283
1284 #[derive(Clone, Debug)]
1302 pub struct ReplaceCatalogAttribute(
1303 RequestBuilder<crate::model::ReplaceCatalogAttributeRequest>,
1304 );
1305
1306 impl ReplaceCatalogAttribute {
1307 pub(crate) fn new(
1308 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1309 ) -> Self {
1310 Self(RequestBuilder::new(stub))
1311 }
1312
1313 pub fn with_request<V: Into<crate::model::ReplaceCatalogAttributeRequest>>(
1315 mut self,
1316 v: V,
1317 ) -> Self {
1318 self.0.request = v.into();
1319 self
1320 }
1321
1322 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1324 self.0.options = v.into();
1325 self
1326 }
1327
1328 pub async fn send(self) -> Result<crate::model::AttributesConfig> {
1330 (*self.0.stub)
1331 .replace_catalog_attribute(self.0.request, self.0.options)
1332 .await
1333 .map(gax::response::Response::into_body)
1334 }
1335
1336 pub fn set_attributes_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
1340 self.0.request.attributes_config = v.into();
1341 self
1342 }
1343
1344 pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
1348 where
1349 T: std::convert::Into<crate::model::CatalogAttribute>,
1350 {
1351 self.0.request.catalog_attribute = std::option::Option::Some(v.into());
1352 self
1353 }
1354
1355 pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
1359 where
1360 T: std::convert::Into<crate::model::CatalogAttribute>,
1361 {
1362 self.0.request.catalog_attribute = v.map(|x| x.into());
1363 self
1364 }
1365
1366 pub fn set_update_mask<T>(mut self, v: T) -> Self
1368 where
1369 T: std::convert::Into<wkt::FieldMask>,
1370 {
1371 self.0.request.update_mask = std::option::Option::Some(v.into());
1372 self
1373 }
1374
1375 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1377 where
1378 T: std::convert::Into<wkt::FieldMask>,
1379 {
1380 self.0.request.update_mask = v.map(|x| x.into());
1381 self
1382 }
1383 }
1384
1385 #[doc(hidden)]
1386 impl gax::options::internal::RequestBuilder for ReplaceCatalogAttribute {
1387 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1388 &mut self.0.options
1389 }
1390 }
1391
1392 #[derive(Clone, Debug)]
1414 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
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<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<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1434 self.0.options = v.into();
1435 self
1436 }
1437
1438 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1440 (*self.0.stub)
1441 .list_operations(self.0.request, self.0.options)
1442 .await
1443 .map(gax::response::Response::into_body)
1444 }
1445
1446 pub fn by_page(
1448 self,
1449 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1450 {
1451 use std::clone::Clone;
1452 let token = self.0.request.page_token.clone();
1453 let execute = move |token: String| {
1454 let mut builder = self.clone();
1455 builder.0.request = builder.0.request.set_page_token(token);
1456 builder.send()
1457 };
1458 gax::paginator::internal::new_paginator(token, execute)
1459 }
1460
1461 pub fn by_item(
1463 self,
1464 ) -> impl gax::paginator::ItemPaginator<
1465 longrunning::model::ListOperationsResponse,
1466 gax::error::Error,
1467 > {
1468 use gax::paginator::Paginator;
1469 self.by_page().items()
1470 }
1471
1472 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1474 self.0.request.name = v.into();
1475 self
1476 }
1477
1478 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1480 self.0.request.filter = v.into();
1481 self
1482 }
1483
1484 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1486 self.0.request.page_size = v.into();
1487 self
1488 }
1489
1490 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1492 self.0.request.page_token = v.into();
1493 self
1494 }
1495
1496 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1498 self.0.request.return_partial_success = v.into();
1499 self
1500 }
1501 }
1502
1503 #[doc(hidden)]
1504 impl gax::options::internal::RequestBuilder for ListOperations {
1505 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1506 &mut self.0.options
1507 }
1508 }
1509
1510 #[derive(Clone, Debug)]
1528 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1529
1530 impl GetOperation {
1531 pub(crate) fn new(
1532 stub: std::sync::Arc<dyn super::super::stub::dynamic::CatalogService>,
1533 ) -> Self {
1534 Self(RequestBuilder::new(stub))
1535 }
1536
1537 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1539 mut self,
1540 v: V,
1541 ) -> Self {
1542 self.0.request = v.into();
1543 self
1544 }
1545
1546 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1548 self.0.options = v.into();
1549 self
1550 }
1551
1552 pub async fn send(self) -> Result<longrunning::model::Operation> {
1554 (*self.0.stub)
1555 .get_operation(self.0.request, self.0.options)
1556 .await
1557 .map(gax::response::Response::into_body)
1558 }
1559
1560 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1562 self.0.request.name = v.into();
1563 self
1564 }
1565 }
1566
1567 #[doc(hidden)]
1568 impl gax::options::internal::RequestBuilder for GetOperation {
1569 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1570 &mut self.0.options
1571 }
1572 }
1573}
1574
1575pub mod completion_service {
1576 use crate::Result;
1577
1578 pub type ClientBuilder =
1592 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1593
1594 pub(crate) mod client {
1595 use super::super::super::client::CompletionService;
1596 pub struct Factory;
1597 impl gax::client_builder::internal::ClientFactory for Factory {
1598 type Client = CompletionService;
1599 type Credentials = gaxi::options::Credentials;
1600 async fn build(
1601 self,
1602 config: gaxi::options::ClientConfig,
1603 ) -> gax::client_builder::Result<Self::Client> {
1604 Self::Client::new(config).await
1605 }
1606 }
1607 }
1608
1609 #[derive(Clone, Debug)]
1611 pub(crate) struct RequestBuilder<R: std::default::Default> {
1612 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1613 request: R,
1614 options: gax::options::RequestOptions,
1615 }
1616
1617 impl<R> RequestBuilder<R>
1618 where
1619 R: std::default::Default,
1620 {
1621 pub(crate) fn new(
1622 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1623 ) -> Self {
1624 Self {
1625 stub,
1626 request: R::default(),
1627 options: gax::options::RequestOptions::default(),
1628 }
1629 }
1630 }
1631
1632 #[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<gax::options::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(gax::response::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 gax::options::internal::RequestBuilder for CompleteQuery {
1745 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1746 &mut self.0.options
1747 }
1748 }
1749
1750 #[derive(Clone, Debug)]
1769 pub struct ImportCompletionData(RequestBuilder<crate::model::ImportCompletionDataRequest>);
1770
1771 impl ImportCompletionData {
1772 pub(crate) fn new(
1773 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1774 ) -> Self {
1775 Self(RequestBuilder::new(stub))
1776 }
1777
1778 pub fn with_request<V: Into<crate::model::ImportCompletionDataRequest>>(
1780 mut self,
1781 v: V,
1782 ) -> Self {
1783 self.0.request = v.into();
1784 self
1785 }
1786
1787 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1789 self.0.options = v.into();
1790 self
1791 }
1792
1793 pub async fn send(self) -> Result<longrunning::model::Operation> {
1800 (*self.0.stub)
1801 .import_completion_data(self.0.request, self.0.options)
1802 .await
1803 .map(gax::response::Response::into_body)
1804 }
1805
1806 pub fn poller(
1808 self,
1809 ) -> impl lro::Poller<crate::model::ImportCompletionDataResponse, crate::model::ImportMetadata>
1810 {
1811 type Operation = lro::internal::Operation<
1812 crate::model::ImportCompletionDataResponse,
1813 crate::model::ImportMetadata,
1814 >;
1815 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1816 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1817
1818 let stub = self.0.stub.clone();
1819 let mut options = self.0.options.clone();
1820 options.set_retry_policy(gax::retry_policy::NeverRetry);
1821 let query = move |name| {
1822 let stub = stub.clone();
1823 let options = options.clone();
1824 async {
1825 let op = GetOperation::new(stub)
1826 .set_name(name)
1827 .with_options(options)
1828 .send()
1829 .await?;
1830 Ok(Operation::new(op))
1831 }
1832 };
1833
1834 let start = move || async {
1835 let op = self.send().await?;
1836 Ok(Operation::new(op))
1837 };
1838
1839 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1840 }
1841
1842 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1846 self.0.request.parent = v.into();
1847 self
1848 }
1849
1850 pub fn set_input_config<T>(mut self, v: T) -> Self
1854 where
1855 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
1856 {
1857 self.0.request.input_config = std::option::Option::Some(v.into());
1858 self
1859 }
1860
1861 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
1865 where
1866 T: std::convert::Into<crate::model::CompletionDataInputConfig>,
1867 {
1868 self.0.request.input_config = v.map(|x| x.into());
1869 self
1870 }
1871
1872 pub fn set_notification_pubsub_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
1874 self.0.request.notification_pubsub_topic = v.into();
1875 self
1876 }
1877 }
1878
1879 #[doc(hidden)]
1880 impl gax::options::internal::RequestBuilder for ImportCompletionData {
1881 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1882 &mut self.0.options
1883 }
1884 }
1885
1886 #[derive(Clone, Debug)]
1908 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1909
1910 impl ListOperations {
1911 pub(crate) fn new(
1912 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1913 ) -> Self {
1914 Self(RequestBuilder::new(stub))
1915 }
1916
1917 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1919 mut self,
1920 v: V,
1921 ) -> Self {
1922 self.0.request = v.into();
1923 self
1924 }
1925
1926 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1928 self.0.options = v.into();
1929 self
1930 }
1931
1932 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1934 (*self.0.stub)
1935 .list_operations(self.0.request, self.0.options)
1936 .await
1937 .map(gax::response::Response::into_body)
1938 }
1939
1940 pub fn by_page(
1942 self,
1943 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1944 {
1945 use std::clone::Clone;
1946 let token = self.0.request.page_token.clone();
1947 let execute = move |token: String| {
1948 let mut builder = self.clone();
1949 builder.0.request = builder.0.request.set_page_token(token);
1950 builder.send()
1951 };
1952 gax::paginator::internal::new_paginator(token, execute)
1953 }
1954
1955 pub fn by_item(
1957 self,
1958 ) -> impl gax::paginator::ItemPaginator<
1959 longrunning::model::ListOperationsResponse,
1960 gax::error::Error,
1961 > {
1962 use gax::paginator::Paginator;
1963 self.by_page().items()
1964 }
1965
1966 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1968 self.0.request.name = v.into();
1969 self
1970 }
1971
1972 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1974 self.0.request.filter = v.into();
1975 self
1976 }
1977
1978 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1980 self.0.request.page_size = v.into();
1981 self
1982 }
1983
1984 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1986 self.0.request.page_token = v.into();
1987 self
1988 }
1989
1990 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1992 self.0.request.return_partial_success = v.into();
1993 self
1994 }
1995 }
1996
1997 #[doc(hidden)]
1998 impl gax::options::internal::RequestBuilder for ListOperations {
1999 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2000 &mut self.0.options
2001 }
2002 }
2003
2004 #[derive(Clone, Debug)]
2022 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2023
2024 impl GetOperation {
2025 pub(crate) fn new(
2026 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
2027 ) -> Self {
2028 Self(RequestBuilder::new(stub))
2029 }
2030
2031 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2033 mut self,
2034 v: V,
2035 ) -> Self {
2036 self.0.request = v.into();
2037 self
2038 }
2039
2040 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2042 self.0.options = v.into();
2043 self
2044 }
2045
2046 pub async fn send(self) -> Result<longrunning::model::Operation> {
2048 (*self.0.stub)
2049 .get_operation(self.0.request, self.0.options)
2050 .await
2051 .map(gax::response::Response::into_body)
2052 }
2053
2054 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2056 self.0.request.name = v.into();
2057 self
2058 }
2059 }
2060
2061 #[doc(hidden)]
2062 impl gax::options::internal::RequestBuilder for GetOperation {
2063 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2064 &mut self.0.options
2065 }
2066 }
2067}
2068
2069pub mod control_service {
2070 use crate::Result;
2071
2072 pub type ClientBuilder =
2086 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2087
2088 pub(crate) mod client {
2089 use super::super::super::client::ControlService;
2090 pub struct Factory;
2091 impl gax::client_builder::internal::ClientFactory for Factory {
2092 type Client = ControlService;
2093 type Credentials = gaxi::options::Credentials;
2094 async fn build(
2095 self,
2096 config: gaxi::options::ClientConfig,
2097 ) -> gax::client_builder::Result<Self::Client> {
2098 Self::Client::new(config).await
2099 }
2100 }
2101 }
2102
2103 #[derive(Clone, Debug)]
2105 pub(crate) struct RequestBuilder<R: std::default::Default> {
2106 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2107 request: R,
2108 options: gax::options::RequestOptions,
2109 }
2110
2111 impl<R> RequestBuilder<R>
2112 where
2113 R: std::default::Default,
2114 {
2115 pub(crate) fn new(
2116 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2117 ) -> Self {
2118 Self {
2119 stub,
2120 request: R::default(),
2121 options: gax::options::RequestOptions::default(),
2122 }
2123 }
2124 }
2125
2126 #[derive(Clone, Debug)]
2144 pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2145
2146 impl CreateControl {
2147 pub(crate) fn new(
2148 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2149 ) -> Self {
2150 Self(RequestBuilder::new(stub))
2151 }
2152
2153 pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2155 self.0.request = v.into();
2156 self
2157 }
2158
2159 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2161 self.0.options = v.into();
2162 self
2163 }
2164
2165 pub async fn send(self) -> Result<crate::model::Control> {
2167 (*self.0.stub)
2168 .create_control(self.0.request, self.0.options)
2169 .await
2170 .map(gax::response::Response::into_body)
2171 }
2172
2173 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2177 self.0.request.parent = v.into();
2178 self
2179 }
2180
2181 pub fn set_control<T>(mut self, v: T) -> Self
2185 where
2186 T: std::convert::Into<crate::model::Control>,
2187 {
2188 self.0.request.control = std::option::Option::Some(v.into());
2189 self
2190 }
2191
2192 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2196 where
2197 T: std::convert::Into<crate::model::Control>,
2198 {
2199 self.0.request.control = v.map(|x| x.into());
2200 self
2201 }
2202
2203 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2207 self.0.request.control_id = v.into();
2208 self
2209 }
2210 }
2211
2212 #[doc(hidden)]
2213 impl gax::options::internal::RequestBuilder for CreateControl {
2214 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2215 &mut self.0.options
2216 }
2217 }
2218
2219 #[derive(Clone, Debug)]
2237 pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2238
2239 impl DeleteControl {
2240 pub(crate) fn new(
2241 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2242 ) -> Self {
2243 Self(RequestBuilder::new(stub))
2244 }
2245
2246 pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2248 self.0.request = v.into();
2249 self
2250 }
2251
2252 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2254 self.0.options = v.into();
2255 self
2256 }
2257
2258 pub async fn send(self) -> Result<()> {
2260 (*self.0.stub)
2261 .delete_control(self.0.request, self.0.options)
2262 .await
2263 .map(gax::response::Response::into_body)
2264 }
2265
2266 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2270 self.0.request.name = v.into();
2271 self
2272 }
2273 }
2274
2275 #[doc(hidden)]
2276 impl gax::options::internal::RequestBuilder for DeleteControl {
2277 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2278 &mut self.0.options
2279 }
2280 }
2281
2282 #[derive(Clone, Debug)]
2300 pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2301
2302 impl UpdateControl {
2303 pub(crate) fn new(
2304 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2305 ) -> Self {
2306 Self(RequestBuilder::new(stub))
2307 }
2308
2309 pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2311 self.0.request = v.into();
2312 self
2313 }
2314
2315 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2317 self.0.options = v.into();
2318 self
2319 }
2320
2321 pub async fn send(self) -> Result<crate::model::Control> {
2323 (*self.0.stub)
2324 .update_control(self.0.request, self.0.options)
2325 .await
2326 .map(gax::response::Response::into_body)
2327 }
2328
2329 pub fn set_control<T>(mut self, v: T) -> Self
2333 where
2334 T: std::convert::Into<crate::model::Control>,
2335 {
2336 self.0.request.control = std::option::Option::Some(v.into());
2337 self
2338 }
2339
2340 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2344 where
2345 T: std::convert::Into<crate::model::Control>,
2346 {
2347 self.0.request.control = v.map(|x| x.into());
2348 self
2349 }
2350
2351 pub fn set_update_mask<T>(mut self, v: T) -> Self
2353 where
2354 T: std::convert::Into<wkt::FieldMask>,
2355 {
2356 self.0.request.update_mask = std::option::Option::Some(v.into());
2357 self
2358 }
2359
2360 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2362 where
2363 T: std::convert::Into<wkt::FieldMask>,
2364 {
2365 self.0.request.update_mask = v.map(|x| x.into());
2366 self
2367 }
2368 }
2369
2370 #[doc(hidden)]
2371 impl gax::options::internal::RequestBuilder for UpdateControl {
2372 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2373 &mut self.0.options
2374 }
2375 }
2376
2377 #[derive(Clone, Debug)]
2395 pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2396
2397 impl GetControl {
2398 pub(crate) fn new(
2399 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2400 ) -> Self {
2401 Self(RequestBuilder::new(stub))
2402 }
2403
2404 pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2406 self.0.request = v.into();
2407 self
2408 }
2409
2410 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2412 self.0.options = v.into();
2413 self
2414 }
2415
2416 pub async fn send(self) -> Result<crate::model::Control> {
2418 (*self.0.stub)
2419 .get_control(self.0.request, self.0.options)
2420 .await
2421 .map(gax::response::Response::into_body)
2422 }
2423
2424 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2428 self.0.request.name = v.into();
2429 self
2430 }
2431 }
2432
2433 #[doc(hidden)]
2434 impl gax::options::internal::RequestBuilder for GetControl {
2435 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2436 &mut self.0.options
2437 }
2438 }
2439
2440 #[derive(Clone, Debug)]
2462 pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2463
2464 impl ListControls {
2465 pub(crate) fn new(
2466 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2467 ) -> Self {
2468 Self(RequestBuilder::new(stub))
2469 }
2470
2471 pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2473 self.0.request = v.into();
2474 self
2475 }
2476
2477 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2479 self.0.options = v.into();
2480 self
2481 }
2482
2483 pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2485 (*self.0.stub)
2486 .list_controls(self.0.request, self.0.options)
2487 .await
2488 .map(gax::response::Response::into_body)
2489 }
2490
2491 pub fn by_page(
2493 self,
2494 ) -> impl gax::paginator::Paginator<crate::model::ListControlsResponse, gax::error::Error>
2495 {
2496 use std::clone::Clone;
2497 let token = self.0.request.page_token.clone();
2498 let execute = move |token: String| {
2499 let mut builder = self.clone();
2500 builder.0.request = builder.0.request.set_page_token(token);
2501 builder.send()
2502 };
2503 gax::paginator::internal::new_paginator(token, execute)
2504 }
2505
2506 pub fn by_item(
2508 self,
2509 ) -> impl gax::paginator::ItemPaginator<crate::model::ListControlsResponse, gax::error::Error>
2510 {
2511 use gax::paginator::Paginator;
2512 self.by_page().items()
2513 }
2514
2515 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2519 self.0.request.parent = v.into();
2520 self
2521 }
2522
2523 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2525 self.0.request.page_size = v.into();
2526 self
2527 }
2528
2529 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2531 self.0.request.page_token = v.into();
2532 self
2533 }
2534
2535 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2537 self.0.request.filter = v.into();
2538 self
2539 }
2540 }
2541
2542 #[doc(hidden)]
2543 impl gax::options::internal::RequestBuilder for ListControls {
2544 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2545 &mut self.0.options
2546 }
2547 }
2548
2549 #[derive(Clone, Debug)]
2571 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2572
2573 impl ListOperations {
2574 pub(crate) fn new(
2575 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2576 ) -> Self {
2577 Self(RequestBuilder::new(stub))
2578 }
2579
2580 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2582 mut self,
2583 v: V,
2584 ) -> Self {
2585 self.0.request = v.into();
2586 self
2587 }
2588
2589 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2591 self.0.options = v.into();
2592 self
2593 }
2594
2595 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2597 (*self.0.stub)
2598 .list_operations(self.0.request, self.0.options)
2599 .await
2600 .map(gax::response::Response::into_body)
2601 }
2602
2603 pub fn by_page(
2605 self,
2606 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2607 {
2608 use std::clone::Clone;
2609 let token = self.0.request.page_token.clone();
2610 let execute = move |token: String| {
2611 let mut builder = self.clone();
2612 builder.0.request = builder.0.request.set_page_token(token);
2613 builder.send()
2614 };
2615 gax::paginator::internal::new_paginator(token, execute)
2616 }
2617
2618 pub fn by_item(
2620 self,
2621 ) -> impl gax::paginator::ItemPaginator<
2622 longrunning::model::ListOperationsResponse,
2623 gax::error::Error,
2624 > {
2625 use gax::paginator::Paginator;
2626 self.by_page().items()
2627 }
2628
2629 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2631 self.0.request.name = v.into();
2632 self
2633 }
2634
2635 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2637 self.0.request.filter = v.into();
2638 self
2639 }
2640
2641 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2643 self.0.request.page_size = v.into();
2644 self
2645 }
2646
2647 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2649 self.0.request.page_token = v.into();
2650 self
2651 }
2652
2653 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2655 self.0.request.return_partial_success = v.into();
2656 self
2657 }
2658 }
2659
2660 #[doc(hidden)]
2661 impl gax::options::internal::RequestBuilder for ListOperations {
2662 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2663 &mut self.0.options
2664 }
2665 }
2666
2667 #[derive(Clone, Debug)]
2685 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2686
2687 impl GetOperation {
2688 pub(crate) fn new(
2689 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2690 ) -> Self {
2691 Self(RequestBuilder::new(stub))
2692 }
2693
2694 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2696 mut self,
2697 v: V,
2698 ) -> Self {
2699 self.0.request = v.into();
2700 self
2701 }
2702
2703 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2705 self.0.options = v.into();
2706 self
2707 }
2708
2709 pub async fn send(self) -> Result<longrunning::model::Operation> {
2711 (*self.0.stub)
2712 .get_operation(self.0.request, self.0.options)
2713 .await
2714 .map(gax::response::Response::into_body)
2715 }
2716
2717 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2719 self.0.request.name = v.into();
2720 self
2721 }
2722 }
2723
2724 #[doc(hidden)]
2725 impl gax::options::internal::RequestBuilder for GetOperation {
2726 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2727 &mut self.0.options
2728 }
2729 }
2730}
2731
2732pub mod conversational_search_service {
2733 use crate::Result;
2734
2735 pub type ClientBuilder =
2749 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2750
2751 pub(crate) mod client {
2752 use super::super::super::client::ConversationalSearchService;
2753 pub struct Factory;
2754 impl gax::client_builder::internal::ClientFactory for Factory {
2755 type Client = ConversationalSearchService;
2756 type Credentials = gaxi::options::Credentials;
2757 async fn build(
2758 self,
2759 config: gaxi::options::ClientConfig,
2760 ) -> gax::client_builder::Result<Self::Client> {
2761 Self::Client::new(config).await
2762 }
2763 }
2764 }
2765
2766 #[derive(Clone, Debug)]
2768 pub(crate) struct RequestBuilder<R: std::default::Default> {
2769 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2770 request: R,
2771 options: gax::options::RequestOptions,
2772 }
2773
2774 impl<R> RequestBuilder<R>
2775 where
2776 R: std::default::Default,
2777 {
2778 pub(crate) fn new(
2779 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2780 ) -> Self {
2781 Self {
2782 stub,
2783 request: R::default(),
2784 options: gax::options::RequestOptions::default(),
2785 }
2786 }
2787 }
2788
2789 #[derive(Clone, Debug)]
2811 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2812
2813 impl ListOperations {
2814 pub(crate) fn new(
2815 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2816 ) -> Self {
2817 Self(RequestBuilder::new(stub))
2818 }
2819
2820 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2822 mut self,
2823 v: V,
2824 ) -> Self {
2825 self.0.request = v.into();
2826 self
2827 }
2828
2829 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2831 self.0.options = v.into();
2832 self
2833 }
2834
2835 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2837 (*self.0.stub)
2838 .list_operations(self.0.request, self.0.options)
2839 .await
2840 .map(gax::response::Response::into_body)
2841 }
2842
2843 pub fn by_page(
2845 self,
2846 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2847 {
2848 use std::clone::Clone;
2849 let token = self.0.request.page_token.clone();
2850 let execute = move |token: String| {
2851 let mut builder = self.clone();
2852 builder.0.request = builder.0.request.set_page_token(token);
2853 builder.send()
2854 };
2855 gax::paginator::internal::new_paginator(token, execute)
2856 }
2857
2858 pub fn by_item(
2860 self,
2861 ) -> impl gax::paginator::ItemPaginator<
2862 longrunning::model::ListOperationsResponse,
2863 gax::error::Error,
2864 > {
2865 use gax::paginator::Paginator;
2866 self.by_page().items()
2867 }
2868
2869 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2871 self.0.request.name = v.into();
2872 self
2873 }
2874
2875 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2877 self.0.request.filter = v.into();
2878 self
2879 }
2880
2881 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2883 self.0.request.page_size = v.into();
2884 self
2885 }
2886
2887 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2889 self.0.request.page_token = v.into();
2890 self
2891 }
2892
2893 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2895 self.0.request.return_partial_success = v.into();
2896 self
2897 }
2898 }
2899
2900 #[doc(hidden)]
2901 impl gax::options::internal::RequestBuilder for ListOperations {
2902 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2903 &mut self.0.options
2904 }
2905 }
2906
2907 #[derive(Clone, Debug)]
2925 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2926
2927 impl GetOperation {
2928 pub(crate) fn new(
2929 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2930 ) -> Self {
2931 Self(RequestBuilder::new(stub))
2932 }
2933
2934 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2936 mut self,
2937 v: V,
2938 ) -> Self {
2939 self.0.request = v.into();
2940 self
2941 }
2942
2943 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2945 self.0.options = v.into();
2946 self
2947 }
2948
2949 pub async fn send(self) -> Result<longrunning::model::Operation> {
2951 (*self.0.stub)
2952 .get_operation(self.0.request, self.0.options)
2953 .await
2954 .map(gax::response::Response::into_body)
2955 }
2956
2957 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2959 self.0.request.name = v.into();
2960 self
2961 }
2962 }
2963
2964 #[doc(hidden)]
2965 impl gax::options::internal::RequestBuilder for GetOperation {
2966 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2967 &mut self.0.options
2968 }
2969 }
2970}
2971
2972pub mod generative_question_service {
2973 use crate::Result;
2974
2975 pub type ClientBuilder =
2989 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2990
2991 pub(crate) mod client {
2992 use super::super::super::client::GenerativeQuestionService;
2993 pub struct Factory;
2994 impl gax::client_builder::internal::ClientFactory for Factory {
2995 type Client = GenerativeQuestionService;
2996 type Credentials = gaxi::options::Credentials;
2997 async fn build(
2998 self,
2999 config: gaxi::options::ClientConfig,
3000 ) -> gax::client_builder::Result<Self::Client> {
3001 Self::Client::new(config).await
3002 }
3003 }
3004 }
3005
3006 #[derive(Clone, Debug)]
3008 pub(crate) struct RequestBuilder<R: std::default::Default> {
3009 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3010 request: R,
3011 options: gax::options::RequestOptions,
3012 }
3013
3014 impl<R> RequestBuilder<R>
3015 where
3016 R: std::default::Default,
3017 {
3018 pub(crate) fn new(
3019 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3020 ) -> Self {
3021 Self {
3022 stub,
3023 request: R::default(),
3024 options: gax::options::RequestOptions::default(),
3025 }
3026 }
3027 }
3028
3029 #[derive(Clone, Debug)]
3047 pub struct UpdateGenerativeQuestionsFeatureConfig(
3048 RequestBuilder<crate::model::UpdateGenerativeQuestionsFeatureConfigRequest>,
3049 );
3050
3051 impl UpdateGenerativeQuestionsFeatureConfig {
3052 pub(crate) fn new(
3053 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3054 ) -> Self {
3055 Self(RequestBuilder::new(stub))
3056 }
3057
3058 pub fn with_request<
3060 V: Into<crate::model::UpdateGenerativeQuestionsFeatureConfigRequest>,
3061 >(
3062 mut self,
3063 v: V,
3064 ) -> Self {
3065 self.0.request = v.into();
3066 self
3067 }
3068
3069 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3071 self.0.options = v.into();
3072 self
3073 }
3074
3075 pub async fn send(self) -> Result<crate::model::GenerativeQuestionsFeatureConfig> {
3077 (*self.0.stub)
3078 .update_generative_questions_feature_config(self.0.request, self.0.options)
3079 .await
3080 .map(gax::response::Response::into_body)
3081 }
3082
3083 pub fn set_generative_questions_feature_config<T>(mut self, v: T) -> Self
3087 where
3088 T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
3089 {
3090 self.0.request.generative_questions_feature_config =
3091 std::option::Option::Some(v.into());
3092 self
3093 }
3094
3095 pub fn set_or_clear_generative_questions_feature_config<T>(
3099 mut self,
3100 v: std::option::Option<T>,
3101 ) -> Self
3102 where
3103 T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
3104 {
3105 self.0.request.generative_questions_feature_config = v.map(|x| x.into());
3106 self
3107 }
3108
3109 pub fn set_update_mask<T>(mut self, v: T) -> Self
3111 where
3112 T: std::convert::Into<wkt::FieldMask>,
3113 {
3114 self.0.request.update_mask = std::option::Option::Some(v.into());
3115 self
3116 }
3117
3118 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3120 where
3121 T: std::convert::Into<wkt::FieldMask>,
3122 {
3123 self.0.request.update_mask = v.map(|x| x.into());
3124 self
3125 }
3126 }
3127
3128 #[doc(hidden)]
3129 impl gax::options::internal::RequestBuilder for UpdateGenerativeQuestionsFeatureConfig {
3130 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3131 &mut self.0.options
3132 }
3133 }
3134
3135 #[derive(Clone, Debug)]
3153 pub struct GetGenerativeQuestionsFeatureConfig(
3154 RequestBuilder<crate::model::GetGenerativeQuestionsFeatureConfigRequest>,
3155 );
3156
3157 impl GetGenerativeQuestionsFeatureConfig {
3158 pub(crate) fn new(
3159 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3160 ) -> Self {
3161 Self(RequestBuilder::new(stub))
3162 }
3163
3164 pub fn with_request<V: Into<crate::model::GetGenerativeQuestionsFeatureConfigRequest>>(
3166 mut self,
3167 v: V,
3168 ) -> Self {
3169 self.0.request = v.into();
3170 self
3171 }
3172
3173 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3175 self.0.options = v.into();
3176 self
3177 }
3178
3179 pub async fn send(self) -> Result<crate::model::GenerativeQuestionsFeatureConfig> {
3181 (*self.0.stub)
3182 .get_generative_questions_feature_config(self.0.request, self.0.options)
3183 .await
3184 .map(gax::response::Response::into_body)
3185 }
3186
3187 pub fn set_catalog<T: Into<std::string::String>>(mut self, v: T) -> Self {
3191 self.0.request.catalog = v.into();
3192 self
3193 }
3194 }
3195
3196 #[doc(hidden)]
3197 impl gax::options::internal::RequestBuilder for GetGenerativeQuestionsFeatureConfig {
3198 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3199 &mut self.0.options
3200 }
3201 }
3202
3203 #[derive(Clone, Debug)]
3221 pub struct ListGenerativeQuestionConfigs(
3222 RequestBuilder<crate::model::ListGenerativeQuestionConfigsRequest>,
3223 );
3224
3225 impl ListGenerativeQuestionConfigs {
3226 pub(crate) fn new(
3227 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3228 ) -> Self {
3229 Self(RequestBuilder::new(stub))
3230 }
3231
3232 pub fn with_request<V: Into<crate::model::ListGenerativeQuestionConfigsRequest>>(
3234 mut self,
3235 v: V,
3236 ) -> Self {
3237 self.0.request = v.into();
3238 self
3239 }
3240
3241 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3243 self.0.options = v.into();
3244 self
3245 }
3246
3247 pub async fn send(self) -> Result<crate::model::ListGenerativeQuestionConfigsResponse> {
3249 (*self.0.stub)
3250 .list_generative_question_configs(self.0.request, self.0.options)
3251 .await
3252 .map(gax::response::Response::into_body)
3253 }
3254
3255 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3259 self.0.request.parent = v.into();
3260 self
3261 }
3262 }
3263
3264 #[doc(hidden)]
3265 impl gax::options::internal::RequestBuilder for ListGenerativeQuestionConfigs {
3266 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3267 &mut self.0.options
3268 }
3269 }
3270
3271 #[derive(Clone, Debug)]
3289 pub struct UpdateGenerativeQuestionConfig(
3290 RequestBuilder<crate::model::UpdateGenerativeQuestionConfigRequest>,
3291 );
3292
3293 impl UpdateGenerativeQuestionConfig {
3294 pub(crate) fn new(
3295 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3296 ) -> Self {
3297 Self(RequestBuilder::new(stub))
3298 }
3299
3300 pub fn with_request<V: Into<crate::model::UpdateGenerativeQuestionConfigRequest>>(
3302 mut self,
3303 v: V,
3304 ) -> Self {
3305 self.0.request = v.into();
3306 self
3307 }
3308
3309 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3311 self.0.options = v.into();
3312 self
3313 }
3314
3315 pub async fn send(self) -> Result<crate::model::GenerativeQuestionConfig> {
3317 (*self.0.stub)
3318 .update_generative_question_config(self.0.request, self.0.options)
3319 .await
3320 .map(gax::response::Response::into_body)
3321 }
3322
3323 pub fn set_generative_question_config<T>(mut self, v: T) -> Self
3327 where
3328 T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
3329 {
3330 self.0.request.generative_question_config = std::option::Option::Some(v.into());
3331 self
3332 }
3333
3334 pub fn set_or_clear_generative_question_config<T>(
3338 mut self,
3339 v: std::option::Option<T>,
3340 ) -> Self
3341 where
3342 T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
3343 {
3344 self.0.request.generative_question_config = v.map(|x| x.into());
3345 self
3346 }
3347
3348 pub fn set_update_mask<T>(mut self, v: T) -> Self
3350 where
3351 T: std::convert::Into<wkt::FieldMask>,
3352 {
3353 self.0.request.update_mask = std::option::Option::Some(v.into());
3354 self
3355 }
3356
3357 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3359 where
3360 T: std::convert::Into<wkt::FieldMask>,
3361 {
3362 self.0.request.update_mask = v.map(|x| x.into());
3363 self
3364 }
3365 }
3366
3367 #[doc(hidden)]
3368 impl gax::options::internal::RequestBuilder for UpdateGenerativeQuestionConfig {
3369 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3370 &mut self.0.options
3371 }
3372 }
3373
3374 #[derive(Clone, Debug)]
3392 pub struct BatchUpdateGenerativeQuestionConfigs(
3393 RequestBuilder<crate::model::BatchUpdateGenerativeQuestionConfigsRequest>,
3394 );
3395
3396 impl BatchUpdateGenerativeQuestionConfigs {
3397 pub(crate) fn new(
3398 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3399 ) -> Self {
3400 Self(RequestBuilder::new(stub))
3401 }
3402
3403 pub fn with_request<V: Into<crate::model::BatchUpdateGenerativeQuestionConfigsRequest>>(
3405 mut self,
3406 v: V,
3407 ) -> Self {
3408 self.0.request = v.into();
3409 self
3410 }
3411
3412 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3414 self.0.options = v.into();
3415 self
3416 }
3417
3418 pub async fn send(
3420 self,
3421 ) -> Result<crate::model::BatchUpdateGenerativeQuestionConfigsResponse> {
3422 (*self.0.stub)
3423 .batch_update_generative_question_configs(self.0.request, self.0.options)
3424 .await
3425 .map(gax::response::Response::into_body)
3426 }
3427
3428 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3430 self.0.request.parent = v.into();
3431 self
3432 }
3433
3434 pub fn set_requests<T, V>(mut self, v: T) -> Self
3438 where
3439 T: std::iter::IntoIterator<Item = V>,
3440 V: std::convert::Into<crate::model::UpdateGenerativeQuestionConfigRequest>,
3441 {
3442 use std::iter::Iterator;
3443 self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
3444 self
3445 }
3446 }
3447
3448 #[doc(hidden)]
3449 impl gax::options::internal::RequestBuilder for BatchUpdateGenerativeQuestionConfigs {
3450 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3451 &mut self.0.options
3452 }
3453 }
3454
3455 #[derive(Clone, Debug)]
3477 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3478
3479 impl ListOperations {
3480 pub(crate) fn new(
3481 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3482 ) -> Self {
3483 Self(RequestBuilder::new(stub))
3484 }
3485
3486 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
3488 mut self,
3489 v: V,
3490 ) -> Self {
3491 self.0.request = v.into();
3492 self
3493 }
3494
3495 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3497 self.0.options = v.into();
3498 self
3499 }
3500
3501 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
3503 (*self.0.stub)
3504 .list_operations(self.0.request, self.0.options)
3505 .await
3506 .map(gax::response::Response::into_body)
3507 }
3508
3509 pub fn by_page(
3511 self,
3512 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
3513 {
3514 use std::clone::Clone;
3515 let token = self.0.request.page_token.clone();
3516 let execute = move |token: String| {
3517 let mut builder = self.clone();
3518 builder.0.request = builder.0.request.set_page_token(token);
3519 builder.send()
3520 };
3521 gax::paginator::internal::new_paginator(token, execute)
3522 }
3523
3524 pub fn by_item(
3526 self,
3527 ) -> impl gax::paginator::ItemPaginator<
3528 longrunning::model::ListOperationsResponse,
3529 gax::error::Error,
3530 > {
3531 use gax::paginator::Paginator;
3532 self.by_page().items()
3533 }
3534
3535 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3537 self.0.request.name = v.into();
3538 self
3539 }
3540
3541 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3543 self.0.request.filter = v.into();
3544 self
3545 }
3546
3547 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3549 self.0.request.page_size = v.into();
3550 self
3551 }
3552
3553 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3555 self.0.request.page_token = v.into();
3556 self
3557 }
3558
3559 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
3561 self.0.request.return_partial_success = v.into();
3562 self
3563 }
3564 }
3565
3566 #[doc(hidden)]
3567 impl gax::options::internal::RequestBuilder for ListOperations {
3568 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3569 &mut self.0.options
3570 }
3571 }
3572
3573 #[derive(Clone, Debug)]
3591 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
3592
3593 impl GetOperation {
3594 pub(crate) fn new(
3595 stub: std::sync::Arc<dyn super::super::stub::dynamic::GenerativeQuestionService>,
3596 ) -> Self {
3597 Self(RequestBuilder::new(stub))
3598 }
3599
3600 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
3602 mut self,
3603 v: V,
3604 ) -> Self {
3605 self.0.request = v.into();
3606 self
3607 }
3608
3609 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3611 self.0.options = v.into();
3612 self
3613 }
3614
3615 pub async fn send(self) -> Result<longrunning::model::Operation> {
3617 (*self.0.stub)
3618 .get_operation(self.0.request, self.0.options)
3619 .await
3620 .map(gax::response::Response::into_body)
3621 }
3622
3623 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3625 self.0.request.name = v.into();
3626 self
3627 }
3628 }
3629
3630 #[doc(hidden)]
3631 impl gax::options::internal::RequestBuilder for GetOperation {
3632 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3633 &mut self.0.options
3634 }
3635 }
3636}
3637
3638pub mod model_service {
3639 use crate::Result;
3640
3641 pub type ClientBuilder =
3655 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3656
3657 pub(crate) mod client {
3658 use super::super::super::client::ModelService;
3659 pub struct Factory;
3660 impl gax::client_builder::internal::ClientFactory for Factory {
3661 type Client = ModelService;
3662 type Credentials = gaxi::options::Credentials;
3663 async fn build(
3664 self,
3665 config: gaxi::options::ClientConfig,
3666 ) -> gax::client_builder::Result<Self::Client> {
3667 Self::Client::new(config).await
3668 }
3669 }
3670 }
3671
3672 #[derive(Clone, Debug)]
3674 pub(crate) struct RequestBuilder<R: std::default::Default> {
3675 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3676 request: R,
3677 options: gax::options::RequestOptions,
3678 }
3679
3680 impl<R> RequestBuilder<R>
3681 where
3682 R: std::default::Default,
3683 {
3684 pub(crate) fn new(
3685 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3686 ) -> Self {
3687 Self {
3688 stub,
3689 request: R::default(),
3690 options: gax::options::RequestOptions::default(),
3691 }
3692 }
3693 }
3694
3695 #[derive(Clone, Debug)]
3714 pub struct CreateModel(RequestBuilder<crate::model::CreateModelRequest>);
3715
3716 impl CreateModel {
3717 pub(crate) fn new(
3718 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3719 ) -> Self {
3720 Self(RequestBuilder::new(stub))
3721 }
3722
3723 pub fn with_request<V: Into<crate::model::CreateModelRequest>>(mut self, v: V) -> Self {
3725 self.0.request = v.into();
3726 self
3727 }
3728
3729 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3731 self.0.options = v.into();
3732 self
3733 }
3734
3735 pub async fn send(self) -> Result<longrunning::model::Operation> {
3742 (*self.0.stub)
3743 .create_model(self.0.request, self.0.options)
3744 .await
3745 .map(gax::response::Response::into_body)
3746 }
3747
3748 pub fn poller(
3750 self,
3751 ) -> impl lro::Poller<crate::model::Model, crate::model::CreateModelMetadata> {
3752 type Operation =
3753 lro::internal::Operation<crate::model::Model, crate::model::CreateModelMetadata>;
3754 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3755 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3756
3757 let stub = self.0.stub.clone();
3758 let mut options = self.0.options.clone();
3759 options.set_retry_policy(gax::retry_policy::NeverRetry);
3760 let query = move |name| {
3761 let stub = stub.clone();
3762 let options = options.clone();
3763 async {
3764 let op = GetOperation::new(stub)
3765 .set_name(name)
3766 .with_options(options)
3767 .send()
3768 .await?;
3769 Ok(Operation::new(op))
3770 }
3771 };
3772
3773 let start = move || async {
3774 let op = self.send().await?;
3775 Ok(Operation::new(op))
3776 };
3777
3778 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
3779 }
3780
3781 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3785 self.0.request.parent = v.into();
3786 self
3787 }
3788
3789 pub fn set_model<T>(mut self, v: T) -> Self
3793 where
3794 T: std::convert::Into<crate::model::Model>,
3795 {
3796 self.0.request.model = std::option::Option::Some(v.into());
3797 self
3798 }
3799
3800 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
3804 where
3805 T: std::convert::Into<crate::model::Model>,
3806 {
3807 self.0.request.model = v.map(|x| x.into());
3808 self
3809 }
3810
3811 pub fn set_dry_run<T: Into<bool>>(mut self, v: T) -> Self {
3813 self.0.request.dry_run = v.into();
3814 self
3815 }
3816 }
3817
3818 #[doc(hidden)]
3819 impl gax::options::internal::RequestBuilder for CreateModel {
3820 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3821 &mut self.0.options
3822 }
3823 }
3824
3825 #[derive(Clone, Debug)]
3843 pub struct GetModel(RequestBuilder<crate::model::GetModelRequest>);
3844
3845 impl GetModel {
3846 pub(crate) fn new(
3847 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3848 ) -> Self {
3849 Self(RequestBuilder::new(stub))
3850 }
3851
3852 pub fn with_request<V: Into<crate::model::GetModelRequest>>(mut self, v: V) -> Self {
3854 self.0.request = v.into();
3855 self
3856 }
3857
3858 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3860 self.0.options = v.into();
3861 self
3862 }
3863
3864 pub async fn send(self) -> Result<crate::model::Model> {
3866 (*self.0.stub)
3867 .get_model(self.0.request, self.0.options)
3868 .await
3869 .map(gax::response::Response::into_body)
3870 }
3871
3872 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3876 self.0.request.name = v.into();
3877 self
3878 }
3879 }
3880
3881 #[doc(hidden)]
3882 impl gax::options::internal::RequestBuilder for GetModel {
3883 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3884 &mut self.0.options
3885 }
3886 }
3887
3888 #[derive(Clone, Debug)]
3906 pub struct PauseModel(RequestBuilder<crate::model::PauseModelRequest>);
3907
3908 impl PauseModel {
3909 pub(crate) fn new(
3910 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3911 ) -> Self {
3912 Self(RequestBuilder::new(stub))
3913 }
3914
3915 pub fn with_request<V: Into<crate::model::PauseModelRequest>>(mut self, v: V) -> Self {
3917 self.0.request = v.into();
3918 self
3919 }
3920
3921 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3923 self.0.options = v.into();
3924 self
3925 }
3926
3927 pub async fn send(self) -> Result<crate::model::Model> {
3929 (*self.0.stub)
3930 .pause_model(self.0.request, self.0.options)
3931 .await
3932 .map(gax::response::Response::into_body)
3933 }
3934
3935 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3939 self.0.request.name = v.into();
3940 self
3941 }
3942 }
3943
3944 #[doc(hidden)]
3945 impl gax::options::internal::RequestBuilder for PauseModel {
3946 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3947 &mut self.0.options
3948 }
3949 }
3950
3951 #[derive(Clone, Debug)]
3969 pub struct ResumeModel(RequestBuilder<crate::model::ResumeModelRequest>);
3970
3971 impl ResumeModel {
3972 pub(crate) fn new(
3973 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
3974 ) -> Self {
3975 Self(RequestBuilder::new(stub))
3976 }
3977
3978 pub fn with_request<V: Into<crate::model::ResumeModelRequest>>(mut self, v: V) -> Self {
3980 self.0.request = v.into();
3981 self
3982 }
3983
3984 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3986 self.0.options = v.into();
3987 self
3988 }
3989
3990 pub async fn send(self) -> Result<crate::model::Model> {
3992 (*self.0.stub)
3993 .resume_model(self.0.request, self.0.options)
3994 .await
3995 .map(gax::response::Response::into_body)
3996 }
3997
3998 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4002 self.0.request.name = v.into();
4003 self
4004 }
4005 }
4006
4007 #[doc(hidden)]
4008 impl gax::options::internal::RequestBuilder for ResumeModel {
4009 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4010 &mut self.0.options
4011 }
4012 }
4013
4014 #[derive(Clone, Debug)]
4032 pub struct DeleteModel(RequestBuilder<crate::model::DeleteModelRequest>);
4033
4034 impl DeleteModel {
4035 pub(crate) fn new(
4036 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4037 ) -> Self {
4038 Self(RequestBuilder::new(stub))
4039 }
4040
4041 pub fn with_request<V: Into<crate::model::DeleteModelRequest>>(mut self, v: V) -> Self {
4043 self.0.request = v.into();
4044 self
4045 }
4046
4047 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4049 self.0.options = v.into();
4050 self
4051 }
4052
4053 pub async fn send(self) -> Result<()> {
4055 (*self.0.stub)
4056 .delete_model(self.0.request, self.0.options)
4057 .await
4058 .map(gax::response::Response::into_body)
4059 }
4060
4061 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4065 self.0.request.name = v.into();
4066 self
4067 }
4068 }
4069
4070 #[doc(hidden)]
4071 impl gax::options::internal::RequestBuilder for DeleteModel {
4072 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4073 &mut self.0.options
4074 }
4075 }
4076
4077 #[derive(Clone, Debug)]
4099 pub struct ListModels(RequestBuilder<crate::model::ListModelsRequest>);
4100
4101 impl ListModels {
4102 pub(crate) fn new(
4103 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4104 ) -> Self {
4105 Self(RequestBuilder::new(stub))
4106 }
4107
4108 pub fn with_request<V: Into<crate::model::ListModelsRequest>>(mut self, v: V) -> Self {
4110 self.0.request = v.into();
4111 self
4112 }
4113
4114 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4116 self.0.options = v.into();
4117 self
4118 }
4119
4120 pub async fn send(self) -> Result<crate::model::ListModelsResponse> {
4122 (*self.0.stub)
4123 .list_models(self.0.request, self.0.options)
4124 .await
4125 .map(gax::response::Response::into_body)
4126 }
4127
4128 pub fn by_page(
4130 self,
4131 ) -> impl gax::paginator::Paginator<crate::model::ListModelsResponse, gax::error::Error>
4132 {
4133 use std::clone::Clone;
4134 let token = self.0.request.page_token.clone();
4135 let execute = move |token: String| {
4136 let mut builder = self.clone();
4137 builder.0.request = builder.0.request.set_page_token(token);
4138 builder.send()
4139 };
4140 gax::paginator::internal::new_paginator(token, execute)
4141 }
4142
4143 pub fn by_item(
4145 self,
4146 ) -> impl gax::paginator::ItemPaginator<crate::model::ListModelsResponse, gax::error::Error>
4147 {
4148 use gax::paginator::Paginator;
4149 self.by_page().items()
4150 }
4151
4152 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4156 self.0.request.parent = v.into();
4157 self
4158 }
4159
4160 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4162 self.0.request.page_size = v.into();
4163 self
4164 }
4165
4166 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4168 self.0.request.page_token = v.into();
4169 self
4170 }
4171 }
4172
4173 #[doc(hidden)]
4174 impl gax::options::internal::RequestBuilder for ListModels {
4175 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4176 &mut self.0.options
4177 }
4178 }
4179
4180 #[derive(Clone, Debug)]
4198 pub struct UpdateModel(RequestBuilder<crate::model::UpdateModelRequest>);
4199
4200 impl UpdateModel {
4201 pub(crate) fn new(
4202 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4203 ) -> Self {
4204 Self(RequestBuilder::new(stub))
4205 }
4206
4207 pub fn with_request<V: Into<crate::model::UpdateModelRequest>>(mut self, v: V) -> Self {
4209 self.0.request = v.into();
4210 self
4211 }
4212
4213 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4215 self.0.options = v.into();
4216 self
4217 }
4218
4219 pub async fn send(self) -> Result<crate::model::Model> {
4221 (*self.0.stub)
4222 .update_model(self.0.request, self.0.options)
4223 .await
4224 .map(gax::response::Response::into_body)
4225 }
4226
4227 pub fn set_model<T>(mut self, v: T) -> Self
4231 where
4232 T: std::convert::Into<crate::model::Model>,
4233 {
4234 self.0.request.model = std::option::Option::Some(v.into());
4235 self
4236 }
4237
4238 pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
4242 where
4243 T: std::convert::Into<crate::model::Model>,
4244 {
4245 self.0.request.model = v.map(|x| x.into());
4246 self
4247 }
4248
4249 pub fn set_update_mask<T>(mut self, v: T) -> Self
4251 where
4252 T: std::convert::Into<wkt::FieldMask>,
4253 {
4254 self.0.request.update_mask = std::option::Option::Some(v.into());
4255 self
4256 }
4257
4258 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4260 where
4261 T: std::convert::Into<wkt::FieldMask>,
4262 {
4263 self.0.request.update_mask = v.map(|x| x.into());
4264 self
4265 }
4266 }
4267
4268 #[doc(hidden)]
4269 impl gax::options::internal::RequestBuilder for UpdateModel {
4270 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4271 &mut self.0.options
4272 }
4273 }
4274
4275 #[derive(Clone, Debug)]
4294 pub struct TuneModel(RequestBuilder<crate::model::TuneModelRequest>);
4295
4296 impl TuneModel {
4297 pub(crate) fn new(
4298 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4299 ) -> Self {
4300 Self(RequestBuilder::new(stub))
4301 }
4302
4303 pub fn with_request<V: Into<crate::model::TuneModelRequest>>(mut self, v: V) -> Self {
4305 self.0.request = v.into();
4306 self
4307 }
4308
4309 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4311 self.0.options = v.into();
4312 self
4313 }
4314
4315 pub async fn send(self) -> Result<longrunning::model::Operation> {
4322 (*self.0.stub)
4323 .tune_model(self.0.request, self.0.options)
4324 .await
4325 .map(gax::response::Response::into_body)
4326 }
4327
4328 pub fn poller(
4330 self,
4331 ) -> impl lro::Poller<crate::model::TuneModelResponse, crate::model::TuneModelMetadata>
4332 {
4333 type Operation = lro::internal::Operation<
4334 crate::model::TuneModelResponse,
4335 crate::model::TuneModelMetadata,
4336 >;
4337 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4338 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4339
4340 let stub = self.0.stub.clone();
4341 let mut options = self.0.options.clone();
4342 options.set_retry_policy(gax::retry_policy::NeverRetry);
4343 let query = move |name| {
4344 let stub = stub.clone();
4345 let options = options.clone();
4346 async {
4347 let op = GetOperation::new(stub)
4348 .set_name(name)
4349 .with_options(options)
4350 .send()
4351 .await?;
4352 Ok(Operation::new(op))
4353 }
4354 };
4355
4356 let start = move || async {
4357 let op = self.send().await?;
4358 Ok(Operation::new(op))
4359 };
4360
4361 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4362 }
4363
4364 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4368 self.0.request.name = v.into();
4369 self
4370 }
4371 }
4372
4373 #[doc(hidden)]
4374 impl gax::options::internal::RequestBuilder for TuneModel {
4375 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4376 &mut self.0.options
4377 }
4378 }
4379
4380 #[derive(Clone, Debug)]
4402 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4403
4404 impl ListOperations {
4405 pub(crate) fn new(
4406 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4407 ) -> Self {
4408 Self(RequestBuilder::new(stub))
4409 }
4410
4411 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4413 mut self,
4414 v: V,
4415 ) -> Self {
4416 self.0.request = v.into();
4417 self
4418 }
4419
4420 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4422 self.0.options = v.into();
4423 self
4424 }
4425
4426 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4428 (*self.0.stub)
4429 .list_operations(self.0.request, self.0.options)
4430 .await
4431 .map(gax::response::Response::into_body)
4432 }
4433
4434 pub fn by_page(
4436 self,
4437 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4438 {
4439 use std::clone::Clone;
4440 let token = self.0.request.page_token.clone();
4441 let execute = move |token: String| {
4442 let mut builder = self.clone();
4443 builder.0.request = builder.0.request.set_page_token(token);
4444 builder.send()
4445 };
4446 gax::paginator::internal::new_paginator(token, execute)
4447 }
4448
4449 pub fn by_item(
4451 self,
4452 ) -> impl gax::paginator::ItemPaginator<
4453 longrunning::model::ListOperationsResponse,
4454 gax::error::Error,
4455 > {
4456 use gax::paginator::Paginator;
4457 self.by_page().items()
4458 }
4459
4460 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4462 self.0.request.name = v.into();
4463 self
4464 }
4465
4466 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4468 self.0.request.filter = v.into();
4469 self
4470 }
4471
4472 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4474 self.0.request.page_size = v.into();
4475 self
4476 }
4477
4478 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4480 self.0.request.page_token = v.into();
4481 self
4482 }
4483
4484 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4486 self.0.request.return_partial_success = v.into();
4487 self
4488 }
4489 }
4490
4491 #[doc(hidden)]
4492 impl gax::options::internal::RequestBuilder for ListOperations {
4493 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4494 &mut self.0.options
4495 }
4496 }
4497
4498 #[derive(Clone, Debug)]
4516 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4517
4518 impl GetOperation {
4519 pub(crate) fn new(
4520 stub: std::sync::Arc<dyn super::super::stub::dynamic::ModelService>,
4521 ) -> Self {
4522 Self(RequestBuilder::new(stub))
4523 }
4524
4525 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4527 mut self,
4528 v: V,
4529 ) -> Self {
4530 self.0.request = v.into();
4531 self
4532 }
4533
4534 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4536 self.0.options = v.into();
4537 self
4538 }
4539
4540 pub async fn send(self) -> Result<longrunning::model::Operation> {
4542 (*self.0.stub)
4543 .get_operation(self.0.request, self.0.options)
4544 .await
4545 .map(gax::response::Response::into_body)
4546 }
4547
4548 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4550 self.0.request.name = v.into();
4551 self
4552 }
4553 }
4554
4555 #[doc(hidden)]
4556 impl gax::options::internal::RequestBuilder for GetOperation {
4557 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4558 &mut self.0.options
4559 }
4560 }
4561}
4562
4563pub mod prediction_service {
4564 use crate::Result;
4565
4566 pub type ClientBuilder =
4580 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4581
4582 pub(crate) mod client {
4583 use super::super::super::client::PredictionService;
4584 pub struct Factory;
4585 impl gax::client_builder::internal::ClientFactory for Factory {
4586 type Client = PredictionService;
4587 type Credentials = gaxi::options::Credentials;
4588 async fn build(
4589 self,
4590 config: gaxi::options::ClientConfig,
4591 ) -> gax::client_builder::Result<Self::Client> {
4592 Self::Client::new(config).await
4593 }
4594 }
4595 }
4596
4597 #[derive(Clone, Debug)]
4599 pub(crate) struct RequestBuilder<R: std::default::Default> {
4600 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4601 request: R,
4602 options: gax::options::RequestOptions,
4603 }
4604
4605 impl<R> RequestBuilder<R>
4606 where
4607 R: std::default::Default,
4608 {
4609 pub(crate) fn new(
4610 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4611 ) -> Self {
4612 Self {
4613 stub,
4614 request: R::default(),
4615 options: gax::options::RequestOptions::default(),
4616 }
4617 }
4618 }
4619
4620 #[derive(Clone, Debug)]
4638 pub struct Predict(RequestBuilder<crate::model::PredictRequest>);
4639
4640 impl Predict {
4641 pub(crate) fn new(
4642 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4643 ) -> Self {
4644 Self(RequestBuilder::new(stub))
4645 }
4646
4647 pub fn with_request<V: Into<crate::model::PredictRequest>>(mut self, v: V) -> Self {
4649 self.0.request = v.into();
4650 self
4651 }
4652
4653 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4655 self.0.options = v.into();
4656 self
4657 }
4658
4659 pub async fn send(self) -> Result<crate::model::PredictResponse> {
4661 (*self.0.stub)
4662 .predict(self.0.request, self.0.options)
4663 .await
4664 .map(gax::response::Response::into_body)
4665 }
4666
4667 pub fn set_placement<T: Into<std::string::String>>(mut self, v: T) -> Self {
4671 self.0.request.placement = v.into();
4672 self
4673 }
4674
4675 pub fn set_user_event<T>(mut self, v: T) -> Self
4679 where
4680 T: std::convert::Into<crate::model::UserEvent>,
4681 {
4682 self.0.request.user_event = std::option::Option::Some(v.into());
4683 self
4684 }
4685
4686 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
4690 where
4691 T: std::convert::Into<crate::model::UserEvent>,
4692 {
4693 self.0.request.user_event = v.map(|x| x.into());
4694 self
4695 }
4696
4697 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4699 self.0.request.page_size = v.into();
4700 self
4701 }
4702
4703 #[deprecated]
4705 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4706 self.0.request.page_token = v.into();
4707 self
4708 }
4709
4710 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4712 self.0.request.filter = v.into();
4713 self
4714 }
4715
4716 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
4718 self.0.request.validate_only = v.into();
4719 self
4720 }
4721
4722 pub fn set_params<T, K, V>(mut self, v: T) -> Self
4724 where
4725 T: std::iter::IntoIterator<Item = (K, V)>,
4726 K: std::convert::Into<std::string::String>,
4727 V: std::convert::Into<wkt::Value>,
4728 {
4729 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4730 self
4731 }
4732
4733 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
4735 where
4736 T: std::iter::IntoIterator<Item = (K, V)>,
4737 K: std::convert::Into<std::string::String>,
4738 V: std::convert::Into<std::string::String>,
4739 {
4740 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4741 self
4742 }
4743 }
4744
4745 #[doc(hidden)]
4746 impl gax::options::internal::RequestBuilder for Predict {
4747 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4748 &mut self.0.options
4749 }
4750 }
4751
4752 #[derive(Clone, Debug)]
4774 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4775
4776 impl ListOperations {
4777 pub(crate) fn new(
4778 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4779 ) -> Self {
4780 Self(RequestBuilder::new(stub))
4781 }
4782
4783 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4785 mut self,
4786 v: V,
4787 ) -> Self {
4788 self.0.request = v.into();
4789 self
4790 }
4791
4792 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4794 self.0.options = v.into();
4795 self
4796 }
4797
4798 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4800 (*self.0.stub)
4801 .list_operations(self.0.request, self.0.options)
4802 .await
4803 .map(gax::response::Response::into_body)
4804 }
4805
4806 pub fn by_page(
4808 self,
4809 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4810 {
4811 use std::clone::Clone;
4812 let token = self.0.request.page_token.clone();
4813 let execute = move |token: String| {
4814 let mut builder = self.clone();
4815 builder.0.request = builder.0.request.set_page_token(token);
4816 builder.send()
4817 };
4818 gax::paginator::internal::new_paginator(token, execute)
4819 }
4820
4821 pub fn by_item(
4823 self,
4824 ) -> impl gax::paginator::ItemPaginator<
4825 longrunning::model::ListOperationsResponse,
4826 gax::error::Error,
4827 > {
4828 use gax::paginator::Paginator;
4829 self.by_page().items()
4830 }
4831
4832 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4834 self.0.request.name = v.into();
4835 self
4836 }
4837
4838 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4840 self.0.request.filter = v.into();
4841 self
4842 }
4843
4844 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4846 self.0.request.page_size = v.into();
4847 self
4848 }
4849
4850 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4852 self.0.request.page_token = v.into();
4853 self
4854 }
4855
4856 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4858 self.0.request.return_partial_success = v.into();
4859 self
4860 }
4861 }
4862
4863 #[doc(hidden)]
4864 impl gax::options::internal::RequestBuilder for ListOperations {
4865 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4866 &mut self.0.options
4867 }
4868 }
4869
4870 #[derive(Clone, Debug)]
4888 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4889
4890 impl GetOperation {
4891 pub(crate) fn new(
4892 stub: std::sync::Arc<dyn super::super::stub::dynamic::PredictionService>,
4893 ) -> Self {
4894 Self(RequestBuilder::new(stub))
4895 }
4896
4897 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4899 mut self,
4900 v: V,
4901 ) -> Self {
4902 self.0.request = v.into();
4903 self
4904 }
4905
4906 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4908 self.0.options = v.into();
4909 self
4910 }
4911
4912 pub async fn send(self) -> Result<longrunning::model::Operation> {
4914 (*self.0.stub)
4915 .get_operation(self.0.request, self.0.options)
4916 .await
4917 .map(gax::response::Response::into_body)
4918 }
4919
4920 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4922 self.0.request.name = v.into();
4923 self
4924 }
4925 }
4926
4927 #[doc(hidden)]
4928 impl gax::options::internal::RequestBuilder for GetOperation {
4929 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4930 &mut self.0.options
4931 }
4932 }
4933}
4934
4935pub mod product_service {
4936 use crate::Result;
4937
4938 pub type ClientBuilder =
4952 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4953
4954 pub(crate) mod client {
4955 use super::super::super::client::ProductService;
4956 pub struct Factory;
4957 impl gax::client_builder::internal::ClientFactory for Factory {
4958 type Client = ProductService;
4959 type Credentials = gaxi::options::Credentials;
4960 async fn build(
4961 self,
4962 config: gaxi::options::ClientConfig,
4963 ) -> gax::client_builder::Result<Self::Client> {
4964 Self::Client::new(config).await
4965 }
4966 }
4967 }
4968
4969 #[derive(Clone, Debug)]
4971 pub(crate) struct RequestBuilder<R: std::default::Default> {
4972 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
4973 request: R,
4974 options: gax::options::RequestOptions,
4975 }
4976
4977 impl<R> RequestBuilder<R>
4978 where
4979 R: std::default::Default,
4980 {
4981 pub(crate) fn new(
4982 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
4983 ) -> Self {
4984 Self {
4985 stub,
4986 request: R::default(),
4987 options: gax::options::RequestOptions::default(),
4988 }
4989 }
4990 }
4991
4992 #[derive(Clone, Debug)]
5010 pub struct CreateProduct(RequestBuilder<crate::model::CreateProductRequest>);
5011
5012 impl CreateProduct {
5013 pub(crate) fn new(
5014 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5015 ) -> Self {
5016 Self(RequestBuilder::new(stub))
5017 }
5018
5019 pub fn with_request<V: Into<crate::model::CreateProductRequest>>(mut self, v: V) -> Self {
5021 self.0.request = v.into();
5022 self
5023 }
5024
5025 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5027 self.0.options = v.into();
5028 self
5029 }
5030
5031 pub async fn send(self) -> Result<crate::model::Product> {
5033 (*self.0.stub)
5034 .create_product(self.0.request, self.0.options)
5035 .await
5036 .map(gax::response::Response::into_body)
5037 }
5038
5039 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5043 self.0.request.parent = v.into();
5044 self
5045 }
5046
5047 pub fn set_product<T>(mut self, v: T) -> Self
5051 where
5052 T: std::convert::Into<crate::model::Product>,
5053 {
5054 self.0.request.product = std::option::Option::Some(v.into());
5055 self
5056 }
5057
5058 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
5062 where
5063 T: std::convert::Into<crate::model::Product>,
5064 {
5065 self.0.request.product = v.map(|x| x.into());
5066 self
5067 }
5068
5069 pub fn set_product_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5073 self.0.request.product_id = v.into();
5074 self
5075 }
5076 }
5077
5078 #[doc(hidden)]
5079 impl gax::options::internal::RequestBuilder for CreateProduct {
5080 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5081 &mut self.0.options
5082 }
5083 }
5084
5085 #[derive(Clone, Debug)]
5103 pub struct GetProduct(RequestBuilder<crate::model::GetProductRequest>);
5104
5105 impl GetProduct {
5106 pub(crate) fn new(
5107 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5108 ) -> Self {
5109 Self(RequestBuilder::new(stub))
5110 }
5111
5112 pub fn with_request<V: Into<crate::model::GetProductRequest>>(mut self, v: V) -> Self {
5114 self.0.request = v.into();
5115 self
5116 }
5117
5118 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5120 self.0.options = v.into();
5121 self
5122 }
5123
5124 pub async fn send(self) -> Result<crate::model::Product> {
5126 (*self.0.stub)
5127 .get_product(self.0.request, self.0.options)
5128 .await
5129 .map(gax::response::Response::into_body)
5130 }
5131
5132 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5136 self.0.request.name = v.into();
5137 self
5138 }
5139 }
5140
5141 #[doc(hidden)]
5142 impl gax::options::internal::RequestBuilder for GetProduct {
5143 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5144 &mut self.0.options
5145 }
5146 }
5147
5148 #[derive(Clone, Debug)]
5170 pub struct ListProducts(RequestBuilder<crate::model::ListProductsRequest>);
5171
5172 impl ListProducts {
5173 pub(crate) fn new(
5174 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5175 ) -> Self {
5176 Self(RequestBuilder::new(stub))
5177 }
5178
5179 pub fn with_request<V: Into<crate::model::ListProductsRequest>>(mut self, v: V) -> Self {
5181 self.0.request = v.into();
5182 self
5183 }
5184
5185 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5187 self.0.options = v.into();
5188 self
5189 }
5190
5191 pub async fn send(self) -> Result<crate::model::ListProductsResponse> {
5193 (*self.0.stub)
5194 .list_products(self.0.request, self.0.options)
5195 .await
5196 .map(gax::response::Response::into_body)
5197 }
5198
5199 pub fn by_page(
5201 self,
5202 ) -> impl gax::paginator::Paginator<crate::model::ListProductsResponse, gax::error::Error>
5203 {
5204 use std::clone::Clone;
5205 let token = self.0.request.page_token.clone();
5206 let execute = move |token: String| {
5207 let mut builder = self.clone();
5208 builder.0.request = builder.0.request.set_page_token(token);
5209 builder.send()
5210 };
5211 gax::paginator::internal::new_paginator(token, execute)
5212 }
5213
5214 pub fn by_item(
5216 self,
5217 ) -> impl gax::paginator::ItemPaginator<crate::model::ListProductsResponse, gax::error::Error>
5218 {
5219 use gax::paginator::Paginator;
5220 self.by_page().items()
5221 }
5222
5223 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5227 self.0.request.parent = v.into();
5228 self
5229 }
5230
5231 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5233 self.0.request.page_size = v.into();
5234 self
5235 }
5236
5237 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5239 self.0.request.page_token = v.into();
5240 self
5241 }
5242
5243 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5245 self.0.request.filter = v.into();
5246 self
5247 }
5248
5249 pub fn set_read_mask<T>(mut self, v: T) -> Self
5251 where
5252 T: std::convert::Into<wkt::FieldMask>,
5253 {
5254 self.0.request.read_mask = std::option::Option::Some(v.into());
5255 self
5256 }
5257
5258 pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
5260 where
5261 T: std::convert::Into<wkt::FieldMask>,
5262 {
5263 self.0.request.read_mask = v.map(|x| x.into());
5264 self
5265 }
5266 }
5267
5268 #[doc(hidden)]
5269 impl gax::options::internal::RequestBuilder for ListProducts {
5270 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5271 &mut self.0.options
5272 }
5273 }
5274
5275 #[derive(Clone, Debug)]
5293 pub struct UpdateProduct(RequestBuilder<crate::model::UpdateProductRequest>);
5294
5295 impl UpdateProduct {
5296 pub(crate) fn new(
5297 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5298 ) -> Self {
5299 Self(RequestBuilder::new(stub))
5300 }
5301
5302 pub fn with_request<V: Into<crate::model::UpdateProductRequest>>(mut self, v: V) -> Self {
5304 self.0.request = v.into();
5305 self
5306 }
5307
5308 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5310 self.0.options = v.into();
5311 self
5312 }
5313
5314 pub async fn send(self) -> Result<crate::model::Product> {
5316 (*self.0.stub)
5317 .update_product(self.0.request, self.0.options)
5318 .await
5319 .map(gax::response::Response::into_body)
5320 }
5321
5322 pub fn set_product<T>(mut self, v: T) -> Self
5326 where
5327 T: std::convert::Into<crate::model::Product>,
5328 {
5329 self.0.request.product = std::option::Option::Some(v.into());
5330 self
5331 }
5332
5333 pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
5337 where
5338 T: std::convert::Into<crate::model::Product>,
5339 {
5340 self.0.request.product = v.map(|x| x.into());
5341 self
5342 }
5343
5344 pub fn set_update_mask<T>(mut self, v: T) -> Self
5346 where
5347 T: std::convert::Into<wkt::FieldMask>,
5348 {
5349 self.0.request.update_mask = std::option::Option::Some(v.into());
5350 self
5351 }
5352
5353 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5355 where
5356 T: std::convert::Into<wkt::FieldMask>,
5357 {
5358 self.0.request.update_mask = v.map(|x| x.into());
5359 self
5360 }
5361
5362 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5364 self.0.request.allow_missing = v.into();
5365 self
5366 }
5367 }
5368
5369 #[doc(hidden)]
5370 impl gax::options::internal::RequestBuilder for UpdateProduct {
5371 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5372 &mut self.0.options
5373 }
5374 }
5375
5376 #[derive(Clone, Debug)]
5394 pub struct DeleteProduct(RequestBuilder<crate::model::DeleteProductRequest>);
5395
5396 impl DeleteProduct {
5397 pub(crate) fn new(
5398 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5399 ) -> Self {
5400 Self(RequestBuilder::new(stub))
5401 }
5402
5403 pub fn with_request<V: Into<crate::model::DeleteProductRequest>>(mut self, v: V) -> Self {
5405 self.0.request = v.into();
5406 self
5407 }
5408
5409 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5411 self.0.options = v.into();
5412 self
5413 }
5414
5415 pub async fn send(self) -> Result<()> {
5417 (*self.0.stub)
5418 .delete_product(self.0.request, self.0.options)
5419 .await
5420 .map(gax::response::Response::into_body)
5421 }
5422
5423 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5427 self.0.request.name = v.into();
5428 self
5429 }
5430 }
5431
5432 #[doc(hidden)]
5433 impl gax::options::internal::RequestBuilder for DeleteProduct {
5434 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5435 &mut self.0.options
5436 }
5437 }
5438
5439 #[derive(Clone, Debug)]
5458 pub struct PurgeProducts(RequestBuilder<crate::model::PurgeProductsRequest>);
5459
5460 impl PurgeProducts {
5461 pub(crate) fn new(
5462 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5463 ) -> Self {
5464 Self(RequestBuilder::new(stub))
5465 }
5466
5467 pub fn with_request<V: Into<crate::model::PurgeProductsRequest>>(mut self, v: V) -> Self {
5469 self.0.request = v.into();
5470 self
5471 }
5472
5473 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5475 self.0.options = v.into();
5476 self
5477 }
5478
5479 pub async fn send(self) -> Result<longrunning::model::Operation> {
5486 (*self.0.stub)
5487 .purge_products(self.0.request, self.0.options)
5488 .await
5489 .map(gax::response::Response::into_body)
5490 }
5491
5492 pub fn poller(
5494 self,
5495 ) -> impl lro::Poller<crate::model::PurgeProductsResponse, crate::model::PurgeProductsMetadata>
5496 {
5497 type Operation = lro::internal::Operation<
5498 crate::model::PurgeProductsResponse,
5499 crate::model::PurgeProductsMetadata,
5500 >;
5501 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5502 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5503
5504 let stub = self.0.stub.clone();
5505 let mut options = self.0.options.clone();
5506 options.set_retry_policy(gax::retry_policy::NeverRetry);
5507 let query = move |name| {
5508 let stub = stub.clone();
5509 let options = options.clone();
5510 async {
5511 let op = GetOperation::new(stub)
5512 .set_name(name)
5513 .with_options(options)
5514 .send()
5515 .await?;
5516 Ok(Operation::new(op))
5517 }
5518 };
5519
5520 let start = move || async {
5521 let op = self.send().await?;
5522 Ok(Operation::new(op))
5523 };
5524
5525 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5526 }
5527
5528 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5532 self.0.request.parent = v.into();
5533 self
5534 }
5535
5536 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5540 self.0.request.filter = v.into();
5541 self
5542 }
5543
5544 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
5546 self.0.request.force = v.into();
5547 self
5548 }
5549 }
5550
5551 #[doc(hidden)]
5552 impl gax::options::internal::RequestBuilder for PurgeProducts {
5553 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5554 &mut self.0.options
5555 }
5556 }
5557
5558 #[derive(Clone, Debug)]
5577 pub struct ImportProducts(RequestBuilder<crate::model::ImportProductsRequest>);
5578
5579 impl ImportProducts {
5580 pub(crate) fn new(
5581 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5582 ) -> Self {
5583 Self(RequestBuilder::new(stub))
5584 }
5585
5586 pub fn with_request<V: Into<crate::model::ImportProductsRequest>>(mut self, v: V) -> Self {
5588 self.0.request = v.into();
5589 self
5590 }
5591
5592 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5594 self.0.options = v.into();
5595 self
5596 }
5597
5598 pub async fn send(self) -> Result<longrunning::model::Operation> {
5605 (*self.0.stub)
5606 .import_products(self.0.request, self.0.options)
5607 .await
5608 .map(gax::response::Response::into_body)
5609 }
5610
5611 pub fn poller(
5613 self,
5614 ) -> impl lro::Poller<crate::model::ImportProductsResponse, crate::model::ImportMetadata>
5615 {
5616 type Operation = lro::internal::Operation<
5617 crate::model::ImportProductsResponse,
5618 crate::model::ImportMetadata,
5619 >;
5620 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5621 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5622
5623 let stub = self.0.stub.clone();
5624 let mut options = self.0.options.clone();
5625 options.set_retry_policy(gax::retry_policy::NeverRetry);
5626 let query = move |name| {
5627 let stub = stub.clone();
5628 let options = options.clone();
5629 async {
5630 let op = GetOperation::new(stub)
5631 .set_name(name)
5632 .with_options(options)
5633 .send()
5634 .await?;
5635 Ok(Operation::new(op))
5636 }
5637 };
5638
5639 let start = move || async {
5640 let op = self.send().await?;
5641 Ok(Operation::new(op))
5642 };
5643
5644 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5645 }
5646
5647 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5651 self.0.request.parent = v.into();
5652 self
5653 }
5654
5655 #[deprecated]
5657 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5658 self.0.request.request_id = v.into();
5659 self
5660 }
5661
5662 pub fn set_input_config<T>(mut self, v: T) -> Self
5666 where
5667 T: std::convert::Into<crate::model::ProductInputConfig>,
5668 {
5669 self.0.request.input_config = std::option::Option::Some(v.into());
5670 self
5671 }
5672
5673 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
5677 where
5678 T: std::convert::Into<crate::model::ProductInputConfig>,
5679 {
5680 self.0.request.input_config = v.map(|x| x.into());
5681 self
5682 }
5683
5684 pub fn set_errors_config<T>(mut self, v: T) -> Self
5686 where
5687 T: std::convert::Into<crate::model::ImportErrorsConfig>,
5688 {
5689 self.0.request.errors_config = std::option::Option::Some(v.into());
5690 self
5691 }
5692
5693 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
5695 where
5696 T: std::convert::Into<crate::model::ImportErrorsConfig>,
5697 {
5698 self.0.request.errors_config = v.map(|x| x.into());
5699 self
5700 }
5701
5702 pub fn set_update_mask<T>(mut self, v: T) -> Self
5704 where
5705 T: std::convert::Into<wkt::FieldMask>,
5706 {
5707 self.0.request.update_mask = std::option::Option::Some(v.into());
5708 self
5709 }
5710
5711 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5713 where
5714 T: std::convert::Into<wkt::FieldMask>,
5715 {
5716 self.0.request.update_mask = v.map(|x| x.into());
5717 self
5718 }
5719
5720 pub fn set_reconciliation_mode<
5722 T: Into<crate::model::import_products_request::ReconciliationMode>,
5723 >(
5724 mut self,
5725 v: T,
5726 ) -> Self {
5727 self.0.request.reconciliation_mode = v.into();
5728 self
5729 }
5730
5731 pub fn set_notification_pubsub_topic<T: Into<std::string::String>>(mut self, v: T) -> Self {
5733 self.0.request.notification_pubsub_topic = v.into();
5734 self
5735 }
5736 }
5737
5738 #[doc(hidden)]
5739 impl gax::options::internal::RequestBuilder for ImportProducts {
5740 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5741 &mut self.0.options
5742 }
5743 }
5744
5745 #[derive(Clone, Debug)]
5764 pub struct SetInventory(RequestBuilder<crate::model::SetInventoryRequest>);
5765
5766 impl SetInventory {
5767 pub(crate) fn new(
5768 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5769 ) -> Self {
5770 Self(RequestBuilder::new(stub))
5771 }
5772
5773 pub fn with_request<V: Into<crate::model::SetInventoryRequest>>(mut self, v: V) -> Self {
5775 self.0.request = v.into();
5776 self
5777 }
5778
5779 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5781 self.0.options = v.into();
5782 self
5783 }
5784
5785 pub async fn send(self) -> Result<longrunning::model::Operation> {
5792 (*self.0.stub)
5793 .set_inventory(self.0.request, self.0.options)
5794 .await
5795 .map(gax::response::Response::into_body)
5796 }
5797
5798 pub fn poller(
5800 self,
5801 ) -> impl lro::Poller<crate::model::SetInventoryResponse, crate::model::SetInventoryMetadata>
5802 {
5803 type Operation = lro::internal::Operation<
5804 crate::model::SetInventoryResponse,
5805 crate::model::SetInventoryMetadata,
5806 >;
5807 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5808 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5809
5810 let stub = self.0.stub.clone();
5811 let mut options = self.0.options.clone();
5812 options.set_retry_policy(gax::retry_policy::NeverRetry);
5813 let query = move |name| {
5814 let stub = stub.clone();
5815 let options = options.clone();
5816 async {
5817 let op = GetOperation::new(stub)
5818 .set_name(name)
5819 .with_options(options)
5820 .send()
5821 .await?;
5822 Ok(Operation::new(op))
5823 }
5824 };
5825
5826 let start = move || async {
5827 let op = self.send().await?;
5828 Ok(Operation::new(op))
5829 };
5830
5831 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5832 }
5833
5834 pub fn set_inventory<T>(mut self, v: T) -> Self
5838 where
5839 T: std::convert::Into<crate::model::Product>,
5840 {
5841 self.0.request.inventory = std::option::Option::Some(v.into());
5842 self
5843 }
5844
5845 pub fn set_or_clear_inventory<T>(mut self, v: std::option::Option<T>) -> Self
5849 where
5850 T: std::convert::Into<crate::model::Product>,
5851 {
5852 self.0.request.inventory = v.map(|x| x.into());
5853 self
5854 }
5855
5856 pub fn set_set_mask<T>(mut self, v: T) -> Self
5858 where
5859 T: std::convert::Into<wkt::FieldMask>,
5860 {
5861 self.0.request.set_mask = std::option::Option::Some(v.into());
5862 self
5863 }
5864
5865 pub fn set_or_clear_set_mask<T>(mut self, v: std::option::Option<T>) -> Self
5867 where
5868 T: std::convert::Into<wkt::FieldMask>,
5869 {
5870 self.0.request.set_mask = v.map(|x| x.into());
5871 self
5872 }
5873
5874 pub fn set_set_time<T>(mut self, v: T) -> Self
5876 where
5877 T: std::convert::Into<wkt::Timestamp>,
5878 {
5879 self.0.request.set_time = std::option::Option::Some(v.into());
5880 self
5881 }
5882
5883 pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
5885 where
5886 T: std::convert::Into<wkt::Timestamp>,
5887 {
5888 self.0.request.set_time = v.map(|x| x.into());
5889 self
5890 }
5891
5892 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5894 self.0.request.allow_missing = v.into();
5895 self
5896 }
5897 }
5898
5899 #[doc(hidden)]
5900 impl gax::options::internal::RequestBuilder for SetInventory {
5901 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5902 &mut self.0.options
5903 }
5904 }
5905
5906 #[derive(Clone, Debug)]
5925 pub struct AddFulfillmentPlaces(RequestBuilder<crate::model::AddFulfillmentPlacesRequest>);
5926
5927 impl AddFulfillmentPlaces {
5928 pub(crate) fn new(
5929 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
5930 ) -> Self {
5931 Self(RequestBuilder::new(stub))
5932 }
5933
5934 pub fn with_request<V: Into<crate::model::AddFulfillmentPlacesRequest>>(
5936 mut self,
5937 v: V,
5938 ) -> Self {
5939 self.0.request = v.into();
5940 self
5941 }
5942
5943 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5945 self.0.options = v.into();
5946 self
5947 }
5948
5949 pub async fn send(self) -> Result<longrunning::model::Operation> {
5956 (*self.0.stub)
5957 .add_fulfillment_places(self.0.request, self.0.options)
5958 .await
5959 .map(gax::response::Response::into_body)
5960 }
5961
5962 pub fn poller(
5964 self,
5965 ) -> impl lro::Poller<
5966 crate::model::AddFulfillmentPlacesResponse,
5967 crate::model::AddFulfillmentPlacesMetadata,
5968 > {
5969 type Operation = lro::internal::Operation<
5970 crate::model::AddFulfillmentPlacesResponse,
5971 crate::model::AddFulfillmentPlacesMetadata,
5972 >;
5973 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5974 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5975
5976 let stub = self.0.stub.clone();
5977 let mut options = self.0.options.clone();
5978 options.set_retry_policy(gax::retry_policy::NeverRetry);
5979 let query = move |name| {
5980 let stub = stub.clone();
5981 let options = options.clone();
5982 async {
5983 let op = GetOperation::new(stub)
5984 .set_name(name)
5985 .with_options(options)
5986 .send()
5987 .await?;
5988 Ok(Operation::new(op))
5989 }
5990 };
5991
5992 let start = move || async {
5993 let op = self.send().await?;
5994 Ok(Operation::new(op))
5995 };
5996
5997 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5998 }
5999
6000 pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6004 self.0.request.product = v.into();
6005 self
6006 }
6007
6008 pub fn set_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
6012 self.0.request.r#type = v.into();
6013 self
6014 }
6015
6016 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
6020 where
6021 T: std::iter::IntoIterator<Item = V>,
6022 V: std::convert::Into<std::string::String>,
6023 {
6024 use std::iter::Iterator;
6025 self.0.request.place_ids = v.into_iter().map(|i| i.into()).collect();
6026 self
6027 }
6028
6029 pub fn set_add_time<T>(mut self, v: T) -> Self
6031 where
6032 T: std::convert::Into<wkt::Timestamp>,
6033 {
6034 self.0.request.add_time = std::option::Option::Some(v.into());
6035 self
6036 }
6037
6038 pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
6040 where
6041 T: std::convert::Into<wkt::Timestamp>,
6042 {
6043 self.0.request.add_time = v.map(|x| x.into());
6044 self
6045 }
6046
6047 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6049 self.0.request.allow_missing = v.into();
6050 self
6051 }
6052 }
6053
6054 #[doc(hidden)]
6055 impl gax::options::internal::RequestBuilder for AddFulfillmentPlaces {
6056 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6057 &mut self.0.options
6058 }
6059 }
6060
6061 #[derive(Clone, Debug)]
6080 pub struct RemoveFulfillmentPlaces(
6081 RequestBuilder<crate::model::RemoveFulfillmentPlacesRequest>,
6082 );
6083
6084 impl RemoveFulfillmentPlaces {
6085 pub(crate) fn new(
6086 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6087 ) -> Self {
6088 Self(RequestBuilder::new(stub))
6089 }
6090
6091 pub fn with_request<V: Into<crate::model::RemoveFulfillmentPlacesRequest>>(
6093 mut self,
6094 v: V,
6095 ) -> Self {
6096 self.0.request = v.into();
6097 self
6098 }
6099
6100 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6102 self.0.options = v.into();
6103 self
6104 }
6105
6106 pub async fn send(self) -> Result<longrunning::model::Operation> {
6113 (*self.0.stub)
6114 .remove_fulfillment_places(self.0.request, self.0.options)
6115 .await
6116 .map(gax::response::Response::into_body)
6117 }
6118
6119 pub fn poller(
6121 self,
6122 ) -> impl lro::Poller<
6123 crate::model::RemoveFulfillmentPlacesResponse,
6124 crate::model::RemoveFulfillmentPlacesMetadata,
6125 > {
6126 type Operation = lro::internal::Operation<
6127 crate::model::RemoveFulfillmentPlacesResponse,
6128 crate::model::RemoveFulfillmentPlacesMetadata,
6129 >;
6130 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6131 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6132
6133 let stub = self.0.stub.clone();
6134 let mut options = self.0.options.clone();
6135 options.set_retry_policy(gax::retry_policy::NeverRetry);
6136 let query = move |name| {
6137 let stub = stub.clone();
6138 let options = options.clone();
6139 async {
6140 let op = GetOperation::new(stub)
6141 .set_name(name)
6142 .with_options(options)
6143 .send()
6144 .await?;
6145 Ok(Operation::new(op))
6146 }
6147 };
6148
6149 let start = move || async {
6150 let op = self.send().await?;
6151 Ok(Operation::new(op))
6152 };
6153
6154 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6155 }
6156
6157 pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6161 self.0.request.product = v.into();
6162 self
6163 }
6164
6165 pub fn set_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
6169 self.0.request.r#type = v.into();
6170 self
6171 }
6172
6173 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
6177 where
6178 T: std::iter::IntoIterator<Item = V>,
6179 V: std::convert::Into<std::string::String>,
6180 {
6181 use std::iter::Iterator;
6182 self.0.request.place_ids = v.into_iter().map(|i| i.into()).collect();
6183 self
6184 }
6185
6186 pub fn set_remove_time<T>(mut self, v: T) -> Self
6188 where
6189 T: std::convert::Into<wkt::Timestamp>,
6190 {
6191 self.0.request.remove_time = std::option::Option::Some(v.into());
6192 self
6193 }
6194
6195 pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
6197 where
6198 T: std::convert::Into<wkt::Timestamp>,
6199 {
6200 self.0.request.remove_time = v.map(|x| x.into());
6201 self
6202 }
6203
6204 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6206 self.0.request.allow_missing = v.into();
6207 self
6208 }
6209 }
6210
6211 #[doc(hidden)]
6212 impl gax::options::internal::RequestBuilder for RemoveFulfillmentPlaces {
6213 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6214 &mut self.0.options
6215 }
6216 }
6217
6218 #[derive(Clone, Debug)]
6237 pub struct AddLocalInventories(RequestBuilder<crate::model::AddLocalInventoriesRequest>);
6238
6239 impl AddLocalInventories {
6240 pub(crate) fn new(
6241 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6242 ) -> Self {
6243 Self(RequestBuilder::new(stub))
6244 }
6245
6246 pub fn with_request<V: Into<crate::model::AddLocalInventoriesRequest>>(
6248 mut self,
6249 v: V,
6250 ) -> Self {
6251 self.0.request = v.into();
6252 self
6253 }
6254
6255 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6257 self.0.options = v.into();
6258 self
6259 }
6260
6261 pub async fn send(self) -> Result<longrunning::model::Operation> {
6268 (*self.0.stub)
6269 .add_local_inventories(self.0.request, self.0.options)
6270 .await
6271 .map(gax::response::Response::into_body)
6272 }
6273
6274 pub fn poller(
6276 self,
6277 ) -> impl lro::Poller<
6278 crate::model::AddLocalInventoriesResponse,
6279 crate::model::AddLocalInventoriesMetadata,
6280 > {
6281 type Operation = lro::internal::Operation<
6282 crate::model::AddLocalInventoriesResponse,
6283 crate::model::AddLocalInventoriesMetadata,
6284 >;
6285 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6286 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6287
6288 let stub = self.0.stub.clone();
6289 let mut options = self.0.options.clone();
6290 options.set_retry_policy(gax::retry_policy::NeverRetry);
6291 let query = move |name| {
6292 let stub = stub.clone();
6293 let options = options.clone();
6294 async {
6295 let op = GetOperation::new(stub)
6296 .set_name(name)
6297 .with_options(options)
6298 .send()
6299 .await?;
6300 Ok(Operation::new(op))
6301 }
6302 };
6303
6304 let start = move || async {
6305 let op = self.send().await?;
6306 Ok(Operation::new(op))
6307 };
6308
6309 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6310 }
6311
6312 pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6316 self.0.request.product = v.into();
6317 self
6318 }
6319
6320 pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
6324 where
6325 T: std::iter::IntoIterator<Item = V>,
6326 V: std::convert::Into<crate::model::LocalInventory>,
6327 {
6328 use std::iter::Iterator;
6329 self.0.request.local_inventories = v.into_iter().map(|i| i.into()).collect();
6330 self
6331 }
6332
6333 pub fn set_add_mask<T>(mut self, v: T) -> Self
6335 where
6336 T: std::convert::Into<wkt::FieldMask>,
6337 {
6338 self.0.request.add_mask = std::option::Option::Some(v.into());
6339 self
6340 }
6341
6342 pub fn set_or_clear_add_mask<T>(mut self, v: std::option::Option<T>) -> Self
6344 where
6345 T: std::convert::Into<wkt::FieldMask>,
6346 {
6347 self.0.request.add_mask = v.map(|x| x.into());
6348 self
6349 }
6350
6351 pub fn set_add_time<T>(mut self, v: T) -> Self
6353 where
6354 T: std::convert::Into<wkt::Timestamp>,
6355 {
6356 self.0.request.add_time = std::option::Option::Some(v.into());
6357 self
6358 }
6359
6360 pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
6362 where
6363 T: std::convert::Into<wkt::Timestamp>,
6364 {
6365 self.0.request.add_time = v.map(|x| x.into());
6366 self
6367 }
6368
6369 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6371 self.0.request.allow_missing = v.into();
6372 self
6373 }
6374 }
6375
6376 #[doc(hidden)]
6377 impl gax::options::internal::RequestBuilder for AddLocalInventories {
6378 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6379 &mut self.0.options
6380 }
6381 }
6382
6383 #[derive(Clone, Debug)]
6402 pub struct RemoveLocalInventories(RequestBuilder<crate::model::RemoveLocalInventoriesRequest>);
6403
6404 impl RemoveLocalInventories {
6405 pub(crate) fn new(
6406 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6407 ) -> Self {
6408 Self(RequestBuilder::new(stub))
6409 }
6410
6411 pub fn with_request<V: Into<crate::model::RemoveLocalInventoriesRequest>>(
6413 mut self,
6414 v: V,
6415 ) -> Self {
6416 self.0.request = v.into();
6417 self
6418 }
6419
6420 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6422 self.0.options = v.into();
6423 self
6424 }
6425
6426 pub async fn send(self) -> Result<longrunning::model::Operation> {
6433 (*self.0.stub)
6434 .remove_local_inventories(self.0.request, self.0.options)
6435 .await
6436 .map(gax::response::Response::into_body)
6437 }
6438
6439 pub fn poller(
6441 self,
6442 ) -> impl lro::Poller<
6443 crate::model::RemoveLocalInventoriesResponse,
6444 crate::model::RemoveLocalInventoriesMetadata,
6445 > {
6446 type Operation = lro::internal::Operation<
6447 crate::model::RemoveLocalInventoriesResponse,
6448 crate::model::RemoveLocalInventoriesMetadata,
6449 >;
6450 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6451 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6452
6453 let stub = self.0.stub.clone();
6454 let mut options = self.0.options.clone();
6455 options.set_retry_policy(gax::retry_policy::NeverRetry);
6456 let query = move |name| {
6457 let stub = stub.clone();
6458 let options = options.clone();
6459 async {
6460 let op = GetOperation::new(stub)
6461 .set_name(name)
6462 .with_options(options)
6463 .send()
6464 .await?;
6465 Ok(Operation::new(op))
6466 }
6467 };
6468
6469 let start = move || async {
6470 let op = self.send().await?;
6471 Ok(Operation::new(op))
6472 };
6473
6474 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6475 }
6476
6477 pub fn set_product<T: Into<std::string::String>>(mut self, v: T) -> Self {
6481 self.0.request.product = v.into();
6482 self
6483 }
6484
6485 pub fn set_place_ids<T, V>(mut self, v: T) -> Self
6489 where
6490 T: std::iter::IntoIterator<Item = V>,
6491 V: std::convert::Into<std::string::String>,
6492 {
6493 use std::iter::Iterator;
6494 self.0.request.place_ids = v.into_iter().map(|i| i.into()).collect();
6495 self
6496 }
6497
6498 pub fn set_remove_time<T>(mut self, v: T) -> Self
6500 where
6501 T: std::convert::Into<wkt::Timestamp>,
6502 {
6503 self.0.request.remove_time = std::option::Option::Some(v.into());
6504 self
6505 }
6506
6507 pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
6509 where
6510 T: std::convert::Into<wkt::Timestamp>,
6511 {
6512 self.0.request.remove_time = v.map(|x| x.into());
6513 self
6514 }
6515
6516 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6518 self.0.request.allow_missing = v.into();
6519 self
6520 }
6521 }
6522
6523 #[doc(hidden)]
6524 impl gax::options::internal::RequestBuilder for RemoveLocalInventories {
6525 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6526 &mut self.0.options
6527 }
6528 }
6529
6530 #[derive(Clone, Debug)]
6552 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6553
6554 impl ListOperations {
6555 pub(crate) fn new(
6556 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6557 ) -> Self {
6558 Self(RequestBuilder::new(stub))
6559 }
6560
6561 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6563 mut self,
6564 v: V,
6565 ) -> Self {
6566 self.0.request = v.into();
6567 self
6568 }
6569
6570 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6572 self.0.options = v.into();
6573 self
6574 }
6575
6576 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6578 (*self.0.stub)
6579 .list_operations(self.0.request, self.0.options)
6580 .await
6581 .map(gax::response::Response::into_body)
6582 }
6583
6584 pub fn by_page(
6586 self,
6587 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6588 {
6589 use std::clone::Clone;
6590 let token = self.0.request.page_token.clone();
6591 let execute = move |token: String| {
6592 let mut builder = self.clone();
6593 builder.0.request = builder.0.request.set_page_token(token);
6594 builder.send()
6595 };
6596 gax::paginator::internal::new_paginator(token, execute)
6597 }
6598
6599 pub fn by_item(
6601 self,
6602 ) -> impl gax::paginator::ItemPaginator<
6603 longrunning::model::ListOperationsResponse,
6604 gax::error::Error,
6605 > {
6606 use gax::paginator::Paginator;
6607 self.by_page().items()
6608 }
6609
6610 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6612 self.0.request.name = v.into();
6613 self
6614 }
6615
6616 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6618 self.0.request.filter = v.into();
6619 self
6620 }
6621
6622 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6624 self.0.request.page_size = v.into();
6625 self
6626 }
6627
6628 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6630 self.0.request.page_token = v.into();
6631 self
6632 }
6633
6634 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6636 self.0.request.return_partial_success = v.into();
6637 self
6638 }
6639 }
6640
6641 #[doc(hidden)]
6642 impl gax::options::internal::RequestBuilder for ListOperations {
6643 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6644 &mut self.0.options
6645 }
6646 }
6647
6648 #[derive(Clone, Debug)]
6666 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6667
6668 impl GetOperation {
6669 pub(crate) fn new(
6670 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProductService>,
6671 ) -> Self {
6672 Self(RequestBuilder::new(stub))
6673 }
6674
6675 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6677 mut self,
6678 v: V,
6679 ) -> Self {
6680 self.0.request = v.into();
6681 self
6682 }
6683
6684 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6686 self.0.options = v.into();
6687 self
6688 }
6689
6690 pub async fn send(self) -> Result<longrunning::model::Operation> {
6692 (*self.0.stub)
6693 .get_operation(self.0.request, self.0.options)
6694 .await
6695 .map(gax::response::Response::into_body)
6696 }
6697
6698 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6700 self.0.request.name = v.into();
6701 self
6702 }
6703 }
6704
6705 #[doc(hidden)]
6706 impl gax::options::internal::RequestBuilder for GetOperation {
6707 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6708 &mut self.0.options
6709 }
6710 }
6711}
6712
6713pub mod search_service {
6714 use crate::Result;
6715
6716 pub type ClientBuilder =
6730 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6731
6732 pub(crate) mod client {
6733 use super::super::super::client::SearchService;
6734 pub struct Factory;
6735 impl gax::client_builder::internal::ClientFactory for Factory {
6736 type Client = SearchService;
6737 type Credentials = gaxi::options::Credentials;
6738 async fn build(
6739 self,
6740 config: gaxi::options::ClientConfig,
6741 ) -> gax::client_builder::Result<Self::Client> {
6742 Self::Client::new(config).await
6743 }
6744 }
6745 }
6746
6747 #[derive(Clone, Debug)]
6749 pub(crate) struct RequestBuilder<R: std::default::Default> {
6750 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
6751 request: R,
6752 options: gax::options::RequestOptions,
6753 }
6754
6755 impl<R> RequestBuilder<R>
6756 where
6757 R: std::default::Default,
6758 {
6759 pub(crate) fn new(
6760 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
6761 ) -> Self {
6762 Self {
6763 stub,
6764 request: R::default(),
6765 options: gax::options::RequestOptions::default(),
6766 }
6767 }
6768 }
6769
6770 #[derive(Clone, Debug)]
6792 pub struct Search(RequestBuilder<crate::model::SearchRequest>);
6793
6794 impl Search {
6795 pub(crate) fn new(
6796 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
6797 ) -> Self {
6798 Self(RequestBuilder::new(stub))
6799 }
6800
6801 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
6803 self.0.request = v.into();
6804 self
6805 }
6806
6807 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6809 self.0.options = v.into();
6810 self
6811 }
6812
6813 pub async fn send(self) -> Result<crate::model::SearchResponse> {
6815 (*self.0.stub)
6816 .search(self.0.request, self.0.options)
6817 .await
6818 .map(gax::response::Response::into_body)
6819 }
6820
6821 pub fn by_page(
6823 self,
6824 ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
6825 {
6826 use std::clone::Clone;
6827 let token = self.0.request.page_token.clone();
6828 let execute = move |token: String| {
6829 let mut builder = self.clone();
6830 builder.0.request = builder.0.request.set_page_token(token);
6831 builder.send()
6832 };
6833 gax::paginator::internal::new_paginator(token, execute)
6834 }
6835
6836 pub fn by_item(
6838 self,
6839 ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
6840 {
6841 use gax::paginator::Paginator;
6842 self.by_page().items()
6843 }
6844
6845 pub fn set_placement<T: Into<std::string::String>>(mut self, v: T) -> Self {
6849 self.0.request.placement = v.into();
6850 self
6851 }
6852
6853 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
6855 self.0.request.branch = v.into();
6856 self
6857 }
6858
6859 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
6861 self.0.request.query = v.into();
6862 self
6863 }
6864
6865 pub fn set_visitor_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6869 self.0.request.visitor_id = v.into();
6870 self
6871 }
6872
6873 pub fn set_user_info<T>(mut self, v: T) -> Self
6875 where
6876 T: std::convert::Into<crate::model::UserInfo>,
6877 {
6878 self.0.request.user_info = std::option::Option::Some(v.into());
6879 self
6880 }
6881
6882 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
6884 where
6885 T: std::convert::Into<crate::model::UserInfo>,
6886 {
6887 self.0.request.user_info = v.map(|x| x.into());
6888 self
6889 }
6890
6891 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6893 self.0.request.page_size = v.into();
6894 self
6895 }
6896
6897 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6899 self.0.request.page_token = v.into();
6900 self
6901 }
6902
6903 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
6905 self.0.request.offset = v.into();
6906 self
6907 }
6908
6909 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6911 self.0.request.filter = v.into();
6912 self
6913 }
6914
6915 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6917 self.0.request.canonical_filter = v.into();
6918 self
6919 }
6920
6921 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
6923 self.0.request.order_by = v.into();
6924 self
6925 }
6926
6927 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
6929 where
6930 T: std::iter::IntoIterator<Item = V>,
6931 V: std::convert::Into<crate::model::search_request::FacetSpec>,
6932 {
6933 use std::iter::Iterator;
6934 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
6935 self
6936 }
6937
6938 #[deprecated]
6940 pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
6941 where
6942 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
6943 {
6944 self.0.request.dynamic_facet_spec = std::option::Option::Some(v.into());
6945 self
6946 }
6947
6948 #[deprecated]
6950 pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
6951 where
6952 T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
6953 {
6954 self.0.request.dynamic_facet_spec = v.map(|x| x.into());
6955 self
6956 }
6957
6958 pub fn set_boost_spec<T>(mut self, v: T) -> Self
6960 where
6961 T: std::convert::Into<crate::model::search_request::BoostSpec>,
6962 {
6963 self.0.request.boost_spec = std::option::Option::Some(v.into());
6964 self
6965 }
6966
6967 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
6969 where
6970 T: std::convert::Into<crate::model::search_request::BoostSpec>,
6971 {
6972 self.0.request.boost_spec = v.map(|x| x.into());
6973 self
6974 }
6975
6976 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
6978 where
6979 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
6980 {
6981 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
6982 self
6983 }
6984
6985 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
6987 where
6988 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
6989 {
6990 self.0.request.query_expansion_spec = v.map(|x| x.into());
6991 self
6992 }
6993
6994 pub fn set_variant_rollup_keys<T, V>(mut self, v: T) -> Self
6996 where
6997 T: std::iter::IntoIterator<Item = V>,
6998 V: std::convert::Into<std::string::String>,
6999 {
7000 use std::iter::Iterator;
7001 self.0.request.variant_rollup_keys = v.into_iter().map(|i| i.into()).collect();
7002 self
7003 }
7004
7005 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
7007 where
7008 T: std::iter::IntoIterator<Item = V>,
7009 V: std::convert::Into<std::string::String>,
7010 {
7011 use std::iter::Iterator;
7012 self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
7013 self
7014 }
7015
7016 pub fn set_search_mode<T: Into<crate::model::search_request::SearchMode>>(
7018 mut self,
7019 v: T,
7020 ) -> Self {
7021 self.0.request.search_mode = v.into();
7022 self
7023 }
7024
7025 pub fn set_personalization_spec<T>(mut self, v: T) -> Self
7027 where
7028 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
7029 {
7030 self.0.request.personalization_spec = std::option::Option::Some(v.into());
7031 self
7032 }
7033
7034 pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
7036 where
7037 T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
7038 {
7039 self.0.request.personalization_spec = v.map(|x| x.into());
7040 self
7041 }
7042
7043 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
7045 where
7046 T: std::iter::IntoIterator<Item = (K, V)>,
7047 K: std::convert::Into<std::string::String>,
7048 V: std::convert::Into<std::string::String>,
7049 {
7050 self.0.request.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7051 self
7052 }
7053
7054 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
7056 where
7057 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
7058 {
7059 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
7060 self
7061 }
7062
7063 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
7065 where
7066 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
7067 {
7068 self.0.request.spell_correction_spec = v.map(|x| x.into());
7069 self
7070 }
7071
7072 pub fn set_entity<T: Into<std::string::String>>(mut self, v: T) -> Self {
7074 self.0.request.entity = v.into();
7075 self
7076 }
7077
7078 pub fn set_conversational_search_spec<T>(mut self, v: T) -> Self
7080 where
7081 T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
7082 {
7083 self.0.request.conversational_search_spec = std::option::Option::Some(v.into());
7084 self
7085 }
7086
7087 pub fn set_or_clear_conversational_search_spec<T>(
7089 mut self,
7090 v: std::option::Option<T>,
7091 ) -> Self
7092 where
7093 T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
7094 {
7095 self.0.request.conversational_search_spec = v.map(|x| x.into());
7096 self
7097 }
7098
7099 pub fn set_tile_navigation_spec<T>(mut self, v: T) -> Self
7101 where
7102 T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
7103 {
7104 self.0.request.tile_navigation_spec = std::option::Option::Some(v.into());
7105 self
7106 }
7107
7108 pub fn set_or_clear_tile_navigation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7110 where
7111 T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
7112 {
7113 self.0.request.tile_navigation_spec = v.map(|x| x.into());
7114 self
7115 }
7116
7117 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
7119 self.0.request.language_code = v.into();
7120 self
7121 }
7122
7123 pub fn set_region_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
7125 self.0.request.region_code = v.into();
7126 self
7127 }
7128
7129 pub fn set_place_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7131 self.0.request.place_id = v.into();
7132 self
7133 }
7134
7135 pub fn set_user_attributes<T, K, V>(mut self, v: T) -> Self
7137 where
7138 T: std::iter::IntoIterator<Item = (K, V)>,
7139 K: std::convert::Into<std::string::String>,
7140 V: std::convert::Into<crate::model::StringList>,
7141 {
7142 self.0.request.user_attributes =
7143 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7144 self
7145 }
7146 }
7147
7148 #[doc(hidden)]
7149 impl gax::options::internal::RequestBuilder for Search {
7150 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7151 &mut self.0.options
7152 }
7153 }
7154
7155 #[derive(Clone, Debug)]
7177 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7178
7179 impl ListOperations {
7180 pub(crate) fn new(
7181 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
7182 ) -> Self {
7183 Self(RequestBuilder::new(stub))
7184 }
7185
7186 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7188 mut self,
7189 v: V,
7190 ) -> Self {
7191 self.0.request = v.into();
7192 self
7193 }
7194
7195 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7197 self.0.options = v.into();
7198 self
7199 }
7200
7201 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7203 (*self.0.stub)
7204 .list_operations(self.0.request, self.0.options)
7205 .await
7206 .map(gax::response::Response::into_body)
7207 }
7208
7209 pub fn by_page(
7211 self,
7212 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7213 {
7214 use std::clone::Clone;
7215 let token = self.0.request.page_token.clone();
7216 let execute = move |token: String| {
7217 let mut builder = self.clone();
7218 builder.0.request = builder.0.request.set_page_token(token);
7219 builder.send()
7220 };
7221 gax::paginator::internal::new_paginator(token, execute)
7222 }
7223
7224 pub fn by_item(
7226 self,
7227 ) -> impl gax::paginator::ItemPaginator<
7228 longrunning::model::ListOperationsResponse,
7229 gax::error::Error,
7230 > {
7231 use gax::paginator::Paginator;
7232 self.by_page().items()
7233 }
7234
7235 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7237 self.0.request.name = v.into();
7238 self
7239 }
7240
7241 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7243 self.0.request.filter = v.into();
7244 self
7245 }
7246
7247 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7249 self.0.request.page_size = v.into();
7250 self
7251 }
7252
7253 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7255 self.0.request.page_token = v.into();
7256 self
7257 }
7258
7259 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7261 self.0.request.return_partial_success = v.into();
7262 self
7263 }
7264 }
7265
7266 #[doc(hidden)]
7267 impl gax::options::internal::RequestBuilder for ListOperations {
7268 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7269 &mut self.0.options
7270 }
7271 }
7272
7273 #[derive(Clone, Debug)]
7291 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7292
7293 impl GetOperation {
7294 pub(crate) fn new(
7295 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
7296 ) -> Self {
7297 Self(RequestBuilder::new(stub))
7298 }
7299
7300 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7302 mut self,
7303 v: V,
7304 ) -> Self {
7305 self.0.request = v.into();
7306 self
7307 }
7308
7309 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7311 self.0.options = v.into();
7312 self
7313 }
7314
7315 pub async fn send(self) -> Result<longrunning::model::Operation> {
7317 (*self.0.stub)
7318 .get_operation(self.0.request, self.0.options)
7319 .await
7320 .map(gax::response::Response::into_body)
7321 }
7322
7323 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7325 self.0.request.name = v.into();
7326 self
7327 }
7328 }
7329
7330 #[doc(hidden)]
7331 impl gax::options::internal::RequestBuilder for GetOperation {
7332 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7333 &mut self.0.options
7334 }
7335 }
7336}
7337
7338pub mod serving_config_service {
7339 use crate::Result;
7340
7341 pub type ClientBuilder =
7355 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7356
7357 pub(crate) mod client {
7358 use super::super::super::client::ServingConfigService;
7359 pub struct Factory;
7360 impl gax::client_builder::internal::ClientFactory for Factory {
7361 type Client = ServingConfigService;
7362 type Credentials = gaxi::options::Credentials;
7363 async fn build(
7364 self,
7365 config: gaxi::options::ClientConfig,
7366 ) -> gax::client_builder::Result<Self::Client> {
7367 Self::Client::new(config).await
7368 }
7369 }
7370 }
7371
7372 #[derive(Clone, Debug)]
7374 pub(crate) struct RequestBuilder<R: std::default::Default> {
7375 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7376 request: R,
7377 options: gax::options::RequestOptions,
7378 }
7379
7380 impl<R> RequestBuilder<R>
7381 where
7382 R: std::default::Default,
7383 {
7384 pub(crate) fn new(
7385 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7386 ) -> Self {
7387 Self {
7388 stub,
7389 request: R::default(),
7390 options: gax::options::RequestOptions::default(),
7391 }
7392 }
7393 }
7394
7395 #[derive(Clone, Debug)]
7413 pub struct CreateServingConfig(RequestBuilder<crate::model::CreateServingConfigRequest>);
7414
7415 impl CreateServingConfig {
7416 pub(crate) fn new(
7417 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7418 ) -> Self {
7419 Self(RequestBuilder::new(stub))
7420 }
7421
7422 pub fn with_request<V: Into<crate::model::CreateServingConfigRequest>>(
7424 mut self,
7425 v: V,
7426 ) -> Self {
7427 self.0.request = v.into();
7428 self
7429 }
7430
7431 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7433 self.0.options = v.into();
7434 self
7435 }
7436
7437 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7439 (*self.0.stub)
7440 .create_serving_config(self.0.request, self.0.options)
7441 .await
7442 .map(gax::response::Response::into_body)
7443 }
7444
7445 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7449 self.0.request.parent = v.into();
7450 self
7451 }
7452
7453 pub fn set_serving_config<T>(mut self, v: T) -> Self
7457 where
7458 T: std::convert::Into<crate::model::ServingConfig>,
7459 {
7460 self.0.request.serving_config = std::option::Option::Some(v.into());
7461 self
7462 }
7463
7464 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
7468 where
7469 T: std::convert::Into<crate::model::ServingConfig>,
7470 {
7471 self.0.request.serving_config = v.map(|x| x.into());
7472 self
7473 }
7474
7475 pub fn set_serving_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7479 self.0.request.serving_config_id = v.into();
7480 self
7481 }
7482 }
7483
7484 #[doc(hidden)]
7485 impl gax::options::internal::RequestBuilder for CreateServingConfig {
7486 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7487 &mut self.0.options
7488 }
7489 }
7490
7491 #[derive(Clone, Debug)]
7509 pub struct DeleteServingConfig(RequestBuilder<crate::model::DeleteServingConfigRequest>);
7510
7511 impl DeleteServingConfig {
7512 pub(crate) fn new(
7513 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7514 ) -> Self {
7515 Self(RequestBuilder::new(stub))
7516 }
7517
7518 pub fn with_request<V: Into<crate::model::DeleteServingConfigRequest>>(
7520 mut self,
7521 v: V,
7522 ) -> Self {
7523 self.0.request = v.into();
7524 self
7525 }
7526
7527 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7529 self.0.options = v.into();
7530 self
7531 }
7532
7533 pub async fn send(self) -> Result<()> {
7535 (*self.0.stub)
7536 .delete_serving_config(self.0.request, self.0.options)
7537 .await
7538 .map(gax::response::Response::into_body)
7539 }
7540
7541 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7545 self.0.request.name = v.into();
7546 self
7547 }
7548 }
7549
7550 #[doc(hidden)]
7551 impl gax::options::internal::RequestBuilder for DeleteServingConfig {
7552 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7553 &mut self.0.options
7554 }
7555 }
7556
7557 #[derive(Clone, Debug)]
7575 pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
7576
7577 impl UpdateServingConfig {
7578 pub(crate) fn new(
7579 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7580 ) -> Self {
7581 Self(RequestBuilder::new(stub))
7582 }
7583
7584 pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
7586 mut self,
7587 v: V,
7588 ) -> Self {
7589 self.0.request = v.into();
7590 self
7591 }
7592
7593 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7595 self.0.options = v.into();
7596 self
7597 }
7598
7599 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7601 (*self.0.stub)
7602 .update_serving_config(self.0.request, self.0.options)
7603 .await
7604 .map(gax::response::Response::into_body)
7605 }
7606
7607 pub fn set_serving_config<T>(mut self, v: T) -> Self
7611 where
7612 T: std::convert::Into<crate::model::ServingConfig>,
7613 {
7614 self.0.request.serving_config = std::option::Option::Some(v.into());
7615 self
7616 }
7617
7618 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
7622 where
7623 T: std::convert::Into<crate::model::ServingConfig>,
7624 {
7625 self.0.request.serving_config = v.map(|x| x.into());
7626 self
7627 }
7628
7629 pub fn set_update_mask<T>(mut self, v: T) -> Self
7631 where
7632 T: std::convert::Into<wkt::FieldMask>,
7633 {
7634 self.0.request.update_mask = std::option::Option::Some(v.into());
7635 self
7636 }
7637
7638 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7640 where
7641 T: std::convert::Into<wkt::FieldMask>,
7642 {
7643 self.0.request.update_mask = v.map(|x| x.into());
7644 self
7645 }
7646 }
7647
7648 #[doc(hidden)]
7649 impl gax::options::internal::RequestBuilder for UpdateServingConfig {
7650 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7651 &mut self.0.options
7652 }
7653 }
7654
7655 #[derive(Clone, Debug)]
7673 pub struct GetServingConfig(RequestBuilder<crate::model::GetServingConfigRequest>);
7674
7675 impl GetServingConfig {
7676 pub(crate) fn new(
7677 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7678 ) -> Self {
7679 Self(RequestBuilder::new(stub))
7680 }
7681
7682 pub fn with_request<V: Into<crate::model::GetServingConfigRequest>>(
7684 mut self,
7685 v: V,
7686 ) -> Self {
7687 self.0.request = v.into();
7688 self
7689 }
7690
7691 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7693 self.0.options = v.into();
7694 self
7695 }
7696
7697 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7699 (*self.0.stub)
7700 .get_serving_config(self.0.request, self.0.options)
7701 .await
7702 .map(gax::response::Response::into_body)
7703 }
7704
7705 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7709 self.0.request.name = v.into();
7710 self
7711 }
7712 }
7713
7714 #[doc(hidden)]
7715 impl gax::options::internal::RequestBuilder for GetServingConfig {
7716 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7717 &mut self.0.options
7718 }
7719 }
7720
7721 #[derive(Clone, Debug)]
7743 pub struct ListServingConfigs(RequestBuilder<crate::model::ListServingConfigsRequest>);
7744
7745 impl ListServingConfigs {
7746 pub(crate) fn new(
7747 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7748 ) -> Self {
7749 Self(RequestBuilder::new(stub))
7750 }
7751
7752 pub fn with_request<V: Into<crate::model::ListServingConfigsRequest>>(
7754 mut self,
7755 v: V,
7756 ) -> Self {
7757 self.0.request = v.into();
7758 self
7759 }
7760
7761 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7763 self.0.options = v.into();
7764 self
7765 }
7766
7767 pub async fn send(self) -> Result<crate::model::ListServingConfigsResponse> {
7769 (*self.0.stub)
7770 .list_serving_configs(self.0.request, self.0.options)
7771 .await
7772 .map(gax::response::Response::into_body)
7773 }
7774
7775 pub fn by_page(
7777 self,
7778 ) -> impl gax::paginator::Paginator<crate::model::ListServingConfigsResponse, gax::error::Error>
7779 {
7780 use std::clone::Clone;
7781 let token = self.0.request.page_token.clone();
7782 let execute = move |token: String| {
7783 let mut builder = self.clone();
7784 builder.0.request = builder.0.request.set_page_token(token);
7785 builder.send()
7786 };
7787 gax::paginator::internal::new_paginator(token, execute)
7788 }
7789
7790 pub fn by_item(
7792 self,
7793 ) -> impl gax::paginator::ItemPaginator<
7794 crate::model::ListServingConfigsResponse,
7795 gax::error::Error,
7796 > {
7797 use gax::paginator::Paginator;
7798 self.by_page().items()
7799 }
7800
7801 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7805 self.0.request.parent = v.into();
7806 self
7807 }
7808
7809 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7811 self.0.request.page_size = v.into();
7812 self
7813 }
7814
7815 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7817 self.0.request.page_token = v.into();
7818 self
7819 }
7820 }
7821
7822 #[doc(hidden)]
7823 impl gax::options::internal::RequestBuilder for ListServingConfigs {
7824 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7825 &mut self.0.options
7826 }
7827 }
7828
7829 #[derive(Clone, Debug)]
7847 pub struct AddControl(RequestBuilder<crate::model::AddControlRequest>);
7848
7849 impl AddControl {
7850 pub(crate) fn new(
7851 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7852 ) -> Self {
7853 Self(RequestBuilder::new(stub))
7854 }
7855
7856 pub fn with_request<V: Into<crate::model::AddControlRequest>>(mut self, v: V) -> Self {
7858 self.0.request = v.into();
7859 self
7860 }
7861
7862 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7864 self.0.options = v.into();
7865 self
7866 }
7867
7868 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7870 (*self.0.stub)
7871 .add_control(self.0.request, self.0.options)
7872 .await
7873 .map(gax::response::Response::into_body)
7874 }
7875
7876 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7880 self.0.request.serving_config = v.into();
7881 self
7882 }
7883
7884 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7888 self.0.request.control_id = v.into();
7889 self
7890 }
7891 }
7892
7893 #[doc(hidden)]
7894 impl gax::options::internal::RequestBuilder for AddControl {
7895 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7896 &mut self.0.options
7897 }
7898 }
7899
7900 #[derive(Clone, Debug)]
7918 pub struct RemoveControl(RequestBuilder<crate::model::RemoveControlRequest>);
7919
7920 impl RemoveControl {
7921 pub(crate) fn new(
7922 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7923 ) -> Self {
7924 Self(RequestBuilder::new(stub))
7925 }
7926
7927 pub fn with_request<V: Into<crate::model::RemoveControlRequest>>(mut self, v: V) -> Self {
7929 self.0.request = v.into();
7930 self
7931 }
7932
7933 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7935 self.0.options = v.into();
7936 self
7937 }
7938
7939 pub async fn send(self) -> Result<crate::model::ServingConfig> {
7941 (*self.0.stub)
7942 .remove_control(self.0.request, self.0.options)
7943 .await
7944 .map(gax::response::Response::into_body)
7945 }
7946
7947 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7951 self.0.request.serving_config = v.into();
7952 self
7953 }
7954
7955 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7959 self.0.request.control_id = v.into();
7960 self
7961 }
7962 }
7963
7964 #[doc(hidden)]
7965 impl gax::options::internal::RequestBuilder for RemoveControl {
7966 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7967 &mut self.0.options
7968 }
7969 }
7970
7971 #[derive(Clone, Debug)]
7993 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7994
7995 impl ListOperations {
7996 pub(crate) fn new(
7997 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
7998 ) -> Self {
7999 Self(RequestBuilder::new(stub))
8000 }
8001
8002 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
8004 mut self,
8005 v: V,
8006 ) -> Self {
8007 self.0.request = v.into();
8008 self
8009 }
8010
8011 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8013 self.0.options = v.into();
8014 self
8015 }
8016
8017 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
8019 (*self.0.stub)
8020 .list_operations(self.0.request, self.0.options)
8021 .await
8022 .map(gax::response::Response::into_body)
8023 }
8024
8025 pub fn by_page(
8027 self,
8028 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8029 {
8030 use std::clone::Clone;
8031 let token = self.0.request.page_token.clone();
8032 let execute = move |token: String| {
8033 let mut builder = self.clone();
8034 builder.0.request = builder.0.request.set_page_token(token);
8035 builder.send()
8036 };
8037 gax::paginator::internal::new_paginator(token, execute)
8038 }
8039
8040 pub fn by_item(
8042 self,
8043 ) -> impl gax::paginator::ItemPaginator<
8044 longrunning::model::ListOperationsResponse,
8045 gax::error::Error,
8046 > {
8047 use gax::paginator::Paginator;
8048 self.by_page().items()
8049 }
8050
8051 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8053 self.0.request.name = v.into();
8054 self
8055 }
8056
8057 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8059 self.0.request.filter = v.into();
8060 self
8061 }
8062
8063 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8065 self.0.request.page_size = v.into();
8066 self
8067 }
8068
8069 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8071 self.0.request.page_token = v.into();
8072 self
8073 }
8074
8075 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8077 self.0.request.return_partial_success = v.into();
8078 self
8079 }
8080 }
8081
8082 #[doc(hidden)]
8083 impl gax::options::internal::RequestBuilder for ListOperations {
8084 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8085 &mut self.0.options
8086 }
8087 }
8088
8089 #[derive(Clone, Debug)]
8107 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8108
8109 impl GetOperation {
8110 pub(crate) fn new(
8111 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
8112 ) -> Self {
8113 Self(RequestBuilder::new(stub))
8114 }
8115
8116 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8118 mut self,
8119 v: V,
8120 ) -> Self {
8121 self.0.request = v.into();
8122 self
8123 }
8124
8125 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8127 self.0.options = v.into();
8128 self
8129 }
8130
8131 pub async fn send(self) -> Result<longrunning::model::Operation> {
8133 (*self.0.stub)
8134 .get_operation(self.0.request, self.0.options)
8135 .await
8136 .map(gax::response::Response::into_body)
8137 }
8138
8139 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8141 self.0.request.name = v.into();
8142 self
8143 }
8144 }
8145
8146 #[doc(hidden)]
8147 impl gax::options::internal::RequestBuilder for GetOperation {
8148 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8149 &mut self.0.options
8150 }
8151 }
8152}
8153
8154pub mod user_event_service {
8155 use crate::Result;
8156
8157 pub type ClientBuilder =
8171 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8172
8173 pub(crate) mod client {
8174 use super::super::super::client::UserEventService;
8175 pub struct Factory;
8176 impl gax::client_builder::internal::ClientFactory for Factory {
8177 type Client = UserEventService;
8178 type Credentials = gaxi::options::Credentials;
8179 async fn build(
8180 self,
8181 config: gaxi::options::ClientConfig,
8182 ) -> gax::client_builder::Result<Self::Client> {
8183 Self::Client::new(config).await
8184 }
8185 }
8186 }
8187
8188 #[derive(Clone, Debug)]
8190 pub(crate) struct RequestBuilder<R: std::default::Default> {
8191 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8192 request: R,
8193 options: gax::options::RequestOptions,
8194 }
8195
8196 impl<R> RequestBuilder<R>
8197 where
8198 R: std::default::Default,
8199 {
8200 pub(crate) fn new(
8201 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8202 ) -> Self {
8203 Self {
8204 stub,
8205 request: R::default(),
8206 options: gax::options::RequestOptions::default(),
8207 }
8208 }
8209 }
8210
8211 #[derive(Clone, Debug)]
8229 pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
8230
8231 impl WriteUserEvent {
8232 pub(crate) fn new(
8233 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8234 ) -> Self {
8235 Self(RequestBuilder::new(stub))
8236 }
8237
8238 pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
8240 self.0.request = v.into();
8241 self
8242 }
8243
8244 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8246 self.0.options = v.into();
8247 self
8248 }
8249
8250 pub async fn send(self) -> Result<crate::model::UserEvent> {
8252 (*self.0.stub)
8253 .write_user_event(self.0.request, self.0.options)
8254 .await
8255 .map(gax::response::Response::into_body)
8256 }
8257
8258 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8262 self.0.request.parent = v.into();
8263 self
8264 }
8265
8266 pub fn set_user_event<T>(mut self, v: T) -> Self
8270 where
8271 T: std::convert::Into<crate::model::UserEvent>,
8272 {
8273 self.0.request.user_event = std::option::Option::Some(v.into());
8274 self
8275 }
8276
8277 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
8281 where
8282 T: std::convert::Into<crate::model::UserEvent>,
8283 {
8284 self.0.request.user_event = v.map(|x| x.into());
8285 self
8286 }
8287
8288 pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
8290 self.0.request.write_async = v.into();
8291 self
8292 }
8293 }
8294
8295 #[doc(hidden)]
8296 impl gax::options::internal::RequestBuilder for WriteUserEvent {
8297 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8298 &mut self.0.options
8299 }
8300 }
8301
8302 #[derive(Clone, Debug)]
8320 pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
8321
8322 impl CollectUserEvent {
8323 pub(crate) fn new(
8324 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8325 ) -> Self {
8326 Self(RequestBuilder::new(stub))
8327 }
8328
8329 pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
8331 mut self,
8332 v: V,
8333 ) -> Self {
8334 self.0.request = v.into();
8335 self
8336 }
8337
8338 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8340 self.0.options = v.into();
8341 self
8342 }
8343
8344 pub async fn send(self) -> Result<api::model::HttpBody> {
8346 (*self.0.stub)
8347 .collect_user_event(self.0.request, self.0.options)
8348 .await
8349 .map(gax::response::Response::into_body)
8350 }
8351
8352 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8356 self.0.request.parent = v.into();
8357 self
8358 }
8359
8360 pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
8364 self.0.request.user_event = v.into();
8365 self
8366 }
8367
8368 pub fn set_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
8370 self.0.request.uri = v.into();
8371 self
8372 }
8373
8374 pub fn set_ets<T: Into<i64>>(mut self, v: T) -> Self {
8376 self.0.request.ets = v.into();
8377 self
8378 }
8379
8380 pub fn set_raw_json<T: Into<std::string::String>>(mut self, v: T) -> Self {
8382 self.0.request.raw_json = v.into();
8383 self
8384 }
8385
8386 pub fn set_conversion_rule<
8391 T: Into<Option<crate::model::collect_user_event_request::ConversionRule>>,
8392 >(
8393 mut self,
8394 v: T,
8395 ) -> Self {
8396 self.0.request.conversion_rule = v.into();
8397 self
8398 }
8399
8400 pub fn set_prebuilt_rule<T: std::convert::Into<std::string::String>>(
8406 mut self,
8407 v: T,
8408 ) -> Self {
8409 self.0.request = self.0.request.set_prebuilt_rule(v);
8410 self
8411 }
8412 }
8413
8414 #[doc(hidden)]
8415 impl gax::options::internal::RequestBuilder for CollectUserEvent {
8416 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8417 &mut self.0.options
8418 }
8419 }
8420
8421 #[derive(Clone, Debug)]
8440 pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
8441
8442 impl PurgeUserEvents {
8443 pub(crate) fn new(
8444 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8445 ) -> Self {
8446 Self(RequestBuilder::new(stub))
8447 }
8448
8449 pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
8451 self.0.request = v.into();
8452 self
8453 }
8454
8455 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8457 self.0.options = v.into();
8458 self
8459 }
8460
8461 pub async fn send(self) -> Result<longrunning::model::Operation> {
8468 (*self.0.stub)
8469 .purge_user_events(self.0.request, self.0.options)
8470 .await
8471 .map(gax::response::Response::into_body)
8472 }
8473
8474 pub fn poller(
8476 self,
8477 ) -> impl lro::Poller<crate::model::PurgeUserEventsResponse, crate::model::PurgeMetadata>
8478 {
8479 type Operation = lro::internal::Operation<
8480 crate::model::PurgeUserEventsResponse,
8481 crate::model::PurgeMetadata,
8482 >;
8483 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8484 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8485
8486 let stub = self.0.stub.clone();
8487 let mut options = self.0.options.clone();
8488 options.set_retry_policy(gax::retry_policy::NeverRetry);
8489 let query = move |name| {
8490 let stub = stub.clone();
8491 let options = options.clone();
8492 async {
8493 let op = GetOperation::new(stub)
8494 .set_name(name)
8495 .with_options(options)
8496 .send()
8497 .await?;
8498 Ok(Operation::new(op))
8499 }
8500 };
8501
8502 let start = move || async {
8503 let op = self.send().await?;
8504 Ok(Operation::new(op))
8505 };
8506
8507 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8508 }
8509
8510 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8514 self.0.request.parent = v.into();
8515 self
8516 }
8517
8518 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8522 self.0.request.filter = v.into();
8523 self
8524 }
8525
8526 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
8528 self.0.request.force = v.into();
8529 self
8530 }
8531 }
8532
8533 #[doc(hidden)]
8534 impl gax::options::internal::RequestBuilder for PurgeUserEvents {
8535 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8536 &mut self.0.options
8537 }
8538 }
8539
8540 #[derive(Clone, Debug)]
8559 pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
8560
8561 impl ImportUserEvents {
8562 pub(crate) fn new(
8563 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8564 ) -> Self {
8565 Self(RequestBuilder::new(stub))
8566 }
8567
8568 pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
8570 mut self,
8571 v: V,
8572 ) -> Self {
8573 self.0.request = v.into();
8574 self
8575 }
8576
8577 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8579 self.0.options = v.into();
8580 self
8581 }
8582
8583 pub async fn send(self) -> Result<longrunning::model::Operation> {
8590 (*self.0.stub)
8591 .import_user_events(self.0.request, self.0.options)
8592 .await
8593 .map(gax::response::Response::into_body)
8594 }
8595
8596 pub fn poller(
8598 self,
8599 ) -> impl lro::Poller<crate::model::ImportUserEventsResponse, crate::model::ImportMetadata>
8600 {
8601 type Operation = lro::internal::Operation<
8602 crate::model::ImportUserEventsResponse,
8603 crate::model::ImportMetadata,
8604 >;
8605 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8606 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8607
8608 let stub = self.0.stub.clone();
8609 let mut options = self.0.options.clone();
8610 options.set_retry_policy(gax::retry_policy::NeverRetry);
8611 let query = move |name| {
8612 let stub = stub.clone();
8613 let options = options.clone();
8614 async {
8615 let op = GetOperation::new(stub)
8616 .set_name(name)
8617 .with_options(options)
8618 .send()
8619 .await?;
8620 Ok(Operation::new(op))
8621 }
8622 };
8623
8624 let start = move || async {
8625 let op = self.send().await?;
8626 Ok(Operation::new(op))
8627 };
8628
8629 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8630 }
8631
8632 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8636 self.0.request.parent = v.into();
8637 self
8638 }
8639
8640 pub fn set_input_config<T>(mut self, v: T) -> Self
8644 where
8645 T: std::convert::Into<crate::model::UserEventInputConfig>,
8646 {
8647 self.0.request.input_config = std::option::Option::Some(v.into());
8648 self
8649 }
8650
8651 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
8655 where
8656 T: std::convert::Into<crate::model::UserEventInputConfig>,
8657 {
8658 self.0.request.input_config = v.map(|x| x.into());
8659 self
8660 }
8661
8662 pub fn set_errors_config<T>(mut self, v: T) -> Self
8664 where
8665 T: std::convert::Into<crate::model::ImportErrorsConfig>,
8666 {
8667 self.0.request.errors_config = std::option::Option::Some(v.into());
8668 self
8669 }
8670
8671 pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
8673 where
8674 T: std::convert::Into<crate::model::ImportErrorsConfig>,
8675 {
8676 self.0.request.errors_config = v.map(|x| x.into());
8677 self
8678 }
8679 }
8680
8681 #[doc(hidden)]
8682 impl gax::options::internal::RequestBuilder for ImportUserEvents {
8683 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8684 &mut self.0.options
8685 }
8686 }
8687
8688 #[derive(Clone, Debug)]
8707 pub struct RejoinUserEvents(RequestBuilder<crate::model::RejoinUserEventsRequest>);
8708
8709 impl RejoinUserEvents {
8710 pub(crate) fn new(
8711 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8712 ) -> Self {
8713 Self(RequestBuilder::new(stub))
8714 }
8715
8716 pub fn with_request<V: Into<crate::model::RejoinUserEventsRequest>>(
8718 mut self,
8719 v: V,
8720 ) -> Self {
8721 self.0.request = v.into();
8722 self
8723 }
8724
8725 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8727 self.0.options = v.into();
8728 self
8729 }
8730
8731 pub async fn send(self) -> Result<longrunning::model::Operation> {
8738 (*self.0.stub)
8739 .rejoin_user_events(self.0.request, self.0.options)
8740 .await
8741 .map(gax::response::Response::into_body)
8742 }
8743
8744 pub fn poller(
8746 self,
8747 ) -> impl lro::Poller<
8748 crate::model::RejoinUserEventsResponse,
8749 crate::model::RejoinUserEventsMetadata,
8750 > {
8751 type Operation = lro::internal::Operation<
8752 crate::model::RejoinUserEventsResponse,
8753 crate::model::RejoinUserEventsMetadata,
8754 >;
8755 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8756 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8757
8758 let stub = self.0.stub.clone();
8759 let mut options = self.0.options.clone();
8760 options.set_retry_policy(gax::retry_policy::NeverRetry);
8761 let query = move |name| {
8762 let stub = stub.clone();
8763 let options = options.clone();
8764 async {
8765 let op = GetOperation::new(stub)
8766 .set_name(name)
8767 .with_options(options)
8768 .send()
8769 .await?;
8770 Ok(Operation::new(op))
8771 }
8772 };
8773
8774 let start = move || async {
8775 let op = self.send().await?;
8776 Ok(Operation::new(op))
8777 };
8778
8779 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8780 }
8781
8782 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8786 self.0.request.parent = v.into();
8787 self
8788 }
8789
8790 pub fn set_user_event_rejoin_scope<
8792 T: Into<crate::model::rejoin_user_events_request::UserEventRejoinScope>,
8793 >(
8794 mut self,
8795 v: T,
8796 ) -> Self {
8797 self.0.request.user_event_rejoin_scope = v.into();
8798 self
8799 }
8800 }
8801
8802 #[doc(hidden)]
8803 impl gax::options::internal::RequestBuilder for RejoinUserEvents {
8804 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8805 &mut self.0.options
8806 }
8807 }
8808
8809 #[derive(Clone, Debug)]
8831 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
8832
8833 impl ListOperations {
8834 pub(crate) fn new(
8835 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8836 ) -> Self {
8837 Self(RequestBuilder::new(stub))
8838 }
8839
8840 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
8842 mut self,
8843 v: V,
8844 ) -> Self {
8845 self.0.request = v.into();
8846 self
8847 }
8848
8849 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8851 self.0.options = v.into();
8852 self
8853 }
8854
8855 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
8857 (*self.0.stub)
8858 .list_operations(self.0.request, self.0.options)
8859 .await
8860 .map(gax::response::Response::into_body)
8861 }
8862
8863 pub fn by_page(
8865 self,
8866 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8867 {
8868 use std::clone::Clone;
8869 let token = self.0.request.page_token.clone();
8870 let execute = move |token: String| {
8871 let mut builder = self.clone();
8872 builder.0.request = builder.0.request.set_page_token(token);
8873 builder.send()
8874 };
8875 gax::paginator::internal::new_paginator(token, execute)
8876 }
8877
8878 pub fn by_item(
8880 self,
8881 ) -> impl gax::paginator::ItemPaginator<
8882 longrunning::model::ListOperationsResponse,
8883 gax::error::Error,
8884 > {
8885 use gax::paginator::Paginator;
8886 self.by_page().items()
8887 }
8888
8889 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8891 self.0.request.name = v.into();
8892 self
8893 }
8894
8895 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8897 self.0.request.filter = v.into();
8898 self
8899 }
8900
8901 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8903 self.0.request.page_size = v.into();
8904 self
8905 }
8906
8907 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8909 self.0.request.page_token = v.into();
8910 self
8911 }
8912
8913 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8915 self.0.request.return_partial_success = v.into();
8916 self
8917 }
8918 }
8919
8920 #[doc(hidden)]
8921 impl gax::options::internal::RequestBuilder for ListOperations {
8922 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8923 &mut self.0.options
8924 }
8925 }
8926
8927 #[derive(Clone, Debug)]
8945 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8946
8947 impl GetOperation {
8948 pub(crate) fn new(
8949 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
8950 ) -> Self {
8951 Self(RequestBuilder::new(stub))
8952 }
8953
8954 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8956 mut self,
8957 v: V,
8958 ) -> Self {
8959 self.0.request = v.into();
8960 self
8961 }
8962
8963 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8965 self.0.options = v.into();
8966 self
8967 }
8968
8969 pub async fn send(self) -> Result<longrunning::model::Operation> {
8971 (*self.0.stub)
8972 .get_operation(self.0.request, self.0.options)
8973 .await
8974 .map(gax::response::Response::into_body)
8975 }
8976
8977 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8979 self.0.request.name = v.into();
8980 self
8981 }
8982 }
8983
8984 #[doc(hidden)]
8985 impl gax::options::internal::RequestBuilder for GetOperation {
8986 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8987 &mut self.0.options
8988 }
8989 }
8990}