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)]
96 pub struct StreamAssist(RequestBuilder<crate::model::StreamAssistRequest>);
97
98 impl StreamAssist {
99 pub(crate) fn new(
100 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
101 ) -> Self {
102 Self(RequestBuilder::new(stub))
103 }
104
105 pub fn with_request<V: Into<crate::model::StreamAssistRequest>>(mut self, v: V) -> Self {
107 self.0.request = v.into();
108 self
109 }
110
111 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
113 self.0.options = v.into();
114 self
115 }
116
117 pub async fn send(
119 self,
120 ) -> Result<google_cloud_gax::streaming::ResponseStream<crate::model::StreamAssistResponse>>
121 {
122 (*self.0.stub)
123 .stream_assist(self.0.request, self.0.options)
124 .await
125 }
126
127 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
131 self.0.request.name = v.into();
132 self
133 }
134
135 pub fn set_query<T>(mut self, v: T) -> Self
137 where
138 T: std::convert::Into<crate::model::Query>,
139 {
140 self.0.request.query = std::option::Option::Some(v.into());
141 self
142 }
143
144 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
146 where
147 T: std::convert::Into<crate::model::Query>,
148 {
149 self.0.request.query = v.map(|x| x.into());
150 self
151 }
152
153 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
155 self.0.request.session = v.into();
156 self
157 }
158
159 pub fn set_user_metadata<T>(mut self, v: T) -> Self
161 where
162 T: std::convert::Into<crate::model::AssistUserMetadata>,
163 {
164 self.0.request.user_metadata = std::option::Option::Some(v.into());
165 self
166 }
167
168 pub fn set_or_clear_user_metadata<T>(mut self, v: std::option::Option<T>) -> Self
170 where
171 T: std::convert::Into<crate::model::AssistUserMetadata>,
172 {
173 self.0.request.user_metadata = v.map(|x| x.into());
174 self
175 }
176
177 pub fn set_agents_spec<T>(mut self, v: T) -> Self
179 where
180 T: std::convert::Into<crate::model::stream_assist_request::AgentsSpec>,
181 {
182 self.0.request.agents_spec = std::option::Option::Some(v.into());
183 self
184 }
185
186 pub fn set_or_clear_agents_spec<T>(mut self, v: std::option::Option<T>) -> Self
188 where
189 T: std::convert::Into<crate::model::stream_assist_request::AgentsSpec>,
190 {
191 self.0.request.agents_spec = v.map(|x| x.into());
192 self
193 }
194
195 pub fn set_tools_spec<T>(mut self, v: T) -> Self
197 where
198 T: std::convert::Into<crate::model::stream_assist_request::ToolsSpec>,
199 {
200 self.0.request.tools_spec = std::option::Option::Some(v.into());
201 self
202 }
203
204 pub fn set_or_clear_tools_spec<T>(mut self, v: std::option::Option<T>) -> Self
206 where
207 T: std::convert::Into<crate::model::stream_assist_request::ToolsSpec>,
208 {
209 self.0.request.tools_spec = v.map(|x| x.into());
210 self
211 }
212
213 pub fn set_generation_spec<T>(mut self, v: T) -> Self
215 where
216 T: std::convert::Into<crate::model::stream_assist_request::GenerationSpec>,
217 {
218 self.0.request.generation_spec = std::option::Option::Some(v.into());
219 self
220 }
221
222 pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
224 where
225 T: std::convert::Into<crate::model::stream_assist_request::GenerationSpec>,
226 {
227 self.0.request.generation_spec = v.map(|x| x.into());
228 self
229 }
230 }
231
232 #[doc(hidden)]
233 impl crate::RequestBuilder for StreamAssist {
234 fn request_options(&mut self) -> &mut crate::RequestOptions {
235 &mut self.0.options
236 }
237 }
238
239 #[derive(Clone, Debug)]
260 pub struct ListOperations(
261 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
262 );
263
264 impl ListOperations {
265 pub(crate) fn new(
266 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
267 ) -> Self {
268 Self(RequestBuilder::new(stub))
269 }
270
271 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
273 mut self,
274 v: V,
275 ) -> Self {
276 self.0.request = v.into();
277 self
278 }
279
280 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
282 self.0.options = v.into();
283 self
284 }
285
286 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
288 (*self.0.stub)
289 .list_operations(self.0.request, self.0.options)
290 .await
291 .map(crate::Response::into_body)
292 }
293
294 pub fn by_page(
296 self,
297 ) -> impl google_cloud_gax::paginator::Paginator<
298 google_cloud_longrunning::model::ListOperationsResponse,
299 crate::Error,
300 > {
301 use std::clone::Clone;
302 let token = self.0.request.page_token.clone();
303 let execute = move |token: String| {
304 let mut builder = self.clone();
305 builder.0.request = builder.0.request.set_page_token(token);
306 builder.send()
307 };
308 google_cloud_gax::paginator::internal::new_paginator(token, execute)
309 }
310
311 pub fn by_item(
313 self,
314 ) -> impl google_cloud_gax::paginator::ItemPaginator<
315 google_cloud_longrunning::model::ListOperationsResponse,
316 crate::Error,
317 > {
318 use google_cloud_gax::paginator::Paginator;
319 self.by_page().items()
320 }
321
322 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
324 self.0.request.name = v.into();
325 self
326 }
327
328 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
330 self.0.request.filter = v.into();
331 self
332 }
333
334 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
336 self.0.request.page_size = v.into();
337 self
338 }
339
340 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
342 self.0.request.page_token = v.into();
343 self
344 }
345
346 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
348 self.0.request.return_partial_success = v.into();
349 self
350 }
351 }
352
353 #[doc(hidden)]
354 impl crate::RequestBuilder for ListOperations {
355 fn request_options(&mut self) -> &mut crate::RequestOptions {
356 &mut self.0.options
357 }
358 }
359
360 #[derive(Clone, Debug)]
377 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
378
379 impl GetOperation {
380 pub(crate) fn new(
381 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
382 ) -> Self {
383 Self(RequestBuilder::new(stub))
384 }
385
386 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
388 mut self,
389 v: V,
390 ) -> Self {
391 self.0.request = v.into();
392 self
393 }
394
395 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
397 self.0.options = v.into();
398 self
399 }
400
401 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
403 (*self.0.stub)
404 .get_operation(self.0.request, self.0.options)
405 .await
406 .map(crate::Response::into_body)
407 }
408
409 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
411 self.0.request.name = v.into();
412 self
413 }
414 }
415
416 #[doc(hidden)]
417 impl crate::RequestBuilder for GetOperation {
418 fn request_options(&mut self) -> &mut crate::RequestOptions {
419 &mut self.0.options
420 }
421 }
422
423 #[derive(Clone, Debug)]
440 pub struct CancelOperation(
441 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
442 );
443
444 impl CancelOperation {
445 pub(crate) fn new(
446 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
447 ) -> Self {
448 Self(RequestBuilder::new(stub))
449 }
450
451 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
453 mut self,
454 v: V,
455 ) -> Self {
456 self.0.request = v.into();
457 self
458 }
459
460 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
462 self.0.options = v.into();
463 self
464 }
465
466 pub async fn send(self) -> Result<()> {
468 (*self.0.stub)
469 .cancel_operation(self.0.request, self.0.options)
470 .await
471 .map(crate::Response::into_body)
472 }
473
474 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
476 self.0.request.name = v.into();
477 self
478 }
479 }
480
481 #[doc(hidden)]
482 impl crate::RequestBuilder for CancelOperation {
483 fn request_options(&mut self) -> &mut crate::RequestOptions {
484 &mut self.0.options
485 }
486 }
487}
488
489#[cfg(feature = "cmek-config-service")]
491#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
492pub mod cmek_config_service {
493 use crate::Result;
494
495 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
509
510 pub(crate) mod client {
511 use super::super::super::client::CmekConfigService;
512 pub struct Factory;
513 impl crate::ClientFactory for Factory {
514 type Client = CmekConfigService;
515 type Credentials = gaxi::options::Credentials;
516 async fn build(
517 self,
518 config: gaxi::options::ClientConfig,
519 ) -> crate::ClientBuilderResult<Self::Client> {
520 Self::Client::new(config).await
521 }
522 }
523 }
524
525 #[derive(Clone, Debug)]
527 pub(crate) struct RequestBuilder<R: std::default::Default> {
528 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
529 request: R,
530 options: crate::RequestOptions,
531 }
532
533 impl<R> RequestBuilder<R>
534 where
535 R: std::default::Default,
536 {
537 pub(crate) fn new(
538 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
539 ) -> Self {
540 Self {
541 stub,
542 request: R::default(),
543 options: crate::RequestOptions::default(),
544 }
545 }
546 }
547
548 #[derive(Clone, Debug)]
566 pub struct UpdateCmekConfig(RequestBuilder<crate::model::UpdateCmekConfigRequest>);
567
568 impl UpdateCmekConfig {
569 pub(crate) fn new(
570 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
571 ) -> Self {
572 Self(RequestBuilder::new(stub))
573 }
574
575 pub fn with_request<V: Into<crate::model::UpdateCmekConfigRequest>>(
577 mut self,
578 v: V,
579 ) -> Self {
580 self.0.request = v.into();
581 self
582 }
583
584 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
586 self.0.options = v.into();
587 self
588 }
589
590 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
597 (*self.0.stub)
598 .update_cmek_config(self.0.request, self.0.options)
599 .await
600 .map(crate::Response::into_body)
601 }
602
603 pub fn poller(
605 self,
606 ) -> impl google_cloud_lro::Poller<
607 crate::model::CmekConfig,
608 crate::model::UpdateCmekConfigMetadata,
609 > {
610 type Operation = google_cloud_lro::internal::Operation<
611 crate::model::CmekConfig,
612 crate::model::UpdateCmekConfigMetadata,
613 >;
614 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
615 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
616 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
617 if let Some(ref mut details) = poller_options.tracing {
618 details.method_name = "google_cloud_discoveryengine_v1::client::CmekConfigService::update_cmek_config::until_done";
619 }
620
621 let stub = self.0.stub.clone();
622 let mut options = self.0.options.clone();
623 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
624 let query = move |name| {
625 let stub = stub.clone();
626 let options = options.clone();
627 async {
628 let op = GetOperation::new(stub)
629 .set_name(name)
630 .with_options(options)
631 .send()
632 .await?;
633 Ok(Operation::new(op))
634 }
635 };
636
637 let start = move || async {
638 let op = self.send().await?;
639 Ok(Operation::new(op))
640 };
641
642 use google_cloud_lro::internal::PollerExt;
643 {
644 google_cloud_lro::internal::new_poller(
645 polling_error_policy,
646 polling_backoff_policy,
647 start,
648 query,
649 )
650 }
651 .with_options(poller_options)
652 }
653
654 pub fn set_config<T>(mut self, v: T) -> Self
658 where
659 T: std::convert::Into<crate::model::CmekConfig>,
660 {
661 self.0.request.config = std::option::Option::Some(v.into());
662 self
663 }
664
665 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
669 where
670 T: std::convert::Into<crate::model::CmekConfig>,
671 {
672 self.0.request.config = v.map(|x| x.into());
673 self
674 }
675
676 pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
678 self.0.request.set_default = v.into();
679 self
680 }
681 }
682
683 #[doc(hidden)]
684 impl crate::RequestBuilder for UpdateCmekConfig {
685 fn request_options(&mut self) -> &mut crate::RequestOptions {
686 &mut self.0.options
687 }
688 }
689
690 #[derive(Clone, Debug)]
707 pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
708
709 impl GetCmekConfig {
710 pub(crate) fn new(
711 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
712 ) -> Self {
713 Self(RequestBuilder::new(stub))
714 }
715
716 pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
718 self.0.request = v.into();
719 self
720 }
721
722 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
724 self.0.options = v.into();
725 self
726 }
727
728 pub async fn send(self) -> Result<crate::model::CmekConfig> {
730 (*self.0.stub)
731 .get_cmek_config(self.0.request, self.0.options)
732 .await
733 .map(crate::Response::into_body)
734 }
735
736 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
740 self.0.request.name = v.into();
741 self
742 }
743 }
744
745 #[doc(hidden)]
746 impl crate::RequestBuilder for GetCmekConfig {
747 fn request_options(&mut self) -> &mut crate::RequestOptions {
748 &mut self.0.options
749 }
750 }
751
752 #[derive(Clone, Debug)]
769 pub struct ListCmekConfigs(RequestBuilder<crate::model::ListCmekConfigsRequest>);
770
771 impl ListCmekConfigs {
772 pub(crate) fn new(
773 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
774 ) -> Self {
775 Self(RequestBuilder::new(stub))
776 }
777
778 pub fn with_request<V: Into<crate::model::ListCmekConfigsRequest>>(mut self, v: V) -> Self {
780 self.0.request = v.into();
781 self
782 }
783
784 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
786 self.0.options = v.into();
787 self
788 }
789
790 pub async fn send(self) -> Result<crate::model::ListCmekConfigsResponse> {
792 (*self.0.stub)
793 .list_cmek_configs(self.0.request, self.0.options)
794 .await
795 .map(crate::Response::into_body)
796 }
797
798 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
802 self.0.request.parent = v.into();
803 self
804 }
805 }
806
807 #[doc(hidden)]
808 impl crate::RequestBuilder for ListCmekConfigs {
809 fn request_options(&mut self) -> &mut crate::RequestOptions {
810 &mut self.0.options
811 }
812 }
813
814 #[derive(Clone, Debug)]
832 pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
833
834 impl DeleteCmekConfig {
835 pub(crate) fn new(
836 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
837 ) -> Self {
838 Self(RequestBuilder::new(stub))
839 }
840
841 pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
843 mut self,
844 v: V,
845 ) -> Self {
846 self.0.request = v.into();
847 self
848 }
849
850 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
852 self.0.options = v.into();
853 self
854 }
855
856 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
863 (*self.0.stub)
864 .delete_cmek_config(self.0.request, self.0.options)
865 .await
866 .map(crate::Response::into_body)
867 }
868
869 pub fn poller(
871 self,
872 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
873 type Operation = google_cloud_lro::internal::Operation<
874 wkt::Empty,
875 crate::model::DeleteCmekConfigMetadata,
876 >;
877 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
878 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
879 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
880 if let Some(ref mut details) = poller_options.tracing {
881 details.method_name = "google_cloud_discoveryengine_v1::client::CmekConfigService::delete_cmek_config::until_done";
882 }
883
884 let stub = self.0.stub.clone();
885 let mut options = self.0.options.clone();
886 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
887 let query = move |name| {
888 let stub = stub.clone();
889 let options = options.clone();
890 async {
891 let op = GetOperation::new(stub)
892 .set_name(name)
893 .with_options(options)
894 .send()
895 .await?;
896 Ok(Operation::new(op))
897 }
898 };
899
900 let start = move || async {
901 let op = self.send().await?;
902 Ok(Operation::new(op))
903 };
904
905 use google_cloud_lro::internal::PollerExt;
906 {
907 google_cloud_lro::internal::new_unit_response_poller(
908 polling_error_policy,
909 polling_backoff_policy,
910 start,
911 query,
912 )
913 }
914 .with_options(poller_options)
915 }
916
917 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
921 self.0.request.name = v.into();
922 self
923 }
924 }
925
926 #[doc(hidden)]
927 impl crate::RequestBuilder for DeleteCmekConfig {
928 fn request_options(&mut self) -> &mut crate::RequestOptions {
929 &mut self.0.options
930 }
931 }
932
933 #[derive(Clone, Debug)]
954 pub struct ListOperations(
955 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
956 );
957
958 impl ListOperations {
959 pub(crate) fn new(
960 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
961 ) -> Self {
962 Self(RequestBuilder::new(stub))
963 }
964
965 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
967 mut self,
968 v: V,
969 ) -> Self {
970 self.0.request = v.into();
971 self
972 }
973
974 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
976 self.0.options = v.into();
977 self
978 }
979
980 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
982 (*self.0.stub)
983 .list_operations(self.0.request, self.0.options)
984 .await
985 .map(crate::Response::into_body)
986 }
987
988 pub fn by_page(
990 self,
991 ) -> impl google_cloud_gax::paginator::Paginator<
992 google_cloud_longrunning::model::ListOperationsResponse,
993 crate::Error,
994 > {
995 use std::clone::Clone;
996 let token = self.0.request.page_token.clone();
997 let execute = move |token: String| {
998 let mut builder = self.clone();
999 builder.0.request = builder.0.request.set_page_token(token);
1000 builder.send()
1001 };
1002 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1003 }
1004
1005 pub fn by_item(
1007 self,
1008 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1009 google_cloud_longrunning::model::ListOperationsResponse,
1010 crate::Error,
1011 > {
1012 use google_cloud_gax::paginator::Paginator;
1013 self.by_page().items()
1014 }
1015
1016 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1018 self.0.request.name = v.into();
1019 self
1020 }
1021
1022 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1024 self.0.request.filter = v.into();
1025 self
1026 }
1027
1028 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1030 self.0.request.page_size = v.into();
1031 self
1032 }
1033
1034 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1036 self.0.request.page_token = v.into();
1037 self
1038 }
1039
1040 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1042 self.0.request.return_partial_success = v.into();
1043 self
1044 }
1045 }
1046
1047 #[doc(hidden)]
1048 impl crate::RequestBuilder for ListOperations {
1049 fn request_options(&mut self) -> &mut crate::RequestOptions {
1050 &mut self.0.options
1051 }
1052 }
1053
1054 #[derive(Clone, Debug)]
1071 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1072
1073 impl GetOperation {
1074 pub(crate) fn new(
1075 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
1076 ) -> Self {
1077 Self(RequestBuilder::new(stub))
1078 }
1079
1080 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1082 mut self,
1083 v: V,
1084 ) -> Self {
1085 self.0.request = v.into();
1086 self
1087 }
1088
1089 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1091 self.0.options = v.into();
1092 self
1093 }
1094
1095 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1097 (*self.0.stub)
1098 .get_operation(self.0.request, self.0.options)
1099 .await
1100 .map(crate::Response::into_body)
1101 }
1102
1103 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1105 self.0.request.name = v.into();
1106 self
1107 }
1108 }
1109
1110 #[doc(hidden)]
1111 impl crate::RequestBuilder for GetOperation {
1112 fn request_options(&mut self) -> &mut crate::RequestOptions {
1113 &mut self.0.options
1114 }
1115 }
1116
1117 #[derive(Clone, Debug)]
1134 pub struct CancelOperation(
1135 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1136 );
1137
1138 impl CancelOperation {
1139 pub(crate) fn new(
1140 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
1141 ) -> Self {
1142 Self(RequestBuilder::new(stub))
1143 }
1144
1145 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1147 mut self,
1148 v: V,
1149 ) -> Self {
1150 self.0.request = v.into();
1151 self
1152 }
1153
1154 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1156 self.0.options = v.into();
1157 self
1158 }
1159
1160 pub async fn send(self) -> Result<()> {
1162 (*self.0.stub)
1163 .cancel_operation(self.0.request, self.0.options)
1164 .await
1165 .map(crate::Response::into_body)
1166 }
1167
1168 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1170 self.0.request.name = v.into();
1171 self
1172 }
1173 }
1174
1175 #[doc(hidden)]
1176 impl crate::RequestBuilder for CancelOperation {
1177 fn request_options(&mut self) -> &mut crate::RequestOptions {
1178 &mut self.0.options
1179 }
1180 }
1181}
1182
1183#[cfg(feature = "completion-service")]
1185#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
1186pub mod completion_service {
1187 use crate::Result;
1188
1189 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1203
1204 pub(crate) mod client {
1205 use super::super::super::client::CompletionService;
1206 pub struct Factory;
1207 impl crate::ClientFactory for Factory {
1208 type Client = CompletionService;
1209 type Credentials = gaxi::options::Credentials;
1210 async fn build(
1211 self,
1212 config: gaxi::options::ClientConfig,
1213 ) -> crate::ClientBuilderResult<Self::Client> {
1214 Self::Client::new(config).await
1215 }
1216 }
1217 }
1218
1219 #[derive(Clone, Debug)]
1221 pub(crate) struct RequestBuilder<R: std::default::Default> {
1222 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1223 request: R,
1224 options: crate::RequestOptions,
1225 }
1226
1227 impl<R> RequestBuilder<R>
1228 where
1229 R: std::default::Default,
1230 {
1231 pub(crate) fn new(
1232 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1233 ) -> Self {
1234 Self {
1235 stub,
1236 request: R::default(),
1237 options: crate::RequestOptions::default(),
1238 }
1239 }
1240 }
1241
1242 #[derive(Clone, Debug)]
1259 pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1260
1261 impl CompleteQuery {
1262 pub(crate) fn new(
1263 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1264 ) -> Self {
1265 Self(RequestBuilder::new(stub))
1266 }
1267
1268 pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1270 self.0.request = v.into();
1271 self
1272 }
1273
1274 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1276 self.0.options = v.into();
1277 self
1278 }
1279
1280 pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1282 (*self.0.stub)
1283 .complete_query(self.0.request, self.0.options)
1284 .await
1285 .map(crate::Response::into_body)
1286 }
1287
1288 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1292 self.0.request.data_store = v.into();
1293 self
1294 }
1295
1296 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1300 self.0.request.query = v.into();
1301 self
1302 }
1303
1304 pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1306 self.0.request.query_model = v.into();
1307 self
1308 }
1309
1310 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1312 self.0.request.user_pseudo_id = v.into();
1313 self
1314 }
1315
1316 pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1318 self.0.request.include_tail_suggestions = v.into();
1319 self
1320 }
1321 }
1322
1323 #[doc(hidden)]
1324 impl crate::RequestBuilder for CompleteQuery {
1325 fn request_options(&mut self) -> &mut crate::RequestOptions {
1326 &mut self.0.options
1327 }
1328 }
1329
1330 #[derive(Clone, Debug)]
1348 pub struct ImportSuggestionDenyListEntries(
1349 RequestBuilder<crate::model::ImportSuggestionDenyListEntriesRequest>,
1350 );
1351
1352 impl ImportSuggestionDenyListEntries {
1353 pub(crate) fn new(
1354 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1355 ) -> Self {
1356 Self(RequestBuilder::new(stub))
1357 }
1358
1359 pub fn with_request<V: Into<crate::model::ImportSuggestionDenyListEntriesRequest>>(
1361 mut self,
1362 v: V,
1363 ) -> Self {
1364 self.0.request = v.into();
1365 self
1366 }
1367
1368 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1370 self.0.options = v.into();
1371 self
1372 }
1373
1374 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1381 (*self.0.stub)
1382 .import_suggestion_deny_list_entries(self.0.request, self.0.options)
1383 .await
1384 .map(crate::Response::into_body)
1385 }
1386
1387 pub fn poller(
1389 self,
1390 ) -> impl google_cloud_lro::Poller<
1391 crate::model::ImportSuggestionDenyListEntriesResponse,
1392 crate::model::ImportSuggestionDenyListEntriesMetadata,
1393 > {
1394 type Operation = google_cloud_lro::internal::Operation<
1395 crate::model::ImportSuggestionDenyListEntriesResponse,
1396 crate::model::ImportSuggestionDenyListEntriesMetadata,
1397 >;
1398 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1399 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1400 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1401 if let Some(ref mut details) = poller_options.tracing {
1402 details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::import_suggestion_deny_list_entries::until_done";
1403 }
1404
1405 let stub = self.0.stub.clone();
1406 let mut options = self.0.options.clone();
1407 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1408 let query = move |name| {
1409 let stub = stub.clone();
1410 let options = options.clone();
1411 async {
1412 let op = GetOperation::new(stub)
1413 .set_name(name)
1414 .with_options(options)
1415 .send()
1416 .await?;
1417 Ok(Operation::new(op))
1418 }
1419 };
1420
1421 let start = move || async {
1422 let op = self.send().await?;
1423 Ok(Operation::new(op))
1424 };
1425
1426 use google_cloud_lro::internal::PollerExt;
1427 {
1428 google_cloud_lro::internal::new_poller(
1429 polling_error_policy,
1430 polling_backoff_policy,
1431 start,
1432 query,
1433 )
1434 }
1435 .with_options(poller_options)
1436 }
1437
1438 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1442 self.0.request.parent = v.into();
1443 self
1444 }
1445
1446 pub fn set_source<
1451 T: Into<Option<crate::model::import_suggestion_deny_list_entries_request::Source>>,
1452 >(
1453 mut self,
1454 v: T,
1455 ) -> Self {
1456 self.0.request.source = v.into();
1457 self
1458 }
1459
1460 pub fn set_inline_source<
1466 T: std::convert::Into<
1467 std::boxed::Box<
1468 crate::model::import_suggestion_deny_list_entries_request::InlineSource,
1469 >,
1470 >,
1471 >(
1472 mut self,
1473 v: T,
1474 ) -> Self {
1475 self.0.request = self.0.request.set_inline_source(v);
1476 self
1477 }
1478
1479 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1485 mut self,
1486 v: T,
1487 ) -> Self {
1488 self.0.request = self.0.request.set_gcs_source(v);
1489 self
1490 }
1491 }
1492
1493 #[doc(hidden)]
1494 impl crate::RequestBuilder for ImportSuggestionDenyListEntries {
1495 fn request_options(&mut self) -> &mut crate::RequestOptions {
1496 &mut self.0.options
1497 }
1498 }
1499
1500 #[derive(Clone, Debug)]
1518 pub struct PurgeSuggestionDenyListEntries(
1519 RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1520 );
1521
1522 impl PurgeSuggestionDenyListEntries {
1523 pub(crate) fn new(
1524 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1525 ) -> Self {
1526 Self(RequestBuilder::new(stub))
1527 }
1528
1529 pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1531 mut self,
1532 v: V,
1533 ) -> Self {
1534 self.0.request = v.into();
1535 self
1536 }
1537
1538 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1540 self.0.options = v.into();
1541 self
1542 }
1543
1544 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1551 (*self.0.stub)
1552 .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1553 .await
1554 .map(crate::Response::into_body)
1555 }
1556
1557 pub fn poller(
1559 self,
1560 ) -> impl google_cloud_lro::Poller<
1561 crate::model::PurgeSuggestionDenyListEntriesResponse,
1562 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1563 > {
1564 type Operation = google_cloud_lro::internal::Operation<
1565 crate::model::PurgeSuggestionDenyListEntriesResponse,
1566 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1567 >;
1568 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1569 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1570 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1571 if let Some(ref mut details) = poller_options.tracing {
1572 details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::purge_suggestion_deny_list_entries::until_done";
1573 }
1574
1575 let stub = self.0.stub.clone();
1576 let mut options = self.0.options.clone();
1577 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1578 let query = move |name| {
1579 let stub = stub.clone();
1580 let options = options.clone();
1581 async {
1582 let op = GetOperation::new(stub)
1583 .set_name(name)
1584 .with_options(options)
1585 .send()
1586 .await?;
1587 Ok(Operation::new(op))
1588 }
1589 };
1590
1591 let start = move || async {
1592 let op = self.send().await?;
1593 Ok(Operation::new(op))
1594 };
1595
1596 use google_cloud_lro::internal::PollerExt;
1597 {
1598 google_cloud_lro::internal::new_poller(
1599 polling_error_policy,
1600 polling_backoff_policy,
1601 start,
1602 query,
1603 )
1604 }
1605 .with_options(poller_options)
1606 }
1607
1608 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1612 self.0.request.parent = v.into();
1613 self
1614 }
1615 }
1616
1617 #[doc(hidden)]
1618 impl crate::RequestBuilder for PurgeSuggestionDenyListEntries {
1619 fn request_options(&mut self) -> &mut crate::RequestOptions {
1620 &mut self.0.options
1621 }
1622 }
1623
1624 #[derive(Clone, Debug)]
1642 pub struct ImportCompletionSuggestions(
1643 RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1644 );
1645
1646 impl ImportCompletionSuggestions {
1647 pub(crate) fn new(
1648 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1649 ) -> Self {
1650 Self(RequestBuilder::new(stub))
1651 }
1652
1653 pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1655 mut self,
1656 v: V,
1657 ) -> Self {
1658 self.0.request = v.into();
1659 self
1660 }
1661
1662 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1664 self.0.options = v.into();
1665 self
1666 }
1667
1668 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1675 (*self.0.stub)
1676 .import_completion_suggestions(self.0.request, self.0.options)
1677 .await
1678 .map(crate::Response::into_body)
1679 }
1680
1681 pub fn poller(
1683 self,
1684 ) -> impl google_cloud_lro::Poller<
1685 crate::model::ImportCompletionSuggestionsResponse,
1686 crate::model::ImportCompletionSuggestionsMetadata,
1687 > {
1688 type Operation = google_cloud_lro::internal::Operation<
1689 crate::model::ImportCompletionSuggestionsResponse,
1690 crate::model::ImportCompletionSuggestionsMetadata,
1691 >;
1692 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1693 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1694 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1695 if let Some(ref mut details) = poller_options.tracing {
1696 details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::import_completion_suggestions::until_done";
1697 }
1698
1699 let stub = self.0.stub.clone();
1700 let mut options = self.0.options.clone();
1701 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1702 let query = move |name| {
1703 let stub = stub.clone();
1704 let options = options.clone();
1705 async {
1706 let op = GetOperation::new(stub)
1707 .set_name(name)
1708 .with_options(options)
1709 .send()
1710 .await?;
1711 Ok(Operation::new(op))
1712 }
1713 };
1714
1715 let start = move || async {
1716 let op = self.send().await?;
1717 Ok(Operation::new(op))
1718 };
1719
1720 use google_cloud_lro::internal::PollerExt;
1721 {
1722 google_cloud_lro::internal::new_poller(
1723 polling_error_policy,
1724 polling_backoff_policy,
1725 start,
1726 query,
1727 )
1728 }
1729 .with_options(poller_options)
1730 }
1731
1732 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1736 self.0.request.parent = v.into();
1737 self
1738 }
1739
1740 pub fn set_error_config<T>(mut self, v: T) -> Self
1742 where
1743 T: std::convert::Into<crate::model::ImportErrorConfig>,
1744 {
1745 self.0.request.error_config = std::option::Option::Some(v.into());
1746 self
1747 }
1748
1749 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1751 where
1752 T: std::convert::Into<crate::model::ImportErrorConfig>,
1753 {
1754 self.0.request.error_config = v.map(|x| x.into());
1755 self
1756 }
1757
1758 pub fn set_source<
1763 T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1764 >(
1765 mut self,
1766 v: T,
1767 ) -> Self {
1768 self.0.request.source = v.into();
1769 self
1770 }
1771
1772 pub fn set_inline_source<
1778 T: std::convert::Into<
1779 std::boxed::Box<
1780 crate::model::import_completion_suggestions_request::InlineSource,
1781 >,
1782 >,
1783 >(
1784 mut self,
1785 v: T,
1786 ) -> Self {
1787 self.0.request = self.0.request.set_inline_source(v);
1788 self
1789 }
1790
1791 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1797 mut self,
1798 v: T,
1799 ) -> Self {
1800 self.0.request = self.0.request.set_gcs_source(v);
1801 self
1802 }
1803
1804 pub fn set_bigquery_source<
1810 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1811 >(
1812 mut self,
1813 v: T,
1814 ) -> Self {
1815 self.0.request = self.0.request.set_bigquery_source(v);
1816 self
1817 }
1818 }
1819
1820 #[doc(hidden)]
1821 impl crate::RequestBuilder for ImportCompletionSuggestions {
1822 fn request_options(&mut self) -> &mut crate::RequestOptions {
1823 &mut self.0.options
1824 }
1825 }
1826
1827 #[derive(Clone, Debug)]
1845 pub struct PurgeCompletionSuggestions(
1846 RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1847 );
1848
1849 impl PurgeCompletionSuggestions {
1850 pub(crate) fn new(
1851 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1852 ) -> Self {
1853 Self(RequestBuilder::new(stub))
1854 }
1855
1856 pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1858 mut self,
1859 v: V,
1860 ) -> Self {
1861 self.0.request = v.into();
1862 self
1863 }
1864
1865 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1867 self.0.options = v.into();
1868 self
1869 }
1870
1871 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1878 (*self.0.stub)
1879 .purge_completion_suggestions(self.0.request, self.0.options)
1880 .await
1881 .map(crate::Response::into_body)
1882 }
1883
1884 pub fn poller(
1886 self,
1887 ) -> impl google_cloud_lro::Poller<
1888 crate::model::PurgeCompletionSuggestionsResponse,
1889 crate::model::PurgeCompletionSuggestionsMetadata,
1890 > {
1891 type Operation = google_cloud_lro::internal::Operation<
1892 crate::model::PurgeCompletionSuggestionsResponse,
1893 crate::model::PurgeCompletionSuggestionsMetadata,
1894 >;
1895 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1896 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1897 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
1898 if let Some(ref mut details) = poller_options.tracing {
1899 details.method_name = "google_cloud_discoveryengine_v1::client::CompletionService::purge_completion_suggestions::until_done";
1900 }
1901
1902 let stub = self.0.stub.clone();
1903 let mut options = self.0.options.clone();
1904 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1905 let query = move |name| {
1906 let stub = stub.clone();
1907 let options = options.clone();
1908 async {
1909 let op = GetOperation::new(stub)
1910 .set_name(name)
1911 .with_options(options)
1912 .send()
1913 .await?;
1914 Ok(Operation::new(op))
1915 }
1916 };
1917
1918 let start = move || async {
1919 let op = self.send().await?;
1920 Ok(Operation::new(op))
1921 };
1922
1923 use google_cloud_lro::internal::PollerExt;
1924 {
1925 google_cloud_lro::internal::new_poller(
1926 polling_error_policy,
1927 polling_backoff_policy,
1928 start,
1929 query,
1930 )
1931 }
1932 .with_options(poller_options)
1933 }
1934
1935 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1939 self.0.request.parent = v.into();
1940 self
1941 }
1942 }
1943
1944 #[doc(hidden)]
1945 impl crate::RequestBuilder for PurgeCompletionSuggestions {
1946 fn request_options(&mut self) -> &mut crate::RequestOptions {
1947 &mut self.0.options
1948 }
1949 }
1950
1951 #[derive(Clone, Debug)]
1972 pub struct ListOperations(
1973 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1974 );
1975
1976 impl ListOperations {
1977 pub(crate) fn new(
1978 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1979 ) -> Self {
1980 Self(RequestBuilder::new(stub))
1981 }
1982
1983 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1985 mut self,
1986 v: V,
1987 ) -> Self {
1988 self.0.request = v.into();
1989 self
1990 }
1991
1992 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1994 self.0.options = v.into();
1995 self
1996 }
1997
1998 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2000 (*self.0.stub)
2001 .list_operations(self.0.request, self.0.options)
2002 .await
2003 .map(crate::Response::into_body)
2004 }
2005
2006 pub fn by_page(
2008 self,
2009 ) -> impl google_cloud_gax::paginator::Paginator<
2010 google_cloud_longrunning::model::ListOperationsResponse,
2011 crate::Error,
2012 > {
2013 use std::clone::Clone;
2014 let token = self.0.request.page_token.clone();
2015 let execute = move |token: String| {
2016 let mut builder = self.clone();
2017 builder.0.request = builder.0.request.set_page_token(token);
2018 builder.send()
2019 };
2020 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2021 }
2022
2023 pub fn by_item(
2025 self,
2026 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2027 google_cloud_longrunning::model::ListOperationsResponse,
2028 crate::Error,
2029 > {
2030 use google_cloud_gax::paginator::Paginator;
2031 self.by_page().items()
2032 }
2033
2034 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2036 self.0.request.name = v.into();
2037 self
2038 }
2039
2040 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2042 self.0.request.filter = v.into();
2043 self
2044 }
2045
2046 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2048 self.0.request.page_size = v.into();
2049 self
2050 }
2051
2052 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2054 self.0.request.page_token = v.into();
2055 self
2056 }
2057
2058 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2060 self.0.request.return_partial_success = v.into();
2061 self
2062 }
2063 }
2064
2065 #[doc(hidden)]
2066 impl crate::RequestBuilder for ListOperations {
2067 fn request_options(&mut self) -> &mut crate::RequestOptions {
2068 &mut self.0.options
2069 }
2070 }
2071
2072 #[derive(Clone, Debug)]
2089 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2090
2091 impl GetOperation {
2092 pub(crate) fn new(
2093 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
2094 ) -> Self {
2095 Self(RequestBuilder::new(stub))
2096 }
2097
2098 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2100 mut self,
2101 v: V,
2102 ) -> Self {
2103 self.0.request = v.into();
2104 self
2105 }
2106
2107 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2109 self.0.options = v.into();
2110 self
2111 }
2112
2113 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2115 (*self.0.stub)
2116 .get_operation(self.0.request, self.0.options)
2117 .await
2118 .map(crate::Response::into_body)
2119 }
2120
2121 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2123 self.0.request.name = v.into();
2124 self
2125 }
2126 }
2127
2128 #[doc(hidden)]
2129 impl crate::RequestBuilder for GetOperation {
2130 fn request_options(&mut self) -> &mut crate::RequestOptions {
2131 &mut self.0.options
2132 }
2133 }
2134
2135 #[derive(Clone, Debug)]
2152 pub struct CancelOperation(
2153 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2154 );
2155
2156 impl CancelOperation {
2157 pub(crate) fn new(
2158 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
2159 ) -> Self {
2160 Self(RequestBuilder::new(stub))
2161 }
2162
2163 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2165 mut self,
2166 v: V,
2167 ) -> Self {
2168 self.0.request = v.into();
2169 self
2170 }
2171
2172 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2174 self.0.options = v.into();
2175 self
2176 }
2177
2178 pub async fn send(self) -> Result<()> {
2180 (*self.0.stub)
2181 .cancel_operation(self.0.request, self.0.options)
2182 .await
2183 .map(crate::Response::into_body)
2184 }
2185
2186 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2188 self.0.request.name = v.into();
2189 self
2190 }
2191 }
2192
2193 #[doc(hidden)]
2194 impl crate::RequestBuilder for CancelOperation {
2195 fn request_options(&mut self) -> &mut crate::RequestOptions {
2196 &mut self.0.options
2197 }
2198 }
2199}
2200
2201#[cfg(feature = "control-service")]
2203#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
2204pub mod control_service {
2205 use crate::Result;
2206
2207 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2221
2222 pub(crate) mod client {
2223 use super::super::super::client::ControlService;
2224 pub struct Factory;
2225 impl crate::ClientFactory for Factory {
2226 type Client = ControlService;
2227 type Credentials = gaxi::options::Credentials;
2228 async fn build(
2229 self,
2230 config: gaxi::options::ClientConfig,
2231 ) -> crate::ClientBuilderResult<Self::Client> {
2232 Self::Client::new(config).await
2233 }
2234 }
2235 }
2236
2237 #[derive(Clone, Debug)]
2239 pub(crate) struct RequestBuilder<R: std::default::Default> {
2240 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2241 request: R,
2242 options: crate::RequestOptions,
2243 }
2244
2245 impl<R> RequestBuilder<R>
2246 where
2247 R: std::default::Default,
2248 {
2249 pub(crate) fn new(
2250 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2251 ) -> Self {
2252 Self {
2253 stub,
2254 request: R::default(),
2255 options: crate::RequestOptions::default(),
2256 }
2257 }
2258 }
2259
2260 #[derive(Clone, Debug)]
2277 pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2278
2279 impl CreateControl {
2280 pub(crate) fn new(
2281 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2282 ) -> Self {
2283 Self(RequestBuilder::new(stub))
2284 }
2285
2286 pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2288 self.0.request = v.into();
2289 self
2290 }
2291
2292 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2294 self.0.options = v.into();
2295 self
2296 }
2297
2298 pub async fn send(self) -> Result<crate::model::Control> {
2300 (*self.0.stub)
2301 .create_control(self.0.request, self.0.options)
2302 .await
2303 .map(crate::Response::into_body)
2304 }
2305
2306 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2310 self.0.request.parent = v.into();
2311 self
2312 }
2313
2314 pub fn set_control<T>(mut self, v: T) -> Self
2318 where
2319 T: std::convert::Into<crate::model::Control>,
2320 {
2321 self.0.request.control = std::option::Option::Some(v.into());
2322 self
2323 }
2324
2325 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2329 where
2330 T: std::convert::Into<crate::model::Control>,
2331 {
2332 self.0.request.control = v.map(|x| x.into());
2333 self
2334 }
2335
2336 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2340 self.0.request.control_id = v.into();
2341 self
2342 }
2343 }
2344
2345 #[doc(hidden)]
2346 impl crate::RequestBuilder for CreateControl {
2347 fn request_options(&mut self) -> &mut crate::RequestOptions {
2348 &mut self.0.options
2349 }
2350 }
2351
2352 #[derive(Clone, Debug)]
2369 pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2370
2371 impl DeleteControl {
2372 pub(crate) fn new(
2373 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2374 ) -> Self {
2375 Self(RequestBuilder::new(stub))
2376 }
2377
2378 pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2380 self.0.request = v.into();
2381 self
2382 }
2383
2384 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2386 self.0.options = v.into();
2387 self
2388 }
2389
2390 pub async fn send(self) -> Result<()> {
2392 (*self.0.stub)
2393 .delete_control(self.0.request, self.0.options)
2394 .await
2395 .map(crate::Response::into_body)
2396 }
2397
2398 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2402 self.0.request.name = v.into();
2403 self
2404 }
2405 }
2406
2407 #[doc(hidden)]
2408 impl crate::RequestBuilder for DeleteControl {
2409 fn request_options(&mut self) -> &mut crate::RequestOptions {
2410 &mut self.0.options
2411 }
2412 }
2413
2414 #[derive(Clone, Debug)]
2431 pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2432
2433 impl UpdateControl {
2434 pub(crate) fn new(
2435 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2436 ) -> Self {
2437 Self(RequestBuilder::new(stub))
2438 }
2439
2440 pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2442 self.0.request = v.into();
2443 self
2444 }
2445
2446 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2448 self.0.options = v.into();
2449 self
2450 }
2451
2452 pub async fn send(self) -> Result<crate::model::Control> {
2454 (*self.0.stub)
2455 .update_control(self.0.request, self.0.options)
2456 .await
2457 .map(crate::Response::into_body)
2458 }
2459
2460 pub fn set_control<T>(mut self, v: T) -> Self
2464 where
2465 T: std::convert::Into<crate::model::Control>,
2466 {
2467 self.0.request.control = std::option::Option::Some(v.into());
2468 self
2469 }
2470
2471 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2475 where
2476 T: std::convert::Into<crate::model::Control>,
2477 {
2478 self.0.request.control = v.map(|x| x.into());
2479 self
2480 }
2481
2482 pub fn set_update_mask<T>(mut self, v: T) -> Self
2484 where
2485 T: std::convert::Into<wkt::FieldMask>,
2486 {
2487 self.0.request.update_mask = std::option::Option::Some(v.into());
2488 self
2489 }
2490
2491 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2493 where
2494 T: std::convert::Into<wkt::FieldMask>,
2495 {
2496 self.0.request.update_mask = v.map(|x| x.into());
2497 self
2498 }
2499 }
2500
2501 #[doc(hidden)]
2502 impl crate::RequestBuilder for UpdateControl {
2503 fn request_options(&mut self) -> &mut crate::RequestOptions {
2504 &mut self.0.options
2505 }
2506 }
2507
2508 #[derive(Clone, Debug)]
2525 pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2526
2527 impl GetControl {
2528 pub(crate) fn new(
2529 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2530 ) -> Self {
2531 Self(RequestBuilder::new(stub))
2532 }
2533
2534 pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2536 self.0.request = v.into();
2537 self
2538 }
2539
2540 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2542 self.0.options = v.into();
2543 self
2544 }
2545
2546 pub async fn send(self) -> Result<crate::model::Control> {
2548 (*self.0.stub)
2549 .get_control(self.0.request, self.0.options)
2550 .await
2551 .map(crate::Response::into_body)
2552 }
2553
2554 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2558 self.0.request.name = v.into();
2559 self
2560 }
2561 }
2562
2563 #[doc(hidden)]
2564 impl crate::RequestBuilder for GetControl {
2565 fn request_options(&mut self) -> &mut crate::RequestOptions {
2566 &mut self.0.options
2567 }
2568 }
2569
2570 #[derive(Clone, Debug)]
2591 pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2592
2593 impl ListControls {
2594 pub(crate) fn new(
2595 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2596 ) -> Self {
2597 Self(RequestBuilder::new(stub))
2598 }
2599
2600 pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2602 self.0.request = v.into();
2603 self
2604 }
2605
2606 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2608 self.0.options = v.into();
2609 self
2610 }
2611
2612 pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2614 (*self.0.stub)
2615 .list_controls(self.0.request, self.0.options)
2616 .await
2617 .map(crate::Response::into_body)
2618 }
2619
2620 pub fn by_page(
2622 self,
2623 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListControlsResponse, crate::Error>
2624 {
2625 use std::clone::Clone;
2626 let token = self.0.request.page_token.clone();
2627 let execute = move |token: String| {
2628 let mut builder = self.clone();
2629 builder.0.request = builder.0.request.set_page_token(token);
2630 builder.send()
2631 };
2632 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2633 }
2634
2635 pub fn by_item(
2637 self,
2638 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2639 crate::model::ListControlsResponse,
2640 crate::Error,
2641 > {
2642 use google_cloud_gax::paginator::Paginator;
2643 self.by_page().items()
2644 }
2645
2646 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2650 self.0.request.parent = v.into();
2651 self
2652 }
2653
2654 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2656 self.0.request.page_size = v.into();
2657 self
2658 }
2659
2660 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2662 self.0.request.page_token = v.into();
2663 self
2664 }
2665
2666 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2668 self.0.request.filter = v.into();
2669 self
2670 }
2671 }
2672
2673 #[doc(hidden)]
2674 impl crate::RequestBuilder for ListControls {
2675 fn request_options(&mut self) -> &mut crate::RequestOptions {
2676 &mut self.0.options
2677 }
2678 }
2679
2680 #[derive(Clone, Debug)]
2701 pub struct ListOperations(
2702 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2703 );
2704
2705 impl ListOperations {
2706 pub(crate) fn new(
2707 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2708 ) -> Self {
2709 Self(RequestBuilder::new(stub))
2710 }
2711
2712 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2714 mut self,
2715 v: V,
2716 ) -> Self {
2717 self.0.request = v.into();
2718 self
2719 }
2720
2721 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2723 self.0.options = v.into();
2724 self
2725 }
2726
2727 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2729 (*self.0.stub)
2730 .list_operations(self.0.request, self.0.options)
2731 .await
2732 .map(crate::Response::into_body)
2733 }
2734
2735 pub fn by_page(
2737 self,
2738 ) -> impl google_cloud_gax::paginator::Paginator<
2739 google_cloud_longrunning::model::ListOperationsResponse,
2740 crate::Error,
2741 > {
2742 use std::clone::Clone;
2743 let token = self.0.request.page_token.clone();
2744 let execute = move |token: String| {
2745 let mut builder = self.clone();
2746 builder.0.request = builder.0.request.set_page_token(token);
2747 builder.send()
2748 };
2749 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2750 }
2751
2752 pub fn by_item(
2754 self,
2755 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2756 google_cloud_longrunning::model::ListOperationsResponse,
2757 crate::Error,
2758 > {
2759 use google_cloud_gax::paginator::Paginator;
2760 self.by_page().items()
2761 }
2762
2763 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2765 self.0.request.name = v.into();
2766 self
2767 }
2768
2769 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2771 self.0.request.filter = v.into();
2772 self
2773 }
2774
2775 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2777 self.0.request.page_size = v.into();
2778 self
2779 }
2780
2781 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2783 self.0.request.page_token = v.into();
2784 self
2785 }
2786
2787 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2789 self.0.request.return_partial_success = v.into();
2790 self
2791 }
2792 }
2793
2794 #[doc(hidden)]
2795 impl crate::RequestBuilder for ListOperations {
2796 fn request_options(&mut self) -> &mut crate::RequestOptions {
2797 &mut self.0.options
2798 }
2799 }
2800
2801 #[derive(Clone, Debug)]
2818 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2819
2820 impl GetOperation {
2821 pub(crate) fn new(
2822 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2823 ) -> Self {
2824 Self(RequestBuilder::new(stub))
2825 }
2826
2827 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2829 mut self,
2830 v: V,
2831 ) -> Self {
2832 self.0.request = v.into();
2833 self
2834 }
2835
2836 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2838 self.0.options = v.into();
2839 self
2840 }
2841
2842 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2844 (*self.0.stub)
2845 .get_operation(self.0.request, self.0.options)
2846 .await
2847 .map(crate::Response::into_body)
2848 }
2849
2850 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2852 self.0.request.name = v.into();
2853 self
2854 }
2855 }
2856
2857 #[doc(hidden)]
2858 impl crate::RequestBuilder for GetOperation {
2859 fn request_options(&mut self) -> &mut crate::RequestOptions {
2860 &mut self.0.options
2861 }
2862 }
2863
2864 #[derive(Clone, Debug)]
2881 pub struct CancelOperation(
2882 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2883 );
2884
2885 impl CancelOperation {
2886 pub(crate) fn new(
2887 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2888 ) -> Self {
2889 Self(RequestBuilder::new(stub))
2890 }
2891
2892 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2894 mut self,
2895 v: V,
2896 ) -> Self {
2897 self.0.request = v.into();
2898 self
2899 }
2900
2901 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2903 self.0.options = v.into();
2904 self
2905 }
2906
2907 pub async fn send(self) -> Result<()> {
2909 (*self.0.stub)
2910 .cancel_operation(self.0.request, self.0.options)
2911 .await
2912 .map(crate::Response::into_body)
2913 }
2914
2915 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2917 self.0.request.name = v.into();
2918 self
2919 }
2920 }
2921
2922 #[doc(hidden)]
2923 impl crate::RequestBuilder for CancelOperation {
2924 fn request_options(&mut self) -> &mut crate::RequestOptions {
2925 &mut self.0.options
2926 }
2927 }
2928}
2929
2930#[cfg(feature = "conversational-search-service")]
2932#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2933pub mod conversational_search_service {
2934 use crate::Result;
2935
2936 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2950
2951 pub(crate) mod client {
2952 use super::super::super::client::ConversationalSearchService;
2953 pub struct Factory;
2954 impl crate::ClientFactory for Factory {
2955 type Client = ConversationalSearchService;
2956 type Credentials = gaxi::options::Credentials;
2957 async fn build(
2958 self,
2959 config: gaxi::options::ClientConfig,
2960 ) -> crate::ClientBuilderResult<Self::Client> {
2961 Self::Client::new(config).await
2962 }
2963 }
2964 }
2965
2966 #[derive(Clone, Debug)]
2968 pub(crate) struct RequestBuilder<R: std::default::Default> {
2969 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2970 request: R,
2971 options: crate::RequestOptions,
2972 }
2973
2974 impl<R> RequestBuilder<R>
2975 where
2976 R: std::default::Default,
2977 {
2978 pub(crate) fn new(
2979 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2980 ) -> Self {
2981 Self {
2982 stub,
2983 request: R::default(),
2984 options: crate::RequestOptions::default(),
2985 }
2986 }
2987 }
2988
2989 #[derive(Clone, Debug)]
3006 pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
3007
3008 impl ConverseConversation {
3009 pub(crate) fn new(
3010 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3011 ) -> Self {
3012 Self(RequestBuilder::new(stub))
3013 }
3014
3015 pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
3017 mut self,
3018 v: V,
3019 ) -> Self {
3020 self.0.request = v.into();
3021 self
3022 }
3023
3024 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3026 self.0.options = v.into();
3027 self
3028 }
3029
3030 pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
3032 (*self.0.stub)
3033 .converse_conversation(self.0.request, self.0.options)
3034 .await
3035 .map(crate::Response::into_body)
3036 }
3037
3038 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3042 self.0.request.name = v.into();
3043 self
3044 }
3045
3046 pub fn set_query<T>(mut self, v: T) -> Self
3050 where
3051 T: std::convert::Into<crate::model::TextInput>,
3052 {
3053 self.0.request.query = std::option::Option::Some(v.into());
3054 self
3055 }
3056
3057 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3061 where
3062 T: std::convert::Into<crate::model::TextInput>,
3063 {
3064 self.0.request.query = v.map(|x| x.into());
3065 self
3066 }
3067
3068 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3070 self.0.request.serving_config = v.into();
3071 self
3072 }
3073
3074 pub fn set_conversation<T>(mut self, v: T) -> Self
3076 where
3077 T: std::convert::Into<crate::model::Conversation>,
3078 {
3079 self.0.request.conversation = std::option::Option::Some(v.into());
3080 self
3081 }
3082
3083 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3085 where
3086 T: std::convert::Into<crate::model::Conversation>,
3087 {
3088 self.0.request.conversation = v.map(|x| x.into());
3089 self
3090 }
3091
3092 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
3094 self.0.request.safe_search = v.into();
3095 self
3096 }
3097
3098 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3100 where
3101 T: std::iter::IntoIterator<Item = (K, V)>,
3102 K: std::convert::Into<std::string::String>,
3103 V: std::convert::Into<std::string::String>,
3104 {
3105 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3106 self
3107 }
3108
3109 pub fn set_summary_spec<T>(mut self, v: T) -> Self
3111 where
3112 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
3113 {
3114 self.0.request.summary_spec = std::option::Option::Some(v.into());
3115 self
3116 }
3117
3118 pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
3120 where
3121 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
3122 {
3123 self.0.request.summary_spec = v.map(|x| x.into());
3124 self
3125 }
3126
3127 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3129 self.0.request.filter = v.into();
3130 self
3131 }
3132
3133 pub fn set_boost_spec<T>(mut self, v: T) -> Self
3135 where
3136 T: std::convert::Into<crate::model::search_request::BoostSpec>,
3137 {
3138 self.0.request.boost_spec = std::option::Option::Some(v.into());
3139 self
3140 }
3141
3142 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
3144 where
3145 T: std::convert::Into<crate::model::search_request::BoostSpec>,
3146 {
3147 self.0.request.boost_spec = v.map(|x| x.into());
3148 self
3149 }
3150 }
3151
3152 #[doc(hidden)]
3153 impl crate::RequestBuilder for ConverseConversation {
3154 fn request_options(&mut self) -> &mut crate::RequestOptions {
3155 &mut self.0.options
3156 }
3157 }
3158
3159 #[derive(Clone, Debug)]
3176 pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
3177
3178 impl CreateConversation {
3179 pub(crate) fn new(
3180 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3181 ) -> Self {
3182 Self(RequestBuilder::new(stub))
3183 }
3184
3185 pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
3187 mut self,
3188 v: V,
3189 ) -> Self {
3190 self.0.request = v.into();
3191 self
3192 }
3193
3194 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3196 self.0.options = v.into();
3197 self
3198 }
3199
3200 pub async fn send(self) -> Result<crate::model::Conversation> {
3202 (*self.0.stub)
3203 .create_conversation(self.0.request, self.0.options)
3204 .await
3205 .map(crate::Response::into_body)
3206 }
3207
3208 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3212 self.0.request.parent = v.into();
3213 self
3214 }
3215
3216 pub fn set_conversation<T>(mut self, v: T) -> Self
3220 where
3221 T: std::convert::Into<crate::model::Conversation>,
3222 {
3223 self.0.request.conversation = std::option::Option::Some(v.into());
3224 self
3225 }
3226
3227 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3231 where
3232 T: std::convert::Into<crate::model::Conversation>,
3233 {
3234 self.0.request.conversation = v.map(|x| x.into());
3235 self
3236 }
3237 }
3238
3239 #[doc(hidden)]
3240 impl crate::RequestBuilder for CreateConversation {
3241 fn request_options(&mut self) -> &mut crate::RequestOptions {
3242 &mut self.0.options
3243 }
3244 }
3245
3246 #[derive(Clone, Debug)]
3263 pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
3264
3265 impl DeleteConversation {
3266 pub(crate) fn new(
3267 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3268 ) -> Self {
3269 Self(RequestBuilder::new(stub))
3270 }
3271
3272 pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3274 mut self,
3275 v: V,
3276 ) -> Self {
3277 self.0.request = v.into();
3278 self
3279 }
3280
3281 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3283 self.0.options = v.into();
3284 self
3285 }
3286
3287 pub async fn send(self) -> Result<()> {
3289 (*self.0.stub)
3290 .delete_conversation(self.0.request, self.0.options)
3291 .await
3292 .map(crate::Response::into_body)
3293 }
3294
3295 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3299 self.0.request.name = v.into();
3300 self
3301 }
3302 }
3303
3304 #[doc(hidden)]
3305 impl crate::RequestBuilder for DeleteConversation {
3306 fn request_options(&mut self) -> &mut crate::RequestOptions {
3307 &mut self.0.options
3308 }
3309 }
3310
3311 #[derive(Clone, Debug)]
3328 pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3329
3330 impl UpdateConversation {
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::UpdateConversationRequest>>(
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::Conversation> {
3354 (*self.0.stub)
3355 .update_conversation(self.0.request, self.0.options)
3356 .await
3357 .map(crate::Response::into_body)
3358 }
3359
3360 pub fn set_conversation<T>(mut self, v: T) -> Self
3364 where
3365 T: std::convert::Into<crate::model::Conversation>,
3366 {
3367 self.0.request.conversation = std::option::Option::Some(v.into());
3368 self
3369 }
3370
3371 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3375 where
3376 T: std::convert::Into<crate::model::Conversation>,
3377 {
3378 self.0.request.conversation = v.map(|x| x.into());
3379 self
3380 }
3381
3382 pub fn set_update_mask<T>(mut self, v: T) -> Self
3384 where
3385 T: std::convert::Into<wkt::FieldMask>,
3386 {
3387 self.0.request.update_mask = std::option::Option::Some(v.into());
3388 self
3389 }
3390
3391 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3393 where
3394 T: std::convert::Into<wkt::FieldMask>,
3395 {
3396 self.0.request.update_mask = v.map(|x| x.into());
3397 self
3398 }
3399 }
3400
3401 #[doc(hidden)]
3402 impl crate::RequestBuilder for UpdateConversation {
3403 fn request_options(&mut self) -> &mut crate::RequestOptions {
3404 &mut self.0.options
3405 }
3406 }
3407
3408 #[derive(Clone, Debug)]
3425 pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3426
3427 impl GetConversation {
3428 pub(crate) fn new(
3429 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3430 ) -> Self {
3431 Self(RequestBuilder::new(stub))
3432 }
3433
3434 pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3436 self.0.request = v.into();
3437 self
3438 }
3439
3440 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3442 self.0.options = v.into();
3443 self
3444 }
3445
3446 pub async fn send(self) -> Result<crate::model::Conversation> {
3448 (*self.0.stub)
3449 .get_conversation(self.0.request, self.0.options)
3450 .await
3451 .map(crate::Response::into_body)
3452 }
3453
3454 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3458 self.0.request.name = v.into();
3459 self
3460 }
3461 }
3462
3463 #[doc(hidden)]
3464 impl crate::RequestBuilder for GetConversation {
3465 fn request_options(&mut self) -> &mut crate::RequestOptions {
3466 &mut self.0.options
3467 }
3468 }
3469
3470 #[derive(Clone, Debug)]
3491 pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3492
3493 impl ListConversations {
3494 pub(crate) fn new(
3495 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3496 ) -> Self {
3497 Self(RequestBuilder::new(stub))
3498 }
3499
3500 pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3502 mut self,
3503 v: V,
3504 ) -> Self {
3505 self.0.request = v.into();
3506 self
3507 }
3508
3509 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3511 self.0.options = v.into();
3512 self
3513 }
3514
3515 pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3517 (*self.0.stub)
3518 .list_conversations(self.0.request, self.0.options)
3519 .await
3520 .map(crate::Response::into_body)
3521 }
3522
3523 pub fn by_page(
3525 self,
3526 ) -> impl google_cloud_gax::paginator::Paginator<
3527 crate::model::ListConversationsResponse,
3528 crate::Error,
3529 > {
3530 use std::clone::Clone;
3531 let token = self.0.request.page_token.clone();
3532 let execute = move |token: String| {
3533 let mut builder = self.clone();
3534 builder.0.request = builder.0.request.set_page_token(token);
3535 builder.send()
3536 };
3537 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3538 }
3539
3540 pub fn by_item(
3542 self,
3543 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3544 crate::model::ListConversationsResponse,
3545 crate::Error,
3546 > {
3547 use google_cloud_gax::paginator::Paginator;
3548 self.by_page().items()
3549 }
3550
3551 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3555 self.0.request.parent = v.into();
3556 self
3557 }
3558
3559 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3561 self.0.request.page_size = v.into();
3562 self
3563 }
3564
3565 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3567 self.0.request.page_token = v.into();
3568 self
3569 }
3570
3571 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3573 self.0.request.filter = v.into();
3574 self
3575 }
3576
3577 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3579 self.0.request.order_by = v.into();
3580 self
3581 }
3582 }
3583
3584 #[doc(hidden)]
3585 impl crate::RequestBuilder for ListConversations {
3586 fn request_options(&mut self) -> &mut crate::RequestOptions {
3587 &mut self.0.options
3588 }
3589 }
3590
3591 #[derive(Clone, Debug)]
3608 pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3609
3610 impl AnswerQuery {
3611 pub(crate) fn new(
3612 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3613 ) -> Self {
3614 Self(RequestBuilder::new(stub))
3615 }
3616
3617 pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3619 self.0.request = v.into();
3620 self
3621 }
3622
3623 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3625 self.0.options = v.into();
3626 self
3627 }
3628
3629 pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3631 (*self.0.stub)
3632 .answer_query(self.0.request, self.0.options)
3633 .await
3634 .map(crate::Response::into_body)
3635 }
3636
3637 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3641 self.0.request.serving_config = v.into();
3642 self
3643 }
3644
3645 pub fn set_query<T>(mut self, v: T) -> Self
3649 where
3650 T: std::convert::Into<crate::model::Query>,
3651 {
3652 self.0.request.query = std::option::Option::Some(v.into());
3653 self
3654 }
3655
3656 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3660 where
3661 T: std::convert::Into<crate::model::Query>,
3662 {
3663 self.0.request.query = v.map(|x| x.into());
3664 self
3665 }
3666
3667 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3669 self.0.request.session = v.into();
3670 self
3671 }
3672
3673 pub fn set_safety_spec<T>(mut self, v: T) -> Self
3675 where
3676 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3677 {
3678 self.0.request.safety_spec = std::option::Option::Some(v.into());
3679 self
3680 }
3681
3682 pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3684 where
3685 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3686 {
3687 self.0.request.safety_spec = v.map(|x| x.into());
3688 self
3689 }
3690
3691 pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3693 where
3694 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3695 {
3696 self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3697 self
3698 }
3699
3700 pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3702 where
3703 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3704 {
3705 self.0.request.related_questions_spec = v.map(|x| x.into());
3706 self
3707 }
3708
3709 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3711 where
3712 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3713 {
3714 self.0.request.grounding_spec = std::option::Option::Some(v.into());
3715 self
3716 }
3717
3718 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3720 where
3721 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3722 {
3723 self.0.request.grounding_spec = v.map(|x| x.into());
3724 self
3725 }
3726
3727 pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3729 where
3730 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3731 {
3732 self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3733 self
3734 }
3735
3736 pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3738 where
3739 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3740 {
3741 self.0.request.answer_generation_spec = v.map(|x| x.into());
3742 self
3743 }
3744
3745 pub fn set_search_spec<T>(mut self, v: T) -> Self
3747 where
3748 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3749 {
3750 self.0.request.search_spec = std::option::Option::Some(v.into());
3751 self
3752 }
3753
3754 pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3756 where
3757 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3758 {
3759 self.0.request.search_spec = v.map(|x| x.into());
3760 self
3761 }
3762
3763 pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3765 where
3766 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3767 {
3768 self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3769 self
3770 }
3771
3772 pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3774 where
3775 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3776 {
3777 self.0.request.query_understanding_spec = v.map(|x| x.into());
3778 self
3779 }
3780
3781 #[deprecated]
3783 pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3784 self.0.request.asynchronous_mode = v.into();
3785 self
3786 }
3787
3788 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3790 self.0.request.user_pseudo_id = v.into();
3791 self
3792 }
3793
3794 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3796 where
3797 T: std::iter::IntoIterator<Item = (K, V)>,
3798 K: std::convert::Into<std::string::String>,
3799 V: std::convert::Into<std::string::String>,
3800 {
3801 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3802 self
3803 }
3804
3805 pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3807 where
3808 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3809 {
3810 self.0.request.end_user_spec = std::option::Option::Some(v.into());
3811 self
3812 }
3813
3814 pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3816 where
3817 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3818 {
3819 self.0.request.end_user_spec = v.map(|x| x.into());
3820 self
3821 }
3822 }
3823
3824 #[doc(hidden)]
3825 impl crate::RequestBuilder for AnswerQuery {
3826 fn request_options(&mut self) -> &mut crate::RequestOptions {
3827 &mut self.0.options
3828 }
3829 }
3830
3831 #[derive(Clone, Debug)]
3851 pub struct StreamAnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3852
3853 impl StreamAnswerQuery {
3854 pub(crate) fn new(
3855 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3856 ) -> Self {
3857 Self(RequestBuilder::new(stub))
3858 }
3859
3860 pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3862 self.0.request = v.into();
3863 self
3864 }
3865
3866 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3868 self.0.options = v.into();
3869 self
3870 }
3871
3872 pub async fn send(
3874 self,
3875 ) -> Result<google_cloud_gax::streaming::ResponseStream<crate::model::AnswerQueryResponse>>
3876 {
3877 (*self.0.stub)
3878 .stream_answer_query(self.0.request, self.0.options)
3879 .await
3880 }
3881
3882 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3886 self.0.request.serving_config = v.into();
3887 self
3888 }
3889
3890 pub fn set_query<T>(mut self, v: T) -> Self
3894 where
3895 T: std::convert::Into<crate::model::Query>,
3896 {
3897 self.0.request.query = std::option::Option::Some(v.into());
3898 self
3899 }
3900
3901 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3905 where
3906 T: std::convert::Into<crate::model::Query>,
3907 {
3908 self.0.request.query = v.map(|x| x.into());
3909 self
3910 }
3911
3912 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3914 self.0.request.session = v.into();
3915 self
3916 }
3917
3918 pub fn set_safety_spec<T>(mut self, v: T) -> Self
3920 where
3921 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3922 {
3923 self.0.request.safety_spec = std::option::Option::Some(v.into());
3924 self
3925 }
3926
3927 pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3929 where
3930 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3931 {
3932 self.0.request.safety_spec = v.map(|x| x.into());
3933 self
3934 }
3935
3936 pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3938 where
3939 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3940 {
3941 self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3942 self
3943 }
3944
3945 pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3947 where
3948 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3949 {
3950 self.0.request.related_questions_spec = v.map(|x| x.into());
3951 self
3952 }
3953
3954 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3956 where
3957 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3958 {
3959 self.0.request.grounding_spec = std::option::Option::Some(v.into());
3960 self
3961 }
3962
3963 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3965 where
3966 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3967 {
3968 self.0.request.grounding_spec = v.map(|x| x.into());
3969 self
3970 }
3971
3972 pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3974 where
3975 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3976 {
3977 self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3978 self
3979 }
3980
3981 pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3983 where
3984 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3985 {
3986 self.0.request.answer_generation_spec = v.map(|x| x.into());
3987 self
3988 }
3989
3990 pub fn set_search_spec<T>(mut self, v: T) -> Self
3992 where
3993 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3994 {
3995 self.0.request.search_spec = std::option::Option::Some(v.into());
3996 self
3997 }
3998
3999 pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
4001 where
4002 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
4003 {
4004 self.0.request.search_spec = v.map(|x| x.into());
4005 self
4006 }
4007
4008 pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
4010 where
4011 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
4012 {
4013 self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
4014 self
4015 }
4016
4017 pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
4019 where
4020 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
4021 {
4022 self.0.request.query_understanding_spec = v.map(|x| x.into());
4023 self
4024 }
4025
4026 #[deprecated]
4028 pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
4029 self.0.request.asynchronous_mode = v.into();
4030 self
4031 }
4032
4033 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4035 self.0.request.user_pseudo_id = v.into();
4036 self
4037 }
4038
4039 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
4041 where
4042 T: std::iter::IntoIterator<Item = (K, V)>,
4043 K: std::convert::Into<std::string::String>,
4044 V: std::convert::Into<std::string::String>,
4045 {
4046 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4047 self
4048 }
4049
4050 pub fn set_end_user_spec<T>(mut self, v: T) -> Self
4052 where
4053 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
4054 {
4055 self.0.request.end_user_spec = std::option::Option::Some(v.into());
4056 self
4057 }
4058
4059 pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
4061 where
4062 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
4063 {
4064 self.0.request.end_user_spec = v.map(|x| x.into());
4065 self
4066 }
4067 }
4068
4069 #[doc(hidden)]
4070 impl crate::RequestBuilder for StreamAnswerQuery {
4071 fn request_options(&mut self) -> &mut crate::RequestOptions {
4072 &mut self.0.options
4073 }
4074 }
4075
4076 #[derive(Clone, Debug)]
4093 pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
4094
4095 impl GetAnswer {
4096 pub(crate) fn new(
4097 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4098 ) -> Self {
4099 Self(RequestBuilder::new(stub))
4100 }
4101
4102 pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
4104 self.0.request = v.into();
4105 self
4106 }
4107
4108 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4110 self.0.options = v.into();
4111 self
4112 }
4113
4114 pub async fn send(self) -> Result<crate::model::Answer> {
4116 (*self.0.stub)
4117 .get_answer(self.0.request, self.0.options)
4118 .await
4119 .map(crate::Response::into_body)
4120 }
4121
4122 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4126 self.0.request.name = v.into();
4127 self
4128 }
4129 }
4130
4131 #[doc(hidden)]
4132 impl crate::RequestBuilder for GetAnswer {
4133 fn request_options(&mut self) -> &mut crate::RequestOptions {
4134 &mut self.0.options
4135 }
4136 }
4137
4138 #[derive(Clone, Debug)]
4155 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
4156
4157 impl CreateSession {
4158 pub(crate) fn new(
4159 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4160 ) -> Self {
4161 Self(RequestBuilder::new(stub))
4162 }
4163
4164 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
4166 self.0.request = v.into();
4167 self
4168 }
4169
4170 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4172 self.0.options = v.into();
4173 self
4174 }
4175
4176 pub async fn send(self) -> Result<crate::model::Session> {
4178 (*self.0.stub)
4179 .create_session(self.0.request, self.0.options)
4180 .await
4181 .map(crate::Response::into_body)
4182 }
4183
4184 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4188 self.0.request.parent = v.into();
4189 self
4190 }
4191
4192 pub fn set_session<T>(mut self, v: T) -> Self
4196 where
4197 T: std::convert::Into<crate::model::Session>,
4198 {
4199 self.0.request.session = std::option::Option::Some(v.into());
4200 self
4201 }
4202
4203 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
4207 where
4208 T: std::convert::Into<crate::model::Session>,
4209 {
4210 self.0.request.session = v.map(|x| x.into());
4211 self
4212 }
4213 }
4214
4215 #[doc(hidden)]
4216 impl crate::RequestBuilder for CreateSession {
4217 fn request_options(&mut self) -> &mut crate::RequestOptions {
4218 &mut self.0.options
4219 }
4220 }
4221
4222 #[derive(Clone, Debug)]
4239 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
4240
4241 impl DeleteSession {
4242 pub(crate) fn new(
4243 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4244 ) -> Self {
4245 Self(RequestBuilder::new(stub))
4246 }
4247
4248 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
4250 self.0.request = v.into();
4251 self
4252 }
4253
4254 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4256 self.0.options = v.into();
4257 self
4258 }
4259
4260 pub async fn send(self) -> Result<()> {
4262 (*self.0.stub)
4263 .delete_session(self.0.request, self.0.options)
4264 .await
4265 .map(crate::Response::into_body)
4266 }
4267
4268 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4272 self.0.request.name = v.into();
4273 self
4274 }
4275 }
4276
4277 #[doc(hidden)]
4278 impl crate::RequestBuilder for DeleteSession {
4279 fn request_options(&mut self) -> &mut crate::RequestOptions {
4280 &mut self.0.options
4281 }
4282 }
4283
4284 #[derive(Clone, Debug)]
4301 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
4302
4303 impl UpdateSession {
4304 pub(crate) fn new(
4305 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4306 ) -> Self {
4307 Self(RequestBuilder::new(stub))
4308 }
4309
4310 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
4312 self.0.request = v.into();
4313 self
4314 }
4315
4316 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4318 self.0.options = v.into();
4319 self
4320 }
4321
4322 pub async fn send(self) -> Result<crate::model::Session> {
4324 (*self.0.stub)
4325 .update_session(self.0.request, self.0.options)
4326 .await
4327 .map(crate::Response::into_body)
4328 }
4329
4330 pub fn set_session<T>(mut self, v: T) -> Self
4334 where
4335 T: std::convert::Into<crate::model::Session>,
4336 {
4337 self.0.request.session = std::option::Option::Some(v.into());
4338 self
4339 }
4340
4341 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
4345 where
4346 T: std::convert::Into<crate::model::Session>,
4347 {
4348 self.0.request.session = v.map(|x| x.into());
4349 self
4350 }
4351
4352 pub fn set_update_mask<T>(mut self, v: T) -> Self
4354 where
4355 T: std::convert::Into<wkt::FieldMask>,
4356 {
4357 self.0.request.update_mask = std::option::Option::Some(v.into());
4358 self
4359 }
4360
4361 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4363 where
4364 T: std::convert::Into<wkt::FieldMask>,
4365 {
4366 self.0.request.update_mask = v.map(|x| x.into());
4367 self
4368 }
4369 }
4370
4371 #[doc(hidden)]
4372 impl crate::RequestBuilder for UpdateSession {
4373 fn request_options(&mut self) -> &mut crate::RequestOptions {
4374 &mut self.0.options
4375 }
4376 }
4377
4378 #[derive(Clone, Debug)]
4395 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
4396
4397 impl GetSession {
4398 pub(crate) fn new(
4399 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4400 ) -> Self {
4401 Self(RequestBuilder::new(stub))
4402 }
4403
4404 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
4406 self.0.request = v.into();
4407 self
4408 }
4409
4410 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4412 self.0.options = v.into();
4413 self
4414 }
4415
4416 pub async fn send(self) -> Result<crate::model::Session> {
4418 (*self.0.stub)
4419 .get_session(self.0.request, self.0.options)
4420 .await
4421 .map(crate::Response::into_body)
4422 }
4423
4424 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4428 self.0.request.name = v.into();
4429 self
4430 }
4431
4432 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
4434 self.0.request.include_answer_details = v.into();
4435 self
4436 }
4437 }
4438
4439 #[doc(hidden)]
4440 impl crate::RequestBuilder for GetSession {
4441 fn request_options(&mut self) -> &mut crate::RequestOptions {
4442 &mut self.0.options
4443 }
4444 }
4445
4446 #[derive(Clone, Debug)]
4467 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
4468
4469 impl ListSessions {
4470 pub(crate) fn new(
4471 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4472 ) -> Self {
4473 Self(RequestBuilder::new(stub))
4474 }
4475
4476 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
4478 self.0.request = v.into();
4479 self
4480 }
4481
4482 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4484 self.0.options = v.into();
4485 self
4486 }
4487
4488 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
4490 (*self.0.stub)
4491 .list_sessions(self.0.request, self.0.options)
4492 .await
4493 .map(crate::Response::into_body)
4494 }
4495
4496 pub fn by_page(
4498 self,
4499 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
4500 {
4501 use std::clone::Clone;
4502 let token = self.0.request.page_token.clone();
4503 let execute = move |token: String| {
4504 let mut builder = self.clone();
4505 builder.0.request = builder.0.request.set_page_token(token);
4506 builder.send()
4507 };
4508 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4509 }
4510
4511 pub fn by_item(
4513 self,
4514 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4515 crate::model::ListSessionsResponse,
4516 crate::Error,
4517 > {
4518 use google_cloud_gax::paginator::Paginator;
4519 self.by_page().items()
4520 }
4521
4522 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4526 self.0.request.parent = v.into();
4527 self
4528 }
4529
4530 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4532 self.0.request.page_size = v.into();
4533 self
4534 }
4535
4536 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4538 self.0.request.page_token = v.into();
4539 self
4540 }
4541
4542 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4544 self.0.request.filter = v.into();
4545 self
4546 }
4547
4548 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4550 self.0.request.order_by = v.into();
4551 self
4552 }
4553 }
4554
4555 #[doc(hidden)]
4556 impl crate::RequestBuilder for ListSessions {
4557 fn request_options(&mut self) -> &mut crate::RequestOptions {
4558 &mut self.0.options
4559 }
4560 }
4561
4562 #[derive(Clone, Debug)]
4583 pub struct ListOperations(
4584 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4585 );
4586
4587 impl ListOperations {
4588 pub(crate) fn new(
4589 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4590 ) -> Self {
4591 Self(RequestBuilder::new(stub))
4592 }
4593
4594 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4596 mut self,
4597 v: V,
4598 ) -> Self {
4599 self.0.request = v.into();
4600 self
4601 }
4602
4603 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4605 self.0.options = v.into();
4606 self
4607 }
4608
4609 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4611 (*self.0.stub)
4612 .list_operations(self.0.request, self.0.options)
4613 .await
4614 .map(crate::Response::into_body)
4615 }
4616
4617 pub fn by_page(
4619 self,
4620 ) -> impl google_cloud_gax::paginator::Paginator<
4621 google_cloud_longrunning::model::ListOperationsResponse,
4622 crate::Error,
4623 > {
4624 use std::clone::Clone;
4625 let token = self.0.request.page_token.clone();
4626 let execute = move |token: String| {
4627 let mut builder = self.clone();
4628 builder.0.request = builder.0.request.set_page_token(token);
4629 builder.send()
4630 };
4631 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4632 }
4633
4634 pub fn by_item(
4636 self,
4637 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4638 google_cloud_longrunning::model::ListOperationsResponse,
4639 crate::Error,
4640 > {
4641 use google_cloud_gax::paginator::Paginator;
4642 self.by_page().items()
4643 }
4644
4645 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4647 self.0.request.name = v.into();
4648 self
4649 }
4650
4651 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4653 self.0.request.filter = v.into();
4654 self
4655 }
4656
4657 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4659 self.0.request.page_size = v.into();
4660 self
4661 }
4662
4663 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4665 self.0.request.page_token = v.into();
4666 self
4667 }
4668
4669 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4671 self.0.request.return_partial_success = v.into();
4672 self
4673 }
4674 }
4675
4676 #[doc(hidden)]
4677 impl crate::RequestBuilder for ListOperations {
4678 fn request_options(&mut self) -> &mut crate::RequestOptions {
4679 &mut self.0.options
4680 }
4681 }
4682
4683 #[derive(Clone, Debug)]
4700 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4701
4702 impl GetOperation {
4703 pub(crate) fn new(
4704 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4705 ) -> Self {
4706 Self(RequestBuilder::new(stub))
4707 }
4708
4709 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4711 mut self,
4712 v: V,
4713 ) -> Self {
4714 self.0.request = v.into();
4715 self
4716 }
4717
4718 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4720 self.0.options = v.into();
4721 self
4722 }
4723
4724 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4726 (*self.0.stub)
4727 .get_operation(self.0.request, self.0.options)
4728 .await
4729 .map(crate::Response::into_body)
4730 }
4731
4732 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4734 self.0.request.name = v.into();
4735 self
4736 }
4737 }
4738
4739 #[doc(hidden)]
4740 impl crate::RequestBuilder for GetOperation {
4741 fn request_options(&mut self) -> &mut crate::RequestOptions {
4742 &mut self.0.options
4743 }
4744 }
4745
4746 #[derive(Clone, Debug)]
4763 pub struct CancelOperation(
4764 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
4765 );
4766
4767 impl CancelOperation {
4768 pub(crate) fn new(
4769 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4770 ) -> Self {
4771 Self(RequestBuilder::new(stub))
4772 }
4773
4774 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
4776 mut self,
4777 v: V,
4778 ) -> Self {
4779 self.0.request = v.into();
4780 self
4781 }
4782
4783 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4785 self.0.options = v.into();
4786 self
4787 }
4788
4789 pub async fn send(self) -> Result<()> {
4791 (*self.0.stub)
4792 .cancel_operation(self.0.request, self.0.options)
4793 .await
4794 .map(crate::Response::into_body)
4795 }
4796
4797 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4799 self.0.request.name = v.into();
4800 self
4801 }
4802 }
4803
4804 #[doc(hidden)]
4805 impl crate::RequestBuilder for CancelOperation {
4806 fn request_options(&mut self) -> &mut crate::RequestOptions {
4807 &mut self.0.options
4808 }
4809 }
4810}
4811
4812#[cfg(feature = "data-store-service")]
4814#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4815pub mod data_store_service {
4816 use crate::Result;
4817
4818 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4832
4833 pub(crate) mod client {
4834 use super::super::super::client::DataStoreService;
4835 pub struct Factory;
4836 impl crate::ClientFactory for Factory {
4837 type Client = DataStoreService;
4838 type Credentials = gaxi::options::Credentials;
4839 async fn build(
4840 self,
4841 config: gaxi::options::ClientConfig,
4842 ) -> crate::ClientBuilderResult<Self::Client> {
4843 Self::Client::new(config).await
4844 }
4845 }
4846 }
4847
4848 #[derive(Clone, Debug)]
4850 pub(crate) struct RequestBuilder<R: std::default::Default> {
4851 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4852 request: R,
4853 options: crate::RequestOptions,
4854 }
4855
4856 impl<R> RequestBuilder<R>
4857 where
4858 R: std::default::Default,
4859 {
4860 pub(crate) fn new(
4861 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4862 ) -> Self {
4863 Self {
4864 stub,
4865 request: R::default(),
4866 options: crate::RequestOptions::default(),
4867 }
4868 }
4869 }
4870
4871 #[derive(Clone, Debug)]
4889 pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4890
4891 impl CreateDataStore {
4892 pub(crate) fn new(
4893 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4894 ) -> Self {
4895 Self(RequestBuilder::new(stub))
4896 }
4897
4898 pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4900 self.0.request = v.into();
4901 self
4902 }
4903
4904 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4906 self.0.options = v.into();
4907 self
4908 }
4909
4910 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4917 (*self.0.stub)
4918 .create_data_store(self.0.request, self.0.options)
4919 .await
4920 .map(crate::Response::into_body)
4921 }
4922
4923 pub fn poller(
4925 self,
4926 ) -> impl google_cloud_lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4927 {
4928 type Operation = google_cloud_lro::internal::Operation<
4929 crate::model::DataStore,
4930 crate::model::CreateDataStoreMetadata,
4931 >;
4932 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4933 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4934 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
4935 if let Some(ref mut details) = poller_options.tracing {
4936 details.method_name = "google_cloud_discoveryengine_v1::client::DataStoreService::create_data_store::until_done";
4937 }
4938
4939 let stub = self.0.stub.clone();
4940 let mut options = self.0.options.clone();
4941 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4942 let query = move |name| {
4943 let stub = stub.clone();
4944 let options = options.clone();
4945 async {
4946 let op = GetOperation::new(stub)
4947 .set_name(name)
4948 .with_options(options)
4949 .send()
4950 .await?;
4951 Ok(Operation::new(op))
4952 }
4953 };
4954
4955 let start = move || async {
4956 let op = self.send().await?;
4957 Ok(Operation::new(op))
4958 };
4959
4960 use google_cloud_lro::internal::PollerExt;
4961 {
4962 google_cloud_lro::internal::new_poller(
4963 polling_error_policy,
4964 polling_backoff_policy,
4965 start,
4966 query,
4967 )
4968 }
4969 .with_options(poller_options)
4970 }
4971
4972 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4976 self.0.request.parent = v.into();
4977 self
4978 }
4979
4980 pub fn set_data_store<T>(mut self, v: T) -> Self
4984 where
4985 T: std::convert::Into<crate::model::DataStore>,
4986 {
4987 self.0.request.data_store = std::option::Option::Some(v.into());
4988 self
4989 }
4990
4991 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4995 where
4996 T: std::convert::Into<crate::model::DataStore>,
4997 {
4998 self.0.request.data_store = v.map(|x| x.into());
4999 self
5000 }
5001
5002 pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5006 self.0.request.data_store_id = v.into();
5007 self
5008 }
5009
5010 pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
5012 self.0.request.create_advanced_site_search = v.into();
5013 self
5014 }
5015
5016 pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
5018 self.0.request.skip_default_schema_creation = v.into();
5019 self
5020 }
5021
5022 pub fn set_cmek_options<
5027 T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
5028 >(
5029 mut self,
5030 v: T,
5031 ) -> Self {
5032 self.0.request.cmek_options = v.into();
5033 self
5034 }
5035
5036 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
5042 mut self,
5043 v: T,
5044 ) -> Self {
5045 self.0.request = self.0.request.set_cmek_config_name(v);
5046 self
5047 }
5048
5049 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5055 self.0.request = self.0.request.set_disable_cmek(v);
5056 self
5057 }
5058 }
5059
5060 #[doc(hidden)]
5061 impl crate::RequestBuilder for CreateDataStore {
5062 fn request_options(&mut self) -> &mut crate::RequestOptions {
5063 &mut self.0.options
5064 }
5065 }
5066
5067 #[derive(Clone, Debug)]
5084 pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
5085
5086 impl GetDataStore {
5087 pub(crate) fn new(
5088 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5089 ) -> Self {
5090 Self(RequestBuilder::new(stub))
5091 }
5092
5093 pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
5095 self.0.request = v.into();
5096 self
5097 }
5098
5099 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5101 self.0.options = v.into();
5102 self
5103 }
5104
5105 pub async fn send(self) -> Result<crate::model::DataStore> {
5107 (*self.0.stub)
5108 .get_data_store(self.0.request, self.0.options)
5109 .await
5110 .map(crate::Response::into_body)
5111 }
5112
5113 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5117 self.0.request.name = v.into();
5118 self
5119 }
5120 }
5121
5122 #[doc(hidden)]
5123 impl crate::RequestBuilder for GetDataStore {
5124 fn request_options(&mut self) -> &mut crate::RequestOptions {
5125 &mut self.0.options
5126 }
5127 }
5128
5129 #[derive(Clone, Debug)]
5150 pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
5151
5152 impl ListDataStores {
5153 pub(crate) fn new(
5154 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5155 ) -> Self {
5156 Self(RequestBuilder::new(stub))
5157 }
5158
5159 pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
5161 self.0.request = v.into();
5162 self
5163 }
5164
5165 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5167 self.0.options = v.into();
5168 self
5169 }
5170
5171 pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
5173 (*self.0.stub)
5174 .list_data_stores(self.0.request, self.0.options)
5175 .await
5176 .map(crate::Response::into_body)
5177 }
5178
5179 pub fn by_page(
5181 self,
5182 ) -> impl google_cloud_gax::paginator::Paginator<
5183 crate::model::ListDataStoresResponse,
5184 crate::Error,
5185 > {
5186 use std::clone::Clone;
5187 let token = self.0.request.page_token.clone();
5188 let execute = move |token: String| {
5189 let mut builder = self.clone();
5190 builder.0.request = builder.0.request.set_page_token(token);
5191 builder.send()
5192 };
5193 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5194 }
5195
5196 pub fn by_item(
5198 self,
5199 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5200 crate::model::ListDataStoresResponse,
5201 crate::Error,
5202 > {
5203 use google_cloud_gax::paginator::Paginator;
5204 self.by_page().items()
5205 }
5206
5207 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5211 self.0.request.parent = v.into();
5212 self
5213 }
5214
5215 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5217 self.0.request.page_size = v.into();
5218 self
5219 }
5220
5221 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5223 self.0.request.page_token = v.into();
5224 self
5225 }
5226
5227 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5229 self.0.request.filter = v.into();
5230 self
5231 }
5232 }
5233
5234 #[doc(hidden)]
5235 impl crate::RequestBuilder for ListDataStores {
5236 fn request_options(&mut self) -> &mut crate::RequestOptions {
5237 &mut self.0.options
5238 }
5239 }
5240
5241 #[derive(Clone, Debug)]
5259 pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
5260
5261 impl DeleteDataStore {
5262 pub(crate) fn new(
5263 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5264 ) -> Self {
5265 Self(RequestBuilder::new(stub))
5266 }
5267
5268 pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
5270 self.0.request = v.into();
5271 self
5272 }
5273
5274 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5276 self.0.options = v.into();
5277 self
5278 }
5279
5280 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5287 (*self.0.stub)
5288 .delete_data_store(self.0.request, self.0.options)
5289 .await
5290 .map(crate::Response::into_body)
5291 }
5292
5293 pub fn poller(
5295 self,
5296 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
5297 type Operation = google_cloud_lro::internal::Operation<
5298 wkt::Empty,
5299 crate::model::DeleteDataStoreMetadata,
5300 >;
5301 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5302 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5303 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
5304 if let Some(ref mut details) = poller_options.tracing {
5305 details.method_name = "google_cloud_discoveryengine_v1::client::DataStoreService::delete_data_store::until_done";
5306 }
5307
5308 let stub = self.0.stub.clone();
5309 let mut options = self.0.options.clone();
5310 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5311 let query = move |name| {
5312 let stub = stub.clone();
5313 let options = options.clone();
5314 async {
5315 let op = GetOperation::new(stub)
5316 .set_name(name)
5317 .with_options(options)
5318 .send()
5319 .await?;
5320 Ok(Operation::new(op))
5321 }
5322 };
5323
5324 let start = move || async {
5325 let op = self.send().await?;
5326 Ok(Operation::new(op))
5327 };
5328
5329 use google_cloud_lro::internal::PollerExt;
5330 {
5331 google_cloud_lro::internal::new_unit_response_poller(
5332 polling_error_policy,
5333 polling_backoff_policy,
5334 start,
5335 query,
5336 )
5337 }
5338 .with_options(poller_options)
5339 }
5340
5341 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5345 self.0.request.name = v.into();
5346 self
5347 }
5348 }
5349
5350 #[doc(hidden)]
5351 impl crate::RequestBuilder for DeleteDataStore {
5352 fn request_options(&mut self) -> &mut crate::RequestOptions {
5353 &mut self.0.options
5354 }
5355 }
5356
5357 #[derive(Clone, Debug)]
5374 pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
5375
5376 impl UpdateDataStore {
5377 pub(crate) fn new(
5378 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5379 ) -> Self {
5380 Self(RequestBuilder::new(stub))
5381 }
5382
5383 pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
5385 self.0.request = v.into();
5386 self
5387 }
5388
5389 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5391 self.0.options = v.into();
5392 self
5393 }
5394
5395 pub async fn send(self) -> Result<crate::model::DataStore> {
5397 (*self.0.stub)
5398 .update_data_store(self.0.request, self.0.options)
5399 .await
5400 .map(crate::Response::into_body)
5401 }
5402
5403 pub fn set_data_store<T>(mut self, v: T) -> Self
5407 where
5408 T: std::convert::Into<crate::model::DataStore>,
5409 {
5410 self.0.request.data_store = std::option::Option::Some(v.into());
5411 self
5412 }
5413
5414 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
5418 where
5419 T: std::convert::Into<crate::model::DataStore>,
5420 {
5421 self.0.request.data_store = v.map(|x| x.into());
5422 self
5423 }
5424
5425 pub fn set_update_mask<T>(mut self, v: T) -> Self
5427 where
5428 T: std::convert::Into<wkt::FieldMask>,
5429 {
5430 self.0.request.update_mask = std::option::Option::Some(v.into());
5431 self
5432 }
5433
5434 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5436 where
5437 T: std::convert::Into<wkt::FieldMask>,
5438 {
5439 self.0.request.update_mask = v.map(|x| x.into());
5440 self
5441 }
5442 }
5443
5444 #[doc(hidden)]
5445 impl crate::RequestBuilder for UpdateDataStore {
5446 fn request_options(&mut self) -> &mut crate::RequestOptions {
5447 &mut self.0.options
5448 }
5449 }
5450
5451 #[derive(Clone, Debug)]
5472 pub struct ListOperations(
5473 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5474 );
5475
5476 impl ListOperations {
5477 pub(crate) fn new(
5478 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5479 ) -> Self {
5480 Self(RequestBuilder::new(stub))
5481 }
5482
5483 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5485 mut self,
5486 v: V,
5487 ) -> Self {
5488 self.0.request = v.into();
5489 self
5490 }
5491
5492 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5494 self.0.options = v.into();
5495 self
5496 }
5497
5498 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5500 (*self.0.stub)
5501 .list_operations(self.0.request, self.0.options)
5502 .await
5503 .map(crate::Response::into_body)
5504 }
5505
5506 pub fn by_page(
5508 self,
5509 ) -> impl google_cloud_gax::paginator::Paginator<
5510 google_cloud_longrunning::model::ListOperationsResponse,
5511 crate::Error,
5512 > {
5513 use std::clone::Clone;
5514 let token = self.0.request.page_token.clone();
5515 let execute = move |token: String| {
5516 let mut builder = self.clone();
5517 builder.0.request = builder.0.request.set_page_token(token);
5518 builder.send()
5519 };
5520 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5521 }
5522
5523 pub fn by_item(
5525 self,
5526 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5527 google_cloud_longrunning::model::ListOperationsResponse,
5528 crate::Error,
5529 > {
5530 use google_cloud_gax::paginator::Paginator;
5531 self.by_page().items()
5532 }
5533
5534 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5536 self.0.request.name = v.into();
5537 self
5538 }
5539
5540 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5542 self.0.request.filter = v.into();
5543 self
5544 }
5545
5546 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5548 self.0.request.page_size = v.into();
5549 self
5550 }
5551
5552 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5554 self.0.request.page_token = v.into();
5555 self
5556 }
5557
5558 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5560 self.0.request.return_partial_success = v.into();
5561 self
5562 }
5563 }
5564
5565 #[doc(hidden)]
5566 impl crate::RequestBuilder for ListOperations {
5567 fn request_options(&mut self) -> &mut crate::RequestOptions {
5568 &mut self.0.options
5569 }
5570 }
5571
5572 #[derive(Clone, Debug)]
5589 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5590
5591 impl GetOperation {
5592 pub(crate) fn new(
5593 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5594 ) -> Self {
5595 Self(RequestBuilder::new(stub))
5596 }
5597
5598 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5600 mut self,
5601 v: V,
5602 ) -> Self {
5603 self.0.request = v.into();
5604 self
5605 }
5606
5607 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5609 self.0.options = v.into();
5610 self
5611 }
5612
5613 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5615 (*self.0.stub)
5616 .get_operation(self.0.request, self.0.options)
5617 .await
5618 .map(crate::Response::into_body)
5619 }
5620
5621 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5623 self.0.request.name = v.into();
5624 self
5625 }
5626 }
5627
5628 #[doc(hidden)]
5629 impl crate::RequestBuilder for GetOperation {
5630 fn request_options(&mut self) -> &mut crate::RequestOptions {
5631 &mut self.0.options
5632 }
5633 }
5634
5635 #[derive(Clone, Debug)]
5652 pub struct CancelOperation(
5653 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
5654 );
5655
5656 impl CancelOperation {
5657 pub(crate) fn new(
5658 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5659 ) -> Self {
5660 Self(RequestBuilder::new(stub))
5661 }
5662
5663 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
5665 mut self,
5666 v: V,
5667 ) -> Self {
5668 self.0.request = v.into();
5669 self
5670 }
5671
5672 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5674 self.0.options = v.into();
5675 self
5676 }
5677
5678 pub async fn send(self) -> Result<()> {
5680 (*self.0.stub)
5681 .cancel_operation(self.0.request, self.0.options)
5682 .await
5683 .map(crate::Response::into_body)
5684 }
5685
5686 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5688 self.0.request.name = v.into();
5689 self
5690 }
5691 }
5692
5693 #[doc(hidden)]
5694 impl crate::RequestBuilder for CancelOperation {
5695 fn request_options(&mut self) -> &mut crate::RequestOptions {
5696 &mut self.0.options
5697 }
5698 }
5699}
5700
5701#[cfg(feature = "document-service")]
5703#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5704pub mod document_service {
5705 use crate::Result;
5706
5707 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5721
5722 pub(crate) mod client {
5723 use super::super::super::client::DocumentService;
5724 pub struct Factory;
5725 impl crate::ClientFactory for Factory {
5726 type Client = DocumentService;
5727 type Credentials = gaxi::options::Credentials;
5728 async fn build(
5729 self,
5730 config: gaxi::options::ClientConfig,
5731 ) -> crate::ClientBuilderResult<Self::Client> {
5732 Self::Client::new(config).await
5733 }
5734 }
5735 }
5736
5737 #[derive(Clone, Debug)]
5739 pub(crate) struct RequestBuilder<R: std::default::Default> {
5740 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5741 request: R,
5742 options: crate::RequestOptions,
5743 }
5744
5745 impl<R> RequestBuilder<R>
5746 where
5747 R: std::default::Default,
5748 {
5749 pub(crate) fn new(
5750 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5751 ) -> Self {
5752 Self {
5753 stub,
5754 request: R::default(),
5755 options: crate::RequestOptions::default(),
5756 }
5757 }
5758 }
5759
5760 #[derive(Clone, Debug)]
5777 pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5778
5779 impl GetDocument {
5780 pub(crate) fn new(
5781 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5782 ) -> Self {
5783 Self(RequestBuilder::new(stub))
5784 }
5785
5786 pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5788 self.0.request = v.into();
5789 self
5790 }
5791
5792 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5794 self.0.options = v.into();
5795 self
5796 }
5797
5798 pub async fn send(self) -> Result<crate::model::Document> {
5800 (*self.0.stub)
5801 .get_document(self.0.request, self.0.options)
5802 .await
5803 .map(crate::Response::into_body)
5804 }
5805
5806 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5810 self.0.request.name = v.into();
5811 self
5812 }
5813 }
5814
5815 #[doc(hidden)]
5816 impl crate::RequestBuilder for GetDocument {
5817 fn request_options(&mut self) -> &mut crate::RequestOptions {
5818 &mut self.0.options
5819 }
5820 }
5821
5822 #[derive(Clone, Debug)]
5843 pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5844
5845 impl ListDocuments {
5846 pub(crate) fn new(
5847 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5848 ) -> Self {
5849 Self(RequestBuilder::new(stub))
5850 }
5851
5852 pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5854 self.0.request = v.into();
5855 self
5856 }
5857
5858 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5860 self.0.options = v.into();
5861 self
5862 }
5863
5864 pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5866 (*self.0.stub)
5867 .list_documents(self.0.request, self.0.options)
5868 .await
5869 .map(crate::Response::into_body)
5870 }
5871
5872 pub fn by_page(
5874 self,
5875 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDocumentsResponse, crate::Error>
5876 {
5877 use std::clone::Clone;
5878 let token = self.0.request.page_token.clone();
5879 let execute = move |token: String| {
5880 let mut builder = self.clone();
5881 builder.0.request = builder.0.request.set_page_token(token);
5882 builder.send()
5883 };
5884 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5885 }
5886
5887 pub fn by_item(
5889 self,
5890 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5891 crate::model::ListDocumentsResponse,
5892 crate::Error,
5893 > {
5894 use google_cloud_gax::paginator::Paginator;
5895 self.by_page().items()
5896 }
5897
5898 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5902 self.0.request.parent = v.into();
5903 self
5904 }
5905
5906 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5908 self.0.request.page_size = v.into();
5909 self
5910 }
5911
5912 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5914 self.0.request.page_token = v.into();
5915 self
5916 }
5917 }
5918
5919 #[doc(hidden)]
5920 impl crate::RequestBuilder for ListDocuments {
5921 fn request_options(&mut self) -> &mut crate::RequestOptions {
5922 &mut self.0.options
5923 }
5924 }
5925
5926 #[derive(Clone, Debug)]
5943 pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5944
5945 impl CreateDocument {
5946 pub(crate) fn new(
5947 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5948 ) -> Self {
5949 Self(RequestBuilder::new(stub))
5950 }
5951
5952 pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5954 self.0.request = v.into();
5955 self
5956 }
5957
5958 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5960 self.0.options = v.into();
5961 self
5962 }
5963
5964 pub async fn send(self) -> Result<crate::model::Document> {
5966 (*self.0.stub)
5967 .create_document(self.0.request, self.0.options)
5968 .await
5969 .map(crate::Response::into_body)
5970 }
5971
5972 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5976 self.0.request.parent = v.into();
5977 self
5978 }
5979
5980 pub fn set_document<T>(mut self, v: T) -> Self
5984 where
5985 T: std::convert::Into<crate::model::Document>,
5986 {
5987 self.0.request.document = std::option::Option::Some(v.into());
5988 self
5989 }
5990
5991 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5995 where
5996 T: std::convert::Into<crate::model::Document>,
5997 {
5998 self.0.request.document = v.map(|x| x.into());
5999 self
6000 }
6001
6002 pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6006 self.0.request.document_id = v.into();
6007 self
6008 }
6009 }
6010
6011 #[doc(hidden)]
6012 impl crate::RequestBuilder for CreateDocument {
6013 fn request_options(&mut self) -> &mut crate::RequestOptions {
6014 &mut self.0.options
6015 }
6016 }
6017
6018 #[derive(Clone, Debug)]
6035 pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
6036
6037 impl UpdateDocument {
6038 pub(crate) fn new(
6039 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6040 ) -> Self {
6041 Self(RequestBuilder::new(stub))
6042 }
6043
6044 pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
6046 self.0.request = v.into();
6047 self
6048 }
6049
6050 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6052 self.0.options = v.into();
6053 self
6054 }
6055
6056 pub async fn send(self) -> Result<crate::model::Document> {
6058 (*self.0.stub)
6059 .update_document(self.0.request, self.0.options)
6060 .await
6061 .map(crate::Response::into_body)
6062 }
6063
6064 pub fn set_document<T>(mut self, v: T) -> Self
6068 where
6069 T: std::convert::Into<crate::model::Document>,
6070 {
6071 self.0.request.document = std::option::Option::Some(v.into());
6072 self
6073 }
6074
6075 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
6079 where
6080 T: std::convert::Into<crate::model::Document>,
6081 {
6082 self.0.request.document = v.map(|x| x.into());
6083 self
6084 }
6085
6086 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
6088 self.0.request.allow_missing = v.into();
6089 self
6090 }
6091
6092 pub fn set_update_mask<T>(mut self, v: T) -> Self
6094 where
6095 T: std::convert::Into<wkt::FieldMask>,
6096 {
6097 self.0.request.update_mask = std::option::Option::Some(v.into());
6098 self
6099 }
6100
6101 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6103 where
6104 T: std::convert::Into<wkt::FieldMask>,
6105 {
6106 self.0.request.update_mask = v.map(|x| x.into());
6107 self
6108 }
6109 }
6110
6111 #[doc(hidden)]
6112 impl crate::RequestBuilder for UpdateDocument {
6113 fn request_options(&mut self) -> &mut crate::RequestOptions {
6114 &mut self.0.options
6115 }
6116 }
6117
6118 #[derive(Clone, Debug)]
6135 pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
6136
6137 impl DeleteDocument {
6138 pub(crate) fn new(
6139 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6140 ) -> Self {
6141 Self(RequestBuilder::new(stub))
6142 }
6143
6144 pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
6146 self.0.request = v.into();
6147 self
6148 }
6149
6150 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6152 self.0.options = v.into();
6153 self
6154 }
6155
6156 pub async fn send(self) -> Result<()> {
6158 (*self.0.stub)
6159 .delete_document(self.0.request, self.0.options)
6160 .await
6161 .map(crate::Response::into_body)
6162 }
6163
6164 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6168 self.0.request.name = v.into();
6169 self
6170 }
6171 }
6172
6173 #[doc(hidden)]
6174 impl crate::RequestBuilder for DeleteDocument {
6175 fn request_options(&mut self) -> &mut crate::RequestOptions {
6176 &mut self.0.options
6177 }
6178 }
6179
6180 #[derive(Clone, Debug)]
6198 pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
6199
6200 impl ImportDocuments {
6201 pub(crate) fn new(
6202 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6203 ) -> Self {
6204 Self(RequestBuilder::new(stub))
6205 }
6206
6207 pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
6209 self.0.request = v.into();
6210 self
6211 }
6212
6213 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6215 self.0.options = v.into();
6216 self
6217 }
6218
6219 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6226 (*self.0.stub)
6227 .import_documents(self.0.request, self.0.options)
6228 .await
6229 .map(crate::Response::into_body)
6230 }
6231
6232 pub fn poller(
6234 self,
6235 ) -> impl google_cloud_lro::Poller<
6236 crate::model::ImportDocumentsResponse,
6237 crate::model::ImportDocumentsMetadata,
6238 > {
6239 type Operation = google_cloud_lro::internal::Operation<
6240 crate::model::ImportDocumentsResponse,
6241 crate::model::ImportDocumentsMetadata,
6242 >;
6243 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6244 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6245 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
6246 if let Some(ref mut details) = poller_options.tracing {
6247 details.method_name = "google_cloud_discoveryengine_v1::client::DocumentService::import_documents::until_done";
6248 }
6249
6250 let stub = self.0.stub.clone();
6251 let mut options = self.0.options.clone();
6252 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6253 let query = move |name| {
6254 let stub = stub.clone();
6255 let options = options.clone();
6256 async {
6257 let op = GetOperation::new(stub)
6258 .set_name(name)
6259 .with_options(options)
6260 .send()
6261 .await?;
6262 Ok(Operation::new(op))
6263 }
6264 };
6265
6266 let start = move || async {
6267 let op = self.send().await?;
6268 Ok(Operation::new(op))
6269 };
6270
6271 use google_cloud_lro::internal::PollerExt;
6272 {
6273 google_cloud_lro::internal::new_poller(
6274 polling_error_policy,
6275 polling_backoff_policy,
6276 start,
6277 query,
6278 )
6279 }
6280 .with_options(poller_options)
6281 }
6282
6283 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6287 self.0.request.parent = v.into();
6288 self
6289 }
6290
6291 pub fn set_error_config<T>(mut self, v: T) -> Self
6293 where
6294 T: std::convert::Into<crate::model::ImportErrorConfig>,
6295 {
6296 self.0.request.error_config = std::option::Option::Some(v.into());
6297 self
6298 }
6299
6300 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6302 where
6303 T: std::convert::Into<crate::model::ImportErrorConfig>,
6304 {
6305 self.0.request.error_config = v.map(|x| x.into());
6306 self
6307 }
6308
6309 pub fn set_reconciliation_mode<
6311 T: Into<crate::model::import_documents_request::ReconciliationMode>,
6312 >(
6313 mut self,
6314 v: T,
6315 ) -> Self {
6316 self.0.request.reconciliation_mode = v.into();
6317 self
6318 }
6319
6320 pub fn set_update_mask<T>(mut self, v: T) -> Self
6322 where
6323 T: std::convert::Into<wkt::FieldMask>,
6324 {
6325 self.0.request.update_mask = std::option::Option::Some(v.into());
6326 self
6327 }
6328
6329 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6331 where
6332 T: std::convert::Into<wkt::FieldMask>,
6333 {
6334 self.0.request.update_mask = v.map(|x| x.into());
6335 self
6336 }
6337
6338 pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
6340 self.0.request.auto_generate_ids = v.into();
6341 self
6342 }
6343
6344 pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
6346 self.0.request.id_field = v.into();
6347 self
6348 }
6349
6350 pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
6352 self.0.request.force_refresh_content = v.into();
6353 self
6354 }
6355
6356 pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
6361 mut self,
6362 v: T,
6363 ) -> Self {
6364 self.0.request.source = v.into();
6365 self
6366 }
6367
6368 pub fn set_inline_source<
6374 T: std::convert::Into<
6375 std::boxed::Box<crate::model::import_documents_request::InlineSource>,
6376 >,
6377 >(
6378 mut self,
6379 v: T,
6380 ) -> Self {
6381 self.0.request = self.0.request.set_inline_source(v);
6382 self
6383 }
6384
6385 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6391 mut self,
6392 v: T,
6393 ) -> Self {
6394 self.0.request = self.0.request.set_gcs_source(v);
6395 self
6396 }
6397
6398 pub fn set_bigquery_source<
6404 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
6405 >(
6406 mut self,
6407 v: T,
6408 ) -> Self {
6409 self.0.request = self.0.request.set_bigquery_source(v);
6410 self
6411 }
6412
6413 pub fn set_fhir_store_source<
6419 T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
6420 >(
6421 mut self,
6422 v: T,
6423 ) -> Self {
6424 self.0.request = self.0.request.set_fhir_store_source(v);
6425 self
6426 }
6427
6428 pub fn set_spanner_source<
6434 T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
6435 >(
6436 mut self,
6437 v: T,
6438 ) -> Self {
6439 self.0.request = self.0.request.set_spanner_source(v);
6440 self
6441 }
6442
6443 pub fn set_cloud_sql_source<
6449 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
6450 >(
6451 mut self,
6452 v: T,
6453 ) -> Self {
6454 self.0.request = self.0.request.set_cloud_sql_source(v);
6455 self
6456 }
6457
6458 pub fn set_firestore_source<
6464 T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
6465 >(
6466 mut self,
6467 v: T,
6468 ) -> Self {
6469 self.0.request = self.0.request.set_firestore_source(v);
6470 self
6471 }
6472
6473 pub fn set_alloy_db_source<
6479 T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
6480 >(
6481 mut self,
6482 v: T,
6483 ) -> Self {
6484 self.0.request = self.0.request.set_alloy_db_source(v);
6485 self
6486 }
6487
6488 pub fn set_bigtable_source<
6494 T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
6495 >(
6496 mut self,
6497 v: T,
6498 ) -> Self {
6499 self.0.request = self.0.request.set_bigtable_source(v);
6500 self
6501 }
6502 }
6503
6504 #[doc(hidden)]
6505 impl crate::RequestBuilder for ImportDocuments {
6506 fn request_options(&mut self) -> &mut crate::RequestOptions {
6507 &mut self.0.options
6508 }
6509 }
6510
6511 #[derive(Clone, Debug)]
6529 pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
6530
6531 impl PurgeDocuments {
6532 pub(crate) fn new(
6533 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6534 ) -> Self {
6535 Self(RequestBuilder::new(stub))
6536 }
6537
6538 pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
6540 self.0.request = v.into();
6541 self
6542 }
6543
6544 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6546 self.0.options = v.into();
6547 self
6548 }
6549
6550 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6557 (*self.0.stub)
6558 .purge_documents(self.0.request, self.0.options)
6559 .await
6560 .map(crate::Response::into_body)
6561 }
6562
6563 pub fn poller(
6565 self,
6566 ) -> impl google_cloud_lro::Poller<
6567 crate::model::PurgeDocumentsResponse,
6568 crate::model::PurgeDocumentsMetadata,
6569 > {
6570 type Operation = google_cloud_lro::internal::Operation<
6571 crate::model::PurgeDocumentsResponse,
6572 crate::model::PurgeDocumentsMetadata,
6573 >;
6574 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6575 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6576 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
6577 if let Some(ref mut details) = poller_options.tracing {
6578 details.method_name = "google_cloud_discoveryengine_v1::client::DocumentService::purge_documents::until_done";
6579 }
6580
6581 let stub = self.0.stub.clone();
6582 let mut options = self.0.options.clone();
6583 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6584 let query = move |name| {
6585 let stub = stub.clone();
6586 let options = options.clone();
6587 async {
6588 let op = GetOperation::new(stub)
6589 .set_name(name)
6590 .with_options(options)
6591 .send()
6592 .await?;
6593 Ok(Operation::new(op))
6594 }
6595 };
6596
6597 let start = move || async {
6598 let op = self.send().await?;
6599 Ok(Operation::new(op))
6600 };
6601
6602 use google_cloud_lro::internal::PollerExt;
6603 {
6604 google_cloud_lro::internal::new_poller(
6605 polling_error_policy,
6606 polling_backoff_policy,
6607 start,
6608 query,
6609 )
6610 }
6611 .with_options(poller_options)
6612 }
6613
6614 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6618 self.0.request.parent = v.into();
6619 self
6620 }
6621
6622 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6626 self.0.request.filter = v.into();
6627 self
6628 }
6629
6630 pub fn set_error_config<T>(mut self, v: T) -> Self
6632 where
6633 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6634 {
6635 self.0.request.error_config = std::option::Option::Some(v.into());
6636 self
6637 }
6638
6639 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6641 where
6642 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6643 {
6644 self.0.request.error_config = v.map(|x| x.into());
6645 self
6646 }
6647
6648 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6650 self.0.request.force = v.into();
6651 self
6652 }
6653
6654 pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6659 mut self,
6660 v: T,
6661 ) -> Self {
6662 self.0.request.source = v.into();
6663 self
6664 }
6665
6666 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6672 mut self,
6673 v: T,
6674 ) -> Self {
6675 self.0.request = self.0.request.set_gcs_source(v);
6676 self
6677 }
6678
6679 pub fn set_inline_source<
6685 T: std::convert::Into<
6686 std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6687 >,
6688 >(
6689 mut self,
6690 v: T,
6691 ) -> Self {
6692 self.0.request = self.0.request.set_inline_source(v);
6693 self
6694 }
6695 }
6696
6697 #[doc(hidden)]
6698 impl crate::RequestBuilder for PurgeDocuments {
6699 fn request_options(&mut self) -> &mut crate::RequestOptions {
6700 &mut self.0.options
6701 }
6702 }
6703
6704 #[derive(Clone, Debug)]
6721 pub struct BatchGetDocumentsMetadata(
6722 RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6723 );
6724
6725 impl BatchGetDocumentsMetadata {
6726 pub(crate) fn new(
6727 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6728 ) -> Self {
6729 Self(RequestBuilder::new(stub))
6730 }
6731
6732 pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6734 mut self,
6735 v: V,
6736 ) -> Self {
6737 self.0.request = v.into();
6738 self
6739 }
6740
6741 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6743 self.0.options = v.into();
6744 self
6745 }
6746
6747 pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6749 (*self.0.stub)
6750 .batch_get_documents_metadata(self.0.request, self.0.options)
6751 .await
6752 .map(crate::Response::into_body)
6753 }
6754
6755 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6759 self.0.request.parent = v.into();
6760 self
6761 }
6762
6763 pub fn set_matcher<T>(mut self, v: T) -> Self
6767 where
6768 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6769 {
6770 self.0.request.matcher = std::option::Option::Some(v.into());
6771 self
6772 }
6773
6774 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6778 where
6779 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6780 {
6781 self.0.request.matcher = v.map(|x| x.into());
6782 self
6783 }
6784 }
6785
6786 #[doc(hidden)]
6787 impl crate::RequestBuilder for BatchGetDocumentsMetadata {
6788 fn request_options(&mut self) -> &mut crate::RequestOptions {
6789 &mut self.0.options
6790 }
6791 }
6792
6793 #[derive(Clone, Debug)]
6814 pub struct ListOperations(
6815 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6816 );
6817
6818 impl ListOperations {
6819 pub(crate) fn new(
6820 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6821 ) -> Self {
6822 Self(RequestBuilder::new(stub))
6823 }
6824
6825 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6827 mut self,
6828 v: V,
6829 ) -> Self {
6830 self.0.request = v.into();
6831 self
6832 }
6833
6834 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6836 self.0.options = v.into();
6837 self
6838 }
6839
6840 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6842 (*self.0.stub)
6843 .list_operations(self.0.request, self.0.options)
6844 .await
6845 .map(crate::Response::into_body)
6846 }
6847
6848 pub fn by_page(
6850 self,
6851 ) -> impl google_cloud_gax::paginator::Paginator<
6852 google_cloud_longrunning::model::ListOperationsResponse,
6853 crate::Error,
6854 > {
6855 use std::clone::Clone;
6856 let token = self.0.request.page_token.clone();
6857 let execute = move |token: String| {
6858 let mut builder = self.clone();
6859 builder.0.request = builder.0.request.set_page_token(token);
6860 builder.send()
6861 };
6862 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6863 }
6864
6865 pub fn by_item(
6867 self,
6868 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6869 google_cloud_longrunning::model::ListOperationsResponse,
6870 crate::Error,
6871 > {
6872 use google_cloud_gax::paginator::Paginator;
6873 self.by_page().items()
6874 }
6875
6876 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6878 self.0.request.name = v.into();
6879 self
6880 }
6881
6882 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6884 self.0.request.filter = v.into();
6885 self
6886 }
6887
6888 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6890 self.0.request.page_size = v.into();
6891 self
6892 }
6893
6894 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6896 self.0.request.page_token = v.into();
6897 self
6898 }
6899
6900 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6902 self.0.request.return_partial_success = v.into();
6903 self
6904 }
6905 }
6906
6907 #[doc(hidden)]
6908 impl crate::RequestBuilder for ListOperations {
6909 fn request_options(&mut self) -> &mut crate::RequestOptions {
6910 &mut self.0.options
6911 }
6912 }
6913
6914 #[derive(Clone, Debug)]
6931 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6932
6933 impl GetOperation {
6934 pub(crate) fn new(
6935 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6936 ) -> Self {
6937 Self(RequestBuilder::new(stub))
6938 }
6939
6940 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6942 mut self,
6943 v: V,
6944 ) -> Self {
6945 self.0.request = v.into();
6946 self
6947 }
6948
6949 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6951 self.0.options = v.into();
6952 self
6953 }
6954
6955 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6957 (*self.0.stub)
6958 .get_operation(self.0.request, self.0.options)
6959 .await
6960 .map(crate::Response::into_body)
6961 }
6962
6963 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6965 self.0.request.name = v.into();
6966 self
6967 }
6968 }
6969
6970 #[doc(hidden)]
6971 impl crate::RequestBuilder for GetOperation {
6972 fn request_options(&mut self) -> &mut crate::RequestOptions {
6973 &mut self.0.options
6974 }
6975 }
6976
6977 #[derive(Clone, Debug)]
6994 pub struct CancelOperation(
6995 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
6996 );
6997
6998 impl CancelOperation {
6999 pub(crate) fn new(
7000 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
7001 ) -> Self {
7002 Self(RequestBuilder::new(stub))
7003 }
7004
7005 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7007 mut self,
7008 v: V,
7009 ) -> Self {
7010 self.0.request = v.into();
7011 self
7012 }
7013
7014 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7016 self.0.options = v.into();
7017 self
7018 }
7019
7020 pub async fn send(self) -> Result<()> {
7022 (*self.0.stub)
7023 .cancel_operation(self.0.request, self.0.options)
7024 .await
7025 .map(crate::Response::into_body)
7026 }
7027
7028 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7030 self.0.request.name = v.into();
7031 self
7032 }
7033 }
7034
7035 #[doc(hidden)]
7036 impl crate::RequestBuilder for CancelOperation {
7037 fn request_options(&mut self) -> &mut crate::RequestOptions {
7038 &mut self.0.options
7039 }
7040 }
7041}
7042
7043#[cfg(feature = "engine-service")]
7045#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
7046pub mod engine_service {
7047 use crate::Result;
7048
7049 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7063
7064 pub(crate) mod client {
7065 use super::super::super::client::EngineService;
7066 pub struct Factory;
7067 impl crate::ClientFactory for Factory {
7068 type Client = EngineService;
7069 type Credentials = gaxi::options::Credentials;
7070 async fn build(
7071 self,
7072 config: gaxi::options::ClientConfig,
7073 ) -> crate::ClientBuilderResult<Self::Client> {
7074 Self::Client::new(config).await
7075 }
7076 }
7077 }
7078
7079 #[derive(Clone, Debug)]
7081 pub(crate) struct RequestBuilder<R: std::default::Default> {
7082 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7083 request: R,
7084 options: crate::RequestOptions,
7085 }
7086
7087 impl<R> RequestBuilder<R>
7088 where
7089 R: std::default::Default,
7090 {
7091 pub(crate) fn new(
7092 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7093 ) -> Self {
7094 Self {
7095 stub,
7096 request: R::default(),
7097 options: crate::RequestOptions::default(),
7098 }
7099 }
7100 }
7101
7102 #[derive(Clone, Debug)]
7120 pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
7121
7122 impl CreateEngine {
7123 pub(crate) fn new(
7124 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7125 ) -> Self {
7126 Self(RequestBuilder::new(stub))
7127 }
7128
7129 pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
7131 self.0.request = v.into();
7132 self
7133 }
7134
7135 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7137 self.0.options = v.into();
7138 self
7139 }
7140
7141 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7148 (*self.0.stub)
7149 .create_engine(self.0.request, self.0.options)
7150 .await
7151 .map(crate::Response::into_body)
7152 }
7153
7154 pub fn poller(
7156 self,
7157 ) -> impl google_cloud_lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata>
7158 {
7159 type Operation = google_cloud_lro::internal::Operation<
7160 crate::model::Engine,
7161 crate::model::CreateEngineMetadata,
7162 >;
7163 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7164 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7165 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
7166 if let Some(ref mut details) = poller_options.tracing {
7167 details.method_name = "google_cloud_discoveryengine_v1::client::EngineService::create_engine::until_done";
7168 }
7169
7170 let stub = self.0.stub.clone();
7171 let mut options = self.0.options.clone();
7172 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7173 let query = move |name| {
7174 let stub = stub.clone();
7175 let options = options.clone();
7176 async {
7177 let op = GetOperation::new(stub)
7178 .set_name(name)
7179 .with_options(options)
7180 .send()
7181 .await?;
7182 Ok(Operation::new(op))
7183 }
7184 };
7185
7186 let start = move || async {
7187 let op = self.send().await?;
7188 Ok(Operation::new(op))
7189 };
7190
7191 use google_cloud_lro::internal::PollerExt;
7192 {
7193 google_cloud_lro::internal::new_poller(
7194 polling_error_policy,
7195 polling_backoff_policy,
7196 start,
7197 query,
7198 )
7199 }
7200 .with_options(poller_options)
7201 }
7202
7203 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7207 self.0.request.parent = v.into();
7208 self
7209 }
7210
7211 pub fn set_engine<T>(mut self, v: T) -> Self
7215 where
7216 T: std::convert::Into<crate::model::Engine>,
7217 {
7218 self.0.request.engine = std::option::Option::Some(v.into());
7219 self
7220 }
7221
7222 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
7226 where
7227 T: std::convert::Into<crate::model::Engine>,
7228 {
7229 self.0.request.engine = v.map(|x| x.into());
7230 self
7231 }
7232
7233 pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7237 self.0.request.engine_id = v.into();
7238 self
7239 }
7240 }
7241
7242 #[doc(hidden)]
7243 impl crate::RequestBuilder for CreateEngine {
7244 fn request_options(&mut self) -> &mut crate::RequestOptions {
7245 &mut self.0.options
7246 }
7247 }
7248
7249 #[derive(Clone, Debug)]
7267 pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
7268
7269 impl DeleteEngine {
7270 pub(crate) fn new(
7271 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7272 ) -> Self {
7273 Self(RequestBuilder::new(stub))
7274 }
7275
7276 pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
7278 self.0.request = v.into();
7279 self
7280 }
7281
7282 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7284 self.0.options = v.into();
7285 self
7286 }
7287
7288 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7295 (*self.0.stub)
7296 .delete_engine(self.0.request, self.0.options)
7297 .await
7298 .map(crate::Response::into_body)
7299 }
7300
7301 pub fn poller(
7303 self,
7304 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteEngineMetadata> {
7305 type Operation = google_cloud_lro::internal::Operation<
7306 wkt::Empty,
7307 crate::model::DeleteEngineMetadata,
7308 >;
7309 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7310 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7311 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
7312 if let Some(ref mut details) = poller_options.tracing {
7313 details.method_name = "google_cloud_discoveryengine_v1::client::EngineService::delete_engine::until_done";
7314 }
7315
7316 let stub = self.0.stub.clone();
7317 let mut options = self.0.options.clone();
7318 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7319 let query = move |name| {
7320 let stub = stub.clone();
7321 let options = options.clone();
7322 async {
7323 let op = GetOperation::new(stub)
7324 .set_name(name)
7325 .with_options(options)
7326 .send()
7327 .await?;
7328 Ok(Operation::new(op))
7329 }
7330 };
7331
7332 let start = move || async {
7333 let op = self.send().await?;
7334 Ok(Operation::new(op))
7335 };
7336
7337 use google_cloud_lro::internal::PollerExt;
7338 {
7339 google_cloud_lro::internal::new_unit_response_poller(
7340 polling_error_policy,
7341 polling_backoff_policy,
7342 start,
7343 query,
7344 )
7345 }
7346 .with_options(poller_options)
7347 }
7348
7349 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7353 self.0.request.name = v.into();
7354 self
7355 }
7356 }
7357
7358 #[doc(hidden)]
7359 impl crate::RequestBuilder for DeleteEngine {
7360 fn request_options(&mut self) -> &mut crate::RequestOptions {
7361 &mut self.0.options
7362 }
7363 }
7364
7365 #[derive(Clone, Debug)]
7382 pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
7383
7384 impl UpdateEngine {
7385 pub(crate) fn new(
7386 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7387 ) -> Self {
7388 Self(RequestBuilder::new(stub))
7389 }
7390
7391 pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
7393 self.0.request = v.into();
7394 self
7395 }
7396
7397 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7399 self.0.options = v.into();
7400 self
7401 }
7402
7403 pub async fn send(self) -> Result<crate::model::Engine> {
7405 (*self.0.stub)
7406 .update_engine(self.0.request, self.0.options)
7407 .await
7408 .map(crate::Response::into_body)
7409 }
7410
7411 pub fn set_engine<T>(mut self, v: T) -> Self
7415 where
7416 T: std::convert::Into<crate::model::Engine>,
7417 {
7418 self.0.request.engine = std::option::Option::Some(v.into());
7419 self
7420 }
7421
7422 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
7426 where
7427 T: std::convert::Into<crate::model::Engine>,
7428 {
7429 self.0.request.engine = v.map(|x| x.into());
7430 self
7431 }
7432
7433 pub fn set_update_mask<T>(mut self, v: T) -> Self
7435 where
7436 T: std::convert::Into<wkt::FieldMask>,
7437 {
7438 self.0.request.update_mask = std::option::Option::Some(v.into());
7439 self
7440 }
7441
7442 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7444 where
7445 T: std::convert::Into<wkt::FieldMask>,
7446 {
7447 self.0.request.update_mask = v.map(|x| x.into());
7448 self
7449 }
7450 }
7451
7452 #[doc(hidden)]
7453 impl crate::RequestBuilder for UpdateEngine {
7454 fn request_options(&mut self) -> &mut crate::RequestOptions {
7455 &mut self.0.options
7456 }
7457 }
7458
7459 #[derive(Clone, Debug)]
7476 pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
7477
7478 impl GetEngine {
7479 pub(crate) fn new(
7480 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7481 ) -> Self {
7482 Self(RequestBuilder::new(stub))
7483 }
7484
7485 pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
7487 self.0.request = v.into();
7488 self
7489 }
7490
7491 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7493 self.0.options = v.into();
7494 self
7495 }
7496
7497 pub async fn send(self) -> Result<crate::model::Engine> {
7499 (*self.0.stub)
7500 .get_engine(self.0.request, self.0.options)
7501 .await
7502 .map(crate::Response::into_body)
7503 }
7504
7505 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7509 self.0.request.name = v.into();
7510 self
7511 }
7512 }
7513
7514 #[doc(hidden)]
7515 impl crate::RequestBuilder for GetEngine {
7516 fn request_options(&mut self) -> &mut crate::RequestOptions {
7517 &mut self.0.options
7518 }
7519 }
7520
7521 #[derive(Clone, Debug)]
7542 pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
7543
7544 impl ListEngines {
7545 pub(crate) fn new(
7546 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7547 ) -> Self {
7548 Self(RequestBuilder::new(stub))
7549 }
7550
7551 pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
7553 self.0.request = v.into();
7554 self
7555 }
7556
7557 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7559 self.0.options = v.into();
7560 self
7561 }
7562
7563 pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
7565 (*self.0.stub)
7566 .list_engines(self.0.request, self.0.options)
7567 .await
7568 .map(crate::Response::into_body)
7569 }
7570
7571 pub fn by_page(
7573 self,
7574 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListEnginesResponse, crate::Error>
7575 {
7576 use std::clone::Clone;
7577 let token = self.0.request.page_token.clone();
7578 let execute = move |token: String| {
7579 let mut builder = self.clone();
7580 builder.0.request = builder.0.request.set_page_token(token);
7581 builder.send()
7582 };
7583 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7584 }
7585
7586 pub fn by_item(
7588 self,
7589 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7590 crate::model::ListEnginesResponse,
7591 crate::Error,
7592 > {
7593 use google_cloud_gax::paginator::Paginator;
7594 self.by_page().items()
7595 }
7596
7597 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7601 self.0.request.parent = v.into();
7602 self
7603 }
7604
7605 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7607 self.0.request.page_size = v.into();
7608 self
7609 }
7610
7611 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7613 self.0.request.page_token = v.into();
7614 self
7615 }
7616
7617 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7619 self.0.request.filter = v.into();
7620 self
7621 }
7622 }
7623
7624 #[doc(hidden)]
7625 impl crate::RequestBuilder for ListEngines {
7626 fn request_options(&mut self) -> &mut crate::RequestOptions {
7627 &mut self.0.options
7628 }
7629 }
7630
7631 #[derive(Clone, Debug)]
7652 pub struct ListOperations(
7653 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7654 );
7655
7656 impl ListOperations {
7657 pub(crate) fn new(
7658 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7659 ) -> Self {
7660 Self(RequestBuilder::new(stub))
7661 }
7662
7663 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7665 mut self,
7666 v: V,
7667 ) -> Self {
7668 self.0.request = v.into();
7669 self
7670 }
7671
7672 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7674 self.0.options = v.into();
7675 self
7676 }
7677
7678 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7680 (*self.0.stub)
7681 .list_operations(self.0.request, self.0.options)
7682 .await
7683 .map(crate::Response::into_body)
7684 }
7685
7686 pub fn by_page(
7688 self,
7689 ) -> impl google_cloud_gax::paginator::Paginator<
7690 google_cloud_longrunning::model::ListOperationsResponse,
7691 crate::Error,
7692 > {
7693 use std::clone::Clone;
7694 let token = self.0.request.page_token.clone();
7695 let execute = move |token: String| {
7696 let mut builder = self.clone();
7697 builder.0.request = builder.0.request.set_page_token(token);
7698 builder.send()
7699 };
7700 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7701 }
7702
7703 pub fn by_item(
7705 self,
7706 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7707 google_cloud_longrunning::model::ListOperationsResponse,
7708 crate::Error,
7709 > {
7710 use google_cloud_gax::paginator::Paginator;
7711 self.by_page().items()
7712 }
7713
7714 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7716 self.0.request.name = v.into();
7717 self
7718 }
7719
7720 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7722 self.0.request.filter = v.into();
7723 self
7724 }
7725
7726 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7728 self.0.request.page_size = v.into();
7729 self
7730 }
7731
7732 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7734 self.0.request.page_token = v.into();
7735 self
7736 }
7737
7738 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7740 self.0.request.return_partial_success = v.into();
7741 self
7742 }
7743 }
7744
7745 #[doc(hidden)]
7746 impl crate::RequestBuilder for ListOperations {
7747 fn request_options(&mut self) -> &mut crate::RequestOptions {
7748 &mut self.0.options
7749 }
7750 }
7751
7752 #[derive(Clone, Debug)]
7769 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7770
7771 impl GetOperation {
7772 pub(crate) fn new(
7773 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7774 ) -> Self {
7775 Self(RequestBuilder::new(stub))
7776 }
7777
7778 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7780 mut self,
7781 v: V,
7782 ) -> Self {
7783 self.0.request = v.into();
7784 self
7785 }
7786
7787 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7789 self.0.options = v.into();
7790 self
7791 }
7792
7793 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7795 (*self.0.stub)
7796 .get_operation(self.0.request, self.0.options)
7797 .await
7798 .map(crate::Response::into_body)
7799 }
7800
7801 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7803 self.0.request.name = v.into();
7804 self
7805 }
7806 }
7807
7808 #[doc(hidden)]
7809 impl crate::RequestBuilder for GetOperation {
7810 fn request_options(&mut self) -> &mut crate::RequestOptions {
7811 &mut self.0.options
7812 }
7813 }
7814
7815 #[derive(Clone, Debug)]
7832 pub struct CancelOperation(
7833 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7834 );
7835
7836 impl CancelOperation {
7837 pub(crate) fn new(
7838 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7839 ) -> Self {
7840 Self(RequestBuilder::new(stub))
7841 }
7842
7843 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7845 mut self,
7846 v: V,
7847 ) -> Self {
7848 self.0.request = v.into();
7849 self
7850 }
7851
7852 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7854 self.0.options = v.into();
7855 self
7856 }
7857
7858 pub async fn send(self) -> Result<()> {
7860 (*self.0.stub)
7861 .cancel_operation(self.0.request, self.0.options)
7862 .await
7863 .map(crate::Response::into_body)
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
7873 #[doc(hidden)]
7874 impl crate::RequestBuilder for CancelOperation {
7875 fn request_options(&mut self) -> &mut crate::RequestOptions {
7876 &mut self.0.options
7877 }
7878 }
7879}
7880
7881#[cfg(feature = "grounded-generation-service")]
7883#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7884pub mod grounded_generation_service {
7885 use crate::Result;
7886
7887 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7901
7902 pub(crate) mod client {
7903 use super::super::super::client::GroundedGenerationService;
7904 pub struct Factory;
7905 impl crate::ClientFactory for Factory {
7906 type Client = GroundedGenerationService;
7907 type Credentials = gaxi::options::Credentials;
7908 async fn build(
7909 self,
7910 config: gaxi::options::ClientConfig,
7911 ) -> crate::ClientBuilderResult<Self::Client> {
7912 Self::Client::new(config).await
7913 }
7914 }
7915 }
7916
7917 #[derive(Clone, Debug)]
7919 pub(crate) struct RequestBuilder<R: std::default::Default> {
7920 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7921 request: R,
7922 options: crate::RequestOptions,
7923 }
7924
7925 impl<R> RequestBuilder<R>
7926 where
7927 R: std::default::Default,
7928 {
7929 pub(crate) fn new(
7930 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7931 ) -> Self {
7932 Self {
7933 stub,
7934 request: R::default(),
7935 options: crate::RequestOptions::default(),
7936 }
7937 }
7938 }
7939
7940 #[derive(Clone, Debug)]
7942 pub(crate) struct BidiStreamBuilder {
7943 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7944 options: crate::RequestOptions,
7945 }
7946
7947 impl BidiStreamBuilder {
7948 pub(crate) fn new(
7949 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7950 ) -> Self {
7951 Self {
7952 stub,
7953 options: crate::RequestOptions::default(),
7954 }
7955 }
7956 }
7957
7958 #[derive(Clone, Debug)]
7983 pub struct StreamGenerateGroundedContent(BidiStreamBuilder);
7984
7985 impl StreamGenerateGroundedContent {
7986 pub(crate) fn new(
7987 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7988 ) -> Self {
7989 Self(BidiStreamBuilder::new(stub))
7990 }
7991
7992 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7994 self.0.options = v.into();
7995 self
7996 }
7997
7998 pub fn build(
8000 self,
8001 ) -> (
8002 google_cloud_gax::streaming::RequestSender<
8003 crate::model::GenerateGroundedContentRequest,
8004 >,
8005 google_cloud_gax::streaming::ResponseStream<
8006 crate::model::GenerateGroundedContentResponse,
8007 >,
8008 ) {
8009 (*self.0.stub).stream_generate_grounded_content(self.0.options)
8010 }
8011 }
8012
8013 #[doc(hidden)]
8014 impl crate::RequestBuilder for StreamGenerateGroundedContent {
8015 fn request_options(&mut self) -> &mut crate::RequestOptions {
8016 &mut self.0.options
8017 }
8018 }
8019
8020 #[derive(Clone, Debug)]
8037 pub struct GenerateGroundedContent(
8038 RequestBuilder<crate::model::GenerateGroundedContentRequest>,
8039 );
8040
8041 impl GenerateGroundedContent {
8042 pub(crate) fn new(
8043 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
8044 ) -> Self {
8045 Self(RequestBuilder::new(stub))
8046 }
8047
8048 pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
8050 mut self,
8051 v: V,
8052 ) -> Self {
8053 self.0.request = v.into();
8054 self
8055 }
8056
8057 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8059 self.0.options = v.into();
8060 self
8061 }
8062
8063 pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
8065 (*self.0.stub)
8066 .generate_grounded_content(self.0.request, self.0.options)
8067 .await
8068 .map(crate::Response::into_body)
8069 }
8070
8071 pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
8075 self.0.request.location = v.into();
8076 self
8077 }
8078
8079 pub fn set_system_instruction<T>(mut self, v: T) -> Self
8081 where
8082 T: std::convert::Into<crate::model::GroundedGenerationContent>,
8083 {
8084 self.0.request.system_instruction = std::option::Option::Some(v.into());
8085 self
8086 }
8087
8088 pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
8090 where
8091 T: std::convert::Into<crate::model::GroundedGenerationContent>,
8092 {
8093 self.0.request.system_instruction = v.map(|x| x.into());
8094 self
8095 }
8096
8097 pub fn set_contents<T, V>(mut self, v: T) -> Self
8099 where
8100 T: std::iter::IntoIterator<Item = V>,
8101 V: std::convert::Into<crate::model::GroundedGenerationContent>,
8102 {
8103 use std::iter::Iterator;
8104 self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
8105 self
8106 }
8107
8108 pub fn set_generation_spec<T>(mut self, v: T) -> Self
8110 where
8111 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
8112 {
8113 self.0.request.generation_spec = std::option::Option::Some(v.into());
8114 self
8115 }
8116
8117 pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
8119 where
8120 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
8121 {
8122 self.0.request.generation_spec = v.map(|x| x.into());
8123 self
8124 }
8125
8126 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
8128 where
8129 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
8130 {
8131 self.0.request.grounding_spec = std::option::Option::Some(v.into());
8132 self
8133 }
8134
8135 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
8137 where
8138 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
8139 {
8140 self.0.request.grounding_spec = v.map(|x| x.into());
8141 self
8142 }
8143
8144 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8146 where
8147 T: std::iter::IntoIterator<Item = (K, V)>,
8148 K: std::convert::Into<std::string::String>,
8149 V: std::convert::Into<std::string::String>,
8150 {
8151 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8152 self
8153 }
8154 }
8155
8156 #[doc(hidden)]
8157 impl crate::RequestBuilder for GenerateGroundedContent {
8158 fn request_options(&mut self) -> &mut crate::RequestOptions {
8159 &mut self.0.options
8160 }
8161 }
8162
8163 #[derive(Clone, Debug)]
8180 pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
8181
8182 impl CheckGrounding {
8183 pub(crate) fn new(
8184 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
8185 ) -> Self {
8186 Self(RequestBuilder::new(stub))
8187 }
8188
8189 pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
8191 self.0.request = v.into();
8192 self
8193 }
8194
8195 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8197 self.0.options = v.into();
8198 self
8199 }
8200
8201 pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
8203 (*self.0.stub)
8204 .check_grounding(self.0.request, self.0.options)
8205 .await
8206 .map(crate::Response::into_body)
8207 }
8208
8209 pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
8213 self.0.request.grounding_config = v.into();
8214 self
8215 }
8216
8217 pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
8219 self.0.request.answer_candidate = v.into();
8220 self
8221 }
8222
8223 pub fn set_facts<T, V>(mut self, v: T) -> Self
8225 where
8226 T: std::iter::IntoIterator<Item = V>,
8227 V: std::convert::Into<crate::model::GroundingFact>,
8228 {
8229 use std::iter::Iterator;
8230 self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
8231 self
8232 }
8233
8234 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
8236 where
8237 T: std::convert::Into<crate::model::CheckGroundingSpec>,
8238 {
8239 self.0.request.grounding_spec = std::option::Option::Some(v.into());
8240 self
8241 }
8242
8243 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
8245 where
8246 T: std::convert::Into<crate::model::CheckGroundingSpec>,
8247 {
8248 self.0.request.grounding_spec = v.map(|x| x.into());
8249 self
8250 }
8251
8252 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8254 where
8255 T: std::iter::IntoIterator<Item = (K, V)>,
8256 K: std::convert::Into<std::string::String>,
8257 V: std::convert::Into<std::string::String>,
8258 {
8259 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8260 self
8261 }
8262 }
8263
8264 #[doc(hidden)]
8265 impl crate::RequestBuilder for CheckGrounding {
8266 fn request_options(&mut self) -> &mut crate::RequestOptions {
8267 &mut self.0.options
8268 }
8269 }
8270
8271 #[derive(Clone, Debug)]
8292 pub struct ListOperations(
8293 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8294 );
8295
8296 impl ListOperations {
8297 pub(crate) fn new(
8298 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
8299 ) -> Self {
8300 Self(RequestBuilder::new(stub))
8301 }
8302
8303 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8305 mut self,
8306 v: V,
8307 ) -> Self {
8308 self.0.request = v.into();
8309 self
8310 }
8311
8312 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8314 self.0.options = v.into();
8315 self
8316 }
8317
8318 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8320 (*self.0.stub)
8321 .list_operations(self.0.request, self.0.options)
8322 .await
8323 .map(crate::Response::into_body)
8324 }
8325
8326 pub fn by_page(
8328 self,
8329 ) -> impl google_cloud_gax::paginator::Paginator<
8330 google_cloud_longrunning::model::ListOperationsResponse,
8331 crate::Error,
8332 > {
8333 use std::clone::Clone;
8334 let token = self.0.request.page_token.clone();
8335 let execute = move |token: String| {
8336 let mut builder = self.clone();
8337 builder.0.request = builder.0.request.set_page_token(token);
8338 builder.send()
8339 };
8340 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8341 }
8342
8343 pub fn by_item(
8345 self,
8346 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8347 google_cloud_longrunning::model::ListOperationsResponse,
8348 crate::Error,
8349 > {
8350 use google_cloud_gax::paginator::Paginator;
8351 self.by_page().items()
8352 }
8353
8354 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8356 self.0.request.name = v.into();
8357 self
8358 }
8359
8360 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8362 self.0.request.filter = v.into();
8363 self
8364 }
8365
8366 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8368 self.0.request.page_size = v.into();
8369 self
8370 }
8371
8372 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8374 self.0.request.page_token = v.into();
8375 self
8376 }
8377
8378 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8380 self.0.request.return_partial_success = v.into();
8381 self
8382 }
8383 }
8384
8385 #[doc(hidden)]
8386 impl crate::RequestBuilder for ListOperations {
8387 fn request_options(&mut self) -> &mut crate::RequestOptions {
8388 &mut self.0.options
8389 }
8390 }
8391
8392 #[derive(Clone, Debug)]
8409 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8410
8411 impl GetOperation {
8412 pub(crate) fn new(
8413 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
8414 ) -> Self {
8415 Self(RequestBuilder::new(stub))
8416 }
8417
8418 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8420 mut self,
8421 v: V,
8422 ) -> Self {
8423 self.0.request = v.into();
8424 self
8425 }
8426
8427 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8429 self.0.options = v.into();
8430 self
8431 }
8432
8433 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8435 (*self.0.stub)
8436 .get_operation(self.0.request, self.0.options)
8437 .await
8438 .map(crate::Response::into_body)
8439 }
8440
8441 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8443 self.0.request.name = v.into();
8444 self
8445 }
8446 }
8447
8448 #[doc(hidden)]
8449 impl crate::RequestBuilder for GetOperation {
8450 fn request_options(&mut self) -> &mut crate::RequestOptions {
8451 &mut self.0.options
8452 }
8453 }
8454
8455 #[derive(Clone, Debug)]
8472 pub struct CancelOperation(
8473 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
8474 );
8475
8476 impl CancelOperation {
8477 pub(crate) fn new(
8478 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
8479 ) -> Self {
8480 Self(RequestBuilder::new(stub))
8481 }
8482
8483 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
8485 mut self,
8486 v: V,
8487 ) -> Self {
8488 self.0.request = v.into();
8489 self
8490 }
8491
8492 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8494 self.0.options = v.into();
8495 self
8496 }
8497
8498 pub async fn send(self) -> Result<()> {
8500 (*self.0.stub)
8501 .cancel_operation(self.0.request, self.0.options)
8502 .await
8503 .map(crate::Response::into_body)
8504 }
8505
8506 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8508 self.0.request.name = v.into();
8509 self
8510 }
8511 }
8512
8513 #[doc(hidden)]
8514 impl crate::RequestBuilder for CancelOperation {
8515 fn request_options(&mut self) -> &mut crate::RequestOptions {
8516 &mut self.0.options
8517 }
8518 }
8519}
8520
8521#[cfg(feature = "identity-mapping-store-service")]
8523#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
8524pub mod identity_mapping_store_service {
8525 use crate::Result;
8526
8527 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8541
8542 pub(crate) mod client {
8543 use super::super::super::client::IdentityMappingStoreService;
8544 pub struct Factory;
8545 impl crate::ClientFactory for Factory {
8546 type Client = IdentityMappingStoreService;
8547 type Credentials = gaxi::options::Credentials;
8548 async fn build(
8549 self,
8550 config: gaxi::options::ClientConfig,
8551 ) -> crate::ClientBuilderResult<Self::Client> {
8552 Self::Client::new(config).await
8553 }
8554 }
8555 }
8556
8557 #[derive(Clone, Debug)]
8559 pub(crate) struct RequestBuilder<R: std::default::Default> {
8560 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8561 request: R,
8562 options: crate::RequestOptions,
8563 }
8564
8565 impl<R> RequestBuilder<R>
8566 where
8567 R: std::default::Default,
8568 {
8569 pub(crate) fn new(
8570 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8571 ) -> Self {
8572 Self {
8573 stub,
8574 request: R::default(),
8575 options: crate::RequestOptions::default(),
8576 }
8577 }
8578 }
8579
8580 #[derive(Clone, Debug)]
8597 pub struct CreateIdentityMappingStore(
8598 RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
8599 );
8600
8601 impl CreateIdentityMappingStore {
8602 pub(crate) fn new(
8603 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8604 ) -> Self {
8605 Self(RequestBuilder::new(stub))
8606 }
8607
8608 pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
8610 mut self,
8611 v: V,
8612 ) -> Self {
8613 self.0.request = v.into();
8614 self
8615 }
8616
8617 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8619 self.0.options = v.into();
8620 self
8621 }
8622
8623 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8625 (*self.0.stub)
8626 .create_identity_mapping_store(self.0.request, self.0.options)
8627 .await
8628 .map(crate::Response::into_body)
8629 }
8630
8631 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8635 self.0.request.parent = v.into();
8636 self
8637 }
8638
8639 pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8643 self.0.request.identity_mapping_store_id = v.into();
8644 self
8645 }
8646
8647 pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
8651 where
8652 T: std::convert::Into<crate::model::IdentityMappingStore>,
8653 {
8654 self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
8655 self
8656 }
8657
8658 pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
8662 where
8663 T: std::convert::Into<crate::model::IdentityMappingStore>,
8664 {
8665 self.0.request.identity_mapping_store = v.map(|x| x.into());
8666 self
8667 }
8668
8669 pub fn set_cmek_options<
8674 T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
8675 >(
8676 mut self,
8677 v: T,
8678 ) -> Self {
8679 self.0.request.cmek_options = v.into();
8680 self
8681 }
8682
8683 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
8689 mut self,
8690 v: T,
8691 ) -> Self {
8692 self.0.request = self.0.request.set_cmek_config_name(v);
8693 self
8694 }
8695
8696 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8702 self.0.request = self.0.request.set_disable_cmek(v);
8703 self
8704 }
8705 }
8706
8707 #[doc(hidden)]
8708 impl crate::RequestBuilder for CreateIdentityMappingStore {
8709 fn request_options(&mut self) -> &mut crate::RequestOptions {
8710 &mut self.0.options
8711 }
8712 }
8713
8714 #[derive(Clone, Debug)]
8731 pub struct GetIdentityMappingStore(
8732 RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8733 );
8734
8735 impl GetIdentityMappingStore {
8736 pub(crate) fn new(
8737 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8738 ) -> Self {
8739 Self(RequestBuilder::new(stub))
8740 }
8741
8742 pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8744 mut self,
8745 v: V,
8746 ) -> Self {
8747 self.0.request = v.into();
8748 self
8749 }
8750
8751 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8753 self.0.options = v.into();
8754 self
8755 }
8756
8757 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8759 (*self.0.stub)
8760 .get_identity_mapping_store(self.0.request, self.0.options)
8761 .await
8762 .map(crate::Response::into_body)
8763 }
8764
8765 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8769 self.0.request.name = v.into();
8770 self
8771 }
8772 }
8773
8774 #[doc(hidden)]
8775 impl crate::RequestBuilder for GetIdentityMappingStore {
8776 fn request_options(&mut self) -> &mut crate::RequestOptions {
8777 &mut self.0.options
8778 }
8779 }
8780
8781 #[derive(Clone, Debug)]
8799 pub struct DeleteIdentityMappingStore(
8800 RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8801 );
8802
8803 impl DeleteIdentityMappingStore {
8804 pub(crate) fn new(
8805 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8806 ) -> Self {
8807 Self(RequestBuilder::new(stub))
8808 }
8809
8810 pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8812 mut self,
8813 v: V,
8814 ) -> Self {
8815 self.0.request = v.into();
8816 self
8817 }
8818
8819 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8821 self.0.options = v.into();
8822 self
8823 }
8824
8825 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8832 (*self.0.stub)
8833 .delete_identity_mapping_store(self.0.request, self.0.options)
8834 .await
8835 .map(crate::Response::into_body)
8836 }
8837
8838 pub fn poller(
8840 self,
8841 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata>
8842 {
8843 type Operation = google_cloud_lro::internal::Operation<
8844 wkt::Empty,
8845 crate::model::DeleteIdentityMappingStoreMetadata,
8846 >;
8847 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8848 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8849 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
8850 if let Some(ref mut details) = poller_options.tracing {
8851 details.method_name = "google_cloud_discoveryengine_v1::client::IdentityMappingStoreService::delete_identity_mapping_store::until_done";
8852 }
8853
8854 let stub = self.0.stub.clone();
8855 let mut options = self.0.options.clone();
8856 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8857 let query = move |name| {
8858 let stub = stub.clone();
8859 let options = options.clone();
8860 async {
8861 let op = GetOperation::new(stub)
8862 .set_name(name)
8863 .with_options(options)
8864 .send()
8865 .await?;
8866 Ok(Operation::new(op))
8867 }
8868 };
8869
8870 let start = move || async {
8871 let op = self.send().await?;
8872 Ok(Operation::new(op))
8873 };
8874
8875 use google_cloud_lro::internal::PollerExt;
8876 {
8877 google_cloud_lro::internal::new_unit_response_poller(
8878 polling_error_policy,
8879 polling_backoff_policy,
8880 start,
8881 query,
8882 )
8883 }
8884 .with_options(poller_options)
8885 }
8886
8887 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8891 self.0.request.name = v.into();
8892 self
8893 }
8894 }
8895
8896 #[doc(hidden)]
8897 impl crate::RequestBuilder for DeleteIdentityMappingStore {
8898 fn request_options(&mut self) -> &mut crate::RequestOptions {
8899 &mut self.0.options
8900 }
8901 }
8902
8903 #[derive(Clone, Debug)]
8921 pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8922
8923 impl ImportIdentityMappings {
8924 pub(crate) fn new(
8925 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8926 ) -> Self {
8927 Self(RequestBuilder::new(stub))
8928 }
8929
8930 pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8932 mut self,
8933 v: V,
8934 ) -> Self {
8935 self.0.request = v.into();
8936 self
8937 }
8938
8939 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8941 self.0.options = v.into();
8942 self
8943 }
8944
8945 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8952 (*self.0.stub)
8953 .import_identity_mappings(self.0.request, self.0.options)
8954 .await
8955 .map(crate::Response::into_body)
8956 }
8957
8958 pub fn poller(
8960 self,
8961 ) -> impl google_cloud_lro::Poller<
8962 crate::model::ImportIdentityMappingsResponse,
8963 crate::model::IdentityMappingEntryOperationMetadata,
8964 > {
8965 type Operation = google_cloud_lro::internal::Operation<
8966 crate::model::ImportIdentityMappingsResponse,
8967 crate::model::IdentityMappingEntryOperationMetadata,
8968 >;
8969 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8970 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8971 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
8972 if let Some(ref mut details) = poller_options.tracing {
8973 details.method_name = "google_cloud_discoveryengine_v1::client::IdentityMappingStoreService::import_identity_mappings::until_done";
8974 }
8975
8976 let stub = self.0.stub.clone();
8977 let mut options = self.0.options.clone();
8978 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8979 let query = move |name| {
8980 let stub = stub.clone();
8981 let options = options.clone();
8982 async {
8983 let op = GetOperation::new(stub)
8984 .set_name(name)
8985 .with_options(options)
8986 .send()
8987 .await?;
8988 Ok(Operation::new(op))
8989 }
8990 };
8991
8992 let start = move || async {
8993 let op = self.send().await?;
8994 Ok(Operation::new(op))
8995 };
8996
8997 use google_cloud_lro::internal::PollerExt;
8998 {
8999 google_cloud_lro::internal::new_poller(
9000 polling_error_policy,
9001 polling_backoff_policy,
9002 start,
9003 query,
9004 )
9005 }
9006 .with_options(poller_options)
9007 }
9008
9009 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
9013 self.0.request.identity_mapping_store = v.into();
9014 self
9015 }
9016
9017 pub fn set_source<
9022 T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
9023 >(
9024 mut self,
9025 v: T,
9026 ) -> Self {
9027 self.0.request.source = v.into();
9028 self
9029 }
9030
9031 pub fn set_inline_source<
9037 T: std::convert::Into<
9038 std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
9039 >,
9040 >(
9041 mut self,
9042 v: T,
9043 ) -> Self {
9044 self.0.request = self.0.request.set_inline_source(v);
9045 self
9046 }
9047 }
9048
9049 #[doc(hidden)]
9050 impl crate::RequestBuilder for ImportIdentityMappings {
9051 fn request_options(&mut self) -> &mut crate::RequestOptions {
9052 &mut self.0.options
9053 }
9054 }
9055
9056 #[derive(Clone, Debug)]
9074 pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
9075
9076 impl PurgeIdentityMappings {
9077 pub(crate) fn new(
9078 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9079 ) -> Self {
9080 Self(RequestBuilder::new(stub))
9081 }
9082
9083 pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
9085 mut self,
9086 v: V,
9087 ) -> Self {
9088 self.0.request = v.into();
9089 self
9090 }
9091
9092 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9094 self.0.options = v.into();
9095 self
9096 }
9097
9098 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9105 (*self.0.stub)
9106 .purge_identity_mappings(self.0.request, self.0.options)
9107 .await
9108 .map(crate::Response::into_body)
9109 }
9110
9111 pub fn poller(
9113 self,
9114 ) -> impl google_cloud_lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata>
9115 {
9116 type Operation = google_cloud_lro::internal::Operation<
9117 wkt::Empty,
9118 crate::model::IdentityMappingEntryOperationMetadata,
9119 >;
9120 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9121 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9122 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
9123 if let Some(ref mut details) = poller_options.tracing {
9124 details.method_name = "google_cloud_discoveryengine_v1::client::IdentityMappingStoreService::purge_identity_mappings::until_done";
9125 }
9126
9127 let stub = self.0.stub.clone();
9128 let mut options = self.0.options.clone();
9129 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9130 let query = move |name| {
9131 let stub = stub.clone();
9132 let options = options.clone();
9133 async {
9134 let op = GetOperation::new(stub)
9135 .set_name(name)
9136 .with_options(options)
9137 .send()
9138 .await?;
9139 Ok(Operation::new(op))
9140 }
9141 };
9142
9143 let start = move || async {
9144 let op = self.send().await?;
9145 Ok(Operation::new(op))
9146 };
9147
9148 use google_cloud_lro::internal::PollerExt;
9149 {
9150 google_cloud_lro::internal::new_unit_response_poller(
9151 polling_error_policy,
9152 polling_backoff_policy,
9153 start,
9154 query,
9155 )
9156 }
9157 .with_options(poller_options)
9158 }
9159
9160 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
9164 self.0.request.identity_mapping_store = v.into();
9165 self
9166 }
9167
9168 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9170 self.0.request.filter = v.into();
9171 self
9172 }
9173
9174 pub fn set_force<T>(mut self, v: T) -> Self
9176 where
9177 T: std::convert::Into<bool>,
9178 {
9179 self.0.request.force = std::option::Option::Some(v.into());
9180 self
9181 }
9182
9183 pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
9185 where
9186 T: std::convert::Into<bool>,
9187 {
9188 self.0.request.force = v.map(|x| x.into());
9189 self
9190 }
9191
9192 pub fn set_source<
9197 T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
9198 >(
9199 mut self,
9200 v: T,
9201 ) -> Self {
9202 self.0.request.source = v.into();
9203 self
9204 }
9205
9206 pub fn set_inline_source<
9212 T: std::convert::Into<
9213 std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
9214 >,
9215 >(
9216 mut self,
9217 v: T,
9218 ) -> Self {
9219 self.0.request = self.0.request.set_inline_source(v);
9220 self
9221 }
9222 }
9223
9224 #[doc(hidden)]
9225 impl crate::RequestBuilder for PurgeIdentityMappings {
9226 fn request_options(&mut self) -> &mut crate::RequestOptions {
9227 &mut self.0.options
9228 }
9229 }
9230
9231 #[derive(Clone, Debug)]
9252 pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
9253
9254 impl ListIdentityMappings {
9255 pub(crate) fn new(
9256 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9257 ) -> Self {
9258 Self(RequestBuilder::new(stub))
9259 }
9260
9261 pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
9263 mut self,
9264 v: V,
9265 ) -> Self {
9266 self.0.request = v.into();
9267 self
9268 }
9269
9270 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9272 self.0.options = v.into();
9273 self
9274 }
9275
9276 pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
9278 (*self.0.stub)
9279 .list_identity_mappings(self.0.request, self.0.options)
9280 .await
9281 .map(crate::Response::into_body)
9282 }
9283
9284 pub fn by_page(
9286 self,
9287 ) -> impl google_cloud_gax::paginator::Paginator<
9288 crate::model::ListIdentityMappingsResponse,
9289 crate::Error,
9290 > {
9291 use std::clone::Clone;
9292 let token = self.0.request.page_token.clone();
9293 let execute = move |token: String| {
9294 let mut builder = self.clone();
9295 builder.0.request = builder.0.request.set_page_token(token);
9296 builder.send()
9297 };
9298 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9299 }
9300
9301 pub fn by_item(
9303 self,
9304 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9305 crate::model::ListIdentityMappingsResponse,
9306 crate::Error,
9307 > {
9308 use google_cloud_gax::paginator::Paginator;
9309 self.by_page().items()
9310 }
9311
9312 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
9316 self.0.request.identity_mapping_store = v.into();
9317 self
9318 }
9319
9320 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9322 self.0.request.page_size = v.into();
9323 self
9324 }
9325
9326 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9328 self.0.request.page_token = v.into();
9329 self
9330 }
9331 }
9332
9333 #[doc(hidden)]
9334 impl crate::RequestBuilder for ListIdentityMappings {
9335 fn request_options(&mut self) -> &mut crate::RequestOptions {
9336 &mut self.0.options
9337 }
9338 }
9339
9340 #[derive(Clone, Debug)]
9361 pub struct ListIdentityMappingStores(
9362 RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
9363 );
9364
9365 impl ListIdentityMappingStores {
9366 pub(crate) fn new(
9367 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9368 ) -> Self {
9369 Self(RequestBuilder::new(stub))
9370 }
9371
9372 pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
9374 mut self,
9375 v: V,
9376 ) -> Self {
9377 self.0.request = v.into();
9378 self
9379 }
9380
9381 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9383 self.0.options = v.into();
9384 self
9385 }
9386
9387 pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
9389 (*self.0.stub)
9390 .list_identity_mapping_stores(self.0.request, self.0.options)
9391 .await
9392 .map(crate::Response::into_body)
9393 }
9394
9395 pub fn by_page(
9397 self,
9398 ) -> impl google_cloud_gax::paginator::Paginator<
9399 crate::model::ListIdentityMappingStoresResponse,
9400 crate::Error,
9401 > {
9402 use std::clone::Clone;
9403 let token = self.0.request.page_token.clone();
9404 let execute = move |token: String| {
9405 let mut builder = self.clone();
9406 builder.0.request = builder.0.request.set_page_token(token);
9407 builder.send()
9408 };
9409 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9410 }
9411
9412 pub fn by_item(
9414 self,
9415 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9416 crate::model::ListIdentityMappingStoresResponse,
9417 crate::Error,
9418 > {
9419 use google_cloud_gax::paginator::Paginator;
9420 self.by_page().items()
9421 }
9422
9423 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
9427 self.0.request.parent = v.into();
9428 self
9429 }
9430
9431 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9433 self.0.request.page_size = v.into();
9434 self
9435 }
9436
9437 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9439 self.0.request.page_token = v.into();
9440 self
9441 }
9442 }
9443
9444 #[doc(hidden)]
9445 impl crate::RequestBuilder for ListIdentityMappingStores {
9446 fn request_options(&mut self) -> &mut crate::RequestOptions {
9447 &mut self.0.options
9448 }
9449 }
9450
9451 #[derive(Clone, Debug)]
9472 pub struct ListOperations(
9473 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9474 );
9475
9476 impl ListOperations {
9477 pub(crate) fn new(
9478 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9479 ) -> Self {
9480 Self(RequestBuilder::new(stub))
9481 }
9482
9483 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9485 mut self,
9486 v: V,
9487 ) -> Self {
9488 self.0.request = v.into();
9489 self
9490 }
9491
9492 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9494 self.0.options = v.into();
9495 self
9496 }
9497
9498 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9500 (*self.0.stub)
9501 .list_operations(self.0.request, self.0.options)
9502 .await
9503 .map(crate::Response::into_body)
9504 }
9505
9506 pub fn by_page(
9508 self,
9509 ) -> impl google_cloud_gax::paginator::Paginator<
9510 google_cloud_longrunning::model::ListOperationsResponse,
9511 crate::Error,
9512 > {
9513 use std::clone::Clone;
9514 let token = self.0.request.page_token.clone();
9515 let execute = move |token: String| {
9516 let mut builder = self.clone();
9517 builder.0.request = builder.0.request.set_page_token(token);
9518 builder.send()
9519 };
9520 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9521 }
9522
9523 pub fn by_item(
9525 self,
9526 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9527 google_cloud_longrunning::model::ListOperationsResponse,
9528 crate::Error,
9529 > {
9530 use google_cloud_gax::paginator::Paginator;
9531 self.by_page().items()
9532 }
9533
9534 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9536 self.0.request.name = v.into();
9537 self
9538 }
9539
9540 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9542 self.0.request.filter = v.into();
9543 self
9544 }
9545
9546 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9548 self.0.request.page_size = v.into();
9549 self
9550 }
9551
9552 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9554 self.0.request.page_token = v.into();
9555 self
9556 }
9557
9558 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9560 self.0.request.return_partial_success = v.into();
9561 self
9562 }
9563 }
9564
9565 #[doc(hidden)]
9566 impl crate::RequestBuilder for ListOperations {
9567 fn request_options(&mut self) -> &mut crate::RequestOptions {
9568 &mut self.0.options
9569 }
9570 }
9571
9572 #[derive(Clone, Debug)]
9589 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9590
9591 impl GetOperation {
9592 pub(crate) fn new(
9593 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9594 ) -> Self {
9595 Self(RequestBuilder::new(stub))
9596 }
9597
9598 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9600 mut self,
9601 v: V,
9602 ) -> Self {
9603 self.0.request = v.into();
9604 self
9605 }
9606
9607 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9609 self.0.options = v.into();
9610 self
9611 }
9612
9613 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9615 (*self.0.stub)
9616 .get_operation(self.0.request, self.0.options)
9617 .await
9618 .map(crate::Response::into_body)
9619 }
9620
9621 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9623 self.0.request.name = v.into();
9624 self
9625 }
9626 }
9627
9628 #[doc(hidden)]
9629 impl crate::RequestBuilder for GetOperation {
9630 fn request_options(&mut self) -> &mut crate::RequestOptions {
9631 &mut self.0.options
9632 }
9633 }
9634
9635 #[derive(Clone, Debug)]
9652 pub struct CancelOperation(
9653 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9654 );
9655
9656 impl CancelOperation {
9657 pub(crate) fn new(
9658 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9659 ) -> Self {
9660 Self(RequestBuilder::new(stub))
9661 }
9662
9663 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9665 mut self,
9666 v: V,
9667 ) -> Self {
9668 self.0.request = v.into();
9669 self
9670 }
9671
9672 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9674 self.0.options = v.into();
9675 self
9676 }
9677
9678 pub async fn send(self) -> Result<()> {
9680 (*self.0.stub)
9681 .cancel_operation(self.0.request, self.0.options)
9682 .await
9683 .map(crate::Response::into_body)
9684 }
9685
9686 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9688 self.0.request.name = v.into();
9689 self
9690 }
9691 }
9692
9693 #[doc(hidden)]
9694 impl crate::RequestBuilder for CancelOperation {
9695 fn request_options(&mut self) -> &mut crate::RequestOptions {
9696 &mut self.0.options
9697 }
9698 }
9699}
9700
9701#[cfg(feature = "project-service")]
9703#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
9704pub mod project_service {
9705 use crate::Result;
9706
9707 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9721
9722 pub(crate) mod client {
9723 use super::super::super::client::ProjectService;
9724 pub struct Factory;
9725 impl crate::ClientFactory for Factory {
9726 type Client = ProjectService;
9727 type Credentials = gaxi::options::Credentials;
9728 async fn build(
9729 self,
9730 config: gaxi::options::ClientConfig,
9731 ) -> crate::ClientBuilderResult<Self::Client> {
9732 Self::Client::new(config).await
9733 }
9734 }
9735 }
9736
9737 #[derive(Clone, Debug)]
9739 pub(crate) struct RequestBuilder<R: std::default::Default> {
9740 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9741 request: R,
9742 options: crate::RequestOptions,
9743 }
9744
9745 impl<R> RequestBuilder<R>
9746 where
9747 R: std::default::Default,
9748 {
9749 pub(crate) fn new(
9750 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9751 ) -> Self {
9752 Self {
9753 stub,
9754 request: R::default(),
9755 options: crate::RequestOptions::default(),
9756 }
9757 }
9758 }
9759
9760 #[derive(Clone, Debug)]
9778 pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9779
9780 impl ProvisionProject {
9781 pub(crate) fn new(
9782 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9783 ) -> Self {
9784 Self(RequestBuilder::new(stub))
9785 }
9786
9787 pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9789 mut self,
9790 v: V,
9791 ) -> Self {
9792 self.0.request = v.into();
9793 self
9794 }
9795
9796 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9798 self.0.options = v.into();
9799 self
9800 }
9801
9802 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9809 (*self.0.stub)
9810 .provision_project(self.0.request, self.0.options)
9811 .await
9812 .map(crate::Response::into_body)
9813 }
9814
9815 pub fn poller(
9817 self,
9818 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9819 {
9820 type Operation = google_cloud_lro::internal::Operation<
9821 crate::model::Project,
9822 crate::model::ProvisionProjectMetadata,
9823 >;
9824 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9825 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9826 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
9827 if let Some(ref mut details) = poller_options.tracing {
9828 details.method_name = "google_cloud_discoveryengine_v1::client::ProjectService::provision_project::until_done";
9829 }
9830
9831 let stub = self.0.stub.clone();
9832 let mut options = self.0.options.clone();
9833 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9834 let query = move |name| {
9835 let stub = stub.clone();
9836 let options = options.clone();
9837 async {
9838 let op = GetOperation::new(stub)
9839 .set_name(name)
9840 .with_options(options)
9841 .send()
9842 .await?;
9843 Ok(Operation::new(op))
9844 }
9845 };
9846
9847 let start = move || async {
9848 let op = self.send().await?;
9849 Ok(Operation::new(op))
9850 };
9851
9852 use google_cloud_lro::internal::PollerExt;
9853 {
9854 google_cloud_lro::internal::new_poller(
9855 polling_error_policy,
9856 polling_backoff_policy,
9857 start,
9858 query,
9859 )
9860 }
9861 .with_options(poller_options)
9862 }
9863
9864 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9868 self.0.request.name = v.into();
9869 self
9870 }
9871
9872 pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9876 self.0.request.accept_data_use_terms = v.into();
9877 self
9878 }
9879
9880 pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9884 self.0.request.data_use_terms_version = v.into();
9885 self
9886 }
9887 }
9888
9889 #[doc(hidden)]
9890 impl crate::RequestBuilder for ProvisionProject {
9891 fn request_options(&mut self) -> &mut crate::RequestOptions {
9892 &mut self.0.options
9893 }
9894 }
9895
9896 #[derive(Clone, Debug)]
9917 pub struct ListOperations(
9918 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9919 );
9920
9921 impl ListOperations {
9922 pub(crate) fn new(
9923 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9924 ) -> Self {
9925 Self(RequestBuilder::new(stub))
9926 }
9927
9928 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9930 mut self,
9931 v: V,
9932 ) -> Self {
9933 self.0.request = v.into();
9934 self
9935 }
9936
9937 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9939 self.0.options = v.into();
9940 self
9941 }
9942
9943 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9945 (*self.0.stub)
9946 .list_operations(self.0.request, self.0.options)
9947 .await
9948 .map(crate::Response::into_body)
9949 }
9950
9951 pub fn by_page(
9953 self,
9954 ) -> impl google_cloud_gax::paginator::Paginator<
9955 google_cloud_longrunning::model::ListOperationsResponse,
9956 crate::Error,
9957 > {
9958 use std::clone::Clone;
9959 let token = self.0.request.page_token.clone();
9960 let execute = move |token: String| {
9961 let mut builder = self.clone();
9962 builder.0.request = builder.0.request.set_page_token(token);
9963 builder.send()
9964 };
9965 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9966 }
9967
9968 pub fn by_item(
9970 self,
9971 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9972 google_cloud_longrunning::model::ListOperationsResponse,
9973 crate::Error,
9974 > {
9975 use google_cloud_gax::paginator::Paginator;
9976 self.by_page().items()
9977 }
9978
9979 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9981 self.0.request.name = v.into();
9982 self
9983 }
9984
9985 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9987 self.0.request.filter = v.into();
9988 self
9989 }
9990
9991 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9993 self.0.request.page_size = v.into();
9994 self
9995 }
9996
9997 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9999 self.0.request.page_token = v.into();
10000 self
10001 }
10002
10003 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10005 self.0.request.return_partial_success = v.into();
10006 self
10007 }
10008 }
10009
10010 #[doc(hidden)]
10011 impl crate::RequestBuilder for ListOperations {
10012 fn request_options(&mut self) -> &mut crate::RequestOptions {
10013 &mut self.0.options
10014 }
10015 }
10016
10017 #[derive(Clone, Debug)]
10034 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10035
10036 impl GetOperation {
10037 pub(crate) fn new(
10038 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
10039 ) -> Self {
10040 Self(RequestBuilder::new(stub))
10041 }
10042
10043 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10045 mut self,
10046 v: V,
10047 ) -> Self {
10048 self.0.request = v.into();
10049 self
10050 }
10051
10052 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10054 self.0.options = v.into();
10055 self
10056 }
10057
10058 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10060 (*self.0.stub)
10061 .get_operation(self.0.request, self.0.options)
10062 .await
10063 .map(crate::Response::into_body)
10064 }
10065
10066 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10068 self.0.request.name = v.into();
10069 self
10070 }
10071 }
10072
10073 #[doc(hidden)]
10074 impl crate::RequestBuilder for GetOperation {
10075 fn request_options(&mut self) -> &mut crate::RequestOptions {
10076 &mut self.0.options
10077 }
10078 }
10079
10080 #[derive(Clone, Debug)]
10097 pub struct CancelOperation(
10098 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10099 );
10100
10101 impl CancelOperation {
10102 pub(crate) fn new(
10103 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
10104 ) -> Self {
10105 Self(RequestBuilder::new(stub))
10106 }
10107
10108 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10110 mut self,
10111 v: V,
10112 ) -> Self {
10113 self.0.request = v.into();
10114 self
10115 }
10116
10117 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10119 self.0.options = v.into();
10120 self
10121 }
10122
10123 pub async fn send(self) -> Result<()> {
10125 (*self.0.stub)
10126 .cancel_operation(self.0.request, self.0.options)
10127 .await
10128 .map(crate::Response::into_body)
10129 }
10130
10131 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10133 self.0.request.name = v.into();
10134 self
10135 }
10136 }
10137
10138 #[doc(hidden)]
10139 impl crate::RequestBuilder for CancelOperation {
10140 fn request_options(&mut self) -> &mut crate::RequestOptions {
10141 &mut self.0.options
10142 }
10143 }
10144}
10145
10146#[cfg(feature = "rank-service")]
10148#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
10149pub mod rank_service {
10150 use crate::Result;
10151
10152 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10166
10167 pub(crate) mod client {
10168 use super::super::super::client::RankService;
10169 pub struct Factory;
10170 impl crate::ClientFactory for Factory {
10171 type Client = RankService;
10172 type Credentials = gaxi::options::Credentials;
10173 async fn build(
10174 self,
10175 config: gaxi::options::ClientConfig,
10176 ) -> crate::ClientBuilderResult<Self::Client> {
10177 Self::Client::new(config).await
10178 }
10179 }
10180 }
10181
10182 #[derive(Clone, Debug)]
10184 pub(crate) struct RequestBuilder<R: std::default::Default> {
10185 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10186 request: R,
10187 options: crate::RequestOptions,
10188 }
10189
10190 impl<R> RequestBuilder<R>
10191 where
10192 R: std::default::Default,
10193 {
10194 pub(crate) fn new(
10195 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10196 ) -> Self {
10197 Self {
10198 stub,
10199 request: R::default(),
10200 options: crate::RequestOptions::default(),
10201 }
10202 }
10203 }
10204
10205 #[derive(Clone, Debug)]
10222 pub struct Rank(RequestBuilder<crate::model::RankRequest>);
10223
10224 impl Rank {
10225 pub(crate) fn new(
10226 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10227 ) -> Self {
10228 Self(RequestBuilder::new(stub))
10229 }
10230
10231 pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
10233 self.0.request = v.into();
10234 self
10235 }
10236
10237 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10239 self.0.options = v.into();
10240 self
10241 }
10242
10243 pub async fn send(self) -> Result<crate::model::RankResponse> {
10245 (*self.0.stub)
10246 .rank(self.0.request, self.0.options)
10247 .await
10248 .map(crate::Response::into_body)
10249 }
10250
10251 pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
10255 self.0.request.ranking_config = v.into();
10256 self
10257 }
10258
10259 pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
10261 self.0.request.model = v.into();
10262 self
10263 }
10264
10265 pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
10267 self.0.request.top_n = v.into();
10268 self
10269 }
10270
10271 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
10273 self.0.request.query = v.into();
10274 self
10275 }
10276
10277 pub fn set_records<T, V>(mut self, v: T) -> Self
10281 where
10282 T: std::iter::IntoIterator<Item = V>,
10283 V: std::convert::Into<crate::model::RankingRecord>,
10284 {
10285 use std::iter::Iterator;
10286 self.0.request.records = v.into_iter().map(|i| i.into()).collect();
10287 self
10288 }
10289
10290 pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
10292 self.0.request.ignore_record_details_in_response = v.into();
10293 self
10294 }
10295
10296 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
10298 where
10299 T: std::iter::IntoIterator<Item = (K, V)>,
10300 K: std::convert::Into<std::string::String>,
10301 V: std::convert::Into<std::string::String>,
10302 {
10303 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10304 self
10305 }
10306 }
10307
10308 #[doc(hidden)]
10309 impl crate::RequestBuilder for Rank {
10310 fn request_options(&mut self) -> &mut crate::RequestOptions {
10311 &mut self.0.options
10312 }
10313 }
10314
10315 #[derive(Clone, Debug)]
10336 pub struct ListOperations(
10337 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10338 );
10339
10340 impl ListOperations {
10341 pub(crate) fn new(
10342 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10343 ) -> Self {
10344 Self(RequestBuilder::new(stub))
10345 }
10346
10347 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
10349 mut self,
10350 v: V,
10351 ) -> Self {
10352 self.0.request = v.into();
10353 self
10354 }
10355
10356 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10358 self.0.options = v.into();
10359 self
10360 }
10361
10362 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
10364 (*self.0.stub)
10365 .list_operations(self.0.request, self.0.options)
10366 .await
10367 .map(crate::Response::into_body)
10368 }
10369
10370 pub fn by_page(
10372 self,
10373 ) -> impl google_cloud_gax::paginator::Paginator<
10374 google_cloud_longrunning::model::ListOperationsResponse,
10375 crate::Error,
10376 > {
10377 use std::clone::Clone;
10378 let token = self.0.request.page_token.clone();
10379 let execute = move |token: String| {
10380 let mut builder = self.clone();
10381 builder.0.request = builder.0.request.set_page_token(token);
10382 builder.send()
10383 };
10384 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10385 }
10386
10387 pub fn by_item(
10389 self,
10390 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10391 google_cloud_longrunning::model::ListOperationsResponse,
10392 crate::Error,
10393 > {
10394 use google_cloud_gax::paginator::Paginator;
10395 self.by_page().items()
10396 }
10397
10398 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10400 self.0.request.name = v.into();
10401 self
10402 }
10403
10404 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10406 self.0.request.filter = v.into();
10407 self
10408 }
10409
10410 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10412 self.0.request.page_size = v.into();
10413 self
10414 }
10415
10416 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10418 self.0.request.page_token = v.into();
10419 self
10420 }
10421
10422 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10424 self.0.request.return_partial_success = v.into();
10425 self
10426 }
10427 }
10428
10429 #[doc(hidden)]
10430 impl crate::RequestBuilder for ListOperations {
10431 fn request_options(&mut self) -> &mut crate::RequestOptions {
10432 &mut self.0.options
10433 }
10434 }
10435
10436 #[derive(Clone, Debug)]
10453 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10454
10455 impl GetOperation {
10456 pub(crate) fn new(
10457 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10458 ) -> Self {
10459 Self(RequestBuilder::new(stub))
10460 }
10461
10462 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10464 mut self,
10465 v: V,
10466 ) -> Self {
10467 self.0.request = v.into();
10468 self
10469 }
10470
10471 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10473 self.0.options = v.into();
10474 self
10475 }
10476
10477 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10479 (*self.0.stub)
10480 .get_operation(self.0.request, self.0.options)
10481 .await
10482 .map(crate::Response::into_body)
10483 }
10484
10485 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10487 self.0.request.name = v.into();
10488 self
10489 }
10490 }
10491
10492 #[doc(hidden)]
10493 impl crate::RequestBuilder for GetOperation {
10494 fn request_options(&mut self) -> &mut crate::RequestOptions {
10495 &mut self.0.options
10496 }
10497 }
10498
10499 #[derive(Clone, Debug)]
10516 pub struct CancelOperation(
10517 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10518 );
10519
10520 impl CancelOperation {
10521 pub(crate) fn new(
10522 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
10523 ) -> Self {
10524 Self(RequestBuilder::new(stub))
10525 }
10526
10527 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10529 mut self,
10530 v: V,
10531 ) -> Self {
10532 self.0.request = v.into();
10533 self
10534 }
10535
10536 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10538 self.0.options = v.into();
10539 self
10540 }
10541
10542 pub async fn send(self) -> Result<()> {
10544 (*self.0.stub)
10545 .cancel_operation(self.0.request, self.0.options)
10546 .await
10547 .map(crate::Response::into_body)
10548 }
10549
10550 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10552 self.0.request.name = v.into();
10553 self
10554 }
10555 }
10556
10557 #[doc(hidden)]
10558 impl crate::RequestBuilder for CancelOperation {
10559 fn request_options(&mut self) -> &mut crate::RequestOptions {
10560 &mut self.0.options
10561 }
10562 }
10563}
10564
10565#[cfg(feature = "recommendation-service")]
10567#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
10568pub mod recommendation_service {
10569 use crate::Result;
10570
10571 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10585
10586 pub(crate) mod client {
10587 use super::super::super::client::RecommendationService;
10588 pub struct Factory;
10589 impl crate::ClientFactory for Factory {
10590 type Client = RecommendationService;
10591 type Credentials = gaxi::options::Credentials;
10592 async fn build(
10593 self,
10594 config: gaxi::options::ClientConfig,
10595 ) -> crate::ClientBuilderResult<Self::Client> {
10596 Self::Client::new(config).await
10597 }
10598 }
10599 }
10600
10601 #[derive(Clone, Debug)]
10603 pub(crate) struct RequestBuilder<R: std::default::Default> {
10604 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10605 request: R,
10606 options: crate::RequestOptions,
10607 }
10608
10609 impl<R> RequestBuilder<R>
10610 where
10611 R: std::default::Default,
10612 {
10613 pub(crate) fn new(
10614 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10615 ) -> Self {
10616 Self {
10617 stub,
10618 request: R::default(),
10619 options: crate::RequestOptions::default(),
10620 }
10621 }
10622 }
10623
10624 #[derive(Clone, Debug)]
10641 pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
10642
10643 impl Recommend {
10644 pub(crate) fn new(
10645 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10646 ) -> Self {
10647 Self(RequestBuilder::new(stub))
10648 }
10649
10650 pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
10652 self.0.request = v.into();
10653 self
10654 }
10655
10656 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10658 self.0.options = v.into();
10659 self
10660 }
10661
10662 pub async fn send(self) -> Result<crate::model::RecommendResponse> {
10664 (*self.0.stub)
10665 .recommend(self.0.request, self.0.options)
10666 .await
10667 .map(crate::Response::into_body)
10668 }
10669
10670 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
10674 self.0.request.serving_config = v.into();
10675 self
10676 }
10677
10678 pub fn set_user_event<T>(mut self, v: T) -> Self
10682 where
10683 T: std::convert::Into<crate::model::UserEvent>,
10684 {
10685 self.0.request.user_event = std::option::Option::Some(v.into());
10686 self
10687 }
10688
10689 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
10693 where
10694 T: std::convert::Into<crate::model::UserEvent>,
10695 {
10696 self.0.request.user_event = v.map(|x| x.into());
10697 self
10698 }
10699
10700 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10702 self.0.request.page_size = v.into();
10703 self
10704 }
10705
10706 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10708 self.0.request.filter = v.into();
10709 self
10710 }
10711
10712 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
10714 self.0.request.validate_only = v.into();
10715 self
10716 }
10717
10718 pub fn set_params<T, K, V>(mut self, v: T) -> Self
10720 where
10721 T: std::iter::IntoIterator<Item = (K, V)>,
10722 K: std::convert::Into<std::string::String>,
10723 V: std::convert::Into<wkt::Value>,
10724 {
10725 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10726 self
10727 }
10728
10729 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
10731 where
10732 T: std::iter::IntoIterator<Item = (K, V)>,
10733 K: std::convert::Into<std::string::String>,
10734 V: std::convert::Into<std::string::String>,
10735 {
10736 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10737 self
10738 }
10739 }
10740
10741 #[doc(hidden)]
10742 impl crate::RequestBuilder for Recommend {
10743 fn request_options(&mut self) -> &mut crate::RequestOptions {
10744 &mut self.0.options
10745 }
10746 }
10747
10748 #[derive(Clone, Debug)]
10769 pub struct ListOperations(
10770 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10771 );
10772
10773 impl ListOperations {
10774 pub(crate) fn new(
10775 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10776 ) -> Self {
10777 Self(RequestBuilder::new(stub))
10778 }
10779
10780 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
10782 mut self,
10783 v: V,
10784 ) -> Self {
10785 self.0.request = v.into();
10786 self
10787 }
10788
10789 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10791 self.0.options = v.into();
10792 self
10793 }
10794
10795 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
10797 (*self.0.stub)
10798 .list_operations(self.0.request, self.0.options)
10799 .await
10800 .map(crate::Response::into_body)
10801 }
10802
10803 pub fn by_page(
10805 self,
10806 ) -> impl google_cloud_gax::paginator::Paginator<
10807 google_cloud_longrunning::model::ListOperationsResponse,
10808 crate::Error,
10809 > {
10810 use std::clone::Clone;
10811 let token = self.0.request.page_token.clone();
10812 let execute = move |token: String| {
10813 let mut builder = self.clone();
10814 builder.0.request = builder.0.request.set_page_token(token);
10815 builder.send()
10816 };
10817 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10818 }
10819
10820 pub fn by_item(
10822 self,
10823 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10824 google_cloud_longrunning::model::ListOperationsResponse,
10825 crate::Error,
10826 > {
10827 use google_cloud_gax::paginator::Paginator;
10828 self.by_page().items()
10829 }
10830
10831 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10833 self.0.request.name = v.into();
10834 self
10835 }
10836
10837 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10839 self.0.request.filter = v.into();
10840 self
10841 }
10842
10843 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10845 self.0.request.page_size = v.into();
10846 self
10847 }
10848
10849 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10851 self.0.request.page_token = v.into();
10852 self
10853 }
10854
10855 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10857 self.0.request.return_partial_success = v.into();
10858 self
10859 }
10860 }
10861
10862 #[doc(hidden)]
10863 impl crate::RequestBuilder for ListOperations {
10864 fn request_options(&mut self) -> &mut crate::RequestOptions {
10865 &mut self.0.options
10866 }
10867 }
10868
10869 #[derive(Clone, Debug)]
10886 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10887
10888 impl GetOperation {
10889 pub(crate) fn new(
10890 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10891 ) -> Self {
10892 Self(RequestBuilder::new(stub))
10893 }
10894
10895 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10897 mut self,
10898 v: V,
10899 ) -> Self {
10900 self.0.request = v.into();
10901 self
10902 }
10903
10904 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10906 self.0.options = v.into();
10907 self
10908 }
10909
10910 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10912 (*self.0.stub)
10913 .get_operation(self.0.request, self.0.options)
10914 .await
10915 .map(crate::Response::into_body)
10916 }
10917
10918 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10920 self.0.request.name = v.into();
10921 self
10922 }
10923 }
10924
10925 #[doc(hidden)]
10926 impl crate::RequestBuilder for GetOperation {
10927 fn request_options(&mut self) -> &mut crate::RequestOptions {
10928 &mut self.0.options
10929 }
10930 }
10931
10932 #[derive(Clone, Debug)]
10949 pub struct CancelOperation(
10950 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10951 );
10952
10953 impl CancelOperation {
10954 pub(crate) fn new(
10955 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10956 ) -> Self {
10957 Self(RequestBuilder::new(stub))
10958 }
10959
10960 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10962 mut self,
10963 v: V,
10964 ) -> Self {
10965 self.0.request = v.into();
10966 self
10967 }
10968
10969 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10971 self.0.options = v.into();
10972 self
10973 }
10974
10975 pub async fn send(self) -> Result<()> {
10977 (*self.0.stub)
10978 .cancel_operation(self.0.request, self.0.options)
10979 .await
10980 .map(crate::Response::into_body)
10981 }
10982
10983 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10985 self.0.request.name = v.into();
10986 self
10987 }
10988 }
10989
10990 #[doc(hidden)]
10991 impl crate::RequestBuilder for CancelOperation {
10992 fn request_options(&mut self) -> &mut crate::RequestOptions {
10993 &mut self.0.options
10994 }
10995 }
10996}
10997
10998#[cfg(feature = "schema-service")]
11000#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
11001pub mod schema_service {
11002 use crate::Result;
11003
11004 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11018
11019 pub(crate) mod client {
11020 use super::super::super::client::SchemaService;
11021 pub struct Factory;
11022 impl crate::ClientFactory for Factory {
11023 type Client = SchemaService;
11024 type Credentials = gaxi::options::Credentials;
11025 async fn build(
11026 self,
11027 config: gaxi::options::ClientConfig,
11028 ) -> crate::ClientBuilderResult<Self::Client> {
11029 Self::Client::new(config).await
11030 }
11031 }
11032 }
11033
11034 #[derive(Clone, Debug)]
11036 pub(crate) struct RequestBuilder<R: std::default::Default> {
11037 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11038 request: R,
11039 options: crate::RequestOptions,
11040 }
11041
11042 impl<R> RequestBuilder<R>
11043 where
11044 R: std::default::Default,
11045 {
11046 pub(crate) fn new(
11047 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11048 ) -> Self {
11049 Self {
11050 stub,
11051 request: R::default(),
11052 options: crate::RequestOptions::default(),
11053 }
11054 }
11055 }
11056
11057 #[derive(Clone, Debug)]
11074 pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
11075
11076 impl GetSchema {
11077 pub(crate) fn new(
11078 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11079 ) -> Self {
11080 Self(RequestBuilder::new(stub))
11081 }
11082
11083 pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
11085 self.0.request = v.into();
11086 self
11087 }
11088
11089 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11091 self.0.options = v.into();
11092 self
11093 }
11094
11095 pub async fn send(self) -> Result<crate::model::Schema> {
11097 (*self.0.stub)
11098 .get_schema(self.0.request, self.0.options)
11099 .await
11100 .map(crate::Response::into_body)
11101 }
11102
11103 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11107 self.0.request.name = v.into();
11108 self
11109 }
11110 }
11111
11112 #[doc(hidden)]
11113 impl crate::RequestBuilder for GetSchema {
11114 fn request_options(&mut self) -> &mut crate::RequestOptions {
11115 &mut self.0.options
11116 }
11117 }
11118
11119 #[derive(Clone, Debug)]
11140 pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
11141
11142 impl ListSchemas {
11143 pub(crate) fn new(
11144 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11145 ) -> Self {
11146 Self(RequestBuilder::new(stub))
11147 }
11148
11149 pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
11151 self.0.request = v.into();
11152 self
11153 }
11154
11155 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11157 self.0.options = v.into();
11158 self
11159 }
11160
11161 pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
11163 (*self.0.stub)
11164 .list_schemas(self.0.request, self.0.options)
11165 .await
11166 .map(crate::Response::into_body)
11167 }
11168
11169 pub fn by_page(
11171 self,
11172 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSchemasResponse, crate::Error>
11173 {
11174 use std::clone::Clone;
11175 let token = self.0.request.page_token.clone();
11176 let execute = move |token: String| {
11177 let mut builder = self.clone();
11178 builder.0.request = builder.0.request.set_page_token(token);
11179 builder.send()
11180 };
11181 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11182 }
11183
11184 pub fn by_item(
11186 self,
11187 ) -> impl google_cloud_gax::paginator::ItemPaginator<
11188 crate::model::ListSchemasResponse,
11189 crate::Error,
11190 > {
11191 use google_cloud_gax::paginator::Paginator;
11192 self.by_page().items()
11193 }
11194
11195 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11199 self.0.request.parent = v.into();
11200 self
11201 }
11202
11203 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11205 self.0.request.page_size = v.into();
11206 self
11207 }
11208
11209 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11211 self.0.request.page_token = v.into();
11212 self
11213 }
11214 }
11215
11216 #[doc(hidden)]
11217 impl crate::RequestBuilder for ListSchemas {
11218 fn request_options(&mut self) -> &mut crate::RequestOptions {
11219 &mut self.0.options
11220 }
11221 }
11222
11223 #[derive(Clone, Debug)]
11241 pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
11242
11243 impl CreateSchema {
11244 pub(crate) fn new(
11245 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11246 ) -> Self {
11247 Self(RequestBuilder::new(stub))
11248 }
11249
11250 pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
11252 self.0.request = v.into();
11253 self
11254 }
11255
11256 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11258 self.0.options = v.into();
11259 self
11260 }
11261
11262 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11269 (*self.0.stub)
11270 .create_schema(self.0.request, self.0.options)
11271 .await
11272 .map(crate::Response::into_body)
11273 }
11274
11275 pub fn poller(
11277 self,
11278 ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata>
11279 {
11280 type Operation = google_cloud_lro::internal::Operation<
11281 crate::model::Schema,
11282 crate::model::CreateSchemaMetadata,
11283 >;
11284 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11285 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11286 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
11287 if let Some(ref mut details) = poller_options.tracing {
11288 details.method_name = "google_cloud_discoveryengine_v1::client::SchemaService::create_schema::until_done";
11289 }
11290
11291 let stub = self.0.stub.clone();
11292 let mut options = self.0.options.clone();
11293 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11294 let query = move |name| {
11295 let stub = stub.clone();
11296 let options = options.clone();
11297 async {
11298 let op = GetOperation::new(stub)
11299 .set_name(name)
11300 .with_options(options)
11301 .send()
11302 .await?;
11303 Ok(Operation::new(op))
11304 }
11305 };
11306
11307 let start = move || async {
11308 let op = self.send().await?;
11309 Ok(Operation::new(op))
11310 };
11311
11312 use google_cloud_lro::internal::PollerExt;
11313 {
11314 google_cloud_lro::internal::new_poller(
11315 polling_error_policy,
11316 polling_backoff_policy,
11317 start,
11318 query,
11319 )
11320 }
11321 .with_options(poller_options)
11322 }
11323
11324 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11328 self.0.request.parent = v.into();
11329 self
11330 }
11331
11332 pub fn set_schema<T>(mut self, v: T) -> Self
11336 where
11337 T: std::convert::Into<crate::model::Schema>,
11338 {
11339 self.0.request.schema = std::option::Option::Some(v.into());
11340 self
11341 }
11342
11343 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
11347 where
11348 T: std::convert::Into<crate::model::Schema>,
11349 {
11350 self.0.request.schema = v.map(|x| x.into());
11351 self
11352 }
11353
11354 pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11358 self.0.request.schema_id = v.into();
11359 self
11360 }
11361 }
11362
11363 #[doc(hidden)]
11364 impl crate::RequestBuilder for CreateSchema {
11365 fn request_options(&mut self) -> &mut crate::RequestOptions {
11366 &mut self.0.options
11367 }
11368 }
11369
11370 #[derive(Clone, Debug)]
11388 pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
11389
11390 impl UpdateSchema {
11391 pub(crate) fn new(
11392 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11393 ) -> Self {
11394 Self(RequestBuilder::new(stub))
11395 }
11396
11397 pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
11399 self.0.request = v.into();
11400 self
11401 }
11402
11403 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11405 self.0.options = v.into();
11406 self
11407 }
11408
11409 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11416 (*self.0.stub)
11417 .update_schema(self.0.request, self.0.options)
11418 .await
11419 .map(crate::Response::into_body)
11420 }
11421
11422 pub fn poller(
11424 self,
11425 ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata>
11426 {
11427 type Operation = google_cloud_lro::internal::Operation<
11428 crate::model::Schema,
11429 crate::model::UpdateSchemaMetadata,
11430 >;
11431 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11432 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11433 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
11434 if let Some(ref mut details) = poller_options.tracing {
11435 details.method_name = "google_cloud_discoveryengine_v1::client::SchemaService::update_schema::until_done";
11436 }
11437
11438 let stub = self.0.stub.clone();
11439 let mut options = self.0.options.clone();
11440 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11441 let query = move |name| {
11442 let stub = stub.clone();
11443 let options = options.clone();
11444 async {
11445 let op = GetOperation::new(stub)
11446 .set_name(name)
11447 .with_options(options)
11448 .send()
11449 .await?;
11450 Ok(Operation::new(op))
11451 }
11452 };
11453
11454 let start = move || async {
11455 let op = self.send().await?;
11456 Ok(Operation::new(op))
11457 };
11458
11459 use google_cloud_lro::internal::PollerExt;
11460 {
11461 google_cloud_lro::internal::new_poller(
11462 polling_error_policy,
11463 polling_backoff_policy,
11464 start,
11465 query,
11466 )
11467 }
11468 .with_options(poller_options)
11469 }
11470
11471 pub fn set_schema<T>(mut self, v: T) -> Self
11475 where
11476 T: std::convert::Into<crate::model::Schema>,
11477 {
11478 self.0.request.schema = std::option::Option::Some(v.into());
11479 self
11480 }
11481
11482 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
11486 where
11487 T: std::convert::Into<crate::model::Schema>,
11488 {
11489 self.0.request.schema = v.map(|x| x.into());
11490 self
11491 }
11492
11493 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
11495 self.0.request.allow_missing = v.into();
11496 self
11497 }
11498 }
11499
11500 #[doc(hidden)]
11501 impl crate::RequestBuilder for UpdateSchema {
11502 fn request_options(&mut self) -> &mut crate::RequestOptions {
11503 &mut self.0.options
11504 }
11505 }
11506
11507 #[derive(Clone, Debug)]
11525 pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
11526
11527 impl DeleteSchema {
11528 pub(crate) fn new(
11529 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11530 ) -> Self {
11531 Self(RequestBuilder::new(stub))
11532 }
11533
11534 pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
11536 self.0.request = v.into();
11537 self
11538 }
11539
11540 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11542 self.0.options = v.into();
11543 self
11544 }
11545
11546 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11553 (*self.0.stub)
11554 .delete_schema(self.0.request, self.0.options)
11555 .await
11556 .map(crate::Response::into_body)
11557 }
11558
11559 pub fn poller(
11561 self,
11562 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSchemaMetadata> {
11563 type Operation = google_cloud_lro::internal::Operation<
11564 wkt::Empty,
11565 crate::model::DeleteSchemaMetadata,
11566 >;
11567 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11568 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11569 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
11570 if let Some(ref mut details) = poller_options.tracing {
11571 details.method_name = "google_cloud_discoveryengine_v1::client::SchemaService::delete_schema::until_done";
11572 }
11573
11574 let stub = self.0.stub.clone();
11575 let mut options = self.0.options.clone();
11576 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11577 let query = move |name| {
11578 let stub = stub.clone();
11579 let options = options.clone();
11580 async {
11581 let op = GetOperation::new(stub)
11582 .set_name(name)
11583 .with_options(options)
11584 .send()
11585 .await?;
11586 Ok(Operation::new(op))
11587 }
11588 };
11589
11590 let start = move || async {
11591 let op = self.send().await?;
11592 Ok(Operation::new(op))
11593 };
11594
11595 use google_cloud_lro::internal::PollerExt;
11596 {
11597 google_cloud_lro::internal::new_unit_response_poller(
11598 polling_error_policy,
11599 polling_backoff_policy,
11600 start,
11601 query,
11602 )
11603 }
11604 .with_options(poller_options)
11605 }
11606
11607 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11611 self.0.request.name = v.into();
11612 self
11613 }
11614 }
11615
11616 #[doc(hidden)]
11617 impl crate::RequestBuilder for DeleteSchema {
11618 fn request_options(&mut self) -> &mut crate::RequestOptions {
11619 &mut self.0.options
11620 }
11621 }
11622
11623 #[derive(Clone, Debug)]
11644 pub struct ListOperations(
11645 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
11646 );
11647
11648 impl ListOperations {
11649 pub(crate) fn new(
11650 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11651 ) -> Self {
11652 Self(RequestBuilder::new(stub))
11653 }
11654
11655 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
11657 mut self,
11658 v: V,
11659 ) -> Self {
11660 self.0.request = v.into();
11661 self
11662 }
11663
11664 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11666 self.0.options = v.into();
11667 self
11668 }
11669
11670 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
11672 (*self.0.stub)
11673 .list_operations(self.0.request, self.0.options)
11674 .await
11675 .map(crate::Response::into_body)
11676 }
11677
11678 pub fn by_page(
11680 self,
11681 ) -> impl google_cloud_gax::paginator::Paginator<
11682 google_cloud_longrunning::model::ListOperationsResponse,
11683 crate::Error,
11684 > {
11685 use std::clone::Clone;
11686 let token = self.0.request.page_token.clone();
11687 let execute = move |token: String| {
11688 let mut builder = self.clone();
11689 builder.0.request = builder.0.request.set_page_token(token);
11690 builder.send()
11691 };
11692 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11693 }
11694
11695 pub fn by_item(
11697 self,
11698 ) -> impl google_cloud_gax::paginator::ItemPaginator<
11699 google_cloud_longrunning::model::ListOperationsResponse,
11700 crate::Error,
11701 > {
11702 use google_cloud_gax::paginator::Paginator;
11703 self.by_page().items()
11704 }
11705
11706 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11708 self.0.request.name = v.into();
11709 self
11710 }
11711
11712 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11714 self.0.request.filter = v.into();
11715 self
11716 }
11717
11718 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11720 self.0.request.page_size = v.into();
11721 self
11722 }
11723
11724 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11726 self.0.request.page_token = v.into();
11727 self
11728 }
11729
11730 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
11732 self.0.request.return_partial_success = v.into();
11733 self
11734 }
11735 }
11736
11737 #[doc(hidden)]
11738 impl crate::RequestBuilder for ListOperations {
11739 fn request_options(&mut self) -> &mut crate::RequestOptions {
11740 &mut self.0.options
11741 }
11742 }
11743
11744 #[derive(Clone, Debug)]
11761 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
11762
11763 impl GetOperation {
11764 pub(crate) fn new(
11765 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11766 ) -> Self {
11767 Self(RequestBuilder::new(stub))
11768 }
11769
11770 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
11772 mut self,
11773 v: V,
11774 ) -> Self {
11775 self.0.request = v.into();
11776 self
11777 }
11778
11779 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11781 self.0.options = v.into();
11782 self
11783 }
11784
11785 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11787 (*self.0.stub)
11788 .get_operation(self.0.request, self.0.options)
11789 .await
11790 .map(crate::Response::into_body)
11791 }
11792
11793 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11795 self.0.request.name = v.into();
11796 self
11797 }
11798 }
11799
11800 #[doc(hidden)]
11801 impl crate::RequestBuilder for GetOperation {
11802 fn request_options(&mut self) -> &mut crate::RequestOptions {
11803 &mut self.0.options
11804 }
11805 }
11806
11807 #[derive(Clone, Debug)]
11824 pub struct CancelOperation(
11825 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
11826 );
11827
11828 impl CancelOperation {
11829 pub(crate) fn new(
11830 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11831 ) -> Self {
11832 Self(RequestBuilder::new(stub))
11833 }
11834
11835 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
11837 mut self,
11838 v: V,
11839 ) -> Self {
11840 self.0.request = v.into();
11841 self
11842 }
11843
11844 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11846 self.0.options = v.into();
11847 self
11848 }
11849
11850 pub async fn send(self) -> Result<()> {
11852 (*self.0.stub)
11853 .cancel_operation(self.0.request, self.0.options)
11854 .await
11855 .map(crate::Response::into_body)
11856 }
11857
11858 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11860 self.0.request.name = v.into();
11861 self
11862 }
11863 }
11864
11865 #[doc(hidden)]
11866 impl crate::RequestBuilder for CancelOperation {
11867 fn request_options(&mut self) -> &mut crate::RequestOptions {
11868 &mut self.0.options
11869 }
11870 }
11871}
11872
11873#[cfg(feature = "search-service")]
11875#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11876pub mod search_service {
11877 use crate::Result;
11878
11879 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11893
11894 pub(crate) mod client {
11895 use super::super::super::client::SearchService;
11896 pub struct Factory;
11897 impl crate::ClientFactory for Factory {
11898 type Client = SearchService;
11899 type Credentials = gaxi::options::Credentials;
11900 async fn build(
11901 self,
11902 config: gaxi::options::ClientConfig,
11903 ) -> crate::ClientBuilderResult<Self::Client> {
11904 Self::Client::new(config).await
11905 }
11906 }
11907 }
11908
11909 #[derive(Clone, Debug)]
11911 pub(crate) struct RequestBuilder<R: std::default::Default> {
11912 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11913 request: R,
11914 options: crate::RequestOptions,
11915 }
11916
11917 impl<R> RequestBuilder<R>
11918 where
11919 R: std::default::Default,
11920 {
11921 pub(crate) fn new(
11922 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11923 ) -> Self {
11924 Self {
11925 stub,
11926 request: R::default(),
11927 options: crate::RequestOptions::default(),
11928 }
11929 }
11930 }
11931
11932 #[derive(Clone, Debug)]
11953 pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11954
11955 impl Search {
11956 pub(crate) fn new(
11957 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11958 ) -> Self {
11959 Self(RequestBuilder::new(stub))
11960 }
11961
11962 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11964 self.0.request = v.into();
11965 self
11966 }
11967
11968 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11970 self.0.options = v.into();
11971 self
11972 }
11973
11974 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11976 (*self.0.stub)
11977 .search(self.0.request, self.0.options)
11978 .await
11979 .map(crate::Response::into_body)
11980 }
11981
11982 pub fn by_page(
11984 self,
11985 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11986 {
11987 use std::clone::Clone;
11988 let token = self.0.request.page_token.clone();
11989 let execute = move |token: String| {
11990 let mut builder = self.clone();
11991 builder.0.request = builder.0.request.set_page_token(token);
11992 builder.send()
11993 };
11994 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11995 }
11996
11997 pub fn by_item(
11999 self,
12000 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
12001 {
12002 use google_cloud_gax::paginator::Paginator;
12003 self.by_page().items()
12004 }
12005
12006 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
12010 self.0.request.serving_config = v.into();
12011 self
12012 }
12013
12014 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
12016 self.0.request.branch = v.into();
12017 self
12018 }
12019
12020 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
12022 self.0.request.query = v.into();
12023 self
12024 }
12025
12026 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
12028 where
12029 T: std::iter::IntoIterator<Item = V>,
12030 V: std::convert::Into<std::string::String>,
12031 {
12032 use std::iter::Iterator;
12033 self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
12034 self
12035 }
12036
12037 pub fn set_image_query<T>(mut self, v: T) -> Self
12039 where
12040 T: std::convert::Into<crate::model::search_request::ImageQuery>,
12041 {
12042 self.0.request.image_query = std::option::Option::Some(v.into());
12043 self
12044 }
12045
12046 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
12048 where
12049 T: std::convert::Into<crate::model::search_request::ImageQuery>,
12050 {
12051 self.0.request.image_query = v.map(|x| x.into());
12052 self
12053 }
12054
12055 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12057 self.0.request.page_size = v.into();
12058 self
12059 }
12060
12061 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12063 self.0.request.page_token = v.into();
12064 self
12065 }
12066
12067 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
12069 self.0.request.offset = v.into();
12070 self
12071 }
12072
12073 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12075 self.0.request.one_box_page_size = v.into();
12076 self
12077 }
12078
12079 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
12081 where
12082 T: std::iter::IntoIterator<Item = V>,
12083 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
12084 {
12085 use std::iter::Iterator;
12086 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
12087 self
12088 }
12089
12090 pub fn set_num_results_per_data_store<T: Into<i32>>(mut self, v: T) -> Self {
12092 self.0.request.num_results_per_data_store = v.into();
12093 self
12094 }
12095
12096 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12098 self.0.request.filter = v.into();
12099 self
12100 }
12101
12102 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12104 self.0.request.canonical_filter = v.into();
12105 self
12106 }
12107
12108 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
12110 self.0.request.order_by = v.into();
12111 self
12112 }
12113
12114 pub fn set_user_info<T>(mut self, v: T) -> Self
12116 where
12117 T: std::convert::Into<crate::model::UserInfo>,
12118 {
12119 self.0.request.user_info = std::option::Option::Some(v.into());
12120 self
12121 }
12122
12123 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
12125 where
12126 T: std::convert::Into<crate::model::UserInfo>,
12127 {
12128 self.0.request.user_info = v.map(|x| x.into());
12129 self
12130 }
12131
12132 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
12134 self.0.request.language_code = v.into();
12135 self
12136 }
12137
12138 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
12140 where
12141 T: std::iter::IntoIterator<Item = V>,
12142 V: std::convert::Into<crate::model::search_request::FacetSpec>,
12143 {
12144 use std::iter::Iterator;
12145 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
12146 self
12147 }
12148
12149 pub fn set_boost_spec<T>(mut self, v: T) -> Self
12151 where
12152 T: std::convert::Into<crate::model::search_request::BoostSpec>,
12153 {
12154 self.0.request.boost_spec = std::option::Option::Some(v.into());
12155 self
12156 }
12157
12158 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
12160 where
12161 T: std::convert::Into<crate::model::search_request::BoostSpec>,
12162 {
12163 self.0.request.boost_spec = v.map(|x| x.into());
12164 self
12165 }
12166
12167 pub fn set_params<T, K, V>(mut self, v: T) -> Self
12169 where
12170 T: std::iter::IntoIterator<Item = (K, V)>,
12171 K: std::convert::Into<std::string::String>,
12172 V: std::convert::Into<wkt::Value>,
12173 {
12174 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12175 self
12176 }
12177
12178 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
12180 where
12181 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12182 {
12183 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
12184 self
12185 }
12186
12187 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
12189 where
12190 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12191 {
12192 self.0.request.query_expansion_spec = v.map(|x| x.into());
12193 self
12194 }
12195
12196 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
12198 where
12199 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12200 {
12201 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
12202 self
12203 }
12204
12205 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
12207 where
12208 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12209 {
12210 self.0.request.spell_correction_spec = v.map(|x| x.into());
12211 self
12212 }
12213
12214 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12216 self.0.request.user_pseudo_id = v.into();
12217 self
12218 }
12219
12220 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
12222 where
12223 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12224 {
12225 self.0.request.content_search_spec = std::option::Option::Some(v.into());
12226 self
12227 }
12228
12229 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
12231 where
12232 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12233 {
12234 self.0.request.content_search_spec = v.map(|x| x.into());
12235 self
12236 }
12237
12238 pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12240 self.0.request.ranking_expression = v.into();
12241 self
12242 }
12243
12244 pub fn set_ranking_expression_backend<
12246 T: Into<crate::model::search_request::RankingExpressionBackend>,
12247 >(
12248 mut self,
12249 v: T,
12250 ) -> Self {
12251 self.0.request.ranking_expression_backend = v.into();
12252 self
12253 }
12254
12255 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
12257 self.0.request.safe_search = v.into();
12258 self
12259 }
12260
12261 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12263 where
12264 T: std::iter::IntoIterator<Item = (K, V)>,
12265 K: std::convert::Into<std::string::String>,
12266 V: std::convert::Into<std::string::String>,
12267 {
12268 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12269 self
12270 }
12271
12272 pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
12274 where
12275 T: std::convert::Into<
12276 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12277 >,
12278 {
12279 self.0.request.natural_language_query_understanding_spec =
12280 std::option::Option::Some(v.into());
12281 self
12282 }
12283
12284 pub fn set_or_clear_natural_language_query_understanding_spec<T>(
12286 mut self,
12287 v: std::option::Option<T>,
12288 ) -> Self
12289 where
12290 T: std::convert::Into<
12291 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12292 >,
12293 {
12294 self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
12295 self
12296 }
12297
12298 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
12300 where
12301 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12302 {
12303 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
12304 self
12305 }
12306
12307 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
12309 where
12310 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12311 {
12312 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
12313 self
12314 }
12315
12316 pub fn set_display_spec<T>(mut self, v: T) -> Self
12318 where
12319 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12320 {
12321 self.0.request.display_spec = std::option::Option::Some(v.into());
12322 self
12323 }
12324
12325 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
12327 where
12328 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12329 {
12330 self.0.request.display_spec = v.map(|x| x.into());
12331 self
12332 }
12333
12334 pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
12336 where
12337 T: std::iter::IntoIterator<Item = V>,
12338 V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
12339 {
12340 use std::iter::Iterator;
12341 self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
12342 self
12343 }
12344
12345 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
12347 self.0.request.session = v.into();
12348 self
12349 }
12350
12351 pub fn set_session_spec<T>(mut self, v: T) -> Self
12353 where
12354 T: std::convert::Into<crate::model::search_request::SessionSpec>,
12355 {
12356 self.0.request.session_spec = std::option::Option::Some(v.into());
12357 self
12358 }
12359
12360 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
12362 where
12363 T: std::convert::Into<crate::model::search_request::SessionSpec>,
12364 {
12365 self.0.request.session_spec = v.map(|x| x.into());
12366 self
12367 }
12368
12369 pub fn set_relevance_threshold<
12371 T: Into<crate::model::search_request::RelevanceThreshold>,
12372 >(
12373 mut self,
12374 v: T,
12375 ) -> Self {
12376 self.0.request.relevance_threshold = v.into();
12377 self
12378 }
12379
12380 pub fn set_relevance_filter_spec<T>(mut self, v: T) -> Self
12382 where
12383 T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
12384 {
12385 self.0.request.relevance_filter_spec = std::option::Option::Some(v.into());
12386 self
12387 }
12388
12389 pub fn set_or_clear_relevance_filter_spec<T>(mut self, v: std::option::Option<T>) -> Self
12391 where
12392 T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
12393 {
12394 self.0.request.relevance_filter_spec = v.map(|x| x.into());
12395 self
12396 }
12397
12398 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
12400 where
12401 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12402 {
12403 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
12404 self
12405 }
12406
12407 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12409 where
12410 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12411 {
12412 self.0.request.relevance_score_spec = v.map(|x| x.into());
12413 self
12414 }
12415
12416 pub fn set_search_addon_spec<T>(mut self, v: T) -> Self
12418 where
12419 T: std::convert::Into<crate::model::search_request::SearchAddonSpec>,
12420 {
12421 self.0.request.search_addon_spec = std::option::Option::Some(v.into());
12422 self
12423 }
12424
12425 pub fn set_or_clear_search_addon_spec<T>(mut self, v: std::option::Option<T>) -> Self
12427 where
12428 T: std::convert::Into<crate::model::search_request::SearchAddonSpec>,
12429 {
12430 self.0.request.search_addon_spec = v.map(|x| x.into());
12431 self
12432 }
12433
12434 pub fn set_custom_ranking_params<T>(mut self, v: T) -> Self
12436 where
12437 T: std::convert::Into<crate::model::search_request::CustomRankingParams>,
12438 {
12439 self.0.request.custom_ranking_params = std::option::Option::Some(v.into());
12440 self
12441 }
12442
12443 pub fn set_or_clear_custom_ranking_params<T>(mut self, v: std::option::Option<T>) -> Self
12445 where
12446 T: std::convert::Into<crate::model::search_request::CustomRankingParams>,
12447 {
12448 self.0.request.custom_ranking_params = v.map(|x| x.into());
12449 self
12450 }
12451
12452 pub fn set_entity<T: Into<std::string::String>>(mut self, v: T) -> Self {
12454 self.0.request.entity = v.into();
12455 self
12456 }
12457 }
12458
12459 #[doc(hidden)]
12460 impl crate::RequestBuilder for Search {
12461 fn request_options(&mut self) -> &mut crate::RequestOptions {
12462 &mut self.0.options
12463 }
12464 }
12465
12466 #[derive(Clone, Debug)]
12487 pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
12488
12489 impl SearchLite {
12490 pub(crate) fn new(
12491 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12492 ) -> Self {
12493 Self(RequestBuilder::new(stub))
12494 }
12495
12496 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
12498 self.0.request = v.into();
12499 self
12500 }
12501
12502 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12504 self.0.options = v.into();
12505 self
12506 }
12507
12508 pub async fn send(self) -> Result<crate::model::SearchResponse> {
12510 (*self.0.stub)
12511 .search_lite(self.0.request, self.0.options)
12512 .await
12513 .map(crate::Response::into_body)
12514 }
12515
12516 pub fn by_page(
12518 self,
12519 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
12520 {
12521 use std::clone::Clone;
12522 let token = self.0.request.page_token.clone();
12523 let execute = move |token: String| {
12524 let mut builder = self.clone();
12525 builder.0.request = builder.0.request.set_page_token(token);
12526 builder.send()
12527 };
12528 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12529 }
12530
12531 pub fn by_item(
12533 self,
12534 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
12535 {
12536 use google_cloud_gax::paginator::Paginator;
12537 self.by_page().items()
12538 }
12539
12540 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
12544 self.0.request.serving_config = v.into();
12545 self
12546 }
12547
12548 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
12550 self.0.request.branch = v.into();
12551 self
12552 }
12553
12554 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
12556 self.0.request.query = v.into();
12557 self
12558 }
12559
12560 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
12562 where
12563 T: std::iter::IntoIterator<Item = V>,
12564 V: std::convert::Into<std::string::String>,
12565 {
12566 use std::iter::Iterator;
12567 self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
12568 self
12569 }
12570
12571 pub fn set_image_query<T>(mut self, v: T) -> Self
12573 where
12574 T: std::convert::Into<crate::model::search_request::ImageQuery>,
12575 {
12576 self.0.request.image_query = std::option::Option::Some(v.into());
12577 self
12578 }
12579
12580 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
12582 where
12583 T: std::convert::Into<crate::model::search_request::ImageQuery>,
12584 {
12585 self.0.request.image_query = v.map(|x| x.into());
12586 self
12587 }
12588
12589 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12591 self.0.request.page_size = v.into();
12592 self
12593 }
12594
12595 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12597 self.0.request.page_token = v.into();
12598 self
12599 }
12600
12601 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
12603 self.0.request.offset = v.into();
12604 self
12605 }
12606
12607 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12609 self.0.request.one_box_page_size = v.into();
12610 self
12611 }
12612
12613 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
12615 where
12616 T: std::iter::IntoIterator<Item = V>,
12617 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
12618 {
12619 use std::iter::Iterator;
12620 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
12621 self
12622 }
12623
12624 pub fn set_num_results_per_data_store<T: Into<i32>>(mut self, v: T) -> Self {
12626 self.0.request.num_results_per_data_store = v.into();
12627 self
12628 }
12629
12630 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12632 self.0.request.filter = v.into();
12633 self
12634 }
12635
12636 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12638 self.0.request.canonical_filter = v.into();
12639 self
12640 }
12641
12642 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
12644 self.0.request.order_by = v.into();
12645 self
12646 }
12647
12648 pub fn set_user_info<T>(mut self, v: T) -> Self
12650 where
12651 T: std::convert::Into<crate::model::UserInfo>,
12652 {
12653 self.0.request.user_info = std::option::Option::Some(v.into());
12654 self
12655 }
12656
12657 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
12659 where
12660 T: std::convert::Into<crate::model::UserInfo>,
12661 {
12662 self.0.request.user_info = v.map(|x| x.into());
12663 self
12664 }
12665
12666 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
12668 self.0.request.language_code = v.into();
12669 self
12670 }
12671
12672 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
12674 where
12675 T: std::iter::IntoIterator<Item = V>,
12676 V: std::convert::Into<crate::model::search_request::FacetSpec>,
12677 {
12678 use std::iter::Iterator;
12679 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
12680 self
12681 }
12682
12683 pub fn set_boost_spec<T>(mut self, v: T) -> Self
12685 where
12686 T: std::convert::Into<crate::model::search_request::BoostSpec>,
12687 {
12688 self.0.request.boost_spec = std::option::Option::Some(v.into());
12689 self
12690 }
12691
12692 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
12694 where
12695 T: std::convert::Into<crate::model::search_request::BoostSpec>,
12696 {
12697 self.0.request.boost_spec = v.map(|x| x.into());
12698 self
12699 }
12700
12701 pub fn set_params<T, K, V>(mut self, v: T) -> Self
12703 where
12704 T: std::iter::IntoIterator<Item = (K, V)>,
12705 K: std::convert::Into<std::string::String>,
12706 V: std::convert::Into<wkt::Value>,
12707 {
12708 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12709 self
12710 }
12711
12712 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
12714 where
12715 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12716 {
12717 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
12718 self
12719 }
12720
12721 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
12723 where
12724 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12725 {
12726 self.0.request.query_expansion_spec = v.map(|x| x.into());
12727 self
12728 }
12729
12730 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
12732 where
12733 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12734 {
12735 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
12736 self
12737 }
12738
12739 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
12741 where
12742 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12743 {
12744 self.0.request.spell_correction_spec = v.map(|x| x.into());
12745 self
12746 }
12747
12748 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12750 self.0.request.user_pseudo_id = v.into();
12751 self
12752 }
12753
12754 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
12756 where
12757 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12758 {
12759 self.0.request.content_search_spec = std::option::Option::Some(v.into());
12760 self
12761 }
12762
12763 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
12765 where
12766 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12767 {
12768 self.0.request.content_search_spec = v.map(|x| x.into());
12769 self
12770 }
12771
12772 pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12774 self.0.request.ranking_expression = v.into();
12775 self
12776 }
12777
12778 pub fn set_ranking_expression_backend<
12780 T: Into<crate::model::search_request::RankingExpressionBackend>,
12781 >(
12782 mut self,
12783 v: T,
12784 ) -> Self {
12785 self.0.request.ranking_expression_backend = v.into();
12786 self
12787 }
12788
12789 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
12791 self.0.request.safe_search = v.into();
12792 self
12793 }
12794
12795 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12797 where
12798 T: std::iter::IntoIterator<Item = (K, V)>,
12799 K: std::convert::Into<std::string::String>,
12800 V: std::convert::Into<std::string::String>,
12801 {
12802 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12803 self
12804 }
12805
12806 pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
12808 where
12809 T: std::convert::Into<
12810 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12811 >,
12812 {
12813 self.0.request.natural_language_query_understanding_spec =
12814 std::option::Option::Some(v.into());
12815 self
12816 }
12817
12818 pub fn set_or_clear_natural_language_query_understanding_spec<T>(
12820 mut self,
12821 v: std::option::Option<T>,
12822 ) -> Self
12823 where
12824 T: std::convert::Into<
12825 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12826 >,
12827 {
12828 self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
12829 self
12830 }
12831
12832 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
12834 where
12835 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12836 {
12837 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
12838 self
12839 }
12840
12841 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
12843 where
12844 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12845 {
12846 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
12847 self
12848 }
12849
12850 pub fn set_display_spec<T>(mut self, v: T) -> Self
12852 where
12853 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12854 {
12855 self.0.request.display_spec = std::option::Option::Some(v.into());
12856 self
12857 }
12858
12859 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
12861 where
12862 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12863 {
12864 self.0.request.display_spec = v.map(|x| x.into());
12865 self
12866 }
12867
12868 pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
12870 where
12871 T: std::iter::IntoIterator<Item = V>,
12872 V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
12873 {
12874 use std::iter::Iterator;
12875 self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
12876 self
12877 }
12878
12879 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
12881 self.0.request.session = v.into();
12882 self
12883 }
12884
12885 pub fn set_session_spec<T>(mut self, v: T) -> Self
12887 where
12888 T: std::convert::Into<crate::model::search_request::SessionSpec>,
12889 {
12890 self.0.request.session_spec = std::option::Option::Some(v.into());
12891 self
12892 }
12893
12894 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
12896 where
12897 T: std::convert::Into<crate::model::search_request::SessionSpec>,
12898 {
12899 self.0.request.session_spec = v.map(|x| x.into());
12900 self
12901 }
12902
12903 pub fn set_relevance_threshold<
12905 T: Into<crate::model::search_request::RelevanceThreshold>,
12906 >(
12907 mut self,
12908 v: T,
12909 ) -> Self {
12910 self.0.request.relevance_threshold = v.into();
12911 self
12912 }
12913
12914 pub fn set_relevance_filter_spec<T>(mut self, v: T) -> Self
12916 where
12917 T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
12918 {
12919 self.0.request.relevance_filter_spec = std::option::Option::Some(v.into());
12920 self
12921 }
12922
12923 pub fn set_or_clear_relevance_filter_spec<T>(mut self, v: std::option::Option<T>) -> Self
12925 where
12926 T: std::convert::Into<crate::model::search_request::RelevanceFilterSpec>,
12927 {
12928 self.0.request.relevance_filter_spec = v.map(|x| x.into());
12929 self
12930 }
12931
12932 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
12934 where
12935 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12936 {
12937 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
12938 self
12939 }
12940
12941 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12943 where
12944 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12945 {
12946 self.0.request.relevance_score_spec = v.map(|x| x.into());
12947 self
12948 }
12949
12950 pub fn set_search_addon_spec<T>(mut self, v: T) -> Self
12952 where
12953 T: std::convert::Into<crate::model::search_request::SearchAddonSpec>,
12954 {
12955 self.0.request.search_addon_spec = std::option::Option::Some(v.into());
12956 self
12957 }
12958
12959 pub fn set_or_clear_search_addon_spec<T>(mut self, v: std::option::Option<T>) -> Self
12961 where
12962 T: std::convert::Into<crate::model::search_request::SearchAddonSpec>,
12963 {
12964 self.0.request.search_addon_spec = v.map(|x| x.into());
12965 self
12966 }
12967
12968 pub fn set_custom_ranking_params<T>(mut self, v: T) -> Self
12970 where
12971 T: std::convert::Into<crate::model::search_request::CustomRankingParams>,
12972 {
12973 self.0.request.custom_ranking_params = std::option::Option::Some(v.into());
12974 self
12975 }
12976
12977 pub fn set_or_clear_custom_ranking_params<T>(mut self, v: std::option::Option<T>) -> Self
12979 where
12980 T: std::convert::Into<crate::model::search_request::CustomRankingParams>,
12981 {
12982 self.0.request.custom_ranking_params = v.map(|x| x.into());
12983 self
12984 }
12985
12986 pub fn set_entity<T: Into<std::string::String>>(mut self, v: T) -> Self {
12988 self.0.request.entity = v.into();
12989 self
12990 }
12991 }
12992
12993 #[doc(hidden)]
12994 impl crate::RequestBuilder for SearchLite {
12995 fn request_options(&mut self) -> &mut crate::RequestOptions {
12996 &mut self.0.options
12997 }
12998 }
12999
13000 #[derive(Clone, Debug)]
13021 pub struct ListOperations(
13022 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13023 );
13024
13025 impl ListOperations {
13026 pub(crate) fn new(
13027 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
13028 ) -> Self {
13029 Self(RequestBuilder::new(stub))
13030 }
13031
13032 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13034 mut self,
13035 v: V,
13036 ) -> Self {
13037 self.0.request = v.into();
13038 self
13039 }
13040
13041 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13043 self.0.options = v.into();
13044 self
13045 }
13046
13047 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13049 (*self.0.stub)
13050 .list_operations(self.0.request, self.0.options)
13051 .await
13052 .map(crate::Response::into_body)
13053 }
13054
13055 pub fn by_page(
13057 self,
13058 ) -> impl google_cloud_gax::paginator::Paginator<
13059 google_cloud_longrunning::model::ListOperationsResponse,
13060 crate::Error,
13061 > {
13062 use std::clone::Clone;
13063 let token = self.0.request.page_token.clone();
13064 let execute = move |token: String| {
13065 let mut builder = self.clone();
13066 builder.0.request = builder.0.request.set_page_token(token);
13067 builder.send()
13068 };
13069 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13070 }
13071
13072 pub fn by_item(
13074 self,
13075 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13076 google_cloud_longrunning::model::ListOperationsResponse,
13077 crate::Error,
13078 > {
13079 use google_cloud_gax::paginator::Paginator;
13080 self.by_page().items()
13081 }
13082
13083 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13085 self.0.request.name = v.into();
13086 self
13087 }
13088
13089 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13091 self.0.request.filter = v.into();
13092 self
13093 }
13094
13095 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13097 self.0.request.page_size = v.into();
13098 self
13099 }
13100
13101 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13103 self.0.request.page_token = v.into();
13104 self
13105 }
13106
13107 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13109 self.0.request.return_partial_success = v.into();
13110 self
13111 }
13112 }
13113
13114 #[doc(hidden)]
13115 impl crate::RequestBuilder for ListOperations {
13116 fn request_options(&mut self) -> &mut crate::RequestOptions {
13117 &mut self.0.options
13118 }
13119 }
13120
13121 #[derive(Clone, Debug)]
13138 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13139
13140 impl GetOperation {
13141 pub(crate) fn new(
13142 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
13143 ) -> Self {
13144 Self(RequestBuilder::new(stub))
13145 }
13146
13147 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13149 mut self,
13150 v: V,
13151 ) -> Self {
13152 self.0.request = v.into();
13153 self
13154 }
13155
13156 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13158 self.0.options = v.into();
13159 self
13160 }
13161
13162 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13164 (*self.0.stub)
13165 .get_operation(self.0.request, self.0.options)
13166 .await
13167 .map(crate::Response::into_body)
13168 }
13169
13170 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13172 self.0.request.name = v.into();
13173 self
13174 }
13175 }
13176
13177 #[doc(hidden)]
13178 impl crate::RequestBuilder for GetOperation {
13179 fn request_options(&mut self) -> &mut crate::RequestOptions {
13180 &mut self.0.options
13181 }
13182 }
13183
13184 #[derive(Clone, Debug)]
13201 pub struct CancelOperation(
13202 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13203 );
13204
13205 impl CancelOperation {
13206 pub(crate) fn new(
13207 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
13208 ) -> Self {
13209 Self(RequestBuilder::new(stub))
13210 }
13211
13212 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13214 mut self,
13215 v: V,
13216 ) -> Self {
13217 self.0.request = v.into();
13218 self
13219 }
13220
13221 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13223 self.0.options = v.into();
13224 self
13225 }
13226
13227 pub async fn send(self) -> Result<()> {
13229 (*self.0.stub)
13230 .cancel_operation(self.0.request, self.0.options)
13231 .await
13232 .map(crate::Response::into_body)
13233 }
13234
13235 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13237 self.0.request.name = v.into();
13238 self
13239 }
13240 }
13241
13242 #[doc(hidden)]
13243 impl crate::RequestBuilder for CancelOperation {
13244 fn request_options(&mut self) -> &mut crate::RequestOptions {
13245 &mut self.0.options
13246 }
13247 }
13248}
13249
13250#[cfg(feature = "search-tuning-service")]
13252#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
13253pub mod search_tuning_service {
13254 use crate::Result;
13255
13256 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13270
13271 pub(crate) mod client {
13272 use super::super::super::client::SearchTuningService;
13273 pub struct Factory;
13274 impl crate::ClientFactory for Factory {
13275 type Client = SearchTuningService;
13276 type Credentials = gaxi::options::Credentials;
13277 async fn build(
13278 self,
13279 config: gaxi::options::ClientConfig,
13280 ) -> crate::ClientBuilderResult<Self::Client> {
13281 Self::Client::new(config).await
13282 }
13283 }
13284 }
13285
13286 #[derive(Clone, Debug)]
13288 pub(crate) struct RequestBuilder<R: std::default::Default> {
13289 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13290 request: R,
13291 options: crate::RequestOptions,
13292 }
13293
13294 impl<R> RequestBuilder<R>
13295 where
13296 R: std::default::Default,
13297 {
13298 pub(crate) fn new(
13299 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13300 ) -> Self {
13301 Self {
13302 stub,
13303 request: R::default(),
13304 options: crate::RequestOptions::default(),
13305 }
13306 }
13307 }
13308
13309 #[derive(Clone, Debug)]
13327 pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
13328
13329 impl TrainCustomModel {
13330 pub(crate) fn new(
13331 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13332 ) -> Self {
13333 Self(RequestBuilder::new(stub))
13334 }
13335
13336 pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
13338 mut self,
13339 v: V,
13340 ) -> Self {
13341 self.0.request = v.into();
13342 self
13343 }
13344
13345 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13347 self.0.options = v.into();
13348 self
13349 }
13350
13351 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13358 (*self.0.stub)
13359 .train_custom_model(self.0.request, self.0.options)
13360 .await
13361 .map(crate::Response::into_body)
13362 }
13363
13364 pub fn poller(
13366 self,
13367 ) -> impl google_cloud_lro::Poller<
13368 crate::model::TrainCustomModelResponse,
13369 crate::model::TrainCustomModelMetadata,
13370 > {
13371 type Operation = google_cloud_lro::internal::Operation<
13372 crate::model::TrainCustomModelResponse,
13373 crate::model::TrainCustomModelMetadata,
13374 >;
13375 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
13376 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
13377 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
13378 if let Some(ref mut details) = poller_options.tracing {
13379 details.method_name = "google_cloud_discoveryengine_v1::client::SearchTuningService::train_custom_model::until_done";
13380 }
13381
13382 let stub = self.0.stub.clone();
13383 let mut options = self.0.options.clone();
13384 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
13385 let query = move |name| {
13386 let stub = stub.clone();
13387 let options = options.clone();
13388 async {
13389 let op = GetOperation::new(stub)
13390 .set_name(name)
13391 .with_options(options)
13392 .send()
13393 .await?;
13394 Ok(Operation::new(op))
13395 }
13396 };
13397
13398 let start = move || async {
13399 let op = self.send().await?;
13400 Ok(Operation::new(op))
13401 };
13402
13403 use google_cloud_lro::internal::PollerExt;
13404 {
13405 google_cloud_lro::internal::new_poller(
13406 polling_error_policy,
13407 polling_backoff_policy,
13408 start,
13409 query,
13410 )
13411 }
13412 .with_options(poller_options)
13413 }
13414
13415 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
13419 self.0.request.data_store = v.into();
13420 self
13421 }
13422
13423 pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
13425 self.0.request.model_type = v.into();
13426 self
13427 }
13428
13429 pub fn set_error_config<T>(mut self, v: T) -> Self
13431 where
13432 T: std::convert::Into<crate::model::ImportErrorConfig>,
13433 {
13434 self.0.request.error_config = std::option::Option::Some(v.into());
13435 self
13436 }
13437
13438 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
13440 where
13441 T: std::convert::Into<crate::model::ImportErrorConfig>,
13442 {
13443 self.0.request.error_config = v.map(|x| x.into());
13444 self
13445 }
13446
13447 pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
13449 self.0.request.model_id = v.into();
13450 self
13451 }
13452
13453 pub fn set_training_input<
13458 T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
13459 >(
13460 mut self,
13461 v: T,
13462 ) -> Self {
13463 self.0.request.training_input = v.into();
13464 self
13465 }
13466
13467 pub fn set_gcs_training_input<
13473 T: std::convert::Into<
13474 std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
13475 >,
13476 >(
13477 mut self,
13478 v: T,
13479 ) -> Self {
13480 self.0.request = self.0.request.set_gcs_training_input(v);
13481 self
13482 }
13483 }
13484
13485 #[doc(hidden)]
13486 impl crate::RequestBuilder for TrainCustomModel {
13487 fn request_options(&mut self) -> &mut crate::RequestOptions {
13488 &mut self.0.options
13489 }
13490 }
13491
13492 #[derive(Clone, Debug)]
13509 pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
13510
13511 impl ListCustomModels {
13512 pub(crate) fn new(
13513 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13514 ) -> Self {
13515 Self(RequestBuilder::new(stub))
13516 }
13517
13518 pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
13520 mut self,
13521 v: V,
13522 ) -> Self {
13523 self.0.request = v.into();
13524 self
13525 }
13526
13527 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13529 self.0.options = v.into();
13530 self
13531 }
13532
13533 pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
13535 (*self.0.stub)
13536 .list_custom_models(self.0.request, self.0.options)
13537 .await
13538 .map(crate::Response::into_body)
13539 }
13540
13541 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
13545 self.0.request.data_store = v.into();
13546 self
13547 }
13548 }
13549
13550 #[doc(hidden)]
13551 impl crate::RequestBuilder for ListCustomModels {
13552 fn request_options(&mut self) -> &mut crate::RequestOptions {
13553 &mut self.0.options
13554 }
13555 }
13556
13557 #[derive(Clone, Debug)]
13578 pub struct ListOperations(
13579 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13580 );
13581
13582 impl ListOperations {
13583 pub(crate) fn new(
13584 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13585 ) -> Self {
13586 Self(RequestBuilder::new(stub))
13587 }
13588
13589 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13591 mut self,
13592 v: V,
13593 ) -> Self {
13594 self.0.request = v.into();
13595 self
13596 }
13597
13598 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13600 self.0.options = v.into();
13601 self
13602 }
13603
13604 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13606 (*self.0.stub)
13607 .list_operations(self.0.request, self.0.options)
13608 .await
13609 .map(crate::Response::into_body)
13610 }
13611
13612 pub fn by_page(
13614 self,
13615 ) -> impl google_cloud_gax::paginator::Paginator<
13616 google_cloud_longrunning::model::ListOperationsResponse,
13617 crate::Error,
13618 > {
13619 use std::clone::Clone;
13620 let token = self.0.request.page_token.clone();
13621 let execute = move |token: String| {
13622 let mut builder = self.clone();
13623 builder.0.request = builder.0.request.set_page_token(token);
13624 builder.send()
13625 };
13626 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13627 }
13628
13629 pub fn by_item(
13631 self,
13632 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13633 google_cloud_longrunning::model::ListOperationsResponse,
13634 crate::Error,
13635 > {
13636 use google_cloud_gax::paginator::Paginator;
13637 self.by_page().items()
13638 }
13639
13640 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13642 self.0.request.name = v.into();
13643 self
13644 }
13645
13646 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13648 self.0.request.filter = v.into();
13649 self
13650 }
13651
13652 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13654 self.0.request.page_size = v.into();
13655 self
13656 }
13657
13658 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13660 self.0.request.page_token = v.into();
13661 self
13662 }
13663
13664 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13666 self.0.request.return_partial_success = v.into();
13667 self
13668 }
13669 }
13670
13671 #[doc(hidden)]
13672 impl crate::RequestBuilder for ListOperations {
13673 fn request_options(&mut self) -> &mut crate::RequestOptions {
13674 &mut self.0.options
13675 }
13676 }
13677
13678 #[derive(Clone, Debug)]
13695 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13696
13697 impl GetOperation {
13698 pub(crate) fn new(
13699 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13700 ) -> Self {
13701 Self(RequestBuilder::new(stub))
13702 }
13703
13704 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13706 mut self,
13707 v: V,
13708 ) -> Self {
13709 self.0.request = v.into();
13710 self
13711 }
13712
13713 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13715 self.0.options = v.into();
13716 self
13717 }
13718
13719 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13721 (*self.0.stub)
13722 .get_operation(self.0.request, self.0.options)
13723 .await
13724 .map(crate::Response::into_body)
13725 }
13726
13727 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13729 self.0.request.name = v.into();
13730 self
13731 }
13732 }
13733
13734 #[doc(hidden)]
13735 impl crate::RequestBuilder for GetOperation {
13736 fn request_options(&mut self) -> &mut crate::RequestOptions {
13737 &mut self.0.options
13738 }
13739 }
13740
13741 #[derive(Clone, Debug)]
13758 pub struct CancelOperation(
13759 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13760 );
13761
13762 impl CancelOperation {
13763 pub(crate) fn new(
13764 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
13765 ) -> Self {
13766 Self(RequestBuilder::new(stub))
13767 }
13768
13769 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13771 mut self,
13772 v: V,
13773 ) -> Self {
13774 self.0.request = v.into();
13775 self
13776 }
13777
13778 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13780 self.0.options = v.into();
13781 self
13782 }
13783
13784 pub async fn send(self) -> Result<()> {
13786 (*self.0.stub)
13787 .cancel_operation(self.0.request, self.0.options)
13788 .await
13789 .map(crate::Response::into_body)
13790 }
13791
13792 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13794 self.0.request.name = v.into();
13795 self
13796 }
13797 }
13798
13799 #[doc(hidden)]
13800 impl crate::RequestBuilder for CancelOperation {
13801 fn request_options(&mut self) -> &mut crate::RequestOptions {
13802 &mut self.0.options
13803 }
13804 }
13805}
13806
13807#[cfg(feature = "serving-config-service")]
13809#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
13810pub mod serving_config_service {
13811 use crate::Result;
13812
13813 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13827
13828 pub(crate) mod client {
13829 use super::super::super::client::ServingConfigService;
13830 pub struct Factory;
13831 impl crate::ClientFactory for Factory {
13832 type Client = ServingConfigService;
13833 type Credentials = gaxi::options::Credentials;
13834 async fn build(
13835 self,
13836 config: gaxi::options::ClientConfig,
13837 ) -> crate::ClientBuilderResult<Self::Client> {
13838 Self::Client::new(config).await
13839 }
13840 }
13841 }
13842
13843 #[derive(Clone, Debug)]
13845 pub(crate) struct RequestBuilder<R: std::default::Default> {
13846 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13847 request: R,
13848 options: crate::RequestOptions,
13849 }
13850
13851 impl<R> RequestBuilder<R>
13852 where
13853 R: std::default::Default,
13854 {
13855 pub(crate) fn new(
13856 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13857 ) -> Self {
13858 Self {
13859 stub,
13860 request: R::default(),
13861 options: crate::RequestOptions::default(),
13862 }
13863 }
13864 }
13865
13866 #[derive(Clone, Debug)]
13883 pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
13884
13885 impl UpdateServingConfig {
13886 pub(crate) fn new(
13887 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13888 ) -> Self {
13889 Self(RequestBuilder::new(stub))
13890 }
13891
13892 pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
13894 mut self,
13895 v: V,
13896 ) -> Self {
13897 self.0.request = v.into();
13898 self
13899 }
13900
13901 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13903 self.0.options = v.into();
13904 self
13905 }
13906
13907 pub async fn send(self) -> Result<crate::model::ServingConfig> {
13909 (*self.0.stub)
13910 .update_serving_config(self.0.request, self.0.options)
13911 .await
13912 .map(crate::Response::into_body)
13913 }
13914
13915 pub fn set_serving_config<T>(mut self, v: T) -> Self
13919 where
13920 T: std::convert::Into<crate::model::ServingConfig>,
13921 {
13922 self.0.request.serving_config = std::option::Option::Some(v.into());
13923 self
13924 }
13925
13926 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
13930 where
13931 T: std::convert::Into<crate::model::ServingConfig>,
13932 {
13933 self.0.request.serving_config = v.map(|x| x.into());
13934 self
13935 }
13936
13937 pub fn set_update_mask<T>(mut self, v: T) -> Self
13939 where
13940 T: std::convert::Into<wkt::FieldMask>,
13941 {
13942 self.0.request.update_mask = std::option::Option::Some(v.into());
13943 self
13944 }
13945
13946 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13948 where
13949 T: std::convert::Into<wkt::FieldMask>,
13950 {
13951 self.0.request.update_mask = v.map(|x| x.into());
13952 self
13953 }
13954 }
13955
13956 #[doc(hidden)]
13957 impl crate::RequestBuilder for UpdateServingConfig {
13958 fn request_options(&mut self) -> &mut crate::RequestOptions {
13959 &mut self.0.options
13960 }
13961 }
13962
13963 #[derive(Clone, Debug)]
13984 pub struct ListOperations(
13985 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13986 );
13987
13988 impl ListOperations {
13989 pub(crate) fn new(
13990 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13991 ) -> Self {
13992 Self(RequestBuilder::new(stub))
13993 }
13994
13995 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13997 mut self,
13998 v: V,
13999 ) -> Self {
14000 self.0.request = v.into();
14001 self
14002 }
14003
14004 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14006 self.0.options = v.into();
14007 self
14008 }
14009
14010 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
14012 (*self.0.stub)
14013 .list_operations(self.0.request, self.0.options)
14014 .await
14015 .map(crate::Response::into_body)
14016 }
14017
14018 pub fn by_page(
14020 self,
14021 ) -> impl google_cloud_gax::paginator::Paginator<
14022 google_cloud_longrunning::model::ListOperationsResponse,
14023 crate::Error,
14024 > {
14025 use std::clone::Clone;
14026 let token = self.0.request.page_token.clone();
14027 let execute = move |token: String| {
14028 let mut builder = self.clone();
14029 builder.0.request = builder.0.request.set_page_token(token);
14030 builder.send()
14031 };
14032 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14033 }
14034
14035 pub fn by_item(
14037 self,
14038 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14039 google_cloud_longrunning::model::ListOperationsResponse,
14040 crate::Error,
14041 > {
14042 use google_cloud_gax::paginator::Paginator;
14043 self.by_page().items()
14044 }
14045
14046 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14048 self.0.request.name = v.into();
14049 self
14050 }
14051
14052 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14054 self.0.request.filter = v.into();
14055 self
14056 }
14057
14058 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14060 self.0.request.page_size = v.into();
14061 self
14062 }
14063
14064 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14066 self.0.request.page_token = v.into();
14067 self
14068 }
14069
14070 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14072 self.0.request.return_partial_success = v.into();
14073 self
14074 }
14075 }
14076
14077 #[doc(hidden)]
14078 impl crate::RequestBuilder for ListOperations {
14079 fn request_options(&mut self) -> &mut crate::RequestOptions {
14080 &mut self.0.options
14081 }
14082 }
14083
14084 #[derive(Clone, Debug)]
14101 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14102
14103 impl GetOperation {
14104 pub(crate) fn new(
14105 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
14106 ) -> Self {
14107 Self(RequestBuilder::new(stub))
14108 }
14109
14110 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14112 mut self,
14113 v: V,
14114 ) -> Self {
14115 self.0.request = v.into();
14116 self
14117 }
14118
14119 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14121 self.0.options = v.into();
14122 self
14123 }
14124
14125 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14127 (*self.0.stub)
14128 .get_operation(self.0.request, self.0.options)
14129 .await
14130 .map(crate::Response::into_body)
14131 }
14132
14133 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14135 self.0.request.name = v.into();
14136 self
14137 }
14138 }
14139
14140 #[doc(hidden)]
14141 impl crate::RequestBuilder for GetOperation {
14142 fn request_options(&mut self) -> &mut crate::RequestOptions {
14143 &mut self.0.options
14144 }
14145 }
14146
14147 #[derive(Clone, Debug)]
14164 pub struct CancelOperation(
14165 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14166 );
14167
14168 impl CancelOperation {
14169 pub(crate) fn new(
14170 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
14171 ) -> Self {
14172 Self(RequestBuilder::new(stub))
14173 }
14174
14175 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
14177 mut self,
14178 v: V,
14179 ) -> Self {
14180 self.0.request = v.into();
14181 self
14182 }
14183
14184 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14186 self.0.options = v.into();
14187 self
14188 }
14189
14190 pub async fn send(self) -> Result<()> {
14192 (*self.0.stub)
14193 .cancel_operation(self.0.request, self.0.options)
14194 .await
14195 .map(crate::Response::into_body)
14196 }
14197
14198 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14200 self.0.request.name = v.into();
14201 self
14202 }
14203 }
14204
14205 #[doc(hidden)]
14206 impl crate::RequestBuilder for CancelOperation {
14207 fn request_options(&mut self) -> &mut crate::RequestOptions {
14208 &mut self.0.options
14209 }
14210 }
14211}
14212
14213#[cfg(feature = "session-service")]
14215#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
14216pub mod session_service {
14217 use crate::Result;
14218
14219 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14233
14234 pub(crate) mod client {
14235 use super::super::super::client::SessionService;
14236 pub struct Factory;
14237 impl crate::ClientFactory for Factory {
14238 type Client = SessionService;
14239 type Credentials = gaxi::options::Credentials;
14240 async fn build(
14241 self,
14242 config: gaxi::options::ClientConfig,
14243 ) -> crate::ClientBuilderResult<Self::Client> {
14244 Self::Client::new(config).await
14245 }
14246 }
14247 }
14248
14249 #[derive(Clone, Debug)]
14251 pub(crate) struct RequestBuilder<R: std::default::Default> {
14252 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14253 request: R,
14254 options: crate::RequestOptions,
14255 }
14256
14257 impl<R> RequestBuilder<R>
14258 where
14259 R: std::default::Default,
14260 {
14261 pub(crate) fn new(
14262 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14263 ) -> Self {
14264 Self {
14265 stub,
14266 request: R::default(),
14267 options: crate::RequestOptions::default(),
14268 }
14269 }
14270 }
14271
14272 #[derive(Clone, Debug)]
14289 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
14290
14291 impl CreateSession {
14292 pub(crate) fn new(
14293 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14294 ) -> Self {
14295 Self(RequestBuilder::new(stub))
14296 }
14297
14298 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
14300 self.0.request = v.into();
14301 self
14302 }
14303
14304 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14306 self.0.options = v.into();
14307 self
14308 }
14309
14310 pub async fn send(self) -> Result<crate::model::Session> {
14312 (*self.0.stub)
14313 .create_session(self.0.request, self.0.options)
14314 .await
14315 .map(crate::Response::into_body)
14316 }
14317
14318 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14322 self.0.request.parent = v.into();
14323 self
14324 }
14325
14326 pub fn set_session<T>(mut self, v: T) -> Self
14330 where
14331 T: std::convert::Into<crate::model::Session>,
14332 {
14333 self.0.request.session = std::option::Option::Some(v.into());
14334 self
14335 }
14336
14337 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
14341 where
14342 T: std::convert::Into<crate::model::Session>,
14343 {
14344 self.0.request.session = v.map(|x| x.into());
14345 self
14346 }
14347 }
14348
14349 #[doc(hidden)]
14350 impl crate::RequestBuilder for CreateSession {
14351 fn request_options(&mut self) -> &mut crate::RequestOptions {
14352 &mut self.0.options
14353 }
14354 }
14355
14356 #[derive(Clone, Debug)]
14373 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
14374
14375 impl DeleteSession {
14376 pub(crate) fn new(
14377 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14378 ) -> Self {
14379 Self(RequestBuilder::new(stub))
14380 }
14381
14382 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
14384 self.0.request = v.into();
14385 self
14386 }
14387
14388 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14390 self.0.options = v.into();
14391 self
14392 }
14393
14394 pub async fn send(self) -> Result<()> {
14396 (*self.0.stub)
14397 .delete_session(self.0.request, self.0.options)
14398 .await
14399 .map(crate::Response::into_body)
14400 }
14401
14402 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14406 self.0.request.name = v.into();
14407 self
14408 }
14409 }
14410
14411 #[doc(hidden)]
14412 impl crate::RequestBuilder for DeleteSession {
14413 fn request_options(&mut self) -> &mut crate::RequestOptions {
14414 &mut self.0.options
14415 }
14416 }
14417
14418 #[derive(Clone, Debug)]
14435 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
14436
14437 impl UpdateSession {
14438 pub(crate) fn new(
14439 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14440 ) -> Self {
14441 Self(RequestBuilder::new(stub))
14442 }
14443
14444 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
14446 self.0.request = v.into();
14447 self
14448 }
14449
14450 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14452 self.0.options = v.into();
14453 self
14454 }
14455
14456 pub async fn send(self) -> Result<crate::model::Session> {
14458 (*self.0.stub)
14459 .update_session(self.0.request, self.0.options)
14460 .await
14461 .map(crate::Response::into_body)
14462 }
14463
14464 pub fn set_session<T>(mut self, v: T) -> Self
14468 where
14469 T: std::convert::Into<crate::model::Session>,
14470 {
14471 self.0.request.session = std::option::Option::Some(v.into());
14472 self
14473 }
14474
14475 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
14479 where
14480 T: std::convert::Into<crate::model::Session>,
14481 {
14482 self.0.request.session = v.map(|x| x.into());
14483 self
14484 }
14485
14486 pub fn set_update_mask<T>(mut self, v: T) -> Self
14488 where
14489 T: std::convert::Into<wkt::FieldMask>,
14490 {
14491 self.0.request.update_mask = std::option::Option::Some(v.into());
14492 self
14493 }
14494
14495 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14497 where
14498 T: std::convert::Into<wkt::FieldMask>,
14499 {
14500 self.0.request.update_mask = v.map(|x| x.into());
14501 self
14502 }
14503 }
14504
14505 #[doc(hidden)]
14506 impl crate::RequestBuilder for UpdateSession {
14507 fn request_options(&mut self) -> &mut crate::RequestOptions {
14508 &mut self.0.options
14509 }
14510 }
14511
14512 #[derive(Clone, Debug)]
14529 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
14530
14531 impl GetSession {
14532 pub(crate) fn new(
14533 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14534 ) -> Self {
14535 Self(RequestBuilder::new(stub))
14536 }
14537
14538 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
14540 self.0.request = v.into();
14541 self
14542 }
14543
14544 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14546 self.0.options = v.into();
14547 self
14548 }
14549
14550 pub async fn send(self) -> Result<crate::model::Session> {
14552 (*self.0.stub)
14553 .get_session(self.0.request, self.0.options)
14554 .await
14555 .map(crate::Response::into_body)
14556 }
14557
14558 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14562 self.0.request.name = v.into();
14563 self
14564 }
14565
14566 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
14568 self.0.request.include_answer_details = v.into();
14569 self
14570 }
14571 }
14572
14573 #[doc(hidden)]
14574 impl crate::RequestBuilder for GetSession {
14575 fn request_options(&mut self) -> &mut crate::RequestOptions {
14576 &mut self.0.options
14577 }
14578 }
14579
14580 #[derive(Clone, Debug)]
14601 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
14602
14603 impl ListSessions {
14604 pub(crate) fn new(
14605 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14606 ) -> Self {
14607 Self(RequestBuilder::new(stub))
14608 }
14609
14610 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
14612 self.0.request = v.into();
14613 self
14614 }
14615
14616 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14618 self.0.options = v.into();
14619 self
14620 }
14621
14622 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
14624 (*self.0.stub)
14625 .list_sessions(self.0.request, self.0.options)
14626 .await
14627 .map(crate::Response::into_body)
14628 }
14629
14630 pub fn by_page(
14632 self,
14633 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
14634 {
14635 use std::clone::Clone;
14636 let token = self.0.request.page_token.clone();
14637 let execute = move |token: String| {
14638 let mut builder = self.clone();
14639 builder.0.request = builder.0.request.set_page_token(token);
14640 builder.send()
14641 };
14642 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14643 }
14644
14645 pub fn by_item(
14647 self,
14648 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14649 crate::model::ListSessionsResponse,
14650 crate::Error,
14651 > {
14652 use google_cloud_gax::paginator::Paginator;
14653 self.by_page().items()
14654 }
14655
14656 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14660 self.0.request.parent = v.into();
14661 self
14662 }
14663
14664 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14666 self.0.request.page_size = v.into();
14667 self
14668 }
14669
14670 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14672 self.0.request.page_token = v.into();
14673 self
14674 }
14675
14676 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14678 self.0.request.filter = v.into();
14679 self
14680 }
14681
14682 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
14684 self.0.request.order_by = v.into();
14685 self
14686 }
14687 }
14688
14689 #[doc(hidden)]
14690 impl crate::RequestBuilder for ListSessions {
14691 fn request_options(&mut self) -> &mut crate::RequestOptions {
14692 &mut self.0.options
14693 }
14694 }
14695
14696 #[derive(Clone, Debug)]
14717 pub struct ListOperations(
14718 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
14719 );
14720
14721 impl ListOperations {
14722 pub(crate) fn new(
14723 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14724 ) -> Self {
14725 Self(RequestBuilder::new(stub))
14726 }
14727
14728 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
14730 mut self,
14731 v: V,
14732 ) -> Self {
14733 self.0.request = v.into();
14734 self
14735 }
14736
14737 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14739 self.0.options = v.into();
14740 self
14741 }
14742
14743 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
14745 (*self.0.stub)
14746 .list_operations(self.0.request, self.0.options)
14747 .await
14748 .map(crate::Response::into_body)
14749 }
14750
14751 pub fn by_page(
14753 self,
14754 ) -> impl google_cloud_gax::paginator::Paginator<
14755 google_cloud_longrunning::model::ListOperationsResponse,
14756 crate::Error,
14757 > {
14758 use std::clone::Clone;
14759 let token = self.0.request.page_token.clone();
14760 let execute = move |token: String| {
14761 let mut builder = self.clone();
14762 builder.0.request = builder.0.request.set_page_token(token);
14763 builder.send()
14764 };
14765 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14766 }
14767
14768 pub fn by_item(
14770 self,
14771 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14772 google_cloud_longrunning::model::ListOperationsResponse,
14773 crate::Error,
14774 > {
14775 use google_cloud_gax::paginator::Paginator;
14776 self.by_page().items()
14777 }
14778
14779 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14781 self.0.request.name = v.into();
14782 self
14783 }
14784
14785 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14787 self.0.request.filter = v.into();
14788 self
14789 }
14790
14791 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14793 self.0.request.page_size = v.into();
14794 self
14795 }
14796
14797 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14799 self.0.request.page_token = v.into();
14800 self
14801 }
14802
14803 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14805 self.0.request.return_partial_success = v.into();
14806 self
14807 }
14808 }
14809
14810 #[doc(hidden)]
14811 impl crate::RequestBuilder for ListOperations {
14812 fn request_options(&mut self) -> &mut crate::RequestOptions {
14813 &mut self.0.options
14814 }
14815 }
14816
14817 #[derive(Clone, Debug)]
14834 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14835
14836 impl GetOperation {
14837 pub(crate) fn new(
14838 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14839 ) -> Self {
14840 Self(RequestBuilder::new(stub))
14841 }
14842
14843 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14845 mut self,
14846 v: V,
14847 ) -> Self {
14848 self.0.request = v.into();
14849 self
14850 }
14851
14852 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14854 self.0.options = v.into();
14855 self
14856 }
14857
14858 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14860 (*self.0.stub)
14861 .get_operation(self.0.request, self.0.options)
14862 .await
14863 .map(crate::Response::into_body)
14864 }
14865
14866 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14868 self.0.request.name = v.into();
14869 self
14870 }
14871 }
14872
14873 #[doc(hidden)]
14874 impl crate::RequestBuilder for GetOperation {
14875 fn request_options(&mut self) -> &mut crate::RequestOptions {
14876 &mut self.0.options
14877 }
14878 }
14879
14880 #[derive(Clone, Debug)]
14897 pub struct CancelOperation(
14898 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14899 );
14900
14901 impl CancelOperation {
14902 pub(crate) fn new(
14903 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14904 ) -> Self {
14905 Self(RequestBuilder::new(stub))
14906 }
14907
14908 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
14910 mut self,
14911 v: V,
14912 ) -> Self {
14913 self.0.request = v.into();
14914 self
14915 }
14916
14917 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14919 self.0.options = v.into();
14920 self
14921 }
14922
14923 pub async fn send(self) -> Result<()> {
14925 (*self.0.stub)
14926 .cancel_operation(self.0.request, self.0.options)
14927 .await
14928 .map(crate::Response::into_body)
14929 }
14930
14931 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14933 self.0.request.name = v.into();
14934 self
14935 }
14936 }
14937
14938 #[doc(hidden)]
14939 impl crate::RequestBuilder for CancelOperation {
14940 fn request_options(&mut self) -> &mut crate::RequestOptions {
14941 &mut self.0.options
14942 }
14943 }
14944}
14945
14946#[cfg(feature = "site-search-engine-service")]
14948#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
14949pub mod site_search_engine_service {
14950 use crate::Result;
14951
14952 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14966
14967 pub(crate) mod client {
14968 use super::super::super::client::SiteSearchEngineService;
14969 pub struct Factory;
14970 impl crate::ClientFactory for Factory {
14971 type Client = SiteSearchEngineService;
14972 type Credentials = gaxi::options::Credentials;
14973 async fn build(
14974 self,
14975 config: gaxi::options::ClientConfig,
14976 ) -> crate::ClientBuilderResult<Self::Client> {
14977 Self::Client::new(config).await
14978 }
14979 }
14980 }
14981
14982 #[derive(Clone, Debug)]
14984 pub(crate) struct RequestBuilder<R: std::default::Default> {
14985 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14986 request: R,
14987 options: crate::RequestOptions,
14988 }
14989
14990 impl<R> RequestBuilder<R>
14991 where
14992 R: std::default::Default,
14993 {
14994 pub(crate) fn new(
14995 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14996 ) -> Self {
14997 Self {
14998 stub,
14999 request: R::default(),
15000 options: crate::RequestOptions::default(),
15001 }
15002 }
15003 }
15004
15005 #[derive(Clone, Debug)]
15022 pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
15023
15024 impl GetSiteSearchEngine {
15025 pub(crate) fn new(
15026 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15027 ) -> Self {
15028 Self(RequestBuilder::new(stub))
15029 }
15030
15031 pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
15033 mut self,
15034 v: V,
15035 ) -> Self {
15036 self.0.request = v.into();
15037 self
15038 }
15039
15040 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15042 self.0.options = v.into();
15043 self
15044 }
15045
15046 pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
15048 (*self.0.stub)
15049 .get_site_search_engine(self.0.request, self.0.options)
15050 .await
15051 .map(crate::Response::into_body)
15052 }
15053
15054 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15058 self.0.request.name = v.into();
15059 self
15060 }
15061 }
15062
15063 #[doc(hidden)]
15064 impl crate::RequestBuilder for GetSiteSearchEngine {
15065 fn request_options(&mut self) -> &mut crate::RequestOptions {
15066 &mut self.0.options
15067 }
15068 }
15069
15070 #[derive(Clone, Debug)]
15088 pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
15089
15090 impl CreateTargetSite {
15091 pub(crate) fn new(
15092 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15093 ) -> Self {
15094 Self(RequestBuilder::new(stub))
15095 }
15096
15097 pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
15099 mut self,
15100 v: V,
15101 ) -> Self {
15102 self.0.request = v.into();
15103 self
15104 }
15105
15106 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15108 self.0.options = v.into();
15109 self
15110 }
15111
15112 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15119 (*self.0.stub)
15120 .create_target_site(self.0.request, self.0.options)
15121 .await
15122 .map(crate::Response::into_body)
15123 }
15124
15125 pub fn poller(
15127 self,
15128 ) -> impl google_cloud_lro::Poller<
15129 crate::model::TargetSite,
15130 crate::model::CreateTargetSiteMetadata,
15131 > {
15132 type Operation = google_cloud_lro::internal::Operation<
15133 crate::model::TargetSite,
15134 crate::model::CreateTargetSiteMetadata,
15135 >;
15136 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15137 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15138 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15139 if let Some(ref mut details) = poller_options.tracing {
15140 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::create_target_site::until_done";
15141 }
15142
15143 let stub = self.0.stub.clone();
15144 let mut options = self.0.options.clone();
15145 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15146 let query = move |name| {
15147 let stub = stub.clone();
15148 let options = options.clone();
15149 async {
15150 let op = GetOperation::new(stub)
15151 .set_name(name)
15152 .with_options(options)
15153 .send()
15154 .await?;
15155 Ok(Operation::new(op))
15156 }
15157 };
15158
15159 let start = move || async {
15160 let op = self.send().await?;
15161 Ok(Operation::new(op))
15162 };
15163
15164 use google_cloud_lro::internal::PollerExt;
15165 {
15166 google_cloud_lro::internal::new_poller(
15167 polling_error_policy,
15168 polling_backoff_policy,
15169 start,
15170 query,
15171 )
15172 }
15173 .with_options(poller_options)
15174 }
15175
15176 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15180 self.0.request.parent = v.into();
15181 self
15182 }
15183
15184 pub fn set_target_site<T>(mut self, v: T) -> Self
15188 where
15189 T: std::convert::Into<crate::model::TargetSite>,
15190 {
15191 self.0.request.target_site = std::option::Option::Some(v.into());
15192 self
15193 }
15194
15195 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
15199 where
15200 T: std::convert::Into<crate::model::TargetSite>,
15201 {
15202 self.0.request.target_site = v.map(|x| x.into());
15203 self
15204 }
15205 }
15206
15207 #[doc(hidden)]
15208 impl crate::RequestBuilder for CreateTargetSite {
15209 fn request_options(&mut self) -> &mut crate::RequestOptions {
15210 &mut self.0.options
15211 }
15212 }
15213
15214 #[derive(Clone, Debug)]
15232 pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
15233
15234 impl BatchCreateTargetSites {
15235 pub(crate) fn new(
15236 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15237 ) -> Self {
15238 Self(RequestBuilder::new(stub))
15239 }
15240
15241 pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
15243 mut self,
15244 v: V,
15245 ) -> Self {
15246 self.0.request = v.into();
15247 self
15248 }
15249
15250 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15252 self.0.options = v.into();
15253 self
15254 }
15255
15256 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15263 (*self.0.stub)
15264 .batch_create_target_sites(self.0.request, self.0.options)
15265 .await
15266 .map(crate::Response::into_body)
15267 }
15268
15269 pub fn poller(
15271 self,
15272 ) -> impl google_cloud_lro::Poller<
15273 crate::model::BatchCreateTargetSitesResponse,
15274 crate::model::BatchCreateTargetSiteMetadata,
15275 > {
15276 type Operation = google_cloud_lro::internal::Operation<
15277 crate::model::BatchCreateTargetSitesResponse,
15278 crate::model::BatchCreateTargetSiteMetadata,
15279 >;
15280 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15281 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15282 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15283 if let Some(ref mut details) = poller_options.tracing {
15284 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::batch_create_target_sites::until_done";
15285 }
15286
15287 let stub = self.0.stub.clone();
15288 let mut options = self.0.options.clone();
15289 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15290 let query = move |name| {
15291 let stub = stub.clone();
15292 let options = options.clone();
15293 async {
15294 let op = GetOperation::new(stub)
15295 .set_name(name)
15296 .with_options(options)
15297 .send()
15298 .await?;
15299 Ok(Operation::new(op))
15300 }
15301 };
15302
15303 let start = move || async {
15304 let op = self.send().await?;
15305 Ok(Operation::new(op))
15306 };
15307
15308 use google_cloud_lro::internal::PollerExt;
15309 {
15310 google_cloud_lro::internal::new_poller(
15311 polling_error_policy,
15312 polling_backoff_policy,
15313 start,
15314 query,
15315 )
15316 }
15317 .with_options(poller_options)
15318 }
15319
15320 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15324 self.0.request.parent = v.into();
15325 self
15326 }
15327
15328 pub fn set_requests<T, V>(mut self, v: T) -> Self
15332 where
15333 T: std::iter::IntoIterator<Item = V>,
15334 V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
15335 {
15336 use std::iter::Iterator;
15337 self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
15338 self
15339 }
15340 }
15341
15342 #[doc(hidden)]
15343 impl crate::RequestBuilder for BatchCreateTargetSites {
15344 fn request_options(&mut self) -> &mut crate::RequestOptions {
15345 &mut self.0.options
15346 }
15347 }
15348
15349 #[derive(Clone, Debug)]
15366 pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
15367
15368 impl GetTargetSite {
15369 pub(crate) fn new(
15370 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15371 ) -> Self {
15372 Self(RequestBuilder::new(stub))
15373 }
15374
15375 pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
15377 self.0.request = v.into();
15378 self
15379 }
15380
15381 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15383 self.0.options = v.into();
15384 self
15385 }
15386
15387 pub async fn send(self) -> Result<crate::model::TargetSite> {
15389 (*self.0.stub)
15390 .get_target_site(self.0.request, self.0.options)
15391 .await
15392 .map(crate::Response::into_body)
15393 }
15394
15395 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15399 self.0.request.name = v.into();
15400 self
15401 }
15402 }
15403
15404 #[doc(hidden)]
15405 impl crate::RequestBuilder for GetTargetSite {
15406 fn request_options(&mut self) -> &mut crate::RequestOptions {
15407 &mut self.0.options
15408 }
15409 }
15410
15411 #[derive(Clone, Debug)]
15429 pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
15430
15431 impl UpdateTargetSite {
15432 pub(crate) fn new(
15433 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15434 ) -> Self {
15435 Self(RequestBuilder::new(stub))
15436 }
15437
15438 pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
15440 mut self,
15441 v: V,
15442 ) -> Self {
15443 self.0.request = v.into();
15444 self
15445 }
15446
15447 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15449 self.0.options = v.into();
15450 self
15451 }
15452
15453 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15460 (*self.0.stub)
15461 .update_target_site(self.0.request, self.0.options)
15462 .await
15463 .map(crate::Response::into_body)
15464 }
15465
15466 pub fn poller(
15468 self,
15469 ) -> impl google_cloud_lro::Poller<
15470 crate::model::TargetSite,
15471 crate::model::UpdateTargetSiteMetadata,
15472 > {
15473 type Operation = google_cloud_lro::internal::Operation<
15474 crate::model::TargetSite,
15475 crate::model::UpdateTargetSiteMetadata,
15476 >;
15477 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15478 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15479 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15480 if let Some(ref mut details) = poller_options.tracing {
15481 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::update_target_site::until_done";
15482 }
15483
15484 let stub = self.0.stub.clone();
15485 let mut options = self.0.options.clone();
15486 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15487 let query = move |name| {
15488 let stub = stub.clone();
15489 let options = options.clone();
15490 async {
15491 let op = GetOperation::new(stub)
15492 .set_name(name)
15493 .with_options(options)
15494 .send()
15495 .await?;
15496 Ok(Operation::new(op))
15497 }
15498 };
15499
15500 let start = move || async {
15501 let op = self.send().await?;
15502 Ok(Operation::new(op))
15503 };
15504
15505 use google_cloud_lro::internal::PollerExt;
15506 {
15507 google_cloud_lro::internal::new_poller(
15508 polling_error_policy,
15509 polling_backoff_policy,
15510 start,
15511 query,
15512 )
15513 }
15514 .with_options(poller_options)
15515 }
15516
15517 pub fn set_target_site<T>(mut self, v: T) -> Self
15521 where
15522 T: std::convert::Into<crate::model::TargetSite>,
15523 {
15524 self.0.request.target_site = std::option::Option::Some(v.into());
15525 self
15526 }
15527
15528 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
15532 where
15533 T: std::convert::Into<crate::model::TargetSite>,
15534 {
15535 self.0.request.target_site = v.map(|x| x.into());
15536 self
15537 }
15538 }
15539
15540 #[doc(hidden)]
15541 impl crate::RequestBuilder for UpdateTargetSite {
15542 fn request_options(&mut self) -> &mut crate::RequestOptions {
15543 &mut self.0.options
15544 }
15545 }
15546
15547 #[derive(Clone, Debug)]
15565 pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
15566
15567 impl DeleteTargetSite {
15568 pub(crate) fn new(
15569 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15570 ) -> Self {
15571 Self(RequestBuilder::new(stub))
15572 }
15573
15574 pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
15576 mut self,
15577 v: V,
15578 ) -> Self {
15579 self.0.request = v.into();
15580 self
15581 }
15582
15583 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15585 self.0.options = v.into();
15586 self
15587 }
15588
15589 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15596 (*self.0.stub)
15597 .delete_target_site(self.0.request, self.0.options)
15598 .await
15599 .map(crate::Response::into_body)
15600 }
15601
15602 pub fn poller(
15604 self,
15605 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
15606 type Operation = google_cloud_lro::internal::Operation<
15607 wkt::Empty,
15608 crate::model::DeleteTargetSiteMetadata,
15609 >;
15610 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15611 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15612 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15613 if let Some(ref mut details) = poller_options.tracing {
15614 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::delete_target_site::until_done";
15615 }
15616
15617 let stub = self.0.stub.clone();
15618 let mut options = self.0.options.clone();
15619 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15620 let query = move |name| {
15621 let stub = stub.clone();
15622 let options = options.clone();
15623 async {
15624 let op = GetOperation::new(stub)
15625 .set_name(name)
15626 .with_options(options)
15627 .send()
15628 .await?;
15629 Ok(Operation::new(op))
15630 }
15631 };
15632
15633 let start = move || async {
15634 let op = self.send().await?;
15635 Ok(Operation::new(op))
15636 };
15637
15638 use google_cloud_lro::internal::PollerExt;
15639 {
15640 google_cloud_lro::internal::new_unit_response_poller(
15641 polling_error_policy,
15642 polling_backoff_policy,
15643 start,
15644 query,
15645 )
15646 }
15647 .with_options(poller_options)
15648 }
15649
15650 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15654 self.0.request.name = v.into();
15655 self
15656 }
15657 }
15658
15659 #[doc(hidden)]
15660 impl crate::RequestBuilder for DeleteTargetSite {
15661 fn request_options(&mut self) -> &mut crate::RequestOptions {
15662 &mut self.0.options
15663 }
15664 }
15665
15666 #[derive(Clone, Debug)]
15687 pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
15688
15689 impl ListTargetSites {
15690 pub(crate) fn new(
15691 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15692 ) -> Self {
15693 Self(RequestBuilder::new(stub))
15694 }
15695
15696 pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
15698 self.0.request = v.into();
15699 self
15700 }
15701
15702 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15704 self.0.options = v.into();
15705 self
15706 }
15707
15708 pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
15710 (*self.0.stub)
15711 .list_target_sites(self.0.request, self.0.options)
15712 .await
15713 .map(crate::Response::into_body)
15714 }
15715
15716 pub fn by_page(
15718 self,
15719 ) -> impl google_cloud_gax::paginator::Paginator<
15720 crate::model::ListTargetSitesResponse,
15721 crate::Error,
15722 > {
15723 use std::clone::Clone;
15724 let token = self.0.request.page_token.clone();
15725 let execute = move |token: String| {
15726 let mut builder = self.clone();
15727 builder.0.request = builder.0.request.set_page_token(token);
15728 builder.send()
15729 };
15730 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15731 }
15732
15733 pub fn by_item(
15735 self,
15736 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15737 crate::model::ListTargetSitesResponse,
15738 crate::Error,
15739 > {
15740 use google_cloud_gax::paginator::Paginator;
15741 self.by_page().items()
15742 }
15743
15744 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15748 self.0.request.parent = v.into();
15749 self
15750 }
15751
15752 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15754 self.0.request.page_size = v.into();
15755 self
15756 }
15757
15758 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15760 self.0.request.page_token = v.into();
15761 self
15762 }
15763 }
15764
15765 #[doc(hidden)]
15766 impl crate::RequestBuilder for ListTargetSites {
15767 fn request_options(&mut self) -> &mut crate::RequestOptions {
15768 &mut self.0.options
15769 }
15770 }
15771
15772 #[derive(Clone, Debug)]
15790 pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
15791
15792 impl CreateSitemap {
15793 pub(crate) fn new(
15794 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15795 ) -> Self {
15796 Self(RequestBuilder::new(stub))
15797 }
15798
15799 pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
15801 self.0.request = v.into();
15802 self
15803 }
15804
15805 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15807 self.0.options = v.into();
15808 self
15809 }
15810
15811 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15818 (*self.0.stub)
15819 .create_sitemap(self.0.request, self.0.options)
15820 .await
15821 .map(crate::Response::into_body)
15822 }
15823
15824 pub fn poller(
15826 self,
15827 ) -> impl google_cloud_lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata>
15828 {
15829 type Operation = google_cloud_lro::internal::Operation<
15830 crate::model::Sitemap,
15831 crate::model::CreateSitemapMetadata,
15832 >;
15833 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15834 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15835 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15836 if let Some(ref mut details) = poller_options.tracing {
15837 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::create_sitemap::until_done";
15838 }
15839
15840 let stub = self.0.stub.clone();
15841 let mut options = self.0.options.clone();
15842 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15843 let query = move |name| {
15844 let stub = stub.clone();
15845 let options = options.clone();
15846 async {
15847 let op = GetOperation::new(stub)
15848 .set_name(name)
15849 .with_options(options)
15850 .send()
15851 .await?;
15852 Ok(Operation::new(op))
15853 }
15854 };
15855
15856 let start = move || async {
15857 let op = self.send().await?;
15858 Ok(Operation::new(op))
15859 };
15860
15861 use google_cloud_lro::internal::PollerExt;
15862 {
15863 google_cloud_lro::internal::new_poller(
15864 polling_error_policy,
15865 polling_backoff_policy,
15866 start,
15867 query,
15868 )
15869 }
15870 .with_options(poller_options)
15871 }
15872
15873 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15877 self.0.request.parent = v.into();
15878 self
15879 }
15880
15881 pub fn set_sitemap<T>(mut self, v: T) -> Self
15885 where
15886 T: std::convert::Into<crate::model::Sitemap>,
15887 {
15888 self.0.request.sitemap = std::option::Option::Some(v.into());
15889 self
15890 }
15891
15892 pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
15896 where
15897 T: std::convert::Into<crate::model::Sitemap>,
15898 {
15899 self.0.request.sitemap = v.map(|x| x.into());
15900 self
15901 }
15902 }
15903
15904 #[doc(hidden)]
15905 impl crate::RequestBuilder for CreateSitemap {
15906 fn request_options(&mut self) -> &mut crate::RequestOptions {
15907 &mut self.0.options
15908 }
15909 }
15910
15911 #[derive(Clone, Debug)]
15929 pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
15930
15931 impl DeleteSitemap {
15932 pub(crate) fn new(
15933 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15934 ) -> Self {
15935 Self(RequestBuilder::new(stub))
15936 }
15937
15938 pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
15940 self.0.request = v.into();
15941 self
15942 }
15943
15944 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15946 self.0.options = v.into();
15947 self
15948 }
15949
15950 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15957 (*self.0.stub)
15958 .delete_sitemap(self.0.request, self.0.options)
15959 .await
15960 .map(crate::Response::into_body)
15961 }
15962
15963 pub fn poller(
15965 self,
15966 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSitemapMetadata> {
15967 type Operation = google_cloud_lro::internal::Operation<
15968 wkt::Empty,
15969 crate::model::DeleteSitemapMetadata,
15970 >;
15971 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15972 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15973 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
15974 if let Some(ref mut details) = poller_options.tracing {
15975 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::delete_sitemap::until_done";
15976 }
15977
15978 let stub = self.0.stub.clone();
15979 let mut options = self.0.options.clone();
15980 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15981 let query = move |name| {
15982 let stub = stub.clone();
15983 let options = options.clone();
15984 async {
15985 let op = GetOperation::new(stub)
15986 .set_name(name)
15987 .with_options(options)
15988 .send()
15989 .await?;
15990 Ok(Operation::new(op))
15991 }
15992 };
15993
15994 let start = move || async {
15995 let op = self.send().await?;
15996 Ok(Operation::new(op))
15997 };
15998
15999 use google_cloud_lro::internal::PollerExt;
16000 {
16001 google_cloud_lro::internal::new_unit_response_poller(
16002 polling_error_policy,
16003 polling_backoff_policy,
16004 start,
16005 query,
16006 )
16007 }
16008 .with_options(poller_options)
16009 }
16010
16011 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16015 self.0.request.name = v.into();
16016 self
16017 }
16018 }
16019
16020 #[doc(hidden)]
16021 impl crate::RequestBuilder for DeleteSitemap {
16022 fn request_options(&mut self) -> &mut crate::RequestOptions {
16023 &mut self.0.options
16024 }
16025 }
16026
16027 #[derive(Clone, Debug)]
16044 pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
16045
16046 impl FetchSitemaps {
16047 pub(crate) fn new(
16048 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16049 ) -> Self {
16050 Self(RequestBuilder::new(stub))
16051 }
16052
16053 pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
16055 self.0.request = v.into();
16056 self
16057 }
16058
16059 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16061 self.0.options = v.into();
16062 self
16063 }
16064
16065 pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
16067 (*self.0.stub)
16068 .fetch_sitemaps(self.0.request, self.0.options)
16069 .await
16070 .map(crate::Response::into_body)
16071 }
16072
16073 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16077 self.0.request.parent = v.into();
16078 self
16079 }
16080
16081 pub fn set_matcher<T>(mut self, v: T) -> Self
16083 where
16084 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
16085 {
16086 self.0.request.matcher = std::option::Option::Some(v.into());
16087 self
16088 }
16089
16090 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
16092 where
16093 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
16094 {
16095 self.0.request.matcher = v.map(|x| x.into());
16096 self
16097 }
16098 }
16099
16100 #[doc(hidden)]
16101 impl crate::RequestBuilder for FetchSitemaps {
16102 fn request_options(&mut self) -> &mut crate::RequestOptions {
16103 &mut self.0.options
16104 }
16105 }
16106
16107 #[derive(Clone, Debug)]
16125 pub struct EnableAdvancedSiteSearch(
16126 RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
16127 );
16128
16129 impl EnableAdvancedSiteSearch {
16130 pub(crate) fn new(
16131 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16132 ) -> Self {
16133 Self(RequestBuilder::new(stub))
16134 }
16135
16136 pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
16138 mut self,
16139 v: V,
16140 ) -> Self {
16141 self.0.request = v.into();
16142 self
16143 }
16144
16145 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16147 self.0.options = v.into();
16148 self
16149 }
16150
16151 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16158 (*self.0.stub)
16159 .enable_advanced_site_search(self.0.request, self.0.options)
16160 .await
16161 .map(crate::Response::into_body)
16162 }
16163
16164 pub fn poller(
16166 self,
16167 ) -> impl google_cloud_lro::Poller<
16168 crate::model::EnableAdvancedSiteSearchResponse,
16169 crate::model::EnableAdvancedSiteSearchMetadata,
16170 > {
16171 type Operation = google_cloud_lro::internal::Operation<
16172 crate::model::EnableAdvancedSiteSearchResponse,
16173 crate::model::EnableAdvancedSiteSearchMetadata,
16174 >;
16175 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16176 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16177 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16178 if let Some(ref mut details) = poller_options.tracing {
16179 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::enable_advanced_site_search::until_done";
16180 }
16181
16182 let stub = self.0.stub.clone();
16183 let mut options = self.0.options.clone();
16184 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16185 let query = move |name| {
16186 let stub = stub.clone();
16187 let options = options.clone();
16188 async {
16189 let op = GetOperation::new(stub)
16190 .set_name(name)
16191 .with_options(options)
16192 .send()
16193 .await?;
16194 Ok(Operation::new(op))
16195 }
16196 };
16197
16198 let start = move || async {
16199 let op = self.send().await?;
16200 Ok(Operation::new(op))
16201 };
16202
16203 use google_cloud_lro::internal::PollerExt;
16204 {
16205 google_cloud_lro::internal::new_poller(
16206 polling_error_policy,
16207 polling_backoff_policy,
16208 start,
16209 query,
16210 )
16211 }
16212 .with_options(poller_options)
16213 }
16214
16215 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
16219 self.0.request.site_search_engine = v.into();
16220 self
16221 }
16222 }
16223
16224 #[doc(hidden)]
16225 impl crate::RequestBuilder for EnableAdvancedSiteSearch {
16226 fn request_options(&mut self) -> &mut crate::RequestOptions {
16227 &mut self.0.options
16228 }
16229 }
16230
16231 #[derive(Clone, Debug)]
16249 pub struct DisableAdvancedSiteSearch(
16250 RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
16251 );
16252
16253 impl DisableAdvancedSiteSearch {
16254 pub(crate) fn new(
16255 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16256 ) -> Self {
16257 Self(RequestBuilder::new(stub))
16258 }
16259
16260 pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
16262 mut self,
16263 v: V,
16264 ) -> Self {
16265 self.0.request = v.into();
16266 self
16267 }
16268
16269 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16271 self.0.options = v.into();
16272 self
16273 }
16274
16275 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16282 (*self.0.stub)
16283 .disable_advanced_site_search(self.0.request, self.0.options)
16284 .await
16285 .map(crate::Response::into_body)
16286 }
16287
16288 pub fn poller(
16290 self,
16291 ) -> impl google_cloud_lro::Poller<
16292 crate::model::DisableAdvancedSiteSearchResponse,
16293 crate::model::DisableAdvancedSiteSearchMetadata,
16294 > {
16295 type Operation = google_cloud_lro::internal::Operation<
16296 crate::model::DisableAdvancedSiteSearchResponse,
16297 crate::model::DisableAdvancedSiteSearchMetadata,
16298 >;
16299 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16300 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16301 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16302 if let Some(ref mut details) = poller_options.tracing {
16303 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::disable_advanced_site_search::until_done";
16304 }
16305
16306 let stub = self.0.stub.clone();
16307 let mut options = self.0.options.clone();
16308 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16309 let query = move |name| {
16310 let stub = stub.clone();
16311 let options = options.clone();
16312 async {
16313 let op = GetOperation::new(stub)
16314 .set_name(name)
16315 .with_options(options)
16316 .send()
16317 .await?;
16318 Ok(Operation::new(op))
16319 }
16320 };
16321
16322 let start = move || async {
16323 let op = self.send().await?;
16324 Ok(Operation::new(op))
16325 };
16326
16327 use google_cloud_lro::internal::PollerExt;
16328 {
16329 google_cloud_lro::internal::new_poller(
16330 polling_error_policy,
16331 polling_backoff_policy,
16332 start,
16333 query,
16334 )
16335 }
16336 .with_options(poller_options)
16337 }
16338
16339 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
16343 self.0.request.site_search_engine = v.into();
16344 self
16345 }
16346 }
16347
16348 #[doc(hidden)]
16349 impl crate::RequestBuilder for DisableAdvancedSiteSearch {
16350 fn request_options(&mut self) -> &mut crate::RequestOptions {
16351 &mut self.0.options
16352 }
16353 }
16354
16355 #[derive(Clone, Debug)]
16373 pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
16374
16375 impl RecrawlUris {
16376 pub(crate) fn new(
16377 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16378 ) -> Self {
16379 Self(RequestBuilder::new(stub))
16380 }
16381
16382 pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
16384 self.0.request = v.into();
16385 self
16386 }
16387
16388 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16390 self.0.options = v.into();
16391 self
16392 }
16393
16394 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16401 (*self.0.stub)
16402 .recrawl_uris(self.0.request, self.0.options)
16403 .await
16404 .map(crate::Response::into_body)
16405 }
16406
16407 pub fn poller(
16409 self,
16410 ) -> impl google_cloud_lro::Poller<
16411 crate::model::RecrawlUrisResponse,
16412 crate::model::RecrawlUrisMetadata,
16413 > {
16414 type Operation = google_cloud_lro::internal::Operation<
16415 crate::model::RecrawlUrisResponse,
16416 crate::model::RecrawlUrisMetadata,
16417 >;
16418 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16419 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16420 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16421 if let Some(ref mut details) = poller_options.tracing {
16422 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::recrawl_uris::until_done";
16423 }
16424
16425 let stub = self.0.stub.clone();
16426 let mut options = self.0.options.clone();
16427 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16428 let query = move |name| {
16429 let stub = stub.clone();
16430 let options = options.clone();
16431 async {
16432 let op = GetOperation::new(stub)
16433 .set_name(name)
16434 .with_options(options)
16435 .send()
16436 .await?;
16437 Ok(Operation::new(op))
16438 }
16439 };
16440
16441 let start = move || async {
16442 let op = self.send().await?;
16443 Ok(Operation::new(op))
16444 };
16445
16446 use google_cloud_lro::internal::PollerExt;
16447 {
16448 google_cloud_lro::internal::new_poller(
16449 polling_error_policy,
16450 polling_backoff_policy,
16451 start,
16452 query,
16453 )
16454 }
16455 .with_options(poller_options)
16456 }
16457
16458 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
16462 self.0.request.site_search_engine = v.into();
16463 self
16464 }
16465
16466 pub fn set_uris<T, V>(mut self, v: T) -> Self
16470 where
16471 T: std::iter::IntoIterator<Item = V>,
16472 V: std::convert::Into<std::string::String>,
16473 {
16474 use std::iter::Iterator;
16475 self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
16476 self
16477 }
16478
16479 pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
16481 self.0.request.site_credential = v.into();
16482 self
16483 }
16484 }
16485
16486 #[doc(hidden)]
16487 impl crate::RequestBuilder for RecrawlUris {
16488 fn request_options(&mut self) -> &mut crate::RequestOptions {
16489 &mut self.0.options
16490 }
16491 }
16492
16493 #[derive(Clone, Debug)]
16511 pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
16512
16513 impl BatchVerifyTargetSites {
16514 pub(crate) fn new(
16515 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16516 ) -> Self {
16517 Self(RequestBuilder::new(stub))
16518 }
16519
16520 pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
16522 mut self,
16523 v: V,
16524 ) -> Self {
16525 self.0.request = v.into();
16526 self
16527 }
16528
16529 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16531 self.0.options = v.into();
16532 self
16533 }
16534
16535 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16542 (*self.0.stub)
16543 .batch_verify_target_sites(self.0.request, self.0.options)
16544 .await
16545 .map(crate::Response::into_body)
16546 }
16547
16548 pub fn poller(
16550 self,
16551 ) -> impl google_cloud_lro::Poller<
16552 crate::model::BatchVerifyTargetSitesResponse,
16553 crate::model::BatchVerifyTargetSitesMetadata,
16554 > {
16555 type Operation = google_cloud_lro::internal::Operation<
16556 crate::model::BatchVerifyTargetSitesResponse,
16557 crate::model::BatchVerifyTargetSitesMetadata,
16558 >;
16559 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16560 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16561 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
16562 if let Some(ref mut details) = poller_options.tracing {
16563 details.method_name = "google_cloud_discoveryengine_v1::client::SiteSearchEngineService::batch_verify_target_sites::until_done";
16564 }
16565
16566 let stub = self.0.stub.clone();
16567 let mut options = self.0.options.clone();
16568 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16569 let query = move |name| {
16570 let stub = stub.clone();
16571 let options = options.clone();
16572 async {
16573 let op = GetOperation::new(stub)
16574 .set_name(name)
16575 .with_options(options)
16576 .send()
16577 .await?;
16578 Ok(Operation::new(op))
16579 }
16580 };
16581
16582 let start = move || async {
16583 let op = self.send().await?;
16584 Ok(Operation::new(op))
16585 };
16586
16587 use google_cloud_lro::internal::PollerExt;
16588 {
16589 google_cloud_lro::internal::new_poller(
16590 polling_error_policy,
16591 polling_backoff_policy,
16592 start,
16593 query,
16594 )
16595 }
16596 .with_options(poller_options)
16597 }
16598
16599 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16603 self.0.request.parent = v.into();
16604 self
16605 }
16606 }
16607
16608 #[doc(hidden)]
16609 impl crate::RequestBuilder for BatchVerifyTargetSites {
16610 fn request_options(&mut self) -> &mut crate::RequestOptions {
16611 &mut self.0.options
16612 }
16613 }
16614
16615 #[derive(Clone, Debug)]
16636 pub struct FetchDomainVerificationStatus(
16637 RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
16638 );
16639
16640 impl FetchDomainVerificationStatus {
16641 pub(crate) fn new(
16642 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16643 ) -> Self {
16644 Self(RequestBuilder::new(stub))
16645 }
16646
16647 pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
16649 mut self,
16650 v: V,
16651 ) -> Self {
16652 self.0.request = v.into();
16653 self
16654 }
16655
16656 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16658 self.0.options = v.into();
16659 self
16660 }
16661
16662 pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
16664 (*self.0.stub)
16665 .fetch_domain_verification_status(self.0.request, self.0.options)
16666 .await
16667 .map(crate::Response::into_body)
16668 }
16669
16670 pub fn by_page(
16672 self,
16673 ) -> impl google_cloud_gax::paginator::Paginator<
16674 crate::model::FetchDomainVerificationStatusResponse,
16675 crate::Error,
16676 > {
16677 use std::clone::Clone;
16678 let token = self.0.request.page_token.clone();
16679 let execute = move |token: String| {
16680 let mut builder = self.clone();
16681 builder.0.request = builder.0.request.set_page_token(token);
16682 builder.send()
16683 };
16684 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16685 }
16686
16687 pub fn by_item(
16689 self,
16690 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16691 crate::model::FetchDomainVerificationStatusResponse,
16692 crate::Error,
16693 > {
16694 use google_cloud_gax::paginator::Paginator;
16695 self.by_page().items()
16696 }
16697
16698 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
16702 self.0.request.site_search_engine = v.into();
16703 self
16704 }
16705
16706 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16708 self.0.request.page_size = v.into();
16709 self
16710 }
16711
16712 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16714 self.0.request.page_token = v.into();
16715 self
16716 }
16717 }
16718
16719 #[doc(hidden)]
16720 impl crate::RequestBuilder for FetchDomainVerificationStatus {
16721 fn request_options(&mut self) -> &mut crate::RequestOptions {
16722 &mut self.0.options
16723 }
16724 }
16725
16726 #[derive(Clone, Debug)]
16747 pub struct ListOperations(
16748 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16749 );
16750
16751 impl ListOperations {
16752 pub(crate) fn new(
16753 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16754 ) -> Self {
16755 Self(RequestBuilder::new(stub))
16756 }
16757
16758 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16760 mut self,
16761 v: V,
16762 ) -> Self {
16763 self.0.request = v.into();
16764 self
16765 }
16766
16767 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16769 self.0.options = v.into();
16770 self
16771 }
16772
16773 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16775 (*self.0.stub)
16776 .list_operations(self.0.request, self.0.options)
16777 .await
16778 .map(crate::Response::into_body)
16779 }
16780
16781 pub fn by_page(
16783 self,
16784 ) -> impl google_cloud_gax::paginator::Paginator<
16785 google_cloud_longrunning::model::ListOperationsResponse,
16786 crate::Error,
16787 > {
16788 use std::clone::Clone;
16789 let token = self.0.request.page_token.clone();
16790 let execute = move |token: String| {
16791 let mut builder = self.clone();
16792 builder.0.request = builder.0.request.set_page_token(token);
16793 builder.send()
16794 };
16795 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16796 }
16797
16798 pub fn by_item(
16800 self,
16801 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16802 google_cloud_longrunning::model::ListOperationsResponse,
16803 crate::Error,
16804 > {
16805 use google_cloud_gax::paginator::Paginator;
16806 self.by_page().items()
16807 }
16808
16809 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16811 self.0.request.name = v.into();
16812 self
16813 }
16814
16815 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16817 self.0.request.filter = v.into();
16818 self
16819 }
16820
16821 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16823 self.0.request.page_size = v.into();
16824 self
16825 }
16826
16827 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16829 self.0.request.page_token = v.into();
16830 self
16831 }
16832
16833 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16835 self.0.request.return_partial_success = v.into();
16836 self
16837 }
16838 }
16839
16840 #[doc(hidden)]
16841 impl crate::RequestBuilder for ListOperations {
16842 fn request_options(&mut self) -> &mut crate::RequestOptions {
16843 &mut self.0.options
16844 }
16845 }
16846
16847 #[derive(Clone, Debug)]
16864 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16865
16866 impl GetOperation {
16867 pub(crate) fn new(
16868 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16869 ) -> Self {
16870 Self(RequestBuilder::new(stub))
16871 }
16872
16873 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16875 mut self,
16876 v: V,
16877 ) -> Self {
16878 self.0.request = v.into();
16879 self
16880 }
16881
16882 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16884 self.0.options = v.into();
16885 self
16886 }
16887
16888 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16890 (*self.0.stub)
16891 .get_operation(self.0.request, self.0.options)
16892 .await
16893 .map(crate::Response::into_body)
16894 }
16895
16896 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16898 self.0.request.name = v.into();
16899 self
16900 }
16901 }
16902
16903 #[doc(hidden)]
16904 impl crate::RequestBuilder for GetOperation {
16905 fn request_options(&mut self) -> &mut crate::RequestOptions {
16906 &mut self.0.options
16907 }
16908 }
16909
16910 #[derive(Clone, Debug)]
16927 pub struct CancelOperation(
16928 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16929 );
16930
16931 impl CancelOperation {
16932 pub(crate) fn new(
16933 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16934 ) -> Self {
16935 Self(RequestBuilder::new(stub))
16936 }
16937
16938 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16940 mut self,
16941 v: V,
16942 ) -> Self {
16943 self.0.request = v.into();
16944 self
16945 }
16946
16947 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16949 self.0.options = v.into();
16950 self
16951 }
16952
16953 pub async fn send(self) -> Result<()> {
16955 (*self.0.stub)
16956 .cancel_operation(self.0.request, self.0.options)
16957 .await
16958 .map(crate::Response::into_body)
16959 }
16960
16961 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16963 self.0.request.name = v.into();
16964 self
16965 }
16966 }
16967
16968 #[doc(hidden)]
16969 impl crate::RequestBuilder for CancelOperation {
16970 fn request_options(&mut self) -> &mut crate::RequestOptions {
16971 &mut self.0.options
16972 }
16973 }
16974}
16975
16976#[cfg(feature = "user-event-service")]
16978#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
16979pub mod user_event_service {
16980 use crate::Result;
16981
16982 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16996
16997 pub(crate) mod client {
16998 use super::super::super::client::UserEventService;
16999 pub struct Factory;
17000 impl crate::ClientFactory for Factory {
17001 type Client = UserEventService;
17002 type Credentials = gaxi::options::Credentials;
17003 async fn build(
17004 self,
17005 config: gaxi::options::ClientConfig,
17006 ) -> crate::ClientBuilderResult<Self::Client> {
17007 Self::Client::new(config).await
17008 }
17009 }
17010 }
17011
17012 #[derive(Clone, Debug)]
17014 pub(crate) struct RequestBuilder<R: std::default::Default> {
17015 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17016 request: R,
17017 options: crate::RequestOptions,
17018 }
17019
17020 impl<R> RequestBuilder<R>
17021 where
17022 R: std::default::Default,
17023 {
17024 pub(crate) fn new(
17025 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17026 ) -> Self {
17027 Self {
17028 stub,
17029 request: R::default(),
17030 options: crate::RequestOptions::default(),
17031 }
17032 }
17033 }
17034
17035 #[derive(Clone, Debug)]
17052 pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
17053
17054 impl WriteUserEvent {
17055 pub(crate) fn new(
17056 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17057 ) -> Self {
17058 Self(RequestBuilder::new(stub))
17059 }
17060
17061 pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
17063 self.0.request = v.into();
17064 self
17065 }
17066
17067 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17069 self.0.options = v.into();
17070 self
17071 }
17072
17073 pub async fn send(self) -> Result<crate::model::UserEvent> {
17075 (*self.0.stub)
17076 .write_user_event(self.0.request, self.0.options)
17077 .await
17078 .map(crate::Response::into_body)
17079 }
17080
17081 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17085 self.0.request.parent = v.into();
17086 self
17087 }
17088
17089 pub fn set_user_event<T>(mut self, v: T) -> Self
17093 where
17094 T: std::convert::Into<crate::model::UserEvent>,
17095 {
17096 self.0.request.user_event = std::option::Option::Some(v.into());
17097 self
17098 }
17099
17100 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
17104 where
17105 T: std::convert::Into<crate::model::UserEvent>,
17106 {
17107 self.0.request.user_event = v.map(|x| x.into());
17108 self
17109 }
17110
17111 pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
17113 self.0.request.write_async = v.into();
17114 self
17115 }
17116 }
17117
17118 #[doc(hidden)]
17119 impl crate::RequestBuilder for WriteUserEvent {
17120 fn request_options(&mut self) -> &mut crate::RequestOptions {
17121 &mut self.0.options
17122 }
17123 }
17124
17125 #[derive(Clone, Debug)]
17142 pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
17143
17144 impl CollectUserEvent {
17145 pub(crate) fn new(
17146 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17147 ) -> Self {
17148 Self(RequestBuilder::new(stub))
17149 }
17150
17151 pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
17153 mut self,
17154 v: V,
17155 ) -> Self {
17156 self.0.request = v.into();
17157 self
17158 }
17159
17160 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17162 self.0.options = v.into();
17163 self
17164 }
17165
17166 pub async fn send(self) -> Result<google_cloud_api::model::HttpBody> {
17168 (*self.0.stub)
17169 .collect_user_event(self.0.request, self.0.options)
17170 .await
17171 .map(crate::Response::into_body)
17172 }
17173
17174 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17178 self.0.request.parent = v.into();
17179 self
17180 }
17181
17182 pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
17186 self.0.request.user_event = v.into();
17187 self
17188 }
17189
17190 pub fn set_uri<T>(mut self, v: T) -> Self
17192 where
17193 T: std::convert::Into<std::string::String>,
17194 {
17195 self.0.request.uri = std::option::Option::Some(v.into());
17196 self
17197 }
17198
17199 pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
17201 where
17202 T: std::convert::Into<std::string::String>,
17203 {
17204 self.0.request.uri = v.map(|x| x.into());
17205 self
17206 }
17207
17208 pub fn set_ets<T>(mut self, v: T) -> Self
17210 where
17211 T: std::convert::Into<i64>,
17212 {
17213 self.0.request.ets = std::option::Option::Some(v.into());
17214 self
17215 }
17216
17217 pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
17219 where
17220 T: std::convert::Into<i64>,
17221 {
17222 self.0.request.ets = v.map(|x| x.into());
17223 self
17224 }
17225 }
17226
17227 #[doc(hidden)]
17228 impl crate::RequestBuilder for CollectUserEvent {
17229 fn request_options(&mut self) -> &mut crate::RequestOptions {
17230 &mut self.0.options
17231 }
17232 }
17233
17234 #[derive(Clone, Debug)]
17252 pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
17253
17254 impl PurgeUserEvents {
17255 pub(crate) fn new(
17256 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17257 ) -> Self {
17258 Self(RequestBuilder::new(stub))
17259 }
17260
17261 pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
17263 self.0.request = v.into();
17264 self
17265 }
17266
17267 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17269 self.0.options = v.into();
17270 self
17271 }
17272
17273 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17280 (*self.0.stub)
17281 .purge_user_events(self.0.request, self.0.options)
17282 .await
17283 .map(crate::Response::into_body)
17284 }
17285
17286 pub fn poller(
17288 self,
17289 ) -> impl google_cloud_lro::Poller<
17290 crate::model::PurgeUserEventsResponse,
17291 crate::model::PurgeUserEventsMetadata,
17292 > {
17293 type Operation = google_cloud_lro::internal::Operation<
17294 crate::model::PurgeUserEventsResponse,
17295 crate::model::PurgeUserEventsMetadata,
17296 >;
17297 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
17298 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
17299 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
17300 if let Some(ref mut details) = poller_options.tracing {
17301 details.method_name = "google_cloud_discoveryengine_v1::client::UserEventService::purge_user_events::until_done";
17302 }
17303
17304 let stub = self.0.stub.clone();
17305 let mut options = self.0.options.clone();
17306 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
17307 let query = move |name| {
17308 let stub = stub.clone();
17309 let options = options.clone();
17310 async {
17311 let op = GetOperation::new(stub)
17312 .set_name(name)
17313 .with_options(options)
17314 .send()
17315 .await?;
17316 Ok(Operation::new(op))
17317 }
17318 };
17319
17320 let start = move || async {
17321 let op = self.send().await?;
17322 Ok(Operation::new(op))
17323 };
17324
17325 use google_cloud_lro::internal::PollerExt;
17326 {
17327 google_cloud_lro::internal::new_poller(
17328 polling_error_policy,
17329 polling_backoff_policy,
17330 start,
17331 query,
17332 )
17333 }
17334 .with_options(poller_options)
17335 }
17336
17337 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17341 self.0.request.parent = v.into();
17342 self
17343 }
17344
17345 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17349 self.0.request.filter = v.into();
17350 self
17351 }
17352
17353 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
17355 self.0.request.force = v.into();
17356 self
17357 }
17358 }
17359
17360 #[doc(hidden)]
17361 impl crate::RequestBuilder for PurgeUserEvents {
17362 fn request_options(&mut self) -> &mut crate::RequestOptions {
17363 &mut self.0.options
17364 }
17365 }
17366
17367 #[derive(Clone, Debug)]
17385 pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
17386
17387 impl ImportUserEvents {
17388 pub(crate) fn new(
17389 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17390 ) -> Self {
17391 Self(RequestBuilder::new(stub))
17392 }
17393
17394 pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
17396 mut self,
17397 v: V,
17398 ) -> Self {
17399 self.0.request = v.into();
17400 self
17401 }
17402
17403 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17405 self.0.options = v.into();
17406 self
17407 }
17408
17409 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17416 (*self.0.stub)
17417 .import_user_events(self.0.request, self.0.options)
17418 .await
17419 .map(crate::Response::into_body)
17420 }
17421
17422 pub fn poller(
17424 self,
17425 ) -> impl google_cloud_lro::Poller<
17426 crate::model::ImportUserEventsResponse,
17427 crate::model::ImportUserEventsMetadata,
17428 > {
17429 type Operation = google_cloud_lro::internal::Operation<
17430 crate::model::ImportUserEventsResponse,
17431 crate::model::ImportUserEventsMetadata,
17432 >;
17433 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
17434 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
17435 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
17436 if let Some(ref mut details) = poller_options.tracing {
17437 details.method_name = "google_cloud_discoveryengine_v1::client::UserEventService::import_user_events::until_done";
17438 }
17439
17440 let stub = self.0.stub.clone();
17441 let mut options = self.0.options.clone();
17442 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
17443 let query = move |name| {
17444 let stub = stub.clone();
17445 let options = options.clone();
17446 async {
17447 let op = GetOperation::new(stub)
17448 .set_name(name)
17449 .with_options(options)
17450 .send()
17451 .await?;
17452 Ok(Operation::new(op))
17453 }
17454 };
17455
17456 let start = move || async {
17457 let op = self.send().await?;
17458 Ok(Operation::new(op))
17459 };
17460
17461 use google_cloud_lro::internal::PollerExt;
17462 {
17463 google_cloud_lro::internal::new_poller(
17464 polling_error_policy,
17465 polling_backoff_policy,
17466 start,
17467 query,
17468 )
17469 }
17470 .with_options(poller_options)
17471 }
17472
17473 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17477 self.0.request.parent = v.into();
17478 self
17479 }
17480
17481 pub fn set_error_config<T>(mut self, v: T) -> Self
17483 where
17484 T: std::convert::Into<crate::model::ImportErrorConfig>,
17485 {
17486 self.0.request.error_config = std::option::Option::Some(v.into());
17487 self
17488 }
17489
17490 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
17492 where
17493 T: std::convert::Into<crate::model::ImportErrorConfig>,
17494 {
17495 self.0.request.error_config = v.map(|x| x.into());
17496 self
17497 }
17498
17499 pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
17504 mut self,
17505 v: T,
17506 ) -> Self {
17507 self.0.request.source = v.into();
17508 self
17509 }
17510
17511 pub fn set_inline_source<
17517 T: std::convert::Into<
17518 std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
17519 >,
17520 >(
17521 mut self,
17522 v: T,
17523 ) -> Self {
17524 self.0.request = self.0.request.set_inline_source(v);
17525 self
17526 }
17527
17528 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
17534 mut self,
17535 v: T,
17536 ) -> Self {
17537 self.0.request = self.0.request.set_gcs_source(v);
17538 self
17539 }
17540
17541 pub fn set_bigquery_source<
17547 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
17548 >(
17549 mut self,
17550 v: T,
17551 ) -> Self {
17552 self.0.request = self.0.request.set_bigquery_source(v);
17553 self
17554 }
17555 }
17556
17557 #[doc(hidden)]
17558 impl crate::RequestBuilder for ImportUserEvents {
17559 fn request_options(&mut self) -> &mut crate::RequestOptions {
17560 &mut self.0.options
17561 }
17562 }
17563
17564 #[derive(Clone, Debug)]
17585 pub struct ListOperations(
17586 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17587 );
17588
17589 impl ListOperations {
17590 pub(crate) fn new(
17591 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17592 ) -> Self {
17593 Self(RequestBuilder::new(stub))
17594 }
17595
17596 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17598 mut self,
17599 v: V,
17600 ) -> Self {
17601 self.0.request = v.into();
17602 self
17603 }
17604
17605 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17607 self.0.options = v.into();
17608 self
17609 }
17610
17611 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17613 (*self.0.stub)
17614 .list_operations(self.0.request, self.0.options)
17615 .await
17616 .map(crate::Response::into_body)
17617 }
17618
17619 pub fn by_page(
17621 self,
17622 ) -> impl google_cloud_gax::paginator::Paginator<
17623 google_cloud_longrunning::model::ListOperationsResponse,
17624 crate::Error,
17625 > {
17626 use std::clone::Clone;
17627 let token = self.0.request.page_token.clone();
17628 let execute = move |token: String| {
17629 let mut builder = self.clone();
17630 builder.0.request = builder.0.request.set_page_token(token);
17631 builder.send()
17632 };
17633 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17634 }
17635
17636 pub fn by_item(
17638 self,
17639 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17640 google_cloud_longrunning::model::ListOperationsResponse,
17641 crate::Error,
17642 > {
17643 use google_cloud_gax::paginator::Paginator;
17644 self.by_page().items()
17645 }
17646
17647 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17649 self.0.request.name = v.into();
17650 self
17651 }
17652
17653 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17655 self.0.request.filter = v.into();
17656 self
17657 }
17658
17659 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17661 self.0.request.page_size = v.into();
17662 self
17663 }
17664
17665 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17667 self.0.request.page_token = v.into();
17668 self
17669 }
17670
17671 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17673 self.0.request.return_partial_success = v.into();
17674 self
17675 }
17676 }
17677
17678 #[doc(hidden)]
17679 impl crate::RequestBuilder for ListOperations {
17680 fn request_options(&mut self) -> &mut crate::RequestOptions {
17681 &mut self.0.options
17682 }
17683 }
17684
17685 #[derive(Clone, Debug)]
17702 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17703
17704 impl GetOperation {
17705 pub(crate) fn new(
17706 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17707 ) -> Self {
17708 Self(RequestBuilder::new(stub))
17709 }
17710
17711 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17713 mut self,
17714 v: V,
17715 ) -> Self {
17716 self.0.request = v.into();
17717 self
17718 }
17719
17720 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17722 self.0.options = v.into();
17723 self
17724 }
17725
17726 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17728 (*self.0.stub)
17729 .get_operation(self.0.request, self.0.options)
17730 .await
17731 .map(crate::Response::into_body)
17732 }
17733
17734 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17736 self.0.request.name = v.into();
17737 self
17738 }
17739 }
17740
17741 #[doc(hidden)]
17742 impl crate::RequestBuilder for GetOperation {
17743 fn request_options(&mut self) -> &mut crate::RequestOptions {
17744 &mut self.0.options
17745 }
17746 }
17747
17748 #[derive(Clone, Debug)]
17765 pub struct CancelOperation(
17766 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17767 );
17768
17769 impl CancelOperation {
17770 pub(crate) fn new(
17771 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
17772 ) -> Self {
17773 Self(RequestBuilder::new(stub))
17774 }
17775
17776 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17778 mut self,
17779 v: V,
17780 ) -> Self {
17781 self.0.request = v.into();
17782 self
17783 }
17784
17785 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17787 self.0.options = v.into();
17788 self
17789 }
17790
17791 pub async fn send(self) -> Result<()> {
17793 (*self.0.stub)
17794 .cancel_operation(self.0.request, self.0.options)
17795 .await
17796 .map(crate::Response::into_body)
17797 }
17798
17799 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17801 self.0.request.name = v.into();
17802 self
17803 }
17804 }
17805
17806 #[doc(hidden)]
17807 impl crate::RequestBuilder for CancelOperation {
17808 fn request_options(&mut self) -> &mut crate::RequestOptions {
17809 &mut self.0.options
17810 }
17811 }
17812}
17813
17814#[cfg(feature = "user-license-service")]
17816#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
17817pub mod user_license_service {
17818 use crate::Result;
17819
17820 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
17834
17835 pub(crate) mod client {
17836 use super::super::super::client::UserLicenseService;
17837 pub struct Factory;
17838 impl crate::ClientFactory for Factory {
17839 type Client = UserLicenseService;
17840 type Credentials = gaxi::options::Credentials;
17841 async fn build(
17842 self,
17843 config: gaxi::options::ClientConfig,
17844 ) -> crate::ClientBuilderResult<Self::Client> {
17845 Self::Client::new(config).await
17846 }
17847 }
17848 }
17849
17850 #[derive(Clone, Debug)]
17852 pub(crate) struct RequestBuilder<R: std::default::Default> {
17853 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17854 request: R,
17855 options: crate::RequestOptions,
17856 }
17857
17858 impl<R> RequestBuilder<R>
17859 where
17860 R: std::default::Default,
17861 {
17862 pub(crate) fn new(
17863 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17864 ) -> Self {
17865 Self {
17866 stub,
17867 request: R::default(),
17868 options: crate::RequestOptions::default(),
17869 }
17870 }
17871 }
17872
17873 #[derive(Clone, Debug)]
17894 pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
17895
17896 impl ListUserLicenses {
17897 pub(crate) fn new(
17898 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17899 ) -> Self {
17900 Self(RequestBuilder::new(stub))
17901 }
17902
17903 pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
17905 mut self,
17906 v: V,
17907 ) -> Self {
17908 self.0.request = v.into();
17909 self
17910 }
17911
17912 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17914 self.0.options = v.into();
17915 self
17916 }
17917
17918 pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
17920 (*self.0.stub)
17921 .list_user_licenses(self.0.request, self.0.options)
17922 .await
17923 .map(crate::Response::into_body)
17924 }
17925
17926 pub fn by_page(
17928 self,
17929 ) -> impl google_cloud_gax::paginator::Paginator<
17930 crate::model::ListUserLicensesResponse,
17931 crate::Error,
17932 > {
17933 use std::clone::Clone;
17934 let token = self.0.request.page_token.clone();
17935 let execute = move |token: String| {
17936 let mut builder = self.clone();
17937 builder.0.request = builder.0.request.set_page_token(token);
17938 builder.send()
17939 };
17940 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17941 }
17942
17943 pub fn by_item(
17945 self,
17946 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17947 crate::model::ListUserLicensesResponse,
17948 crate::Error,
17949 > {
17950 use google_cloud_gax::paginator::Paginator;
17951 self.by_page().items()
17952 }
17953
17954 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17958 self.0.request.parent = v.into();
17959 self
17960 }
17961
17962 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17964 self.0.request.page_size = v.into();
17965 self
17966 }
17967
17968 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17970 self.0.request.page_token = v.into();
17971 self
17972 }
17973
17974 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17976 self.0.request.filter = v.into();
17977 self
17978 }
17979 }
17980
17981 #[doc(hidden)]
17982 impl crate::RequestBuilder for ListUserLicenses {
17983 fn request_options(&mut self) -> &mut crate::RequestOptions {
17984 &mut self.0.options
17985 }
17986 }
17987
17988 #[derive(Clone, Debug)]
18006 pub struct BatchUpdateUserLicenses(
18007 RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
18008 );
18009
18010 impl BatchUpdateUserLicenses {
18011 pub(crate) fn new(
18012 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
18013 ) -> Self {
18014 Self(RequestBuilder::new(stub))
18015 }
18016
18017 pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
18019 mut self,
18020 v: V,
18021 ) -> Self {
18022 self.0.request = v.into();
18023 self
18024 }
18025
18026 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18028 self.0.options = v.into();
18029 self
18030 }
18031
18032 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
18039 (*self.0.stub)
18040 .batch_update_user_licenses(self.0.request, self.0.options)
18041 .await
18042 .map(crate::Response::into_body)
18043 }
18044
18045 pub fn poller(
18047 self,
18048 ) -> impl google_cloud_lro::Poller<
18049 crate::model::BatchUpdateUserLicensesResponse,
18050 crate::model::BatchUpdateUserLicensesMetadata,
18051 > {
18052 type Operation = google_cloud_lro::internal::Operation<
18053 crate::model::BatchUpdateUserLicensesResponse,
18054 crate::model::BatchUpdateUserLicensesMetadata,
18055 >;
18056 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
18057 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
18058 let mut poller_options = self.0.stub.get_poller_options(&self.0.options);
18059 if let Some(ref mut details) = poller_options.tracing {
18060 details.method_name = "google_cloud_discoveryengine_v1::client::UserLicenseService::batch_update_user_licenses::until_done";
18061 }
18062
18063 let stub = self.0.stub.clone();
18064 let mut options = self.0.options.clone();
18065 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
18066 let query = move |name| {
18067 let stub = stub.clone();
18068 let options = options.clone();
18069 async {
18070 let op = GetOperation::new(stub)
18071 .set_name(name)
18072 .with_options(options)
18073 .send()
18074 .await?;
18075 Ok(Operation::new(op))
18076 }
18077 };
18078
18079 let start = move || async {
18080 let op = self.send().await?;
18081 Ok(Operation::new(op))
18082 };
18083
18084 use google_cloud_lro::internal::PollerExt;
18085 {
18086 google_cloud_lro::internal::new_poller(
18087 polling_error_policy,
18088 polling_backoff_policy,
18089 start,
18090 query,
18091 )
18092 }
18093 .with_options(poller_options)
18094 }
18095
18096 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18100 self.0.request.parent = v.into();
18101 self
18102 }
18103
18104 pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
18106 self.0.request.delete_unassigned_user_licenses = v.into();
18107 self
18108 }
18109
18110 pub fn set_source<
18115 T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
18116 >(
18117 mut self,
18118 v: T,
18119 ) -> Self {
18120 self.0.request.source = v.into();
18121 self
18122 }
18123
18124 pub fn set_inline_source<
18130 T: std::convert::Into<
18131 std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
18132 >,
18133 >(
18134 mut self,
18135 v: T,
18136 ) -> Self {
18137 self.0.request = self.0.request.set_inline_source(v);
18138 self
18139 }
18140 }
18141
18142 #[doc(hidden)]
18143 impl crate::RequestBuilder for BatchUpdateUserLicenses {
18144 fn request_options(&mut self) -> &mut crate::RequestOptions {
18145 &mut self.0.options
18146 }
18147 }
18148
18149 #[derive(Clone, Debug)]
18170 pub struct ListOperations(
18171 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
18172 );
18173
18174 impl ListOperations {
18175 pub(crate) fn new(
18176 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
18177 ) -> Self {
18178 Self(RequestBuilder::new(stub))
18179 }
18180
18181 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
18183 mut self,
18184 v: V,
18185 ) -> Self {
18186 self.0.request = v.into();
18187 self
18188 }
18189
18190 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18192 self.0.options = v.into();
18193 self
18194 }
18195
18196 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
18198 (*self.0.stub)
18199 .list_operations(self.0.request, self.0.options)
18200 .await
18201 .map(crate::Response::into_body)
18202 }
18203
18204 pub fn by_page(
18206 self,
18207 ) -> impl google_cloud_gax::paginator::Paginator<
18208 google_cloud_longrunning::model::ListOperationsResponse,
18209 crate::Error,
18210 > {
18211 use std::clone::Clone;
18212 let token = self.0.request.page_token.clone();
18213 let execute = move |token: String| {
18214 let mut builder = self.clone();
18215 builder.0.request = builder.0.request.set_page_token(token);
18216 builder.send()
18217 };
18218 google_cloud_gax::paginator::internal::new_paginator(token, execute)
18219 }
18220
18221 pub fn by_item(
18223 self,
18224 ) -> impl google_cloud_gax::paginator::ItemPaginator<
18225 google_cloud_longrunning::model::ListOperationsResponse,
18226 crate::Error,
18227 > {
18228 use google_cloud_gax::paginator::Paginator;
18229 self.by_page().items()
18230 }
18231
18232 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18234 self.0.request.name = v.into();
18235 self
18236 }
18237
18238 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
18240 self.0.request.filter = v.into();
18241 self
18242 }
18243
18244 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
18246 self.0.request.page_size = v.into();
18247 self
18248 }
18249
18250 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
18252 self.0.request.page_token = v.into();
18253 self
18254 }
18255
18256 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
18258 self.0.request.return_partial_success = v.into();
18259 self
18260 }
18261 }
18262
18263 #[doc(hidden)]
18264 impl crate::RequestBuilder for ListOperations {
18265 fn request_options(&mut self) -> &mut crate::RequestOptions {
18266 &mut self.0.options
18267 }
18268 }
18269
18270 #[derive(Clone, Debug)]
18287 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
18288
18289 impl GetOperation {
18290 pub(crate) fn new(
18291 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
18292 ) -> Self {
18293 Self(RequestBuilder::new(stub))
18294 }
18295
18296 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
18298 mut self,
18299 v: V,
18300 ) -> Self {
18301 self.0.request = v.into();
18302 self
18303 }
18304
18305 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18307 self.0.options = v.into();
18308 self
18309 }
18310
18311 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
18313 (*self.0.stub)
18314 .get_operation(self.0.request, self.0.options)
18315 .await
18316 .map(crate::Response::into_body)
18317 }
18318
18319 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18321 self.0.request.name = v.into();
18322 self
18323 }
18324 }
18325
18326 #[doc(hidden)]
18327 impl crate::RequestBuilder for GetOperation {
18328 fn request_options(&mut self) -> &mut crate::RequestOptions {
18329 &mut self.0.options
18330 }
18331 }
18332
18333 #[derive(Clone, Debug)]
18350 pub struct CancelOperation(
18351 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
18352 );
18353
18354 impl CancelOperation {
18355 pub(crate) fn new(
18356 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
18357 ) -> Self {
18358 Self(RequestBuilder::new(stub))
18359 }
18360
18361 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
18363 mut self,
18364 v: V,
18365 ) -> Self {
18366 self.0.request = v.into();
18367 self
18368 }
18369
18370 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18372 self.0.options = v.into();
18373 self
18374 }
18375
18376 pub async fn send(self) -> Result<()> {
18378 (*self.0.stub)
18379 .cancel_operation(self.0.request, self.0.options)
18380 .await
18381 .map(crate::Response::into_body)
18382 }
18383
18384 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18386 self.0.request.name = v.into();
18387 self
18388 }
18389 }
18390
18391 #[doc(hidden)]
18392 impl crate::RequestBuilder for CancelOperation {
18393 fn request_options(&mut self) -> &mut crate::RequestOptions {
18394 &mut self.0.options
18395 }
18396 }
18397}