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_score_spec<T>(mut self, v: T) -> Self
11888 where
11889 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11890 {
11891 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11892 self
11893 }
11894
11895 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11897 where
11898 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11899 {
11900 self.0.request.relevance_score_spec = v.map(|x| x.into());
11901 self
11902 }
11903 }
11904
11905 #[doc(hidden)]
11906 impl crate::RequestBuilder for Search {
11907 fn request_options(&mut self) -> &mut crate::RequestOptions {
11908 &mut self.0.options
11909 }
11910 }
11911
11912 #[derive(Clone, Debug)]
11933 pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11934
11935 impl SearchLite {
11936 pub(crate) fn new(
11937 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11938 ) -> Self {
11939 Self(RequestBuilder::new(stub))
11940 }
11941
11942 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11944 self.0.request = v.into();
11945 self
11946 }
11947
11948 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11950 self.0.options = v.into();
11951 self
11952 }
11953
11954 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11956 (*self.0.stub)
11957 .search_lite(self.0.request, self.0.options)
11958 .await
11959 .map(crate::Response::into_body)
11960 }
11961
11962 pub fn by_page(
11964 self,
11965 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11966 {
11967 use std::clone::Clone;
11968 let token = self.0.request.page_token.clone();
11969 let execute = move |token: String| {
11970 let mut builder = self.clone();
11971 builder.0.request = builder.0.request.set_page_token(token);
11972 builder.send()
11973 };
11974 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11975 }
11976
11977 pub fn by_item(
11979 self,
11980 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11981 {
11982 use google_cloud_gax::paginator::Paginator;
11983 self.by_page().items()
11984 }
11985
11986 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11990 self.0.request.serving_config = v.into();
11991 self
11992 }
11993
11994 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11996 self.0.request.branch = v.into();
11997 self
11998 }
11999
12000 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
12002 self.0.request.query = v.into();
12003 self
12004 }
12005
12006 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
12008 where
12009 T: std::iter::IntoIterator<Item = V>,
12010 V: std::convert::Into<std::string::String>,
12011 {
12012 use std::iter::Iterator;
12013 self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
12014 self
12015 }
12016
12017 pub fn set_image_query<T>(mut self, v: T) -> Self
12019 where
12020 T: std::convert::Into<crate::model::search_request::ImageQuery>,
12021 {
12022 self.0.request.image_query = std::option::Option::Some(v.into());
12023 self
12024 }
12025
12026 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
12028 where
12029 T: std::convert::Into<crate::model::search_request::ImageQuery>,
12030 {
12031 self.0.request.image_query = v.map(|x| x.into());
12032 self
12033 }
12034
12035 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12037 self.0.request.page_size = v.into();
12038 self
12039 }
12040
12041 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12043 self.0.request.page_token = v.into();
12044 self
12045 }
12046
12047 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
12049 self.0.request.offset = v.into();
12050 self
12051 }
12052
12053 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12055 self.0.request.one_box_page_size = v.into();
12056 self
12057 }
12058
12059 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
12061 where
12062 T: std::iter::IntoIterator<Item = V>,
12063 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
12064 {
12065 use std::iter::Iterator;
12066 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
12067 self
12068 }
12069
12070 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12072 self.0.request.filter = v.into();
12073 self
12074 }
12075
12076 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12078 self.0.request.canonical_filter = v.into();
12079 self
12080 }
12081
12082 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
12084 self.0.request.order_by = v.into();
12085 self
12086 }
12087
12088 pub fn set_user_info<T>(mut self, v: T) -> Self
12090 where
12091 T: std::convert::Into<crate::model::UserInfo>,
12092 {
12093 self.0.request.user_info = std::option::Option::Some(v.into());
12094 self
12095 }
12096
12097 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
12099 where
12100 T: std::convert::Into<crate::model::UserInfo>,
12101 {
12102 self.0.request.user_info = v.map(|x| x.into());
12103 self
12104 }
12105
12106 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
12108 self.0.request.language_code = v.into();
12109 self
12110 }
12111
12112 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
12114 where
12115 T: std::iter::IntoIterator<Item = V>,
12116 V: std::convert::Into<crate::model::search_request::FacetSpec>,
12117 {
12118 use std::iter::Iterator;
12119 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
12120 self
12121 }
12122
12123 pub fn set_boost_spec<T>(mut self, v: T) -> Self
12125 where
12126 T: std::convert::Into<crate::model::search_request::BoostSpec>,
12127 {
12128 self.0.request.boost_spec = std::option::Option::Some(v.into());
12129 self
12130 }
12131
12132 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
12134 where
12135 T: std::convert::Into<crate::model::search_request::BoostSpec>,
12136 {
12137 self.0.request.boost_spec = v.map(|x| x.into());
12138 self
12139 }
12140
12141 pub fn set_params<T, K, V>(mut self, v: T) -> Self
12143 where
12144 T: std::iter::IntoIterator<Item = (K, V)>,
12145 K: std::convert::Into<std::string::String>,
12146 V: std::convert::Into<wkt::Value>,
12147 {
12148 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12149 self
12150 }
12151
12152 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
12154 where
12155 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12156 {
12157 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
12158 self
12159 }
12160
12161 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
12163 where
12164 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12165 {
12166 self.0.request.query_expansion_spec = v.map(|x| x.into());
12167 self
12168 }
12169
12170 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
12172 where
12173 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12174 {
12175 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
12176 self
12177 }
12178
12179 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
12181 where
12182 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12183 {
12184 self.0.request.spell_correction_spec = v.map(|x| x.into());
12185 self
12186 }
12187
12188 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12190 self.0.request.user_pseudo_id = v.into();
12191 self
12192 }
12193
12194 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
12196 where
12197 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12198 {
12199 self.0.request.content_search_spec = std::option::Option::Some(v.into());
12200 self
12201 }
12202
12203 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
12205 where
12206 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12207 {
12208 self.0.request.content_search_spec = v.map(|x| x.into());
12209 self
12210 }
12211
12212 pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12214 self.0.request.ranking_expression = v.into();
12215 self
12216 }
12217
12218 pub fn set_ranking_expression_backend<
12220 T: Into<crate::model::search_request::RankingExpressionBackend>,
12221 >(
12222 mut self,
12223 v: T,
12224 ) -> Self {
12225 self.0.request.ranking_expression_backend = v.into();
12226 self
12227 }
12228
12229 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
12231 self.0.request.safe_search = v.into();
12232 self
12233 }
12234
12235 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12237 where
12238 T: std::iter::IntoIterator<Item = (K, V)>,
12239 K: std::convert::Into<std::string::String>,
12240 V: std::convert::Into<std::string::String>,
12241 {
12242 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12243 self
12244 }
12245
12246 pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
12248 where
12249 T: std::convert::Into<
12250 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12251 >,
12252 {
12253 self.0.request.natural_language_query_understanding_spec =
12254 std::option::Option::Some(v.into());
12255 self
12256 }
12257
12258 pub fn set_or_clear_natural_language_query_understanding_spec<T>(
12260 mut self,
12261 v: std::option::Option<T>,
12262 ) -> Self
12263 where
12264 T: std::convert::Into<
12265 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12266 >,
12267 {
12268 self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
12269 self
12270 }
12271
12272 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
12274 where
12275 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12276 {
12277 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
12278 self
12279 }
12280
12281 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
12283 where
12284 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12285 {
12286 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
12287 self
12288 }
12289
12290 pub fn set_display_spec<T>(mut self, v: T) -> Self
12292 where
12293 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12294 {
12295 self.0.request.display_spec = std::option::Option::Some(v.into());
12296 self
12297 }
12298
12299 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
12301 where
12302 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12303 {
12304 self.0.request.display_spec = v.map(|x| x.into());
12305 self
12306 }
12307
12308 pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
12310 where
12311 T: std::iter::IntoIterator<Item = V>,
12312 V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
12313 {
12314 use std::iter::Iterator;
12315 self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
12316 self
12317 }
12318
12319 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
12321 self.0.request.session = v.into();
12322 self
12323 }
12324
12325 pub fn set_session_spec<T>(mut self, v: T) -> Self
12327 where
12328 T: std::convert::Into<crate::model::search_request::SessionSpec>,
12329 {
12330 self.0.request.session_spec = std::option::Option::Some(v.into());
12331 self
12332 }
12333
12334 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
12336 where
12337 T: std::convert::Into<crate::model::search_request::SessionSpec>,
12338 {
12339 self.0.request.session_spec = v.map(|x| x.into());
12340 self
12341 }
12342
12343 pub fn set_relevance_threshold<
12345 T: Into<crate::model::search_request::RelevanceThreshold>,
12346 >(
12347 mut self,
12348 v: T,
12349 ) -> Self {
12350 self.0.request.relevance_threshold = v.into();
12351 self
12352 }
12353
12354 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
12356 where
12357 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12358 {
12359 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
12360 self
12361 }
12362
12363 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12365 where
12366 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12367 {
12368 self.0.request.relevance_score_spec = v.map(|x| x.into());
12369 self
12370 }
12371 }
12372
12373 #[doc(hidden)]
12374 impl crate::RequestBuilder for SearchLite {
12375 fn request_options(&mut self) -> &mut crate::RequestOptions {
12376 &mut self.0.options
12377 }
12378 }
12379
12380 #[derive(Clone, Debug)]
12401 pub struct ListOperations(
12402 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12403 );
12404
12405 impl ListOperations {
12406 pub(crate) fn new(
12407 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12408 ) -> Self {
12409 Self(RequestBuilder::new(stub))
12410 }
12411
12412 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12414 mut self,
12415 v: V,
12416 ) -> Self {
12417 self.0.request = v.into();
12418 self
12419 }
12420
12421 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12423 self.0.options = v.into();
12424 self
12425 }
12426
12427 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12429 (*self.0.stub)
12430 .list_operations(self.0.request, self.0.options)
12431 .await
12432 .map(crate::Response::into_body)
12433 }
12434
12435 pub fn by_page(
12437 self,
12438 ) -> impl google_cloud_gax::paginator::Paginator<
12439 google_cloud_longrunning::model::ListOperationsResponse,
12440 crate::Error,
12441 > {
12442 use std::clone::Clone;
12443 let token = self.0.request.page_token.clone();
12444 let execute = move |token: String| {
12445 let mut builder = self.clone();
12446 builder.0.request = builder.0.request.set_page_token(token);
12447 builder.send()
12448 };
12449 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12450 }
12451
12452 pub fn by_item(
12454 self,
12455 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12456 google_cloud_longrunning::model::ListOperationsResponse,
12457 crate::Error,
12458 > {
12459 use google_cloud_gax::paginator::Paginator;
12460 self.by_page().items()
12461 }
12462
12463 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12465 self.0.request.name = v.into();
12466 self
12467 }
12468
12469 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12471 self.0.request.filter = v.into();
12472 self
12473 }
12474
12475 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12477 self.0.request.page_size = v.into();
12478 self
12479 }
12480
12481 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12483 self.0.request.page_token = v.into();
12484 self
12485 }
12486
12487 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12489 self.0.request.return_partial_success = v.into();
12490 self
12491 }
12492 }
12493
12494 #[doc(hidden)]
12495 impl crate::RequestBuilder for ListOperations {
12496 fn request_options(&mut self) -> &mut crate::RequestOptions {
12497 &mut self.0.options
12498 }
12499 }
12500
12501 #[derive(Clone, Debug)]
12518 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12519
12520 impl GetOperation {
12521 pub(crate) fn new(
12522 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12523 ) -> Self {
12524 Self(RequestBuilder::new(stub))
12525 }
12526
12527 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12529 mut self,
12530 v: V,
12531 ) -> Self {
12532 self.0.request = v.into();
12533 self
12534 }
12535
12536 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12538 self.0.options = v.into();
12539 self
12540 }
12541
12542 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12544 (*self.0.stub)
12545 .get_operation(self.0.request, self.0.options)
12546 .await
12547 .map(crate::Response::into_body)
12548 }
12549
12550 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12552 self.0.request.name = v.into();
12553 self
12554 }
12555 }
12556
12557 #[doc(hidden)]
12558 impl crate::RequestBuilder for GetOperation {
12559 fn request_options(&mut self) -> &mut crate::RequestOptions {
12560 &mut self.0.options
12561 }
12562 }
12563
12564 #[derive(Clone, Debug)]
12581 pub struct CancelOperation(
12582 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12583 );
12584
12585 impl CancelOperation {
12586 pub(crate) fn new(
12587 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12588 ) -> Self {
12589 Self(RequestBuilder::new(stub))
12590 }
12591
12592 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12594 mut self,
12595 v: V,
12596 ) -> Self {
12597 self.0.request = v.into();
12598 self
12599 }
12600
12601 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12603 self.0.options = v.into();
12604 self
12605 }
12606
12607 pub async fn send(self) -> Result<()> {
12609 (*self.0.stub)
12610 .cancel_operation(self.0.request, self.0.options)
12611 .await
12612 .map(crate::Response::into_body)
12613 }
12614
12615 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12617 self.0.request.name = v.into();
12618 self
12619 }
12620 }
12621
12622 #[doc(hidden)]
12623 impl crate::RequestBuilder for CancelOperation {
12624 fn request_options(&mut self) -> &mut crate::RequestOptions {
12625 &mut self.0.options
12626 }
12627 }
12628}
12629
12630#[cfg(feature = "search-tuning-service")]
12632#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12633pub mod search_tuning_service {
12634 use crate::Result;
12635
12636 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12650
12651 pub(crate) mod client {
12652 use super::super::super::client::SearchTuningService;
12653 pub struct Factory;
12654 impl crate::ClientFactory for Factory {
12655 type Client = SearchTuningService;
12656 type Credentials = gaxi::options::Credentials;
12657 async fn build(
12658 self,
12659 config: gaxi::options::ClientConfig,
12660 ) -> crate::ClientBuilderResult<Self::Client> {
12661 Self::Client::new(config).await
12662 }
12663 }
12664 }
12665
12666 #[derive(Clone, Debug)]
12668 pub(crate) struct RequestBuilder<R: std::default::Default> {
12669 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12670 request: R,
12671 options: crate::RequestOptions,
12672 }
12673
12674 impl<R> RequestBuilder<R>
12675 where
12676 R: std::default::Default,
12677 {
12678 pub(crate) fn new(
12679 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12680 ) -> Self {
12681 Self {
12682 stub,
12683 request: R::default(),
12684 options: crate::RequestOptions::default(),
12685 }
12686 }
12687 }
12688
12689 #[derive(Clone, Debug)]
12707 pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12708
12709 impl TrainCustomModel {
12710 pub(crate) fn new(
12711 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12712 ) -> Self {
12713 Self(RequestBuilder::new(stub))
12714 }
12715
12716 pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12718 mut self,
12719 v: V,
12720 ) -> Self {
12721 self.0.request = v.into();
12722 self
12723 }
12724
12725 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12727 self.0.options = v.into();
12728 self
12729 }
12730
12731 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12738 (*self.0.stub)
12739 .train_custom_model(self.0.request, self.0.options)
12740 .await
12741 .map(crate::Response::into_body)
12742 }
12743
12744 pub fn poller(
12746 self,
12747 ) -> impl google_cloud_lro::Poller<
12748 crate::model::TrainCustomModelResponse,
12749 crate::model::TrainCustomModelMetadata,
12750 > {
12751 type Operation = google_cloud_lro::internal::Operation<
12752 crate::model::TrainCustomModelResponse,
12753 crate::model::TrainCustomModelMetadata,
12754 >;
12755 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12756 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12757 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
12758 if let Some(ref mut details) = poller_options.tracing {
12759 details.method_name = "google_cloud_discoveryengine_v1::client::SearchTuningService::train_custom_model::until_done";
12760 }
12761
12762 let stub = self.0.stub.clone();
12763 let mut options = self.0.options.clone();
12764 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
12765 let query = move |name| {
12766 let stub = stub.clone();
12767 let options = options.clone();
12768 async {
12769 let op = GetOperation::new(stub)
12770 .set_name(name)
12771 .with_options(options)
12772 .send()
12773 .await?;
12774 Ok(Operation::new(op))
12775 }
12776 };
12777
12778 let start = move || async {
12779 let op = self.send().await?;
12780 Ok(Operation::new(op))
12781 };
12782
12783 use google_cloud_lro::internal::PollerExt;
12784 {
12785 google_cloud_lro::internal::new_poller(
12786 polling_error_policy,
12787 polling_backoff_policy,
12788 start,
12789 query,
12790 )
12791 }
12792 .with_options(poller_options)
12793 }
12794
12795 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12799 self.0.request.data_store = v.into();
12800 self
12801 }
12802
12803 pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12805 self.0.request.model_type = v.into();
12806 self
12807 }
12808
12809 pub fn set_error_config<T>(mut self, v: T) -> Self
12811 where
12812 T: std::convert::Into<crate::model::ImportErrorConfig>,
12813 {
12814 self.0.request.error_config = std::option::Option::Some(v.into());
12815 self
12816 }
12817
12818 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12820 where
12821 T: std::convert::Into<crate::model::ImportErrorConfig>,
12822 {
12823 self.0.request.error_config = v.map(|x| x.into());
12824 self
12825 }
12826
12827 pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12829 self.0.request.model_id = v.into();
12830 self
12831 }
12832
12833 pub fn set_training_input<
12838 T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12839 >(
12840 mut self,
12841 v: T,
12842 ) -> Self {
12843 self.0.request.training_input = v.into();
12844 self
12845 }
12846
12847 pub fn set_gcs_training_input<
12853 T: std::convert::Into<
12854 std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12855 >,
12856 >(
12857 mut self,
12858 v: T,
12859 ) -> Self {
12860 self.0.request = self.0.request.set_gcs_training_input(v);
12861 self
12862 }
12863 }
12864
12865 #[doc(hidden)]
12866 impl crate::RequestBuilder for TrainCustomModel {
12867 fn request_options(&mut self) -> &mut crate::RequestOptions {
12868 &mut self.0.options
12869 }
12870 }
12871
12872 #[derive(Clone, Debug)]
12889 pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12890
12891 impl ListCustomModels {
12892 pub(crate) fn new(
12893 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12894 ) -> Self {
12895 Self(RequestBuilder::new(stub))
12896 }
12897
12898 pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12900 mut self,
12901 v: V,
12902 ) -> Self {
12903 self.0.request = v.into();
12904 self
12905 }
12906
12907 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12909 self.0.options = v.into();
12910 self
12911 }
12912
12913 pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12915 (*self.0.stub)
12916 .list_custom_models(self.0.request, self.0.options)
12917 .await
12918 .map(crate::Response::into_body)
12919 }
12920
12921 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12925 self.0.request.data_store = v.into();
12926 self
12927 }
12928 }
12929
12930 #[doc(hidden)]
12931 impl crate::RequestBuilder for ListCustomModels {
12932 fn request_options(&mut self) -> &mut crate::RequestOptions {
12933 &mut self.0.options
12934 }
12935 }
12936
12937 #[derive(Clone, Debug)]
12958 pub struct ListOperations(
12959 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12960 );
12961
12962 impl ListOperations {
12963 pub(crate) fn new(
12964 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12965 ) -> Self {
12966 Self(RequestBuilder::new(stub))
12967 }
12968
12969 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12971 mut self,
12972 v: V,
12973 ) -> Self {
12974 self.0.request = v.into();
12975 self
12976 }
12977
12978 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12980 self.0.options = v.into();
12981 self
12982 }
12983
12984 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12986 (*self.0.stub)
12987 .list_operations(self.0.request, self.0.options)
12988 .await
12989 .map(crate::Response::into_body)
12990 }
12991
12992 pub fn by_page(
12994 self,
12995 ) -> impl google_cloud_gax::paginator::Paginator<
12996 google_cloud_longrunning::model::ListOperationsResponse,
12997 crate::Error,
12998 > {
12999 use std::clone::Clone;
13000 let token = self.0.request.page_token.clone();
13001 let execute = move |token: String| {
13002 let mut builder = self.clone();
13003 builder.0.request = builder.0.request.set_page_token(token);
13004 builder.send()
13005 };
13006 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13007 }
13008
13009 pub fn by_item(
13011 self,
13012 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13013 google_cloud_longrunning::model::ListOperationsResponse,
13014 crate::Error,
13015 > {
13016 use google_cloud_gax::paginator::Paginator;
13017 self.by_page().items()
13018 }
13019
13020 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13022 self.0.request.name = v.into();
13023 self
13024 }
13025
13026 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13028 self.0.request.filter = v.into();
13029 self
13030 }
13031
13032 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13034 self.0.request.page_size = v.into();
13035 self
13036 }
13037
13038 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13040 self.0.request.page_token = v.into();
13041 self
13042 }
13043
13044 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13046 self.0.request.return_partial_success = v.into();
13047 self
13048 }
13049 }
13050
13051 #[doc(hidden)]
13052 impl crate::RequestBuilder for ListOperations {
13053 fn request_options(&mut self) -> &mut crate::RequestOptions {
13054 &mut self.0.options
13055 }
13056 }
13057
13058 #[derive(Clone, Debug)]
13075 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13076
13077 impl GetOperation {
13078 pub(crate) fn new(
13079 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13080 ) -> Self {
13081 Self(RequestBuilder::new(stub))
13082 }
13083
13084 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13086 mut self,
13087 v: V,
13088 ) -> Self {
13089 self.0.request = v.into();
13090 self
13091 }
13092
13093 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13095 self.0.options = v.into();
13096 self
13097 }
13098
13099 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13101 (*self.0.stub)
13102 .get_operation(self.0.request, self.0.options)
13103 .await
13104 .map(crate::Response::into_body)
13105 }
13106
13107 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13109 self.0.request.name = v.into();
13110 self
13111 }
13112 }
13113
13114 #[doc(hidden)]
13115 impl crate::RequestBuilder for GetOperation {
13116 fn request_options(&mut self) -> &mut crate::RequestOptions {
13117 &mut self.0.options
13118 }
13119 }
13120
13121 #[derive(Clone, Debug)]
13138 pub struct CancelOperation(
13139 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13140 );
13141
13142 impl CancelOperation {
13143 pub(crate) fn new(
13144 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13145 ) -> Self {
13146 Self(RequestBuilder::new(stub))
13147 }
13148
13149 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13151 mut self,
13152 v: V,
13153 ) -> Self {
13154 self.0.request = v.into();
13155 self
13156 }
13157
13158 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13160 self.0.options = v.into();
13161 self
13162 }
13163
13164 pub async fn send(self) -> Result<()> {
13166 (*self.0.stub)
13167 .cancel_operation(self.0.request, self.0.options)
13168 .await
13169 .map(crate::Response::into_body)
13170 }
13171
13172 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13174 self.0.request.name = v.into();
13175 self
13176 }
13177 }
13178
13179 #[doc(hidden)]
13180 impl crate::RequestBuilder for CancelOperation {
13181 fn request_options(&mut self) -> &mut crate::RequestOptions {
13182 &mut self.0.options
13183 }
13184 }
13185}
13186
13187#[cfg(feature = "serving-config-service")]
13189#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
13190pub mod serving_config_service {
13191 use crate::Result;
13192
13193 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13207
13208 pub(crate) mod client {
13209 use super::super::super::client::ServingConfigService;
13210 pub struct Factory;
13211 impl crate::ClientFactory for Factory {
13212 type Client = ServingConfigService;
13213 type Credentials = gaxi::options::Credentials;
13214 async fn build(
13215 self,
13216 config: gaxi::options::ClientConfig,
13217 ) -> crate::ClientBuilderResult<Self::Client> {
13218 Self::Client::new(config).await
13219 }
13220 }
13221 }
13222
13223 #[derive(Clone, Debug)]
13225 pub(crate) struct RequestBuilder<R: std::default::Default> {
13226 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13227 request: R,
13228 options: crate::RequestOptions,
13229 }
13230
13231 impl<R> RequestBuilder<R>
13232 where
13233 R: std::default::Default,
13234 {
13235 pub(crate) fn new(
13236 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13237 ) -> Self {
13238 Self {
13239 stub,
13240 request: R::default(),
13241 options: crate::RequestOptions::default(),
13242 }
13243 }
13244 }
13245
13246 #[derive(Clone, Debug)]
13263 pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
13264
13265 impl UpdateServingConfig {
13266 pub(crate) fn new(
13267 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13268 ) -> Self {
13269 Self(RequestBuilder::new(stub))
13270 }
13271
13272 pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
13274 mut self,
13275 v: V,
13276 ) -> Self {
13277 self.0.request = v.into();
13278 self
13279 }
13280
13281 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13283 self.0.options = v.into();
13284 self
13285 }
13286
13287 pub async fn send(self) -> Result<crate::model::ServingConfig> {
13289 (*self.0.stub)
13290 .update_serving_config(self.0.request, self.0.options)
13291 .await
13292 .map(crate::Response::into_body)
13293 }
13294
13295 pub fn set_serving_config<T>(mut self, v: T) -> Self
13299 where
13300 T: std::convert::Into<crate::model::ServingConfig>,
13301 {
13302 self.0.request.serving_config = std::option::Option::Some(v.into());
13303 self
13304 }
13305
13306 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
13310 where
13311 T: std::convert::Into<crate::model::ServingConfig>,
13312 {
13313 self.0.request.serving_config = v.map(|x| x.into());
13314 self
13315 }
13316
13317 pub fn set_update_mask<T>(mut self, v: T) -> Self
13319 where
13320 T: std::convert::Into<wkt::FieldMask>,
13321 {
13322 self.0.request.update_mask = std::option::Option::Some(v.into());
13323 self
13324 }
13325
13326 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13328 where
13329 T: std::convert::Into<wkt::FieldMask>,
13330 {
13331 self.0.request.update_mask = v.map(|x| x.into());
13332 self
13333 }
13334 }
13335
13336 #[doc(hidden)]
13337 impl crate::RequestBuilder for UpdateServingConfig {
13338 fn request_options(&mut self) -> &mut crate::RequestOptions {
13339 &mut self.0.options
13340 }
13341 }
13342
13343 #[derive(Clone, Debug)]
13364 pub struct ListOperations(
13365 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13366 );
13367
13368 impl ListOperations {
13369 pub(crate) fn new(
13370 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13371 ) -> Self {
13372 Self(RequestBuilder::new(stub))
13373 }
13374
13375 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13377 mut self,
13378 v: V,
13379 ) -> Self {
13380 self.0.request = v.into();
13381 self
13382 }
13383
13384 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13386 self.0.options = v.into();
13387 self
13388 }
13389
13390 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13392 (*self.0.stub)
13393 .list_operations(self.0.request, self.0.options)
13394 .await
13395 .map(crate::Response::into_body)
13396 }
13397
13398 pub fn by_page(
13400 self,
13401 ) -> impl google_cloud_gax::paginator::Paginator<
13402 google_cloud_longrunning::model::ListOperationsResponse,
13403 crate::Error,
13404 > {
13405 use std::clone::Clone;
13406 let token = self.0.request.page_token.clone();
13407 let execute = move |token: String| {
13408 let mut builder = self.clone();
13409 builder.0.request = builder.0.request.set_page_token(token);
13410 builder.send()
13411 };
13412 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13413 }
13414
13415 pub fn by_item(
13417 self,
13418 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13419 google_cloud_longrunning::model::ListOperationsResponse,
13420 crate::Error,
13421 > {
13422 use google_cloud_gax::paginator::Paginator;
13423 self.by_page().items()
13424 }
13425
13426 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13428 self.0.request.name = v.into();
13429 self
13430 }
13431
13432 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13434 self.0.request.filter = v.into();
13435 self
13436 }
13437
13438 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13440 self.0.request.page_size = v.into();
13441 self
13442 }
13443
13444 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13446 self.0.request.page_token = v.into();
13447 self
13448 }
13449
13450 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13452 self.0.request.return_partial_success = v.into();
13453 self
13454 }
13455 }
13456
13457 #[doc(hidden)]
13458 impl crate::RequestBuilder for ListOperations {
13459 fn request_options(&mut self) -> &mut crate::RequestOptions {
13460 &mut self.0.options
13461 }
13462 }
13463
13464 #[derive(Clone, Debug)]
13481 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13482
13483 impl GetOperation {
13484 pub(crate) fn new(
13485 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13486 ) -> Self {
13487 Self(RequestBuilder::new(stub))
13488 }
13489
13490 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13492 mut self,
13493 v: V,
13494 ) -> Self {
13495 self.0.request = v.into();
13496 self
13497 }
13498
13499 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13501 self.0.options = v.into();
13502 self
13503 }
13504
13505 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13507 (*self.0.stub)
13508 .get_operation(self.0.request, self.0.options)
13509 .await
13510 .map(crate::Response::into_body)
13511 }
13512
13513 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13515 self.0.request.name = v.into();
13516 self
13517 }
13518 }
13519
13520 #[doc(hidden)]
13521 impl crate::RequestBuilder for GetOperation {
13522 fn request_options(&mut self) -> &mut crate::RequestOptions {
13523 &mut self.0.options
13524 }
13525 }
13526
13527 #[derive(Clone, Debug)]
13544 pub struct CancelOperation(
13545 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13546 );
13547
13548 impl CancelOperation {
13549 pub(crate) fn new(
13550 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13551 ) -> Self {
13552 Self(RequestBuilder::new(stub))
13553 }
13554
13555 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13557 mut self,
13558 v: V,
13559 ) -> Self {
13560 self.0.request = v.into();
13561 self
13562 }
13563
13564 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13566 self.0.options = v.into();
13567 self
13568 }
13569
13570 pub async fn send(self) -> Result<()> {
13572 (*self.0.stub)
13573 .cancel_operation(self.0.request, self.0.options)
13574 .await
13575 .map(crate::Response::into_body)
13576 }
13577
13578 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13580 self.0.request.name = v.into();
13581 self
13582 }
13583 }
13584
13585 #[doc(hidden)]
13586 impl crate::RequestBuilder for CancelOperation {
13587 fn request_options(&mut self) -> &mut crate::RequestOptions {
13588 &mut self.0.options
13589 }
13590 }
13591}
13592
13593#[cfg(feature = "session-service")]
13595#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13596pub mod session_service {
13597 use crate::Result;
13598
13599 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13613
13614 pub(crate) mod client {
13615 use super::super::super::client::SessionService;
13616 pub struct Factory;
13617 impl crate::ClientFactory for Factory {
13618 type Client = SessionService;
13619 type Credentials = gaxi::options::Credentials;
13620 async fn build(
13621 self,
13622 config: gaxi::options::ClientConfig,
13623 ) -> crate::ClientBuilderResult<Self::Client> {
13624 Self::Client::new(config).await
13625 }
13626 }
13627 }
13628
13629 #[derive(Clone, Debug)]
13631 pub(crate) struct RequestBuilder<R: std::default::Default> {
13632 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13633 request: R,
13634 options: crate::RequestOptions,
13635 }
13636
13637 impl<R> RequestBuilder<R>
13638 where
13639 R: std::default::Default,
13640 {
13641 pub(crate) fn new(
13642 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13643 ) -> Self {
13644 Self {
13645 stub,
13646 request: R::default(),
13647 options: crate::RequestOptions::default(),
13648 }
13649 }
13650 }
13651
13652 #[derive(Clone, Debug)]
13669 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13670
13671 impl CreateSession {
13672 pub(crate) fn new(
13673 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13674 ) -> Self {
13675 Self(RequestBuilder::new(stub))
13676 }
13677
13678 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13680 self.0.request = v.into();
13681 self
13682 }
13683
13684 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13686 self.0.options = v.into();
13687 self
13688 }
13689
13690 pub async fn send(self) -> Result<crate::model::Session> {
13692 (*self.0.stub)
13693 .create_session(self.0.request, self.0.options)
13694 .await
13695 .map(crate::Response::into_body)
13696 }
13697
13698 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13702 self.0.request.parent = v.into();
13703 self
13704 }
13705
13706 pub fn set_session<T>(mut self, v: T) -> Self
13710 where
13711 T: std::convert::Into<crate::model::Session>,
13712 {
13713 self.0.request.session = std::option::Option::Some(v.into());
13714 self
13715 }
13716
13717 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13721 where
13722 T: std::convert::Into<crate::model::Session>,
13723 {
13724 self.0.request.session = v.map(|x| x.into());
13725 self
13726 }
13727 }
13728
13729 #[doc(hidden)]
13730 impl crate::RequestBuilder for CreateSession {
13731 fn request_options(&mut self) -> &mut crate::RequestOptions {
13732 &mut self.0.options
13733 }
13734 }
13735
13736 #[derive(Clone, Debug)]
13753 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13754
13755 impl DeleteSession {
13756 pub(crate) fn new(
13757 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13758 ) -> Self {
13759 Self(RequestBuilder::new(stub))
13760 }
13761
13762 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13764 self.0.request = v.into();
13765 self
13766 }
13767
13768 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13770 self.0.options = v.into();
13771 self
13772 }
13773
13774 pub async fn send(self) -> Result<()> {
13776 (*self.0.stub)
13777 .delete_session(self.0.request, self.0.options)
13778 .await
13779 .map(crate::Response::into_body)
13780 }
13781
13782 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13786 self.0.request.name = v.into();
13787 self
13788 }
13789 }
13790
13791 #[doc(hidden)]
13792 impl crate::RequestBuilder for DeleteSession {
13793 fn request_options(&mut self) -> &mut crate::RequestOptions {
13794 &mut self.0.options
13795 }
13796 }
13797
13798 #[derive(Clone, Debug)]
13815 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13816
13817 impl UpdateSession {
13818 pub(crate) fn new(
13819 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13820 ) -> Self {
13821 Self(RequestBuilder::new(stub))
13822 }
13823
13824 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13826 self.0.request = v.into();
13827 self
13828 }
13829
13830 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13832 self.0.options = v.into();
13833 self
13834 }
13835
13836 pub async fn send(self) -> Result<crate::model::Session> {
13838 (*self.0.stub)
13839 .update_session(self.0.request, self.0.options)
13840 .await
13841 .map(crate::Response::into_body)
13842 }
13843
13844 pub fn set_session<T>(mut self, v: T) -> Self
13848 where
13849 T: std::convert::Into<crate::model::Session>,
13850 {
13851 self.0.request.session = std::option::Option::Some(v.into());
13852 self
13853 }
13854
13855 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13859 where
13860 T: std::convert::Into<crate::model::Session>,
13861 {
13862 self.0.request.session = v.map(|x| x.into());
13863 self
13864 }
13865
13866 pub fn set_update_mask<T>(mut self, v: T) -> Self
13868 where
13869 T: std::convert::Into<wkt::FieldMask>,
13870 {
13871 self.0.request.update_mask = std::option::Option::Some(v.into());
13872 self
13873 }
13874
13875 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13877 where
13878 T: std::convert::Into<wkt::FieldMask>,
13879 {
13880 self.0.request.update_mask = v.map(|x| x.into());
13881 self
13882 }
13883 }
13884
13885 #[doc(hidden)]
13886 impl crate::RequestBuilder for UpdateSession {
13887 fn request_options(&mut self) -> &mut crate::RequestOptions {
13888 &mut self.0.options
13889 }
13890 }
13891
13892 #[derive(Clone, Debug)]
13909 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13910
13911 impl GetSession {
13912 pub(crate) fn new(
13913 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13914 ) -> Self {
13915 Self(RequestBuilder::new(stub))
13916 }
13917
13918 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13920 self.0.request = v.into();
13921 self
13922 }
13923
13924 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13926 self.0.options = v.into();
13927 self
13928 }
13929
13930 pub async fn send(self) -> Result<crate::model::Session> {
13932 (*self.0.stub)
13933 .get_session(self.0.request, self.0.options)
13934 .await
13935 .map(crate::Response::into_body)
13936 }
13937
13938 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13942 self.0.request.name = v.into();
13943 self
13944 }
13945
13946 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13948 self.0.request.include_answer_details = v.into();
13949 self
13950 }
13951 }
13952
13953 #[doc(hidden)]
13954 impl crate::RequestBuilder for GetSession {
13955 fn request_options(&mut self) -> &mut crate::RequestOptions {
13956 &mut self.0.options
13957 }
13958 }
13959
13960 #[derive(Clone, Debug)]
13981 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
13982
13983 impl ListSessions {
13984 pub(crate) fn new(
13985 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13986 ) -> Self {
13987 Self(RequestBuilder::new(stub))
13988 }
13989
13990 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
13992 self.0.request = v.into();
13993 self
13994 }
13995
13996 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13998 self.0.options = v.into();
13999 self
14000 }
14001
14002 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
14004 (*self.0.stub)
14005 .list_sessions(self.0.request, self.0.options)
14006 .await
14007 .map(crate::Response::into_body)
14008 }
14009
14010 pub fn by_page(
14012 self,
14013 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
14014 {
14015 use std::clone::Clone;
14016 let token = self.0.request.page_token.clone();
14017 let execute = move |token: String| {
14018 let mut builder = self.clone();
14019 builder.0.request = builder.0.request.set_page_token(token);
14020 builder.send()
14021 };
14022 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14023 }
14024
14025 pub fn by_item(
14027 self,
14028 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14029 crate::model::ListSessionsResponse,
14030 crate::Error,
14031 > {
14032 use google_cloud_gax::paginator::Paginator;
14033 self.by_page().items()
14034 }
14035
14036 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14040 self.0.request.parent = v.into();
14041 self
14042 }
14043
14044 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14046 self.0.request.page_size = v.into();
14047 self
14048 }
14049
14050 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14052 self.0.request.page_token = v.into();
14053 self
14054 }
14055
14056 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14058 self.0.request.filter = v.into();
14059 self
14060 }
14061
14062 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
14064 self.0.request.order_by = v.into();
14065 self
14066 }
14067 }
14068
14069 #[doc(hidden)]
14070 impl crate::RequestBuilder for ListSessions {
14071 fn request_options(&mut self) -> &mut crate::RequestOptions {
14072 &mut self.0.options
14073 }
14074 }
14075
14076 #[derive(Clone, Debug)]
14097 pub struct ListOperations(
14098 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
14099 );
14100
14101 impl ListOperations {
14102 pub(crate) fn new(
14103 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14104 ) -> Self {
14105 Self(RequestBuilder::new(stub))
14106 }
14107
14108 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
14110 mut self,
14111 v: V,
14112 ) -> Self {
14113 self.0.request = v.into();
14114 self
14115 }
14116
14117 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14119 self.0.options = v.into();
14120 self
14121 }
14122
14123 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
14125 (*self.0.stub)
14126 .list_operations(self.0.request, self.0.options)
14127 .await
14128 .map(crate::Response::into_body)
14129 }
14130
14131 pub fn by_page(
14133 self,
14134 ) -> impl google_cloud_gax::paginator::Paginator<
14135 google_cloud_longrunning::model::ListOperationsResponse,
14136 crate::Error,
14137 > {
14138 use std::clone::Clone;
14139 let token = self.0.request.page_token.clone();
14140 let execute = move |token: String| {
14141 let mut builder = self.clone();
14142 builder.0.request = builder.0.request.set_page_token(token);
14143 builder.send()
14144 };
14145 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14146 }
14147
14148 pub fn by_item(
14150 self,
14151 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14152 google_cloud_longrunning::model::ListOperationsResponse,
14153 crate::Error,
14154 > {
14155 use google_cloud_gax::paginator::Paginator;
14156 self.by_page().items()
14157 }
14158
14159 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14161 self.0.request.name = v.into();
14162 self
14163 }
14164
14165 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14167 self.0.request.filter = v.into();
14168 self
14169 }
14170
14171 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14173 self.0.request.page_size = v.into();
14174 self
14175 }
14176
14177 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14179 self.0.request.page_token = v.into();
14180 self
14181 }
14182
14183 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14185 self.0.request.return_partial_success = v.into();
14186 self
14187 }
14188 }
14189
14190 #[doc(hidden)]
14191 impl crate::RequestBuilder for ListOperations {
14192 fn request_options(&mut self) -> &mut crate::RequestOptions {
14193 &mut self.0.options
14194 }
14195 }
14196
14197 #[derive(Clone, Debug)]
14214 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14215
14216 impl GetOperation {
14217 pub(crate) fn new(
14218 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14219 ) -> Self {
14220 Self(RequestBuilder::new(stub))
14221 }
14222
14223 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14225 mut self,
14226 v: V,
14227 ) -> Self {
14228 self.0.request = v.into();
14229 self
14230 }
14231
14232 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14234 self.0.options = v.into();
14235 self
14236 }
14237
14238 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14240 (*self.0.stub)
14241 .get_operation(self.0.request, self.0.options)
14242 .await
14243 .map(crate::Response::into_body)
14244 }
14245
14246 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14248 self.0.request.name = v.into();
14249 self
14250 }
14251 }
14252
14253 #[doc(hidden)]
14254 impl crate::RequestBuilder for GetOperation {
14255 fn request_options(&mut self) -> &mut crate::RequestOptions {
14256 &mut self.0.options
14257 }
14258 }
14259
14260 #[derive(Clone, Debug)]
14277 pub struct CancelOperation(
14278 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14279 );
14280
14281 impl CancelOperation {
14282 pub(crate) fn new(
14283 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14284 ) -> Self {
14285 Self(RequestBuilder::new(stub))
14286 }
14287
14288 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
14290 mut self,
14291 v: V,
14292 ) -> Self {
14293 self.0.request = v.into();
14294 self
14295 }
14296
14297 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14299 self.0.options = v.into();
14300 self
14301 }
14302
14303 pub async fn send(self) -> Result<()> {
14305 (*self.0.stub)
14306 .cancel_operation(self.0.request, self.0.options)
14307 .await
14308 .map(crate::Response::into_body)
14309 }
14310
14311 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14313 self.0.request.name = v.into();
14314 self
14315 }
14316 }
14317
14318 #[doc(hidden)]
14319 impl crate::RequestBuilder for CancelOperation {
14320 fn request_options(&mut self) -> &mut crate::RequestOptions {
14321 &mut self.0.options
14322 }
14323 }
14324}
14325
14326#[cfg(feature = "site-search-engine-service")]
14328#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
14329pub mod site_search_engine_service {
14330 use crate::Result;
14331
14332 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14346
14347 pub(crate) mod client {
14348 use super::super::super::client::SiteSearchEngineService;
14349 pub struct Factory;
14350 impl crate::ClientFactory for Factory {
14351 type Client = SiteSearchEngineService;
14352 type Credentials = gaxi::options::Credentials;
14353 async fn build(
14354 self,
14355 config: gaxi::options::ClientConfig,
14356 ) -> crate::ClientBuilderResult<Self::Client> {
14357 Self::Client::new(config).await
14358 }
14359 }
14360 }
14361
14362 #[derive(Clone, Debug)]
14364 pub(crate) struct RequestBuilder<R: std::default::Default> {
14365 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14366 request: R,
14367 options: crate::RequestOptions,
14368 }
14369
14370 impl<R> RequestBuilder<R>
14371 where
14372 R: std::default::Default,
14373 {
14374 pub(crate) fn new(
14375 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14376 ) -> Self {
14377 Self {
14378 stub,
14379 request: R::default(),
14380 options: crate::RequestOptions::default(),
14381 }
14382 }
14383 }
14384
14385 #[derive(Clone, Debug)]
14402 pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
14403
14404 impl GetSiteSearchEngine {
14405 pub(crate) fn new(
14406 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14407 ) -> Self {
14408 Self(RequestBuilder::new(stub))
14409 }
14410
14411 pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
14413 mut self,
14414 v: V,
14415 ) -> Self {
14416 self.0.request = v.into();
14417 self
14418 }
14419
14420 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14422 self.0.options = v.into();
14423 self
14424 }
14425
14426 pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
14428 (*self.0.stub)
14429 .get_site_search_engine(self.0.request, self.0.options)
14430 .await
14431 .map(crate::Response::into_body)
14432 }
14433
14434 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14438 self.0.request.name = v.into();
14439 self
14440 }
14441 }
14442
14443 #[doc(hidden)]
14444 impl crate::RequestBuilder for GetSiteSearchEngine {
14445 fn request_options(&mut self) -> &mut crate::RequestOptions {
14446 &mut self.0.options
14447 }
14448 }
14449
14450 #[derive(Clone, Debug)]
14468 pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
14469
14470 impl CreateTargetSite {
14471 pub(crate) fn new(
14472 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14473 ) -> Self {
14474 Self(RequestBuilder::new(stub))
14475 }
14476
14477 pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
14479 mut self,
14480 v: V,
14481 ) -> Self {
14482 self.0.request = v.into();
14483 self
14484 }
14485
14486 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14488 self.0.options = v.into();
14489 self
14490 }
14491
14492 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14499 (*self.0.stub)
14500 .create_target_site(self.0.request, self.0.options)
14501 .await
14502 .map(crate::Response::into_body)
14503 }
14504
14505 pub fn poller(
14507 self,
14508 ) -> impl google_cloud_lro::Poller<
14509 crate::model::TargetSite,
14510 crate::model::CreateTargetSiteMetadata,
14511 > {
14512 type Operation = google_cloud_lro::internal::Operation<
14513 crate::model::TargetSite,
14514 crate::model::CreateTargetSiteMetadata,
14515 >;
14516 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14517 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14518 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14519 if let Some(ref mut details) = poller_options.tracing {
14520 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::create_target_site::until_done";
14521 }
14522
14523 let stub = self.0.stub.clone();
14524 let mut options = self.0.options.clone();
14525 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14526 let query = move |name| {
14527 let stub = stub.clone();
14528 let options = options.clone();
14529 async {
14530 let op = GetOperation::new(stub)
14531 .set_name(name)
14532 .with_options(options)
14533 .send()
14534 .await?;
14535 Ok(Operation::new(op))
14536 }
14537 };
14538
14539 let start = move || async {
14540 let op = self.send().await?;
14541 Ok(Operation::new(op))
14542 };
14543
14544 use google_cloud_lro::internal::PollerExt;
14545 {
14546 google_cloud_lro::internal::new_poller(
14547 polling_error_policy,
14548 polling_backoff_policy,
14549 start,
14550 query,
14551 )
14552 }
14553 .with_options(poller_options)
14554 }
14555
14556 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14560 self.0.request.parent = v.into();
14561 self
14562 }
14563
14564 pub fn set_target_site<T>(mut self, v: T) -> Self
14568 where
14569 T: std::convert::Into<crate::model::TargetSite>,
14570 {
14571 self.0.request.target_site = std::option::Option::Some(v.into());
14572 self
14573 }
14574
14575 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14579 where
14580 T: std::convert::Into<crate::model::TargetSite>,
14581 {
14582 self.0.request.target_site = v.map(|x| x.into());
14583 self
14584 }
14585 }
14586
14587 #[doc(hidden)]
14588 impl crate::RequestBuilder for CreateTargetSite {
14589 fn request_options(&mut self) -> &mut crate::RequestOptions {
14590 &mut self.0.options
14591 }
14592 }
14593
14594 #[derive(Clone, Debug)]
14612 pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14613
14614 impl BatchCreateTargetSites {
14615 pub(crate) fn new(
14616 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14617 ) -> Self {
14618 Self(RequestBuilder::new(stub))
14619 }
14620
14621 pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14623 mut self,
14624 v: V,
14625 ) -> Self {
14626 self.0.request = v.into();
14627 self
14628 }
14629
14630 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14632 self.0.options = v.into();
14633 self
14634 }
14635
14636 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14643 (*self.0.stub)
14644 .batch_create_target_sites(self.0.request, self.0.options)
14645 .await
14646 .map(crate::Response::into_body)
14647 }
14648
14649 pub fn poller(
14651 self,
14652 ) -> impl google_cloud_lro::Poller<
14653 crate::model::BatchCreateTargetSitesResponse,
14654 crate::model::BatchCreateTargetSiteMetadata,
14655 > {
14656 type Operation = google_cloud_lro::internal::Operation<
14657 crate::model::BatchCreateTargetSitesResponse,
14658 crate::model::BatchCreateTargetSiteMetadata,
14659 >;
14660 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14661 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14662 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14663 if let Some(ref mut details) = poller_options.tracing {
14664 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::batch_create_target_sites::until_done";
14665 }
14666
14667 let stub = self.0.stub.clone();
14668 let mut options = self.0.options.clone();
14669 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14670 let query = move |name| {
14671 let stub = stub.clone();
14672 let options = options.clone();
14673 async {
14674 let op = GetOperation::new(stub)
14675 .set_name(name)
14676 .with_options(options)
14677 .send()
14678 .await?;
14679 Ok(Operation::new(op))
14680 }
14681 };
14682
14683 let start = move || async {
14684 let op = self.send().await?;
14685 Ok(Operation::new(op))
14686 };
14687
14688 use google_cloud_lro::internal::PollerExt;
14689 {
14690 google_cloud_lro::internal::new_poller(
14691 polling_error_policy,
14692 polling_backoff_policy,
14693 start,
14694 query,
14695 )
14696 }
14697 .with_options(poller_options)
14698 }
14699
14700 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14704 self.0.request.parent = v.into();
14705 self
14706 }
14707
14708 pub fn set_requests<T, V>(mut self, v: T) -> Self
14712 where
14713 T: std::iter::IntoIterator<Item = V>,
14714 V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14715 {
14716 use std::iter::Iterator;
14717 self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14718 self
14719 }
14720 }
14721
14722 #[doc(hidden)]
14723 impl crate::RequestBuilder for BatchCreateTargetSites {
14724 fn request_options(&mut self) -> &mut crate::RequestOptions {
14725 &mut self.0.options
14726 }
14727 }
14728
14729 #[derive(Clone, Debug)]
14746 pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14747
14748 impl GetTargetSite {
14749 pub(crate) fn new(
14750 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14751 ) -> Self {
14752 Self(RequestBuilder::new(stub))
14753 }
14754
14755 pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14757 self.0.request = v.into();
14758 self
14759 }
14760
14761 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14763 self.0.options = v.into();
14764 self
14765 }
14766
14767 pub async fn send(self) -> Result<crate::model::TargetSite> {
14769 (*self.0.stub)
14770 .get_target_site(self.0.request, self.0.options)
14771 .await
14772 .map(crate::Response::into_body)
14773 }
14774
14775 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14779 self.0.request.name = v.into();
14780 self
14781 }
14782 }
14783
14784 #[doc(hidden)]
14785 impl crate::RequestBuilder for GetTargetSite {
14786 fn request_options(&mut self) -> &mut crate::RequestOptions {
14787 &mut self.0.options
14788 }
14789 }
14790
14791 #[derive(Clone, Debug)]
14809 pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14810
14811 impl UpdateTargetSite {
14812 pub(crate) fn new(
14813 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14814 ) -> Self {
14815 Self(RequestBuilder::new(stub))
14816 }
14817
14818 pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14820 mut self,
14821 v: V,
14822 ) -> Self {
14823 self.0.request = v.into();
14824 self
14825 }
14826
14827 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14829 self.0.options = v.into();
14830 self
14831 }
14832
14833 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14840 (*self.0.stub)
14841 .update_target_site(self.0.request, self.0.options)
14842 .await
14843 .map(crate::Response::into_body)
14844 }
14845
14846 pub fn poller(
14848 self,
14849 ) -> impl google_cloud_lro::Poller<
14850 crate::model::TargetSite,
14851 crate::model::UpdateTargetSiteMetadata,
14852 > {
14853 type Operation = google_cloud_lro::internal::Operation<
14854 crate::model::TargetSite,
14855 crate::model::UpdateTargetSiteMetadata,
14856 >;
14857 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14858 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14859 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14860 if let Some(ref mut details) = poller_options.tracing {
14861 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::update_target_site::until_done";
14862 }
14863
14864 let stub = self.0.stub.clone();
14865 let mut options = self.0.options.clone();
14866 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14867 let query = move |name| {
14868 let stub = stub.clone();
14869 let options = options.clone();
14870 async {
14871 let op = GetOperation::new(stub)
14872 .set_name(name)
14873 .with_options(options)
14874 .send()
14875 .await?;
14876 Ok(Operation::new(op))
14877 }
14878 };
14879
14880 let start = move || async {
14881 let op = self.send().await?;
14882 Ok(Operation::new(op))
14883 };
14884
14885 use google_cloud_lro::internal::PollerExt;
14886 {
14887 google_cloud_lro::internal::new_poller(
14888 polling_error_policy,
14889 polling_backoff_policy,
14890 start,
14891 query,
14892 )
14893 }
14894 .with_options(poller_options)
14895 }
14896
14897 pub fn set_target_site<T>(mut self, v: T) -> Self
14901 where
14902 T: std::convert::Into<crate::model::TargetSite>,
14903 {
14904 self.0.request.target_site = std::option::Option::Some(v.into());
14905 self
14906 }
14907
14908 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14912 where
14913 T: std::convert::Into<crate::model::TargetSite>,
14914 {
14915 self.0.request.target_site = v.map(|x| x.into());
14916 self
14917 }
14918 }
14919
14920 #[doc(hidden)]
14921 impl crate::RequestBuilder for UpdateTargetSite {
14922 fn request_options(&mut self) -> &mut crate::RequestOptions {
14923 &mut self.0.options
14924 }
14925 }
14926
14927 #[derive(Clone, Debug)]
14945 pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14946
14947 impl DeleteTargetSite {
14948 pub(crate) fn new(
14949 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14950 ) -> Self {
14951 Self(RequestBuilder::new(stub))
14952 }
14953
14954 pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14956 mut self,
14957 v: V,
14958 ) -> Self {
14959 self.0.request = v.into();
14960 self
14961 }
14962
14963 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14965 self.0.options = v.into();
14966 self
14967 }
14968
14969 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14976 (*self.0.stub)
14977 .delete_target_site(self.0.request, self.0.options)
14978 .await
14979 .map(crate::Response::into_body)
14980 }
14981
14982 pub fn poller(
14984 self,
14985 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
14986 type Operation = google_cloud_lro::internal::Operation<
14987 wkt::Empty,
14988 crate::model::DeleteTargetSiteMetadata,
14989 >;
14990 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14991 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14992 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
14993 if let Some(ref mut details) = poller_options.tracing {
14994 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::delete_target_site::until_done";
14995 }
14996
14997 let stub = self.0.stub.clone();
14998 let mut options = self.0.options.clone();
14999 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15000 let query = move |name| {
15001 let stub = stub.clone();
15002 let options = options.clone();
15003 async {
15004 let op = GetOperation::new(stub)
15005 .set_name(name)
15006 .with_options(options)
15007 .send()
15008 .await?;
15009 Ok(Operation::new(op))
15010 }
15011 };
15012
15013 let start = move || async {
15014 let op = self.send().await?;
15015 Ok(Operation::new(op))
15016 };
15017
15018 use google_cloud_lro::internal::PollerExt;
15019 {
15020 google_cloud_lro::internal::new_unit_response_poller(
15021 polling_error_policy,
15022 polling_backoff_policy,
15023 start,
15024 query,
15025 )
15026 }
15027 .with_options(poller_options)
15028 }
15029
15030 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15034 self.0.request.name = v.into();
15035 self
15036 }
15037 }
15038
15039 #[doc(hidden)]
15040 impl crate::RequestBuilder for DeleteTargetSite {
15041 fn request_options(&mut self) -> &mut crate::RequestOptions {
15042 &mut self.0.options
15043 }
15044 }
15045
15046 #[derive(Clone, Debug)]
15067 pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
15068
15069 impl ListTargetSites {
15070 pub(crate) fn new(
15071 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15072 ) -> Self {
15073 Self(RequestBuilder::new(stub))
15074 }
15075
15076 pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
15078 self.0.request = v.into();
15079 self
15080 }
15081
15082 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15084 self.0.options = v.into();
15085 self
15086 }
15087
15088 pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
15090 (*self.0.stub)
15091 .list_target_sites(self.0.request, self.0.options)
15092 .await
15093 .map(crate::Response::into_body)
15094 }
15095
15096 pub fn by_page(
15098 self,
15099 ) -> impl google_cloud_gax::paginator::Paginator<
15100 crate::model::ListTargetSitesResponse,
15101 crate::Error,
15102 > {
15103 use std::clone::Clone;
15104 let token = self.0.request.page_token.clone();
15105 let execute = move |token: String| {
15106 let mut builder = self.clone();
15107 builder.0.request = builder.0.request.set_page_token(token);
15108 builder.send()
15109 };
15110 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15111 }
15112
15113 pub fn by_item(
15115 self,
15116 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15117 crate::model::ListTargetSitesResponse,
15118 crate::Error,
15119 > {
15120 use google_cloud_gax::paginator::Paginator;
15121 self.by_page().items()
15122 }
15123
15124 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15128 self.0.request.parent = v.into();
15129 self
15130 }
15131
15132 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15134 self.0.request.page_size = v.into();
15135 self
15136 }
15137
15138 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15140 self.0.request.page_token = v.into();
15141 self
15142 }
15143 }
15144
15145 #[doc(hidden)]
15146 impl crate::RequestBuilder for ListTargetSites {
15147 fn request_options(&mut self) -> &mut crate::RequestOptions {
15148 &mut self.0.options
15149 }
15150 }
15151
15152 #[derive(Clone, Debug)]
15170 pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
15171
15172 impl CreateSitemap {
15173 pub(crate) fn new(
15174 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15175 ) -> Self {
15176 Self(RequestBuilder::new(stub))
15177 }
15178
15179 pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
15181 self.0.request = v.into();
15182 self
15183 }
15184
15185 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15187 self.0.options = v.into();
15188 self
15189 }
15190
15191 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15198 (*self.0.stub)
15199 .create_sitemap(self.0.request, self.0.options)
15200 .await
15201 .map(crate::Response::into_body)
15202 }
15203
15204 pub fn poller(
15206 self,
15207 ) -> impl google_cloud_lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata>
15208 {
15209 type Operation = google_cloud_lro::internal::Operation<
15210 crate::model::Sitemap,
15211 crate::model::CreateSitemapMetadata,
15212 >;
15213 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15214 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15215 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15216 if let Some(ref mut details) = poller_options.tracing {
15217 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::create_sitemap::until_done";
15218 }
15219
15220 let stub = self.0.stub.clone();
15221 let mut options = self.0.options.clone();
15222 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15223 let query = move |name| {
15224 let stub = stub.clone();
15225 let options = options.clone();
15226 async {
15227 let op = GetOperation::new(stub)
15228 .set_name(name)
15229 .with_options(options)
15230 .send()
15231 .await?;
15232 Ok(Operation::new(op))
15233 }
15234 };
15235
15236 let start = move || async {
15237 let op = self.send().await?;
15238 Ok(Operation::new(op))
15239 };
15240
15241 use google_cloud_lro::internal::PollerExt;
15242 {
15243 google_cloud_lro::internal::new_poller(
15244 polling_error_policy,
15245 polling_backoff_policy,
15246 start,
15247 query,
15248 )
15249 }
15250 .with_options(poller_options)
15251 }
15252
15253 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15257 self.0.request.parent = v.into();
15258 self
15259 }
15260
15261 pub fn set_sitemap<T>(mut self, v: T) -> Self
15265 where
15266 T: std::convert::Into<crate::model::Sitemap>,
15267 {
15268 self.0.request.sitemap = std::option::Option::Some(v.into());
15269 self
15270 }
15271
15272 pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
15276 where
15277 T: std::convert::Into<crate::model::Sitemap>,
15278 {
15279 self.0.request.sitemap = v.map(|x| x.into());
15280 self
15281 }
15282 }
15283
15284 #[doc(hidden)]
15285 impl crate::RequestBuilder for CreateSitemap {
15286 fn request_options(&mut self) -> &mut crate::RequestOptions {
15287 &mut self.0.options
15288 }
15289 }
15290
15291 #[derive(Clone, Debug)]
15309 pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
15310
15311 impl DeleteSitemap {
15312 pub(crate) fn new(
15313 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15314 ) -> Self {
15315 Self(RequestBuilder::new(stub))
15316 }
15317
15318 pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
15320 self.0.request = v.into();
15321 self
15322 }
15323
15324 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15326 self.0.options = v.into();
15327 self
15328 }
15329
15330 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15337 (*self.0.stub)
15338 .delete_sitemap(self.0.request, self.0.options)
15339 .await
15340 .map(crate::Response::into_body)
15341 }
15342
15343 pub fn poller(
15345 self,
15346 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSitemapMetadata> {
15347 type Operation = google_cloud_lro::internal::Operation<
15348 wkt::Empty,
15349 crate::model::DeleteSitemapMetadata,
15350 >;
15351 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15352 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15353 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15354 if let Some(ref mut details) = poller_options.tracing {
15355 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::delete_sitemap::until_done";
15356 }
15357
15358 let stub = self.0.stub.clone();
15359 let mut options = self.0.options.clone();
15360 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15361 let query = move |name| {
15362 let stub = stub.clone();
15363 let options = options.clone();
15364 async {
15365 let op = GetOperation::new(stub)
15366 .set_name(name)
15367 .with_options(options)
15368 .send()
15369 .await?;
15370 Ok(Operation::new(op))
15371 }
15372 };
15373
15374 let start = move || async {
15375 let op = self.send().await?;
15376 Ok(Operation::new(op))
15377 };
15378
15379 use google_cloud_lro::internal::PollerExt;
15380 {
15381 google_cloud_lro::internal::new_unit_response_poller(
15382 polling_error_policy,
15383 polling_backoff_policy,
15384 start,
15385 query,
15386 )
15387 }
15388 .with_options(poller_options)
15389 }
15390
15391 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15395 self.0.request.name = v.into();
15396 self
15397 }
15398 }
15399
15400 #[doc(hidden)]
15401 impl crate::RequestBuilder for DeleteSitemap {
15402 fn request_options(&mut self) -> &mut crate::RequestOptions {
15403 &mut self.0.options
15404 }
15405 }
15406
15407 #[derive(Clone, Debug)]
15424 pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
15425
15426 impl FetchSitemaps {
15427 pub(crate) fn new(
15428 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15429 ) -> Self {
15430 Self(RequestBuilder::new(stub))
15431 }
15432
15433 pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
15435 self.0.request = v.into();
15436 self
15437 }
15438
15439 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15441 self.0.options = v.into();
15442 self
15443 }
15444
15445 pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
15447 (*self.0.stub)
15448 .fetch_sitemaps(self.0.request, self.0.options)
15449 .await
15450 .map(crate::Response::into_body)
15451 }
15452
15453 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15457 self.0.request.parent = v.into();
15458 self
15459 }
15460
15461 pub fn set_matcher<T>(mut self, v: T) -> Self
15463 where
15464 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15465 {
15466 self.0.request.matcher = std::option::Option::Some(v.into());
15467 self
15468 }
15469
15470 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
15472 where
15473 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15474 {
15475 self.0.request.matcher = v.map(|x| x.into());
15476 self
15477 }
15478 }
15479
15480 #[doc(hidden)]
15481 impl crate::RequestBuilder for FetchSitemaps {
15482 fn request_options(&mut self) -> &mut crate::RequestOptions {
15483 &mut self.0.options
15484 }
15485 }
15486
15487 #[derive(Clone, Debug)]
15505 pub struct EnableAdvancedSiteSearch(
15506 RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
15507 );
15508
15509 impl EnableAdvancedSiteSearch {
15510 pub(crate) fn new(
15511 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15512 ) -> Self {
15513 Self(RequestBuilder::new(stub))
15514 }
15515
15516 pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
15518 mut self,
15519 v: V,
15520 ) -> Self {
15521 self.0.request = v.into();
15522 self
15523 }
15524
15525 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15527 self.0.options = v.into();
15528 self
15529 }
15530
15531 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15538 (*self.0.stub)
15539 .enable_advanced_site_search(self.0.request, self.0.options)
15540 .await
15541 .map(crate::Response::into_body)
15542 }
15543
15544 pub fn poller(
15546 self,
15547 ) -> impl google_cloud_lro::Poller<
15548 crate::model::EnableAdvancedSiteSearchResponse,
15549 crate::model::EnableAdvancedSiteSearchMetadata,
15550 > {
15551 type Operation = google_cloud_lro::internal::Operation<
15552 crate::model::EnableAdvancedSiteSearchResponse,
15553 crate::model::EnableAdvancedSiteSearchMetadata,
15554 >;
15555 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15556 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15557 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15558 if let Some(ref mut details) = poller_options.tracing {
15559 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::enable_advanced_site_search::until_done";
15560 }
15561
15562 let stub = self.0.stub.clone();
15563 let mut options = self.0.options.clone();
15564 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15565 let query = move |name| {
15566 let stub = stub.clone();
15567 let options = options.clone();
15568 async {
15569 let op = GetOperation::new(stub)
15570 .set_name(name)
15571 .with_options(options)
15572 .send()
15573 .await?;
15574 Ok(Operation::new(op))
15575 }
15576 };
15577
15578 let start = move || async {
15579 let op = self.send().await?;
15580 Ok(Operation::new(op))
15581 };
15582
15583 use google_cloud_lro::internal::PollerExt;
15584 {
15585 google_cloud_lro::internal::new_poller(
15586 polling_error_policy,
15587 polling_backoff_policy,
15588 start,
15589 query,
15590 )
15591 }
15592 .with_options(poller_options)
15593 }
15594
15595 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15599 self.0.request.site_search_engine = v.into();
15600 self
15601 }
15602 }
15603
15604 #[doc(hidden)]
15605 impl crate::RequestBuilder for EnableAdvancedSiteSearch {
15606 fn request_options(&mut self) -> &mut crate::RequestOptions {
15607 &mut self.0.options
15608 }
15609 }
15610
15611 #[derive(Clone, Debug)]
15629 pub struct DisableAdvancedSiteSearch(
15630 RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15631 );
15632
15633 impl DisableAdvancedSiteSearch {
15634 pub(crate) fn new(
15635 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15636 ) -> Self {
15637 Self(RequestBuilder::new(stub))
15638 }
15639
15640 pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15642 mut self,
15643 v: V,
15644 ) -> Self {
15645 self.0.request = v.into();
15646 self
15647 }
15648
15649 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15651 self.0.options = v.into();
15652 self
15653 }
15654
15655 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15662 (*self.0.stub)
15663 .disable_advanced_site_search(self.0.request, self.0.options)
15664 .await
15665 .map(crate::Response::into_body)
15666 }
15667
15668 pub fn poller(
15670 self,
15671 ) -> impl google_cloud_lro::Poller<
15672 crate::model::DisableAdvancedSiteSearchResponse,
15673 crate::model::DisableAdvancedSiteSearchMetadata,
15674 > {
15675 type Operation = google_cloud_lro::internal::Operation<
15676 crate::model::DisableAdvancedSiteSearchResponse,
15677 crate::model::DisableAdvancedSiteSearchMetadata,
15678 >;
15679 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15680 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15681 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15682 if let Some(ref mut details) = poller_options.tracing {
15683 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::disable_advanced_site_search::until_done";
15684 }
15685
15686 let stub = self.0.stub.clone();
15687 let mut options = self.0.options.clone();
15688 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15689 let query = move |name| {
15690 let stub = stub.clone();
15691 let options = options.clone();
15692 async {
15693 let op = GetOperation::new(stub)
15694 .set_name(name)
15695 .with_options(options)
15696 .send()
15697 .await?;
15698 Ok(Operation::new(op))
15699 }
15700 };
15701
15702 let start = move || async {
15703 let op = self.send().await?;
15704 Ok(Operation::new(op))
15705 };
15706
15707 use google_cloud_lro::internal::PollerExt;
15708 {
15709 google_cloud_lro::internal::new_poller(
15710 polling_error_policy,
15711 polling_backoff_policy,
15712 start,
15713 query,
15714 )
15715 }
15716 .with_options(poller_options)
15717 }
15718
15719 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15723 self.0.request.site_search_engine = v.into();
15724 self
15725 }
15726 }
15727
15728 #[doc(hidden)]
15729 impl crate::RequestBuilder for DisableAdvancedSiteSearch {
15730 fn request_options(&mut self) -> &mut crate::RequestOptions {
15731 &mut self.0.options
15732 }
15733 }
15734
15735 #[derive(Clone, Debug)]
15753 pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15754
15755 impl RecrawlUris {
15756 pub(crate) fn new(
15757 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15758 ) -> Self {
15759 Self(RequestBuilder::new(stub))
15760 }
15761
15762 pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15764 self.0.request = v.into();
15765 self
15766 }
15767
15768 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15770 self.0.options = v.into();
15771 self
15772 }
15773
15774 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15781 (*self.0.stub)
15782 .recrawl_uris(self.0.request, self.0.options)
15783 .await
15784 .map(crate::Response::into_body)
15785 }
15786
15787 pub fn poller(
15789 self,
15790 ) -> impl google_cloud_lro::Poller<
15791 crate::model::RecrawlUrisResponse,
15792 crate::model::RecrawlUrisMetadata,
15793 > {
15794 type Operation = google_cloud_lro::internal::Operation<
15795 crate::model::RecrawlUrisResponse,
15796 crate::model::RecrawlUrisMetadata,
15797 >;
15798 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15799 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15800 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15801 if let Some(ref mut details) = poller_options.tracing {
15802 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::recrawl_uris::until_done";
15803 }
15804
15805 let stub = self.0.stub.clone();
15806 let mut options = self.0.options.clone();
15807 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15808 let query = move |name| {
15809 let stub = stub.clone();
15810 let options = options.clone();
15811 async {
15812 let op = GetOperation::new(stub)
15813 .set_name(name)
15814 .with_options(options)
15815 .send()
15816 .await?;
15817 Ok(Operation::new(op))
15818 }
15819 };
15820
15821 let start = move || async {
15822 let op = self.send().await?;
15823 Ok(Operation::new(op))
15824 };
15825
15826 use google_cloud_lro::internal::PollerExt;
15827 {
15828 google_cloud_lro::internal::new_poller(
15829 polling_error_policy,
15830 polling_backoff_policy,
15831 start,
15832 query,
15833 )
15834 }
15835 .with_options(poller_options)
15836 }
15837
15838 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15842 self.0.request.site_search_engine = v.into();
15843 self
15844 }
15845
15846 pub fn set_uris<T, V>(mut self, v: T) -> Self
15850 where
15851 T: std::iter::IntoIterator<Item = V>,
15852 V: std::convert::Into<std::string::String>,
15853 {
15854 use std::iter::Iterator;
15855 self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15856 self
15857 }
15858
15859 pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15861 self.0.request.site_credential = v.into();
15862 self
15863 }
15864 }
15865
15866 #[doc(hidden)]
15867 impl crate::RequestBuilder for RecrawlUris {
15868 fn request_options(&mut self) -> &mut crate::RequestOptions {
15869 &mut self.0.options
15870 }
15871 }
15872
15873 #[derive(Clone, Debug)]
15891 pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15892
15893 impl BatchVerifyTargetSites {
15894 pub(crate) fn new(
15895 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15896 ) -> Self {
15897 Self(RequestBuilder::new(stub))
15898 }
15899
15900 pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15902 mut self,
15903 v: V,
15904 ) -> Self {
15905 self.0.request = v.into();
15906 self
15907 }
15908
15909 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15911 self.0.options = v.into();
15912 self
15913 }
15914
15915 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15922 (*self.0.stub)
15923 .batch_verify_target_sites(self.0.request, self.0.options)
15924 .await
15925 .map(crate::Response::into_body)
15926 }
15927
15928 pub fn poller(
15930 self,
15931 ) -> impl google_cloud_lro::Poller<
15932 crate::model::BatchVerifyTargetSitesResponse,
15933 crate::model::BatchVerifyTargetSitesMetadata,
15934 > {
15935 type Operation = google_cloud_lro::internal::Operation<
15936 crate::model::BatchVerifyTargetSitesResponse,
15937 crate::model::BatchVerifyTargetSitesMetadata,
15938 >;
15939 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15940 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15941 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15942 if let Some(ref mut details) = poller_options.tracing {
15943 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::batch_verify_target_sites::until_done";
15944 }
15945
15946 let stub = self.0.stub.clone();
15947 let mut options = self.0.options.clone();
15948 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15949 let query = move |name| {
15950 let stub = stub.clone();
15951 let options = options.clone();
15952 async {
15953 let op = GetOperation::new(stub)
15954 .set_name(name)
15955 .with_options(options)
15956 .send()
15957 .await?;
15958 Ok(Operation::new(op))
15959 }
15960 };
15961
15962 let start = move || async {
15963 let op = self.send().await?;
15964 Ok(Operation::new(op))
15965 };
15966
15967 use google_cloud_lro::internal::PollerExt;
15968 {
15969 google_cloud_lro::internal::new_poller(
15970 polling_error_policy,
15971 polling_backoff_policy,
15972 start,
15973 query,
15974 )
15975 }
15976 .with_options(poller_options)
15977 }
15978
15979 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15983 self.0.request.parent = v.into();
15984 self
15985 }
15986 }
15987
15988 #[doc(hidden)]
15989 impl crate::RequestBuilder for BatchVerifyTargetSites {
15990 fn request_options(&mut self) -> &mut crate::RequestOptions {
15991 &mut self.0.options
15992 }
15993 }
15994
15995 #[derive(Clone, Debug)]
16016 pub struct FetchDomainVerificationStatus(
16017 RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
16018 );
16019
16020 impl FetchDomainVerificationStatus {
16021 pub(crate) fn new(
16022 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16023 ) -> Self {
16024 Self(RequestBuilder::new(stub))
16025 }
16026
16027 pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
16029 mut self,
16030 v: V,
16031 ) -> Self {
16032 self.0.request = v.into();
16033 self
16034 }
16035
16036 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16038 self.0.options = v.into();
16039 self
16040 }
16041
16042 pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
16044 (*self.0.stub)
16045 .fetch_domain_verification_status(self.0.request, self.0.options)
16046 .await
16047 .map(crate::Response::into_body)
16048 }
16049
16050 pub fn by_page(
16052 self,
16053 ) -> impl google_cloud_gax::paginator::Paginator<
16054 crate::model::FetchDomainVerificationStatusResponse,
16055 crate::Error,
16056 > {
16057 use std::clone::Clone;
16058 let token = self.0.request.page_token.clone();
16059 let execute = move |token: String| {
16060 let mut builder = self.clone();
16061 builder.0.request = builder.0.request.set_page_token(token);
16062 builder.send()
16063 };
16064 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16065 }
16066
16067 pub fn by_item(
16069 self,
16070 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16071 crate::model::FetchDomainVerificationStatusResponse,
16072 crate::Error,
16073 > {
16074 use google_cloud_gax::paginator::Paginator;
16075 self.by_page().items()
16076 }
16077
16078 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
16082 self.0.request.site_search_engine = v.into();
16083 self
16084 }
16085
16086 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16088 self.0.request.page_size = v.into();
16089 self
16090 }
16091
16092 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16094 self.0.request.page_token = v.into();
16095 self
16096 }
16097 }
16098
16099 #[doc(hidden)]
16100 impl crate::RequestBuilder for FetchDomainVerificationStatus {
16101 fn request_options(&mut self) -> &mut crate::RequestOptions {
16102 &mut self.0.options
16103 }
16104 }
16105
16106 #[derive(Clone, Debug)]
16127 pub struct ListOperations(
16128 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16129 );
16130
16131 impl ListOperations {
16132 pub(crate) fn new(
16133 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16134 ) -> Self {
16135 Self(RequestBuilder::new(stub))
16136 }
16137
16138 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16140 mut self,
16141 v: V,
16142 ) -> Self {
16143 self.0.request = v.into();
16144 self
16145 }
16146
16147 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16149 self.0.options = v.into();
16150 self
16151 }
16152
16153 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16155 (*self.0.stub)
16156 .list_operations(self.0.request, self.0.options)
16157 .await
16158 .map(crate::Response::into_body)
16159 }
16160
16161 pub fn by_page(
16163 self,
16164 ) -> impl google_cloud_gax::paginator::Paginator<
16165 google_cloud_longrunning::model::ListOperationsResponse,
16166 crate::Error,
16167 > {
16168 use std::clone::Clone;
16169 let token = self.0.request.page_token.clone();
16170 let execute = move |token: String| {
16171 let mut builder = self.clone();
16172 builder.0.request = builder.0.request.set_page_token(token);
16173 builder.send()
16174 };
16175 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16176 }
16177
16178 pub fn by_item(
16180 self,
16181 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16182 google_cloud_longrunning::model::ListOperationsResponse,
16183 crate::Error,
16184 > {
16185 use google_cloud_gax::paginator::Paginator;
16186 self.by_page().items()
16187 }
16188
16189 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16191 self.0.request.name = v.into();
16192 self
16193 }
16194
16195 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16197 self.0.request.filter = v.into();
16198 self
16199 }
16200
16201 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16203 self.0.request.page_size = v.into();
16204 self
16205 }
16206
16207 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16209 self.0.request.page_token = v.into();
16210 self
16211 }
16212
16213 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16215 self.0.request.return_partial_success = v.into();
16216 self
16217 }
16218 }
16219
16220 #[doc(hidden)]
16221 impl crate::RequestBuilder for ListOperations {
16222 fn request_options(&mut self) -> &mut crate::RequestOptions {
16223 &mut self.0.options
16224 }
16225 }
16226
16227 #[derive(Clone, Debug)]
16244 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16245
16246 impl GetOperation {
16247 pub(crate) fn new(
16248 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16249 ) -> Self {
16250 Self(RequestBuilder::new(stub))
16251 }
16252
16253 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16255 mut self,
16256 v: V,
16257 ) -> Self {
16258 self.0.request = v.into();
16259 self
16260 }
16261
16262 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16264 self.0.options = v.into();
16265 self
16266 }
16267
16268 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16270 (*self.0.stub)
16271 .get_operation(self.0.request, self.0.options)
16272 .await
16273 .map(crate::Response::into_body)
16274 }
16275
16276 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16278 self.0.request.name = v.into();
16279 self
16280 }
16281 }
16282
16283 #[doc(hidden)]
16284 impl crate::RequestBuilder for GetOperation {
16285 fn request_options(&mut self) -> &mut crate::RequestOptions {
16286 &mut self.0.options
16287 }
16288 }
16289
16290 #[derive(Clone, Debug)]
16307 pub struct CancelOperation(
16308 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16309 );
16310
16311 impl CancelOperation {
16312 pub(crate) fn new(
16313 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16314 ) -> Self {
16315 Self(RequestBuilder::new(stub))
16316 }
16317
16318 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16320 mut self,
16321 v: V,
16322 ) -> Self {
16323 self.0.request = v.into();
16324 self
16325 }
16326
16327 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16329 self.0.options = v.into();
16330 self
16331 }
16332
16333 pub async fn send(self) -> Result<()> {
16335 (*self.0.stub)
16336 .cancel_operation(self.0.request, self.0.options)
16337 .await
16338 .map(crate::Response::into_body)
16339 }
16340
16341 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16343 self.0.request.name = v.into();
16344 self
16345 }
16346 }
16347
16348 #[doc(hidden)]
16349 impl crate::RequestBuilder for CancelOperation {
16350 fn request_options(&mut self) -> &mut crate::RequestOptions {
16351 &mut self.0.options
16352 }
16353 }
16354}
16355
16356#[cfg(feature = "user-event-service")]
16358#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
16359pub mod user_event_service {
16360 use crate::Result;
16361
16362 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16376
16377 pub(crate) mod client {
16378 use super::super::super::client::UserEventService;
16379 pub struct Factory;
16380 impl crate::ClientFactory for Factory {
16381 type Client = UserEventService;
16382 type Credentials = gaxi::options::Credentials;
16383 async fn build(
16384 self,
16385 config: gaxi::options::ClientConfig,
16386 ) -> crate::ClientBuilderResult<Self::Client> {
16387 Self::Client::new(config).await
16388 }
16389 }
16390 }
16391
16392 #[derive(Clone, Debug)]
16394 pub(crate) struct RequestBuilder<R: std::default::Default> {
16395 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16396 request: R,
16397 options: crate::RequestOptions,
16398 }
16399
16400 impl<R> RequestBuilder<R>
16401 where
16402 R: std::default::Default,
16403 {
16404 pub(crate) fn new(
16405 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16406 ) -> Self {
16407 Self {
16408 stub,
16409 request: R::default(),
16410 options: crate::RequestOptions::default(),
16411 }
16412 }
16413 }
16414
16415 #[derive(Clone, Debug)]
16432 pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
16433
16434 impl WriteUserEvent {
16435 pub(crate) fn new(
16436 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16437 ) -> Self {
16438 Self(RequestBuilder::new(stub))
16439 }
16440
16441 pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
16443 self.0.request = v.into();
16444 self
16445 }
16446
16447 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16449 self.0.options = v.into();
16450 self
16451 }
16452
16453 pub async fn send(self) -> Result<crate::model::UserEvent> {
16455 (*self.0.stub)
16456 .write_user_event(self.0.request, self.0.options)
16457 .await
16458 .map(crate::Response::into_body)
16459 }
16460
16461 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16465 self.0.request.parent = v.into();
16466 self
16467 }
16468
16469 pub fn set_user_event<T>(mut self, v: T) -> Self
16473 where
16474 T: std::convert::Into<crate::model::UserEvent>,
16475 {
16476 self.0.request.user_event = std::option::Option::Some(v.into());
16477 self
16478 }
16479
16480 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
16484 where
16485 T: std::convert::Into<crate::model::UserEvent>,
16486 {
16487 self.0.request.user_event = v.map(|x| x.into());
16488 self
16489 }
16490
16491 pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
16493 self.0.request.write_async = v.into();
16494 self
16495 }
16496 }
16497
16498 #[doc(hidden)]
16499 impl crate::RequestBuilder for WriteUserEvent {
16500 fn request_options(&mut self) -> &mut crate::RequestOptions {
16501 &mut self.0.options
16502 }
16503 }
16504
16505 #[derive(Clone, Debug)]
16522 pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
16523
16524 impl CollectUserEvent {
16525 pub(crate) fn new(
16526 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16527 ) -> Self {
16528 Self(RequestBuilder::new(stub))
16529 }
16530
16531 pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
16533 mut self,
16534 v: V,
16535 ) -> Self {
16536 self.0.request = v.into();
16537 self
16538 }
16539
16540 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16542 self.0.options = v.into();
16543 self
16544 }
16545
16546 pub async fn send(self) -> Result<google_cloud_api::model::HttpBody> {
16548 (*self.0.stub)
16549 .collect_user_event(self.0.request, self.0.options)
16550 .await
16551 .map(crate::Response::into_body)
16552 }
16553
16554 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16558 self.0.request.parent = v.into();
16559 self
16560 }
16561
16562 pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
16566 self.0.request.user_event = v.into();
16567 self
16568 }
16569
16570 pub fn set_uri<T>(mut self, v: T) -> Self
16572 where
16573 T: std::convert::Into<std::string::String>,
16574 {
16575 self.0.request.uri = std::option::Option::Some(v.into());
16576 self
16577 }
16578
16579 pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
16581 where
16582 T: std::convert::Into<std::string::String>,
16583 {
16584 self.0.request.uri = v.map(|x| x.into());
16585 self
16586 }
16587
16588 pub fn set_ets<T>(mut self, v: T) -> Self
16590 where
16591 T: std::convert::Into<i64>,
16592 {
16593 self.0.request.ets = std::option::Option::Some(v.into());
16594 self
16595 }
16596
16597 pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
16599 where
16600 T: std::convert::Into<i64>,
16601 {
16602 self.0.request.ets = v.map(|x| x.into());
16603 self
16604 }
16605 }
16606
16607 #[doc(hidden)]
16608 impl crate::RequestBuilder for CollectUserEvent {
16609 fn request_options(&mut self) -> &mut crate::RequestOptions {
16610 &mut self.0.options
16611 }
16612 }
16613
16614 #[derive(Clone, Debug)]
16632 pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
16633
16634 impl PurgeUserEvents {
16635 pub(crate) fn new(
16636 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16637 ) -> Self {
16638 Self(RequestBuilder::new(stub))
16639 }
16640
16641 pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16643 self.0.request = v.into();
16644 self
16645 }
16646
16647 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16649 self.0.options = v.into();
16650 self
16651 }
16652
16653 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16660 (*self.0.stub)
16661 .purge_user_events(self.0.request, self.0.options)
16662 .await
16663 .map(crate::Response::into_body)
16664 }
16665
16666 pub fn poller(
16668 self,
16669 ) -> impl google_cloud_lro::Poller<
16670 crate::model::PurgeUserEventsResponse,
16671 crate::model::PurgeUserEventsMetadata,
16672 > {
16673 type Operation = google_cloud_lro::internal::Operation<
16674 crate::model::PurgeUserEventsResponse,
16675 crate::model::PurgeUserEventsMetadata,
16676 >;
16677 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16678 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16679 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16680 if let Some(ref mut details) = poller_options.tracing {
16681 details.method_name = "google_cloud_discoveryengine_v1::client::UserEventService::purge_user_events::until_done";
16682 }
16683
16684 let stub = self.0.stub.clone();
16685 let mut options = self.0.options.clone();
16686 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16687 let query = move |name| {
16688 let stub = stub.clone();
16689 let options = options.clone();
16690 async {
16691 let op = GetOperation::new(stub)
16692 .set_name(name)
16693 .with_options(options)
16694 .send()
16695 .await?;
16696 Ok(Operation::new(op))
16697 }
16698 };
16699
16700 let start = move || async {
16701 let op = self.send().await?;
16702 Ok(Operation::new(op))
16703 };
16704
16705 use google_cloud_lro::internal::PollerExt;
16706 {
16707 google_cloud_lro::internal::new_poller(
16708 polling_error_policy,
16709 polling_backoff_policy,
16710 start,
16711 query,
16712 )
16713 }
16714 .with_options(poller_options)
16715 }
16716
16717 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16721 self.0.request.parent = v.into();
16722 self
16723 }
16724
16725 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16729 self.0.request.filter = v.into();
16730 self
16731 }
16732
16733 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16735 self.0.request.force = v.into();
16736 self
16737 }
16738 }
16739
16740 #[doc(hidden)]
16741 impl crate::RequestBuilder for PurgeUserEvents {
16742 fn request_options(&mut self) -> &mut crate::RequestOptions {
16743 &mut self.0.options
16744 }
16745 }
16746
16747 #[derive(Clone, Debug)]
16765 pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
16766
16767 impl ImportUserEvents {
16768 pub(crate) fn new(
16769 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16770 ) -> Self {
16771 Self(RequestBuilder::new(stub))
16772 }
16773
16774 pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
16776 mut self,
16777 v: V,
16778 ) -> Self {
16779 self.0.request = v.into();
16780 self
16781 }
16782
16783 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16785 self.0.options = v.into();
16786 self
16787 }
16788
16789 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16796 (*self.0.stub)
16797 .import_user_events(self.0.request, self.0.options)
16798 .await
16799 .map(crate::Response::into_body)
16800 }
16801
16802 pub fn poller(
16804 self,
16805 ) -> impl google_cloud_lro::Poller<
16806 crate::model::ImportUserEventsResponse,
16807 crate::model::ImportUserEventsMetadata,
16808 > {
16809 type Operation = google_cloud_lro::internal::Operation<
16810 crate::model::ImportUserEventsResponse,
16811 crate::model::ImportUserEventsMetadata,
16812 >;
16813 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16814 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16815 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16816 if let Some(ref mut details) = poller_options.tracing {
16817 details.method_name = "google_cloud_discoveryengine_v1::client::UserEventService::import_user_events::until_done";
16818 }
16819
16820 let stub = self.0.stub.clone();
16821 let mut options = self.0.options.clone();
16822 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16823 let query = move |name| {
16824 let stub = stub.clone();
16825 let options = options.clone();
16826 async {
16827 let op = GetOperation::new(stub)
16828 .set_name(name)
16829 .with_options(options)
16830 .send()
16831 .await?;
16832 Ok(Operation::new(op))
16833 }
16834 };
16835
16836 let start = move || async {
16837 let op = self.send().await?;
16838 Ok(Operation::new(op))
16839 };
16840
16841 use google_cloud_lro::internal::PollerExt;
16842 {
16843 google_cloud_lro::internal::new_poller(
16844 polling_error_policy,
16845 polling_backoff_policy,
16846 start,
16847 query,
16848 )
16849 }
16850 .with_options(poller_options)
16851 }
16852
16853 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16857 self.0.request.parent = v.into();
16858 self
16859 }
16860
16861 pub fn set_error_config<T>(mut self, v: T) -> Self
16863 where
16864 T: std::convert::Into<crate::model::ImportErrorConfig>,
16865 {
16866 self.0.request.error_config = std::option::Option::Some(v.into());
16867 self
16868 }
16869
16870 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
16872 where
16873 T: std::convert::Into<crate::model::ImportErrorConfig>,
16874 {
16875 self.0.request.error_config = v.map(|x| x.into());
16876 self
16877 }
16878
16879 pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
16884 mut self,
16885 v: T,
16886 ) -> Self {
16887 self.0.request.source = v.into();
16888 self
16889 }
16890
16891 pub fn set_inline_source<
16897 T: std::convert::Into<
16898 std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
16899 >,
16900 >(
16901 mut self,
16902 v: T,
16903 ) -> Self {
16904 self.0.request = self.0.request.set_inline_source(v);
16905 self
16906 }
16907
16908 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
16914 mut self,
16915 v: T,
16916 ) -> Self {
16917 self.0.request = self.0.request.set_gcs_source(v);
16918 self
16919 }
16920
16921 pub fn set_bigquery_source<
16927 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
16928 >(
16929 mut self,
16930 v: T,
16931 ) -> Self {
16932 self.0.request = self.0.request.set_bigquery_source(v);
16933 self
16934 }
16935 }
16936
16937 #[doc(hidden)]
16938 impl crate::RequestBuilder for ImportUserEvents {
16939 fn request_options(&mut self) -> &mut crate::RequestOptions {
16940 &mut self.0.options
16941 }
16942 }
16943
16944 #[derive(Clone, Debug)]
16965 pub struct ListOperations(
16966 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16967 );
16968
16969 impl ListOperations {
16970 pub(crate) fn new(
16971 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16972 ) -> Self {
16973 Self(RequestBuilder::new(stub))
16974 }
16975
16976 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16978 mut self,
16979 v: V,
16980 ) -> Self {
16981 self.0.request = v.into();
16982 self
16983 }
16984
16985 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16987 self.0.options = v.into();
16988 self
16989 }
16990
16991 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16993 (*self.0.stub)
16994 .list_operations(self.0.request, self.0.options)
16995 .await
16996 .map(crate::Response::into_body)
16997 }
16998
16999 pub fn by_page(
17001 self,
17002 ) -> impl google_cloud_gax::paginator::Paginator<
17003 google_cloud_longrunning::model::ListOperationsResponse,
17004 crate::Error,
17005 > {
17006 use std::clone::Clone;
17007 let token = self.0.request.page_token.clone();
17008 let execute = move |token: String| {
17009 let mut builder = self.clone();
17010 builder.0.request = builder.0.request.set_page_token(token);
17011 builder.send()
17012 };
17013 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17014 }
17015
17016 pub fn by_item(
17018 self,
17019 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17020 google_cloud_longrunning::model::ListOperationsResponse,
17021 crate::Error,
17022 > {
17023 use google_cloud_gax::paginator::Paginator;
17024 self.by_page().items()
17025 }
17026
17027 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17029 self.0.request.name = v.into();
17030 self
17031 }
17032
17033 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17035 self.0.request.filter = v.into();
17036 self
17037 }
17038
17039 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17041 self.0.request.page_size = v.into();
17042 self
17043 }
17044
17045 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17047 self.0.request.page_token = v.into();
17048 self
17049 }
17050
17051 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17053 self.0.request.return_partial_success = v.into();
17054 self
17055 }
17056 }
17057
17058 #[doc(hidden)]
17059 impl crate::RequestBuilder for ListOperations {
17060 fn request_options(&mut self) -> &mut crate::RequestOptions {
17061 &mut self.0.options
17062 }
17063 }
17064
17065 #[derive(Clone, Debug)]
17082 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17083
17084 impl GetOperation {
17085 pub(crate) fn new(
17086 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17087 ) -> Self {
17088 Self(RequestBuilder::new(stub))
17089 }
17090
17091 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17093 mut self,
17094 v: V,
17095 ) -> Self {
17096 self.0.request = v.into();
17097 self
17098 }
17099
17100 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17102 self.0.options = v.into();
17103 self
17104 }
17105
17106 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17108 (*self.0.stub)
17109 .get_operation(self.0.request, self.0.options)
17110 .await
17111 .map(crate::Response::into_body)
17112 }
17113
17114 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17116 self.0.request.name = v.into();
17117 self
17118 }
17119 }
17120
17121 #[doc(hidden)]
17122 impl crate::RequestBuilder for GetOperation {
17123 fn request_options(&mut self) -> &mut crate::RequestOptions {
17124 &mut self.0.options
17125 }
17126 }
17127
17128 #[derive(Clone, Debug)]
17145 pub struct CancelOperation(
17146 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17147 );
17148
17149 impl CancelOperation {
17150 pub(crate) fn new(
17151 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17152 ) -> Self {
17153 Self(RequestBuilder::new(stub))
17154 }
17155
17156 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17158 mut self,
17159 v: V,
17160 ) -> Self {
17161 self.0.request = v.into();
17162 self
17163 }
17164
17165 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17167 self.0.options = v.into();
17168 self
17169 }
17170
17171 pub async fn send(self) -> Result<()> {
17173 (*self.0.stub)
17174 .cancel_operation(self.0.request, self.0.options)
17175 .await
17176 .map(crate::Response::into_body)
17177 }
17178
17179 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17181 self.0.request.name = v.into();
17182 self
17183 }
17184 }
17185
17186 #[doc(hidden)]
17187 impl crate::RequestBuilder for CancelOperation {
17188 fn request_options(&mut self) -> &mut crate::RequestOptions {
17189 &mut self.0.options
17190 }
17191 }
17192}
17193
17194#[cfg(feature = "user-license-service")]
17196#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
17197pub mod user_license_service {
17198 use crate::Result;
17199
17200 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
17214
17215 pub(crate) mod client {
17216 use super::super::super::client::UserLicenseService;
17217 pub struct Factory;
17218 impl crate::ClientFactory for Factory {
17219 type Client = UserLicenseService;
17220 type Credentials = gaxi::options::Credentials;
17221 async fn build(
17222 self,
17223 config: gaxi::options::ClientConfig,
17224 ) -> crate::ClientBuilderResult<Self::Client> {
17225 Self::Client::new(config).await
17226 }
17227 }
17228 }
17229
17230 #[derive(Clone, Debug)]
17232 pub(crate) struct RequestBuilder<R: std::default::Default> {
17233 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17234 request: R,
17235 options: crate::RequestOptions,
17236 }
17237
17238 impl<R> RequestBuilder<R>
17239 where
17240 R: std::default::Default,
17241 {
17242 pub(crate) fn new(
17243 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17244 ) -> Self {
17245 Self {
17246 stub,
17247 request: R::default(),
17248 options: crate::RequestOptions::default(),
17249 }
17250 }
17251 }
17252
17253 #[derive(Clone, Debug)]
17274 pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
17275
17276 impl ListUserLicenses {
17277 pub(crate) fn new(
17278 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17279 ) -> Self {
17280 Self(RequestBuilder::new(stub))
17281 }
17282
17283 pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
17285 mut self,
17286 v: V,
17287 ) -> Self {
17288 self.0.request = v.into();
17289 self
17290 }
17291
17292 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17294 self.0.options = v.into();
17295 self
17296 }
17297
17298 pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
17300 (*self.0.stub)
17301 .list_user_licenses(self.0.request, self.0.options)
17302 .await
17303 .map(crate::Response::into_body)
17304 }
17305
17306 pub fn by_page(
17308 self,
17309 ) -> impl google_cloud_gax::paginator::Paginator<
17310 crate::model::ListUserLicensesResponse,
17311 crate::Error,
17312 > {
17313 use std::clone::Clone;
17314 let token = self.0.request.page_token.clone();
17315 let execute = move |token: String| {
17316 let mut builder = self.clone();
17317 builder.0.request = builder.0.request.set_page_token(token);
17318 builder.send()
17319 };
17320 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17321 }
17322
17323 pub fn by_item(
17325 self,
17326 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17327 crate::model::ListUserLicensesResponse,
17328 crate::Error,
17329 > {
17330 use google_cloud_gax::paginator::Paginator;
17331 self.by_page().items()
17332 }
17333
17334 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17338 self.0.request.parent = v.into();
17339 self
17340 }
17341
17342 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17344 self.0.request.page_size = v.into();
17345 self
17346 }
17347
17348 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17350 self.0.request.page_token = v.into();
17351 self
17352 }
17353
17354 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17356 self.0.request.filter = v.into();
17357 self
17358 }
17359 }
17360
17361 #[doc(hidden)]
17362 impl crate::RequestBuilder for ListUserLicenses {
17363 fn request_options(&mut self) -> &mut crate::RequestOptions {
17364 &mut self.0.options
17365 }
17366 }
17367
17368 #[derive(Clone, Debug)]
17386 pub struct BatchUpdateUserLicenses(
17387 RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
17388 );
17389
17390 impl BatchUpdateUserLicenses {
17391 pub(crate) fn new(
17392 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17393 ) -> Self {
17394 Self(RequestBuilder::new(stub))
17395 }
17396
17397 pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
17399 mut self,
17400 v: V,
17401 ) -> Self {
17402 self.0.request = v.into();
17403 self
17404 }
17405
17406 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17408 self.0.options = v.into();
17409 self
17410 }
17411
17412 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17419 (*self.0.stub)
17420 .batch_update_user_licenses(self.0.request, self.0.options)
17421 .await
17422 .map(crate::Response::into_body)
17423 }
17424
17425 pub fn poller(
17427 self,
17428 ) -> impl google_cloud_lro::Poller<
17429 crate::model::BatchUpdateUserLicensesResponse,
17430 crate::model::BatchUpdateUserLicensesMetadata,
17431 > {
17432 type Operation = google_cloud_lro::internal::Operation<
17433 crate::model::BatchUpdateUserLicensesResponse,
17434 crate::model::BatchUpdateUserLicensesMetadata,
17435 >;
17436 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
17437 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
17438 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
17439 if let Some(ref mut details) = poller_options.tracing {
17440 details.method_name = "google_cloud_discoveryengine_v1::client::UserLicenseService::batch_update_user_licenses::until_done";
17441 }
17442
17443 let stub = self.0.stub.clone();
17444 let mut options = self.0.options.clone();
17445 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
17446 let query = move |name| {
17447 let stub = stub.clone();
17448 let options = options.clone();
17449 async {
17450 let op = GetOperation::new(stub)
17451 .set_name(name)
17452 .with_options(options)
17453 .send()
17454 .await?;
17455 Ok(Operation::new(op))
17456 }
17457 };
17458
17459 let start = move || async {
17460 let op = self.send().await?;
17461 Ok(Operation::new(op))
17462 };
17463
17464 use google_cloud_lro::internal::PollerExt;
17465 {
17466 google_cloud_lro::internal::new_poller(
17467 polling_error_policy,
17468 polling_backoff_policy,
17469 start,
17470 query,
17471 )
17472 }
17473 .with_options(poller_options)
17474 }
17475
17476 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17480 self.0.request.parent = v.into();
17481 self
17482 }
17483
17484 pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
17486 self.0.request.delete_unassigned_user_licenses = v.into();
17487 self
17488 }
17489
17490 pub fn set_source<
17495 T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
17496 >(
17497 mut self,
17498 v: T,
17499 ) -> Self {
17500 self.0.request.source = v.into();
17501 self
17502 }
17503
17504 pub fn set_inline_source<
17510 T: std::convert::Into<
17511 std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
17512 >,
17513 >(
17514 mut self,
17515 v: T,
17516 ) -> Self {
17517 self.0.request = self.0.request.set_inline_source(v);
17518 self
17519 }
17520 }
17521
17522 #[doc(hidden)]
17523 impl crate::RequestBuilder for BatchUpdateUserLicenses {
17524 fn request_options(&mut self) -> &mut crate::RequestOptions {
17525 &mut self.0.options
17526 }
17527 }
17528
17529 #[derive(Clone, Debug)]
17550 pub struct ListOperations(
17551 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17552 );
17553
17554 impl ListOperations {
17555 pub(crate) fn new(
17556 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17557 ) -> Self {
17558 Self(RequestBuilder::new(stub))
17559 }
17560
17561 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17563 mut self,
17564 v: V,
17565 ) -> Self {
17566 self.0.request = v.into();
17567 self
17568 }
17569
17570 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17572 self.0.options = v.into();
17573 self
17574 }
17575
17576 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17578 (*self.0.stub)
17579 .list_operations(self.0.request, self.0.options)
17580 .await
17581 .map(crate::Response::into_body)
17582 }
17583
17584 pub fn by_page(
17586 self,
17587 ) -> impl google_cloud_gax::paginator::Paginator<
17588 google_cloud_longrunning::model::ListOperationsResponse,
17589 crate::Error,
17590 > {
17591 use std::clone::Clone;
17592 let token = self.0.request.page_token.clone();
17593 let execute = move |token: String| {
17594 let mut builder = self.clone();
17595 builder.0.request = builder.0.request.set_page_token(token);
17596 builder.send()
17597 };
17598 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17599 }
17600
17601 pub fn by_item(
17603 self,
17604 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17605 google_cloud_longrunning::model::ListOperationsResponse,
17606 crate::Error,
17607 > {
17608 use google_cloud_gax::paginator::Paginator;
17609 self.by_page().items()
17610 }
17611
17612 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17614 self.0.request.name = v.into();
17615 self
17616 }
17617
17618 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17620 self.0.request.filter = v.into();
17621 self
17622 }
17623
17624 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17626 self.0.request.page_size = v.into();
17627 self
17628 }
17629
17630 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17632 self.0.request.page_token = v.into();
17633 self
17634 }
17635
17636 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17638 self.0.request.return_partial_success = v.into();
17639 self
17640 }
17641 }
17642
17643 #[doc(hidden)]
17644 impl crate::RequestBuilder for ListOperations {
17645 fn request_options(&mut self) -> &mut crate::RequestOptions {
17646 &mut self.0.options
17647 }
17648 }
17649
17650 #[derive(Clone, Debug)]
17667 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17668
17669 impl GetOperation {
17670 pub(crate) fn new(
17671 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17672 ) -> Self {
17673 Self(RequestBuilder::new(stub))
17674 }
17675
17676 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17678 mut self,
17679 v: V,
17680 ) -> Self {
17681 self.0.request = v.into();
17682 self
17683 }
17684
17685 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17687 self.0.options = v.into();
17688 self
17689 }
17690
17691 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17693 (*self.0.stub)
17694 .get_operation(self.0.request, self.0.options)
17695 .await
17696 .map(crate::Response::into_body)
17697 }
17698
17699 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17701 self.0.request.name = v.into();
17702 self
17703 }
17704 }
17705
17706 #[doc(hidden)]
17707 impl crate::RequestBuilder for GetOperation {
17708 fn request_options(&mut self) -> &mut crate::RequestOptions {
17709 &mut self.0.options
17710 }
17711 }
17712
17713 #[derive(Clone, Debug)]
17730 pub struct CancelOperation(
17731 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17732 );
17733
17734 impl CancelOperation {
17735 pub(crate) fn new(
17736 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17737 ) -> Self {
17738 Self(RequestBuilder::new(stub))
17739 }
17740
17741 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17743 mut self,
17744 v: V,
17745 ) -> Self {
17746 self.0.request = v.into();
17747 self
17748 }
17749
17750 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17752 self.0.options = v.into();
17753 self
17754 }
17755
17756 pub async fn send(self) -> Result<()> {
17758 (*self.0.stub)
17759 .cancel_operation(self.0.request, self.0.options)
17760 .await
17761 .map(crate::Response::into_body)
17762 }
17763
17764 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17766 self.0.request.name = v.into();
17767 self
17768 }
17769 }
17770
17771 #[doc(hidden)]
17772 impl crate::RequestBuilder for CancelOperation {
17773 fn request_options(&mut self) -> &mut crate::RequestOptions {
17774 &mut self.0.options
17775 }
17776 }
17777}