1#[cfg(feature = "assistant-service")]
19#[cfg_attr(docsrs, doc(cfg(feature = "assistant-service")))]
20pub mod assistant_service {
21 use crate::Result;
22
23 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
37
38 pub(crate) mod client {
39 use super::super::super::client::AssistantService;
40 pub struct Factory;
41 impl crate::ClientFactory for Factory {
42 type Client = AssistantService;
43 type Credentials = gaxi::options::Credentials;
44 async fn build(
45 self,
46 config: gaxi::options::ClientConfig,
47 ) -> crate::ClientBuilderResult<Self::Client> {
48 Self::Client::new(config).await
49 }
50 }
51 }
52
53 #[derive(Clone, Debug)]
55 pub(crate) struct RequestBuilder<R: std::default::Default> {
56 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
57 request: R,
58 options: crate::RequestOptions,
59 }
60
61 impl<R> RequestBuilder<R>
62 where
63 R: std::default::Default,
64 {
65 pub(crate) fn new(
66 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
67 ) -> Self {
68 Self {
69 stub,
70 request: R::default(),
71 options: crate::RequestOptions::default(),
72 }
73 }
74 }
75
76 #[derive(Clone, Debug)]
97 pub struct ListOperations(
98 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
99 );
100
101 impl ListOperations {
102 pub(crate) fn new(
103 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
104 ) -> Self {
105 Self(RequestBuilder::new(stub))
106 }
107
108 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
110 mut self,
111 v: V,
112 ) -> Self {
113 self.0.request = v.into();
114 self
115 }
116
117 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
119 self.0.options = v.into();
120 self
121 }
122
123 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
125 (*self.0.stub)
126 .list_operations(self.0.request, self.0.options)
127 .await
128 .map(crate::Response::into_body)
129 }
130
131 pub fn by_page(
133 self,
134 ) -> impl google_cloud_gax::paginator::Paginator<
135 google_cloud_longrunning::model::ListOperationsResponse,
136 crate::Error,
137 > {
138 use std::clone::Clone;
139 let token = self.0.request.page_token.clone();
140 let execute = move |token: String| {
141 let mut builder = self.clone();
142 builder.0.request = builder.0.request.set_page_token(token);
143 builder.send()
144 };
145 google_cloud_gax::paginator::internal::new_paginator(token, execute)
146 }
147
148 pub fn by_item(
150 self,
151 ) -> impl google_cloud_gax::paginator::ItemPaginator<
152 google_cloud_longrunning::model::ListOperationsResponse,
153 crate::Error,
154 > {
155 use google_cloud_gax::paginator::Paginator;
156 self.by_page().items()
157 }
158
159 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
161 self.0.request.name = v.into();
162 self
163 }
164
165 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
167 self.0.request.filter = v.into();
168 self
169 }
170
171 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
173 self.0.request.page_size = v.into();
174 self
175 }
176
177 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
179 self.0.request.page_token = v.into();
180 self
181 }
182
183 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
185 self.0.request.return_partial_success = v.into();
186 self
187 }
188 }
189
190 #[doc(hidden)]
191 impl crate::RequestBuilder for ListOperations {
192 fn request_options(&mut self) -> &mut crate::RequestOptions {
193 &mut self.0.options
194 }
195 }
196
197 #[derive(Clone, Debug)]
214 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
215
216 impl GetOperation {
217 pub(crate) fn new(
218 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
219 ) -> Self {
220 Self(RequestBuilder::new(stub))
221 }
222
223 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
225 mut self,
226 v: V,
227 ) -> Self {
228 self.0.request = v.into();
229 self
230 }
231
232 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
234 self.0.options = v.into();
235 self
236 }
237
238 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
240 (*self.0.stub)
241 .get_operation(self.0.request, self.0.options)
242 .await
243 .map(crate::Response::into_body)
244 }
245
246 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
248 self.0.request.name = v.into();
249 self
250 }
251 }
252
253 #[doc(hidden)]
254 impl crate::RequestBuilder for GetOperation {
255 fn request_options(&mut self) -> &mut crate::RequestOptions {
256 &mut self.0.options
257 }
258 }
259
260 #[derive(Clone, Debug)]
277 pub struct CancelOperation(
278 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
279 );
280
281 impl CancelOperation {
282 pub(crate) fn new(
283 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
284 ) -> Self {
285 Self(RequestBuilder::new(stub))
286 }
287
288 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
290 mut self,
291 v: V,
292 ) -> Self {
293 self.0.request = v.into();
294 self
295 }
296
297 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
299 self.0.options = v.into();
300 self
301 }
302
303 pub async fn send(self) -> Result<()> {
305 (*self.0.stub)
306 .cancel_operation(self.0.request, self.0.options)
307 .await
308 .map(crate::Response::into_body)
309 }
310
311 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
313 self.0.request.name = v.into();
314 self
315 }
316 }
317
318 #[doc(hidden)]
319 impl crate::RequestBuilder for CancelOperation {
320 fn request_options(&mut self) -> &mut crate::RequestOptions {
321 &mut self.0.options
322 }
323 }
324}
325
326#[cfg(feature = "cmek-config-service")]
328#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
329pub mod cmek_config_service {
330 use crate::Result;
331
332 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
346
347 pub(crate) mod client {
348 use super::super::super::client::CmekConfigService;
349 pub struct Factory;
350 impl crate::ClientFactory for Factory {
351 type Client = CmekConfigService;
352 type Credentials = gaxi::options::Credentials;
353 async fn build(
354 self,
355 config: gaxi::options::ClientConfig,
356 ) -> crate::ClientBuilderResult<Self::Client> {
357 Self::Client::new(config).await
358 }
359 }
360 }
361
362 #[derive(Clone, Debug)]
364 pub(crate) struct RequestBuilder<R: std::default::Default> {
365 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
366 request: R,
367 options: crate::RequestOptions,
368 }
369
370 impl<R> RequestBuilder<R>
371 where
372 R: std::default::Default,
373 {
374 pub(crate) fn new(
375 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
376 ) -> Self {
377 Self {
378 stub,
379 request: R::default(),
380 options: crate::RequestOptions::default(),
381 }
382 }
383 }
384
385 #[derive(Clone, Debug)]
403 pub struct UpdateCmekConfig(RequestBuilder<crate::model::UpdateCmekConfigRequest>);
404
405 impl UpdateCmekConfig {
406 pub(crate) fn new(
407 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
408 ) -> Self {
409 Self(RequestBuilder::new(stub))
410 }
411
412 pub fn with_request<V: Into<crate::model::UpdateCmekConfigRequest>>(
414 mut self,
415 v: V,
416 ) -> Self {
417 self.0.request = v.into();
418 self
419 }
420
421 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
423 self.0.options = v.into();
424 self
425 }
426
427 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
434 (*self.0.stub)
435 .update_cmek_config(self.0.request, self.0.options)
436 .await
437 .map(crate::Response::into_body)
438 }
439
440 pub fn poller(
442 self,
443 ) -> impl google_cloud_lro::Poller<
444 crate::model::CmekConfig,
445 crate::model::UpdateCmekConfigMetadata,
446 > {
447 type Operation = google_cloud_lro::internal::Operation<
448 crate::model::CmekConfig,
449 crate::model::UpdateCmekConfigMetadata,
450 >;
451 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
452 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
453 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
454 if let Some(ref mut details) = poller_options.tracing {
455 details.method_name = "google_cloud_discoveryengine_v1::client::CmekConfigService::update_cmek_config::until_done";
456 }
457
458 let stub = self.0.stub.clone();
459 let mut options = self.0.options.clone();
460 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
461 let query = move |name| {
462 let stub = stub.clone();
463 let options = options.clone();
464 async {
465 let op = GetOperation::new(stub)
466 .set_name(name)
467 .with_options(options)
468 .send()
469 .await?;
470 Ok(Operation::new(op))
471 }
472 };
473
474 let start = move || async {
475 let op = self.send().await?;
476 Ok(Operation::new(op))
477 };
478
479 use google_cloud_lro::internal::PollerExt;
480 {
481 google_cloud_lro::internal::new_poller(
482 polling_error_policy,
483 polling_backoff_policy,
484 start,
485 query,
486 )
487 }
488 .with_options(poller_options)
489 }
490
491 pub fn set_config<T>(mut self, v: T) -> Self
495 where
496 T: std::convert::Into<crate::model::CmekConfig>,
497 {
498 self.0.request.config = std::option::Option::Some(v.into());
499 self
500 }
501
502 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
506 where
507 T: std::convert::Into<crate::model::CmekConfig>,
508 {
509 self.0.request.config = v.map(|x| x.into());
510 self
511 }
512
513 pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
515 self.0.request.set_default = v.into();
516 self
517 }
518 }
519
520 #[doc(hidden)]
521 impl crate::RequestBuilder for UpdateCmekConfig {
522 fn request_options(&mut self) -> &mut crate::RequestOptions {
523 &mut self.0.options
524 }
525 }
526
527 #[derive(Clone, Debug)]
544 pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
545
546 impl GetCmekConfig {
547 pub(crate) fn new(
548 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
549 ) -> Self {
550 Self(RequestBuilder::new(stub))
551 }
552
553 pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
555 self.0.request = v.into();
556 self
557 }
558
559 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
561 self.0.options = v.into();
562 self
563 }
564
565 pub async fn send(self) -> Result<crate::model::CmekConfig> {
567 (*self.0.stub)
568 .get_cmek_config(self.0.request, self.0.options)
569 .await
570 .map(crate::Response::into_body)
571 }
572
573 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
577 self.0.request.name = v.into();
578 self
579 }
580 }
581
582 #[doc(hidden)]
583 impl crate::RequestBuilder for GetCmekConfig {
584 fn request_options(&mut self) -> &mut crate::RequestOptions {
585 &mut self.0.options
586 }
587 }
588
589 #[derive(Clone, Debug)]
606 pub struct ListCmekConfigs(RequestBuilder<crate::model::ListCmekConfigsRequest>);
607
608 impl ListCmekConfigs {
609 pub(crate) fn new(
610 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
611 ) -> Self {
612 Self(RequestBuilder::new(stub))
613 }
614
615 pub fn with_request<V: Into<crate::model::ListCmekConfigsRequest>>(mut self, v: V) -> Self {
617 self.0.request = v.into();
618 self
619 }
620
621 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
623 self.0.options = v.into();
624 self
625 }
626
627 pub async fn send(self) -> Result<crate::model::ListCmekConfigsResponse> {
629 (*self.0.stub)
630 .list_cmek_configs(self.0.request, self.0.options)
631 .await
632 .map(crate::Response::into_body)
633 }
634
635 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
639 self.0.request.parent = v.into();
640 self
641 }
642 }
643
644 #[doc(hidden)]
645 impl crate::RequestBuilder for ListCmekConfigs {
646 fn request_options(&mut self) -> &mut crate::RequestOptions {
647 &mut self.0.options
648 }
649 }
650
651 #[derive(Clone, Debug)]
669 pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
670
671 impl DeleteCmekConfig {
672 pub(crate) fn new(
673 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
674 ) -> Self {
675 Self(RequestBuilder::new(stub))
676 }
677
678 pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
680 mut self,
681 v: V,
682 ) -> Self {
683 self.0.request = v.into();
684 self
685 }
686
687 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
689 self.0.options = v.into();
690 self
691 }
692
693 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
700 (*self.0.stub)
701 .delete_cmek_config(self.0.request, self.0.options)
702 .await
703 .map(crate::Response::into_body)
704 }
705
706 pub fn poller(
708 self,
709 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
710 type Operation = google_cloud_lro::internal::Operation<
711 wkt::Empty,
712 crate::model::DeleteCmekConfigMetadata,
713 >;
714 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
715 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
716 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
717 if let Some(ref mut details) = poller_options.tracing {
718 details.method_name = "google_cloud_discoveryengine_v1::client::CmekConfigService::delete_cmek_config::until_done";
719 }
720
721 let stub = self.0.stub.clone();
722 let mut options = self.0.options.clone();
723 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
724 let query = move |name| {
725 let stub = stub.clone();
726 let options = options.clone();
727 async {
728 let op = GetOperation::new(stub)
729 .set_name(name)
730 .with_options(options)
731 .send()
732 .await?;
733 Ok(Operation::new(op))
734 }
735 };
736
737 let start = move || async {
738 let op = self.send().await?;
739 Ok(Operation::new(op))
740 };
741
742 use google_cloud_lro::internal::PollerExt;
743 {
744 google_cloud_lro::internal::new_unit_response_poller(
745 polling_error_policy,
746 polling_backoff_policy,
747 start,
748 query,
749 )
750 }
751 .with_options(poller_options)
752 }
753
754 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
758 self.0.request.name = v.into();
759 self
760 }
761 }
762
763 #[doc(hidden)]
764 impl crate::RequestBuilder for DeleteCmekConfig {
765 fn request_options(&mut self) -> &mut crate::RequestOptions {
766 &mut self.0.options
767 }
768 }
769
770 #[derive(Clone, Debug)]
791 pub struct ListOperations(
792 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
793 );
794
795 impl ListOperations {
796 pub(crate) fn new(
797 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
798 ) -> Self {
799 Self(RequestBuilder::new(stub))
800 }
801
802 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
804 mut self,
805 v: V,
806 ) -> Self {
807 self.0.request = v.into();
808 self
809 }
810
811 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
813 self.0.options = v.into();
814 self
815 }
816
817 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
819 (*self.0.stub)
820 .list_operations(self.0.request, self.0.options)
821 .await
822 .map(crate::Response::into_body)
823 }
824
825 pub fn by_page(
827 self,
828 ) -> impl google_cloud_gax::paginator::Paginator<
829 google_cloud_longrunning::model::ListOperationsResponse,
830 crate::Error,
831 > {
832 use std::clone::Clone;
833 let token = self.0.request.page_token.clone();
834 let execute = move |token: String| {
835 let mut builder = self.clone();
836 builder.0.request = builder.0.request.set_page_token(token);
837 builder.send()
838 };
839 google_cloud_gax::paginator::internal::new_paginator(token, execute)
840 }
841
842 pub fn by_item(
844 self,
845 ) -> impl google_cloud_gax::paginator::ItemPaginator<
846 google_cloud_longrunning::model::ListOperationsResponse,
847 crate::Error,
848 > {
849 use google_cloud_gax::paginator::Paginator;
850 self.by_page().items()
851 }
852
853 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
855 self.0.request.name = v.into();
856 self
857 }
858
859 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
861 self.0.request.filter = v.into();
862 self
863 }
864
865 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
867 self.0.request.page_size = v.into();
868 self
869 }
870
871 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
873 self.0.request.page_token = v.into();
874 self
875 }
876
877 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
879 self.0.request.return_partial_success = v.into();
880 self
881 }
882 }
883
884 #[doc(hidden)]
885 impl crate::RequestBuilder for ListOperations {
886 fn request_options(&mut self) -> &mut crate::RequestOptions {
887 &mut self.0.options
888 }
889 }
890
891 #[derive(Clone, Debug)]
908 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
909
910 impl GetOperation {
911 pub(crate) fn new(
912 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
913 ) -> Self {
914 Self(RequestBuilder::new(stub))
915 }
916
917 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
919 mut self,
920 v: V,
921 ) -> Self {
922 self.0.request = v.into();
923 self
924 }
925
926 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
928 self.0.options = v.into();
929 self
930 }
931
932 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
934 (*self.0.stub)
935 .get_operation(self.0.request, self.0.options)
936 .await
937 .map(crate::Response::into_body)
938 }
939
940 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
942 self.0.request.name = v.into();
943 self
944 }
945 }
946
947 #[doc(hidden)]
948 impl crate::RequestBuilder for GetOperation {
949 fn request_options(&mut self) -> &mut crate::RequestOptions {
950 &mut self.0.options
951 }
952 }
953
954 #[derive(Clone, Debug)]
971 pub struct CancelOperation(
972 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
973 );
974
975 impl CancelOperation {
976 pub(crate) fn new(
977 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
978 ) -> Self {
979 Self(RequestBuilder::new(stub))
980 }
981
982 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
984 mut self,
985 v: V,
986 ) -> Self {
987 self.0.request = v.into();
988 self
989 }
990
991 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
993 self.0.options = v.into();
994 self
995 }
996
997 pub async fn send(self) -> Result<()> {
999 (*self.0.stub)
1000 .cancel_operation(self.0.request, self.0.options)
1001 .await
1002 .map(crate::Response::into_body)
1003 }
1004
1005 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1007 self.0.request.name = v.into();
1008 self
1009 }
1010 }
1011
1012 #[doc(hidden)]
1013 impl crate::RequestBuilder for CancelOperation {
1014 fn request_options(&mut self) -> &mut crate::RequestOptions {
1015 &mut self.0.options
1016 }
1017 }
1018}
1019
1020#[cfg(feature = "completion-service")]
1022#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
1023pub mod completion_service {
1024 use crate::Result;
1025
1026 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1040
1041 pub(crate) mod client {
1042 use super::super::super::client::CompletionService;
1043 pub struct Factory;
1044 impl crate::ClientFactory for Factory {
1045 type Client = CompletionService;
1046 type Credentials = gaxi::options::Credentials;
1047 async fn build(
1048 self,
1049 config: gaxi::options::ClientConfig,
1050 ) -> crate::ClientBuilderResult<Self::Client> {
1051 Self::Client::new(config).await
1052 }
1053 }
1054 }
1055
1056 #[derive(Clone, Debug)]
1058 pub(crate) struct RequestBuilder<R: std::default::Default> {
1059 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1060 request: R,
1061 options: crate::RequestOptions,
1062 }
1063
1064 impl<R> RequestBuilder<R>
1065 where
1066 R: std::default::Default,
1067 {
1068 pub(crate) fn new(
1069 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1070 ) -> Self {
1071 Self {
1072 stub,
1073 request: R::default(),
1074 options: crate::RequestOptions::default(),
1075 }
1076 }
1077 }
1078
1079 #[derive(Clone, Debug)]
1096 pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1097
1098 impl CompleteQuery {
1099 pub(crate) fn new(
1100 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1101 ) -> Self {
1102 Self(RequestBuilder::new(stub))
1103 }
1104
1105 pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1107 self.0.request = v.into();
1108 self
1109 }
1110
1111 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1113 self.0.options = v.into();
1114 self
1115 }
1116
1117 pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1119 (*self.0.stub)
1120 .complete_query(self.0.request, self.0.options)
1121 .await
1122 .map(crate::Response::into_body)
1123 }
1124
1125 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1129 self.0.request.data_store = v.into();
1130 self
1131 }
1132
1133 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1137 self.0.request.query = v.into();
1138 self
1139 }
1140
1141 pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1143 self.0.request.query_model = v.into();
1144 self
1145 }
1146
1147 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1149 self.0.request.user_pseudo_id = v.into();
1150 self
1151 }
1152
1153 pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1155 self.0.request.include_tail_suggestions = v.into();
1156 self
1157 }
1158 }
1159
1160 #[doc(hidden)]
1161 impl crate::RequestBuilder for CompleteQuery {
1162 fn request_options(&mut self) -> &mut crate::RequestOptions {
1163 &mut self.0.options
1164 }
1165 }
1166
1167 #[derive(Clone, Debug)]
1185 pub struct ImportSuggestionDenyListEntries(
1186 RequestBuilder<crate::model::ImportSuggestionDenyListEntriesRequest>,
1187 );
1188
1189 impl ImportSuggestionDenyListEntries {
1190 pub(crate) fn new(
1191 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1192 ) -> Self {
1193 Self(RequestBuilder::new(stub))
1194 }
1195
1196 pub fn with_request<V: Into<crate::model::ImportSuggestionDenyListEntriesRequest>>(
1198 mut self,
1199 v: V,
1200 ) -> Self {
1201 self.0.request = v.into();
1202 self
1203 }
1204
1205 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1207 self.0.options = v.into();
1208 self
1209 }
1210
1211 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1218 (*self.0.stub)
1219 .import_suggestion_deny_list_entries(self.0.request, self.0.options)
1220 .await
1221 .map(crate::Response::into_body)
1222 }
1223
1224 pub fn poller(
1226 self,
1227 ) -> impl google_cloud_lro::Poller<
1228 crate::model::ImportSuggestionDenyListEntriesResponse,
1229 crate::model::ImportSuggestionDenyListEntriesMetadata,
1230 > {
1231 type Operation = google_cloud_lro::internal::Operation<
1232 crate::model::ImportSuggestionDenyListEntriesResponse,
1233 crate::model::ImportSuggestionDenyListEntriesMetadata,
1234 >;
1235 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1236 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1237 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1238 if let Some(ref mut details) = poller_options.tracing {
1239 details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::import_suggestion_deny_list_entries::until_done";
1240 }
1241
1242 let stub = self.0.stub.clone();
1243 let mut options = self.0.options.clone();
1244 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1245 let query = move |name| {
1246 let stub = stub.clone();
1247 let options = options.clone();
1248 async {
1249 let op = GetOperation::new(stub)
1250 .set_name(name)
1251 .with_options(options)
1252 .send()
1253 .await?;
1254 Ok(Operation::new(op))
1255 }
1256 };
1257
1258 let start = move || async {
1259 let op = self.send().await?;
1260 Ok(Operation::new(op))
1261 };
1262
1263 use google_cloud_lro::internal::PollerExt;
1264 {
1265 google_cloud_lro::internal::new_poller(
1266 polling_error_policy,
1267 polling_backoff_policy,
1268 start,
1269 query,
1270 )
1271 }
1272 .with_options(poller_options)
1273 }
1274
1275 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1279 self.0.request.parent = v.into();
1280 self
1281 }
1282
1283 pub fn set_source<
1288 T: Into<Option<crate::model::import_suggestion_deny_list_entries_request::Source>>,
1289 >(
1290 mut self,
1291 v: T,
1292 ) -> Self {
1293 self.0.request.source = v.into();
1294 self
1295 }
1296
1297 pub fn set_inline_source<
1303 T: std::convert::Into<
1304 std::boxed::Box<
1305 crate::model::import_suggestion_deny_list_entries_request::InlineSource,
1306 >,
1307 >,
1308 >(
1309 mut self,
1310 v: T,
1311 ) -> Self {
1312 self.0.request = self.0.request.set_inline_source(v);
1313 self
1314 }
1315
1316 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1322 mut self,
1323 v: T,
1324 ) -> Self {
1325 self.0.request = self.0.request.set_gcs_source(v);
1326 self
1327 }
1328 }
1329
1330 #[doc(hidden)]
1331 impl crate::RequestBuilder for ImportSuggestionDenyListEntries {
1332 fn request_options(&mut self) -> &mut crate::RequestOptions {
1333 &mut self.0.options
1334 }
1335 }
1336
1337 #[derive(Clone, Debug)]
1355 pub struct PurgeSuggestionDenyListEntries(
1356 RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1357 );
1358
1359 impl PurgeSuggestionDenyListEntries {
1360 pub(crate) fn new(
1361 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1362 ) -> Self {
1363 Self(RequestBuilder::new(stub))
1364 }
1365
1366 pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1368 mut self,
1369 v: V,
1370 ) -> Self {
1371 self.0.request = v.into();
1372 self
1373 }
1374
1375 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1377 self.0.options = v.into();
1378 self
1379 }
1380
1381 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1388 (*self.0.stub)
1389 .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1390 .await
1391 .map(crate::Response::into_body)
1392 }
1393
1394 pub fn poller(
1396 self,
1397 ) -> impl google_cloud_lro::Poller<
1398 crate::model::PurgeSuggestionDenyListEntriesResponse,
1399 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1400 > {
1401 type Operation = google_cloud_lro::internal::Operation<
1402 crate::model::PurgeSuggestionDenyListEntriesResponse,
1403 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1404 >;
1405 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1406 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1407 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1408 if let Some(ref mut details) = poller_options.tracing {
1409 details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::purge_suggestion_deny_list_entries::until_done";
1410 }
1411
1412 let stub = self.0.stub.clone();
1413 let mut options = self.0.options.clone();
1414 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1415 let query = move |name| {
1416 let stub = stub.clone();
1417 let options = options.clone();
1418 async {
1419 let op = GetOperation::new(stub)
1420 .set_name(name)
1421 .with_options(options)
1422 .send()
1423 .await?;
1424 Ok(Operation::new(op))
1425 }
1426 };
1427
1428 let start = move || async {
1429 let op = self.send().await?;
1430 Ok(Operation::new(op))
1431 };
1432
1433 use google_cloud_lro::internal::PollerExt;
1434 {
1435 google_cloud_lro::internal::new_poller(
1436 polling_error_policy,
1437 polling_backoff_policy,
1438 start,
1439 query,
1440 )
1441 }
1442 .with_options(poller_options)
1443 }
1444
1445 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1449 self.0.request.parent = v.into();
1450 self
1451 }
1452 }
1453
1454 #[doc(hidden)]
1455 impl crate::RequestBuilder for PurgeSuggestionDenyListEntries {
1456 fn request_options(&mut self) -> &mut crate::RequestOptions {
1457 &mut self.0.options
1458 }
1459 }
1460
1461 #[derive(Clone, Debug)]
1479 pub struct ImportCompletionSuggestions(
1480 RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1481 );
1482
1483 impl ImportCompletionSuggestions {
1484 pub(crate) fn new(
1485 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1486 ) -> Self {
1487 Self(RequestBuilder::new(stub))
1488 }
1489
1490 pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1492 mut self,
1493 v: V,
1494 ) -> Self {
1495 self.0.request = v.into();
1496 self
1497 }
1498
1499 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1501 self.0.options = v.into();
1502 self
1503 }
1504
1505 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1512 (*self.0.stub)
1513 .import_completion_suggestions(self.0.request, self.0.options)
1514 .await
1515 .map(crate::Response::into_body)
1516 }
1517
1518 pub fn poller(
1520 self,
1521 ) -> impl google_cloud_lro::Poller<
1522 crate::model::ImportCompletionSuggestionsResponse,
1523 crate::model::ImportCompletionSuggestionsMetadata,
1524 > {
1525 type Operation = google_cloud_lro::internal::Operation<
1526 crate::model::ImportCompletionSuggestionsResponse,
1527 crate::model::ImportCompletionSuggestionsMetadata,
1528 >;
1529 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1530 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1531 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1532 if let Some(ref mut details) = poller_options.tracing {
1533 details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::import_completion_suggestions::until_done";
1534 }
1535
1536 let stub = self.0.stub.clone();
1537 let mut options = self.0.options.clone();
1538 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1539 let query = move |name| {
1540 let stub = stub.clone();
1541 let options = options.clone();
1542 async {
1543 let op = GetOperation::new(stub)
1544 .set_name(name)
1545 .with_options(options)
1546 .send()
1547 .await?;
1548 Ok(Operation::new(op))
1549 }
1550 };
1551
1552 let start = move || async {
1553 let op = self.send().await?;
1554 Ok(Operation::new(op))
1555 };
1556
1557 use google_cloud_lro::internal::PollerExt;
1558 {
1559 google_cloud_lro::internal::new_poller(
1560 polling_error_policy,
1561 polling_backoff_policy,
1562 start,
1563 query,
1564 )
1565 }
1566 .with_options(poller_options)
1567 }
1568
1569 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1573 self.0.request.parent = v.into();
1574 self
1575 }
1576
1577 pub fn set_error_config<T>(mut self, v: T) -> Self
1579 where
1580 T: std::convert::Into<crate::model::ImportErrorConfig>,
1581 {
1582 self.0.request.error_config = std::option::Option::Some(v.into());
1583 self
1584 }
1585
1586 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1588 where
1589 T: std::convert::Into<crate::model::ImportErrorConfig>,
1590 {
1591 self.0.request.error_config = v.map(|x| x.into());
1592 self
1593 }
1594
1595 pub fn set_source<
1600 T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1601 >(
1602 mut self,
1603 v: T,
1604 ) -> Self {
1605 self.0.request.source = v.into();
1606 self
1607 }
1608
1609 pub fn set_inline_source<
1615 T: std::convert::Into<
1616 std::boxed::Box<
1617 crate::model::import_completion_suggestions_request::InlineSource,
1618 >,
1619 >,
1620 >(
1621 mut self,
1622 v: T,
1623 ) -> Self {
1624 self.0.request = self.0.request.set_inline_source(v);
1625 self
1626 }
1627
1628 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1634 mut self,
1635 v: T,
1636 ) -> Self {
1637 self.0.request = self.0.request.set_gcs_source(v);
1638 self
1639 }
1640
1641 pub fn set_bigquery_source<
1647 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1648 >(
1649 mut self,
1650 v: T,
1651 ) -> Self {
1652 self.0.request = self.0.request.set_bigquery_source(v);
1653 self
1654 }
1655 }
1656
1657 #[doc(hidden)]
1658 impl crate::RequestBuilder for ImportCompletionSuggestions {
1659 fn request_options(&mut self) -> &mut crate::RequestOptions {
1660 &mut self.0.options
1661 }
1662 }
1663
1664 #[derive(Clone, Debug)]
1682 pub struct PurgeCompletionSuggestions(
1683 RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1684 );
1685
1686 impl PurgeCompletionSuggestions {
1687 pub(crate) fn new(
1688 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1689 ) -> Self {
1690 Self(RequestBuilder::new(stub))
1691 }
1692
1693 pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1695 mut self,
1696 v: V,
1697 ) -> Self {
1698 self.0.request = v.into();
1699 self
1700 }
1701
1702 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1704 self.0.options = v.into();
1705 self
1706 }
1707
1708 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1715 (*self.0.stub)
1716 .purge_completion_suggestions(self.0.request, self.0.options)
1717 .await
1718 .map(crate::Response::into_body)
1719 }
1720
1721 pub fn poller(
1723 self,
1724 ) -> impl google_cloud_lro::Poller<
1725 crate::model::PurgeCompletionSuggestionsResponse,
1726 crate::model::PurgeCompletionSuggestionsMetadata,
1727 > {
1728 type Operation = google_cloud_lro::internal::Operation<
1729 crate::model::PurgeCompletionSuggestionsResponse,
1730 crate::model::PurgeCompletionSuggestionsMetadata,
1731 >;
1732 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1733 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1734 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1735 if let Some(ref mut details) = poller_options.tracing {
1736 details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::purge_completion_suggestions::until_done";
1737 }
1738
1739 let stub = self.0.stub.clone();
1740 let mut options = self.0.options.clone();
1741 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1742 let query = move |name| {
1743 let stub = stub.clone();
1744 let options = options.clone();
1745 async {
1746 let op = GetOperation::new(stub)
1747 .set_name(name)
1748 .with_options(options)
1749 .send()
1750 .await?;
1751 Ok(Operation::new(op))
1752 }
1753 };
1754
1755 let start = move || async {
1756 let op = self.send().await?;
1757 Ok(Operation::new(op))
1758 };
1759
1760 use google_cloud_lro::internal::PollerExt;
1761 {
1762 google_cloud_lro::internal::new_poller(
1763 polling_error_policy,
1764 polling_backoff_policy,
1765 start,
1766 query,
1767 )
1768 }
1769 .with_options(poller_options)
1770 }
1771
1772 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1776 self.0.request.parent = v.into();
1777 self
1778 }
1779 }
1780
1781 #[doc(hidden)]
1782 impl crate::RequestBuilder for PurgeCompletionSuggestions {
1783 fn request_options(&mut self) -> &mut crate::RequestOptions {
1784 &mut self.0.options
1785 }
1786 }
1787
1788 #[derive(Clone, Debug)]
1809 pub struct ListOperations(
1810 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1811 );
1812
1813 impl ListOperations {
1814 pub(crate) fn new(
1815 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1816 ) -> Self {
1817 Self(RequestBuilder::new(stub))
1818 }
1819
1820 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1822 mut self,
1823 v: V,
1824 ) -> Self {
1825 self.0.request = v.into();
1826 self
1827 }
1828
1829 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1831 self.0.options = v.into();
1832 self
1833 }
1834
1835 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1837 (*self.0.stub)
1838 .list_operations(self.0.request, self.0.options)
1839 .await
1840 .map(crate::Response::into_body)
1841 }
1842
1843 pub fn by_page(
1845 self,
1846 ) -> impl google_cloud_gax::paginator::Paginator<
1847 google_cloud_longrunning::model::ListOperationsResponse,
1848 crate::Error,
1849 > {
1850 use std::clone::Clone;
1851 let token = self.0.request.page_token.clone();
1852 let execute = move |token: String| {
1853 let mut builder = self.clone();
1854 builder.0.request = builder.0.request.set_page_token(token);
1855 builder.send()
1856 };
1857 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1858 }
1859
1860 pub fn by_item(
1862 self,
1863 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1864 google_cloud_longrunning::model::ListOperationsResponse,
1865 crate::Error,
1866 > {
1867 use google_cloud_gax::paginator::Paginator;
1868 self.by_page().items()
1869 }
1870
1871 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1873 self.0.request.name = v.into();
1874 self
1875 }
1876
1877 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1879 self.0.request.filter = v.into();
1880 self
1881 }
1882
1883 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1885 self.0.request.page_size = v.into();
1886 self
1887 }
1888
1889 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1891 self.0.request.page_token = v.into();
1892 self
1893 }
1894
1895 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1897 self.0.request.return_partial_success = v.into();
1898 self
1899 }
1900 }
1901
1902 #[doc(hidden)]
1903 impl crate::RequestBuilder for ListOperations {
1904 fn request_options(&mut self) -> &mut crate::RequestOptions {
1905 &mut self.0.options
1906 }
1907 }
1908
1909 #[derive(Clone, Debug)]
1926 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1927
1928 impl GetOperation {
1929 pub(crate) fn new(
1930 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1931 ) -> Self {
1932 Self(RequestBuilder::new(stub))
1933 }
1934
1935 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1937 mut self,
1938 v: V,
1939 ) -> Self {
1940 self.0.request = v.into();
1941 self
1942 }
1943
1944 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1946 self.0.options = v.into();
1947 self
1948 }
1949
1950 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1952 (*self.0.stub)
1953 .get_operation(self.0.request, self.0.options)
1954 .await
1955 .map(crate::Response::into_body)
1956 }
1957
1958 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1960 self.0.request.name = v.into();
1961 self
1962 }
1963 }
1964
1965 #[doc(hidden)]
1966 impl crate::RequestBuilder for GetOperation {
1967 fn request_options(&mut self) -> &mut crate::RequestOptions {
1968 &mut self.0.options
1969 }
1970 }
1971
1972 #[derive(Clone, Debug)]
1989 pub struct CancelOperation(
1990 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1991 );
1992
1993 impl CancelOperation {
1994 pub(crate) fn new(
1995 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1996 ) -> Self {
1997 Self(RequestBuilder::new(stub))
1998 }
1999
2000 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2002 mut self,
2003 v: V,
2004 ) -> Self {
2005 self.0.request = v.into();
2006 self
2007 }
2008
2009 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2011 self.0.options = v.into();
2012 self
2013 }
2014
2015 pub async fn send(self) -> Result<()> {
2017 (*self.0.stub)
2018 .cancel_operation(self.0.request, self.0.options)
2019 .await
2020 .map(crate::Response::into_body)
2021 }
2022
2023 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2025 self.0.request.name = v.into();
2026 self
2027 }
2028 }
2029
2030 #[doc(hidden)]
2031 impl crate::RequestBuilder for CancelOperation {
2032 fn request_options(&mut self) -> &mut crate::RequestOptions {
2033 &mut self.0.options
2034 }
2035 }
2036}
2037
2038#[cfg(feature = "control-service")]
2040#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
2041pub mod control_service {
2042 use crate::Result;
2043
2044 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2058
2059 pub(crate) mod client {
2060 use super::super::super::client::ControlService;
2061 pub struct Factory;
2062 impl crate::ClientFactory for Factory {
2063 type Client = ControlService;
2064 type Credentials = gaxi::options::Credentials;
2065 async fn build(
2066 self,
2067 config: gaxi::options::ClientConfig,
2068 ) -> crate::ClientBuilderResult<Self::Client> {
2069 Self::Client::new(config).await
2070 }
2071 }
2072 }
2073
2074 #[derive(Clone, Debug)]
2076 pub(crate) struct RequestBuilder<R: std::default::Default> {
2077 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2078 request: R,
2079 options: crate::RequestOptions,
2080 }
2081
2082 impl<R> RequestBuilder<R>
2083 where
2084 R: std::default::Default,
2085 {
2086 pub(crate) fn new(
2087 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2088 ) -> Self {
2089 Self {
2090 stub,
2091 request: R::default(),
2092 options: crate::RequestOptions::default(),
2093 }
2094 }
2095 }
2096
2097 #[derive(Clone, Debug)]
2114 pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2115
2116 impl CreateControl {
2117 pub(crate) fn new(
2118 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2119 ) -> Self {
2120 Self(RequestBuilder::new(stub))
2121 }
2122
2123 pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2125 self.0.request = v.into();
2126 self
2127 }
2128
2129 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2131 self.0.options = v.into();
2132 self
2133 }
2134
2135 pub async fn send(self) -> Result<crate::model::Control> {
2137 (*self.0.stub)
2138 .create_control(self.0.request, self.0.options)
2139 .await
2140 .map(crate::Response::into_body)
2141 }
2142
2143 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2147 self.0.request.parent = v.into();
2148 self
2149 }
2150
2151 pub fn set_control<T>(mut self, v: T) -> Self
2155 where
2156 T: std::convert::Into<crate::model::Control>,
2157 {
2158 self.0.request.control = std::option::Option::Some(v.into());
2159 self
2160 }
2161
2162 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2166 where
2167 T: std::convert::Into<crate::model::Control>,
2168 {
2169 self.0.request.control = v.map(|x| x.into());
2170 self
2171 }
2172
2173 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2177 self.0.request.control_id = v.into();
2178 self
2179 }
2180 }
2181
2182 #[doc(hidden)]
2183 impl crate::RequestBuilder for CreateControl {
2184 fn request_options(&mut self) -> &mut crate::RequestOptions {
2185 &mut self.0.options
2186 }
2187 }
2188
2189 #[derive(Clone, Debug)]
2206 pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2207
2208 impl DeleteControl {
2209 pub(crate) fn new(
2210 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2211 ) -> Self {
2212 Self(RequestBuilder::new(stub))
2213 }
2214
2215 pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2217 self.0.request = v.into();
2218 self
2219 }
2220
2221 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2223 self.0.options = v.into();
2224 self
2225 }
2226
2227 pub async fn send(self) -> Result<()> {
2229 (*self.0.stub)
2230 .delete_control(self.0.request, self.0.options)
2231 .await
2232 .map(crate::Response::into_body)
2233 }
2234
2235 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2239 self.0.request.name = v.into();
2240 self
2241 }
2242 }
2243
2244 #[doc(hidden)]
2245 impl crate::RequestBuilder for DeleteControl {
2246 fn request_options(&mut self) -> &mut crate::RequestOptions {
2247 &mut self.0.options
2248 }
2249 }
2250
2251 #[derive(Clone, Debug)]
2268 pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2269
2270 impl UpdateControl {
2271 pub(crate) fn new(
2272 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2273 ) -> Self {
2274 Self(RequestBuilder::new(stub))
2275 }
2276
2277 pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2279 self.0.request = v.into();
2280 self
2281 }
2282
2283 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2285 self.0.options = v.into();
2286 self
2287 }
2288
2289 pub async fn send(self) -> Result<crate::model::Control> {
2291 (*self.0.stub)
2292 .update_control(self.0.request, self.0.options)
2293 .await
2294 .map(crate::Response::into_body)
2295 }
2296
2297 pub fn set_control<T>(mut self, v: T) -> Self
2301 where
2302 T: std::convert::Into<crate::model::Control>,
2303 {
2304 self.0.request.control = std::option::Option::Some(v.into());
2305 self
2306 }
2307
2308 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2312 where
2313 T: std::convert::Into<crate::model::Control>,
2314 {
2315 self.0.request.control = v.map(|x| x.into());
2316 self
2317 }
2318
2319 pub fn set_update_mask<T>(mut self, v: T) -> Self
2321 where
2322 T: std::convert::Into<wkt::FieldMask>,
2323 {
2324 self.0.request.update_mask = std::option::Option::Some(v.into());
2325 self
2326 }
2327
2328 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2330 where
2331 T: std::convert::Into<wkt::FieldMask>,
2332 {
2333 self.0.request.update_mask = v.map(|x| x.into());
2334 self
2335 }
2336 }
2337
2338 #[doc(hidden)]
2339 impl crate::RequestBuilder for UpdateControl {
2340 fn request_options(&mut self) -> &mut crate::RequestOptions {
2341 &mut self.0.options
2342 }
2343 }
2344
2345 #[derive(Clone, Debug)]
2362 pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2363
2364 impl GetControl {
2365 pub(crate) fn new(
2366 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2367 ) -> Self {
2368 Self(RequestBuilder::new(stub))
2369 }
2370
2371 pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2373 self.0.request = v.into();
2374 self
2375 }
2376
2377 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2379 self.0.options = v.into();
2380 self
2381 }
2382
2383 pub async fn send(self) -> Result<crate::model::Control> {
2385 (*self.0.stub)
2386 .get_control(self.0.request, self.0.options)
2387 .await
2388 .map(crate::Response::into_body)
2389 }
2390
2391 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2395 self.0.request.name = v.into();
2396 self
2397 }
2398 }
2399
2400 #[doc(hidden)]
2401 impl crate::RequestBuilder for GetControl {
2402 fn request_options(&mut self) -> &mut crate::RequestOptions {
2403 &mut self.0.options
2404 }
2405 }
2406
2407 #[derive(Clone, Debug)]
2428 pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2429
2430 impl ListControls {
2431 pub(crate) fn new(
2432 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2433 ) -> Self {
2434 Self(RequestBuilder::new(stub))
2435 }
2436
2437 pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2439 self.0.request = v.into();
2440 self
2441 }
2442
2443 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2445 self.0.options = v.into();
2446 self
2447 }
2448
2449 pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2451 (*self.0.stub)
2452 .list_controls(self.0.request, self.0.options)
2453 .await
2454 .map(crate::Response::into_body)
2455 }
2456
2457 pub fn by_page(
2459 self,
2460 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListControlsResponse, crate::Error>
2461 {
2462 use std::clone::Clone;
2463 let token = self.0.request.page_token.clone();
2464 let execute = move |token: String| {
2465 let mut builder = self.clone();
2466 builder.0.request = builder.0.request.set_page_token(token);
2467 builder.send()
2468 };
2469 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2470 }
2471
2472 pub fn by_item(
2474 self,
2475 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2476 crate::model::ListControlsResponse,
2477 crate::Error,
2478 > {
2479 use google_cloud_gax::paginator::Paginator;
2480 self.by_page().items()
2481 }
2482
2483 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2487 self.0.request.parent = v.into();
2488 self
2489 }
2490
2491 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2493 self.0.request.page_size = v.into();
2494 self
2495 }
2496
2497 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2499 self.0.request.page_token = v.into();
2500 self
2501 }
2502
2503 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2505 self.0.request.filter = v.into();
2506 self
2507 }
2508 }
2509
2510 #[doc(hidden)]
2511 impl crate::RequestBuilder for ListControls {
2512 fn request_options(&mut self) -> &mut crate::RequestOptions {
2513 &mut self.0.options
2514 }
2515 }
2516
2517 #[derive(Clone, Debug)]
2538 pub struct ListOperations(
2539 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2540 );
2541
2542 impl ListOperations {
2543 pub(crate) fn new(
2544 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2545 ) -> Self {
2546 Self(RequestBuilder::new(stub))
2547 }
2548
2549 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2551 mut self,
2552 v: V,
2553 ) -> Self {
2554 self.0.request = v.into();
2555 self
2556 }
2557
2558 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2560 self.0.options = v.into();
2561 self
2562 }
2563
2564 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2566 (*self.0.stub)
2567 .list_operations(self.0.request, self.0.options)
2568 .await
2569 .map(crate::Response::into_body)
2570 }
2571
2572 pub fn by_page(
2574 self,
2575 ) -> impl google_cloud_gax::paginator::Paginator<
2576 google_cloud_longrunning::model::ListOperationsResponse,
2577 crate::Error,
2578 > {
2579 use std::clone::Clone;
2580 let token = self.0.request.page_token.clone();
2581 let execute = move |token: String| {
2582 let mut builder = self.clone();
2583 builder.0.request = builder.0.request.set_page_token(token);
2584 builder.send()
2585 };
2586 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2587 }
2588
2589 pub fn by_item(
2591 self,
2592 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2593 google_cloud_longrunning::model::ListOperationsResponse,
2594 crate::Error,
2595 > {
2596 use google_cloud_gax::paginator::Paginator;
2597 self.by_page().items()
2598 }
2599
2600 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2602 self.0.request.name = v.into();
2603 self
2604 }
2605
2606 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2608 self.0.request.filter = v.into();
2609 self
2610 }
2611
2612 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2614 self.0.request.page_size = v.into();
2615 self
2616 }
2617
2618 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2620 self.0.request.page_token = v.into();
2621 self
2622 }
2623
2624 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2626 self.0.request.return_partial_success = v.into();
2627 self
2628 }
2629 }
2630
2631 #[doc(hidden)]
2632 impl crate::RequestBuilder for ListOperations {
2633 fn request_options(&mut self) -> &mut crate::RequestOptions {
2634 &mut self.0.options
2635 }
2636 }
2637
2638 #[derive(Clone, Debug)]
2655 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2656
2657 impl GetOperation {
2658 pub(crate) fn new(
2659 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2660 ) -> Self {
2661 Self(RequestBuilder::new(stub))
2662 }
2663
2664 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2666 mut self,
2667 v: V,
2668 ) -> Self {
2669 self.0.request = v.into();
2670 self
2671 }
2672
2673 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2675 self.0.options = v.into();
2676 self
2677 }
2678
2679 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2681 (*self.0.stub)
2682 .get_operation(self.0.request, self.0.options)
2683 .await
2684 .map(crate::Response::into_body)
2685 }
2686
2687 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2689 self.0.request.name = v.into();
2690 self
2691 }
2692 }
2693
2694 #[doc(hidden)]
2695 impl crate::RequestBuilder for GetOperation {
2696 fn request_options(&mut self) -> &mut crate::RequestOptions {
2697 &mut self.0.options
2698 }
2699 }
2700
2701 #[derive(Clone, Debug)]
2718 pub struct CancelOperation(
2719 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2720 );
2721
2722 impl CancelOperation {
2723 pub(crate) fn new(
2724 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2725 ) -> Self {
2726 Self(RequestBuilder::new(stub))
2727 }
2728
2729 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2731 mut self,
2732 v: V,
2733 ) -> Self {
2734 self.0.request = v.into();
2735 self
2736 }
2737
2738 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2740 self.0.options = v.into();
2741 self
2742 }
2743
2744 pub async fn send(self) -> Result<()> {
2746 (*self.0.stub)
2747 .cancel_operation(self.0.request, self.0.options)
2748 .await
2749 .map(crate::Response::into_body)
2750 }
2751
2752 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2754 self.0.request.name = v.into();
2755 self
2756 }
2757 }
2758
2759 #[doc(hidden)]
2760 impl crate::RequestBuilder for CancelOperation {
2761 fn request_options(&mut self) -> &mut crate::RequestOptions {
2762 &mut self.0.options
2763 }
2764 }
2765}
2766
2767#[cfg(feature = "conversational-search-service")]
2769#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2770pub mod conversational_search_service {
2771 use crate::Result;
2772
2773 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2787
2788 pub(crate) mod client {
2789 use super::super::super::client::ConversationalSearchService;
2790 pub struct Factory;
2791 impl crate::ClientFactory for Factory {
2792 type Client = ConversationalSearchService;
2793 type Credentials = gaxi::options::Credentials;
2794 async fn build(
2795 self,
2796 config: gaxi::options::ClientConfig,
2797 ) -> crate::ClientBuilderResult<Self::Client> {
2798 Self::Client::new(config).await
2799 }
2800 }
2801 }
2802
2803 #[derive(Clone, Debug)]
2805 pub(crate) struct RequestBuilder<R: std::default::Default> {
2806 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2807 request: R,
2808 options: crate::RequestOptions,
2809 }
2810
2811 impl<R> RequestBuilder<R>
2812 where
2813 R: std::default::Default,
2814 {
2815 pub(crate) fn new(
2816 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2817 ) -> Self {
2818 Self {
2819 stub,
2820 request: R::default(),
2821 options: crate::RequestOptions::default(),
2822 }
2823 }
2824 }
2825
2826 #[derive(Clone, Debug)]
2843 pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
2844
2845 impl ConverseConversation {
2846 pub(crate) fn new(
2847 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2848 ) -> Self {
2849 Self(RequestBuilder::new(stub))
2850 }
2851
2852 pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
2854 mut self,
2855 v: V,
2856 ) -> Self {
2857 self.0.request = v.into();
2858 self
2859 }
2860
2861 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2863 self.0.options = v.into();
2864 self
2865 }
2866
2867 pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
2869 (*self.0.stub)
2870 .converse_conversation(self.0.request, self.0.options)
2871 .await
2872 .map(crate::Response::into_body)
2873 }
2874
2875 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2879 self.0.request.name = v.into();
2880 self
2881 }
2882
2883 pub fn set_query<T>(mut self, v: T) -> Self
2887 where
2888 T: std::convert::Into<crate::model::TextInput>,
2889 {
2890 self.0.request.query = std::option::Option::Some(v.into());
2891 self
2892 }
2893
2894 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
2898 where
2899 T: std::convert::Into<crate::model::TextInput>,
2900 {
2901 self.0.request.query = v.map(|x| x.into());
2902 self
2903 }
2904
2905 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2907 self.0.request.serving_config = v.into();
2908 self
2909 }
2910
2911 pub fn set_conversation<T>(mut self, v: T) -> Self
2913 where
2914 T: std::convert::Into<crate::model::Conversation>,
2915 {
2916 self.0.request.conversation = std::option::Option::Some(v.into());
2917 self
2918 }
2919
2920 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2922 where
2923 T: std::convert::Into<crate::model::Conversation>,
2924 {
2925 self.0.request.conversation = v.map(|x| x.into());
2926 self
2927 }
2928
2929 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
2931 self.0.request.safe_search = v.into();
2932 self
2933 }
2934
2935 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
2937 where
2938 T: std::iter::IntoIterator<Item = (K, V)>,
2939 K: std::convert::Into<std::string::String>,
2940 V: std::convert::Into<std::string::String>,
2941 {
2942 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2943 self
2944 }
2945
2946 pub fn set_summary_spec<T>(mut self, v: T) -> Self
2948 where
2949 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2950 {
2951 self.0.request.summary_spec = std::option::Option::Some(v.into());
2952 self
2953 }
2954
2955 pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
2957 where
2958 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2959 {
2960 self.0.request.summary_spec = v.map(|x| x.into());
2961 self
2962 }
2963
2964 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2966 self.0.request.filter = v.into();
2967 self
2968 }
2969
2970 pub fn set_boost_spec<T>(mut self, v: T) -> Self
2972 where
2973 T: std::convert::Into<crate::model::search_request::BoostSpec>,
2974 {
2975 self.0.request.boost_spec = std::option::Option::Some(v.into());
2976 self
2977 }
2978
2979 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
2981 where
2982 T: std::convert::Into<crate::model::search_request::BoostSpec>,
2983 {
2984 self.0.request.boost_spec = v.map(|x| x.into());
2985 self
2986 }
2987 }
2988
2989 #[doc(hidden)]
2990 impl crate::RequestBuilder for ConverseConversation {
2991 fn request_options(&mut self) -> &mut crate::RequestOptions {
2992 &mut self.0.options
2993 }
2994 }
2995
2996 #[derive(Clone, Debug)]
3013 pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
3014
3015 impl CreateConversation {
3016 pub(crate) fn new(
3017 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3018 ) -> Self {
3019 Self(RequestBuilder::new(stub))
3020 }
3021
3022 pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
3024 mut self,
3025 v: V,
3026 ) -> Self {
3027 self.0.request = v.into();
3028 self
3029 }
3030
3031 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3033 self.0.options = v.into();
3034 self
3035 }
3036
3037 pub async fn send(self) -> Result<crate::model::Conversation> {
3039 (*self.0.stub)
3040 .create_conversation(self.0.request, self.0.options)
3041 .await
3042 .map(crate::Response::into_body)
3043 }
3044
3045 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3049 self.0.request.parent = v.into();
3050 self
3051 }
3052
3053 pub fn set_conversation<T>(mut self, v: T) -> Self
3057 where
3058 T: std::convert::Into<crate::model::Conversation>,
3059 {
3060 self.0.request.conversation = std::option::Option::Some(v.into());
3061 self
3062 }
3063
3064 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3068 where
3069 T: std::convert::Into<crate::model::Conversation>,
3070 {
3071 self.0.request.conversation = v.map(|x| x.into());
3072 self
3073 }
3074 }
3075
3076 #[doc(hidden)]
3077 impl crate::RequestBuilder for CreateConversation {
3078 fn request_options(&mut self) -> &mut crate::RequestOptions {
3079 &mut self.0.options
3080 }
3081 }
3082
3083 #[derive(Clone, Debug)]
3100 pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
3101
3102 impl DeleteConversation {
3103 pub(crate) fn new(
3104 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3105 ) -> Self {
3106 Self(RequestBuilder::new(stub))
3107 }
3108
3109 pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3111 mut self,
3112 v: V,
3113 ) -> Self {
3114 self.0.request = v.into();
3115 self
3116 }
3117
3118 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3120 self.0.options = v.into();
3121 self
3122 }
3123
3124 pub async fn send(self) -> Result<()> {
3126 (*self.0.stub)
3127 .delete_conversation(self.0.request, self.0.options)
3128 .await
3129 .map(crate::Response::into_body)
3130 }
3131
3132 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3136 self.0.request.name = v.into();
3137 self
3138 }
3139 }
3140
3141 #[doc(hidden)]
3142 impl crate::RequestBuilder for DeleteConversation {
3143 fn request_options(&mut self) -> &mut crate::RequestOptions {
3144 &mut self.0.options
3145 }
3146 }
3147
3148 #[derive(Clone, Debug)]
3165 pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3166
3167 impl UpdateConversation {
3168 pub(crate) fn new(
3169 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3170 ) -> Self {
3171 Self(RequestBuilder::new(stub))
3172 }
3173
3174 pub fn with_request<V: Into<crate::model::UpdateConversationRequest>>(
3176 mut self,
3177 v: V,
3178 ) -> Self {
3179 self.0.request = v.into();
3180 self
3181 }
3182
3183 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3185 self.0.options = v.into();
3186 self
3187 }
3188
3189 pub async fn send(self) -> Result<crate::model::Conversation> {
3191 (*self.0.stub)
3192 .update_conversation(self.0.request, self.0.options)
3193 .await
3194 .map(crate::Response::into_body)
3195 }
3196
3197 pub fn set_conversation<T>(mut self, v: T) -> Self
3201 where
3202 T: std::convert::Into<crate::model::Conversation>,
3203 {
3204 self.0.request.conversation = std::option::Option::Some(v.into());
3205 self
3206 }
3207
3208 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3212 where
3213 T: std::convert::Into<crate::model::Conversation>,
3214 {
3215 self.0.request.conversation = v.map(|x| x.into());
3216 self
3217 }
3218
3219 pub fn set_update_mask<T>(mut self, v: T) -> Self
3221 where
3222 T: std::convert::Into<wkt::FieldMask>,
3223 {
3224 self.0.request.update_mask = std::option::Option::Some(v.into());
3225 self
3226 }
3227
3228 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3230 where
3231 T: std::convert::Into<wkt::FieldMask>,
3232 {
3233 self.0.request.update_mask = v.map(|x| x.into());
3234 self
3235 }
3236 }
3237
3238 #[doc(hidden)]
3239 impl crate::RequestBuilder for UpdateConversation {
3240 fn request_options(&mut self) -> &mut crate::RequestOptions {
3241 &mut self.0.options
3242 }
3243 }
3244
3245 #[derive(Clone, Debug)]
3262 pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3263
3264 impl GetConversation {
3265 pub(crate) fn new(
3266 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3267 ) -> Self {
3268 Self(RequestBuilder::new(stub))
3269 }
3270
3271 pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3273 self.0.request = v.into();
3274 self
3275 }
3276
3277 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3279 self.0.options = v.into();
3280 self
3281 }
3282
3283 pub async fn send(self) -> Result<crate::model::Conversation> {
3285 (*self.0.stub)
3286 .get_conversation(self.0.request, self.0.options)
3287 .await
3288 .map(crate::Response::into_body)
3289 }
3290
3291 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3295 self.0.request.name = v.into();
3296 self
3297 }
3298 }
3299
3300 #[doc(hidden)]
3301 impl crate::RequestBuilder for GetConversation {
3302 fn request_options(&mut self) -> &mut crate::RequestOptions {
3303 &mut self.0.options
3304 }
3305 }
3306
3307 #[derive(Clone, Debug)]
3328 pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3329
3330 impl ListConversations {
3331 pub(crate) fn new(
3332 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3333 ) -> Self {
3334 Self(RequestBuilder::new(stub))
3335 }
3336
3337 pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3339 mut self,
3340 v: V,
3341 ) -> Self {
3342 self.0.request = v.into();
3343 self
3344 }
3345
3346 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3348 self.0.options = v.into();
3349 self
3350 }
3351
3352 pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3354 (*self.0.stub)
3355 .list_conversations(self.0.request, self.0.options)
3356 .await
3357 .map(crate::Response::into_body)
3358 }
3359
3360 pub fn by_page(
3362 self,
3363 ) -> impl google_cloud_gax::paginator::Paginator<
3364 crate::model::ListConversationsResponse,
3365 crate::Error,
3366 > {
3367 use std::clone::Clone;
3368 let token = self.0.request.page_token.clone();
3369 let execute = move |token: String| {
3370 let mut builder = self.clone();
3371 builder.0.request = builder.0.request.set_page_token(token);
3372 builder.send()
3373 };
3374 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3375 }
3376
3377 pub fn by_item(
3379 self,
3380 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3381 crate::model::ListConversationsResponse,
3382 crate::Error,
3383 > {
3384 use google_cloud_gax::paginator::Paginator;
3385 self.by_page().items()
3386 }
3387
3388 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3392 self.0.request.parent = v.into();
3393 self
3394 }
3395
3396 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3398 self.0.request.page_size = v.into();
3399 self
3400 }
3401
3402 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3404 self.0.request.page_token = v.into();
3405 self
3406 }
3407
3408 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3410 self.0.request.filter = v.into();
3411 self
3412 }
3413
3414 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3416 self.0.request.order_by = v.into();
3417 self
3418 }
3419 }
3420
3421 #[doc(hidden)]
3422 impl crate::RequestBuilder for ListConversations {
3423 fn request_options(&mut self) -> &mut crate::RequestOptions {
3424 &mut self.0.options
3425 }
3426 }
3427
3428 #[derive(Clone, Debug)]
3445 pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3446
3447 impl AnswerQuery {
3448 pub(crate) fn new(
3449 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3450 ) -> Self {
3451 Self(RequestBuilder::new(stub))
3452 }
3453
3454 pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3456 self.0.request = v.into();
3457 self
3458 }
3459
3460 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3462 self.0.options = v.into();
3463 self
3464 }
3465
3466 pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3468 (*self.0.stub)
3469 .answer_query(self.0.request, self.0.options)
3470 .await
3471 .map(crate::Response::into_body)
3472 }
3473
3474 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3478 self.0.request.serving_config = v.into();
3479 self
3480 }
3481
3482 pub fn set_query<T>(mut self, v: T) -> Self
3486 where
3487 T: std::convert::Into<crate::model::Query>,
3488 {
3489 self.0.request.query = std::option::Option::Some(v.into());
3490 self
3491 }
3492
3493 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3497 where
3498 T: std::convert::Into<crate::model::Query>,
3499 {
3500 self.0.request.query = v.map(|x| x.into());
3501 self
3502 }
3503
3504 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3506 self.0.request.session = v.into();
3507 self
3508 }
3509
3510 pub fn set_safety_spec<T>(mut self, v: T) -> Self
3512 where
3513 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3514 {
3515 self.0.request.safety_spec = std::option::Option::Some(v.into());
3516 self
3517 }
3518
3519 pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3521 where
3522 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3523 {
3524 self.0.request.safety_spec = v.map(|x| x.into());
3525 self
3526 }
3527
3528 pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3530 where
3531 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3532 {
3533 self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3534 self
3535 }
3536
3537 pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3539 where
3540 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3541 {
3542 self.0.request.related_questions_spec = v.map(|x| x.into());
3543 self
3544 }
3545
3546 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3548 where
3549 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3550 {
3551 self.0.request.grounding_spec = std::option::Option::Some(v.into());
3552 self
3553 }
3554
3555 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3557 where
3558 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3559 {
3560 self.0.request.grounding_spec = v.map(|x| x.into());
3561 self
3562 }
3563
3564 pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3566 where
3567 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3568 {
3569 self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3570 self
3571 }
3572
3573 pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3575 where
3576 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3577 {
3578 self.0.request.answer_generation_spec = v.map(|x| x.into());
3579 self
3580 }
3581
3582 pub fn set_search_spec<T>(mut self, v: T) -> Self
3584 where
3585 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3586 {
3587 self.0.request.search_spec = std::option::Option::Some(v.into());
3588 self
3589 }
3590
3591 pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3593 where
3594 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3595 {
3596 self.0.request.search_spec = v.map(|x| x.into());
3597 self
3598 }
3599
3600 pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3602 where
3603 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3604 {
3605 self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3606 self
3607 }
3608
3609 pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3611 where
3612 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3613 {
3614 self.0.request.query_understanding_spec = v.map(|x| x.into());
3615 self
3616 }
3617
3618 #[deprecated]
3620 pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3621 self.0.request.asynchronous_mode = v.into();
3622 self
3623 }
3624
3625 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3627 self.0.request.user_pseudo_id = v.into();
3628 self
3629 }
3630
3631 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3633 where
3634 T: std::iter::IntoIterator<Item = (K, V)>,
3635 K: std::convert::Into<std::string::String>,
3636 V: std::convert::Into<std::string::String>,
3637 {
3638 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3639 self
3640 }
3641
3642 pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3644 where
3645 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3646 {
3647 self.0.request.end_user_spec = std::option::Option::Some(v.into());
3648 self
3649 }
3650
3651 pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3653 where
3654 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3655 {
3656 self.0.request.end_user_spec = v.map(|x| x.into());
3657 self
3658 }
3659 }
3660
3661 #[doc(hidden)]
3662 impl crate::RequestBuilder for AnswerQuery {
3663 fn request_options(&mut self) -> &mut crate::RequestOptions {
3664 &mut self.0.options
3665 }
3666 }
3667
3668 #[derive(Clone, Debug)]
3685 pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
3686
3687 impl GetAnswer {
3688 pub(crate) fn new(
3689 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3690 ) -> Self {
3691 Self(RequestBuilder::new(stub))
3692 }
3693
3694 pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
3696 self.0.request = v.into();
3697 self
3698 }
3699
3700 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3702 self.0.options = v.into();
3703 self
3704 }
3705
3706 pub async fn send(self) -> Result<crate::model::Answer> {
3708 (*self.0.stub)
3709 .get_answer(self.0.request, self.0.options)
3710 .await
3711 .map(crate::Response::into_body)
3712 }
3713
3714 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3718 self.0.request.name = v.into();
3719 self
3720 }
3721 }
3722
3723 #[doc(hidden)]
3724 impl crate::RequestBuilder for GetAnswer {
3725 fn request_options(&mut self) -> &mut crate::RequestOptions {
3726 &mut self.0.options
3727 }
3728 }
3729
3730 #[derive(Clone, Debug)]
3747 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
3748
3749 impl CreateSession {
3750 pub(crate) fn new(
3751 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3752 ) -> Self {
3753 Self(RequestBuilder::new(stub))
3754 }
3755
3756 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
3758 self.0.request = v.into();
3759 self
3760 }
3761
3762 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3764 self.0.options = v.into();
3765 self
3766 }
3767
3768 pub async fn send(self) -> Result<crate::model::Session> {
3770 (*self.0.stub)
3771 .create_session(self.0.request, self.0.options)
3772 .await
3773 .map(crate::Response::into_body)
3774 }
3775
3776 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3780 self.0.request.parent = v.into();
3781 self
3782 }
3783
3784 pub fn set_session<T>(mut self, v: T) -> Self
3788 where
3789 T: std::convert::Into<crate::model::Session>,
3790 {
3791 self.0.request.session = std::option::Option::Some(v.into());
3792 self
3793 }
3794
3795 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3799 where
3800 T: std::convert::Into<crate::model::Session>,
3801 {
3802 self.0.request.session = v.map(|x| x.into());
3803 self
3804 }
3805 }
3806
3807 #[doc(hidden)]
3808 impl crate::RequestBuilder for CreateSession {
3809 fn request_options(&mut self) -> &mut crate::RequestOptions {
3810 &mut self.0.options
3811 }
3812 }
3813
3814 #[derive(Clone, Debug)]
3831 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
3832
3833 impl DeleteSession {
3834 pub(crate) fn new(
3835 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3836 ) -> Self {
3837 Self(RequestBuilder::new(stub))
3838 }
3839
3840 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
3842 self.0.request = v.into();
3843 self
3844 }
3845
3846 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3848 self.0.options = v.into();
3849 self
3850 }
3851
3852 pub async fn send(self) -> Result<()> {
3854 (*self.0.stub)
3855 .delete_session(self.0.request, self.0.options)
3856 .await
3857 .map(crate::Response::into_body)
3858 }
3859
3860 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3864 self.0.request.name = v.into();
3865 self
3866 }
3867 }
3868
3869 #[doc(hidden)]
3870 impl crate::RequestBuilder for DeleteSession {
3871 fn request_options(&mut self) -> &mut crate::RequestOptions {
3872 &mut self.0.options
3873 }
3874 }
3875
3876 #[derive(Clone, Debug)]
3893 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
3894
3895 impl UpdateSession {
3896 pub(crate) fn new(
3897 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3898 ) -> Self {
3899 Self(RequestBuilder::new(stub))
3900 }
3901
3902 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
3904 self.0.request = v.into();
3905 self
3906 }
3907
3908 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3910 self.0.options = v.into();
3911 self
3912 }
3913
3914 pub async fn send(self) -> Result<crate::model::Session> {
3916 (*self.0.stub)
3917 .update_session(self.0.request, self.0.options)
3918 .await
3919 .map(crate::Response::into_body)
3920 }
3921
3922 pub fn set_session<T>(mut self, v: T) -> Self
3926 where
3927 T: std::convert::Into<crate::model::Session>,
3928 {
3929 self.0.request.session = std::option::Option::Some(v.into());
3930 self
3931 }
3932
3933 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3937 where
3938 T: std::convert::Into<crate::model::Session>,
3939 {
3940 self.0.request.session = v.map(|x| x.into());
3941 self
3942 }
3943
3944 pub fn set_update_mask<T>(mut self, v: T) -> Self
3946 where
3947 T: std::convert::Into<wkt::FieldMask>,
3948 {
3949 self.0.request.update_mask = std::option::Option::Some(v.into());
3950 self
3951 }
3952
3953 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3955 where
3956 T: std::convert::Into<wkt::FieldMask>,
3957 {
3958 self.0.request.update_mask = v.map(|x| x.into());
3959 self
3960 }
3961 }
3962
3963 #[doc(hidden)]
3964 impl crate::RequestBuilder for UpdateSession {
3965 fn request_options(&mut self) -> &mut crate::RequestOptions {
3966 &mut self.0.options
3967 }
3968 }
3969
3970 #[derive(Clone, Debug)]
3987 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
3988
3989 impl GetSession {
3990 pub(crate) fn new(
3991 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3992 ) -> Self {
3993 Self(RequestBuilder::new(stub))
3994 }
3995
3996 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
3998 self.0.request = v.into();
3999 self
4000 }
4001
4002 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4004 self.0.options = v.into();
4005 self
4006 }
4007
4008 pub async fn send(self) -> Result<crate::model::Session> {
4010 (*self.0.stub)
4011 .get_session(self.0.request, self.0.options)
4012 .await
4013 .map(crate::Response::into_body)
4014 }
4015
4016 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4020 self.0.request.name = v.into();
4021 self
4022 }
4023
4024 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
4026 self.0.request.include_answer_details = v.into();
4027 self
4028 }
4029 }
4030
4031 #[doc(hidden)]
4032 impl crate::RequestBuilder for GetSession {
4033 fn request_options(&mut self) -> &mut crate::RequestOptions {
4034 &mut self.0.options
4035 }
4036 }
4037
4038 #[derive(Clone, Debug)]
4059 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
4060
4061 impl ListSessions {
4062 pub(crate) fn new(
4063 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4064 ) -> Self {
4065 Self(RequestBuilder::new(stub))
4066 }
4067
4068 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
4070 self.0.request = v.into();
4071 self
4072 }
4073
4074 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4076 self.0.options = v.into();
4077 self
4078 }
4079
4080 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
4082 (*self.0.stub)
4083 .list_sessions(self.0.request, self.0.options)
4084 .await
4085 .map(crate::Response::into_body)
4086 }
4087
4088 pub fn by_page(
4090 self,
4091 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
4092 {
4093 use std::clone::Clone;
4094 let token = self.0.request.page_token.clone();
4095 let execute = move |token: String| {
4096 let mut builder = self.clone();
4097 builder.0.request = builder.0.request.set_page_token(token);
4098 builder.send()
4099 };
4100 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4101 }
4102
4103 pub fn by_item(
4105 self,
4106 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4107 crate::model::ListSessionsResponse,
4108 crate::Error,
4109 > {
4110 use google_cloud_gax::paginator::Paginator;
4111 self.by_page().items()
4112 }
4113
4114 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4118 self.0.request.parent = v.into();
4119 self
4120 }
4121
4122 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4124 self.0.request.page_size = v.into();
4125 self
4126 }
4127
4128 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4130 self.0.request.page_token = v.into();
4131 self
4132 }
4133
4134 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4136 self.0.request.filter = v.into();
4137 self
4138 }
4139
4140 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4142 self.0.request.order_by = v.into();
4143 self
4144 }
4145 }
4146
4147 #[doc(hidden)]
4148 impl crate::RequestBuilder for ListSessions {
4149 fn request_options(&mut self) -> &mut crate::RequestOptions {
4150 &mut self.0.options
4151 }
4152 }
4153
4154 #[derive(Clone, Debug)]
4175 pub struct ListOperations(
4176 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4177 );
4178
4179 impl ListOperations {
4180 pub(crate) fn new(
4181 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4182 ) -> Self {
4183 Self(RequestBuilder::new(stub))
4184 }
4185
4186 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4188 mut self,
4189 v: V,
4190 ) -> Self {
4191 self.0.request = v.into();
4192 self
4193 }
4194
4195 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4197 self.0.options = v.into();
4198 self
4199 }
4200
4201 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4203 (*self.0.stub)
4204 .list_operations(self.0.request, self.0.options)
4205 .await
4206 .map(crate::Response::into_body)
4207 }
4208
4209 pub fn by_page(
4211 self,
4212 ) -> impl google_cloud_gax::paginator::Paginator<
4213 google_cloud_longrunning::model::ListOperationsResponse,
4214 crate::Error,
4215 > {
4216 use std::clone::Clone;
4217 let token = self.0.request.page_token.clone();
4218 let execute = move |token: String| {
4219 let mut builder = self.clone();
4220 builder.0.request = builder.0.request.set_page_token(token);
4221 builder.send()
4222 };
4223 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4224 }
4225
4226 pub fn by_item(
4228 self,
4229 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4230 google_cloud_longrunning::model::ListOperationsResponse,
4231 crate::Error,
4232 > {
4233 use google_cloud_gax::paginator::Paginator;
4234 self.by_page().items()
4235 }
4236
4237 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4239 self.0.request.name = v.into();
4240 self
4241 }
4242
4243 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4245 self.0.request.filter = v.into();
4246 self
4247 }
4248
4249 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4251 self.0.request.page_size = v.into();
4252 self
4253 }
4254
4255 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4257 self.0.request.page_token = v.into();
4258 self
4259 }
4260
4261 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4263 self.0.request.return_partial_success = v.into();
4264 self
4265 }
4266 }
4267
4268 #[doc(hidden)]
4269 impl crate::RequestBuilder for ListOperations {
4270 fn request_options(&mut self) -> &mut crate::RequestOptions {
4271 &mut self.0.options
4272 }
4273 }
4274
4275 #[derive(Clone, Debug)]
4292 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4293
4294 impl GetOperation {
4295 pub(crate) fn new(
4296 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4297 ) -> Self {
4298 Self(RequestBuilder::new(stub))
4299 }
4300
4301 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4303 mut self,
4304 v: V,
4305 ) -> Self {
4306 self.0.request = v.into();
4307 self
4308 }
4309
4310 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4312 self.0.options = v.into();
4313 self
4314 }
4315
4316 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4318 (*self.0.stub)
4319 .get_operation(self.0.request, self.0.options)
4320 .await
4321 .map(crate::Response::into_body)
4322 }
4323
4324 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4326 self.0.request.name = v.into();
4327 self
4328 }
4329 }
4330
4331 #[doc(hidden)]
4332 impl crate::RequestBuilder for GetOperation {
4333 fn request_options(&mut self) -> &mut crate::RequestOptions {
4334 &mut self.0.options
4335 }
4336 }
4337
4338 #[derive(Clone, Debug)]
4355 pub struct CancelOperation(
4356 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
4357 );
4358
4359 impl CancelOperation {
4360 pub(crate) fn new(
4361 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4362 ) -> Self {
4363 Self(RequestBuilder::new(stub))
4364 }
4365
4366 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
4368 mut self,
4369 v: V,
4370 ) -> Self {
4371 self.0.request = v.into();
4372 self
4373 }
4374
4375 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4377 self.0.options = v.into();
4378 self
4379 }
4380
4381 pub async fn send(self) -> Result<()> {
4383 (*self.0.stub)
4384 .cancel_operation(self.0.request, self.0.options)
4385 .await
4386 .map(crate::Response::into_body)
4387 }
4388
4389 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4391 self.0.request.name = v.into();
4392 self
4393 }
4394 }
4395
4396 #[doc(hidden)]
4397 impl crate::RequestBuilder for CancelOperation {
4398 fn request_options(&mut self) -> &mut crate::RequestOptions {
4399 &mut self.0.options
4400 }
4401 }
4402}
4403
4404#[cfg(feature = "data-store-service")]
4406#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4407pub mod data_store_service {
4408 use crate::Result;
4409
4410 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4424
4425 pub(crate) mod client {
4426 use super::super::super::client::DataStoreService;
4427 pub struct Factory;
4428 impl crate::ClientFactory for Factory {
4429 type Client = DataStoreService;
4430 type Credentials = gaxi::options::Credentials;
4431 async fn build(
4432 self,
4433 config: gaxi::options::ClientConfig,
4434 ) -> crate::ClientBuilderResult<Self::Client> {
4435 Self::Client::new(config).await
4436 }
4437 }
4438 }
4439
4440 #[derive(Clone, Debug)]
4442 pub(crate) struct RequestBuilder<R: std::default::Default> {
4443 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4444 request: R,
4445 options: crate::RequestOptions,
4446 }
4447
4448 impl<R> RequestBuilder<R>
4449 where
4450 R: std::default::Default,
4451 {
4452 pub(crate) fn new(
4453 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4454 ) -> Self {
4455 Self {
4456 stub,
4457 request: R::default(),
4458 options: crate::RequestOptions::default(),
4459 }
4460 }
4461 }
4462
4463 #[derive(Clone, Debug)]
4481 pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4482
4483 impl CreateDataStore {
4484 pub(crate) fn new(
4485 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4486 ) -> Self {
4487 Self(RequestBuilder::new(stub))
4488 }
4489
4490 pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4492 self.0.request = v.into();
4493 self
4494 }
4495
4496 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4498 self.0.options = v.into();
4499 self
4500 }
4501
4502 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4509 (*self.0.stub)
4510 .create_data_store(self.0.request, self.0.options)
4511 .await
4512 .map(crate::Response::into_body)
4513 }
4514
4515 pub fn poller(
4517 self,
4518 ) -> impl google_cloud_lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4519 {
4520 type Operation = google_cloud_lro::internal::Operation<
4521 crate::model::DataStore,
4522 crate::model::CreateDataStoreMetadata,
4523 >;
4524 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4525 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4526 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
4527 if let Some(ref mut details) = poller_options.tracing {
4528 details.method_name = "google_cloud_discoveryengine_v1::client::DataStoreService::create_data_store::until_done";
4529 }
4530
4531 let stub = self.0.stub.clone();
4532 let mut options = self.0.options.clone();
4533 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4534 let query = move |name| {
4535 let stub = stub.clone();
4536 let options = options.clone();
4537 async {
4538 let op = GetOperation::new(stub)
4539 .set_name(name)
4540 .with_options(options)
4541 .send()
4542 .await?;
4543 Ok(Operation::new(op))
4544 }
4545 };
4546
4547 let start = move || async {
4548 let op = self.send().await?;
4549 Ok(Operation::new(op))
4550 };
4551
4552 use google_cloud_lro::internal::PollerExt;
4553 {
4554 google_cloud_lro::internal::new_poller(
4555 polling_error_policy,
4556 polling_backoff_policy,
4557 start,
4558 query,
4559 )
4560 }
4561 .with_options(poller_options)
4562 }
4563
4564 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4568 self.0.request.parent = v.into();
4569 self
4570 }
4571
4572 pub fn set_data_store<T>(mut self, v: T) -> Self
4576 where
4577 T: std::convert::Into<crate::model::DataStore>,
4578 {
4579 self.0.request.data_store = std::option::Option::Some(v.into());
4580 self
4581 }
4582
4583 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4587 where
4588 T: std::convert::Into<crate::model::DataStore>,
4589 {
4590 self.0.request.data_store = v.map(|x| x.into());
4591 self
4592 }
4593
4594 pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4598 self.0.request.data_store_id = v.into();
4599 self
4600 }
4601
4602 pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
4604 self.0.request.create_advanced_site_search = v.into();
4605 self
4606 }
4607
4608 pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
4610 self.0.request.skip_default_schema_creation = v.into();
4611 self
4612 }
4613
4614 pub fn set_cmek_options<
4619 T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
4620 >(
4621 mut self,
4622 v: T,
4623 ) -> Self {
4624 self.0.request.cmek_options = v.into();
4625 self
4626 }
4627
4628 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
4634 mut self,
4635 v: T,
4636 ) -> Self {
4637 self.0.request = self.0.request.set_cmek_config_name(v);
4638 self
4639 }
4640
4641 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4647 self.0.request = self.0.request.set_disable_cmek(v);
4648 self
4649 }
4650 }
4651
4652 #[doc(hidden)]
4653 impl crate::RequestBuilder for CreateDataStore {
4654 fn request_options(&mut self) -> &mut crate::RequestOptions {
4655 &mut self.0.options
4656 }
4657 }
4658
4659 #[derive(Clone, Debug)]
4676 pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
4677
4678 impl GetDataStore {
4679 pub(crate) fn new(
4680 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4681 ) -> Self {
4682 Self(RequestBuilder::new(stub))
4683 }
4684
4685 pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
4687 self.0.request = v.into();
4688 self
4689 }
4690
4691 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4693 self.0.options = v.into();
4694 self
4695 }
4696
4697 pub async fn send(self) -> Result<crate::model::DataStore> {
4699 (*self.0.stub)
4700 .get_data_store(self.0.request, self.0.options)
4701 .await
4702 .map(crate::Response::into_body)
4703 }
4704
4705 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4709 self.0.request.name = v.into();
4710 self
4711 }
4712 }
4713
4714 #[doc(hidden)]
4715 impl crate::RequestBuilder for GetDataStore {
4716 fn request_options(&mut self) -> &mut crate::RequestOptions {
4717 &mut self.0.options
4718 }
4719 }
4720
4721 #[derive(Clone, Debug)]
4742 pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
4743
4744 impl ListDataStores {
4745 pub(crate) fn new(
4746 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4747 ) -> Self {
4748 Self(RequestBuilder::new(stub))
4749 }
4750
4751 pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
4753 self.0.request = v.into();
4754 self
4755 }
4756
4757 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4759 self.0.options = v.into();
4760 self
4761 }
4762
4763 pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
4765 (*self.0.stub)
4766 .list_data_stores(self.0.request, self.0.options)
4767 .await
4768 .map(crate::Response::into_body)
4769 }
4770
4771 pub fn by_page(
4773 self,
4774 ) -> impl google_cloud_gax::paginator::Paginator<
4775 crate::model::ListDataStoresResponse,
4776 crate::Error,
4777 > {
4778 use std::clone::Clone;
4779 let token = self.0.request.page_token.clone();
4780 let execute = move |token: String| {
4781 let mut builder = self.clone();
4782 builder.0.request = builder.0.request.set_page_token(token);
4783 builder.send()
4784 };
4785 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4786 }
4787
4788 pub fn by_item(
4790 self,
4791 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4792 crate::model::ListDataStoresResponse,
4793 crate::Error,
4794 > {
4795 use google_cloud_gax::paginator::Paginator;
4796 self.by_page().items()
4797 }
4798
4799 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4803 self.0.request.parent = v.into();
4804 self
4805 }
4806
4807 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4809 self.0.request.page_size = v.into();
4810 self
4811 }
4812
4813 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4815 self.0.request.page_token = v.into();
4816 self
4817 }
4818
4819 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4821 self.0.request.filter = v.into();
4822 self
4823 }
4824 }
4825
4826 #[doc(hidden)]
4827 impl crate::RequestBuilder for ListDataStores {
4828 fn request_options(&mut self) -> &mut crate::RequestOptions {
4829 &mut self.0.options
4830 }
4831 }
4832
4833 #[derive(Clone, Debug)]
4851 pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
4852
4853 impl DeleteDataStore {
4854 pub(crate) fn new(
4855 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4856 ) -> Self {
4857 Self(RequestBuilder::new(stub))
4858 }
4859
4860 pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
4862 self.0.request = v.into();
4863 self
4864 }
4865
4866 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4868 self.0.options = v.into();
4869 self
4870 }
4871
4872 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4879 (*self.0.stub)
4880 .delete_data_store(self.0.request, self.0.options)
4881 .await
4882 .map(crate::Response::into_body)
4883 }
4884
4885 pub fn poller(
4887 self,
4888 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
4889 type Operation = google_cloud_lro::internal::Operation<
4890 wkt::Empty,
4891 crate::model::DeleteDataStoreMetadata,
4892 >;
4893 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4894 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4895 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
4896 if let Some(ref mut details) = poller_options.tracing {
4897 details.method_name = "google_cloud_discoveryengine_v1::client::DataStoreService::delete_data_store::until_done";
4898 }
4899
4900 let stub = self.0.stub.clone();
4901 let mut options = self.0.options.clone();
4902 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4903 let query = move |name| {
4904 let stub = stub.clone();
4905 let options = options.clone();
4906 async {
4907 let op = GetOperation::new(stub)
4908 .set_name(name)
4909 .with_options(options)
4910 .send()
4911 .await?;
4912 Ok(Operation::new(op))
4913 }
4914 };
4915
4916 let start = move || async {
4917 let op = self.send().await?;
4918 Ok(Operation::new(op))
4919 };
4920
4921 use google_cloud_lro::internal::PollerExt;
4922 {
4923 google_cloud_lro::internal::new_unit_response_poller(
4924 polling_error_policy,
4925 polling_backoff_policy,
4926 start,
4927 query,
4928 )
4929 }
4930 .with_options(poller_options)
4931 }
4932
4933 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4937 self.0.request.name = v.into();
4938 self
4939 }
4940 }
4941
4942 #[doc(hidden)]
4943 impl crate::RequestBuilder for DeleteDataStore {
4944 fn request_options(&mut self) -> &mut crate::RequestOptions {
4945 &mut self.0.options
4946 }
4947 }
4948
4949 #[derive(Clone, Debug)]
4966 pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
4967
4968 impl UpdateDataStore {
4969 pub(crate) fn new(
4970 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4971 ) -> Self {
4972 Self(RequestBuilder::new(stub))
4973 }
4974
4975 pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
4977 self.0.request = v.into();
4978 self
4979 }
4980
4981 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4983 self.0.options = v.into();
4984 self
4985 }
4986
4987 pub async fn send(self) -> Result<crate::model::DataStore> {
4989 (*self.0.stub)
4990 .update_data_store(self.0.request, self.0.options)
4991 .await
4992 .map(crate::Response::into_body)
4993 }
4994
4995 pub fn set_data_store<T>(mut self, v: T) -> Self
4999 where
5000 T: std::convert::Into<crate::model::DataStore>,
5001 {
5002 self.0.request.data_store = std::option::Option::Some(v.into());
5003 self
5004 }
5005
5006 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
5010 where
5011 T: std::convert::Into<crate::model::DataStore>,
5012 {
5013 self.0.request.data_store = v.map(|x| x.into());
5014 self
5015 }
5016
5017 pub fn set_update_mask<T>(mut self, v: T) -> Self
5019 where
5020 T: std::convert::Into<wkt::FieldMask>,
5021 {
5022 self.0.request.update_mask = std::option::Option::Some(v.into());
5023 self
5024 }
5025
5026 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5028 where
5029 T: std::convert::Into<wkt::FieldMask>,
5030 {
5031 self.0.request.update_mask = v.map(|x| x.into());
5032 self
5033 }
5034 }
5035
5036 #[doc(hidden)]
5037 impl crate::RequestBuilder for UpdateDataStore {
5038 fn request_options(&mut self) -> &mut crate::RequestOptions {
5039 &mut self.0.options
5040 }
5041 }
5042
5043 #[derive(Clone, Debug)]
5064 pub struct ListOperations(
5065 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5066 );
5067
5068 impl ListOperations {
5069 pub(crate) fn new(
5070 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5071 ) -> Self {
5072 Self(RequestBuilder::new(stub))
5073 }
5074
5075 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5077 mut self,
5078 v: V,
5079 ) -> Self {
5080 self.0.request = v.into();
5081 self
5082 }
5083
5084 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5086 self.0.options = v.into();
5087 self
5088 }
5089
5090 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5092 (*self.0.stub)
5093 .list_operations(self.0.request, self.0.options)
5094 .await
5095 .map(crate::Response::into_body)
5096 }
5097
5098 pub fn by_page(
5100 self,
5101 ) -> impl google_cloud_gax::paginator::Paginator<
5102 google_cloud_longrunning::model::ListOperationsResponse,
5103 crate::Error,
5104 > {
5105 use std::clone::Clone;
5106 let token = self.0.request.page_token.clone();
5107 let execute = move |token: String| {
5108 let mut builder = self.clone();
5109 builder.0.request = builder.0.request.set_page_token(token);
5110 builder.send()
5111 };
5112 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5113 }
5114
5115 pub fn by_item(
5117 self,
5118 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5119 google_cloud_longrunning::model::ListOperationsResponse,
5120 crate::Error,
5121 > {
5122 use google_cloud_gax::paginator::Paginator;
5123 self.by_page().items()
5124 }
5125
5126 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5128 self.0.request.name = v.into();
5129 self
5130 }
5131
5132 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5134 self.0.request.filter = v.into();
5135 self
5136 }
5137
5138 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5140 self.0.request.page_size = v.into();
5141 self
5142 }
5143
5144 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5146 self.0.request.page_token = v.into();
5147 self
5148 }
5149
5150 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5152 self.0.request.return_partial_success = v.into();
5153 self
5154 }
5155 }
5156
5157 #[doc(hidden)]
5158 impl crate::RequestBuilder for ListOperations {
5159 fn request_options(&mut self) -> &mut crate::RequestOptions {
5160 &mut self.0.options
5161 }
5162 }
5163
5164 #[derive(Clone, Debug)]
5181 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5182
5183 impl GetOperation {
5184 pub(crate) fn new(
5185 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5186 ) -> Self {
5187 Self(RequestBuilder::new(stub))
5188 }
5189
5190 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5192 mut self,
5193 v: V,
5194 ) -> Self {
5195 self.0.request = v.into();
5196 self
5197 }
5198
5199 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5201 self.0.options = v.into();
5202 self
5203 }
5204
5205 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5207 (*self.0.stub)
5208 .get_operation(self.0.request, self.0.options)
5209 .await
5210 .map(crate::Response::into_body)
5211 }
5212
5213 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5215 self.0.request.name = v.into();
5216 self
5217 }
5218 }
5219
5220 #[doc(hidden)]
5221 impl crate::RequestBuilder for GetOperation {
5222 fn request_options(&mut self) -> &mut crate::RequestOptions {
5223 &mut self.0.options
5224 }
5225 }
5226
5227 #[derive(Clone, Debug)]
5244 pub struct CancelOperation(
5245 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
5246 );
5247
5248 impl CancelOperation {
5249 pub(crate) fn new(
5250 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5251 ) -> Self {
5252 Self(RequestBuilder::new(stub))
5253 }
5254
5255 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
5257 mut self,
5258 v: V,
5259 ) -> Self {
5260 self.0.request = v.into();
5261 self
5262 }
5263
5264 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5266 self.0.options = v.into();
5267 self
5268 }
5269
5270 pub async fn send(self) -> Result<()> {
5272 (*self.0.stub)
5273 .cancel_operation(self.0.request, self.0.options)
5274 .await
5275 .map(crate::Response::into_body)
5276 }
5277
5278 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5280 self.0.request.name = v.into();
5281 self
5282 }
5283 }
5284
5285 #[doc(hidden)]
5286 impl crate::RequestBuilder for CancelOperation {
5287 fn request_options(&mut self) -> &mut crate::RequestOptions {
5288 &mut self.0.options
5289 }
5290 }
5291}
5292
5293#[cfg(feature = "document-service")]
5295#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5296pub mod document_service {
5297 use crate::Result;
5298
5299 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5313
5314 pub(crate) mod client {
5315 use super::super::super::client::DocumentService;
5316 pub struct Factory;
5317 impl crate::ClientFactory for Factory {
5318 type Client = DocumentService;
5319 type Credentials = gaxi::options::Credentials;
5320 async fn build(
5321 self,
5322 config: gaxi::options::ClientConfig,
5323 ) -> crate::ClientBuilderResult<Self::Client> {
5324 Self::Client::new(config).await
5325 }
5326 }
5327 }
5328
5329 #[derive(Clone, Debug)]
5331 pub(crate) struct RequestBuilder<R: std::default::Default> {
5332 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5333 request: R,
5334 options: crate::RequestOptions,
5335 }
5336
5337 impl<R> RequestBuilder<R>
5338 where
5339 R: std::default::Default,
5340 {
5341 pub(crate) fn new(
5342 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5343 ) -> Self {
5344 Self {
5345 stub,
5346 request: R::default(),
5347 options: crate::RequestOptions::default(),
5348 }
5349 }
5350 }
5351
5352 #[derive(Clone, Debug)]
5369 pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5370
5371 impl GetDocument {
5372 pub(crate) fn new(
5373 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5374 ) -> Self {
5375 Self(RequestBuilder::new(stub))
5376 }
5377
5378 pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5380 self.0.request = v.into();
5381 self
5382 }
5383
5384 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5386 self.0.options = v.into();
5387 self
5388 }
5389
5390 pub async fn send(self) -> Result<crate::model::Document> {
5392 (*self.0.stub)
5393 .get_document(self.0.request, self.0.options)
5394 .await
5395 .map(crate::Response::into_body)
5396 }
5397
5398 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5402 self.0.request.name = v.into();
5403 self
5404 }
5405 }
5406
5407 #[doc(hidden)]
5408 impl crate::RequestBuilder for GetDocument {
5409 fn request_options(&mut self) -> &mut crate::RequestOptions {
5410 &mut self.0.options
5411 }
5412 }
5413
5414 #[derive(Clone, Debug)]
5435 pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5436
5437 impl ListDocuments {
5438 pub(crate) fn new(
5439 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5440 ) -> Self {
5441 Self(RequestBuilder::new(stub))
5442 }
5443
5444 pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5446 self.0.request = v.into();
5447 self
5448 }
5449
5450 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5452 self.0.options = v.into();
5453 self
5454 }
5455
5456 pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5458 (*self.0.stub)
5459 .list_documents(self.0.request, self.0.options)
5460 .await
5461 .map(crate::Response::into_body)
5462 }
5463
5464 pub fn by_page(
5466 self,
5467 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDocumentsResponse, crate::Error>
5468 {
5469 use std::clone::Clone;
5470 let token = self.0.request.page_token.clone();
5471 let execute = move |token: String| {
5472 let mut builder = self.clone();
5473 builder.0.request = builder.0.request.set_page_token(token);
5474 builder.send()
5475 };
5476 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5477 }
5478
5479 pub fn by_item(
5481 self,
5482 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5483 crate::model::ListDocumentsResponse,
5484 crate::Error,
5485 > {
5486 use google_cloud_gax::paginator::Paginator;
5487 self.by_page().items()
5488 }
5489
5490 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5494 self.0.request.parent = v.into();
5495 self
5496 }
5497
5498 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5500 self.0.request.page_size = v.into();
5501 self
5502 }
5503
5504 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5506 self.0.request.page_token = v.into();
5507 self
5508 }
5509 }
5510
5511 #[doc(hidden)]
5512 impl crate::RequestBuilder for ListDocuments {
5513 fn request_options(&mut self) -> &mut crate::RequestOptions {
5514 &mut self.0.options
5515 }
5516 }
5517
5518 #[derive(Clone, Debug)]
5535 pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5536
5537 impl CreateDocument {
5538 pub(crate) fn new(
5539 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5540 ) -> Self {
5541 Self(RequestBuilder::new(stub))
5542 }
5543
5544 pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5546 self.0.request = v.into();
5547 self
5548 }
5549
5550 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5552 self.0.options = v.into();
5553 self
5554 }
5555
5556 pub async fn send(self) -> Result<crate::model::Document> {
5558 (*self.0.stub)
5559 .create_document(self.0.request, self.0.options)
5560 .await
5561 .map(crate::Response::into_body)
5562 }
5563
5564 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5568 self.0.request.parent = v.into();
5569 self
5570 }
5571
5572 pub fn set_document<T>(mut self, v: T) -> Self
5576 where
5577 T: std::convert::Into<crate::model::Document>,
5578 {
5579 self.0.request.document = std::option::Option::Some(v.into());
5580 self
5581 }
5582
5583 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5587 where
5588 T: std::convert::Into<crate::model::Document>,
5589 {
5590 self.0.request.document = v.map(|x| x.into());
5591 self
5592 }
5593
5594 pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5598 self.0.request.document_id = v.into();
5599 self
5600 }
5601 }
5602
5603 #[doc(hidden)]
5604 impl crate::RequestBuilder for CreateDocument {
5605 fn request_options(&mut self) -> &mut crate::RequestOptions {
5606 &mut self.0.options
5607 }
5608 }
5609
5610 #[derive(Clone, Debug)]
5627 pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
5628
5629 impl UpdateDocument {
5630 pub(crate) fn new(
5631 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5632 ) -> Self {
5633 Self(RequestBuilder::new(stub))
5634 }
5635
5636 pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
5638 self.0.request = v.into();
5639 self
5640 }
5641
5642 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5644 self.0.options = v.into();
5645 self
5646 }
5647
5648 pub async fn send(self) -> Result<crate::model::Document> {
5650 (*self.0.stub)
5651 .update_document(self.0.request, self.0.options)
5652 .await
5653 .map(crate::Response::into_body)
5654 }
5655
5656 pub fn set_document<T>(mut self, v: T) -> Self
5660 where
5661 T: std::convert::Into<crate::model::Document>,
5662 {
5663 self.0.request.document = std::option::Option::Some(v.into());
5664 self
5665 }
5666
5667 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5671 where
5672 T: std::convert::Into<crate::model::Document>,
5673 {
5674 self.0.request.document = v.map(|x| x.into());
5675 self
5676 }
5677
5678 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5680 self.0.request.allow_missing = v.into();
5681 self
5682 }
5683
5684 pub fn set_update_mask<T>(mut self, v: T) -> Self
5686 where
5687 T: std::convert::Into<wkt::FieldMask>,
5688 {
5689 self.0.request.update_mask = std::option::Option::Some(v.into());
5690 self
5691 }
5692
5693 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5695 where
5696 T: std::convert::Into<wkt::FieldMask>,
5697 {
5698 self.0.request.update_mask = v.map(|x| x.into());
5699 self
5700 }
5701 }
5702
5703 #[doc(hidden)]
5704 impl crate::RequestBuilder for UpdateDocument {
5705 fn request_options(&mut self) -> &mut crate::RequestOptions {
5706 &mut self.0.options
5707 }
5708 }
5709
5710 #[derive(Clone, Debug)]
5727 pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
5728
5729 impl DeleteDocument {
5730 pub(crate) fn new(
5731 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5732 ) -> Self {
5733 Self(RequestBuilder::new(stub))
5734 }
5735
5736 pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
5738 self.0.request = v.into();
5739 self
5740 }
5741
5742 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5744 self.0.options = v.into();
5745 self
5746 }
5747
5748 pub async fn send(self) -> Result<()> {
5750 (*self.0.stub)
5751 .delete_document(self.0.request, self.0.options)
5752 .await
5753 .map(crate::Response::into_body)
5754 }
5755
5756 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5760 self.0.request.name = v.into();
5761 self
5762 }
5763 }
5764
5765 #[doc(hidden)]
5766 impl crate::RequestBuilder for DeleteDocument {
5767 fn request_options(&mut self) -> &mut crate::RequestOptions {
5768 &mut self.0.options
5769 }
5770 }
5771
5772 #[derive(Clone, Debug)]
5790 pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
5791
5792 impl ImportDocuments {
5793 pub(crate) fn new(
5794 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5795 ) -> Self {
5796 Self(RequestBuilder::new(stub))
5797 }
5798
5799 pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
5801 self.0.request = v.into();
5802 self
5803 }
5804
5805 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5807 self.0.options = v.into();
5808 self
5809 }
5810
5811 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5818 (*self.0.stub)
5819 .import_documents(self.0.request, self.0.options)
5820 .await
5821 .map(crate::Response::into_body)
5822 }
5823
5824 pub fn poller(
5826 self,
5827 ) -> impl google_cloud_lro::Poller<
5828 crate::model::ImportDocumentsResponse,
5829 crate::model::ImportDocumentsMetadata,
5830 > {
5831 type Operation = google_cloud_lro::internal::Operation<
5832 crate::model::ImportDocumentsResponse,
5833 crate::model::ImportDocumentsMetadata,
5834 >;
5835 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5836 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5837 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
5838 if let Some(ref mut details) = poller_options.tracing {
5839 details.method_name = "google_cloud_discoveryengine_v1::client::DocumentService::import_documents::until_done";
5840 }
5841
5842 let stub = self.0.stub.clone();
5843 let mut options = self.0.options.clone();
5844 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5845 let query = move |name| {
5846 let stub = stub.clone();
5847 let options = options.clone();
5848 async {
5849 let op = GetOperation::new(stub)
5850 .set_name(name)
5851 .with_options(options)
5852 .send()
5853 .await?;
5854 Ok(Operation::new(op))
5855 }
5856 };
5857
5858 let start = move || async {
5859 let op = self.send().await?;
5860 Ok(Operation::new(op))
5861 };
5862
5863 use google_cloud_lro::internal::PollerExt;
5864 {
5865 google_cloud_lro::internal::new_poller(
5866 polling_error_policy,
5867 polling_backoff_policy,
5868 start,
5869 query,
5870 )
5871 }
5872 .with_options(poller_options)
5873 }
5874
5875 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5879 self.0.request.parent = v.into();
5880 self
5881 }
5882
5883 pub fn set_error_config<T>(mut self, v: T) -> Self
5885 where
5886 T: std::convert::Into<crate::model::ImportErrorConfig>,
5887 {
5888 self.0.request.error_config = std::option::Option::Some(v.into());
5889 self
5890 }
5891
5892 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
5894 where
5895 T: std::convert::Into<crate::model::ImportErrorConfig>,
5896 {
5897 self.0.request.error_config = v.map(|x| x.into());
5898 self
5899 }
5900
5901 pub fn set_reconciliation_mode<
5903 T: Into<crate::model::import_documents_request::ReconciliationMode>,
5904 >(
5905 mut self,
5906 v: T,
5907 ) -> Self {
5908 self.0.request.reconciliation_mode = v.into();
5909 self
5910 }
5911
5912 pub fn set_update_mask<T>(mut self, v: T) -> Self
5914 where
5915 T: std::convert::Into<wkt::FieldMask>,
5916 {
5917 self.0.request.update_mask = std::option::Option::Some(v.into());
5918 self
5919 }
5920
5921 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5923 where
5924 T: std::convert::Into<wkt::FieldMask>,
5925 {
5926 self.0.request.update_mask = v.map(|x| x.into());
5927 self
5928 }
5929
5930 pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
5932 self.0.request.auto_generate_ids = v.into();
5933 self
5934 }
5935
5936 pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
5938 self.0.request.id_field = v.into();
5939 self
5940 }
5941
5942 pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
5944 self.0.request.force_refresh_content = v.into();
5945 self
5946 }
5947
5948 pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
5953 mut self,
5954 v: T,
5955 ) -> Self {
5956 self.0.request.source = v.into();
5957 self
5958 }
5959
5960 pub fn set_inline_source<
5966 T: std::convert::Into<
5967 std::boxed::Box<crate::model::import_documents_request::InlineSource>,
5968 >,
5969 >(
5970 mut self,
5971 v: T,
5972 ) -> Self {
5973 self.0.request = self.0.request.set_inline_source(v);
5974 self
5975 }
5976
5977 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
5983 mut self,
5984 v: T,
5985 ) -> Self {
5986 self.0.request = self.0.request.set_gcs_source(v);
5987 self
5988 }
5989
5990 pub fn set_bigquery_source<
5996 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
5997 >(
5998 mut self,
5999 v: T,
6000 ) -> Self {
6001 self.0.request = self.0.request.set_bigquery_source(v);
6002 self
6003 }
6004
6005 pub fn set_fhir_store_source<
6011 T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
6012 >(
6013 mut self,
6014 v: T,
6015 ) -> Self {
6016 self.0.request = self.0.request.set_fhir_store_source(v);
6017 self
6018 }
6019
6020 pub fn set_spanner_source<
6026 T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
6027 >(
6028 mut self,
6029 v: T,
6030 ) -> Self {
6031 self.0.request = self.0.request.set_spanner_source(v);
6032 self
6033 }
6034
6035 pub fn set_cloud_sql_source<
6041 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
6042 >(
6043 mut self,
6044 v: T,
6045 ) -> Self {
6046 self.0.request = self.0.request.set_cloud_sql_source(v);
6047 self
6048 }
6049
6050 pub fn set_firestore_source<
6056 T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
6057 >(
6058 mut self,
6059 v: T,
6060 ) -> Self {
6061 self.0.request = self.0.request.set_firestore_source(v);
6062 self
6063 }
6064
6065 pub fn set_alloy_db_source<
6071 T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
6072 >(
6073 mut self,
6074 v: T,
6075 ) -> Self {
6076 self.0.request = self.0.request.set_alloy_db_source(v);
6077 self
6078 }
6079
6080 pub fn set_bigtable_source<
6086 T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
6087 >(
6088 mut self,
6089 v: T,
6090 ) -> Self {
6091 self.0.request = self.0.request.set_bigtable_source(v);
6092 self
6093 }
6094 }
6095
6096 #[doc(hidden)]
6097 impl crate::RequestBuilder for ImportDocuments {
6098 fn request_options(&mut self) -> &mut crate::RequestOptions {
6099 &mut self.0.options
6100 }
6101 }
6102
6103 #[derive(Clone, Debug)]
6121 pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
6122
6123 impl PurgeDocuments {
6124 pub(crate) fn new(
6125 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6126 ) -> Self {
6127 Self(RequestBuilder::new(stub))
6128 }
6129
6130 pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
6132 self.0.request = v.into();
6133 self
6134 }
6135
6136 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6138 self.0.options = v.into();
6139 self
6140 }
6141
6142 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6149 (*self.0.stub)
6150 .purge_documents(self.0.request, self.0.options)
6151 .await
6152 .map(crate::Response::into_body)
6153 }
6154
6155 pub fn poller(
6157 self,
6158 ) -> impl google_cloud_lro::Poller<
6159 crate::model::PurgeDocumentsResponse,
6160 crate::model::PurgeDocumentsMetadata,
6161 > {
6162 type Operation = google_cloud_lro::internal::Operation<
6163 crate::model::PurgeDocumentsResponse,
6164 crate::model::PurgeDocumentsMetadata,
6165 >;
6166 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6167 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6168 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
6169 if let Some(ref mut details) = poller_options.tracing {
6170 details.method_name = "google_cloud_discoveryengine_v1::client::DocumentService::purge_documents::until_done";
6171 }
6172
6173 let stub = self.0.stub.clone();
6174 let mut options = self.0.options.clone();
6175 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6176 let query = move |name| {
6177 let stub = stub.clone();
6178 let options = options.clone();
6179 async {
6180 let op = GetOperation::new(stub)
6181 .set_name(name)
6182 .with_options(options)
6183 .send()
6184 .await?;
6185 Ok(Operation::new(op))
6186 }
6187 };
6188
6189 let start = move || async {
6190 let op = self.send().await?;
6191 Ok(Operation::new(op))
6192 };
6193
6194 use google_cloud_lro::internal::PollerExt;
6195 {
6196 google_cloud_lro::internal::new_poller(
6197 polling_error_policy,
6198 polling_backoff_policy,
6199 start,
6200 query,
6201 )
6202 }
6203 .with_options(poller_options)
6204 }
6205
6206 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6210 self.0.request.parent = v.into();
6211 self
6212 }
6213
6214 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6218 self.0.request.filter = v.into();
6219 self
6220 }
6221
6222 pub fn set_error_config<T>(mut self, v: T) -> Self
6224 where
6225 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6226 {
6227 self.0.request.error_config = std::option::Option::Some(v.into());
6228 self
6229 }
6230
6231 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6233 where
6234 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6235 {
6236 self.0.request.error_config = v.map(|x| x.into());
6237 self
6238 }
6239
6240 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6242 self.0.request.force = v.into();
6243 self
6244 }
6245
6246 pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6251 mut self,
6252 v: T,
6253 ) -> Self {
6254 self.0.request.source = v.into();
6255 self
6256 }
6257
6258 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6264 mut self,
6265 v: T,
6266 ) -> Self {
6267 self.0.request = self.0.request.set_gcs_source(v);
6268 self
6269 }
6270
6271 pub fn set_inline_source<
6277 T: std::convert::Into<
6278 std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6279 >,
6280 >(
6281 mut self,
6282 v: T,
6283 ) -> Self {
6284 self.0.request = self.0.request.set_inline_source(v);
6285 self
6286 }
6287 }
6288
6289 #[doc(hidden)]
6290 impl crate::RequestBuilder for PurgeDocuments {
6291 fn request_options(&mut self) -> &mut crate::RequestOptions {
6292 &mut self.0.options
6293 }
6294 }
6295
6296 #[derive(Clone, Debug)]
6313 pub struct BatchGetDocumentsMetadata(
6314 RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6315 );
6316
6317 impl BatchGetDocumentsMetadata {
6318 pub(crate) fn new(
6319 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6320 ) -> Self {
6321 Self(RequestBuilder::new(stub))
6322 }
6323
6324 pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6326 mut self,
6327 v: V,
6328 ) -> Self {
6329 self.0.request = v.into();
6330 self
6331 }
6332
6333 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6335 self.0.options = v.into();
6336 self
6337 }
6338
6339 pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6341 (*self.0.stub)
6342 .batch_get_documents_metadata(self.0.request, self.0.options)
6343 .await
6344 .map(crate::Response::into_body)
6345 }
6346
6347 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6351 self.0.request.parent = v.into();
6352 self
6353 }
6354
6355 pub fn set_matcher<T>(mut self, v: T) -> Self
6359 where
6360 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6361 {
6362 self.0.request.matcher = std::option::Option::Some(v.into());
6363 self
6364 }
6365
6366 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6370 where
6371 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6372 {
6373 self.0.request.matcher = v.map(|x| x.into());
6374 self
6375 }
6376 }
6377
6378 #[doc(hidden)]
6379 impl crate::RequestBuilder for BatchGetDocumentsMetadata {
6380 fn request_options(&mut self) -> &mut crate::RequestOptions {
6381 &mut self.0.options
6382 }
6383 }
6384
6385 #[derive(Clone, Debug)]
6406 pub struct ListOperations(
6407 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6408 );
6409
6410 impl ListOperations {
6411 pub(crate) fn new(
6412 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6413 ) -> Self {
6414 Self(RequestBuilder::new(stub))
6415 }
6416
6417 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6419 mut self,
6420 v: V,
6421 ) -> Self {
6422 self.0.request = v.into();
6423 self
6424 }
6425
6426 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6428 self.0.options = v.into();
6429 self
6430 }
6431
6432 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6434 (*self.0.stub)
6435 .list_operations(self.0.request, self.0.options)
6436 .await
6437 .map(crate::Response::into_body)
6438 }
6439
6440 pub fn by_page(
6442 self,
6443 ) -> impl google_cloud_gax::paginator::Paginator<
6444 google_cloud_longrunning::model::ListOperationsResponse,
6445 crate::Error,
6446 > {
6447 use std::clone::Clone;
6448 let token = self.0.request.page_token.clone();
6449 let execute = move |token: String| {
6450 let mut builder = self.clone();
6451 builder.0.request = builder.0.request.set_page_token(token);
6452 builder.send()
6453 };
6454 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6455 }
6456
6457 pub fn by_item(
6459 self,
6460 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6461 google_cloud_longrunning::model::ListOperationsResponse,
6462 crate::Error,
6463 > {
6464 use google_cloud_gax::paginator::Paginator;
6465 self.by_page().items()
6466 }
6467
6468 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6470 self.0.request.name = v.into();
6471 self
6472 }
6473
6474 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6476 self.0.request.filter = v.into();
6477 self
6478 }
6479
6480 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6482 self.0.request.page_size = v.into();
6483 self
6484 }
6485
6486 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6488 self.0.request.page_token = v.into();
6489 self
6490 }
6491
6492 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6494 self.0.request.return_partial_success = v.into();
6495 self
6496 }
6497 }
6498
6499 #[doc(hidden)]
6500 impl crate::RequestBuilder for ListOperations {
6501 fn request_options(&mut self) -> &mut crate::RequestOptions {
6502 &mut self.0.options
6503 }
6504 }
6505
6506 #[derive(Clone, Debug)]
6523 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6524
6525 impl GetOperation {
6526 pub(crate) fn new(
6527 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6528 ) -> Self {
6529 Self(RequestBuilder::new(stub))
6530 }
6531
6532 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6534 mut self,
6535 v: V,
6536 ) -> Self {
6537 self.0.request = v.into();
6538 self
6539 }
6540
6541 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6543 self.0.options = v.into();
6544 self
6545 }
6546
6547 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6549 (*self.0.stub)
6550 .get_operation(self.0.request, self.0.options)
6551 .await
6552 .map(crate::Response::into_body)
6553 }
6554
6555 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6557 self.0.request.name = v.into();
6558 self
6559 }
6560 }
6561
6562 #[doc(hidden)]
6563 impl crate::RequestBuilder for GetOperation {
6564 fn request_options(&mut self) -> &mut crate::RequestOptions {
6565 &mut self.0.options
6566 }
6567 }
6568
6569 #[derive(Clone, Debug)]
6586 pub struct CancelOperation(
6587 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
6588 );
6589
6590 impl CancelOperation {
6591 pub(crate) fn new(
6592 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6593 ) -> Self {
6594 Self(RequestBuilder::new(stub))
6595 }
6596
6597 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
6599 mut self,
6600 v: V,
6601 ) -> Self {
6602 self.0.request = v.into();
6603 self
6604 }
6605
6606 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6608 self.0.options = v.into();
6609 self
6610 }
6611
6612 pub async fn send(self) -> Result<()> {
6614 (*self.0.stub)
6615 .cancel_operation(self.0.request, self.0.options)
6616 .await
6617 .map(crate::Response::into_body)
6618 }
6619
6620 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6622 self.0.request.name = v.into();
6623 self
6624 }
6625 }
6626
6627 #[doc(hidden)]
6628 impl crate::RequestBuilder for CancelOperation {
6629 fn request_options(&mut self) -> &mut crate::RequestOptions {
6630 &mut self.0.options
6631 }
6632 }
6633}
6634
6635#[cfg(feature = "engine-service")]
6637#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
6638pub mod engine_service {
6639 use crate::Result;
6640
6641 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6655
6656 pub(crate) mod client {
6657 use super::super::super::client::EngineService;
6658 pub struct Factory;
6659 impl crate::ClientFactory for Factory {
6660 type Client = EngineService;
6661 type Credentials = gaxi::options::Credentials;
6662 async fn build(
6663 self,
6664 config: gaxi::options::ClientConfig,
6665 ) -> crate::ClientBuilderResult<Self::Client> {
6666 Self::Client::new(config).await
6667 }
6668 }
6669 }
6670
6671 #[derive(Clone, Debug)]
6673 pub(crate) struct RequestBuilder<R: std::default::Default> {
6674 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6675 request: R,
6676 options: crate::RequestOptions,
6677 }
6678
6679 impl<R> RequestBuilder<R>
6680 where
6681 R: std::default::Default,
6682 {
6683 pub(crate) fn new(
6684 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6685 ) -> Self {
6686 Self {
6687 stub,
6688 request: R::default(),
6689 options: crate::RequestOptions::default(),
6690 }
6691 }
6692 }
6693
6694 #[derive(Clone, Debug)]
6712 pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
6713
6714 impl CreateEngine {
6715 pub(crate) fn new(
6716 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6717 ) -> Self {
6718 Self(RequestBuilder::new(stub))
6719 }
6720
6721 pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
6723 self.0.request = v.into();
6724 self
6725 }
6726
6727 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6729 self.0.options = v.into();
6730 self
6731 }
6732
6733 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6740 (*self.0.stub)
6741 .create_engine(self.0.request, self.0.options)
6742 .await
6743 .map(crate::Response::into_body)
6744 }
6745
6746 pub fn poller(
6748 self,
6749 ) -> impl google_cloud_lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata>
6750 {
6751 type Operation = google_cloud_lro::internal::Operation<
6752 crate::model::Engine,
6753 crate::model::CreateEngineMetadata,
6754 >;
6755 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6756 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6757 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
6758 if let Some(ref mut details) = poller_options.tracing {
6759 details.method_name = "google_cloud_discoveryengine_v1::client::EngineService::create_engine::until_done";
6760 }
6761
6762 let stub = self.0.stub.clone();
6763 let mut options = self.0.options.clone();
6764 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6765 let query = move |name| {
6766 let stub = stub.clone();
6767 let options = options.clone();
6768 async {
6769 let op = GetOperation::new(stub)
6770 .set_name(name)
6771 .with_options(options)
6772 .send()
6773 .await?;
6774 Ok(Operation::new(op))
6775 }
6776 };
6777
6778 let start = move || async {
6779 let op = self.send().await?;
6780 Ok(Operation::new(op))
6781 };
6782
6783 use google_cloud_lro::internal::PollerExt;
6784 {
6785 google_cloud_lro::internal::new_poller(
6786 polling_error_policy,
6787 polling_backoff_policy,
6788 start,
6789 query,
6790 )
6791 }
6792 .with_options(poller_options)
6793 }
6794
6795 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6799 self.0.request.parent = v.into();
6800 self
6801 }
6802
6803 pub fn set_engine<T>(mut self, v: T) -> Self
6807 where
6808 T: std::convert::Into<crate::model::Engine>,
6809 {
6810 self.0.request.engine = std::option::Option::Some(v.into());
6811 self
6812 }
6813
6814 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6818 where
6819 T: std::convert::Into<crate::model::Engine>,
6820 {
6821 self.0.request.engine = v.map(|x| x.into());
6822 self
6823 }
6824
6825 pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6829 self.0.request.engine_id = v.into();
6830 self
6831 }
6832 }
6833
6834 #[doc(hidden)]
6835 impl crate::RequestBuilder for CreateEngine {
6836 fn request_options(&mut self) -> &mut crate::RequestOptions {
6837 &mut self.0.options
6838 }
6839 }
6840
6841 #[derive(Clone, Debug)]
6859 pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
6860
6861 impl DeleteEngine {
6862 pub(crate) fn new(
6863 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6864 ) -> Self {
6865 Self(RequestBuilder::new(stub))
6866 }
6867
6868 pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
6870 self.0.request = v.into();
6871 self
6872 }
6873
6874 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6876 self.0.options = v.into();
6877 self
6878 }
6879
6880 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6887 (*self.0.stub)
6888 .delete_engine(self.0.request, self.0.options)
6889 .await
6890 .map(crate::Response::into_body)
6891 }
6892
6893 pub fn poller(
6895 self,
6896 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteEngineMetadata> {
6897 type Operation = google_cloud_lro::internal::Operation<
6898 wkt::Empty,
6899 crate::model::DeleteEngineMetadata,
6900 >;
6901 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6902 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6903 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
6904 if let Some(ref mut details) = poller_options.tracing {
6905 details.method_name = "google_cloud_discoveryengine_v1::client::EngineService::delete_engine::until_done";
6906 }
6907
6908 let stub = self.0.stub.clone();
6909 let mut options = self.0.options.clone();
6910 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6911 let query = move |name| {
6912 let stub = stub.clone();
6913 let options = options.clone();
6914 async {
6915 let op = GetOperation::new(stub)
6916 .set_name(name)
6917 .with_options(options)
6918 .send()
6919 .await?;
6920 Ok(Operation::new(op))
6921 }
6922 };
6923
6924 let start = move || async {
6925 let op = self.send().await?;
6926 Ok(Operation::new(op))
6927 };
6928
6929 use google_cloud_lro::internal::PollerExt;
6930 {
6931 google_cloud_lro::internal::new_unit_response_poller(
6932 polling_error_policy,
6933 polling_backoff_policy,
6934 start,
6935 query,
6936 )
6937 }
6938 .with_options(poller_options)
6939 }
6940
6941 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6945 self.0.request.name = v.into();
6946 self
6947 }
6948 }
6949
6950 #[doc(hidden)]
6951 impl crate::RequestBuilder for DeleteEngine {
6952 fn request_options(&mut self) -> &mut crate::RequestOptions {
6953 &mut self.0.options
6954 }
6955 }
6956
6957 #[derive(Clone, Debug)]
6974 pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
6975
6976 impl UpdateEngine {
6977 pub(crate) fn new(
6978 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6979 ) -> Self {
6980 Self(RequestBuilder::new(stub))
6981 }
6982
6983 pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
6985 self.0.request = v.into();
6986 self
6987 }
6988
6989 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6991 self.0.options = v.into();
6992 self
6993 }
6994
6995 pub async fn send(self) -> Result<crate::model::Engine> {
6997 (*self.0.stub)
6998 .update_engine(self.0.request, self.0.options)
6999 .await
7000 .map(crate::Response::into_body)
7001 }
7002
7003 pub fn set_engine<T>(mut self, v: T) -> Self
7007 where
7008 T: std::convert::Into<crate::model::Engine>,
7009 {
7010 self.0.request.engine = std::option::Option::Some(v.into());
7011 self
7012 }
7013
7014 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
7018 where
7019 T: std::convert::Into<crate::model::Engine>,
7020 {
7021 self.0.request.engine = v.map(|x| x.into());
7022 self
7023 }
7024
7025 pub fn set_update_mask<T>(mut self, v: T) -> Self
7027 where
7028 T: std::convert::Into<wkt::FieldMask>,
7029 {
7030 self.0.request.update_mask = std::option::Option::Some(v.into());
7031 self
7032 }
7033
7034 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7036 where
7037 T: std::convert::Into<wkt::FieldMask>,
7038 {
7039 self.0.request.update_mask = v.map(|x| x.into());
7040 self
7041 }
7042 }
7043
7044 #[doc(hidden)]
7045 impl crate::RequestBuilder for UpdateEngine {
7046 fn request_options(&mut self) -> &mut crate::RequestOptions {
7047 &mut self.0.options
7048 }
7049 }
7050
7051 #[derive(Clone, Debug)]
7068 pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
7069
7070 impl GetEngine {
7071 pub(crate) fn new(
7072 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7073 ) -> Self {
7074 Self(RequestBuilder::new(stub))
7075 }
7076
7077 pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
7079 self.0.request = v.into();
7080 self
7081 }
7082
7083 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7085 self.0.options = v.into();
7086 self
7087 }
7088
7089 pub async fn send(self) -> Result<crate::model::Engine> {
7091 (*self.0.stub)
7092 .get_engine(self.0.request, self.0.options)
7093 .await
7094 .map(crate::Response::into_body)
7095 }
7096
7097 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7101 self.0.request.name = v.into();
7102 self
7103 }
7104 }
7105
7106 #[doc(hidden)]
7107 impl crate::RequestBuilder for GetEngine {
7108 fn request_options(&mut self) -> &mut crate::RequestOptions {
7109 &mut self.0.options
7110 }
7111 }
7112
7113 #[derive(Clone, Debug)]
7134 pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
7135
7136 impl ListEngines {
7137 pub(crate) fn new(
7138 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7139 ) -> Self {
7140 Self(RequestBuilder::new(stub))
7141 }
7142
7143 pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
7145 self.0.request = v.into();
7146 self
7147 }
7148
7149 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7151 self.0.options = v.into();
7152 self
7153 }
7154
7155 pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
7157 (*self.0.stub)
7158 .list_engines(self.0.request, self.0.options)
7159 .await
7160 .map(crate::Response::into_body)
7161 }
7162
7163 pub fn by_page(
7165 self,
7166 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListEnginesResponse, crate::Error>
7167 {
7168 use std::clone::Clone;
7169 let token = self.0.request.page_token.clone();
7170 let execute = move |token: String| {
7171 let mut builder = self.clone();
7172 builder.0.request = builder.0.request.set_page_token(token);
7173 builder.send()
7174 };
7175 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7176 }
7177
7178 pub fn by_item(
7180 self,
7181 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7182 crate::model::ListEnginesResponse,
7183 crate::Error,
7184 > {
7185 use google_cloud_gax::paginator::Paginator;
7186 self.by_page().items()
7187 }
7188
7189 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7193 self.0.request.parent = v.into();
7194 self
7195 }
7196
7197 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7199 self.0.request.page_size = v.into();
7200 self
7201 }
7202
7203 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7205 self.0.request.page_token = v.into();
7206 self
7207 }
7208
7209 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7211 self.0.request.filter = v.into();
7212 self
7213 }
7214 }
7215
7216 #[doc(hidden)]
7217 impl crate::RequestBuilder for ListEngines {
7218 fn request_options(&mut self) -> &mut crate::RequestOptions {
7219 &mut self.0.options
7220 }
7221 }
7222
7223 #[derive(Clone, Debug)]
7244 pub struct ListOperations(
7245 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7246 );
7247
7248 impl ListOperations {
7249 pub(crate) fn new(
7250 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7251 ) -> Self {
7252 Self(RequestBuilder::new(stub))
7253 }
7254
7255 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7257 mut self,
7258 v: V,
7259 ) -> Self {
7260 self.0.request = v.into();
7261 self
7262 }
7263
7264 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7266 self.0.options = v.into();
7267 self
7268 }
7269
7270 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7272 (*self.0.stub)
7273 .list_operations(self.0.request, self.0.options)
7274 .await
7275 .map(crate::Response::into_body)
7276 }
7277
7278 pub fn by_page(
7280 self,
7281 ) -> impl google_cloud_gax::paginator::Paginator<
7282 google_cloud_longrunning::model::ListOperationsResponse,
7283 crate::Error,
7284 > {
7285 use std::clone::Clone;
7286 let token = self.0.request.page_token.clone();
7287 let execute = move |token: String| {
7288 let mut builder = self.clone();
7289 builder.0.request = builder.0.request.set_page_token(token);
7290 builder.send()
7291 };
7292 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7293 }
7294
7295 pub fn by_item(
7297 self,
7298 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7299 google_cloud_longrunning::model::ListOperationsResponse,
7300 crate::Error,
7301 > {
7302 use google_cloud_gax::paginator::Paginator;
7303 self.by_page().items()
7304 }
7305
7306 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7308 self.0.request.name = v.into();
7309 self
7310 }
7311
7312 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7314 self.0.request.filter = v.into();
7315 self
7316 }
7317
7318 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7320 self.0.request.page_size = v.into();
7321 self
7322 }
7323
7324 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7326 self.0.request.page_token = v.into();
7327 self
7328 }
7329
7330 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7332 self.0.request.return_partial_success = v.into();
7333 self
7334 }
7335 }
7336
7337 #[doc(hidden)]
7338 impl crate::RequestBuilder for ListOperations {
7339 fn request_options(&mut self) -> &mut crate::RequestOptions {
7340 &mut self.0.options
7341 }
7342 }
7343
7344 #[derive(Clone, Debug)]
7361 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7362
7363 impl GetOperation {
7364 pub(crate) fn new(
7365 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7366 ) -> Self {
7367 Self(RequestBuilder::new(stub))
7368 }
7369
7370 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7372 mut self,
7373 v: V,
7374 ) -> Self {
7375 self.0.request = v.into();
7376 self
7377 }
7378
7379 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7381 self.0.options = v.into();
7382 self
7383 }
7384
7385 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7387 (*self.0.stub)
7388 .get_operation(self.0.request, self.0.options)
7389 .await
7390 .map(crate::Response::into_body)
7391 }
7392
7393 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7395 self.0.request.name = v.into();
7396 self
7397 }
7398 }
7399
7400 #[doc(hidden)]
7401 impl crate::RequestBuilder for GetOperation {
7402 fn request_options(&mut self) -> &mut crate::RequestOptions {
7403 &mut self.0.options
7404 }
7405 }
7406
7407 #[derive(Clone, Debug)]
7424 pub struct CancelOperation(
7425 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7426 );
7427
7428 impl CancelOperation {
7429 pub(crate) fn new(
7430 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7431 ) -> Self {
7432 Self(RequestBuilder::new(stub))
7433 }
7434
7435 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7437 mut self,
7438 v: V,
7439 ) -> Self {
7440 self.0.request = v.into();
7441 self
7442 }
7443
7444 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7446 self.0.options = v.into();
7447 self
7448 }
7449
7450 pub async fn send(self) -> Result<()> {
7452 (*self.0.stub)
7453 .cancel_operation(self.0.request, self.0.options)
7454 .await
7455 .map(crate::Response::into_body)
7456 }
7457
7458 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7460 self.0.request.name = v.into();
7461 self
7462 }
7463 }
7464
7465 #[doc(hidden)]
7466 impl crate::RequestBuilder for CancelOperation {
7467 fn request_options(&mut self) -> &mut crate::RequestOptions {
7468 &mut self.0.options
7469 }
7470 }
7471}
7472
7473#[cfg(feature = "grounded-generation-service")]
7475#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7476pub mod grounded_generation_service {
7477 use crate::Result;
7478
7479 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7493
7494 pub(crate) mod client {
7495 use super::super::super::client::GroundedGenerationService;
7496 pub struct Factory;
7497 impl crate::ClientFactory for Factory {
7498 type Client = GroundedGenerationService;
7499 type Credentials = gaxi::options::Credentials;
7500 async fn build(
7501 self,
7502 config: gaxi::options::ClientConfig,
7503 ) -> crate::ClientBuilderResult<Self::Client> {
7504 Self::Client::new(config).await
7505 }
7506 }
7507 }
7508
7509 #[derive(Clone, Debug)]
7511 pub(crate) struct RequestBuilder<R: std::default::Default> {
7512 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7513 request: R,
7514 options: crate::RequestOptions,
7515 }
7516
7517 impl<R> RequestBuilder<R>
7518 where
7519 R: std::default::Default,
7520 {
7521 pub(crate) fn new(
7522 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7523 ) -> Self {
7524 Self {
7525 stub,
7526 request: R::default(),
7527 options: crate::RequestOptions::default(),
7528 }
7529 }
7530 }
7531
7532 #[derive(Clone, Debug)]
7549 pub struct GenerateGroundedContent(
7550 RequestBuilder<crate::model::GenerateGroundedContentRequest>,
7551 );
7552
7553 impl GenerateGroundedContent {
7554 pub(crate) fn new(
7555 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7556 ) -> Self {
7557 Self(RequestBuilder::new(stub))
7558 }
7559
7560 pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
7562 mut self,
7563 v: V,
7564 ) -> Self {
7565 self.0.request = v.into();
7566 self
7567 }
7568
7569 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7571 self.0.options = v.into();
7572 self
7573 }
7574
7575 pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
7577 (*self.0.stub)
7578 .generate_grounded_content(self.0.request, self.0.options)
7579 .await
7580 .map(crate::Response::into_body)
7581 }
7582
7583 pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7587 self.0.request.location = v.into();
7588 self
7589 }
7590
7591 pub fn set_system_instruction<T>(mut self, v: T) -> Self
7593 where
7594 T: std::convert::Into<crate::model::GroundedGenerationContent>,
7595 {
7596 self.0.request.system_instruction = std::option::Option::Some(v.into());
7597 self
7598 }
7599
7600 pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
7602 where
7603 T: std::convert::Into<crate::model::GroundedGenerationContent>,
7604 {
7605 self.0.request.system_instruction = v.map(|x| x.into());
7606 self
7607 }
7608
7609 pub fn set_contents<T, V>(mut self, v: T) -> Self
7611 where
7612 T: std::iter::IntoIterator<Item = V>,
7613 V: std::convert::Into<crate::model::GroundedGenerationContent>,
7614 {
7615 use std::iter::Iterator;
7616 self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
7617 self
7618 }
7619
7620 pub fn set_generation_spec<T>(mut self, v: T) -> Self
7622 where
7623 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7624 {
7625 self.0.request.generation_spec = std::option::Option::Some(v.into());
7626 self
7627 }
7628
7629 pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7631 where
7632 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7633 {
7634 self.0.request.generation_spec = v.map(|x| x.into());
7635 self
7636 }
7637
7638 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7640 where
7641 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7642 {
7643 self.0.request.grounding_spec = std::option::Option::Some(v.into());
7644 self
7645 }
7646
7647 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7649 where
7650 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7651 {
7652 self.0.request.grounding_spec = v.map(|x| x.into());
7653 self
7654 }
7655
7656 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7658 where
7659 T: std::iter::IntoIterator<Item = (K, V)>,
7660 K: std::convert::Into<std::string::String>,
7661 V: std::convert::Into<std::string::String>,
7662 {
7663 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7664 self
7665 }
7666 }
7667
7668 #[doc(hidden)]
7669 impl crate::RequestBuilder for GenerateGroundedContent {
7670 fn request_options(&mut self) -> &mut crate::RequestOptions {
7671 &mut self.0.options
7672 }
7673 }
7674
7675 #[derive(Clone, Debug)]
7692 pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
7693
7694 impl CheckGrounding {
7695 pub(crate) fn new(
7696 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7697 ) -> Self {
7698 Self(RequestBuilder::new(stub))
7699 }
7700
7701 pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
7703 self.0.request = v.into();
7704 self
7705 }
7706
7707 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7709 self.0.options = v.into();
7710 self
7711 }
7712
7713 pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
7715 (*self.0.stub)
7716 .check_grounding(self.0.request, self.0.options)
7717 .await
7718 .map(crate::Response::into_body)
7719 }
7720
7721 pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7725 self.0.request.grounding_config = v.into();
7726 self
7727 }
7728
7729 pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
7731 self.0.request.answer_candidate = v.into();
7732 self
7733 }
7734
7735 pub fn set_facts<T, V>(mut self, v: T) -> Self
7737 where
7738 T: std::iter::IntoIterator<Item = V>,
7739 V: std::convert::Into<crate::model::GroundingFact>,
7740 {
7741 use std::iter::Iterator;
7742 self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
7743 self
7744 }
7745
7746 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7748 where
7749 T: std::convert::Into<crate::model::CheckGroundingSpec>,
7750 {
7751 self.0.request.grounding_spec = std::option::Option::Some(v.into());
7752 self
7753 }
7754
7755 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7757 where
7758 T: std::convert::Into<crate::model::CheckGroundingSpec>,
7759 {
7760 self.0.request.grounding_spec = v.map(|x| x.into());
7761 self
7762 }
7763
7764 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7766 where
7767 T: std::iter::IntoIterator<Item = (K, V)>,
7768 K: std::convert::Into<std::string::String>,
7769 V: std::convert::Into<std::string::String>,
7770 {
7771 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7772 self
7773 }
7774 }
7775
7776 #[doc(hidden)]
7777 impl crate::RequestBuilder for CheckGrounding {
7778 fn request_options(&mut self) -> &mut crate::RequestOptions {
7779 &mut self.0.options
7780 }
7781 }
7782
7783 #[derive(Clone, Debug)]
7804 pub struct ListOperations(
7805 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7806 );
7807
7808 impl ListOperations {
7809 pub(crate) fn new(
7810 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7811 ) -> Self {
7812 Self(RequestBuilder::new(stub))
7813 }
7814
7815 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7817 mut self,
7818 v: V,
7819 ) -> Self {
7820 self.0.request = v.into();
7821 self
7822 }
7823
7824 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7826 self.0.options = v.into();
7827 self
7828 }
7829
7830 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7832 (*self.0.stub)
7833 .list_operations(self.0.request, self.0.options)
7834 .await
7835 .map(crate::Response::into_body)
7836 }
7837
7838 pub fn by_page(
7840 self,
7841 ) -> impl google_cloud_gax::paginator::Paginator<
7842 google_cloud_longrunning::model::ListOperationsResponse,
7843 crate::Error,
7844 > {
7845 use std::clone::Clone;
7846 let token = self.0.request.page_token.clone();
7847 let execute = move |token: String| {
7848 let mut builder = self.clone();
7849 builder.0.request = builder.0.request.set_page_token(token);
7850 builder.send()
7851 };
7852 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7853 }
7854
7855 pub fn by_item(
7857 self,
7858 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7859 google_cloud_longrunning::model::ListOperationsResponse,
7860 crate::Error,
7861 > {
7862 use google_cloud_gax::paginator::Paginator;
7863 self.by_page().items()
7864 }
7865
7866 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7868 self.0.request.name = v.into();
7869 self
7870 }
7871
7872 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7874 self.0.request.filter = v.into();
7875 self
7876 }
7877
7878 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7880 self.0.request.page_size = v.into();
7881 self
7882 }
7883
7884 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7886 self.0.request.page_token = v.into();
7887 self
7888 }
7889
7890 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7892 self.0.request.return_partial_success = v.into();
7893 self
7894 }
7895 }
7896
7897 #[doc(hidden)]
7898 impl crate::RequestBuilder for ListOperations {
7899 fn request_options(&mut self) -> &mut crate::RequestOptions {
7900 &mut self.0.options
7901 }
7902 }
7903
7904 #[derive(Clone, Debug)]
7921 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7922
7923 impl GetOperation {
7924 pub(crate) fn new(
7925 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7926 ) -> Self {
7927 Self(RequestBuilder::new(stub))
7928 }
7929
7930 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7932 mut self,
7933 v: V,
7934 ) -> Self {
7935 self.0.request = v.into();
7936 self
7937 }
7938
7939 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7941 self.0.options = v.into();
7942 self
7943 }
7944
7945 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7947 (*self.0.stub)
7948 .get_operation(self.0.request, self.0.options)
7949 .await
7950 .map(crate::Response::into_body)
7951 }
7952
7953 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7955 self.0.request.name = v.into();
7956 self
7957 }
7958 }
7959
7960 #[doc(hidden)]
7961 impl crate::RequestBuilder for GetOperation {
7962 fn request_options(&mut self) -> &mut crate::RequestOptions {
7963 &mut self.0.options
7964 }
7965 }
7966
7967 #[derive(Clone, Debug)]
7984 pub struct CancelOperation(
7985 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7986 );
7987
7988 impl CancelOperation {
7989 pub(crate) fn new(
7990 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7991 ) -> Self {
7992 Self(RequestBuilder::new(stub))
7993 }
7994
7995 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7997 mut self,
7998 v: V,
7999 ) -> Self {
8000 self.0.request = v.into();
8001 self
8002 }
8003
8004 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8006 self.0.options = v.into();
8007 self
8008 }
8009
8010 pub async fn send(self) -> Result<()> {
8012 (*self.0.stub)
8013 .cancel_operation(self.0.request, self.0.options)
8014 .await
8015 .map(crate::Response::into_body)
8016 }
8017
8018 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8020 self.0.request.name = v.into();
8021 self
8022 }
8023 }
8024
8025 #[doc(hidden)]
8026 impl crate::RequestBuilder for CancelOperation {
8027 fn request_options(&mut self) -> &mut crate::RequestOptions {
8028 &mut self.0.options
8029 }
8030 }
8031}
8032
8033#[cfg(feature = "identity-mapping-store-service")]
8035#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
8036pub mod identity_mapping_store_service {
8037 use crate::Result;
8038
8039 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8053
8054 pub(crate) mod client {
8055 use super::super::super::client::IdentityMappingStoreService;
8056 pub struct Factory;
8057 impl crate::ClientFactory for Factory {
8058 type Client = IdentityMappingStoreService;
8059 type Credentials = gaxi::options::Credentials;
8060 async fn build(
8061 self,
8062 config: gaxi::options::ClientConfig,
8063 ) -> crate::ClientBuilderResult<Self::Client> {
8064 Self::Client::new(config).await
8065 }
8066 }
8067 }
8068
8069 #[derive(Clone, Debug)]
8071 pub(crate) struct RequestBuilder<R: std::default::Default> {
8072 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8073 request: R,
8074 options: crate::RequestOptions,
8075 }
8076
8077 impl<R> RequestBuilder<R>
8078 where
8079 R: std::default::Default,
8080 {
8081 pub(crate) fn new(
8082 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8083 ) -> Self {
8084 Self {
8085 stub,
8086 request: R::default(),
8087 options: crate::RequestOptions::default(),
8088 }
8089 }
8090 }
8091
8092 #[derive(Clone, Debug)]
8109 pub struct CreateIdentityMappingStore(
8110 RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
8111 );
8112
8113 impl CreateIdentityMappingStore {
8114 pub(crate) fn new(
8115 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8116 ) -> Self {
8117 Self(RequestBuilder::new(stub))
8118 }
8119
8120 pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
8122 mut self,
8123 v: V,
8124 ) -> Self {
8125 self.0.request = v.into();
8126 self
8127 }
8128
8129 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8131 self.0.options = v.into();
8132 self
8133 }
8134
8135 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8137 (*self.0.stub)
8138 .create_identity_mapping_store(self.0.request, self.0.options)
8139 .await
8140 .map(crate::Response::into_body)
8141 }
8142
8143 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8147 self.0.request.parent = v.into();
8148 self
8149 }
8150
8151 pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8155 self.0.request.identity_mapping_store_id = v.into();
8156 self
8157 }
8158
8159 pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
8163 where
8164 T: std::convert::Into<crate::model::IdentityMappingStore>,
8165 {
8166 self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
8167 self
8168 }
8169
8170 pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
8174 where
8175 T: std::convert::Into<crate::model::IdentityMappingStore>,
8176 {
8177 self.0.request.identity_mapping_store = v.map(|x| x.into());
8178 self
8179 }
8180
8181 pub fn set_cmek_options<
8186 T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
8187 >(
8188 mut self,
8189 v: T,
8190 ) -> Self {
8191 self.0.request.cmek_options = v.into();
8192 self
8193 }
8194
8195 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
8201 mut self,
8202 v: T,
8203 ) -> Self {
8204 self.0.request = self.0.request.set_cmek_config_name(v);
8205 self
8206 }
8207
8208 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8214 self.0.request = self.0.request.set_disable_cmek(v);
8215 self
8216 }
8217 }
8218
8219 #[doc(hidden)]
8220 impl crate::RequestBuilder for CreateIdentityMappingStore {
8221 fn request_options(&mut self) -> &mut crate::RequestOptions {
8222 &mut self.0.options
8223 }
8224 }
8225
8226 #[derive(Clone, Debug)]
8243 pub struct GetIdentityMappingStore(
8244 RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8245 );
8246
8247 impl GetIdentityMappingStore {
8248 pub(crate) fn new(
8249 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8250 ) -> Self {
8251 Self(RequestBuilder::new(stub))
8252 }
8253
8254 pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8256 mut self,
8257 v: V,
8258 ) -> Self {
8259 self.0.request = v.into();
8260 self
8261 }
8262
8263 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8265 self.0.options = v.into();
8266 self
8267 }
8268
8269 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8271 (*self.0.stub)
8272 .get_identity_mapping_store(self.0.request, self.0.options)
8273 .await
8274 .map(crate::Response::into_body)
8275 }
8276
8277 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8281 self.0.request.name = v.into();
8282 self
8283 }
8284 }
8285
8286 #[doc(hidden)]
8287 impl crate::RequestBuilder for GetIdentityMappingStore {
8288 fn request_options(&mut self) -> &mut crate::RequestOptions {
8289 &mut self.0.options
8290 }
8291 }
8292
8293 #[derive(Clone, Debug)]
8311 pub struct DeleteIdentityMappingStore(
8312 RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8313 );
8314
8315 impl DeleteIdentityMappingStore {
8316 pub(crate) fn new(
8317 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8318 ) -> Self {
8319 Self(RequestBuilder::new(stub))
8320 }
8321
8322 pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8324 mut self,
8325 v: V,
8326 ) -> Self {
8327 self.0.request = v.into();
8328 self
8329 }
8330
8331 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8333 self.0.options = v.into();
8334 self
8335 }
8336
8337 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8344 (*self.0.stub)
8345 .delete_identity_mapping_store(self.0.request, self.0.options)
8346 .await
8347 .map(crate::Response::into_body)
8348 }
8349
8350 pub fn poller(
8352 self,
8353 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata>
8354 {
8355 type Operation = google_cloud_lro::internal::Operation<
8356 wkt::Empty,
8357 crate::model::DeleteIdentityMappingStoreMetadata,
8358 >;
8359 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8360 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8361 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
8362 if let Some(ref mut details) = poller_options.tracing {
8363 details.method_name = "google_cloud_discoveryengine_v1::client::IdentityMappingStoreService::delete_identity_mapping_store::until_done";
8364 }
8365
8366 let stub = self.0.stub.clone();
8367 let mut options = self.0.options.clone();
8368 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8369 let query = move |name| {
8370 let stub = stub.clone();
8371 let options = options.clone();
8372 async {
8373 let op = GetOperation::new(stub)
8374 .set_name(name)
8375 .with_options(options)
8376 .send()
8377 .await?;
8378 Ok(Operation::new(op))
8379 }
8380 };
8381
8382 let start = move || async {
8383 let op = self.send().await?;
8384 Ok(Operation::new(op))
8385 };
8386
8387 use google_cloud_lro::internal::PollerExt;
8388 {
8389 google_cloud_lro::internal::new_unit_response_poller(
8390 polling_error_policy,
8391 polling_backoff_policy,
8392 start,
8393 query,
8394 )
8395 }
8396 .with_options(poller_options)
8397 }
8398
8399 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8403 self.0.request.name = v.into();
8404 self
8405 }
8406 }
8407
8408 #[doc(hidden)]
8409 impl crate::RequestBuilder for DeleteIdentityMappingStore {
8410 fn request_options(&mut self) -> &mut crate::RequestOptions {
8411 &mut self.0.options
8412 }
8413 }
8414
8415 #[derive(Clone, Debug)]
8433 pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8434
8435 impl ImportIdentityMappings {
8436 pub(crate) fn new(
8437 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8438 ) -> Self {
8439 Self(RequestBuilder::new(stub))
8440 }
8441
8442 pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8444 mut self,
8445 v: V,
8446 ) -> Self {
8447 self.0.request = v.into();
8448 self
8449 }
8450
8451 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8453 self.0.options = v.into();
8454 self
8455 }
8456
8457 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8464 (*self.0.stub)
8465 .import_identity_mappings(self.0.request, self.0.options)
8466 .await
8467 .map(crate::Response::into_body)
8468 }
8469
8470 pub fn poller(
8472 self,
8473 ) -> impl google_cloud_lro::Poller<
8474 crate::model::ImportIdentityMappingsResponse,
8475 crate::model::IdentityMappingEntryOperationMetadata,
8476 > {
8477 type Operation = google_cloud_lro::internal::Operation<
8478 crate::model::ImportIdentityMappingsResponse,
8479 crate::model::IdentityMappingEntryOperationMetadata,
8480 >;
8481 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8482 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8483 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
8484 if let Some(ref mut details) = poller_options.tracing {
8485 details.method_name = "google_cloud_discoveryengine_v1::client::IdentityMappingStoreService::import_identity_mappings::until_done";
8486 }
8487
8488 let stub = self.0.stub.clone();
8489 let mut options = self.0.options.clone();
8490 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8491 let query = move |name| {
8492 let stub = stub.clone();
8493 let options = options.clone();
8494 async {
8495 let op = GetOperation::new(stub)
8496 .set_name(name)
8497 .with_options(options)
8498 .send()
8499 .await?;
8500 Ok(Operation::new(op))
8501 }
8502 };
8503
8504 let start = move || async {
8505 let op = self.send().await?;
8506 Ok(Operation::new(op))
8507 };
8508
8509 use google_cloud_lro::internal::PollerExt;
8510 {
8511 google_cloud_lro::internal::new_poller(
8512 polling_error_policy,
8513 polling_backoff_policy,
8514 start,
8515 query,
8516 )
8517 }
8518 .with_options(poller_options)
8519 }
8520
8521 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8525 self.0.request.identity_mapping_store = v.into();
8526 self
8527 }
8528
8529 pub fn set_source<
8534 T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
8535 >(
8536 mut self,
8537 v: T,
8538 ) -> Self {
8539 self.0.request.source = v.into();
8540 self
8541 }
8542
8543 pub fn set_inline_source<
8549 T: std::convert::Into<
8550 std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
8551 >,
8552 >(
8553 mut self,
8554 v: T,
8555 ) -> Self {
8556 self.0.request = self.0.request.set_inline_source(v);
8557 self
8558 }
8559 }
8560
8561 #[doc(hidden)]
8562 impl crate::RequestBuilder for ImportIdentityMappings {
8563 fn request_options(&mut self) -> &mut crate::RequestOptions {
8564 &mut self.0.options
8565 }
8566 }
8567
8568 #[derive(Clone, Debug)]
8586 pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
8587
8588 impl PurgeIdentityMappings {
8589 pub(crate) fn new(
8590 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8591 ) -> Self {
8592 Self(RequestBuilder::new(stub))
8593 }
8594
8595 pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
8597 mut self,
8598 v: V,
8599 ) -> Self {
8600 self.0.request = v.into();
8601 self
8602 }
8603
8604 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8606 self.0.options = v.into();
8607 self
8608 }
8609
8610 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8617 (*self.0.stub)
8618 .purge_identity_mappings(self.0.request, self.0.options)
8619 .await
8620 .map(crate::Response::into_body)
8621 }
8622
8623 pub fn poller(
8625 self,
8626 ) -> impl google_cloud_lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata>
8627 {
8628 type Operation = google_cloud_lro::internal::Operation<
8629 wkt::Empty,
8630 crate::model::IdentityMappingEntryOperationMetadata,
8631 >;
8632 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8633 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8634 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
8635 if let Some(ref mut details) = poller_options.tracing {
8636 details.method_name = "google_cloud_discoveryengine_v1::client::IdentityMappingStoreService::purge_identity_mappings::until_done";
8637 }
8638
8639 let stub = self.0.stub.clone();
8640 let mut options = self.0.options.clone();
8641 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8642 let query = move |name| {
8643 let stub = stub.clone();
8644 let options = options.clone();
8645 async {
8646 let op = GetOperation::new(stub)
8647 .set_name(name)
8648 .with_options(options)
8649 .send()
8650 .await?;
8651 Ok(Operation::new(op))
8652 }
8653 };
8654
8655 let start = move || async {
8656 let op = self.send().await?;
8657 Ok(Operation::new(op))
8658 };
8659
8660 use google_cloud_lro::internal::PollerExt;
8661 {
8662 google_cloud_lro::internal::new_unit_response_poller(
8663 polling_error_policy,
8664 polling_backoff_policy,
8665 start,
8666 query,
8667 )
8668 }
8669 .with_options(poller_options)
8670 }
8671
8672 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8676 self.0.request.identity_mapping_store = v.into();
8677 self
8678 }
8679
8680 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8682 self.0.request.filter = v.into();
8683 self
8684 }
8685
8686 pub fn set_force<T>(mut self, v: T) -> Self
8688 where
8689 T: std::convert::Into<bool>,
8690 {
8691 self.0.request.force = std::option::Option::Some(v.into());
8692 self
8693 }
8694
8695 pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
8697 where
8698 T: std::convert::Into<bool>,
8699 {
8700 self.0.request.force = v.map(|x| x.into());
8701 self
8702 }
8703
8704 pub fn set_source<
8709 T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
8710 >(
8711 mut self,
8712 v: T,
8713 ) -> Self {
8714 self.0.request.source = v.into();
8715 self
8716 }
8717
8718 pub fn set_inline_source<
8724 T: std::convert::Into<
8725 std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
8726 >,
8727 >(
8728 mut self,
8729 v: T,
8730 ) -> Self {
8731 self.0.request = self.0.request.set_inline_source(v);
8732 self
8733 }
8734 }
8735
8736 #[doc(hidden)]
8737 impl crate::RequestBuilder for PurgeIdentityMappings {
8738 fn request_options(&mut self) -> &mut crate::RequestOptions {
8739 &mut self.0.options
8740 }
8741 }
8742
8743 #[derive(Clone, Debug)]
8764 pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
8765
8766 impl ListIdentityMappings {
8767 pub(crate) fn new(
8768 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8769 ) -> Self {
8770 Self(RequestBuilder::new(stub))
8771 }
8772
8773 pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
8775 mut self,
8776 v: V,
8777 ) -> Self {
8778 self.0.request = v.into();
8779 self
8780 }
8781
8782 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8784 self.0.options = v.into();
8785 self
8786 }
8787
8788 pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
8790 (*self.0.stub)
8791 .list_identity_mappings(self.0.request, self.0.options)
8792 .await
8793 .map(crate::Response::into_body)
8794 }
8795
8796 pub fn by_page(
8798 self,
8799 ) -> impl google_cloud_gax::paginator::Paginator<
8800 crate::model::ListIdentityMappingsResponse,
8801 crate::Error,
8802 > {
8803 use std::clone::Clone;
8804 let token = self.0.request.page_token.clone();
8805 let execute = move |token: String| {
8806 let mut builder = self.clone();
8807 builder.0.request = builder.0.request.set_page_token(token);
8808 builder.send()
8809 };
8810 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8811 }
8812
8813 pub fn by_item(
8815 self,
8816 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8817 crate::model::ListIdentityMappingsResponse,
8818 crate::Error,
8819 > {
8820 use google_cloud_gax::paginator::Paginator;
8821 self.by_page().items()
8822 }
8823
8824 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8828 self.0.request.identity_mapping_store = v.into();
8829 self
8830 }
8831
8832 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8834 self.0.request.page_size = v.into();
8835 self
8836 }
8837
8838 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8840 self.0.request.page_token = v.into();
8841 self
8842 }
8843 }
8844
8845 #[doc(hidden)]
8846 impl crate::RequestBuilder for ListIdentityMappings {
8847 fn request_options(&mut self) -> &mut crate::RequestOptions {
8848 &mut self.0.options
8849 }
8850 }
8851
8852 #[derive(Clone, Debug)]
8873 pub struct ListIdentityMappingStores(
8874 RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
8875 );
8876
8877 impl ListIdentityMappingStores {
8878 pub(crate) fn new(
8879 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8880 ) -> Self {
8881 Self(RequestBuilder::new(stub))
8882 }
8883
8884 pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
8886 mut self,
8887 v: V,
8888 ) -> Self {
8889 self.0.request = v.into();
8890 self
8891 }
8892
8893 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8895 self.0.options = v.into();
8896 self
8897 }
8898
8899 pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
8901 (*self.0.stub)
8902 .list_identity_mapping_stores(self.0.request, self.0.options)
8903 .await
8904 .map(crate::Response::into_body)
8905 }
8906
8907 pub fn by_page(
8909 self,
8910 ) -> impl google_cloud_gax::paginator::Paginator<
8911 crate::model::ListIdentityMappingStoresResponse,
8912 crate::Error,
8913 > {
8914 use std::clone::Clone;
8915 let token = self.0.request.page_token.clone();
8916 let execute = move |token: String| {
8917 let mut builder = self.clone();
8918 builder.0.request = builder.0.request.set_page_token(token);
8919 builder.send()
8920 };
8921 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8922 }
8923
8924 pub fn by_item(
8926 self,
8927 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8928 crate::model::ListIdentityMappingStoresResponse,
8929 crate::Error,
8930 > {
8931 use google_cloud_gax::paginator::Paginator;
8932 self.by_page().items()
8933 }
8934
8935 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8939 self.0.request.parent = v.into();
8940 self
8941 }
8942
8943 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8945 self.0.request.page_size = v.into();
8946 self
8947 }
8948
8949 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8951 self.0.request.page_token = v.into();
8952 self
8953 }
8954 }
8955
8956 #[doc(hidden)]
8957 impl crate::RequestBuilder for ListIdentityMappingStores {
8958 fn request_options(&mut self) -> &mut crate::RequestOptions {
8959 &mut self.0.options
8960 }
8961 }
8962
8963 #[derive(Clone, Debug)]
8984 pub struct ListOperations(
8985 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8986 );
8987
8988 impl ListOperations {
8989 pub(crate) fn new(
8990 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8991 ) -> Self {
8992 Self(RequestBuilder::new(stub))
8993 }
8994
8995 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8997 mut self,
8998 v: V,
8999 ) -> Self {
9000 self.0.request = v.into();
9001 self
9002 }
9003
9004 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9006 self.0.options = v.into();
9007 self
9008 }
9009
9010 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9012 (*self.0.stub)
9013 .list_operations(self.0.request, self.0.options)
9014 .await
9015 .map(crate::Response::into_body)
9016 }
9017
9018 pub fn by_page(
9020 self,
9021 ) -> impl google_cloud_gax::paginator::Paginator<
9022 google_cloud_longrunning::model::ListOperationsResponse,
9023 crate::Error,
9024 > {
9025 use std::clone::Clone;
9026 let token = self.0.request.page_token.clone();
9027 let execute = move |token: String| {
9028 let mut builder = self.clone();
9029 builder.0.request = builder.0.request.set_page_token(token);
9030 builder.send()
9031 };
9032 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9033 }
9034
9035 pub fn by_item(
9037 self,
9038 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9039 google_cloud_longrunning::model::ListOperationsResponse,
9040 crate::Error,
9041 > {
9042 use google_cloud_gax::paginator::Paginator;
9043 self.by_page().items()
9044 }
9045
9046 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9048 self.0.request.name = v.into();
9049 self
9050 }
9051
9052 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9054 self.0.request.filter = v.into();
9055 self
9056 }
9057
9058 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9060 self.0.request.page_size = v.into();
9061 self
9062 }
9063
9064 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9066 self.0.request.page_token = v.into();
9067 self
9068 }
9069
9070 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9072 self.0.request.return_partial_success = v.into();
9073 self
9074 }
9075 }
9076
9077 #[doc(hidden)]
9078 impl crate::RequestBuilder for ListOperations {
9079 fn request_options(&mut self) -> &mut crate::RequestOptions {
9080 &mut self.0.options
9081 }
9082 }
9083
9084 #[derive(Clone, Debug)]
9101 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9102
9103 impl GetOperation {
9104 pub(crate) fn new(
9105 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9106 ) -> Self {
9107 Self(RequestBuilder::new(stub))
9108 }
9109
9110 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9112 mut self,
9113 v: V,
9114 ) -> Self {
9115 self.0.request = v.into();
9116 self
9117 }
9118
9119 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9121 self.0.options = v.into();
9122 self
9123 }
9124
9125 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9127 (*self.0.stub)
9128 .get_operation(self.0.request, self.0.options)
9129 .await
9130 .map(crate::Response::into_body)
9131 }
9132
9133 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9135 self.0.request.name = v.into();
9136 self
9137 }
9138 }
9139
9140 #[doc(hidden)]
9141 impl crate::RequestBuilder for GetOperation {
9142 fn request_options(&mut self) -> &mut crate::RequestOptions {
9143 &mut self.0.options
9144 }
9145 }
9146
9147 #[derive(Clone, Debug)]
9164 pub struct CancelOperation(
9165 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9166 );
9167
9168 impl CancelOperation {
9169 pub(crate) fn new(
9170 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9171 ) -> Self {
9172 Self(RequestBuilder::new(stub))
9173 }
9174
9175 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9177 mut self,
9178 v: V,
9179 ) -> Self {
9180 self.0.request = v.into();
9181 self
9182 }
9183
9184 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9186 self.0.options = v.into();
9187 self
9188 }
9189
9190 pub async fn send(self) -> Result<()> {
9192 (*self.0.stub)
9193 .cancel_operation(self.0.request, self.0.options)
9194 .await
9195 .map(crate::Response::into_body)
9196 }
9197
9198 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9200 self.0.request.name = v.into();
9201 self
9202 }
9203 }
9204
9205 #[doc(hidden)]
9206 impl crate::RequestBuilder for CancelOperation {
9207 fn request_options(&mut self) -> &mut crate::RequestOptions {
9208 &mut self.0.options
9209 }
9210 }
9211}
9212
9213#[cfg(feature = "project-service")]
9215#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
9216pub mod project_service {
9217 use crate::Result;
9218
9219 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9233
9234 pub(crate) mod client {
9235 use super::super::super::client::ProjectService;
9236 pub struct Factory;
9237 impl crate::ClientFactory for Factory {
9238 type Client = ProjectService;
9239 type Credentials = gaxi::options::Credentials;
9240 async fn build(
9241 self,
9242 config: gaxi::options::ClientConfig,
9243 ) -> crate::ClientBuilderResult<Self::Client> {
9244 Self::Client::new(config).await
9245 }
9246 }
9247 }
9248
9249 #[derive(Clone, Debug)]
9251 pub(crate) struct RequestBuilder<R: std::default::Default> {
9252 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9253 request: R,
9254 options: crate::RequestOptions,
9255 }
9256
9257 impl<R> RequestBuilder<R>
9258 where
9259 R: std::default::Default,
9260 {
9261 pub(crate) fn new(
9262 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9263 ) -> Self {
9264 Self {
9265 stub,
9266 request: R::default(),
9267 options: crate::RequestOptions::default(),
9268 }
9269 }
9270 }
9271
9272 #[derive(Clone, Debug)]
9290 pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9291
9292 impl ProvisionProject {
9293 pub(crate) fn new(
9294 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9295 ) -> Self {
9296 Self(RequestBuilder::new(stub))
9297 }
9298
9299 pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9301 mut self,
9302 v: V,
9303 ) -> Self {
9304 self.0.request = v.into();
9305 self
9306 }
9307
9308 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9310 self.0.options = v.into();
9311 self
9312 }
9313
9314 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9321 (*self.0.stub)
9322 .provision_project(self.0.request, self.0.options)
9323 .await
9324 .map(crate::Response::into_body)
9325 }
9326
9327 pub fn poller(
9329 self,
9330 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9331 {
9332 type Operation = google_cloud_lro::internal::Operation<
9333 crate::model::Project,
9334 crate::model::ProvisionProjectMetadata,
9335 >;
9336 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9337 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9338 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
9339 if let Some(ref mut details) = poller_options.tracing {
9340 details.method_name = "google_cloud_discoveryengine_v1::client::ProjectService::provision_project::until_done";
9341 }
9342
9343 let stub = self.0.stub.clone();
9344 let mut options = self.0.options.clone();
9345 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9346 let query = move |name| {
9347 let stub = stub.clone();
9348 let options = options.clone();
9349 async {
9350 let op = GetOperation::new(stub)
9351 .set_name(name)
9352 .with_options(options)
9353 .send()
9354 .await?;
9355 Ok(Operation::new(op))
9356 }
9357 };
9358
9359 let start = move || async {
9360 let op = self.send().await?;
9361 Ok(Operation::new(op))
9362 };
9363
9364 use google_cloud_lro::internal::PollerExt;
9365 {
9366 google_cloud_lro::internal::new_poller(
9367 polling_error_policy,
9368 polling_backoff_policy,
9369 start,
9370 query,
9371 )
9372 }
9373 .with_options(poller_options)
9374 }
9375
9376 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9380 self.0.request.name = v.into();
9381 self
9382 }
9383
9384 pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9388 self.0.request.accept_data_use_terms = v.into();
9389 self
9390 }
9391
9392 pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9396 self.0.request.data_use_terms_version = v.into();
9397 self
9398 }
9399 }
9400
9401 #[doc(hidden)]
9402 impl crate::RequestBuilder for ProvisionProject {
9403 fn request_options(&mut self) -> &mut crate::RequestOptions {
9404 &mut self.0.options
9405 }
9406 }
9407
9408 #[derive(Clone, Debug)]
9429 pub struct ListOperations(
9430 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9431 );
9432
9433 impl ListOperations {
9434 pub(crate) fn new(
9435 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9436 ) -> Self {
9437 Self(RequestBuilder::new(stub))
9438 }
9439
9440 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9442 mut self,
9443 v: V,
9444 ) -> Self {
9445 self.0.request = v.into();
9446 self
9447 }
9448
9449 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9451 self.0.options = v.into();
9452 self
9453 }
9454
9455 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9457 (*self.0.stub)
9458 .list_operations(self.0.request, self.0.options)
9459 .await
9460 .map(crate::Response::into_body)
9461 }
9462
9463 pub fn by_page(
9465 self,
9466 ) -> impl google_cloud_gax::paginator::Paginator<
9467 google_cloud_longrunning::model::ListOperationsResponse,
9468 crate::Error,
9469 > {
9470 use std::clone::Clone;
9471 let token = self.0.request.page_token.clone();
9472 let execute = move |token: String| {
9473 let mut builder = self.clone();
9474 builder.0.request = builder.0.request.set_page_token(token);
9475 builder.send()
9476 };
9477 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9478 }
9479
9480 pub fn by_item(
9482 self,
9483 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9484 google_cloud_longrunning::model::ListOperationsResponse,
9485 crate::Error,
9486 > {
9487 use google_cloud_gax::paginator::Paginator;
9488 self.by_page().items()
9489 }
9490
9491 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9493 self.0.request.name = v.into();
9494 self
9495 }
9496
9497 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9499 self.0.request.filter = v.into();
9500 self
9501 }
9502
9503 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9505 self.0.request.page_size = v.into();
9506 self
9507 }
9508
9509 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9511 self.0.request.page_token = v.into();
9512 self
9513 }
9514
9515 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9517 self.0.request.return_partial_success = v.into();
9518 self
9519 }
9520 }
9521
9522 #[doc(hidden)]
9523 impl crate::RequestBuilder for ListOperations {
9524 fn request_options(&mut self) -> &mut crate::RequestOptions {
9525 &mut self.0.options
9526 }
9527 }
9528
9529 #[derive(Clone, Debug)]
9546 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9547
9548 impl GetOperation {
9549 pub(crate) fn new(
9550 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9551 ) -> Self {
9552 Self(RequestBuilder::new(stub))
9553 }
9554
9555 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9557 mut self,
9558 v: V,
9559 ) -> Self {
9560 self.0.request = v.into();
9561 self
9562 }
9563
9564 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9566 self.0.options = v.into();
9567 self
9568 }
9569
9570 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9572 (*self.0.stub)
9573 .get_operation(self.0.request, self.0.options)
9574 .await
9575 .map(crate::Response::into_body)
9576 }
9577
9578 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9580 self.0.request.name = v.into();
9581 self
9582 }
9583 }
9584
9585 #[doc(hidden)]
9586 impl crate::RequestBuilder for GetOperation {
9587 fn request_options(&mut self) -> &mut crate::RequestOptions {
9588 &mut self.0.options
9589 }
9590 }
9591
9592 #[derive(Clone, Debug)]
9609 pub struct CancelOperation(
9610 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9611 );
9612
9613 impl CancelOperation {
9614 pub(crate) fn new(
9615 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9616 ) -> Self {
9617 Self(RequestBuilder::new(stub))
9618 }
9619
9620 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9622 mut self,
9623 v: V,
9624 ) -> Self {
9625 self.0.request = v.into();
9626 self
9627 }
9628
9629 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9631 self.0.options = v.into();
9632 self
9633 }
9634
9635 pub async fn send(self) -> Result<()> {
9637 (*self.0.stub)
9638 .cancel_operation(self.0.request, self.0.options)
9639 .await
9640 .map(crate::Response::into_body)
9641 }
9642
9643 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9645 self.0.request.name = v.into();
9646 self
9647 }
9648 }
9649
9650 #[doc(hidden)]
9651 impl crate::RequestBuilder for CancelOperation {
9652 fn request_options(&mut self) -> &mut crate::RequestOptions {
9653 &mut self.0.options
9654 }
9655 }
9656}
9657
9658#[cfg(feature = "rank-service")]
9660#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
9661pub mod rank_service {
9662 use crate::Result;
9663
9664 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9678
9679 pub(crate) mod client {
9680 use super::super::super::client::RankService;
9681 pub struct Factory;
9682 impl crate::ClientFactory for Factory {
9683 type Client = RankService;
9684 type Credentials = gaxi::options::Credentials;
9685 async fn build(
9686 self,
9687 config: gaxi::options::ClientConfig,
9688 ) -> crate::ClientBuilderResult<Self::Client> {
9689 Self::Client::new(config).await
9690 }
9691 }
9692 }
9693
9694 #[derive(Clone, Debug)]
9696 pub(crate) struct RequestBuilder<R: std::default::Default> {
9697 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9698 request: R,
9699 options: crate::RequestOptions,
9700 }
9701
9702 impl<R> RequestBuilder<R>
9703 where
9704 R: std::default::Default,
9705 {
9706 pub(crate) fn new(
9707 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9708 ) -> Self {
9709 Self {
9710 stub,
9711 request: R::default(),
9712 options: crate::RequestOptions::default(),
9713 }
9714 }
9715 }
9716
9717 #[derive(Clone, Debug)]
9734 pub struct Rank(RequestBuilder<crate::model::RankRequest>);
9735
9736 impl Rank {
9737 pub(crate) fn new(
9738 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9739 ) -> Self {
9740 Self(RequestBuilder::new(stub))
9741 }
9742
9743 pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
9745 self.0.request = v.into();
9746 self
9747 }
9748
9749 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9751 self.0.options = v.into();
9752 self
9753 }
9754
9755 pub async fn send(self) -> Result<crate::model::RankResponse> {
9757 (*self.0.stub)
9758 .rank(self.0.request, self.0.options)
9759 .await
9760 .map(crate::Response::into_body)
9761 }
9762
9763 pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9767 self.0.request.ranking_config = v.into();
9768 self
9769 }
9770
9771 pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
9773 self.0.request.model = v.into();
9774 self
9775 }
9776
9777 pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
9779 self.0.request.top_n = v.into();
9780 self
9781 }
9782
9783 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
9785 self.0.request.query = v.into();
9786 self
9787 }
9788
9789 pub fn set_records<T, V>(mut self, v: T) -> Self
9793 where
9794 T: std::iter::IntoIterator<Item = V>,
9795 V: std::convert::Into<crate::model::RankingRecord>,
9796 {
9797 use std::iter::Iterator;
9798 self.0.request.records = v.into_iter().map(|i| i.into()).collect();
9799 self
9800 }
9801
9802 pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
9804 self.0.request.ignore_record_details_in_response = v.into();
9805 self
9806 }
9807
9808 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9810 where
9811 T: std::iter::IntoIterator<Item = (K, V)>,
9812 K: std::convert::Into<std::string::String>,
9813 V: std::convert::Into<std::string::String>,
9814 {
9815 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9816 self
9817 }
9818 }
9819
9820 #[doc(hidden)]
9821 impl crate::RequestBuilder for Rank {
9822 fn request_options(&mut self) -> &mut crate::RequestOptions {
9823 &mut self.0.options
9824 }
9825 }
9826
9827 #[derive(Clone, Debug)]
9848 pub struct ListOperations(
9849 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9850 );
9851
9852 impl ListOperations {
9853 pub(crate) fn new(
9854 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9855 ) -> Self {
9856 Self(RequestBuilder::new(stub))
9857 }
9858
9859 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9861 mut self,
9862 v: V,
9863 ) -> Self {
9864 self.0.request = v.into();
9865 self
9866 }
9867
9868 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9870 self.0.options = v.into();
9871 self
9872 }
9873
9874 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9876 (*self.0.stub)
9877 .list_operations(self.0.request, self.0.options)
9878 .await
9879 .map(crate::Response::into_body)
9880 }
9881
9882 pub fn by_page(
9884 self,
9885 ) -> impl google_cloud_gax::paginator::Paginator<
9886 google_cloud_longrunning::model::ListOperationsResponse,
9887 crate::Error,
9888 > {
9889 use std::clone::Clone;
9890 let token = self.0.request.page_token.clone();
9891 let execute = move |token: String| {
9892 let mut builder = self.clone();
9893 builder.0.request = builder.0.request.set_page_token(token);
9894 builder.send()
9895 };
9896 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9897 }
9898
9899 pub fn by_item(
9901 self,
9902 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9903 google_cloud_longrunning::model::ListOperationsResponse,
9904 crate::Error,
9905 > {
9906 use google_cloud_gax::paginator::Paginator;
9907 self.by_page().items()
9908 }
9909
9910 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9912 self.0.request.name = v.into();
9913 self
9914 }
9915
9916 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9918 self.0.request.filter = v.into();
9919 self
9920 }
9921
9922 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9924 self.0.request.page_size = v.into();
9925 self
9926 }
9927
9928 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9930 self.0.request.page_token = v.into();
9931 self
9932 }
9933
9934 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9936 self.0.request.return_partial_success = v.into();
9937 self
9938 }
9939 }
9940
9941 #[doc(hidden)]
9942 impl crate::RequestBuilder for ListOperations {
9943 fn request_options(&mut self) -> &mut crate::RequestOptions {
9944 &mut self.0.options
9945 }
9946 }
9947
9948 #[derive(Clone, Debug)]
9965 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9966
9967 impl GetOperation {
9968 pub(crate) fn new(
9969 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9970 ) -> Self {
9971 Self(RequestBuilder::new(stub))
9972 }
9973
9974 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9976 mut self,
9977 v: V,
9978 ) -> Self {
9979 self.0.request = v.into();
9980 self
9981 }
9982
9983 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9985 self.0.options = v.into();
9986 self
9987 }
9988
9989 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9991 (*self.0.stub)
9992 .get_operation(self.0.request, self.0.options)
9993 .await
9994 .map(crate::Response::into_body)
9995 }
9996
9997 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9999 self.0.request.name = v.into();
10000 self
10001 }
10002 }
10003
10004 #[doc(hidden)]
10005 impl crate::RequestBuilder for GetOperation {
10006 fn request_options(&mut self) -> &mut crate::RequestOptions {
10007 &mut self.0.options
10008 }
10009 }
10010
10011 #[derive(Clone, Debug)]
10028 pub struct CancelOperation(
10029 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10030 );
10031
10032 impl CancelOperation {
10033 pub(crate) fn new(
10034 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10035 ) -> Self {
10036 Self(RequestBuilder::new(stub))
10037 }
10038
10039 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10041 mut self,
10042 v: V,
10043 ) -> Self {
10044 self.0.request = v.into();
10045 self
10046 }
10047
10048 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10050 self.0.options = v.into();
10051 self
10052 }
10053
10054 pub async fn send(self) -> Result<()> {
10056 (*self.0.stub)
10057 .cancel_operation(self.0.request, self.0.options)
10058 .await
10059 .map(crate::Response::into_body)
10060 }
10061
10062 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10064 self.0.request.name = v.into();
10065 self
10066 }
10067 }
10068
10069 #[doc(hidden)]
10070 impl crate::RequestBuilder for CancelOperation {
10071 fn request_options(&mut self) -> &mut crate::RequestOptions {
10072 &mut self.0.options
10073 }
10074 }
10075}
10076
10077#[cfg(feature = "recommendation-service")]
10079#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
10080pub mod recommendation_service {
10081 use crate::Result;
10082
10083 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10097
10098 pub(crate) mod client {
10099 use super::super::super::client::RecommendationService;
10100 pub struct Factory;
10101 impl crate::ClientFactory for Factory {
10102 type Client = RecommendationService;
10103 type Credentials = gaxi::options::Credentials;
10104 async fn build(
10105 self,
10106 config: gaxi::options::ClientConfig,
10107 ) -> crate::ClientBuilderResult<Self::Client> {
10108 Self::Client::new(config).await
10109 }
10110 }
10111 }
10112
10113 #[derive(Clone, Debug)]
10115 pub(crate) struct RequestBuilder<R: std::default::Default> {
10116 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10117 request: R,
10118 options: crate::RequestOptions,
10119 }
10120
10121 impl<R> RequestBuilder<R>
10122 where
10123 R: std::default::Default,
10124 {
10125 pub(crate) fn new(
10126 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10127 ) -> Self {
10128 Self {
10129 stub,
10130 request: R::default(),
10131 options: crate::RequestOptions::default(),
10132 }
10133 }
10134 }
10135
10136 #[derive(Clone, Debug)]
10153 pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
10154
10155 impl Recommend {
10156 pub(crate) fn new(
10157 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10158 ) -> Self {
10159 Self(RequestBuilder::new(stub))
10160 }
10161
10162 pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
10164 self.0.request = v.into();
10165 self
10166 }
10167
10168 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10170 self.0.options = v.into();
10171 self
10172 }
10173
10174 pub async fn send(self) -> Result<crate::model::RecommendResponse> {
10176 (*self.0.stub)
10177 .recommend(self.0.request, self.0.options)
10178 .await
10179 .map(crate::Response::into_body)
10180 }
10181
10182 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
10186 self.0.request.serving_config = v.into();
10187 self
10188 }
10189
10190 pub fn set_user_event<T>(mut self, v: T) -> Self
10194 where
10195 T: std::convert::Into<crate::model::UserEvent>,
10196 {
10197 self.0.request.user_event = std::option::Option::Some(v.into());
10198 self
10199 }
10200
10201 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
10205 where
10206 T: std::convert::Into<crate::model::UserEvent>,
10207 {
10208 self.0.request.user_event = v.map(|x| x.into());
10209 self
10210 }
10211
10212 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10214 self.0.request.page_size = v.into();
10215 self
10216 }
10217
10218 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10220 self.0.request.filter = v.into();
10221 self
10222 }
10223
10224 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
10226 self.0.request.validate_only = v.into();
10227 self
10228 }
10229
10230 pub fn set_params<T, K, V>(mut self, v: T) -> Self
10232 where
10233 T: std::iter::IntoIterator<Item = (K, V)>,
10234 K: std::convert::Into<std::string::String>,
10235 V: std::convert::Into<wkt::Value>,
10236 {
10237 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10238 self
10239 }
10240
10241 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
10243 where
10244 T: std::iter::IntoIterator<Item = (K, V)>,
10245 K: std::convert::Into<std::string::String>,
10246 V: std::convert::Into<std::string::String>,
10247 {
10248 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10249 self
10250 }
10251 }
10252
10253 #[doc(hidden)]
10254 impl crate::RequestBuilder for Recommend {
10255 fn request_options(&mut self) -> &mut crate::RequestOptions {
10256 &mut self.0.options
10257 }
10258 }
10259
10260 #[derive(Clone, Debug)]
10281 pub struct ListOperations(
10282 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10283 );
10284
10285 impl ListOperations {
10286 pub(crate) fn new(
10287 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10288 ) -> Self {
10289 Self(RequestBuilder::new(stub))
10290 }
10291
10292 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
10294 mut self,
10295 v: V,
10296 ) -> Self {
10297 self.0.request = v.into();
10298 self
10299 }
10300
10301 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10303 self.0.options = v.into();
10304 self
10305 }
10306
10307 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
10309 (*self.0.stub)
10310 .list_operations(self.0.request, self.0.options)
10311 .await
10312 .map(crate::Response::into_body)
10313 }
10314
10315 pub fn by_page(
10317 self,
10318 ) -> impl google_cloud_gax::paginator::Paginator<
10319 google_cloud_longrunning::model::ListOperationsResponse,
10320 crate::Error,
10321 > {
10322 use std::clone::Clone;
10323 let token = self.0.request.page_token.clone();
10324 let execute = move |token: String| {
10325 let mut builder = self.clone();
10326 builder.0.request = builder.0.request.set_page_token(token);
10327 builder.send()
10328 };
10329 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10330 }
10331
10332 pub fn by_item(
10334 self,
10335 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10336 google_cloud_longrunning::model::ListOperationsResponse,
10337 crate::Error,
10338 > {
10339 use google_cloud_gax::paginator::Paginator;
10340 self.by_page().items()
10341 }
10342
10343 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10345 self.0.request.name = v.into();
10346 self
10347 }
10348
10349 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10351 self.0.request.filter = v.into();
10352 self
10353 }
10354
10355 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10357 self.0.request.page_size = v.into();
10358 self
10359 }
10360
10361 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10363 self.0.request.page_token = v.into();
10364 self
10365 }
10366
10367 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10369 self.0.request.return_partial_success = v.into();
10370 self
10371 }
10372 }
10373
10374 #[doc(hidden)]
10375 impl crate::RequestBuilder for ListOperations {
10376 fn request_options(&mut self) -> &mut crate::RequestOptions {
10377 &mut self.0.options
10378 }
10379 }
10380
10381 #[derive(Clone, Debug)]
10398 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10399
10400 impl GetOperation {
10401 pub(crate) fn new(
10402 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10403 ) -> Self {
10404 Self(RequestBuilder::new(stub))
10405 }
10406
10407 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10409 mut self,
10410 v: V,
10411 ) -> Self {
10412 self.0.request = v.into();
10413 self
10414 }
10415
10416 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10418 self.0.options = v.into();
10419 self
10420 }
10421
10422 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10424 (*self.0.stub)
10425 .get_operation(self.0.request, self.0.options)
10426 .await
10427 .map(crate::Response::into_body)
10428 }
10429
10430 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10432 self.0.request.name = v.into();
10433 self
10434 }
10435 }
10436
10437 #[doc(hidden)]
10438 impl crate::RequestBuilder for GetOperation {
10439 fn request_options(&mut self) -> &mut crate::RequestOptions {
10440 &mut self.0.options
10441 }
10442 }
10443
10444 #[derive(Clone, Debug)]
10461 pub struct CancelOperation(
10462 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10463 );
10464
10465 impl CancelOperation {
10466 pub(crate) fn new(
10467 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10468 ) -> Self {
10469 Self(RequestBuilder::new(stub))
10470 }
10471
10472 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10474 mut self,
10475 v: V,
10476 ) -> Self {
10477 self.0.request = v.into();
10478 self
10479 }
10480
10481 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10483 self.0.options = v.into();
10484 self
10485 }
10486
10487 pub async fn send(self) -> Result<()> {
10489 (*self.0.stub)
10490 .cancel_operation(self.0.request, self.0.options)
10491 .await
10492 .map(crate::Response::into_body)
10493 }
10494
10495 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10497 self.0.request.name = v.into();
10498 self
10499 }
10500 }
10501
10502 #[doc(hidden)]
10503 impl crate::RequestBuilder for CancelOperation {
10504 fn request_options(&mut self) -> &mut crate::RequestOptions {
10505 &mut self.0.options
10506 }
10507 }
10508}
10509
10510#[cfg(feature = "schema-service")]
10512#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
10513pub mod schema_service {
10514 use crate::Result;
10515
10516 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10530
10531 pub(crate) mod client {
10532 use super::super::super::client::SchemaService;
10533 pub struct Factory;
10534 impl crate::ClientFactory for Factory {
10535 type Client = SchemaService;
10536 type Credentials = gaxi::options::Credentials;
10537 async fn build(
10538 self,
10539 config: gaxi::options::ClientConfig,
10540 ) -> crate::ClientBuilderResult<Self::Client> {
10541 Self::Client::new(config).await
10542 }
10543 }
10544 }
10545
10546 #[derive(Clone, Debug)]
10548 pub(crate) struct RequestBuilder<R: std::default::Default> {
10549 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10550 request: R,
10551 options: crate::RequestOptions,
10552 }
10553
10554 impl<R> RequestBuilder<R>
10555 where
10556 R: std::default::Default,
10557 {
10558 pub(crate) fn new(
10559 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10560 ) -> Self {
10561 Self {
10562 stub,
10563 request: R::default(),
10564 options: crate::RequestOptions::default(),
10565 }
10566 }
10567 }
10568
10569 #[derive(Clone, Debug)]
10586 pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
10587
10588 impl GetSchema {
10589 pub(crate) fn new(
10590 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10591 ) -> Self {
10592 Self(RequestBuilder::new(stub))
10593 }
10594
10595 pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
10597 self.0.request = v.into();
10598 self
10599 }
10600
10601 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10603 self.0.options = v.into();
10604 self
10605 }
10606
10607 pub async fn send(self) -> Result<crate::model::Schema> {
10609 (*self.0.stub)
10610 .get_schema(self.0.request, self.0.options)
10611 .await
10612 .map(crate::Response::into_body)
10613 }
10614
10615 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10619 self.0.request.name = v.into();
10620 self
10621 }
10622 }
10623
10624 #[doc(hidden)]
10625 impl crate::RequestBuilder for GetSchema {
10626 fn request_options(&mut self) -> &mut crate::RequestOptions {
10627 &mut self.0.options
10628 }
10629 }
10630
10631 #[derive(Clone, Debug)]
10652 pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
10653
10654 impl ListSchemas {
10655 pub(crate) fn new(
10656 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10657 ) -> Self {
10658 Self(RequestBuilder::new(stub))
10659 }
10660
10661 pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
10663 self.0.request = v.into();
10664 self
10665 }
10666
10667 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10669 self.0.options = v.into();
10670 self
10671 }
10672
10673 pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
10675 (*self.0.stub)
10676 .list_schemas(self.0.request, self.0.options)
10677 .await
10678 .map(crate::Response::into_body)
10679 }
10680
10681 pub fn by_page(
10683 self,
10684 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSchemasResponse, crate::Error>
10685 {
10686 use std::clone::Clone;
10687 let token = self.0.request.page_token.clone();
10688 let execute = move |token: String| {
10689 let mut builder = self.clone();
10690 builder.0.request = builder.0.request.set_page_token(token);
10691 builder.send()
10692 };
10693 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10694 }
10695
10696 pub fn by_item(
10698 self,
10699 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10700 crate::model::ListSchemasResponse,
10701 crate::Error,
10702 > {
10703 use google_cloud_gax::paginator::Paginator;
10704 self.by_page().items()
10705 }
10706
10707 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10711 self.0.request.parent = v.into();
10712 self
10713 }
10714
10715 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10717 self.0.request.page_size = v.into();
10718 self
10719 }
10720
10721 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10723 self.0.request.page_token = v.into();
10724 self
10725 }
10726 }
10727
10728 #[doc(hidden)]
10729 impl crate::RequestBuilder for ListSchemas {
10730 fn request_options(&mut self) -> &mut crate::RequestOptions {
10731 &mut self.0.options
10732 }
10733 }
10734
10735 #[derive(Clone, Debug)]
10753 pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
10754
10755 impl CreateSchema {
10756 pub(crate) fn new(
10757 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10758 ) -> Self {
10759 Self(RequestBuilder::new(stub))
10760 }
10761
10762 pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
10764 self.0.request = v.into();
10765 self
10766 }
10767
10768 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10770 self.0.options = v.into();
10771 self
10772 }
10773
10774 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10781 (*self.0.stub)
10782 .create_schema(self.0.request, self.0.options)
10783 .await
10784 .map(crate::Response::into_body)
10785 }
10786
10787 pub fn poller(
10789 self,
10790 ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata>
10791 {
10792 type Operation = google_cloud_lro::internal::Operation<
10793 crate::model::Schema,
10794 crate::model::CreateSchemaMetadata,
10795 >;
10796 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10797 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10798 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
10799 if let Some(ref mut details) = poller_options.tracing {
10800 details.method_name = "google_cloud_discoveryengine_v1::client::SchemaService::create_schema::until_done";
10801 }
10802
10803 let stub = self.0.stub.clone();
10804 let mut options = self.0.options.clone();
10805 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10806 let query = move |name| {
10807 let stub = stub.clone();
10808 let options = options.clone();
10809 async {
10810 let op = GetOperation::new(stub)
10811 .set_name(name)
10812 .with_options(options)
10813 .send()
10814 .await?;
10815 Ok(Operation::new(op))
10816 }
10817 };
10818
10819 let start = move || async {
10820 let op = self.send().await?;
10821 Ok(Operation::new(op))
10822 };
10823
10824 use google_cloud_lro::internal::PollerExt;
10825 {
10826 google_cloud_lro::internal::new_poller(
10827 polling_error_policy,
10828 polling_backoff_policy,
10829 start,
10830 query,
10831 )
10832 }
10833 .with_options(poller_options)
10834 }
10835
10836 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10840 self.0.request.parent = v.into();
10841 self
10842 }
10843
10844 pub fn set_schema<T>(mut self, v: T) -> Self
10848 where
10849 T: std::convert::Into<crate::model::Schema>,
10850 {
10851 self.0.request.schema = std::option::Option::Some(v.into());
10852 self
10853 }
10854
10855 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10859 where
10860 T: std::convert::Into<crate::model::Schema>,
10861 {
10862 self.0.request.schema = v.map(|x| x.into());
10863 self
10864 }
10865
10866 pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
10870 self.0.request.schema_id = v.into();
10871 self
10872 }
10873 }
10874
10875 #[doc(hidden)]
10876 impl crate::RequestBuilder for CreateSchema {
10877 fn request_options(&mut self) -> &mut crate::RequestOptions {
10878 &mut self.0.options
10879 }
10880 }
10881
10882 #[derive(Clone, Debug)]
10900 pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
10901
10902 impl UpdateSchema {
10903 pub(crate) fn new(
10904 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10905 ) -> Self {
10906 Self(RequestBuilder::new(stub))
10907 }
10908
10909 pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
10911 self.0.request = v.into();
10912 self
10913 }
10914
10915 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10917 self.0.options = v.into();
10918 self
10919 }
10920
10921 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10928 (*self.0.stub)
10929 .update_schema(self.0.request, self.0.options)
10930 .await
10931 .map(crate::Response::into_body)
10932 }
10933
10934 pub fn poller(
10936 self,
10937 ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata>
10938 {
10939 type Operation = google_cloud_lro::internal::Operation<
10940 crate::model::Schema,
10941 crate::model::UpdateSchemaMetadata,
10942 >;
10943 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10944 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10945 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
10946 if let Some(ref mut details) = poller_options.tracing {
10947 details.method_name = "google_cloud_discoveryengine_v1::client::SchemaService::update_schema::until_done";
10948 }
10949
10950 let stub = self.0.stub.clone();
10951 let mut options = self.0.options.clone();
10952 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10953 let query = move |name| {
10954 let stub = stub.clone();
10955 let options = options.clone();
10956 async {
10957 let op = GetOperation::new(stub)
10958 .set_name(name)
10959 .with_options(options)
10960 .send()
10961 .await?;
10962 Ok(Operation::new(op))
10963 }
10964 };
10965
10966 let start = move || async {
10967 let op = self.send().await?;
10968 Ok(Operation::new(op))
10969 };
10970
10971 use google_cloud_lro::internal::PollerExt;
10972 {
10973 google_cloud_lro::internal::new_poller(
10974 polling_error_policy,
10975 polling_backoff_policy,
10976 start,
10977 query,
10978 )
10979 }
10980 .with_options(poller_options)
10981 }
10982
10983 pub fn set_schema<T>(mut self, v: T) -> Self
10987 where
10988 T: std::convert::Into<crate::model::Schema>,
10989 {
10990 self.0.request.schema = std::option::Option::Some(v.into());
10991 self
10992 }
10993
10994 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10998 where
10999 T: std::convert::Into<crate::model::Schema>,
11000 {
11001 self.0.request.schema = v.map(|x| x.into());
11002 self
11003 }
11004
11005 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
11007 self.0.request.allow_missing = v.into();
11008 self
11009 }
11010 }
11011
11012 #[doc(hidden)]
11013 impl crate::RequestBuilder for UpdateSchema {
11014 fn request_options(&mut self) -> &mut crate::RequestOptions {
11015 &mut self.0.options
11016 }
11017 }
11018
11019 #[derive(Clone, Debug)]
11037 pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
11038
11039 impl DeleteSchema {
11040 pub(crate) fn new(
11041 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11042 ) -> Self {
11043 Self(RequestBuilder::new(stub))
11044 }
11045
11046 pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
11048 self.0.request = v.into();
11049 self
11050 }
11051
11052 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11054 self.0.options = v.into();
11055 self
11056 }
11057
11058 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11065 (*self.0.stub)
11066 .delete_schema(self.0.request, self.0.options)
11067 .await
11068 .map(crate::Response::into_body)
11069 }
11070
11071 pub fn poller(
11073 self,
11074 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSchemaMetadata> {
11075 type Operation = google_cloud_lro::internal::Operation<
11076 wkt::Empty,
11077 crate::model::DeleteSchemaMetadata,
11078 >;
11079 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11080 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11081 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
11082 if let Some(ref mut details) = poller_options.tracing {
11083 details.method_name = "google_cloud_discoveryengine_v1::client::SchemaService::delete_schema::until_done";
11084 }
11085
11086 let stub = self.0.stub.clone();
11087 let mut options = self.0.options.clone();
11088 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11089 let query = move |name| {
11090 let stub = stub.clone();
11091 let options = options.clone();
11092 async {
11093 let op = GetOperation::new(stub)
11094 .set_name(name)
11095 .with_options(options)
11096 .send()
11097 .await?;
11098 Ok(Operation::new(op))
11099 }
11100 };
11101
11102 let start = move || async {
11103 let op = self.send().await?;
11104 Ok(Operation::new(op))
11105 };
11106
11107 use google_cloud_lro::internal::PollerExt;
11108 {
11109 google_cloud_lro::internal::new_unit_response_poller(
11110 polling_error_policy,
11111 polling_backoff_policy,
11112 start,
11113 query,
11114 )
11115 }
11116 .with_options(poller_options)
11117 }
11118
11119 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11123 self.0.request.name = v.into();
11124 self
11125 }
11126 }
11127
11128 #[doc(hidden)]
11129 impl crate::RequestBuilder for DeleteSchema {
11130 fn request_options(&mut self) -> &mut crate::RequestOptions {
11131 &mut self.0.options
11132 }
11133 }
11134
11135 #[derive(Clone, Debug)]
11156 pub struct ListOperations(
11157 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
11158 );
11159
11160 impl ListOperations {
11161 pub(crate) fn new(
11162 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11163 ) -> Self {
11164 Self(RequestBuilder::new(stub))
11165 }
11166
11167 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
11169 mut self,
11170 v: V,
11171 ) -> Self {
11172 self.0.request = v.into();
11173 self
11174 }
11175
11176 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11178 self.0.options = v.into();
11179 self
11180 }
11181
11182 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
11184 (*self.0.stub)
11185 .list_operations(self.0.request, self.0.options)
11186 .await
11187 .map(crate::Response::into_body)
11188 }
11189
11190 pub fn by_page(
11192 self,
11193 ) -> impl google_cloud_gax::paginator::Paginator<
11194 google_cloud_longrunning::model::ListOperationsResponse,
11195 crate::Error,
11196 > {
11197 use std::clone::Clone;
11198 let token = self.0.request.page_token.clone();
11199 let execute = move |token: String| {
11200 let mut builder = self.clone();
11201 builder.0.request = builder.0.request.set_page_token(token);
11202 builder.send()
11203 };
11204 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11205 }
11206
11207 pub fn by_item(
11209 self,
11210 ) -> impl google_cloud_gax::paginator::ItemPaginator<
11211 google_cloud_longrunning::model::ListOperationsResponse,
11212 crate::Error,
11213 > {
11214 use google_cloud_gax::paginator::Paginator;
11215 self.by_page().items()
11216 }
11217
11218 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11220 self.0.request.name = v.into();
11221 self
11222 }
11223
11224 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11226 self.0.request.filter = v.into();
11227 self
11228 }
11229
11230 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11232 self.0.request.page_size = v.into();
11233 self
11234 }
11235
11236 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11238 self.0.request.page_token = v.into();
11239 self
11240 }
11241
11242 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
11244 self.0.request.return_partial_success = v.into();
11245 self
11246 }
11247 }
11248
11249 #[doc(hidden)]
11250 impl crate::RequestBuilder for ListOperations {
11251 fn request_options(&mut self) -> &mut crate::RequestOptions {
11252 &mut self.0.options
11253 }
11254 }
11255
11256 #[derive(Clone, Debug)]
11273 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
11274
11275 impl GetOperation {
11276 pub(crate) fn new(
11277 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11278 ) -> Self {
11279 Self(RequestBuilder::new(stub))
11280 }
11281
11282 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
11284 mut self,
11285 v: V,
11286 ) -> Self {
11287 self.0.request = v.into();
11288 self
11289 }
11290
11291 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11293 self.0.options = v.into();
11294 self
11295 }
11296
11297 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11299 (*self.0.stub)
11300 .get_operation(self.0.request, self.0.options)
11301 .await
11302 .map(crate::Response::into_body)
11303 }
11304
11305 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11307 self.0.request.name = v.into();
11308 self
11309 }
11310 }
11311
11312 #[doc(hidden)]
11313 impl crate::RequestBuilder for GetOperation {
11314 fn request_options(&mut self) -> &mut crate::RequestOptions {
11315 &mut self.0.options
11316 }
11317 }
11318
11319 #[derive(Clone, Debug)]
11336 pub struct CancelOperation(
11337 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
11338 );
11339
11340 impl CancelOperation {
11341 pub(crate) fn new(
11342 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11343 ) -> Self {
11344 Self(RequestBuilder::new(stub))
11345 }
11346
11347 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
11349 mut self,
11350 v: V,
11351 ) -> Self {
11352 self.0.request = v.into();
11353 self
11354 }
11355
11356 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11358 self.0.options = v.into();
11359 self
11360 }
11361
11362 pub async fn send(self) -> Result<()> {
11364 (*self.0.stub)
11365 .cancel_operation(self.0.request, self.0.options)
11366 .await
11367 .map(crate::Response::into_body)
11368 }
11369
11370 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11372 self.0.request.name = v.into();
11373 self
11374 }
11375 }
11376
11377 #[doc(hidden)]
11378 impl crate::RequestBuilder for CancelOperation {
11379 fn request_options(&mut self) -> &mut crate::RequestOptions {
11380 &mut self.0.options
11381 }
11382 }
11383}
11384
11385#[cfg(feature = "search-service")]
11387#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11388pub mod search_service {
11389 use crate::Result;
11390
11391 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11405
11406 pub(crate) mod client {
11407 use super::super::super::client::SearchService;
11408 pub struct Factory;
11409 impl crate::ClientFactory for Factory {
11410 type Client = SearchService;
11411 type Credentials = gaxi::options::Credentials;
11412 async fn build(
11413 self,
11414 config: gaxi::options::ClientConfig,
11415 ) -> crate::ClientBuilderResult<Self::Client> {
11416 Self::Client::new(config).await
11417 }
11418 }
11419 }
11420
11421 #[derive(Clone, Debug)]
11423 pub(crate) struct RequestBuilder<R: std::default::Default> {
11424 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11425 request: R,
11426 options: crate::RequestOptions,
11427 }
11428
11429 impl<R> RequestBuilder<R>
11430 where
11431 R: std::default::Default,
11432 {
11433 pub(crate) fn new(
11434 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11435 ) -> Self {
11436 Self {
11437 stub,
11438 request: R::default(),
11439 options: crate::RequestOptions::default(),
11440 }
11441 }
11442 }
11443
11444 #[derive(Clone, Debug)]
11465 pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11466
11467 impl Search {
11468 pub(crate) fn new(
11469 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11470 ) -> Self {
11471 Self(RequestBuilder::new(stub))
11472 }
11473
11474 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11476 self.0.request = v.into();
11477 self
11478 }
11479
11480 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11482 self.0.options = v.into();
11483 self
11484 }
11485
11486 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11488 (*self.0.stub)
11489 .search(self.0.request, self.0.options)
11490 .await
11491 .map(crate::Response::into_body)
11492 }
11493
11494 pub fn by_page(
11496 self,
11497 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11498 {
11499 use std::clone::Clone;
11500 let token = self.0.request.page_token.clone();
11501 let execute = move |token: String| {
11502 let mut builder = self.clone();
11503 builder.0.request = builder.0.request.set_page_token(token);
11504 builder.send()
11505 };
11506 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11507 }
11508
11509 pub fn by_item(
11511 self,
11512 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11513 {
11514 use google_cloud_gax::paginator::Paginator;
11515 self.by_page().items()
11516 }
11517
11518 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11522 self.0.request.serving_config = v.into();
11523 self
11524 }
11525
11526 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11528 self.0.request.branch = v.into();
11529 self
11530 }
11531
11532 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11534 self.0.request.query = v.into();
11535 self
11536 }
11537
11538 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
11540 where
11541 T: std::iter::IntoIterator<Item = V>,
11542 V: std::convert::Into<std::string::String>,
11543 {
11544 use std::iter::Iterator;
11545 self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
11546 self
11547 }
11548
11549 pub fn set_image_query<T>(mut self, v: T) -> Self
11551 where
11552 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11553 {
11554 self.0.request.image_query = std::option::Option::Some(v.into());
11555 self
11556 }
11557
11558 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11560 where
11561 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11562 {
11563 self.0.request.image_query = v.map(|x| x.into());
11564 self
11565 }
11566
11567 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11569 self.0.request.page_size = v.into();
11570 self
11571 }
11572
11573 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11575 self.0.request.page_token = v.into();
11576 self
11577 }
11578
11579 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11581 self.0.request.offset = v.into();
11582 self
11583 }
11584
11585 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11587 self.0.request.one_box_page_size = v.into();
11588 self
11589 }
11590
11591 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11593 where
11594 T: std::iter::IntoIterator<Item = V>,
11595 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11596 {
11597 use std::iter::Iterator;
11598 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11599 self
11600 }
11601
11602 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11604 self.0.request.filter = v.into();
11605 self
11606 }
11607
11608 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11610 self.0.request.canonical_filter = v.into();
11611 self
11612 }
11613
11614 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11616 self.0.request.order_by = v.into();
11617 self
11618 }
11619
11620 pub fn set_user_info<T>(mut self, v: T) -> Self
11622 where
11623 T: std::convert::Into<crate::model::UserInfo>,
11624 {
11625 self.0.request.user_info = std::option::Option::Some(v.into());
11626 self
11627 }
11628
11629 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11631 where
11632 T: std::convert::Into<crate::model::UserInfo>,
11633 {
11634 self.0.request.user_info = v.map(|x| x.into());
11635 self
11636 }
11637
11638 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11640 self.0.request.language_code = v.into();
11641 self
11642 }
11643
11644 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11646 where
11647 T: std::iter::IntoIterator<Item = V>,
11648 V: std::convert::Into<crate::model::search_request::FacetSpec>,
11649 {
11650 use std::iter::Iterator;
11651 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11652 self
11653 }
11654
11655 pub fn set_boost_spec<T>(mut self, v: T) -> Self
11657 where
11658 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11659 {
11660 self.0.request.boost_spec = std::option::Option::Some(v.into());
11661 self
11662 }
11663
11664 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11666 where
11667 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11668 {
11669 self.0.request.boost_spec = v.map(|x| x.into());
11670 self
11671 }
11672
11673 pub fn set_params<T, K, V>(mut self, v: T) -> Self
11675 where
11676 T: std::iter::IntoIterator<Item = (K, V)>,
11677 K: std::convert::Into<std::string::String>,
11678 V: std::convert::Into<wkt::Value>,
11679 {
11680 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11681 self
11682 }
11683
11684 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11686 where
11687 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11688 {
11689 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11690 self
11691 }
11692
11693 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11695 where
11696 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11697 {
11698 self.0.request.query_expansion_spec = v.map(|x| x.into());
11699 self
11700 }
11701
11702 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11704 where
11705 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11706 {
11707 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11708 self
11709 }
11710
11711 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11713 where
11714 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11715 {
11716 self.0.request.spell_correction_spec = v.map(|x| x.into());
11717 self
11718 }
11719
11720 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11722 self.0.request.user_pseudo_id = v.into();
11723 self
11724 }
11725
11726 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11728 where
11729 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11730 {
11731 self.0.request.content_search_spec = std::option::Option::Some(v.into());
11732 self
11733 }
11734
11735 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11737 where
11738 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11739 {
11740 self.0.request.content_search_spec = v.map(|x| x.into());
11741 self
11742 }
11743
11744 pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
11746 self.0.request.ranking_expression = v.into();
11747 self
11748 }
11749
11750 pub fn set_ranking_expression_backend<
11752 T: Into<crate::model::search_request::RankingExpressionBackend>,
11753 >(
11754 mut self,
11755 v: T,
11756 ) -> Self {
11757 self.0.request.ranking_expression_backend = v.into();
11758 self
11759 }
11760
11761 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11763 self.0.request.safe_search = v.into();
11764 self
11765 }
11766
11767 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11769 where
11770 T: std::iter::IntoIterator<Item = (K, V)>,
11771 K: std::convert::Into<std::string::String>,
11772 V: std::convert::Into<std::string::String>,
11773 {
11774 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11775 self
11776 }
11777
11778 pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
11780 where
11781 T: std::convert::Into<
11782 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
11783 >,
11784 {
11785 self.0.request.natural_language_query_understanding_spec =
11786 std::option::Option::Some(v.into());
11787 self
11788 }
11789
11790 pub fn set_or_clear_natural_language_query_understanding_spec<T>(
11792 mut self,
11793 v: std::option::Option<T>,
11794 ) -> Self
11795 where
11796 T: std::convert::Into<
11797 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
11798 >,
11799 {
11800 self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
11801 self
11802 }
11803
11804 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11806 where
11807 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11808 {
11809 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11810 self
11811 }
11812
11813 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11815 where
11816 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11817 {
11818 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11819 self
11820 }
11821
11822 pub fn set_display_spec<T>(mut self, v: T) -> Self
11824 where
11825 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11826 {
11827 self.0.request.display_spec = std::option::Option::Some(v.into());
11828 self
11829 }
11830
11831 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11833 where
11834 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11835 {
11836 self.0.request.display_spec = v.map(|x| x.into());
11837 self
11838 }
11839
11840 pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
11842 where
11843 T: std::iter::IntoIterator<Item = V>,
11844 V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
11845 {
11846 use std::iter::Iterator;
11847 self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
11848 self
11849 }
11850
11851 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11853 self.0.request.session = v.into();
11854 self
11855 }
11856
11857 pub fn set_session_spec<T>(mut self, v: T) -> Self
11859 where
11860 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11861 {
11862 self.0.request.session_spec = std::option::Option::Some(v.into());
11863 self
11864 }
11865
11866 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11868 where
11869 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11870 {
11871 self.0.request.session_spec = v.map(|x| x.into());
11872 self
11873 }
11874
11875 pub fn set_relevance_threshold<
11877 T: Into<crate::model::search_request::RelevanceThreshold>,
11878 >(
11879 mut self,
11880 v: T,
11881 ) -> Self {
11882 self.0.request.relevance_threshold = v.into();
11883 self
11884 }
11885
11886 pub fn set_relevance_filter_spec<T>(mut self, v: T) -> Self
11888 where
11889 T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
11890 {
11891 self.0.request.relevance_filter_spec = std::option::Option::Some(v.into());
11892 self
11893 }
11894
11895 pub fn set_or_clear_relevance_filter_spec<T>(mut self, v: std::option::Option<T>) -> Self
11897 where
11898 T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
11899 {
11900 self.0.request.relevance_filter_spec = v.map(|x| x.into());
11901 self
11902 }
11903
11904 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11906 where
11907 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11908 {
11909 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11910 self
11911 }
11912
11913 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11915 where
11916 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11917 {
11918 self.0.request.relevance_score_spec = v.map(|x| x.into());
11919 self
11920 }
11921 }
11922
11923 #[doc(hidden)]
11924 impl crate::RequestBuilder for Search {
11925 fn request_options(&mut self) -> &mut crate::RequestOptions {
11926 &mut self.0.options
11927 }
11928 }
11929
11930 #[derive(Clone, Debug)]
11951 pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11952
11953 impl SearchLite {
11954 pub(crate) fn new(
11955 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11956 ) -> Self {
11957 Self(RequestBuilder::new(stub))
11958 }
11959
11960 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11962 self.0.request = v.into();
11963 self
11964 }
11965
11966 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11968 self.0.options = v.into();
11969 self
11970 }
11971
11972 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11974 (*self.0.stub)
11975 .search_lite(self.0.request, self.0.options)
11976 .await
11977 .map(crate::Response::into_body)
11978 }
11979
11980 pub fn by_page(
11982 self,
11983 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11984 {
11985 use std::clone::Clone;
11986 let token = self.0.request.page_token.clone();
11987 let execute = move |token: String| {
11988 let mut builder = self.clone();
11989 builder.0.request = builder.0.request.set_page_token(token);
11990 builder.send()
11991 };
11992 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11993 }
11994
11995 pub fn by_item(
11997 self,
11998 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11999 {
12000 use google_cloud_gax::paginator::Paginator;
12001 self.by_page().items()
12002 }
12003
12004 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
12008 self.0.request.serving_config = v.into();
12009 self
12010 }
12011
12012 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
12014 self.0.request.branch = v.into();
12015 self
12016 }
12017
12018 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
12020 self.0.request.query = v.into();
12021 self
12022 }
12023
12024 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
12026 where
12027 T: std::iter::IntoIterator<Item = V>,
12028 V: std::convert::Into<std::string::String>,
12029 {
12030 use std::iter::Iterator;
12031 self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
12032 self
12033 }
12034
12035 pub fn set_image_query<T>(mut self, v: T) -> Self
12037 where
12038 T: std::convert::Into<crate::model::search_request::ImageQuery>,
12039 {
12040 self.0.request.image_query = std::option::Option::Some(v.into());
12041 self
12042 }
12043
12044 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
12046 where
12047 T: std::convert::Into<crate::model::search_request::ImageQuery>,
12048 {
12049 self.0.request.image_query = v.map(|x| x.into());
12050 self
12051 }
12052
12053 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12055 self.0.request.page_size = v.into();
12056 self
12057 }
12058
12059 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12061 self.0.request.page_token = v.into();
12062 self
12063 }
12064
12065 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
12067 self.0.request.offset = v.into();
12068 self
12069 }
12070
12071 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12073 self.0.request.one_box_page_size = v.into();
12074 self
12075 }
12076
12077 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
12079 where
12080 T: std::iter::IntoIterator<Item = V>,
12081 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
12082 {
12083 use std::iter::Iterator;
12084 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
12085 self
12086 }
12087
12088 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12090 self.0.request.filter = v.into();
12091 self
12092 }
12093
12094 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12096 self.0.request.canonical_filter = v.into();
12097 self
12098 }
12099
12100 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
12102 self.0.request.order_by = v.into();
12103 self
12104 }
12105
12106 pub fn set_user_info<T>(mut self, v: T) -> Self
12108 where
12109 T: std::convert::Into<crate::model::UserInfo>,
12110 {
12111 self.0.request.user_info = std::option::Option::Some(v.into());
12112 self
12113 }
12114
12115 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
12117 where
12118 T: std::convert::Into<crate::model::UserInfo>,
12119 {
12120 self.0.request.user_info = v.map(|x| x.into());
12121 self
12122 }
12123
12124 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
12126 self.0.request.language_code = v.into();
12127 self
12128 }
12129
12130 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
12132 where
12133 T: std::iter::IntoIterator<Item = V>,
12134 V: std::convert::Into<crate::model::search_request::FacetSpec>,
12135 {
12136 use std::iter::Iterator;
12137 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
12138 self
12139 }
12140
12141 pub fn set_boost_spec<T>(mut self, v: T) -> Self
12143 where
12144 T: std::convert::Into<crate::model::search_request::BoostSpec>,
12145 {
12146 self.0.request.boost_spec = std::option::Option::Some(v.into());
12147 self
12148 }
12149
12150 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
12152 where
12153 T: std::convert::Into<crate::model::search_request::BoostSpec>,
12154 {
12155 self.0.request.boost_spec = v.map(|x| x.into());
12156 self
12157 }
12158
12159 pub fn set_params<T, K, V>(mut self, v: T) -> Self
12161 where
12162 T: std::iter::IntoIterator<Item = (K, V)>,
12163 K: std::convert::Into<std::string::String>,
12164 V: std::convert::Into<wkt::Value>,
12165 {
12166 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12167 self
12168 }
12169
12170 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
12172 where
12173 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12174 {
12175 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
12176 self
12177 }
12178
12179 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
12181 where
12182 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12183 {
12184 self.0.request.query_expansion_spec = v.map(|x| x.into());
12185 self
12186 }
12187
12188 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
12190 where
12191 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12192 {
12193 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
12194 self
12195 }
12196
12197 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
12199 where
12200 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12201 {
12202 self.0.request.spell_correction_spec = v.map(|x| x.into());
12203 self
12204 }
12205
12206 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12208 self.0.request.user_pseudo_id = v.into();
12209 self
12210 }
12211
12212 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
12214 where
12215 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12216 {
12217 self.0.request.content_search_spec = std::option::Option::Some(v.into());
12218 self
12219 }
12220
12221 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
12223 where
12224 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12225 {
12226 self.0.request.content_search_spec = v.map(|x| x.into());
12227 self
12228 }
12229
12230 pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12232 self.0.request.ranking_expression = v.into();
12233 self
12234 }
12235
12236 pub fn set_ranking_expression_backend<
12238 T: Into<crate::model::search_request::RankingExpressionBackend>,
12239 >(
12240 mut self,
12241 v: T,
12242 ) -> Self {
12243 self.0.request.ranking_expression_backend = v.into();
12244 self
12245 }
12246
12247 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
12249 self.0.request.safe_search = v.into();
12250 self
12251 }
12252
12253 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12255 where
12256 T: std::iter::IntoIterator<Item = (K, V)>,
12257 K: std::convert::Into<std::string::String>,
12258 V: std::convert::Into<std::string::String>,
12259 {
12260 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12261 self
12262 }
12263
12264 pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
12266 where
12267 T: std::convert::Into<
12268 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12269 >,
12270 {
12271 self.0.request.natural_language_query_understanding_spec =
12272 std::option::Option::Some(v.into());
12273 self
12274 }
12275
12276 pub fn set_or_clear_natural_language_query_understanding_spec<T>(
12278 mut self,
12279 v: std::option::Option<T>,
12280 ) -> Self
12281 where
12282 T: std::convert::Into<
12283 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12284 >,
12285 {
12286 self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
12287 self
12288 }
12289
12290 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
12292 where
12293 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12294 {
12295 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
12296 self
12297 }
12298
12299 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
12301 where
12302 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12303 {
12304 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
12305 self
12306 }
12307
12308 pub fn set_display_spec<T>(mut self, v: T) -> Self
12310 where
12311 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12312 {
12313 self.0.request.display_spec = std::option::Option::Some(v.into());
12314 self
12315 }
12316
12317 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
12319 where
12320 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12321 {
12322 self.0.request.display_spec = v.map(|x| x.into());
12323 self
12324 }
12325
12326 pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
12328 where
12329 T: std::iter::IntoIterator<Item = V>,
12330 V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
12331 {
12332 use std::iter::Iterator;
12333 self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
12334 self
12335 }
12336
12337 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
12339 self.0.request.session = v.into();
12340 self
12341 }
12342
12343 pub fn set_session_spec<T>(mut self, v: T) -> Self
12345 where
12346 T: std::convert::Into<crate::model::search_request::SessionSpec>,
12347 {
12348 self.0.request.session_spec = std::option::Option::Some(v.into());
12349 self
12350 }
12351
12352 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
12354 where
12355 T: std::convert::Into<crate::model::search_request::SessionSpec>,
12356 {
12357 self.0.request.session_spec = v.map(|x| x.into());
12358 self
12359 }
12360
12361 pub fn set_relevance_threshold<
12363 T: Into<crate::model::search_request::RelevanceThreshold>,
12364 >(
12365 mut self,
12366 v: T,
12367 ) -> Self {
12368 self.0.request.relevance_threshold = v.into();
12369 self
12370 }
12371
12372 pub fn set_relevance_filter_spec<T>(mut self, v: T) -> Self
12374 where
12375 T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
12376 {
12377 self.0.request.relevance_filter_spec = std::option::Option::Some(v.into());
12378 self
12379 }
12380
12381 pub fn set_or_clear_relevance_filter_spec<T>(mut self, v: std::option::Option<T>) -> Self
12383 where
12384 T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
12385 {
12386 self.0.request.relevance_filter_spec = v.map(|x| x.into());
12387 self
12388 }
12389
12390 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
12392 where
12393 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12394 {
12395 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
12396 self
12397 }
12398
12399 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12401 where
12402 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12403 {
12404 self.0.request.relevance_score_spec = v.map(|x| x.into());
12405 self
12406 }
12407 }
12408
12409 #[doc(hidden)]
12410 impl crate::RequestBuilder for SearchLite {
12411 fn request_options(&mut self) -> &mut crate::RequestOptions {
12412 &mut self.0.options
12413 }
12414 }
12415
12416 #[derive(Clone, Debug)]
12437 pub struct ListOperations(
12438 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12439 );
12440
12441 impl ListOperations {
12442 pub(crate) fn new(
12443 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12444 ) -> Self {
12445 Self(RequestBuilder::new(stub))
12446 }
12447
12448 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12450 mut self,
12451 v: V,
12452 ) -> Self {
12453 self.0.request = v.into();
12454 self
12455 }
12456
12457 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12459 self.0.options = v.into();
12460 self
12461 }
12462
12463 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12465 (*self.0.stub)
12466 .list_operations(self.0.request, self.0.options)
12467 .await
12468 .map(crate::Response::into_body)
12469 }
12470
12471 pub fn by_page(
12473 self,
12474 ) -> impl google_cloud_gax::paginator::Paginator<
12475 google_cloud_longrunning::model::ListOperationsResponse,
12476 crate::Error,
12477 > {
12478 use std::clone::Clone;
12479 let token = self.0.request.page_token.clone();
12480 let execute = move |token: String| {
12481 let mut builder = self.clone();
12482 builder.0.request = builder.0.request.set_page_token(token);
12483 builder.send()
12484 };
12485 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12486 }
12487
12488 pub fn by_item(
12490 self,
12491 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12492 google_cloud_longrunning::model::ListOperationsResponse,
12493 crate::Error,
12494 > {
12495 use google_cloud_gax::paginator::Paginator;
12496 self.by_page().items()
12497 }
12498
12499 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12501 self.0.request.name = v.into();
12502 self
12503 }
12504
12505 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12507 self.0.request.filter = v.into();
12508 self
12509 }
12510
12511 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12513 self.0.request.page_size = v.into();
12514 self
12515 }
12516
12517 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12519 self.0.request.page_token = v.into();
12520 self
12521 }
12522
12523 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12525 self.0.request.return_partial_success = v.into();
12526 self
12527 }
12528 }
12529
12530 #[doc(hidden)]
12531 impl crate::RequestBuilder for ListOperations {
12532 fn request_options(&mut self) -> &mut crate::RequestOptions {
12533 &mut self.0.options
12534 }
12535 }
12536
12537 #[derive(Clone, Debug)]
12554 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12555
12556 impl GetOperation {
12557 pub(crate) fn new(
12558 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12559 ) -> Self {
12560 Self(RequestBuilder::new(stub))
12561 }
12562
12563 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12565 mut self,
12566 v: V,
12567 ) -> Self {
12568 self.0.request = v.into();
12569 self
12570 }
12571
12572 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12574 self.0.options = v.into();
12575 self
12576 }
12577
12578 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12580 (*self.0.stub)
12581 .get_operation(self.0.request, self.0.options)
12582 .await
12583 .map(crate::Response::into_body)
12584 }
12585
12586 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12588 self.0.request.name = v.into();
12589 self
12590 }
12591 }
12592
12593 #[doc(hidden)]
12594 impl crate::RequestBuilder for GetOperation {
12595 fn request_options(&mut self) -> &mut crate::RequestOptions {
12596 &mut self.0.options
12597 }
12598 }
12599
12600 #[derive(Clone, Debug)]
12617 pub struct CancelOperation(
12618 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12619 );
12620
12621 impl CancelOperation {
12622 pub(crate) fn new(
12623 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12624 ) -> Self {
12625 Self(RequestBuilder::new(stub))
12626 }
12627
12628 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12630 mut self,
12631 v: V,
12632 ) -> Self {
12633 self.0.request = v.into();
12634 self
12635 }
12636
12637 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12639 self.0.options = v.into();
12640 self
12641 }
12642
12643 pub async fn send(self) -> Result<()> {
12645 (*self.0.stub)
12646 .cancel_operation(self.0.request, self.0.options)
12647 .await
12648 .map(crate::Response::into_body)
12649 }
12650
12651 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12653 self.0.request.name = v.into();
12654 self
12655 }
12656 }
12657
12658 #[doc(hidden)]
12659 impl crate::RequestBuilder for CancelOperation {
12660 fn request_options(&mut self) -> &mut crate::RequestOptions {
12661 &mut self.0.options
12662 }
12663 }
12664}
12665
12666#[cfg(feature = "search-tuning-service")]
12668#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12669pub mod search_tuning_service {
12670 use crate::Result;
12671
12672 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12686
12687 pub(crate) mod client {
12688 use super::super::super::client::SearchTuningService;
12689 pub struct Factory;
12690 impl crate::ClientFactory for Factory {
12691 type Client = SearchTuningService;
12692 type Credentials = gaxi::options::Credentials;
12693 async fn build(
12694 self,
12695 config: gaxi::options::ClientConfig,
12696 ) -> crate::ClientBuilderResult<Self::Client> {
12697 Self::Client::new(config).await
12698 }
12699 }
12700 }
12701
12702 #[derive(Clone, Debug)]
12704 pub(crate) struct RequestBuilder<R: std::default::Default> {
12705 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12706 request: R,
12707 options: crate::RequestOptions,
12708 }
12709
12710 impl<R> RequestBuilder<R>
12711 where
12712 R: std::default::Default,
12713 {
12714 pub(crate) fn new(
12715 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12716 ) -> Self {
12717 Self {
12718 stub,
12719 request: R::default(),
12720 options: crate::RequestOptions::default(),
12721 }
12722 }
12723 }
12724
12725 #[derive(Clone, Debug)]
12743 pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12744
12745 impl TrainCustomModel {
12746 pub(crate) fn new(
12747 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12748 ) -> Self {
12749 Self(RequestBuilder::new(stub))
12750 }
12751
12752 pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12754 mut self,
12755 v: V,
12756 ) -> Self {
12757 self.0.request = v.into();
12758 self
12759 }
12760
12761 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12763 self.0.options = v.into();
12764 self
12765 }
12766
12767 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12774 (*self.0.stub)
12775 .train_custom_model(self.0.request, self.0.options)
12776 .await
12777 .map(crate::Response::into_body)
12778 }
12779
12780 pub fn poller(
12782 self,
12783 ) -> impl google_cloud_lro::Poller<
12784 crate::model::TrainCustomModelResponse,
12785 crate::model::TrainCustomModelMetadata,
12786 > {
12787 type Operation = google_cloud_lro::internal::Operation<
12788 crate::model::TrainCustomModelResponse,
12789 crate::model::TrainCustomModelMetadata,
12790 >;
12791 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12792 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12793 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
12794 if let Some(ref mut details) = poller_options.tracing {
12795 details.method_name = "google_cloud_discoveryengine_v1::client::SearchTuningService::train_custom_model::until_done";
12796 }
12797
12798 let stub = self.0.stub.clone();
12799 let mut options = self.0.options.clone();
12800 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
12801 let query = move |name| {
12802 let stub = stub.clone();
12803 let options = options.clone();
12804 async {
12805 let op = GetOperation::new(stub)
12806 .set_name(name)
12807 .with_options(options)
12808 .send()
12809 .await?;
12810 Ok(Operation::new(op))
12811 }
12812 };
12813
12814 let start = move || async {
12815 let op = self.send().await?;
12816 Ok(Operation::new(op))
12817 };
12818
12819 use google_cloud_lro::internal::PollerExt;
12820 {
12821 google_cloud_lro::internal::new_poller(
12822 polling_error_policy,
12823 polling_backoff_policy,
12824 start,
12825 query,
12826 )
12827 }
12828 .with_options(poller_options)
12829 }
12830
12831 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12835 self.0.request.data_store = v.into();
12836 self
12837 }
12838
12839 pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12841 self.0.request.model_type = v.into();
12842 self
12843 }
12844
12845 pub fn set_error_config<T>(mut self, v: T) -> Self
12847 where
12848 T: std::convert::Into<crate::model::ImportErrorConfig>,
12849 {
12850 self.0.request.error_config = std::option::Option::Some(v.into());
12851 self
12852 }
12853
12854 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12856 where
12857 T: std::convert::Into<crate::model::ImportErrorConfig>,
12858 {
12859 self.0.request.error_config = v.map(|x| x.into());
12860 self
12861 }
12862
12863 pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12865 self.0.request.model_id = v.into();
12866 self
12867 }
12868
12869 pub fn set_training_input<
12874 T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12875 >(
12876 mut self,
12877 v: T,
12878 ) -> Self {
12879 self.0.request.training_input = v.into();
12880 self
12881 }
12882
12883 pub fn set_gcs_training_input<
12889 T: std::convert::Into<
12890 std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12891 >,
12892 >(
12893 mut self,
12894 v: T,
12895 ) -> Self {
12896 self.0.request = self.0.request.set_gcs_training_input(v);
12897 self
12898 }
12899 }
12900
12901 #[doc(hidden)]
12902 impl crate::RequestBuilder for TrainCustomModel {
12903 fn request_options(&mut self) -> &mut crate::RequestOptions {
12904 &mut self.0.options
12905 }
12906 }
12907
12908 #[derive(Clone, Debug)]
12925 pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12926
12927 impl ListCustomModels {
12928 pub(crate) fn new(
12929 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12930 ) -> Self {
12931 Self(RequestBuilder::new(stub))
12932 }
12933
12934 pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12936 mut self,
12937 v: V,
12938 ) -> Self {
12939 self.0.request = v.into();
12940 self
12941 }
12942
12943 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12945 self.0.options = v.into();
12946 self
12947 }
12948
12949 pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12951 (*self.0.stub)
12952 .list_custom_models(self.0.request, self.0.options)
12953 .await
12954 .map(crate::Response::into_body)
12955 }
12956
12957 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12961 self.0.request.data_store = v.into();
12962 self
12963 }
12964 }
12965
12966 #[doc(hidden)]
12967 impl crate::RequestBuilder for ListCustomModels {
12968 fn request_options(&mut self) -> &mut crate::RequestOptions {
12969 &mut self.0.options
12970 }
12971 }
12972
12973 #[derive(Clone, Debug)]
12994 pub struct ListOperations(
12995 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12996 );
12997
12998 impl ListOperations {
12999 pub(crate) fn new(
13000 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13001 ) -> Self {
13002 Self(RequestBuilder::new(stub))
13003 }
13004
13005 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13007 mut self,
13008 v: V,
13009 ) -> Self {
13010 self.0.request = v.into();
13011 self
13012 }
13013
13014 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13016 self.0.options = v.into();
13017 self
13018 }
13019
13020 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13022 (*self.0.stub)
13023 .list_operations(self.0.request, self.0.options)
13024 .await
13025 .map(crate::Response::into_body)
13026 }
13027
13028 pub fn by_page(
13030 self,
13031 ) -> impl google_cloud_gax::paginator::Paginator<
13032 google_cloud_longrunning::model::ListOperationsResponse,
13033 crate::Error,
13034 > {
13035 use std::clone::Clone;
13036 let token = self.0.request.page_token.clone();
13037 let execute = move |token: String| {
13038 let mut builder = self.clone();
13039 builder.0.request = builder.0.request.set_page_token(token);
13040 builder.send()
13041 };
13042 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13043 }
13044
13045 pub fn by_item(
13047 self,
13048 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13049 google_cloud_longrunning::model::ListOperationsResponse,
13050 crate::Error,
13051 > {
13052 use google_cloud_gax::paginator::Paginator;
13053 self.by_page().items()
13054 }
13055
13056 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13058 self.0.request.name = v.into();
13059 self
13060 }
13061
13062 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13064 self.0.request.filter = v.into();
13065 self
13066 }
13067
13068 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13070 self.0.request.page_size = v.into();
13071 self
13072 }
13073
13074 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13076 self.0.request.page_token = v.into();
13077 self
13078 }
13079
13080 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13082 self.0.request.return_partial_success = v.into();
13083 self
13084 }
13085 }
13086
13087 #[doc(hidden)]
13088 impl crate::RequestBuilder for ListOperations {
13089 fn request_options(&mut self) -> &mut crate::RequestOptions {
13090 &mut self.0.options
13091 }
13092 }
13093
13094 #[derive(Clone, Debug)]
13111 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13112
13113 impl GetOperation {
13114 pub(crate) fn new(
13115 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13116 ) -> Self {
13117 Self(RequestBuilder::new(stub))
13118 }
13119
13120 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13122 mut self,
13123 v: V,
13124 ) -> Self {
13125 self.0.request = v.into();
13126 self
13127 }
13128
13129 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13131 self.0.options = v.into();
13132 self
13133 }
13134
13135 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13137 (*self.0.stub)
13138 .get_operation(self.0.request, self.0.options)
13139 .await
13140 .map(crate::Response::into_body)
13141 }
13142
13143 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13145 self.0.request.name = v.into();
13146 self
13147 }
13148 }
13149
13150 #[doc(hidden)]
13151 impl crate::RequestBuilder for GetOperation {
13152 fn request_options(&mut self) -> &mut crate::RequestOptions {
13153 &mut self.0.options
13154 }
13155 }
13156
13157 #[derive(Clone, Debug)]
13174 pub struct CancelOperation(
13175 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13176 );
13177
13178 impl CancelOperation {
13179 pub(crate) fn new(
13180 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13181 ) -> Self {
13182 Self(RequestBuilder::new(stub))
13183 }
13184
13185 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13187 mut self,
13188 v: V,
13189 ) -> Self {
13190 self.0.request = v.into();
13191 self
13192 }
13193
13194 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13196 self.0.options = v.into();
13197 self
13198 }
13199
13200 pub async fn send(self) -> Result<()> {
13202 (*self.0.stub)
13203 .cancel_operation(self.0.request, self.0.options)
13204 .await
13205 .map(crate::Response::into_body)
13206 }
13207
13208 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13210 self.0.request.name = v.into();
13211 self
13212 }
13213 }
13214
13215 #[doc(hidden)]
13216 impl crate::RequestBuilder for CancelOperation {
13217 fn request_options(&mut self) -> &mut crate::RequestOptions {
13218 &mut self.0.options
13219 }
13220 }
13221}
13222
13223#[cfg(feature = "serving-config-service")]
13225#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
13226pub mod serving_config_service {
13227 use crate::Result;
13228
13229 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13243
13244 pub(crate) mod client {
13245 use super::super::super::client::ServingConfigService;
13246 pub struct Factory;
13247 impl crate::ClientFactory for Factory {
13248 type Client = ServingConfigService;
13249 type Credentials = gaxi::options::Credentials;
13250 async fn build(
13251 self,
13252 config: gaxi::options::ClientConfig,
13253 ) -> crate::ClientBuilderResult<Self::Client> {
13254 Self::Client::new(config).await
13255 }
13256 }
13257 }
13258
13259 #[derive(Clone, Debug)]
13261 pub(crate) struct RequestBuilder<R: std::default::Default> {
13262 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13263 request: R,
13264 options: crate::RequestOptions,
13265 }
13266
13267 impl<R> RequestBuilder<R>
13268 where
13269 R: std::default::Default,
13270 {
13271 pub(crate) fn new(
13272 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13273 ) -> Self {
13274 Self {
13275 stub,
13276 request: R::default(),
13277 options: crate::RequestOptions::default(),
13278 }
13279 }
13280 }
13281
13282 #[derive(Clone, Debug)]
13299 pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
13300
13301 impl UpdateServingConfig {
13302 pub(crate) fn new(
13303 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13304 ) -> Self {
13305 Self(RequestBuilder::new(stub))
13306 }
13307
13308 pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
13310 mut self,
13311 v: V,
13312 ) -> Self {
13313 self.0.request = v.into();
13314 self
13315 }
13316
13317 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13319 self.0.options = v.into();
13320 self
13321 }
13322
13323 pub async fn send(self) -> Result<crate::model::ServingConfig> {
13325 (*self.0.stub)
13326 .update_serving_config(self.0.request, self.0.options)
13327 .await
13328 .map(crate::Response::into_body)
13329 }
13330
13331 pub fn set_serving_config<T>(mut self, v: T) -> Self
13335 where
13336 T: std::convert::Into<crate::model::ServingConfig>,
13337 {
13338 self.0.request.serving_config = std::option::Option::Some(v.into());
13339 self
13340 }
13341
13342 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
13346 where
13347 T: std::convert::Into<crate::model::ServingConfig>,
13348 {
13349 self.0.request.serving_config = v.map(|x| x.into());
13350 self
13351 }
13352
13353 pub fn set_update_mask<T>(mut self, v: T) -> Self
13355 where
13356 T: std::convert::Into<wkt::FieldMask>,
13357 {
13358 self.0.request.update_mask = std::option::Option::Some(v.into());
13359 self
13360 }
13361
13362 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13364 where
13365 T: std::convert::Into<wkt::FieldMask>,
13366 {
13367 self.0.request.update_mask = v.map(|x| x.into());
13368 self
13369 }
13370 }
13371
13372 #[doc(hidden)]
13373 impl crate::RequestBuilder for UpdateServingConfig {
13374 fn request_options(&mut self) -> &mut crate::RequestOptions {
13375 &mut self.0.options
13376 }
13377 }
13378
13379 #[derive(Clone, Debug)]
13400 pub struct ListOperations(
13401 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13402 );
13403
13404 impl ListOperations {
13405 pub(crate) fn new(
13406 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13407 ) -> Self {
13408 Self(RequestBuilder::new(stub))
13409 }
13410
13411 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13413 mut self,
13414 v: V,
13415 ) -> Self {
13416 self.0.request = v.into();
13417 self
13418 }
13419
13420 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13422 self.0.options = v.into();
13423 self
13424 }
13425
13426 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13428 (*self.0.stub)
13429 .list_operations(self.0.request, self.0.options)
13430 .await
13431 .map(crate::Response::into_body)
13432 }
13433
13434 pub fn by_page(
13436 self,
13437 ) -> impl google_cloud_gax::paginator::Paginator<
13438 google_cloud_longrunning::model::ListOperationsResponse,
13439 crate::Error,
13440 > {
13441 use std::clone::Clone;
13442 let token = self.0.request.page_token.clone();
13443 let execute = move |token: String| {
13444 let mut builder = self.clone();
13445 builder.0.request = builder.0.request.set_page_token(token);
13446 builder.send()
13447 };
13448 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13449 }
13450
13451 pub fn by_item(
13453 self,
13454 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13455 google_cloud_longrunning::model::ListOperationsResponse,
13456 crate::Error,
13457 > {
13458 use google_cloud_gax::paginator::Paginator;
13459 self.by_page().items()
13460 }
13461
13462 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13464 self.0.request.name = v.into();
13465 self
13466 }
13467
13468 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13470 self.0.request.filter = v.into();
13471 self
13472 }
13473
13474 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13476 self.0.request.page_size = v.into();
13477 self
13478 }
13479
13480 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13482 self.0.request.page_token = v.into();
13483 self
13484 }
13485
13486 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13488 self.0.request.return_partial_success = v.into();
13489 self
13490 }
13491 }
13492
13493 #[doc(hidden)]
13494 impl crate::RequestBuilder for ListOperations {
13495 fn request_options(&mut self) -> &mut crate::RequestOptions {
13496 &mut self.0.options
13497 }
13498 }
13499
13500 #[derive(Clone, Debug)]
13517 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13518
13519 impl GetOperation {
13520 pub(crate) fn new(
13521 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13522 ) -> Self {
13523 Self(RequestBuilder::new(stub))
13524 }
13525
13526 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13528 mut self,
13529 v: V,
13530 ) -> Self {
13531 self.0.request = v.into();
13532 self
13533 }
13534
13535 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13537 self.0.options = v.into();
13538 self
13539 }
13540
13541 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13543 (*self.0.stub)
13544 .get_operation(self.0.request, self.0.options)
13545 .await
13546 .map(crate::Response::into_body)
13547 }
13548
13549 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13551 self.0.request.name = v.into();
13552 self
13553 }
13554 }
13555
13556 #[doc(hidden)]
13557 impl crate::RequestBuilder for GetOperation {
13558 fn request_options(&mut self) -> &mut crate::RequestOptions {
13559 &mut self.0.options
13560 }
13561 }
13562
13563 #[derive(Clone, Debug)]
13580 pub struct CancelOperation(
13581 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13582 );
13583
13584 impl CancelOperation {
13585 pub(crate) fn new(
13586 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13587 ) -> Self {
13588 Self(RequestBuilder::new(stub))
13589 }
13590
13591 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13593 mut self,
13594 v: V,
13595 ) -> Self {
13596 self.0.request = v.into();
13597 self
13598 }
13599
13600 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13602 self.0.options = v.into();
13603 self
13604 }
13605
13606 pub async fn send(self) -> Result<()> {
13608 (*self.0.stub)
13609 .cancel_operation(self.0.request, self.0.options)
13610 .await
13611 .map(crate::Response::into_body)
13612 }
13613
13614 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13616 self.0.request.name = v.into();
13617 self
13618 }
13619 }
13620
13621 #[doc(hidden)]
13622 impl crate::RequestBuilder for CancelOperation {
13623 fn request_options(&mut self) -> &mut crate::RequestOptions {
13624 &mut self.0.options
13625 }
13626 }
13627}
13628
13629#[cfg(feature = "session-service")]
13631#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13632pub mod session_service {
13633 use crate::Result;
13634
13635 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13649
13650 pub(crate) mod client {
13651 use super::super::super::client::SessionService;
13652 pub struct Factory;
13653 impl crate::ClientFactory for Factory {
13654 type Client = SessionService;
13655 type Credentials = gaxi::options::Credentials;
13656 async fn build(
13657 self,
13658 config: gaxi::options::ClientConfig,
13659 ) -> crate::ClientBuilderResult<Self::Client> {
13660 Self::Client::new(config).await
13661 }
13662 }
13663 }
13664
13665 #[derive(Clone, Debug)]
13667 pub(crate) struct RequestBuilder<R: std::default::Default> {
13668 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13669 request: R,
13670 options: crate::RequestOptions,
13671 }
13672
13673 impl<R> RequestBuilder<R>
13674 where
13675 R: std::default::Default,
13676 {
13677 pub(crate) fn new(
13678 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13679 ) -> Self {
13680 Self {
13681 stub,
13682 request: R::default(),
13683 options: crate::RequestOptions::default(),
13684 }
13685 }
13686 }
13687
13688 #[derive(Clone, Debug)]
13705 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13706
13707 impl CreateSession {
13708 pub(crate) fn new(
13709 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13710 ) -> Self {
13711 Self(RequestBuilder::new(stub))
13712 }
13713
13714 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13716 self.0.request = v.into();
13717 self
13718 }
13719
13720 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13722 self.0.options = v.into();
13723 self
13724 }
13725
13726 pub async fn send(self) -> Result<crate::model::Session> {
13728 (*self.0.stub)
13729 .create_session(self.0.request, self.0.options)
13730 .await
13731 .map(crate::Response::into_body)
13732 }
13733
13734 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13738 self.0.request.parent = v.into();
13739 self
13740 }
13741
13742 pub fn set_session<T>(mut self, v: T) -> Self
13746 where
13747 T: std::convert::Into<crate::model::Session>,
13748 {
13749 self.0.request.session = std::option::Option::Some(v.into());
13750 self
13751 }
13752
13753 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13757 where
13758 T: std::convert::Into<crate::model::Session>,
13759 {
13760 self.0.request.session = v.map(|x| x.into());
13761 self
13762 }
13763 }
13764
13765 #[doc(hidden)]
13766 impl crate::RequestBuilder for CreateSession {
13767 fn request_options(&mut self) -> &mut crate::RequestOptions {
13768 &mut self.0.options
13769 }
13770 }
13771
13772 #[derive(Clone, Debug)]
13789 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13790
13791 impl DeleteSession {
13792 pub(crate) fn new(
13793 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13794 ) -> Self {
13795 Self(RequestBuilder::new(stub))
13796 }
13797
13798 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13800 self.0.request = v.into();
13801 self
13802 }
13803
13804 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13806 self.0.options = v.into();
13807 self
13808 }
13809
13810 pub async fn send(self) -> Result<()> {
13812 (*self.0.stub)
13813 .delete_session(self.0.request, self.0.options)
13814 .await
13815 .map(crate::Response::into_body)
13816 }
13817
13818 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13822 self.0.request.name = v.into();
13823 self
13824 }
13825 }
13826
13827 #[doc(hidden)]
13828 impl crate::RequestBuilder for DeleteSession {
13829 fn request_options(&mut self) -> &mut crate::RequestOptions {
13830 &mut self.0.options
13831 }
13832 }
13833
13834 #[derive(Clone, Debug)]
13851 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13852
13853 impl UpdateSession {
13854 pub(crate) fn new(
13855 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13856 ) -> Self {
13857 Self(RequestBuilder::new(stub))
13858 }
13859
13860 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13862 self.0.request = v.into();
13863 self
13864 }
13865
13866 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13868 self.0.options = v.into();
13869 self
13870 }
13871
13872 pub async fn send(self) -> Result<crate::model::Session> {
13874 (*self.0.stub)
13875 .update_session(self.0.request, self.0.options)
13876 .await
13877 .map(crate::Response::into_body)
13878 }
13879
13880 pub fn set_session<T>(mut self, v: T) -> Self
13884 where
13885 T: std::convert::Into<crate::model::Session>,
13886 {
13887 self.0.request.session = std::option::Option::Some(v.into());
13888 self
13889 }
13890
13891 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13895 where
13896 T: std::convert::Into<crate::model::Session>,
13897 {
13898 self.0.request.session = v.map(|x| x.into());
13899 self
13900 }
13901
13902 pub fn set_update_mask<T>(mut self, v: T) -> Self
13904 where
13905 T: std::convert::Into<wkt::FieldMask>,
13906 {
13907 self.0.request.update_mask = std::option::Option::Some(v.into());
13908 self
13909 }
13910
13911 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13913 where
13914 T: std::convert::Into<wkt::FieldMask>,
13915 {
13916 self.0.request.update_mask = v.map(|x| x.into());
13917 self
13918 }
13919 }
13920
13921 #[doc(hidden)]
13922 impl crate::RequestBuilder for UpdateSession {
13923 fn request_options(&mut self) -> &mut crate::RequestOptions {
13924 &mut self.0.options
13925 }
13926 }
13927
13928 #[derive(Clone, Debug)]
13945 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13946
13947 impl GetSession {
13948 pub(crate) fn new(
13949 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13950 ) -> Self {
13951 Self(RequestBuilder::new(stub))
13952 }
13953
13954 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13956 self.0.request = v.into();
13957 self
13958 }
13959
13960 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13962 self.0.options = v.into();
13963 self
13964 }
13965
13966 pub async fn send(self) -> Result<crate::model::Session> {
13968 (*self.0.stub)
13969 .get_session(self.0.request, self.0.options)
13970 .await
13971 .map(crate::Response::into_body)
13972 }
13973
13974 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13978 self.0.request.name = v.into();
13979 self
13980 }
13981
13982 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13984 self.0.request.include_answer_details = v.into();
13985 self
13986 }
13987 }
13988
13989 #[doc(hidden)]
13990 impl crate::RequestBuilder for GetSession {
13991 fn request_options(&mut self) -> &mut crate::RequestOptions {
13992 &mut self.0.options
13993 }
13994 }
13995
13996 #[derive(Clone, Debug)]
14017 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
14018
14019 impl ListSessions {
14020 pub(crate) fn new(
14021 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14022 ) -> Self {
14023 Self(RequestBuilder::new(stub))
14024 }
14025
14026 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
14028 self.0.request = v.into();
14029 self
14030 }
14031
14032 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14034 self.0.options = v.into();
14035 self
14036 }
14037
14038 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
14040 (*self.0.stub)
14041 .list_sessions(self.0.request, self.0.options)
14042 .await
14043 .map(crate::Response::into_body)
14044 }
14045
14046 pub fn by_page(
14048 self,
14049 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
14050 {
14051 use std::clone::Clone;
14052 let token = self.0.request.page_token.clone();
14053 let execute = move |token: String| {
14054 let mut builder = self.clone();
14055 builder.0.request = builder.0.request.set_page_token(token);
14056 builder.send()
14057 };
14058 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14059 }
14060
14061 pub fn by_item(
14063 self,
14064 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14065 crate::model::ListSessionsResponse,
14066 crate::Error,
14067 > {
14068 use google_cloud_gax::paginator::Paginator;
14069 self.by_page().items()
14070 }
14071
14072 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14076 self.0.request.parent = v.into();
14077 self
14078 }
14079
14080 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14082 self.0.request.page_size = v.into();
14083 self
14084 }
14085
14086 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14088 self.0.request.page_token = v.into();
14089 self
14090 }
14091
14092 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14094 self.0.request.filter = v.into();
14095 self
14096 }
14097
14098 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
14100 self.0.request.order_by = v.into();
14101 self
14102 }
14103 }
14104
14105 #[doc(hidden)]
14106 impl crate::RequestBuilder for ListSessions {
14107 fn request_options(&mut self) -> &mut crate::RequestOptions {
14108 &mut self.0.options
14109 }
14110 }
14111
14112 #[derive(Clone, Debug)]
14133 pub struct ListOperations(
14134 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
14135 );
14136
14137 impl ListOperations {
14138 pub(crate) fn new(
14139 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14140 ) -> Self {
14141 Self(RequestBuilder::new(stub))
14142 }
14143
14144 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
14146 mut self,
14147 v: V,
14148 ) -> Self {
14149 self.0.request = v.into();
14150 self
14151 }
14152
14153 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14155 self.0.options = v.into();
14156 self
14157 }
14158
14159 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
14161 (*self.0.stub)
14162 .list_operations(self.0.request, self.0.options)
14163 .await
14164 .map(crate::Response::into_body)
14165 }
14166
14167 pub fn by_page(
14169 self,
14170 ) -> impl google_cloud_gax::paginator::Paginator<
14171 google_cloud_longrunning::model::ListOperationsResponse,
14172 crate::Error,
14173 > {
14174 use std::clone::Clone;
14175 let token = self.0.request.page_token.clone();
14176 let execute = move |token: String| {
14177 let mut builder = self.clone();
14178 builder.0.request = builder.0.request.set_page_token(token);
14179 builder.send()
14180 };
14181 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14182 }
14183
14184 pub fn by_item(
14186 self,
14187 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14188 google_cloud_longrunning::model::ListOperationsResponse,
14189 crate::Error,
14190 > {
14191 use google_cloud_gax::paginator::Paginator;
14192 self.by_page().items()
14193 }
14194
14195 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14197 self.0.request.name = v.into();
14198 self
14199 }
14200
14201 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14203 self.0.request.filter = v.into();
14204 self
14205 }
14206
14207 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14209 self.0.request.page_size = v.into();
14210 self
14211 }
14212
14213 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14215 self.0.request.page_token = v.into();
14216 self
14217 }
14218
14219 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14221 self.0.request.return_partial_success = v.into();
14222 self
14223 }
14224 }
14225
14226 #[doc(hidden)]
14227 impl crate::RequestBuilder for ListOperations {
14228 fn request_options(&mut self) -> &mut crate::RequestOptions {
14229 &mut self.0.options
14230 }
14231 }
14232
14233 #[derive(Clone, Debug)]
14250 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14251
14252 impl GetOperation {
14253 pub(crate) fn new(
14254 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14255 ) -> Self {
14256 Self(RequestBuilder::new(stub))
14257 }
14258
14259 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14261 mut self,
14262 v: V,
14263 ) -> Self {
14264 self.0.request = v.into();
14265 self
14266 }
14267
14268 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14270 self.0.options = v.into();
14271 self
14272 }
14273
14274 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14276 (*self.0.stub)
14277 .get_operation(self.0.request, self.0.options)
14278 .await
14279 .map(crate::Response::into_body)
14280 }
14281
14282 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14284 self.0.request.name = v.into();
14285 self
14286 }
14287 }
14288
14289 #[doc(hidden)]
14290 impl crate::RequestBuilder for GetOperation {
14291 fn request_options(&mut self) -> &mut crate::RequestOptions {
14292 &mut self.0.options
14293 }
14294 }
14295
14296 #[derive(Clone, Debug)]
14313 pub struct CancelOperation(
14314 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14315 );
14316
14317 impl CancelOperation {
14318 pub(crate) fn new(
14319 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14320 ) -> Self {
14321 Self(RequestBuilder::new(stub))
14322 }
14323
14324 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
14326 mut self,
14327 v: V,
14328 ) -> Self {
14329 self.0.request = v.into();
14330 self
14331 }
14332
14333 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14335 self.0.options = v.into();
14336 self
14337 }
14338
14339 pub async fn send(self) -> Result<()> {
14341 (*self.0.stub)
14342 .cancel_operation(self.0.request, self.0.options)
14343 .await
14344 .map(crate::Response::into_body)
14345 }
14346
14347 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14349 self.0.request.name = v.into();
14350 self
14351 }
14352 }
14353
14354 #[doc(hidden)]
14355 impl crate::RequestBuilder for CancelOperation {
14356 fn request_options(&mut self) -> &mut crate::RequestOptions {
14357 &mut self.0.options
14358 }
14359 }
14360}
14361
14362#[cfg(feature = "site-search-engine-service")]
14364#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
14365pub mod site_search_engine_service {
14366 use crate::Result;
14367
14368 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14382
14383 pub(crate) mod client {
14384 use super::super::super::client::SiteSearchEngineService;
14385 pub struct Factory;
14386 impl crate::ClientFactory for Factory {
14387 type Client = SiteSearchEngineService;
14388 type Credentials = gaxi::options::Credentials;
14389 async fn build(
14390 self,
14391 config: gaxi::options::ClientConfig,
14392 ) -> crate::ClientBuilderResult<Self::Client> {
14393 Self::Client::new(config).await
14394 }
14395 }
14396 }
14397
14398 #[derive(Clone, Debug)]
14400 pub(crate) struct RequestBuilder<R: std::default::Default> {
14401 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14402 request: R,
14403 options: crate::RequestOptions,
14404 }
14405
14406 impl<R> RequestBuilder<R>
14407 where
14408 R: std::default::Default,
14409 {
14410 pub(crate) fn new(
14411 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14412 ) -> Self {
14413 Self {
14414 stub,
14415 request: R::default(),
14416 options: crate::RequestOptions::default(),
14417 }
14418 }
14419 }
14420
14421 #[derive(Clone, Debug)]
14438 pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
14439
14440 impl GetSiteSearchEngine {
14441 pub(crate) fn new(
14442 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14443 ) -> Self {
14444 Self(RequestBuilder::new(stub))
14445 }
14446
14447 pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
14449 mut self,
14450 v: V,
14451 ) -> Self {
14452 self.0.request = v.into();
14453 self
14454 }
14455
14456 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14458 self.0.options = v.into();
14459 self
14460 }
14461
14462 pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
14464 (*self.0.stub)
14465 .get_site_search_engine(self.0.request, self.0.options)
14466 .await
14467 .map(crate::Response::into_body)
14468 }
14469
14470 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14474 self.0.request.name = v.into();
14475 self
14476 }
14477 }
14478
14479 #[doc(hidden)]
14480 impl crate::RequestBuilder for GetSiteSearchEngine {
14481 fn request_options(&mut self) -> &mut crate::RequestOptions {
14482 &mut self.0.options
14483 }
14484 }
14485
14486 #[derive(Clone, Debug)]
14504 pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
14505
14506 impl CreateTargetSite {
14507 pub(crate) fn new(
14508 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14509 ) -> Self {
14510 Self(RequestBuilder::new(stub))
14511 }
14512
14513 pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
14515 mut self,
14516 v: V,
14517 ) -> Self {
14518 self.0.request = v.into();
14519 self
14520 }
14521
14522 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14524 self.0.options = v.into();
14525 self
14526 }
14527
14528 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14535 (*self.0.stub)
14536 .create_target_site(self.0.request, self.0.options)
14537 .await
14538 .map(crate::Response::into_body)
14539 }
14540
14541 pub fn poller(
14543 self,
14544 ) -> impl google_cloud_lro::Poller<
14545 crate::model::TargetSite,
14546 crate::model::CreateTargetSiteMetadata,
14547 > {
14548 type Operation = google_cloud_lro::internal::Operation<
14549 crate::model::TargetSite,
14550 crate::model::CreateTargetSiteMetadata,
14551 >;
14552 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14553 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14554 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14555 if let Some(ref mut details) = poller_options.tracing {
14556 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::create_target_site::until_done";
14557 }
14558
14559 let stub = self.0.stub.clone();
14560 let mut options = self.0.options.clone();
14561 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14562 let query = move |name| {
14563 let stub = stub.clone();
14564 let options = options.clone();
14565 async {
14566 let op = GetOperation::new(stub)
14567 .set_name(name)
14568 .with_options(options)
14569 .send()
14570 .await?;
14571 Ok(Operation::new(op))
14572 }
14573 };
14574
14575 let start = move || async {
14576 let op = self.send().await?;
14577 Ok(Operation::new(op))
14578 };
14579
14580 use google_cloud_lro::internal::PollerExt;
14581 {
14582 google_cloud_lro::internal::new_poller(
14583 polling_error_policy,
14584 polling_backoff_policy,
14585 start,
14586 query,
14587 )
14588 }
14589 .with_options(poller_options)
14590 }
14591
14592 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14596 self.0.request.parent = v.into();
14597 self
14598 }
14599
14600 pub fn set_target_site<T>(mut self, v: T) -> Self
14604 where
14605 T: std::convert::Into<crate::model::TargetSite>,
14606 {
14607 self.0.request.target_site = std::option::Option::Some(v.into());
14608 self
14609 }
14610
14611 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14615 where
14616 T: std::convert::Into<crate::model::TargetSite>,
14617 {
14618 self.0.request.target_site = v.map(|x| x.into());
14619 self
14620 }
14621 }
14622
14623 #[doc(hidden)]
14624 impl crate::RequestBuilder for CreateTargetSite {
14625 fn request_options(&mut self) -> &mut crate::RequestOptions {
14626 &mut self.0.options
14627 }
14628 }
14629
14630 #[derive(Clone, Debug)]
14648 pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14649
14650 impl BatchCreateTargetSites {
14651 pub(crate) fn new(
14652 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14653 ) -> Self {
14654 Self(RequestBuilder::new(stub))
14655 }
14656
14657 pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14659 mut self,
14660 v: V,
14661 ) -> Self {
14662 self.0.request = v.into();
14663 self
14664 }
14665
14666 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14668 self.0.options = v.into();
14669 self
14670 }
14671
14672 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14679 (*self.0.stub)
14680 .batch_create_target_sites(self.0.request, self.0.options)
14681 .await
14682 .map(crate::Response::into_body)
14683 }
14684
14685 pub fn poller(
14687 self,
14688 ) -> impl google_cloud_lro::Poller<
14689 crate::model::BatchCreateTargetSitesResponse,
14690 crate::model::BatchCreateTargetSiteMetadata,
14691 > {
14692 type Operation = google_cloud_lro::internal::Operation<
14693 crate::model::BatchCreateTargetSitesResponse,
14694 crate::model::BatchCreateTargetSiteMetadata,
14695 >;
14696 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14697 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14698 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14699 if let Some(ref mut details) = poller_options.tracing {
14700 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::batch_create_target_sites::until_done";
14701 }
14702
14703 let stub = self.0.stub.clone();
14704 let mut options = self.0.options.clone();
14705 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14706 let query = move |name| {
14707 let stub = stub.clone();
14708 let options = options.clone();
14709 async {
14710 let op = GetOperation::new(stub)
14711 .set_name(name)
14712 .with_options(options)
14713 .send()
14714 .await?;
14715 Ok(Operation::new(op))
14716 }
14717 };
14718
14719 let start = move || async {
14720 let op = self.send().await?;
14721 Ok(Operation::new(op))
14722 };
14723
14724 use google_cloud_lro::internal::PollerExt;
14725 {
14726 google_cloud_lro::internal::new_poller(
14727 polling_error_policy,
14728 polling_backoff_policy,
14729 start,
14730 query,
14731 )
14732 }
14733 .with_options(poller_options)
14734 }
14735
14736 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14740 self.0.request.parent = v.into();
14741 self
14742 }
14743
14744 pub fn set_requests<T, V>(mut self, v: T) -> Self
14748 where
14749 T: std::iter::IntoIterator<Item = V>,
14750 V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14751 {
14752 use std::iter::Iterator;
14753 self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14754 self
14755 }
14756 }
14757
14758 #[doc(hidden)]
14759 impl crate::RequestBuilder for BatchCreateTargetSites {
14760 fn request_options(&mut self) -> &mut crate::RequestOptions {
14761 &mut self.0.options
14762 }
14763 }
14764
14765 #[derive(Clone, Debug)]
14782 pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14783
14784 impl GetTargetSite {
14785 pub(crate) fn new(
14786 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14787 ) -> Self {
14788 Self(RequestBuilder::new(stub))
14789 }
14790
14791 pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14793 self.0.request = v.into();
14794 self
14795 }
14796
14797 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14799 self.0.options = v.into();
14800 self
14801 }
14802
14803 pub async fn send(self) -> Result<crate::model::TargetSite> {
14805 (*self.0.stub)
14806 .get_target_site(self.0.request, self.0.options)
14807 .await
14808 .map(crate::Response::into_body)
14809 }
14810
14811 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14815 self.0.request.name = v.into();
14816 self
14817 }
14818 }
14819
14820 #[doc(hidden)]
14821 impl crate::RequestBuilder for GetTargetSite {
14822 fn request_options(&mut self) -> &mut crate::RequestOptions {
14823 &mut self.0.options
14824 }
14825 }
14826
14827 #[derive(Clone, Debug)]
14845 pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14846
14847 impl UpdateTargetSite {
14848 pub(crate) fn new(
14849 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14850 ) -> Self {
14851 Self(RequestBuilder::new(stub))
14852 }
14853
14854 pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14856 mut self,
14857 v: V,
14858 ) -> Self {
14859 self.0.request = v.into();
14860 self
14861 }
14862
14863 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14865 self.0.options = v.into();
14866 self
14867 }
14868
14869 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14876 (*self.0.stub)
14877 .update_target_site(self.0.request, self.0.options)
14878 .await
14879 .map(crate::Response::into_body)
14880 }
14881
14882 pub fn poller(
14884 self,
14885 ) -> impl google_cloud_lro::Poller<
14886 crate::model::TargetSite,
14887 crate::model::UpdateTargetSiteMetadata,
14888 > {
14889 type Operation = google_cloud_lro::internal::Operation<
14890 crate::model::TargetSite,
14891 crate::model::UpdateTargetSiteMetadata,
14892 >;
14893 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14894 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14895 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14896 if let Some(ref mut details) = poller_options.tracing {
14897 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::update_target_site::until_done";
14898 }
14899
14900 let stub = self.0.stub.clone();
14901 let mut options = self.0.options.clone();
14902 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14903 let query = move |name| {
14904 let stub = stub.clone();
14905 let options = options.clone();
14906 async {
14907 let op = GetOperation::new(stub)
14908 .set_name(name)
14909 .with_options(options)
14910 .send()
14911 .await?;
14912 Ok(Operation::new(op))
14913 }
14914 };
14915
14916 let start = move || async {
14917 let op = self.send().await?;
14918 Ok(Operation::new(op))
14919 };
14920
14921 use google_cloud_lro::internal::PollerExt;
14922 {
14923 google_cloud_lro::internal::new_poller(
14924 polling_error_policy,
14925 polling_backoff_policy,
14926 start,
14927 query,
14928 )
14929 }
14930 .with_options(poller_options)
14931 }
14932
14933 pub fn set_target_site<T>(mut self, v: T) -> Self
14937 where
14938 T: std::convert::Into<crate::model::TargetSite>,
14939 {
14940 self.0.request.target_site = std::option::Option::Some(v.into());
14941 self
14942 }
14943
14944 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14948 where
14949 T: std::convert::Into<crate::model::TargetSite>,
14950 {
14951 self.0.request.target_site = v.map(|x| x.into());
14952 self
14953 }
14954 }
14955
14956 #[doc(hidden)]
14957 impl crate::RequestBuilder for UpdateTargetSite {
14958 fn request_options(&mut self) -> &mut crate::RequestOptions {
14959 &mut self.0.options
14960 }
14961 }
14962
14963 #[derive(Clone, Debug)]
14981 pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14982
14983 impl DeleteTargetSite {
14984 pub(crate) fn new(
14985 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14986 ) -> Self {
14987 Self(RequestBuilder::new(stub))
14988 }
14989
14990 pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14992 mut self,
14993 v: V,
14994 ) -> Self {
14995 self.0.request = v.into();
14996 self
14997 }
14998
14999 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15001 self.0.options = v.into();
15002 self
15003 }
15004
15005 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15012 (*self.0.stub)
15013 .delete_target_site(self.0.request, self.0.options)
15014 .await
15015 .map(crate::Response::into_body)
15016 }
15017
15018 pub fn poller(
15020 self,
15021 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
15022 type Operation = google_cloud_lro::internal::Operation<
15023 wkt::Empty,
15024 crate::model::DeleteTargetSiteMetadata,
15025 >;
15026 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15027 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15028 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15029 if let Some(ref mut details) = poller_options.tracing {
15030 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::delete_target_site::until_done";
15031 }
15032
15033 let stub = self.0.stub.clone();
15034 let mut options = self.0.options.clone();
15035 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15036 let query = move |name| {
15037 let stub = stub.clone();
15038 let options = options.clone();
15039 async {
15040 let op = GetOperation::new(stub)
15041 .set_name(name)
15042 .with_options(options)
15043 .send()
15044 .await?;
15045 Ok(Operation::new(op))
15046 }
15047 };
15048
15049 let start = move || async {
15050 let op = self.send().await?;
15051 Ok(Operation::new(op))
15052 };
15053
15054 use google_cloud_lro::internal::PollerExt;
15055 {
15056 google_cloud_lro::internal::new_unit_response_poller(
15057 polling_error_policy,
15058 polling_backoff_policy,
15059 start,
15060 query,
15061 )
15062 }
15063 .with_options(poller_options)
15064 }
15065
15066 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15070 self.0.request.name = v.into();
15071 self
15072 }
15073 }
15074
15075 #[doc(hidden)]
15076 impl crate::RequestBuilder for DeleteTargetSite {
15077 fn request_options(&mut self) -> &mut crate::RequestOptions {
15078 &mut self.0.options
15079 }
15080 }
15081
15082 #[derive(Clone, Debug)]
15103 pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
15104
15105 impl ListTargetSites {
15106 pub(crate) fn new(
15107 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15108 ) -> Self {
15109 Self(RequestBuilder::new(stub))
15110 }
15111
15112 pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
15114 self.0.request = v.into();
15115 self
15116 }
15117
15118 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15120 self.0.options = v.into();
15121 self
15122 }
15123
15124 pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
15126 (*self.0.stub)
15127 .list_target_sites(self.0.request, self.0.options)
15128 .await
15129 .map(crate::Response::into_body)
15130 }
15131
15132 pub fn by_page(
15134 self,
15135 ) -> impl google_cloud_gax::paginator::Paginator<
15136 crate::model::ListTargetSitesResponse,
15137 crate::Error,
15138 > {
15139 use std::clone::Clone;
15140 let token = self.0.request.page_token.clone();
15141 let execute = move |token: String| {
15142 let mut builder = self.clone();
15143 builder.0.request = builder.0.request.set_page_token(token);
15144 builder.send()
15145 };
15146 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15147 }
15148
15149 pub fn by_item(
15151 self,
15152 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15153 crate::model::ListTargetSitesResponse,
15154 crate::Error,
15155 > {
15156 use google_cloud_gax::paginator::Paginator;
15157 self.by_page().items()
15158 }
15159
15160 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15164 self.0.request.parent = v.into();
15165 self
15166 }
15167
15168 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15170 self.0.request.page_size = v.into();
15171 self
15172 }
15173
15174 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15176 self.0.request.page_token = v.into();
15177 self
15178 }
15179 }
15180
15181 #[doc(hidden)]
15182 impl crate::RequestBuilder for ListTargetSites {
15183 fn request_options(&mut self) -> &mut crate::RequestOptions {
15184 &mut self.0.options
15185 }
15186 }
15187
15188 #[derive(Clone, Debug)]
15206 pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
15207
15208 impl CreateSitemap {
15209 pub(crate) fn new(
15210 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15211 ) -> Self {
15212 Self(RequestBuilder::new(stub))
15213 }
15214
15215 pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
15217 self.0.request = v.into();
15218 self
15219 }
15220
15221 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15223 self.0.options = v.into();
15224 self
15225 }
15226
15227 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15234 (*self.0.stub)
15235 .create_sitemap(self.0.request, self.0.options)
15236 .await
15237 .map(crate::Response::into_body)
15238 }
15239
15240 pub fn poller(
15242 self,
15243 ) -> impl google_cloud_lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata>
15244 {
15245 type Operation = google_cloud_lro::internal::Operation<
15246 crate::model::Sitemap,
15247 crate::model::CreateSitemapMetadata,
15248 >;
15249 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15250 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15251 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15252 if let Some(ref mut details) = poller_options.tracing {
15253 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::create_sitemap::until_done";
15254 }
15255
15256 let stub = self.0.stub.clone();
15257 let mut options = self.0.options.clone();
15258 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15259 let query = move |name| {
15260 let stub = stub.clone();
15261 let options = options.clone();
15262 async {
15263 let op = GetOperation::new(stub)
15264 .set_name(name)
15265 .with_options(options)
15266 .send()
15267 .await?;
15268 Ok(Operation::new(op))
15269 }
15270 };
15271
15272 let start = move || async {
15273 let op = self.send().await?;
15274 Ok(Operation::new(op))
15275 };
15276
15277 use google_cloud_lro::internal::PollerExt;
15278 {
15279 google_cloud_lro::internal::new_poller(
15280 polling_error_policy,
15281 polling_backoff_policy,
15282 start,
15283 query,
15284 )
15285 }
15286 .with_options(poller_options)
15287 }
15288
15289 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15293 self.0.request.parent = v.into();
15294 self
15295 }
15296
15297 pub fn set_sitemap<T>(mut self, v: T) -> Self
15301 where
15302 T: std::convert::Into<crate::model::Sitemap>,
15303 {
15304 self.0.request.sitemap = std::option::Option::Some(v.into());
15305 self
15306 }
15307
15308 pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
15312 where
15313 T: std::convert::Into<crate::model::Sitemap>,
15314 {
15315 self.0.request.sitemap = v.map(|x| x.into());
15316 self
15317 }
15318 }
15319
15320 #[doc(hidden)]
15321 impl crate::RequestBuilder for CreateSitemap {
15322 fn request_options(&mut self) -> &mut crate::RequestOptions {
15323 &mut self.0.options
15324 }
15325 }
15326
15327 #[derive(Clone, Debug)]
15345 pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
15346
15347 impl DeleteSitemap {
15348 pub(crate) fn new(
15349 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15350 ) -> Self {
15351 Self(RequestBuilder::new(stub))
15352 }
15353
15354 pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
15356 self.0.request = v.into();
15357 self
15358 }
15359
15360 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15362 self.0.options = v.into();
15363 self
15364 }
15365
15366 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15373 (*self.0.stub)
15374 .delete_sitemap(self.0.request, self.0.options)
15375 .await
15376 .map(crate::Response::into_body)
15377 }
15378
15379 pub fn poller(
15381 self,
15382 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSitemapMetadata> {
15383 type Operation = google_cloud_lro::internal::Operation<
15384 wkt::Empty,
15385 crate::model::DeleteSitemapMetadata,
15386 >;
15387 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15388 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15389 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15390 if let Some(ref mut details) = poller_options.tracing {
15391 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::delete_sitemap::until_done";
15392 }
15393
15394 let stub = self.0.stub.clone();
15395 let mut options = self.0.options.clone();
15396 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15397 let query = move |name| {
15398 let stub = stub.clone();
15399 let options = options.clone();
15400 async {
15401 let op = GetOperation::new(stub)
15402 .set_name(name)
15403 .with_options(options)
15404 .send()
15405 .await?;
15406 Ok(Operation::new(op))
15407 }
15408 };
15409
15410 let start = move || async {
15411 let op = self.send().await?;
15412 Ok(Operation::new(op))
15413 };
15414
15415 use google_cloud_lro::internal::PollerExt;
15416 {
15417 google_cloud_lro::internal::new_unit_response_poller(
15418 polling_error_policy,
15419 polling_backoff_policy,
15420 start,
15421 query,
15422 )
15423 }
15424 .with_options(poller_options)
15425 }
15426
15427 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15431 self.0.request.name = v.into();
15432 self
15433 }
15434 }
15435
15436 #[doc(hidden)]
15437 impl crate::RequestBuilder for DeleteSitemap {
15438 fn request_options(&mut self) -> &mut crate::RequestOptions {
15439 &mut self.0.options
15440 }
15441 }
15442
15443 #[derive(Clone, Debug)]
15460 pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
15461
15462 impl FetchSitemaps {
15463 pub(crate) fn new(
15464 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15465 ) -> Self {
15466 Self(RequestBuilder::new(stub))
15467 }
15468
15469 pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
15471 self.0.request = v.into();
15472 self
15473 }
15474
15475 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15477 self.0.options = v.into();
15478 self
15479 }
15480
15481 pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
15483 (*self.0.stub)
15484 .fetch_sitemaps(self.0.request, self.0.options)
15485 .await
15486 .map(crate::Response::into_body)
15487 }
15488
15489 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15493 self.0.request.parent = v.into();
15494 self
15495 }
15496
15497 pub fn set_matcher<T>(mut self, v: T) -> Self
15499 where
15500 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15501 {
15502 self.0.request.matcher = std::option::Option::Some(v.into());
15503 self
15504 }
15505
15506 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
15508 where
15509 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15510 {
15511 self.0.request.matcher = v.map(|x| x.into());
15512 self
15513 }
15514 }
15515
15516 #[doc(hidden)]
15517 impl crate::RequestBuilder for FetchSitemaps {
15518 fn request_options(&mut self) -> &mut crate::RequestOptions {
15519 &mut self.0.options
15520 }
15521 }
15522
15523 #[derive(Clone, Debug)]
15541 pub struct EnableAdvancedSiteSearch(
15542 RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
15543 );
15544
15545 impl EnableAdvancedSiteSearch {
15546 pub(crate) fn new(
15547 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15548 ) -> Self {
15549 Self(RequestBuilder::new(stub))
15550 }
15551
15552 pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
15554 mut self,
15555 v: V,
15556 ) -> Self {
15557 self.0.request = v.into();
15558 self
15559 }
15560
15561 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15563 self.0.options = v.into();
15564 self
15565 }
15566
15567 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15574 (*self.0.stub)
15575 .enable_advanced_site_search(self.0.request, self.0.options)
15576 .await
15577 .map(crate::Response::into_body)
15578 }
15579
15580 pub fn poller(
15582 self,
15583 ) -> impl google_cloud_lro::Poller<
15584 crate::model::EnableAdvancedSiteSearchResponse,
15585 crate::model::EnableAdvancedSiteSearchMetadata,
15586 > {
15587 type Operation = google_cloud_lro::internal::Operation<
15588 crate::model::EnableAdvancedSiteSearchResponse,
15589 crate::model::EnableAdvancedSiteSearchMetadata,
15590 >;
15591 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15592 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15593 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15594 if let Some(ref mut details) = poller_options.tracing {
15595 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::enable_advanced_site_search::until_done";
15596 }
15597
15598 let stub = self.0.stub.clone();
15599 let mut options = self.0.options.clone();
15600 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15601 let query = move |name| {
15602 let stub = stub.clone();
15603 let options = options.clone();
15604 async {
15605 let op = GetOperation::new(stub)
15606 .set_name(name)
15607 .with_options(options)
15608 .send()
15609 .await?;
15610 Ok(Operation::new(op))
15611 }
15612 };
15613
15614 let start = move || async {
15615 let op = self.send().await?;
15616 Ok(Operation::new(op))
15617 };
15618
15619 use google_cloud_lro::internal::PollerExt;
15620 {
15621 google_cloud_lro::internal::new_poller(
15622 polling_error_policy,
15623 polling_backoff_policy,
15624 start,
15625 query,
15626 )
15627 }
15628 .with_options(poller_options)
15629 }
15630
15631 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15635 self.0.request.site_search_engine = v.into();
15636 self
15637 }
15638 }
15639
15640 #[doc(hidden)]
15641 impl crate::RequestBuilder for EnableAdvancedSiteSearch {
15642 fn request_options(&mut self) -> &mut crate::RequestOptions {
15643 &mut self.0.options
15644 }
15645 }
15646
15647 #[derive(Clone, Debug)]
15665 pub struct DisableAdvancedSiteSearch(
15666 RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15667 );
15668
15669 impl DisableAdvancedSiteSearch {
15670 pub(crate) fn new(
15671 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15672 ) -> Self {
15673 Self(RequestBuilder::new(stub))
15674 }
15675
15676 pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15678 mut self,
15679 v: V,
15680 ) -> Self {
15681 self.0.request = v.into();
15682 self
15683 }
15684
15685 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15687 self.0.options = v.into();
15688 self
15689 }
15690
15691 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15698 (*self.0.stub)
15699 .disable_advanced_site_search(self.0.request, self.0.options)
15700 .await
15701 .map(crate::Response::into_body)
15702 }
15703
15704 pub fn poller(
15706 self,
15707 ) -> impl google_cloud_lro::Poller<
15708 crate::model::DisableAdvancedSiteSearchResponse,
15709 crate::model::DisableAdvancedSiteSearchMetadata,
15710 > {
15711 type Operation = google_cloud_lro::internal::Operation<
15712 crate::model::DisableAdvancedSiteSearchResponse,
15713 crate::model::DisableAdvancedSiteSearchMetadata,
15714 >;
15715 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15716 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15717 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15718 if let Some(ref mut details) = poller_options.tracing {
15719 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::disable_advanced_site_search::until_done";
15720 }
15721
15722 let stub = self.0.stub.clone();
15723 let mut options = self.0.options.clone();
15724 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15725 let query = move |name| {
15726 let stub = stub.clone();
15727 let options = options.clone();
15728 async {
15729 let op = GetOperation::new(stub)
15730 .set_name(name)
15731 .with_options(options)
15732 .send()
15733 .await?;
15734 Ok(Operation::new(op))
15735 }
15736 };
15737
15738 let start = move || async {
15739 let op = self.send().await?;
15740 Ok(Operation::new(op))
15741 };
15742
15743 use google_cloud_lro::internal::PollerExt;
15744 {
15745 google_cloud_lro::internal::new_poller(
15746 polling_error_policy,
15747 polling_backoff_policy,
15748 start,
15749 query,
15750 )
15751 }
15752 .with_options(poller_options)
15753 }
15754
15755 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15759 self.0.request.site_search_engine = v.into();
15760 self
15761 }
15762 }
15763
15764 #[doc(hidden)]
15765 impl crate::RequestBuilder for DisableAdvancedSiteSearch {
15766 fn request_options(&mut self) -> &mut crate::RequestOptions {
15767 &mut self.0.options
15768 }
15769 }
15770
15771 #[derive(Clone, Debug)]
15789 pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15790
15791 impl RecrawlUris {
15792 pub(crate) fn new(
15793 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15794 ) -> Self {
15795 Self(RequestBuilder::new(stub))
15796 }
15797
15798 pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15800 self.0.request = v.into();
15801 self
15802 }
15803
15804 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15806 self.0.options = v.into();
15807 self
15808 }
15809
15810 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15817 (*self.0.stub)
15818 .recrawl_uris(self.0.request, self.0.options)
15819 .await
15820 .map(crate::Response::into_body)
15821 }
15822
15823 pub fn poller(
15825 self,
15826 ) -> impl google_cloud_lro::Poller<
15827 crate::model::RecrawlUrisResponse,
15828 crate::model::RecrawlUrisMetadata,
15829 > {
15830 type Operation = google_cloud_lro::internal::Operation<
15831 crate::model::RecrawlUrisResponse,
15832 crate::model::RecrawlUrisMetadata,
15833 >;
15834 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15835 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15836 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15837 if let Some(ref mut details) = poller_options.tracing {
15838 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::recrawl_uris::until_done";
15839 }
15840
15841 let stub = self.0.stub.clone();
15842 let mut options = self.0.options.clone();
15843 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15844 let query = move |name| {
15845 let stub = stub.clone();
15846 let options = options.clone();
15847 async {
15848 let op = GetOperation::new(stub)
15849 .set_name(name)
15850 .with_options(options)
15851 .send()
15852 .await?;
15853 Ok(Operation::new(op))
15854 }
15855 };
15856
15857 let start = move || async {
15858 let op = self.send().await?;
15859 Ok(Operation::new(op))
15860 };
15861
15862 use google_cloud_lro::internal::PollerExt;
15863 {
15864 google_cloud_lro::internal::new_poller(
15865 polling_error_policy,
15866 polling_backoff_policy,
15867 start,
15868 query,
15869 )
15870 }
15871 .with_options(poller_options)
15872 }
15873
15874 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15878 self.0.request.site_search_engine = v.into();
15879 self
15880 }
15881
15882 pub fn set_uris<T, V>(mut self, v: T) -> Self
15886 where
15887 T: std::iter::IntoIterator<Item = V>,
15888 V: std::convert::Into<std::string::String>,
15889 {
15890 use std::iter::Iterator;
15891 self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15892 self
15893 }
15894
15895 pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15897 self.0.request.site_credential = v.into();
15898 self
15899 }
15900 }
15901
15902 #[doc(hidden)]
15903 impl crate::RequestBuilder for RecrawlUris {
15904 fn request_options(&mut self) -> &mut crate::RequestOptions {
15905 &mut self.0.options
15906 }
15907 }
15908
15909 #[derive(Clone, Debug)]
15927 pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15928
15929 impl BatchVerifyTargetSites {
15930 pub(crate) fn new(
15931 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15932 ) -> Self {
15933 Self(RequestBuilder::new(stub))
15934 }
15935
15936 pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15938 mut self,
15939 v: V,
15940 ) -> Self {
15941 self.0.request = v.into();
15942 self
15943 }
15944
15945 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15947 self.0.options = v.into();
15948 self
15949 }
15950
15951 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15958 (*self.0.stub)
15959 .batch_verify_target_sites(self.0.request, self.0.options)
15960 .await
15961 .map(crate::Response::into_body)
15962 }
15963
15964 pub fn poller(
15966 self,
15967 ) -> impl google_cloud_lro::Poller<
15968 crate::model::BatchVerifyTargetSitesResponse,
15969 crate::model::BatchVerifyTargetSitesMetadata,
15970 > {
15971 type Operation = google_cloud_lro::internal::Operation<
15972 crate::model::BatchVerifyTargetSitesResponse,
15973 crate::model::BatchVerifyTargetSitesMetadata,
15974 >;
15975 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15976 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15977 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15978 if let Some(ref mut details) = poller_options.tracing {
15979 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::batch_verify_target_sites::until_done";
15980 }
15981
15982 let stub = self.0.stub.clone();
15983 let mut options = self.0.options.clone();
15984 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15985 let query = move |name| {
15986 let stub = stub.clone();
15987 let options = options.clone();
15988 async {
15989 let op = GetOperation::new(stub)
15990 .set_name(name)
15991 .with_options(options)
15992 .send()
15993 .await?;
15994 Ok(Operation::new(op))
15995 }
15996 };
15997
15998 let start = move || async {
15999 let op = self.send().await?;
16000 Ok(Operation::new(op))
16001 };
16002
16003 use google_cloud_lro::internal::PollerExt;
16004 {
16005 google_cloud_lro::internal::new_poller(
16006 polling_error_policy,
16007 polling_backoff_policy,
16008 start,
16009 query,
16010 )
16011 }
16012 .with_options(poller_options)
16013 }
16014
16015 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16019 self.0.request.parent = v.into();
16020 self
16021 }
16022 }
16023
16024 #[doc(hidden)]
16025 impl crate::RequestBuilder for BatchVerifyTargetSites {
16026 fn request_options(&mut self) -> &mut crate::RequestOptions {
16027 &mut self.0.options
16028 }
16029 }
16030
16031 #[derive(Clone, Debug)]
16052 pub struct FetchDomainVerificationStatus(
16053 RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
16054 );
16055
16056 impl FetchDomainVerificationStatus {
16057 pub(crate) fn new(
16058 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16059 ) -> Self {
16060 Self(RequestBuilder::new(stub))
16061 }
16062
16063 pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
16065 mut self,
16066 v: V,
16067 ) -> Self {
16068 self.0.request = v.into();
16069 self
16070 }
16071
16072 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16074 self.0.options = v.into();
16075 self
16076 }
16077
16078 pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
16080 (*self.0.stub)
16081 .fetch_domain_verification_status(self.0.request, self.0.options)
16082 .await
16083 .map(crate::Response::into_body)
16084 }
16085
16086 pub fn by_page(
16088 self,
16089 ) -> impl google_cloud_gax::paginator::Paginator<
16090 crate::model::FetchDomainVerificationStatusResponse,
16091 crate::Error,
16092 > {
16093 use std::clone::Clone;
16094 let token = self.0.request.page_token.clone();
16095 let execute = move |token: String| {
16096 let mut builder = self.clone();
16097 builder.0.request = builder.0.request.set_page_token(token);
16098 builder.send()
16099 };
16100 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16101 }
16102
16103 pub fn by_item(
16105 self,
16106 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16107 crate::model::FetchDomainVerificationStatusResponse,
16108 crate::Error,
16109 > {
16110 use google_cloud_gax::paginator::Paginator;
16111 self.by_page().items()
16112 }
16113
16114 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
16118 self.0.request.site_search_engine = v.into();
16119 self
16120 }
16121
16122 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16124 self.0.request.page_size = v.into();
16125 self
16126 }
16127
16128 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16130 self.0.request.page_token = v.into();
16131 self
16132 }
16133 }
16134
16135 #[doc(hidden)]
16136 impl crate::RequestBuilder for FetchDomainVerificationStatus {
16137 fn request_options(&mut self) -> &mut crate::RequestOptions {
16138 &mut self.0.options
16139 }
16140 }
16141
16142 #[derive(Clone, Debug)]
16163 pub struct ListOperations(
16164 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16165 );
16166
16167 impl ListOperations {
16168 pub(crate) fn new(
16169 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16170 ) -> Self {
16171 Self(RequestBuilder::new(stub))
16172 }
16173
16174 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16176 mut self,
16177 v: V,
16178 ) -> Self {
16179 self.0.request = v.into();
16180 self
16181 }
16182
16183 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16185 self.0.options = v.into();
16186 self
16187 }
16188
16189 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16191 (*self.0.stub)
16192 .list_operations(self.0.request, self.0.options)
16193 .await
16194 .map(crate::Response::into_body)
16195 }
16196
16197 pub fn by_page(
16199 self,
16200 ) -> impl google_cloud_gax::paginator::Paginator<
16201 google_cloud_longrunning::model::ListOperationsResponse,
16202 crate::Error,
16203 > {
16204 use std::clone::Clone;
16205 let token = self.0.request.page_token.clone();
16206 let execute = move |token: String| {
16207 let mut builder = self.clone();
16208 builder.0.request = builder.0.request.set_page_token(token);
16209 builder.send()
16210 };
16211 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16212 }
16213
16214 pub fn by_item(
16216 self,
16217 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16218 google_cloud_longrunning::model::ListOperationsResponse,
16219 crate::Error,
16220 > {
16221 use google_cloud_gax::paginator::Paginator;
16222 self.by_page().items()
16223 }
16224
16225 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16227 self.0.request.name = v.into();
16228 self
16229 }
16230
16231 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16233 self.0.request.filter = v.into();
16234 self
16235 }
16236
16237 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16239 self.0.request.page_size = v.into();
16240 self
16241 }
16242
16243 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16245 self.0.request.page_token = v.into();
16246 self
16247 }
16248
16249 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16251 self.0.request.return_partial_success = v.into();
16252 self
16253 }
16254 }
16255
16256 #[doc(hidden)]
16257 impl crate::RequestBuilder for ListOperations {
16258 fn request_options(&mut self) -> &mut crate::RequestOptions {
16259 &mut self.0.options
16260 }
16261 }
16262
16263 #[derive(Clone, Debug)]
16280 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16281
16282 impl GetOperation {
16283 pub(crate) fn new(
16284 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16285 ) -> Self {
16286 Self(RequestBuilder::new(stub))
16287 }
16288
16289 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16291 mut self,
16292 v: V,
16293 ) -> Self {
16294 self.0.request = v.into();
16295 self
16296 }
16297
16298 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16300 self.0.options = v.into();
16301 self
16302 }
16303
16304 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16306 (*self.0.stub)
16307 .get_operation(self.0.request, self.0.options)
16308 .await
16309 .map(crate::Response::into_body)
16310 }
16311
16312 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16314 self.0.request.name = v.into();
16315 self
16316 }
16317 }
16318
16319 #[doc(hidden)]
16320 impl crate::RequestBuilder for GetOperation {
16321 fn request_options(&mut self) -> &mut crate::RequestOptions {
16322 &mut self.0.options
16323 }
16324 }
16325
16326 #[derive(Clone, Debug)]
16343 pub struct CancelOperation(
16344 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16345 );
16346
16347 impl CancelOperation {
16348 pub(crate) fn new(
16349 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16350 ) -> Self {
16351 Self(RequestBuilder::new(stub))
16352 }
16353
16354 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16356 mut self,
16357 v: V,
16358 ) -> Self {
16359 self.0.request = v.into();
16360 self
16361 }
16362
16363 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16365 self.0.options = v.into();
16366 self
16367 }
16368
16369 pub async fn send(self) -> Result<()> {
16371 (*self.0.stub)
16372 .cancel_operation(self.0.request, self.0.options)
16373 .await
16374 .map(crate::Response::into_body)
16375 }
16376
16377 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16379 self.0.request.name = v.into();
16380 self
16381 }
16382 }
16383
16384 #[doc(hidden)]
16385 impl crate::RequestBuilder for CancelOperation {
16386 fn request_options(&mut self) -> &mut crate::RequestOptions {
16387 &mut self.0.options
16388 }
16389 }
16390}
16391
16392#[cfg(feature = "user-event-service")]
16394#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
16395pub mod user_event_service {
16396 use crate::Result;
16397
16398 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16412
16413 pub(crate) mod client {
16414 use super::super::super::client::UserEventService;
16415 pub struct Factory;
16416 impl crate::ClientFactory for Factory {
16417 type Client = UserEventService;
16418 type Credentials = gaxi::options::Credentials;
16419 async fn build(
16420 self,
16421 config: gaxi::options::ClientConfig,
16422 ) -> crate::ClientBuilderResult<Self::Client> {
16423 Self::Client::new(config).await
16424 }
16425 }
16426 }
16427
16428 #[derive(Clone, Debug)]
16430 pub(crate) struct RequestBuilder<R: std::default::Default> {
16431 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16432 request: R,
16433 options: crate::RequestOptions,
16434 }
16435
16436 impl<R> RequestBuilder<R>
16437 where
16438 R: std::default::Default,
16439 {
16440 pub(crate) fn new(
16441 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16442 ) -> Self {
16443 Self {
16444 stub,
16445 request: R::default(),
16446 options: crate::RequestOptions::default(),
16447 }
16448 }
16449 }
16450
16451 #[derive(Clone, Debug)]
16468 pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
16469
16470 impl WriteUserEvent {
16471 pub(crate) fn new(
16472 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16473 ) -> Self {
16474 Self(RequestBuilder::new(stub))
16475 }
16476
16477 pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
16479 self.0.request = v.into();
16480 self
16481 }
16482
16483 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16485 self.0.options = v.into();
16486 self
16487 }
16488
16489 pub async fn send(self) -> Result<crate::model::UserEvent> {
16491 (*self.0.stub)
16492 .write_user_event(self.0.request, self.0.options)
16493 .await
16494 .map(crate::Response::into_body)
16495 }
16496
16497 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16501 self.0.request.parent = v.into();
16502 self
16503 }
16504
16505 pub fn set_user_event<T>(mut self, v: T) -> Self
16509 where
16510 T: std::convert::Into<crate::model::UserEvent>,
16511 {
16512 self.0.request.user_event = std::option::Option::Some(v.into());
16513 self
16514 }
16515
16516 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
16520 where
16521 T: std::convert::Into<crate::model::UserEvent>,
16522 {
16523 self.0.request.user_event = v.map(|x| x.into());
16524 self
16525 }
16526
16527 pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
16529 self.0.request.write_async = v.into();
16530 self
16531 }
16532 }
16533
16534 #[doc(hidden)]
16535 impl crate::RequestBuilder for WriteUserEvent {
16536 fn request_options(&mut self) -> &mut crate::RequestOptions {
16537 &mut self.0.options
16538 }
16539 }
16540
16541 #[derive(Clone, Debug)]
16558 pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
16559
16560 impl CollectUserEvent {
16561 pub(crate) fn new(
16562 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16563 ) -> Self {
16564 Self(RequestBuilder::new(stub))
16565 }
16566
16567 pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
16569 mut self,
16570 v: V,
16571 ) -> Self {
16572 self.0.request = v.into();
16573 self
16574 }
16575
16576 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16578 self.0.options = v.into();
16579 self
16580 }
16581
16582 pub async fn send(self) -> Result<google_cloud_api::model::HttpBody> {
16584 (*self.0.stub)
16585 .collect_user_event(self.0.request, self.0.options)
16586 .await
16587 .map(crate::Response::into_body)
16588 }
16589
16590 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16594 self.0.request.parent = v.into();
16595 self
16596 }
16597
16598 pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
16602 self.0.request.user_event = v.into();
16603 self
16604 }
16605
16606 pub fn set_uri<T>(mut self, v: T) -> Self
16608 where
16609 T: std::convert::Into<std::string::String>,
16610 {
16611 self.0.request.uri = std::option::Option::Some(v.into());
16612 self
16613 }
16614
16615 pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
16617 where
16618 T: std::convert::Into<std::string::String>,
16619 {
16620 self.0.request.uri = v.map(|x| x.into());
16621 self
16622 }
16623
16624 pub fn set_ets<T>(mut self, v: T) -> Self
16626 where
16627 T: std::convert::Into<i64>,
16628 {
16629 self.0.request.ets = std::option::Option::Some(v.into());
16630 self
16631 }
16632
16633 pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
16635 where
16636 T: std::convert::Into<i64>,
16637 {
16638 self.0.request.ets = v.map(|x| x.into());
16639 self
16640 }
16641 }
16642
16643 #[doc(hidden)]
16644 impl crate::RequestBuilder for CollectUserEvent {
16645 fn request_options(&mut self) -> &mut crate::RequestOptions {
16646 &mut self.0.options
16647 }
16648 }
16649
16650 #[derive(Clone, Debug)]
16668 pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
16669
16670 impl PurgeUserEvents {
16671 pub(crate) fn new(
16672 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16673 ) -> Self {
16674 Self(RequestBuilder::new(stub))
16675 }
16676
16677 pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16679 self.0.request = v.into();
16680 self
16681 }
16682
16683 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16685 self.0.options = v.into();
16686 self
16687 }
16688
16689 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16696 (*self.0.stub)
16697 .purge_user_events(self.0.request, self.0.options)
16698 .await
16699 .map(crate::Response::into_body)
16700 }
16701
16702 pub fn poller(
16704 self,
16705 ) -> impl google_cloud_lro::Poller<
16706 crate::model::PurgeUserEventsResponse,
16707 crate::model::PurgeUserEventsMetadata,
16708 > {
16709 type Operation = google_cloud_lro::internal::Operation<
16710 crate::model::PurgeUserEventsResponse,
16711 crate::model::PurgeUserEventsMetadata,
16712 >;
16713 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16714 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16715 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16716 if let Some(ref mut details) = poller_options.tracing {
16717 details.method_name = "google_cloud_discoveryengine_v1::client::UserEventService::purge_user_events::until_done";
16718 }
16719
16720 let stub = self.0.stub.clone();
16721 let mut options = self.0.options.clone();
16722 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16723 let query = move |name| {
16724 let stub = stub.clone();
16725 let options = options.clone();
16726 async {
16727 let op = GetOperation::new(stub)
16728 .set_name(name)
16729 .with_options(options)
16730 .send()
16731 .await?;
16732 Ok(Operation::new(op))
16733 }
16734 };
16735
16736 let start = move || async {
16737 let op = self.send().await?;
16738 Ok(Operation::new(op))
16739 };
16740
16741 use google_cloud_lro::internal::PollerExt;
16742 {
16743 google_cloud_lro::internal::new_poller(
16744 polling_error_policy,
16745 polling_backoff_policy,
16746 start,
16747 query,
16748 )
16749 }
16750 .with_options(poller_options)
16751 }
16752
16753 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16757 self.0.request.parent = v.into();
16758 self
16759 }
16760
16761 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16765 self.0.request.filter = v.into();
16766 self
16767 }
16768
16769 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16771 self.0.request.force = v.into();
16772 self
16773 }
16774 }
16775
16776 #[doc(hidden)]
16777 impl crate::RequestBuilder for PurgeUserEvents {
16778 fn request_options(&mut self) -> &mut crate::RequestOptions {
16779 &mut self.0.options
16780 }
16781 }
16782
16783 #[derive(Clone, Debug)]
16801 pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
16802
16803 impl ImportUserEvents {
16804 pub(crate) fn new(
16805 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16806 ) -> Self {
16807 Self(RequestBuilder::new(stub))
16808 }
16809
16810 pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
16812 mut self,
16813 v: V,
16814 ) -> Self {
16815 self.0.request = v.into();
16816 self
16817 }
16818
16819 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16821 self.0.options = v.into();
16822 self
16823 }
16824
16825 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16832 (*self.0.stub)
16833 .import_user_events(self.0.request, self.0.options)
16834 .await
16835 .map(crate::Response::into_body)
16836 }
16837
16838 pub fn poller(
16840 self,
16841 ) -> impl google_cloud_lro::Poller<
16842 crate::model::ImportUserEventsResponse,
16843 crate::model::ImportUserEventsMetadata,
16844 > {
16845 type Operation = google_cloud_lro::internal::Operation<
16846 crate::model::ImportUserEventsResponse,
16847 crate::model::ImportUserEventsMetadata,
16848 >;
16849 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16850 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16851 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16852 if let Some(ref mut details) = poller_options.tracing {
16853 details.method_name = "google_cloud_discoveryengine_v1::client::UserEventService::import_user_events::until_done";
16854 }
16855
16856 let stub = self.0.stub.clone();
16857 let mut options = self.0.options.clone();
16858 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16859 let query = move |name| {
16860 let stub = stub.clone();
16861 let options = options.clone();
16862 async {
16863 let op = GetOperation::new(stub)
16864 .set_name(name)
16865 .with_options(options)
16866 .send()
16867 .await?;
16868 Ok(Operation::new(op))
16869 }
16870 };
16871
16872 let start = move || async {
16873 let op = self.send().await?;
16874 Ok(Operation::new(op))
16875 };
16876
16877 use google_cloud_lro::internal::PollerExt;
16878 {
16879 google_cloud_lro::internal::new_poller(
16880 polling_error_policy,
16881 polling_backoff_policy,
16882 start,
16883 query,
16884 )
16885 }
16886 .with_options(poller_options)
16887 }
16888
16889 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16893 self.0.request.parent = v.into();
16894 self
16895 }
16896
16897 pub fn set_error_config<T>(mut self, v: T) -> Self
16899 where
16900 T: std::convert::Into<crate::model::ImportErrorConfig>,
16901 {
16902 self.0.request.error_config = std::option::Option::Some(v.into());
16903 self
16904 }
16905
16906 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
16908 where
16909 T: std::convert::Into<crate::model::ImportErrorConfig>,
16910 {
16911 self.0.request.error_config = v.map(|x| x.into());
16912 self
16913 }
16914
16915 pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
16920 mut self,
16921 v: T,
16922 ) -> Self {
16923 self.0.request.source = v.into();
16924 self
16925 }
16926
16927 pub fn set_inline_source<
16933 T: std::convert::Into<
16934 std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
16935 >,
16936 >(
16937 mut self,
16938 v: T,
16939 ) -> Self {
16940 self.0.request = self.0.request.set_inline_source(v);
16941 self
16942 }
16943
16944 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
16950 mut self,
16951 v: T,
16952 ) -> Self {
16953 self.0.request = self.0.request.set_gcs_source(v);
16954 self
16955 }
16956
16957 pub fn set_bigquery_source<
16963 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
16964 >(
16965 mut self,
16966 v: T,
16967 ) -> Self {
16968 self.0.request = self.0.request.set_bigquery_source(v);
16969 self
16970 }
16971 }
16972
16973 #[doc(hidden)]
16974 impl crate::RequestBuilder for ImportUserEvents {
16975 fn request_options(&mut self) -> &mut crate::RequestOptions {
16976 &mut self.0.options
16977 }
16978 }
16979
16980 #[derive(Clone, Debug)]
17001 pub struct ListOperations(
17002 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17003 );
17004
17005 impl ListOperations {
17006 pub(crate) fn new(
17007 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17008 ) -> Self {
17009 Self(RequestBuilder::new(stub))
17010 }
17011
17012 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17014 mut self,
17015 v: V,
17016 ) -> Self {
17017 self.0.request = v.into();
17018 self
17019 }
17020
17021 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17023 self.0.options = v.into();
17024 self
17025 }
17026
17027 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17029 (*self.0.stub)
17030 .list_operations(self.0.request, self.0.options)
17031 .await
17032 .map(crate::Response::into_body)
17033 }
17034
17035 pub fn by_page(
17037 self,
17038 ) -> impl google_cloud_gax::paginator::Paginator<
17039 google_cloud_longrunning::model::ListOperationsResponse,
17040 crate::Error,
17041 > {
17042 use std::clone::Clone;
17043 let token = self.0.request.page_token.clone();
17044 let execute = move |token: String| {
17045 let mut builder = self.clone();
17046 builder.0.request = builder.0.request.set_page_token(token);
17047 builder.send()
17048 };
17049 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17050 }
17051
17052 pub fn by_item(
17054 self,
17055 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17056 google_cloud_longrunning::model::ListOperationsResponse,
17057 crate::Error,
17058 > {
17059 use google_cloud_gax::paginator::Paginator;
17060 self.by_page().items()
17061 }
17062
17063 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17065 self.0.request.name = v.into();
17066 self
17067 }
17068
17069 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17071 self.0.request.filter = v.into();
17072 self
17073 }
17074
17075 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17077 self.0.request.page_size = v.into();
17078 self
17079 }
17080
17081 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17083 self.0.request.page_token = v.into();
17084 self
17085 }
17086
17087 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17089 self.0.request.return_partial_success = v.into();
17090 self
17091 }
17092 }
17093
17094 #[doc(hidden)]
17095 impl crate::RequestBuilder for ListOperations {
17096 fn request_options(&mut self) -> &mut crate::RequestOptions {
17097 &mut self.0.options
17098 }
17099 }
17100
17101 #[derive(Clone, Debug)]
17118 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17119
17120 impl GetOperation {
17121 pub(crate) fn new(
17122 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17123 ) -> Self {
17124 Self(RequestBuilder::new(stub))
17125 }
17126
17127 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17129 mut self,
17130 v: V,
17131 ) -> Self {
17132 self.0.request = v.into();
17133 self
17134 }
17135
17136 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17138 self.0.options = v.into();
17139 self
17140 }
17141
17142 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17144 (*self.0.stub)
17145 .get_operation(self.0.request, self.0.options)
17146 .await
17147 .map(crate::Response::into_body)
17148 }
17149
17150 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17152 self.0.request.name = v.into();
17153 self
17154 }
17155 }
17156
17157 #[doc(hidden)]
17158 impl crate::RequestBuilder for GetOperation {
17159 fn request_options(&mut self) -> &mut crate::RequestOptions {
17160 &mut self.0.options
17161 }
17162 }
17163
17164 #[derive(Clone, Debug)]
17181 pub struct CancelOperation(
17182 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17183 );
17184
17185 impl CancelOperation {
17186 pub(crate) fn new(
17187 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17188 ) -> Self {
17189 Self(RequestBuilder::new(stub))
17190 }
17191
17192 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17194 mut self,
17195 v: V,
17196 ) -> Self {
17197 self.0.request = v.into();
17198 self
17199 }
17200
17201 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17203 self.0.options = v.into();
17204 self
17205 }
17206
17207 pub async fn send(self) -> Result<()> {
17209 (*self.0.stub)
17210 .cancel_operation(self.0.request, self.0.options)
17211 .await
17212 .map(crate::Response::into_body)
17213 }
17214
17215 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17217 self.0.request.name = v.into();
17218 self
17219 }
17220 }
17221
17222 #[doc(hidden)]
17223 impl crate::RequestBuilder for CancelOperation {
17224 fn request_options(&mut self) -> &mut crate::RequestOptions {
17225 &mut self.0.options
17226 }
17227 }
17228}
17229
17230#[cfg(feature = "user-license-service")]
17232#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
17233pub mod user_license_service {
17234 use crate::Result;
17235
17236 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
17250
17251 pub(crate) mod client {
17252 use super::super::super::client::UserLicenseService;
17253 pub struct Factory;
17254 impl crate::ClientFactory for Factory {
17255 type Client = UserLicenseService;
17256 type Credentials = gaxi::options::Credentials;
17257 async fn build(
17258 self,
17259 config: gaxi::options::ClientConfig,
17260 ) -> crate::ClientBuilderResult<Self::Client> {
17261 Self::Client::new(config).await
17262 }
17263 }
17264 }
17265
17266 #[derive(Clone, Debug)]
17268 pub(crate) struct RequestBuilder<R: std::default::Default> {
17269 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17270 request: R,
17271 options: crate::RequestOptions,
17272 }
17273
17274 impl<R> RequestBuilder<R>
17275 where
17276 R: std::default::Default,
17277 {
17278 pub(crate) fn new(
17279 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17280 ) -> Self {
17281 Self {
17282 stub,
17283 request: R::default(),
17284 options: crate::RequestOptions::default(),
17285 }
17286 }
17287 }
17288
17289 #[derive(Clone, Debug)]
17310 pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
17311
17312 impl ListUserLicenses {
17313 pub(crate) fn new(
17314 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17315 ) -> Self {
17316 Self(RequestBuilder::new(stub))
17317 }
17318
17319 pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
17321 mut self,
17322 v: V,
17323 ) -> Self {
17324 self.0.request = v.into();
17325 self
17326 }
17327
17328 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17330 self.0.options = v.into();
17331 self
17332 }
17333
17334 pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
17336 (*self.0.stub)
17337 .list_user_licenses(self.0.request, self.0.options)
17338 .await
17339 .map(crate::Response::into_body)
17340 }
17341
17342 pub fn by_page(
17344 self,
17345 ) -> impl google_cloud_gax::paginator::Paginator<
17346 crate::model::ListUserLicensesResponse,
17347 crate::Error,
17348 > {
17349 use std::clone::Clone;
17350 let token = self.0.request.page_token.clone();
17351 let execute = move |token: String| {
17352 let mut builder = self.clone();
17353 builder.0.request = builder.0.request.set_page_token(token);
17354 builder.send()
17355 };
17356 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17357 }
17358
17359 pub fn by_item(
17361 self,
17362 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17363 crate::model::ListUserLicensesResponse,
17364 crate::Error,
17365 > {
17366 use google_cloud_gax::paginator::Paginator;
17367 self.by_page().items()
17368 }
17369
17370 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17374 self.0.request.parent = v.into();
17375 self
17376 }
17377
17378 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17380 self.0.request.page_size = v.into();
17381 self
17382 }
17383
17384 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17386 self.0.request.page_token = v.into();
17387 self
17388 }
17389
17390 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17392 self.0.request.filter = v.into();
17393 self
17394 }
17395 }
17396
17397 #[doc(hidden)]
17398 impl crate::RequestBuilder for ListUserLicenses {
17399 fn request_options(&mut self) -> &mut crate::RequestOptions {
17400 &mut self.0.options
17401 }
17402 }
17403
17404 #[derive(Clone, Debug)]
17422 pub struct BatchUpdateUserLicenses(
17423 RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
17424 );
17425
17426 impl BatchUpdateUserLicenses {
17427 pub(crate) fn new(
17428 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17429 ) -> Self {
17430 Self(RequestBuilder::new(stub))
17431 }
17432
17433 pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
17435 mut self,
17436 v: V,
17437 ) -> Self {
17438 self.0.request = v.into();
17439 self
17440 }
17441
17442 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17444 self.0.options = v.into();
17445 self
17446 }
17447
17448 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17455 (*self.0.stub)
17456 .batch_update_user_licenses(self.0.request, self.0.options)
17457 .await
17458 .map(crate::Response::into_body)
17459 }
17460
17461 pub fn poller(
17463 self,
17464 ) -> impl google_cloud_lro::Poller<
17465 crate::model::BatchUpdateUserLicensesResponse,
17466 crate::model::BatchUpdateUserLicensesMetadata,
17467 > {
17468 type Operation = google_cloud_lro::internal::Operation<
17469 crate::model::BatchUpdateUserLicensesResponse,
17470 crate::model::BatchUpdateUserLicensesMetadata,
17471 >;
17472 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
17473 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
17474 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
17475 if let Some(ref mut details) = poller_options.tracing {
17476 details.method_name = "google_cloud_discoveryengine_v1::client::UserLicenseService::batch_update_user_licenses::until_done";
17477 }
17478
17479 let stub = self.0.stub.clone();
17480 let mut options = self.0.options.clone();
17481 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
17482 let query = move |name| {
17483 let stub = stub.clone();
17484 let options = options.clone();
17485 async {
17486 let op = GetOperation::new(stub)
17487 .set_name(name)
17488 .with_options(options)
17489 .send()
17490 .await?;
17491 Ok(Operation::new(op))
17492 }
17493 };
17494
17495 let start = move || async {
17496 let op = self.send().await?;
17497 Ok(Operation::new(op))
17498 };
17499
17500 use google_cloud_lro::internal::PollerExt;
17501 {
17502 google_cloud_lro::internal::new_poller(
17503 polling_error_policy,
17504 polling_backoff_policy,
17505 start,
17506 query,
17507 )
17508 }
17509 .with_options(poller_options)
17510 }
17511
17512 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17516 self.0.request.parent = v.into();
17517 self
17518 }
17519
17520 pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
17522 self.0.request.delete_unassigned_user_licenses = v.into();
17523 self
17524 }
17525
17526 pub fn set_source<
17531 T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
17532 >(
17533 mut self,
17534 v: T,
17535 ) -> Self {
17536 self.0.request.source = v.into();
17537 self
17538 }
17539
17540 pub fn set_inline_source<
17546 T: std::convert::Into<
17547 std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
17548 >,
17549 >(
17550 mut self,
17551 v: T,
17552 ) -> Self {
17553 self.0.request = self.0.request.set_inline_source(v);
17554 self
17555 }
17556 }
17557
17558 #[doc(hidden)]
17559 impl crate::RequestBuilder for BatchUpdateUserLicenses {
17560 fn request_options(&mut self) -> &mut crate::RequestOptions {
17561 &mut self.0.options
17562 }
17563 }
17564
17565 #[derive(Clone, Debug)]
17586 pub struct ListOperations(
17587 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17588 );
17589
17590 impl ListOperations {
17591 pub(crate) fn new(
17592 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17593 ) -> Self {
17594 Self(RequestBuilder::new(stub))
17595 }
17596
17597 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17599 mut self,
17600 v: V,
17601 ) -> Self {
17602 self.0.request = v.into();
17603 self
17604 }
17605
17606 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17608 self.0.options = v.into();
17609 self
17610 }
17611
17612 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17614 (*self.0.stub)
17615 .list_operations(self.0.request, self.0.options)
17616 .await
17617 .map(crate::Response::into_body)
17618 }
17619
17620 pub fn by_page(
17622 self,
17623 ) -> impl google_cloud_gax::paginator::Paginator<
17624 google_cloud_longrunning::model::ListOperationsResponse,
17625 crate::Error,
17626 > {
17627 use std::clone::Clone;
17628 let token = self.0.request.page_token.clone();
17629 let execute = move |token: String| {
17630 let mut builder = self.clone();
17631 builder.0.request = builder.0.request.set_page_token(token);
17632 builder.send()
17633 };
17634 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17635 }
17636
17637 pub fn by_item(
17639 self,
17640 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17641 google_cloud_longrunning::model::ListOperationsResponse,
17642 crate::Error,
17643 > {
17644 use google_cloud_gax::paginator::Paginator;
17645 self.by_page().items()
17646 }
17647
17648 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17650 self.0.request.name = v.into();
17651 self
17652 }
17653
17654 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17656 self.0.request.filter = v.into();
17657 self
17658 }
17659
17660 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17662 self.0.request.page_size = v.into();
17663 self
17664 }
17665
17666 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17668 self.0.request.page_token = v.into();
17669 self
17670 }
17671
17672 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17674 self.0.request.return_partial_success = v.into();
17675 self
17676 }
17677 }
17678
17679 #[doc(hidden)]
17680 impl crate::RequestBuilder for ListOperations {
17681 fn request_options(&mut self) -> &mut crate::RequestOptions {
17682 &mut self.0.options
17683 }
17684 }
17685
17686 #[derive(Clone, Debug)]
17703 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17704
17705 impl GetOperation {
17706 pub(crate) fn new(
17707 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17708 ) -> Self {
17709 Self(RequestBuilder::new(stub))
17710 }
17711
17712 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17714 mut self,
17715 v: V,
17716 ) -> Self {
17717 self.0.request = v.into();
17718 self
17719 }
17720
17721 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17723 self.0.options = v.into();
17724 self
17725 }
17726
17727 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17729 (*self.0.stub)
17730 .get_operation(self.0.request, self.0.options)
17731 .await
17732 .map(crate::Response::into_body)
17733 }
17734
17735 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17737 self.0.request.name = v.into();
17738 self
17739 }
17740 }
17741
17742 #[doc(hidden)]
17743 impl crate::RequestBuilder for GetOperation {
17744 fn request_options(&mut self) -> &mut crate::RequestOptions {
17745 &mut self.0.options
17746 }
17747 }
17748
17749 #[derive(Clone, Debug)]
17766 pub struct CancelOperation(
17767 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17768 );
17769
17770 impl CancelOperation {
17771 pub(crate) fn new(
17772 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17773 ) -> Self {
17774 Self(RequestBuilder::new(stub))
17775 }
17776
17777 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17779 mut self,
17780 v: V,
17781 ) -> Self {
17782 self.0.request = v.into();
17783 self
17784 }
17785
17786 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17788 self.0.options = v.into();
17789 self
17790 }
17791
17792 pub async fn send(self) -> Result<()> {
17794 (*self.0.stub)
17795 .cancel_operation(self.0.request, self.0.options)
17796 .await
17797 .map(crate::Response::into_body)
17798 }
17799
17800 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17802 self.0.request.name = v.into();
17803 self
17804 }
17805 }
17806
17807 #[doc(hidden)]
17808 impl crate::RequestBuilder for CancelOperation {
17809 fn request_options(&mut self) -> &mut crate::RequestOptions {
17810 &mut self.0.options
17811 }
17812 }
17813}