1#[cfg(feature = "assistant-service")]
18#[cfg_attr(docsrs, doc(cfg(feature = "assistant-service")))]
19pub mod assistant_service {
20 use crate::Result;
21
22 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
36
37 pub(crate) mod client {
38 use super::super::super::client::AssistantService;
39 pub struct Factory;
40 impl crate::ClientFactory for Factory {
41 type Client = AssistantService;
42 type Credentials = gaxi::options::Credentials;
43 async fn build(
44 self,
45 config: gaxi::options::ClientConfig,
46 ) -> crate::ClientBuilderResult<Self::Client> {
47 Self::Client::new(config).await
48 }
49 }
50 }
51
52 #[derive(Clone, Debug)]
54 pub(crate) struct RequestBuilder<R: std::default::Default> {
55 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
56 request: R,
57 options: crate::RequestOptions,
58 }
59
60 impl<R> RequestBuilder<R>
61 where
62 R: std::default::Default,
63 {
64 pub(crate) fn new(
65 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
66 ) -> Self {
67 Self {
68 stub,
69 request: R::default(),
70 options: crate::RequestOptions::default(),
71 }
72 }
73 }
74
75 #[derive(Clone, Debug)]
96 pub struct ListOperations(
97 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
98 );
99
100 impl ListOperations {
101 pub(crate) fn new(
102 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
103 ) -> Self {
104 Self(RequestBuilder::new(stub))
105 }
106
107 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
109 mut self,
110 v: V,
111 ) -> Self {
112 self.0.request = v.into();
113 self
114 }
115
116 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
118 self.0.options = v.into();
119 self
120 }
121
122 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
124 (*self.0.stub)
125 .list_operations(self.0.request, self.0.options)
126 .await
127 .map(crate::Response::into_body)
128 }
129
130 pub fn by_page(
132 self,
133 ) -> impl google_cloud_gax::paginator::Paginator<
134 google_cloud_longrunning::model::ListOperationsResponse,
135 crate::Error,
136 > {
137 use std::clone::Clone;
138 let token = self.0.request.page_token.clone();
139 let execute = move |token: String| {
140 let mut builder = self.clone();
141 builder.0.request = builder.0.request.set_page_token(token);
142 builder.send()
143 };
144 google_cloud_gax::paginator::internal::new_paginator(token, execute)
145 }
146
147 pub fn by_item(
149 self,
150 ) -> impl google_cloud_gax::paginator::ItemPaginator<
151 google_cloud_longrunning::model::ListOperationsResponse,
152 crate::Error,
153 > {
154 use google_cloud_gax::paginator::Paginator;
155 self.by_page().items()
156 }
157
158 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
160 self.0.request.name = v.into();
161 self
162 }
163
164 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
166 self.0.request.filter = v.into();
167 self
168 }
169
170 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
172 self.0.request.page_size = v.into();
173 self
174 }
175
176 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
178 self.0.request.page_token = v.into();
179 self
180 }
181
182 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
184 self.0.request.return_partial_success = v.into();
185 self
186 }
187 }
188
189 #[doc(hidden)]
190 impl crate::RequestBuilder for ListOperations {
191 fn request_options(&mut self) -> &mut crate::RequestOptions {
192 &mut self.0.options
193 }
194 }
195
196 #[derive(Clone, Debug)]
213 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
214
215 impl GetOperation {
216 pub(crate) fn new(
217 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
218 ) -> Self {
219 Self(RequestBuilder::new(stub))
220 }
221
222 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
224 mut self,
225 v: V,
226 ) -> Self {
227 self.0.request = v.into();
228 self
229 }
230
231 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
233 self.0.options = v.into();
234 self
235 }
236
237 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
239 (*self.0.stub)
240 .get_operation(self.0.request, self.0.options)
241 .await
242 .map(crate::Response::into_body)
243 }
244
245 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
247 self.0.request.name = v.into();
248 self
249 }
250 }
251
252 #[doc(hidden)]
253 impl crate::RequestBuilder for GetOperation {
254 fn request_options(&mut self) -> &mut crate::RequestOptions {
255 &mut self.0.options
256 }
257 }
258
259 #[derive(Clone, Debug)]
276 pub struct CancelOperation(
277 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
278 );
279
280 impl CancelOperation {
281 pub(crate) fn new(
282 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
283 ) -> Self {
284 Self(RequestBuilder::new(stub))
285 }
286
287 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
289 mut self,
290 v: V,
291 ) -> Self {
292 self.0.request = v.into();
293 self
294 }
295
296 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
298 self.0.options = v.into();
299 self
300 }
301
302 pub async fn send(self) -> Result<()> {
304 (*self.0.stub)
305 .cancel_operation(self.0.request, self.0.options)
306 .await
307 .map(crate::Response::into_body)
308 }
309
310 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
312 self.0.request.name = v.into();
313 self
314 }
315 }
316
317 #[doc(hidden)]
318 impl crate::RequestBuilder for CancelOperation {
319 fn request_options(&mut self) -> &mut crate::RequestOptions {
320 &mut self.0.options
321 }
322 }
323}
324
325#[cfg(feature = "cmek-config-service")]
326#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
327pub mod cmek_config_service {
328 use crate::Result;
329
330 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
344
345 pub(crate) mod client {
346 use super::super::super::client::CmekConfigService;
347 pub struct Factory;
348 impl crate::ClientFactory for Factory {
349 type Client = CmekConfigService;
350 type Credentials = gaxi::options::Credentials;
351 async fn build(
352 self,
353 config: gaxi::options::ClientConfig,
354 ) -> crate::ClientBuilderResult<Self::Client> {
355 Self::Client::new(config).await
356 }
357 }
358 }
359
360 #[derive(Clone, Debug)]
362 pub(crate) struct RequestBuilder<R: std::default::Default> {
363 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
364 request: R,
365 options: crate::RequestOptions,
366 }
367
368 impl<R> RequestBuilder<R>
369 where
370 R: std::default::Default,
371 {
372 pub(crate) fn new(
373 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
374 ) -> Self {
375 Self {
376 stub,
377 request: R::default(),
378 options: crate::RequestOptions::default(),
379 }
380 }
381 }
382
383 #[derive(Clone, Debug)]
401 pub struct UpdateCmekConfig(RequestBuilder<crate::model::UpdateCmekConfigRequest>);
402
403 impl UpdateCmekConfig {
404 pub(crate) fn new(
405 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
406 ) -> Self {
407 Self(RequestBuilder::new(stub))
408 }
409
410 pub fn with_request<V: Into<crate::model::UpdateCmekConfigRequest>>(
412 mut self,
413 v: V,
414 ) -> Self {
415 self.0.request = v.into();
416 self
417 }
418
419 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
421 self.0.options = v.into();
422 self
423 }
424
425 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
432 (*self.0.stub)
433 .update_cmek_config(self.0.request, self.0.options)
434 .await
435 .map(crate::Response::into_body)
436 }
437
438 pub fn poller(
440 self,
441 ) -> impl google_cloud_lro::Poller<
442 crate::model::CmekConfig,
443 crate::model::UpdateCmekConfigMetadata,
444 > {
445 type Operation = google_cloud_lro::internal::Operation<
446 crate::model::CmekConfig,
447 crate::model::UpdateCmekConfigMetadata,
448 >;
449 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
450 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
451
452 let stub = self.0.stub.clone();
453 let mut options = self.0.options.clone();
454 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
455 let query = move |name| {
456 let stub = stub.clone();
457 let options = options.clone();
458 async {
459 let op = GetOperation::new(stub)
460 .set_name(name)
461 .with_options(options)
462 .send()
463 .await?;
464 Ok(Operation::new(op))
465 }
466 };
467
468 let start = move || async {
469 let op = self.send().await?;
470 Ok(Operation::new(op))
471 };
472
473 google_cloud_lro::internal::new_poller(
474 polling_error_policy,
475 polling_backoff_policy,
476 start,
477 query,
478 )
479 }
480
481 pub fn set_config<T>(mut self, v: T) -> Self
485 where
486 T: std::convert::Into<crate::model::CmekConfig>,
487 {
488 self.0.request.config = std::option::Option::Some(v.into());
489 self
490 }
491
492 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
496 where
497 T: std::convert::Into<crate::model::CmekConfig>,
498 {
499 self.0.request.config = v.map(|x| x.into());
500 self
501 }
502
503 pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
505 self.0.request.set_default = v.into();
506 self
507 }
508 }
509
510 #[doc(hidden)]
511 impl crate::RequestBuilder for UpdateCmekConfig {
512 fn request_options(&mut self) -> &mut crate::RequestOptions {
513 &mut self.0.options
514 }
515 }
516
517 #[derive(Clone, Debug)]
534 pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
535
536 impl GetCmekConfig {
537 pub(crate) fn new(
538 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
539 ) -> Self {
540 Self(RequestBuilder::new(stub))
541 }
542
543 pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
545 self.0.request = v.into();
546 self
547 }
548
549 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
551 self.0.options = v.into();
552 self
553 }
554
555 pub async fn send(self) -> Result<crate::model::CmekConfig> {
557 (*self.0.stub)
558 .get_cmek_config(self.0.request, self.0.options)
559 .await
560 .map(crate::Response::into_body)
561 }
562
563 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
567 self.0.request.name = v.into();
568 self
569 }
570 }
571
572 #[doc(hidden)]
573 impl crate::RequestBuilder for GetCmekConfig {
574 fn request_options(&mut self) -> &mut crate::RequestOptions {
575 &mut self.0.options
576 }
577 }
578
579 #[derive(Clone, Debug)]
596 pub struct ListCmekConfigs(RequestBuilder<crate::model::ListCmekConfigsRequest>);
597
598 impl ListCmekConfigs {
599 pub(crate) fn new(
600 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
601 ) -> Self {
602 Self(RequestBuilder::new(stub))
603 }
604
605 pub fn with_request<V: Into<crate::model::ListCmekConfigsRequest>>(mut self, v: V) -> Self {
607 self.0.request = v.into();
608 self
609 }
610
611 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
613 self.0.options = v.into();
614 self
615 }
616
617 pub async fn send(self) -> Result<crate::model::ListCmekConfigsResponse> {
619 (*self.0.stub)
620 .list_cmek_configs(self.0.request, self.0.options)
621 .await
622 .map(crate::Response::into_body)
623 }
624
625 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
629 self.0.request.parent = v.into();
630 self
631 }
632 }
633
634 #[doc(hidden)]
635 impl crate::RequestBuilder for ListCmekConfigs {
636 fn request_options(&mut self) -> &mut crate::RequestOptions {
637 &mut self.0.options
638 }
639 }
640
641 #[derive(Clone, Debug)]
659 pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
660
661 impl DeleteCmekConfig {
662 pub(crate) fn new(
663 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
664 ) -> Self {
665 Self(RequestBuilder::new(stub))
666 }
667
668 pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
670 mut self,
671 v: V,
672 ) -> Self {
673 self.0.request = v.into();
674 self
675 }
676
677 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
679 self.0.options = v.into();
680 self
681 }
682
683 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
690 (*self.0.stub)
691 .delete_cmek_config(self.0.request, self.0.options)
692 .await
693 .map(crate::Response::into_body)
694 }
695
696 pub fn poller(
698 self,
699 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
700 type Operation = google_cloud_lro::internal::Operation<
701 wkt::Empty,
702 crate::model::DeleteCmekConfigMetadata,
703 >;
704 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
705 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
706
707 let stub = self.0.stub.clone();
708 let mut options = self.0.options.clone();
709 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
710 let query = move |name| {
711 let stub = stub.clone();
712 let options = options.clone();
713 async {
714 let op = GetOperation::new(stub)
715 .set_name(name)
716 .with_options(options)
717 .send()
718 .await?;
719 Ok(Operation::new(op))
720 }
721 };
722
723 let start = move || async {
724 let op = self.send().await?;
725 Ok(Operation::new(op))
726 };
727
728 google_cloud_lro::internal::new_unit_response_poller(
729 polling_error_policy,
730 polling_backoff_policy,
731 start,
732 query,
733 )
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 DeleteCmekConfig {
747 fn request_options(&mut self) -> &mut crate::RequestOptions {
748 &mut self.0.options
749 }
750 }
751
752 #[derive(Clone, Debug)]
773 pub struct ListOperations(
774 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
775 );
776
777 impl ListOperations {
778 pub(crate) fn new(
779 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
780 ) -> Self {
781 Self(RequestBuilder::new(stub))
782 }
783
784 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
786 mut self,
787 v: V,
788 ) -> Self {
789 self.0.request = v.into();
790 self
791 }
792
793 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
795 self.0.options = v.into();
796 self
797 }
798
799 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
801 (*self.0.stub)
802 .list_operations(self.0.request, self.0.options)
803 .await
804 .map(crate::Response::into_body)
805 }
806
807 pub fn by_page(
809 self,
810 ) -> impl google_cloud_gax::paginator::Paginator<
811 google_cloud_longrunning::model::ListOperationsResponse,
812 crate::Error,
813 > {
814 use std::clone::Clone;
815 let token = self.0.request.page_token.clone();
816 let execute = move |token: String| {
817 let mut builder = self.clone();
818 builder.0.request = builder.0.request.set_page_token(token);
819 builder.send()
820 };
821 google_cloud_gax::paginator::internal::new_paginator(token, execute)
822 }
823
824 pub fn by_item(
826 self,
827 ) -> impl google_cloud_gax::paginator::ItemPaginator<
828 google_cloud_longrunning::model::ListOperationsResponse,
829 crate::Error,
830 > {
831 use google_cloud_gax::paginator::Paginator;
832 self.by_page().items()
833 }
834
835 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
837 self.0.request.name = v.into();
838 self
839 }
840
841 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
843 self.0.request.filter = v.into();
844 self
845 }
846
847 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
849 self.0.request.page_size = v.into();
850 self
851 }
852
853 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
855 self.0.request.page_token = v.into();
856 self
857 }
858
859 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
861 self.0.request.return_partial_success = v.into();
862 self
863 }
864 }
865
866 #[doc(hidden)]
867 impl crate::RequestBuilder for ListOperations {
868 fn request_options(&mut self) -> &mut crate::RequestOptions {
869 &mut self.0.options
870 }
871 }
872
873 #[derive(Clone, Debug)]
890 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
891
892 impl GetOperation {
893 pub(crate) fn new(
894 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
895 ) -> Self {
896 Self(RequestBuilder::new(stub))
897 }
898
899 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
901 mut self,
902 v: V,
903 ) -> Self {
904 self.0.request = v.into();
905 self
906 }
907
908 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
910 self.0.options = v.into();
911 self
912 }
913
914 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
916 (*self.0.stub)
917 .get_operation(self.0.request, self.0.options)
918 .await
919 .map(crate::Response::into_body)
920 }
921
922 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
924 self.0.request.name = v.into();
925 self
926 }
927 }
928
929 #[doc(hidden)]
930 impl crate::RequestBuilder for GetOperation {
931 fn request_options(&mut self) -> &mut crate::RequestOptions {
932 &mut self.0.options
933 }
934 }
935
936 #[derive(Clone, Debug)]
953 pub struct CancelOperation(
954 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
955 );
956
957 impl CancelOperation {
958 pub(crate) fn new(
959 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
960 ) -> Self {
961 Self(RequestBuilder::new(stub))
962 }
963
964 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
966 mut self,
967 v: V,
968 ) -> Self {
969 self.0.request = v.into();
970 self
971 }
972
973 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
975 self.0.options = v.into();
976 self
977 }
978
979 pub async fn send(self) -> Result<()> {
981 (*self.0.stub)
982 .cancel_operation(self.0.request, self.0.options)
983 .await
984 .map(crate::Response::into_body)
985 }
986
987 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
989 self.0.request.name = v.into();
990 self
991 }
992 }
993
994 #[doc(hidden)]
995 impl crate::RequestBuilder for CancelOperation {
996 fn request_options(&mut self) -> &mut crate::RequestOptions {
997 &mut self.0.options
998 }
999 }
1000}
1001
1002#[cfg(feature = "completion-service")]
1003#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
1004pub mod completion_service {
1005 use crate::Result;
1006
1007 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1021
1022 pub(crate) mod client {
1023 use super::super::super::client::CompletionService;
1024 pub struct Factory;
1025 impl crate::ClientFactory for Factory {
1026 type Client = CompletionService;
1027 type Credentials = gaxi::options::Credentials;
1028 async fn build(
1029 self,
1030 config: gaxi::options::ClientConfig,
1031 ) -> crate::ClientBuilderResult<Self::Client> {
1032 Self::Client::new(config).await
1033 }
1034 }
1035 }
1036
1037 #[derive(Clone, Debug)]
1039 pub(crate) struct RequestBuilder<R: std::default::Default> {
1040 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1041 request: R,
1042 options: crate::RequestOptions,
1043 }
1044
1045 impl<R> RequestBuilder<R>
1046 where
1047 R: std::default::Default,
1048 {
1049 pub(crate) fn new(
1050 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1051 ) -> Self {
1052 Self {
1053 stub,
1054 request: R::default(),
1055 options: crate::RequestOptions::default(),
1056 }
1057 }
1058 }
1059
1060 #[derive(Clone, Debug)]
1077 pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1078
1079 impl CompleteQuery {
1080 pub(crate) fn new(
1081 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1082 ) -> Self {
1083 Self(RequestBuilder::new(stub))
1084 }
1085
1086 pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1088 self.0.request = v.into();
1089 self
1090 }
1091
1092 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1094 self.0.options = v.into();
1095 self
1096 }
1097
1098 pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1100 (*self.0.stub)
1101 .complete_query(self.0.request, self.0.options)
1102 .await
1103 .map(crate::Response::into_body)
1104 }
1105
1106 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1110 self.0.request.data_store = v.into();
1111 self
1112 }
1113
1114 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1118 self.0.request.query = v.into();
1119 self
1120 }
1121
1122 pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1124 self.0.request.query_model = v.into();
1125 self
1126 }
1127
1128 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1130 self.0.request.user_pseudo_id = v.into();
1131 self
1132 }
1133
1134 pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1136 self.0.request.include_tail_suggestions = v.into();
1137 self
1138 }
1139 }
1140
1141 #[doc(hidden)]
1142 impl crate::RequestBuilder for CompleteQuery {
1143 fn request_options(&mut self) -> &mut crate::RequestOptions {
1144 &mut self.0.options
1145 }
1146 }
1147
1148 #[derive(Clone, Debug)]
1166 pub struct ImportSuggestionDenyListEntries(
1167 RequestBuilder<crate::model::ImportSuggestionDenyListEntriesRequest>,
1168 );
1169
1170 impl ImportSuggestionDenyListEntries {
1171 pub(crate) fn new(
1172 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1173 ) -> Self {
1174 Self(RequestBuilder::new(stub))
1175 }
1176
1177 pub fn with_request<V: Into<crate::model::ImportSuggestionDenyListEntriesRequest>>(
1179 mut self,
1180 v: V,
1181 ) -> Self {
1182 self.0.request = v.into();
1183 self
1184 }
1185
1186 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1188 self.0.options = v.into();
1189 self
1190 }
1191
1192 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1199 (*self.0.stub)
1200 .import_suggestion_deny_list_entries(self.0.request, self.0.options)
1201 .await
1202 .map(crate::Response::into_body)
1203 }
1204
1205 pub fn poller(
1207 self,
1208 ) -> impl google_cloud_lro::Poller<
1209 crate::model::ImportSuggestionDenyListEntriesResponse,
1210 crate::model::ImportSuggestionDenyListEntriesMetadata,
1211 > {
1212 type Operation = google_cloud_lro::internal::Operation<
1213 crate::model::ImportSuggestionDenyListEntriesResponse,
1214 crate::model::ImportSuggestionDenyListEntriesMetadata,
1215 >;
1216 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1217 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1218
1219 let stub = self.0.stub.clone();
1220 let mut options = self.0.options.clone();
1221 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1222 let query = move |name| {
1223 let stub = stub.clone();
1224 let options = options.clone();
1225 async {
1226 let op = GetOperation::new(stub)
1227 .set_name(name)
1228 .with_options(options)
1229 .send()
1230 .await?;
1231 Ok(Operation::new(op))
1232 }
1233 };
1234
1235 let start = move || async {
1236 let op = self.send().await?;
1237 Ok(Operation::new(op))
1238 };
1239
1240 google_cloud_lro::internal::new_poller(
1241 polling_error_policy,
1242 polling_backoff_policy,
1243 start,
1244 query,
1245 )
1246 }
1247
1248 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1252 self.0.request.parent = v.into();
1253 self
1254 }
1255
1256 pub fn set_source<
1261 T: Into<Option<crate::model::import_suggestion_deny_list_entries_request::Source>>,
1262 >(
1263 mut self,
1264 v: T,
1265 ) -> Self {
1266 self.0.request.source = v.into();
1267 self
1268 }
1269
1270 pub fn set_inline_source<
1276 T: std::convert::Into<
1277 std::boxed::Box<
1278 crate::model::import_suggestion_deny_list_entries_request::InlineSource,
1279 >,
1280 >,
1281 >(
1282 mut self,
1283 v: T,
1284 ) -> Self {
1285 self.0.request = self.0.request.set_inline_source(v);
1286 self
1287 }
1288
1289 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1295 mut self,
1296 v: T,
1297 ) -> Self {
1298 self.0.request = self.0.request.set_gcs_source(v);
1299 self
1300 }
1301 }
1302
1303 #[doc(hidden)]
1304 impl crate::RequestBuilder for ImportSuggestionDenyListEntries {
1305 fn request_options(&mut self) -> &mut crate::RequestOptions {
1306 &mut self.0.options
1307 }
1308 }
1309
1310 #[derive(Clone, Debug)]
1328 pub struct PurgeSuggestionDenyListEntries(
1329 RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1330 );
1331
1332 impl PurgeSuggestionDenyListEntries {
1333 pub(crate) fn new(
1334 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1335 ) -> Self {
1336 Self(RequestBuilder::new(stub))
1337 }
1338
1339 pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1341 mut self,
1342 v: V,
1343 ) -> Self {
1344 self.0.request = v.into();
1345 self
1346 }
1347
1348 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1350 self.0.options = v.into();
1351 self
1352 }
1353
1354 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1361 (*self.0.stub)
1362 .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1363 .await
1364 .map(crate::Response::into_body)
1365 }
1366
1367 pub fn poller(
1369 self,
1370 ) -> impl google_cloud_lro::Poller<
1371 crate::model::PurgeSuggestionDenyListEntriesResponse,
1372 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1373 > {
1374 type Operation = google_cloud_lro::internal::Operation<
1375 crate::model::PurgeSuggestionDenyListEntriesResponse,
1376 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1377 >;
1378 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1379 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1380
1381 let stub = self.0.stub.clone();
1382 let mut options = self.0.options.clone();
1383 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1384 let query = move |name| {
1385 let stub = stub.clone();
1386 let options = options.clone();
1387 async {
1388 let op = GetOperation::new(stub)
1389 .set_name(name)
1390 .with_options(options)
1391 .send()
1392 .await?;
1393 Ok(Operation::new(op))
1394 }
1395 };
1396
1397 let start = move || async {
1398 let op = self.send().await?;
1399 Ok(Operation::new(op))
1400 };
1401
1402 google_cloud_lro::internal::new_poller(
1403 polling_error_policy,
1404 polling_backoff_policy,
1405 start,
1406 query,
1407 )
1408 }
1409
1410 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1414 self.0.request.parent = v.into();
1415 self
1416 }
1417 }
1418
1419 #[doc(hidden)]
1420 impl crate::RequestBuilder for PurgeSuggestionDenyListEntries {
1421 fn request_options(&mut self) -> &mut crate::RequestOptions {
1422 &mut self.0.options
1423 }
1424 }
1425
1426 #[derive(Clone, Debug)]
1444 pub struct ImportCompletionSuggestions(
1445 RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1446 );
1447
1448 impl ImportCompletionSuggestions {
1449 pub(crate) fn new(
1450 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1451 ) -> Self {
1452 Self(RequestBuilder::new(stub))
1453 }
1454
1455 pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1457 mut self,
1458 v: V,
1459 ) -> Self {
1460 self.0.request = v.into();
1461 self
1462 }
1463
1464 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1466 self.0.options = v.into();
1467 self
1468 }
1469
1470 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1477 (*self.0.stub)
1478 .import_completion_suggestions(self.0.request, self.0.options)
1479 .await
1480 .map(crate::Response::into_body)
1481 }
1482
1483 pub fn poller(
1485 self,
1486 ) -> impl google_cloud_lro::Poller<
1487 crate::model::ImportCompletionSuggestionsResponse,
1488 crate::model::ImportCompletionSuggestionsMetadata,
1489 > {
1490 type Operation = google_cloud_lro::internal::Operation<
1491 crate::model::ImportCompletionSuggestionsResponse,
1492 crate::model::ImportCompletionSuggestionsMetadata,
1493 >;
1494 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1495 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1496
1497 let stub = self.0.stub.clone();
1498 let mut options = self.0.options.clone();
1499 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1500 let query = move |name| {
1501 let stub = stub.clone();
1502 let options = options.clone();
1503 async {
1504 let op = GetOperation::new(stub)
1505 .set_name(name)
1506 .with_options(options)
1507 .send()
1508 .await?;
1509 Ok(Operation::new(op))
1510 }
1511 };
1512
1513 let start = move || async {
1514 let op = self.send().await?;
1515 Ok(Operation::new(op))
1516 };
1517
1518 google_cloud_lro::internal::new_poller(
1519 polling_error_policy,
1520 polling_backoff_policy,
1521 start,
1522 query,
1523 )
1524 }
1525
1526 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1530 self.0.request.parent = v.into();
1531 self
1532 }
1533
1534 pub fn set_error_config<T>(mut self, v: T) -> Self
1536 where
1537 T: std::convert::Into<crate::model::ImportErrorConfig>,
1538 {
1539 self.0.request.error_config = std::option::Option::Some(v.into());
1540 self
1541 }
1542
1543 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1545 where
1546 T: std::convert::Into<crate::model::ImportErrorConfig>,
1547 {
1548 self.0.request.error_config = v.map(|x| x.into());
1549 self
1550 }
1551
1552 pub fn set_source<
1557 T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1558 >(
1559 mut self,
1560 v: T,
1561 ) -> Self {
1562 self.0.request.source = v.into();
1563 self
1564 }
1565
1566 pub fn set_inline_source<
1572 T: std::convert::Into<
1573 std::boxed::Box<
1574 crate::model::import_completion_suggestions_request::InlineSource,
1575 >,
1576 >,
1577 >(
1578 mut self,
1579 v: T,
1580 ) -> Self {
1581 self.0.request = self.0.request.set_inline_source(v);
1582 self
1583 }
1584
1585 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1591 mut self,
1592 v: T,
1593 ) -> Self {
1594 self.0.request = self.0.request.set_gcs_source(v);
1595 self
1596 }
1597
1598 pub fn set_bigquery_source<
1604 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1605 >(
1606 mut self,
1607 v: T,
1608 ) -> Self {
1609 self.0.request = self.0.request.set_bigquery_source(v);
1610 self
1611 }
1612 }
1613
1614 #[doc(hidden)]
1615 impl crate::RequestBuilder for ImportCompletionSuggestions {
1616 fn request_options(&mut self) -> &mut crate::RequestOptions {
1617 &mut self.0.options
1618 }
1619 }
1620
1621 #[derive(Clone, Debug)]
1639 pub struct PurgeCompletionSuggestions(
1640 RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1641 );
1642
1643 impl PurgeCompletionSuggestions {
1644 pub(crate) fn new(
1645 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1646 ) -> Self {
1647 Self(RequestBuilder::new(stub))
1648 }
1649
1650 pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1652 mut self,
1653 v: V,
1654 ) -> Self {
1655 self.0.request = v.into();
1656 self
1657 }
1658
1659 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1661 self.0.options = v.into();
1662 self
1663 }
1664
1665 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1672 (*self.0.stub)
1673 .purge_completion_suggestions(self.0.request, self.0.options)
1674 .await
1675 .map(crate::Response::into_body)
1676 }
1677
1678 pub fn poller(
1680 self,
1681 ) -> impl google_cloud_lro::Poller<
1682 crate::model::PurgeCompletionSuggestionsResponse,
1683 crate::model::PurgeCompletionSuggestionsMetadata,
1684 > {
1685 type Operation = google_cloud_lro::internal::Operation<
1686 crate::model::PurgeCompletionSuggestionsResponse,
1687 crate::model::PurgeCompletionSuggestionsMetadata,
1688 >;
1689 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1690 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1691
1692 let stub = self.0.stub.clone();
1693 let mut options = self.0.options.clone();
1694 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1695 let query = move |name| {
1696 let stub = stub.clone();
1697 let options = options.clone();
1698 async {
1699 let op = GetOperation::new(stub)
1700 .set_name(name)
1701 .with_options(options)
1702 .send()
1703 .await?;
1704 Ok(Operation::new(op))
1705 }
1706 };
1707
1708 let start = move || async {
1709 let op = self.send().await?;
1710 Ok(Operation::new(op))
1711 };
1712
1713 google_cloud_lro::internal::new_poller(
1714 polling_error_policy,
1715 polling_backoff_policy,
1716 start,
1717 query,
1718 )
1719 }
1720
1721 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1725 self.0.request.parent = v.into();
1726 self
1727 }
1728 }
1729
1730 #[doc(hidden)]
1731 impl crate::RequestBuilder for PurgeCompletionSuggestions {
1732 fn request_options(&mut self) -> &mut crate::RequestOptions {
1733 &mut self.0.options
1734 }
1735 }
1736
1737 #[derive(Clone, Debug)]
1758 pub struct ListOperations(
1759 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1760 );
1761
1762 impl ListOperations {
1763 pub(crate) fn new(
1764 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1765 ) -> Self {
1766 Self(RequestBuilder::new(stub))
1767 }
1768
1769 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1771 mut self,
1772 v: V,
1773 ) -> Self {
1774 self.0.request = v.into();
1775 self
1776 }
1777
1778 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1780 self.0.options = v.into();
1781 self
1782 }
1783
1784 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1786 (*self.0.stub)
1787 .list_operations(self.0.request, self.0.options)
1788 .await
1789 .map(crate::Response::into_body)
1790 }
1791
1792 pub fn by_page(
1794 self,
1795 ) -> impl google_cloud_gax::paginator::Paginator<
1796 google_cloud_longrunning::model::ListOperationsResponse,
1797 crate::Error,
1798 > {
1799 use std::clone::Clone;
1800 let token = self.0.request.page_token.clone();
1801 let execute = move |token: String| {
1802 let mut builder = self.clone();
1803 builder.0.request = builder.0.request.set_page_token(token);
1804 builder.send()
1805 };
1806 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1807 }
1808
1809 pub fn by_item(
1811 self,
1812 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1813 google_cloud_longrunning::model::ListOperationsResponse,
1814 crate::Error,
1815 > {
1816 use google_cloud_gax::paginator::Paginator;
1817 self.by_page().items()
1818 }
1819
1820 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1822 self.0.request.name = v.into();
1823 self
1824 }
1825
1826 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1828 self.0.request.filter = v.into();
1829 self
1830 }
1831
1832 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1834 self.0.request.page_size = v.into();
1835 self
1836 }
1837
1838 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1840 self.0.request.page_token = v.into();
1841 self
1842 }
1843
1844 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1846 self.0.request.return_partial_success = v.into();
1847 self
1848 }
1849 }
1850
1851 #[doc(hidden)]
1852 impl crate::RequestBuilder for ListOperations {
1853 fn request_options(&mut self) -> &mut crate::RequestOptions {
1854 &mut self.0.options
1855 }
1856 }
1857
1858 #[derive(Clone, Debug)]
1875 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1876
1877 impl GetOperation {
1878 pub(crate) fn new(
1879 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1880 ) -> Self {
1881 Self(RequestBuilder::new(stub))
1882 }
1883
1884 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1886 mut self,
1887 v: V,
1888 ) -> Self {
1889 self.0.request = v.into();
1890 self
1891 }
1892
1893 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1895 self.0.options = v.into();
1896 self
1897 }
1898
1899 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1901 (*self.0.stub)
1902 .get_operation(self.0.request, self.0.options)
1903 .await
1904 .map(crate::Response::into_body)
1905 }
1906
1907 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1909 self.0.request.name = v.into();
1910 self
1911 }
1912 }
1913
1914 #[doc(hidden)]
1915 impl crate::RequestBuilder for GetOperation {
1916 fn request_options(&mut self) -> &mut crate::RequestOptions {
1917 &mut self.0.options
1918 }
1919 }
1920
1921 #[derive(Clone, Debug)]
1938 pub struct CancelOperation(
1939 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1940 );
1941
1942 impl CancelOperation {
1943 pub(crate) fn new(
1944 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1945 ) -> Self {
1946 Self(RequestBuilder::new(stub))
1947 }
1948
1949 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1951 mut self,
1952 v: V,
1953 ) -> Self {
1954 self.0.request = v.into();
1955 self
1956 }
1957
1958 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1960 self.0.options = v.into();
1961 self
1962 }
1963
1964 pub async fn send(self) -> Result<()> {
1966 (*self.0.stub)
1967 .cancel_operation(self.0.request, self.0.options)
1968 .await
1969 .map(crate::Response::into_body)
1970 }
1971
1972 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1974 self.0.request.name = v.into();
1975 self
1976 }
1977 }
1978
1979 #[doc(hidden)]
1980 impl crate::RequestBuilder for CancelOperation {
1981 fn request_options(&mut self) -> &mut crate::RequestOptions {
1982 &mut self.0.options
1983 }
1984 }
1985}
1986
1987#[cfg(feature = "control-service")]
1988#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
1989pub mod control_service {
1990 use crate::Result;
1991
1992 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2006
2007 pub(crate) mod client {
2008 use super::super::super::client::ControlService;
2009 pub struct Factory;
2010 impl crate::ClientFactory for Factory {
2011 type Client = ControlService;
2012 type Credentials = gaxi::options::Credentials;
2013 async fn build(
2014 self,
2015 config: gaxi::options::ClientConfig,
2016 ) -> crate::ClientBuilderResult<Self::Client> {
2017 Self::Client::new(config).await
2018 }
2019 }
2020 }
2021
2022 #[derive(Clone, Debug)]
2024 pub(crate) struct RequestBuilder<R: std::default::Default> {
2025 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2026 request: R,
2027 options: crate::RequestOptions,
2028 }
2029
2030 impl<R> RequestBuilder<R>
2031 where
2032 R: std::default::Default,
2033 {
2034 pub(crate) fn new(
2035 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2036 ) -> Self {
2037 Self {
2038 stub,
2039 request: R::default(),
2040 options: crate::RequestOptions::default(),
2041 }
2042 }
2043 }
2044
2045 #[derive(Clone, Debug)]
2062 pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2063
2064 impl CreateControl {
2065 pub(crate) fn new(
2066 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2067 ) -> Self {
2068 Self(RequestBuilder::new(stub))
2069 }
2070
2071 pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2073 self.0.request = v.into();
2074 self
2075 }
2076
2077 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2079 self.0.options = v.into();
2080 self
2081 }
2082
2083 pub async fn send(self) -> Result<crate::model::Control> {
2085 (*self.0.stub)
2086 .create_control(self.0.request, self.0.options)
2087 .await
2088 .map(crate::Response::into_body)
2089 }
2090
2091 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2095 self.0.request.parent = v.into();
2096 self
2097 }
2098
2099 pub fn set_control<T>(mut self, v: T) -> Self
2103 where
2104 T: std::convert::Into<crate::model::Control>,
2105 {
2106 self.0.request.control = std::option::Option::Some(v.into());
2107 self
2108 }
2109
2110 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2114 where
2115 T: std::convert::Into<crate::model::Control>,
2116 {
2117 self.0.request.control = v.map(|x| x.into());
2118 self
2119 }
2120
2121 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2125 self.0.request.control_id = v.into();
2126 self
2127 }
2128 }
2129
2130 #[doc(hidden)]
2131 impl crate::RequestBuilder for CreateControl {
2132 fn request_options(&mut self) -> &mut crate::RequestOptions {
2133 &mut self.0.options
2134 }
2135 }
2136
2137 #[derive(Clone, Debug)]
2154 pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2155
2156 impl DeleteControl {
2157 pub(crate) fn new(
2158 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2159 ) -> Self {
2160 Self(RequestBuilder::new(stub))
2161 }
2162
2163 pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2165 self.0.request = v.into();
2166 self
2167 }
2168
2169 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2171 self.0.options = v.into();
2172 self
2173 }
2174
2175 pub async fn send(self) -> Result<()> {
2177 (*self.0.stub)
2178 .delete_control(self.0.request, self.0.options)
2179 .await
2180 .map(crate::Response::into_body)
2181 }
2182
2183 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2187 self.0.request.name = v.into();
2188 self
2189 }
2190 }
2191
2192 #[doc(hidden)]
2193 impl crate::RequestBuilder for DeleteControl {
2194 fn request_options(&mut self) -> &mut crate::RequestOptions {
2195 &mut self.0.options
2196 }
2197 }
2198
2199 #[derive(Clone, Debug)]
2216 pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2217
2218 impl UpdateControl {
2219 pub(crate) fn new(
2220 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2221 ) -> Self {
2222 Self(RequestBuilder::new(stub))
2223 }
2224
2225 pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2227 self.0.request = v.into();
2228 self
2229 }
2230
2231 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2233 self.0.options = v.into();
2234 self
2235 }
2236
2237 pub async fn send(self) -> Result<crate::model::Control> {
2239 (*self.0.stub)
2240 .update_control(self.0.request, self.0.options)
2241 .await
2242 .map(crate::Response::into_body)
2243 }
2244
2245 pub fn set_control<T>(mut self, v: T) -> Self
2249 where
2250 T: std::convert::Into<crate::model::Control>,
2251 {
2252 self.0.request.control = std::option::Option::Some(v.into());
2253 self
2254 }
2255
2256 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2260 where
2261 T: std::convert::Into<crate::model::Control>,
2262 {
2263 self.0.request.control = v.map(|x| x.into());
2264 self
2265 }
2266
2267 pub fn set_update_mask<T>(mut self, v: T) -> Self
2269 where
2270 T: std::convert::Into<wkt::FieldMask>,
2271 {
2272 self.0.request.update_mask = std::option::Option::Some(v.into());
2273 self
2274 }
2275
2276 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2278 where
2279 T: std::convert::Into<wkt::FieldMask>,
2280 {
2281 self.0.request.update_mask = v.map(|x| x.into());
2282 self
2283 }
2284 }
2285
2286 #[doc(hidden)]
2287 impl crate::RequestBuilder for UpdateControl {
2288 fn request_options(&mut self) -> &mut crate::RequestOptions {
2289 &mut self.0.options
2290 }
2291 }
2292
2293 #[derive(Clone, Debug)]
2310 pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2311
2312 impl GetControl {
2313 pub(crate) fn new(
2314 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2315 ) -> Self {
2316 Self(RequestBuilder::new(stub))
2317 }
2318
2319 pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2321 self.0.request = v.into();
2322 self
2323 }
2324
2325 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2327 self.0.options = v.into();
2328 self
2329 }
2330
2331 pub async fn send(self) -> Result<crate::model::Control> {
2333 (*self.0.stub)
2334 .get_control(self.0.request, self.0.options)
2335 .await
2336 .map(crate::Response::into_body)
2337 }
2338
2339 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2343 self.0.request.name = v.into();
2344 self
2345 }
2346 }
2347
2348 #[doc(hidden)]
2349 impl crate::RequestBuilder for GetControl {
2350 fn request_options(&mut self) -> &mut crate::RequestOptions {
2351 &mut self.0.options
2352 }
2353 }
2354
2355 #[derive(Clone, Debug)]
2376 pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2377
2378 impl ListControls {
2379 pub(crate) fn new(
2380 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2381 ) -> Self {
2382 Self(RequestBuilder::new(stub))
2383 }
2384
2385 pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2387 self.0.request = v.into();
2388 self
2389 }
2390
2391 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2393 self.0.options = v.into();
2394 self
2395 }
2396
2397 pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2399 (*self.0.stub)
2400 .list_controls(self.0.request, self.0.options)
2401 .await
2402 .map(crate::Response::into_body)
2403 }
2404
2405 pub fn by_page(
2407 self,
2408 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListControlsResponse, crate::Error>
2409 {
2410 use std::clone::Clone;
2411 let token = self.0.request.page_token.clone();
2412 let execute = move |token: String| {
2413 let mut builder = self.clone();
2414 builder.0.request = builder.0.request.set_page_token(token);
2415 builder.send()
2416 };
2417 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2418 }
2419
2420 pub fn by_item(
2422 self,
2423 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2424 crate::model::ListControlsResponse,
2425 crate::Error,
2426 > {
2427 use google_cloud_gax::paginator::Paginator;
2428 self.by_page().items()
2429 }
2430
2431 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2435 self.0.request.parent = v.into();
2436 self
2437 }
2438
2439 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2441 self.0.request.page_size = v.into();
2442 self
2443 }
2444
2445 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2447 self.0.request.page_token = v.into();
2448 self
2449 }
2450
2451 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2453 self.0.request.filter = v.into();
2454 self
2455 }
2456 }
2457
2458 #[doc(hidden)]
2459 impl crate::RequestBuilder for ListControls {
2460 fn request_options(&mut self) -> &mut crate::RequestOptions {
2461 &mut self.0.options
2462 }
2463 }
2464
2465 #[derive(Clone, Debug)]
2486 pub struct ListOperations(
2487 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2488 );
2489
2490 impl ListOperations {
2491 pub(crate) fn new(
2492 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2493 ) -> Self {
2494 Self(RequestBuilder::new(stub))
2495 }
2496
2497 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2499 mut self,
2500 v: V,
2501 ) -> Self {
2502 self.0.request = v.into();
2503 self
2504 }
2505
2506 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2508 self.0.options = v.into();
2509 self
2510 }
2511
2512 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2514 (*self.0.stub)
2515 .list_operations(self.0.request, self.0.options)
2516 .await
2517 .map(crate::Response::into_body)
2518 }
2519
2520 pub fn by_page(
2522 self,
2523 ) -> impl google_cloud_gax::paginator::Paginator<
2524 google_cloud_longrunning::model::ListOperationsResponse,
2525 crate::Error,
2526 > {
2527 use std::clone::Clone;
2528 let token = self.0.request.page_token.clone();
2529 let execute = move |token: String| {
2530 let mut builder = self.clone();
2531 builder.0.request = builder.0.request.set_page_token(token);
2532 builder.send()
2533 };
2534 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2535 }
2536
2537 pub fn by_item(
2539 self,
2540 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2541 google_cloud_longrunning::model::ListOperationsResponse,
2542 crate::Error,
2543 > {
2544 use google_cloud_gax::paginator::Paginator;
2545 self.by_page().items()
2546 }
2547
2548 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2550 self.0.request.name = v.into();
2551 self
2552 }
2553
2554 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2556 self.0.request.filter = v.into();
2557 self
2558 }
2559
2560 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2562 self.0.request.page_size = v.into();
2563 self
2564 }
2565
2566 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2568 self.0.request.page_token = v.into();
2569 self
2570 }
2571
2572 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2574 self.0.request.return_partial_success = v.into();
2575 self
2576 }
2577 }
2578
2579 #[doc(hidden)]
2580 impl crate::RequestBuilder for ListOperations {
2581 fn request_options(&mut self) -> &mut crate::RequestOptions {
2582 &mut self.0.options
2583 }
2584 }
2585
2586 #[derive(Clone, Debug)]
2603 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2604
2605 impl GetOperation {
2606 pub(crate) fn new(
2607 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2608 ) -> Self {
2609 Self(RequestBuilder::new(stub))
2610 }
2611
2612 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2614 mut self,
2615 v: V,
2616 ) -> Self {
2617 self.0.request = v.into();
2618 self
2619 }
2620
2621 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2623 self.0.options = v.into();
2624 self
2625 }
2626
2627 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2629 (*self.0.stub)
2630 .get_operation(self.0.request, self.0.options)
2631 .await
2632 .map(crate::Response::into_body)
2633 }
2634
2635 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2637 self.0.request.name = v.into();
2638 self
2639 }
2640 }
2641
2642 #[doc(hidden)]
2643 impl crate::RequestBuilder for GetOperation {
2644 fn request_options(&mut self) -> &mut crate::RequestOptions {
2645 &mut self.0.options
2646 }
2647 }
2648
2649 #[derive(Clone, Debug)]
2666 pub struct CancelOperation(
2667 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2668 );
2669
2670 impl CancelOperation {
2671 pub(crate) fn new(
2672 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2673 ) -> Self {
2674 Self(RequestBuilder::new(stub))
2675 }
2676
2677 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2679 mut self,
2680 v: V,
2681 ) -> Self {
2682 self.0.request = v.into();
2683 self
2684 }
2685
2686 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2688 self.0.options = v.into();
2689 self
2690 }
2691
2692 pub async fn send(self) -> Result<()> {
2694 (*self.0.stub)
2695 .cancel_operation(self.0.request, self.0.options)
2696 .await
2697 .map(crate::Response::into_body)
2698 }
2699
2700 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2702 self.0.request.name = v.into();
2703 self
2704 }
2705 }
2706
2707 #[doc(hidden)]
2708 impl crate::RequestBuilder for CancelOperation {
2709 fn request_options(&mut self) -> &mut crate::RequestOptions {
2710 &mut self.0.options
2711 }
2712 }
2713}
2714
2715#[cfg(feature = "conversational-search-service")]
2716#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2717pub mod conversational_search_service {
2718 use crate::Result;
2719
2720 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2734
2735 pub(crate) mod client {
2736 use super::super::super::client::ConversationalSearchService;
2737 pub struct Factory;
2738 impl crate::ClientFactory for Factory {
2739 type Client = ConversationalSearchService;
2740 type Credentials = gaxi::options::Credentials;
2741 async fn build(
2742 self,
2743 config: gaxi::options::ClientConfig,
2744 ) -> crate::ClientBuilderResult<Self::Client> {
2745 Self::Client::new(config).await
2746 }
2747 }
2748 }
2749
2750 #[derive(Clone, Debug)]
2752 pub(crate) struct RequestBuilder<R: std::default::Default> {
2753 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2754 request: R,
2755 options: crate::RequestOptions,
2756 }
2757
2758 impl<R> RequestBuilder<R>
2759 where
2760 R: std::default::Default,
2761 {
2762 pub(crate) fn new(
2763 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2764 ) -> Self {
2765 Self {
2766 stub,
2767 request: R::default(),
2768 options: crate::RequestOptions::default(),
2769 }
2770 }
2771 }
2772
2773 #[derive(Clone, Debug)]
2790 pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
2791
2792 impl ConverseConversation {
2793 pub(crate) fn new(
2794 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2795 ) -> Self {
2796 Self(RequestBuilder::new(stub))
2797 }
2798
2799 pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
2801 mut self,
2802 v: V,
2803 ) -> Self {
2804 self.0.request = v.into();
2805 self
2806 }
2807
2808 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2810 self.0.options = v.into();
2811 self
2812 }
2813
2814 pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
2816 (*self.0.stub)
2817 .converse_conversation(self.0.request, self.0.options)
2818 .await
2819 .map(crate::Response::into_body)
2820 }
2821
2822 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2826 self.0.request.name = v.into();
2827 self
2828 }
2829
2830 pub fn set_query<T>(mut self, v: T) -> Self
2834 where
2835 T: std::convert::Into<crate::model::TextInput>,
2836 {
2837 self.0.request.query = std::option::Option::Some(v.into());
2838 self
2839 }
2840
2841 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
2845 where
2846 T: std::convert::Into<crate::model::TextInput>,
2847 {
2848 self.0.request.query = v.map(|x| x.into());
2849 self
2850 }
2851
2852 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2854 self.0.request.serving_config = v.into();
2855 self
2856 }
2857
2858 pub fn set_conversation<T>(mut self, v: T) -> Self
2860 where
2861 T: std::convert::Into<crate::model::Conversation>,
2862 {
2863 self.0.request.conversation = std::option::Option::Some(v.into());
2864 self
2865 }
2866
2867 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2869 where
2870 T: std::convert::Into<crate::model::Conversation>,
2871 {
2872 self.0.request.conversation = v.map(|x| x.into());
2873 self
2874 }
2875
2876 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
2878 self.0.request.safe_search = v.into();
2879 self
2880 }
2881
2882 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
2884 where
2885 T: std::iter::IntoIterator<Item = (K, V)>,
2886 K: std::convert::Into<std::string::String>,
2887 V: std::convert::Into<std::string::String>,
2888 {
2889 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2890 self
2891 }
2892
2893 pub fn set_summary_spec<T>(mut self, v: T) -> Self
2895 where
2896 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2897 {
2898 self.0.request.summary_spec = std::option::Option::Some(v.into());
2899 self
2900 }
2901
2902 pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
2904 where
2905 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2906 {
2907 self.0.request.summary_spec = v.map(|x| x.into());
2908 self
2909 }
2910
2911 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2913 self.0.request.filter = v.into();
2914 self
2915 }
2916
2917 pub fn set_boost_spec<T>(mut self, v: T) -> Self
2919 where
2920 T: std::convert::Into<crate::model::search_request::BoostSpec>,
2921 {
2922 self.0.request.boost_spec = std::option::Option::Some(v.into());
2923 self
2924 }
2925
2926 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
2928 where
2929 T: std::convert::Into<crate::model::search_request::BoostSpec>,
2930 {
2931 self.0.request.boost_spec = v.map(|x| x.into());
2932 self
2933 }
2934 }
2935
2936 #[doc(hidden)]
2937 impl crate::RequestBuilder for ConverseConversation {
2938 fn request_options(&mut self) -> &mut crate::RequestOptions {
2939 &mut self.0.options
2940 }
2941 }
2942
2943 #[derive(Clone, Debug)]
2960 pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
2961
2962 impl CreateConversation {
2963 pub(crate) fn new(
2964 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2965 ) -> Self {
2966 Self(RequestBuilder::new(stub))
2967 }
2968
2969 pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
2971 mut self,
2972 v: V,
2973 ) -> Self {
2974 self.0.request = v.into();
2975 self
2976 }
2977
2978 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2980 self.0.options = v.into();
2981 self
2982 }
2983
2984 pub async fn send(self) -> Result<crate::model::Conversation> {
2986 (*self.0.stub)
2987 .create_conversation(self.0.request, self.0.options)
2988 .await
2989 .map(crate::Response::into_body)
2990 }
2991
2992 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2996 self.0.request.parent = v.into();
2997 self
2998 }
2999
3000 pub fn set_conversation<T>(mut self, v: T) -> Self
3004 where
3005 T: std::convert::Into<crate::model::Conversation>,
3006 {
3007 self.0.request.conversation = std::option::Option::Some(v.into());
3008 self
3009 }
3010
3011 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3015 where
3016 T: std::convert::Into<crate::model::Conversation>,
3017 {
3018 self.0.request.conversation = v.map(|x| x.into());
3019 self
3020 }
3021 }
3022
3023 #[doc(hidden)]
3024 impl crate::RequestBuilder for CreateConversation {
3025 fn request_options(&mut self) -> &mut crate::RequestOptions {
3026 &mut self.0.options
3027 }
3028 }
3029
3030 #[derive(Clone, Debug)]
3047 pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
3048
3049 impl DeleteConversation {
3050 pub(crate) fn new(
3051 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3052 ) -> Self {
3053 Self(RequestBuilder::new(stub))
3054 }
3055
3056 pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3058 mut self,
3059 v: V,
3060 ) -> Self {
3061 self.0.request = v.into();
3062 self
3063 }
3064
3065 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3067 self.0.options = v.into();
3068 self
3069 }
3070
3071 pub async fn send(self) -> Result<()> {
3073 (*self.0.stub)
3074 .delete_conversation(self.0.request, self.0.options)
3075 .await
3076 .map(crate::Response::into_body)
3077 }
3078
3079 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3083 self.0.request.name = v.into();
3084 self
3085 }
3086 }
3087
3088 #[doc(hidden)]
3089 impl crate::RequestBuilder for DeleteConversation {
3090 fn request_options(&mut self) -> &mut crate::RequestOptions {
3091 &mut self.0.options
3092 }
3093 }
3094
3095 #[derive(Clone, Debug)]
3112 pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3113
3114 impl UpdateConversation {
3115 pub(crate) fn new(
3116 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3117 ) -> Self {
3118 Self(RequestBuilder::new(stub))
3119 }
3120
3121 pub fn with_request<V: Into<crate::model::UpdateConversationRequest>>(
3123 mut self,
3124 v: V,
3125 ) -> Self {
3126 self.0.request = v.into();
3127 self
3128 }
3129
3130 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3132 self.0.options = v.into();
3133 self
3134 }
3135
3136 pub async fn send(self) -> Result<crate::model::Conversation> {
3138 (*self.0.stub)
3139 .update_conversation(self.0.request, self.0.options)
3140 .await
3141 .map(crate::Response::into_body)
3142 }
3143
3144 pub fn set_conversation<T>(mut self, v: T) -> Self
3148 where
3149 T: std::convert::Into<crate::model::Conversation>,
3150 {
3151 self.0.request.conversation = std::option::Option::Some(v.into());
3152 self
3153 }
3154
3155 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3159 where
3160 T: std::convert::Into<crate::model::Conversation>,
3161 {
3162 self.0.request.conversation = v.map(|x| x.into());
3163 self
3164 }
3165
3166 pub fn set_update_mask<T>(mut self, v: T) -> Self
3168 where
3169 T: std::convert::Into<wkt::FieldMask>,
3170 {
3171 self.0.request.update_mask = std::option::Option::Some(v.into());
3172 self
3173 }
3174
3175 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3177 where
3178 T: std::convert::Into<wkt::FieldMask>,
3179 {
3180 self.0.request.update_mask = v.map(|x| x.into());
3181 self
3182 }
3183 }
3184
3185 #[doc(hidden)]
3186 impl crate::RequestBuilder for UpdateConversation {
3187 fn request_options(&mut self) -> &mut crate::RequestOptions {
3188 &mut self.0.options
3189 }
3190 }
3191
3192 #[derive(Clone, Debug)]
3209 pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3210
3211 impl GetConversation {
3212 pub(crate) fn new(
3213 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3214 ) -> Self {
3215 Self(RequestBuilder::new(stub))
3216 }
3217
3218 pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3220 self.0.request = v.into();
3221 self
3222 }
3223
3224 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3226 self.0.options = v.into();
3227 self
3228 }
3229
3230 pub async fn send(self) -> Result<crate::model::Conversation> {
3232 (*self.0.stub)
3233 .get_conversation(self.0.request, self.0.options)
3234 .await
3235 .map(crate::Response::into_body)
3236 }
3237
3238 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3242 self.0.request.name = v.into();
3243 self
3244 }
3245 }
3246
3247 #[doc(hidden)]
3248 impl crate::RequestBuilder for GetConversation {
3249 fn request_options(&mut self) -> &mut crate::RequestOptions {
3250 &mut self.0.options
3251 }
3252 }
3253
3254 #[derive(Clone, Debug)]
3275 pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3276
3277 impl ListConversations {
3278 pub(crate) fn new(
3279 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3280 ) -> Self {
3281 Self(RequestBuilder::new(stub))
3282 }
3283
3284 pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3286 mut self,
3287 v: V,
3288 ) -> Self {
3289 self.0.request = v.into();
3290 self
3291 }
3292
3293 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3295 self.0.options = v.into();
3296 self
3297 }
3298
3299 pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3301 (*self.0.stub)
3302 .list_conversations(self.0.request, self.0.options)
3303 .await
3304 .map(crate::Response::into_body)
3305 }
3306
3307 pub fn by_page(
3309 self,
3310 ) -> impl google_cloud_gax::paginator::Paginator<
3311 crate::model::ListConversationsResponse,
3312 crate::Error,
3313 > {
3314 use std::clone::Clone;
3315 let token = self.0.request.page_token.clone();
3316 let execute = move |token: String| {
3317 let mut builder = self.clone();
3318 builder.0.request = builder.0.request.set_page_token(token);
3319 builder.send()
3320 };
3321 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3322 }
3323
3324 pub fn by_item(
3326 self,
3327 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3328 crate::model::ListConversationsResponse,
3329 crate::Error,
3330 > {
3331 use google_cloud_gax::paginator::Paginator;
3332 self.by_page().items()
3333 }
3334
3335 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3339 self.0.request.parent = v.into();
3340 self
3341 }
3342
3343 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3345 self.0.request.page_size = v.into();
3346 self
3347 }
3348
3349 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3351 self.0.request.page_token = v.into();
3352 self
3353 }
3354
3355 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3357 self.0.request.filter = v.into();
3358 self
3359 }
3360
3361 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3363 self.0.request.order_by = v.into();
3364 self
3365 }
3366 }
3367
3368 #[doc(hidden)]
3369 impl crate::RequestBuilder for ListConversations {
3370 fn request_options(&mut self) -> &mut crate::RequestOptions {
3371 &mut self.0.options
3372 }
3373 }
3374
3375 #[derive(Clone, Debug)]
3392 pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3393
3394 impl AnswerQuery {
3395 pub(crate) fn new(
3396 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3397 ) -> Self {
3398 Self(RequestBuilder::new(stub))
3399 }
3400
3401 pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3403 self.0.request = v.into();
3404 self
3405 }
3406
3407 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3409 self.0.options = v.into();
3410 self
3411 }
3412
3413 pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3415 (*self.0.stub)
3416 .answer_query(self.0.request, self.0.options)
3417 .await
3418 .map(crate::Response::into_body)
3419 }
3420
3421 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3425 self.0.request.serving_config = v.into();
3426 self
3427 }
3428
3429 pub fn set_query<T>(mut self, v: T) -> Self
3433 where
3434 T: std::convert::Into<crate::model::Query>,
3435 {
3436 self.0.request.query = std::option::Option::Some(v.into());
3437 self
3438 }
3439
3440 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3444 where
3445 T: std::convert::Into<crate::model::Query>,
3446 {
3447 self.0.request.query = v.map(|x| x.into());
3448 self
3449 }
3450
3451 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3453 self.0.request.session = v.into();
3454 self
3455 }
3456
3457 pub fn set_safety_spec<T>(mut self, v: T) -> Self
3459 where
3460 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3461 {
3462 self.0.request.safety_spec = std::option::Option::Some(v.into());
3463 self
3464 }
3465
3466 pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3468 where
3469 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3470 {
3471 self.0.request.safety_spec = v.map(|x| x.into());
3472 self
3473 }
3474
3475 pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3477 where
3478 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3479 {
3480 self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3481 self
3482 }
3483
3484 pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3486 where
3487 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3488 {
3489 self.0.request.related_questions_spec = v.map(|x| x.into());
3490 self
3491 }
3492
3493 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3495 where
3496 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3497 {
3498 self.0.request.grounding_spec = std::option::Option::Some(v.into());
3499 self
3500 }
3501
3502 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3504 where
3505 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3506 {
3507 self.0.request.grounding_spec = v.map(|x| x.into());
3508 self
3509 }
3510
3511 pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3513 where
3514 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3515 {
3516 self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3517 self
3518 }
3519
3520 pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3522 where
3523 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3524 {
3525 self.0.request.answer_generation_spec = v.map(|x| x.into());
3526 self
3527 }
3528
3529 pub fn set_search_spec<T>(mut self, v: T) -> Self
3531 where
3532 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3533 {
3534 self.0.request.search_spec = std::option::Option::Some(v.into());
3535 self
3536 }
3537
3538 pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3540 where
3541 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3542 {
3543 self.0.request.search_spec = v.map(|x| x.into());
3544 self
3545 }
3546
3547 pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3549 where
3550 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3551 {
3552 self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3553 self
3554 }
3555
3556 pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3558 where
3559 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3560 {
3561 self.0.request.query_understanding_spec = v.map(|x| x.into());
3562 self
3563 }
3564
3565 #[deprecated]
3567 pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3568 self.0.request.asynchronous_mode = v.into();
3569 self
3570 }
3571
3572 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3574 self.0.request.user_pseudo_id = v.into();
3575 self
3576 }
3577
3578 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3580 where
3581 T: std::iter::IntoIterator<Item = (K, V)>,
3582 K: std::convert::Into<std::string::String>,
3583 V: std::convert::Into<std::string::String>,
3584 {
3585 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3586 self
3587 }
3588
3589 pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3591 where
3592 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3593 {
3594 self.0.request.end_user_spec = std::option::Option::Some(v.into());
3595 self
3596 }
3597
3598 pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3600 where
3601 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3602 {
3603 self.0.request.end_user_spec = v.map(|x| x.into());
3604 self
3605 }
3606 }
3607
3608 #[doc(hidden)]
3609 impl crate::RequestBuilder for AnswerQuery {
3610 fn request_options(&mut self) -> &mut crate::RequestOptions {
3611 &mut self.0.options
3612 }
3613 }
3614
3615 #[derive(Clone, Debug)]
3632 pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
3633
3634 impl GetAnswer {
3635 pub(crate) fn new(
3636 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3637 ) -> Self {
3638 Self(RequestBuilder::new(stub))
3639 }
3640
3641 pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
3643 self.0.request = v.into();
3644 self
3645 }
3646
3647 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3649 self.0.options = v.into();
3650 self
3651 }
3652
3653 pub async fn send(self) -> Result<crate::model::Answer> {
3655 (*self.0.stub)
3656 .get_answer(self.0.request, self.0.options)
3657 .await
3658 .map(crate::Response::into_body)
3659 }
3660
3661 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3665 self.0.request.name = v.into();
3666 self
3667 }
3668 }
3669
3670 #[doc(hidden)]
3671 impl crate::RequestBuilder for GetAnswer {
3672 fn request_options(&mut self) -> &mut crate::RequestOptions {
3673 &mut self.0.options
3674 }
3675 }
3676
3677 #[derive(Clone, Debug)]
3694 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
3695
3696 impl CreateSession {
3697 pub(crate) fn new(
3698 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3699 ) -> Self {
3700 Self(RequestBuilder::new(stub))
3701 }
3702
3703 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
3705 self.0.request = v.into();
3706 self
3707 }
3708
3709 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3711 self.0.options = v.into();
3712 self
3713 }
3714
3715 pub async fn send(self) -> Result<crate::model::Session> {
3717 (*self.0.stub)
3718 .create_session(self.0.request, self.0.options)
3719 .await
3720 .map(crate::Response::into_body)
3721 }
3722
3723 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3727 self.0.request.parent = v.into();
3728 self
3729 }
3730
3731 pub fn set_session<T>(mut self, v: T) -> Self
3735 where
3736 T: std::convert::Into<crate::model::Session>,
3737 {
3738 self.0.request.session = std::option::Option::Some(v.into());
3739 self
3740 }
3741
3742 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3746 where
3747 T: std::convert::Into<crate::model::Session>,
3748 {
3749 self.0.request.session = v.map(|x| x.into());
3750 self
3751 }
3752 }
3753
3754 #[doc(hidden)]
3755 impl crate::RequestBuilder for CreateSession {
3756 fn request_options(&mut self) -> &mut crate::RequestOptions {
3757 &mut self.0.options
3758 }
3759 }
3760
3761 #[derive(Clone, Debug)]
3778 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
3779
3780 impl DeleteSession {
3781 pub(crate) fn new(
3782 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3783 ) -> Self {
3784 Self(RequestBuilder::new(stub))
3785 }
3786
3787 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
3789 self.0.request = v.into();
3790 self
3791 }
3792
3793 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3795 self.0.options = v.into();
3796 self
3797 }
3798
3799 pub async fn send(self) -> Result<()> {
3801 (*self.0.stub)
3802 .delete_session(self.0.request, self.0.options)
3803 .await
3804 .map(crate::Response::into_body)
3805 }
3806
3807 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3811 self.0.request.name = v.into();
3812 self
3813 }
3814 }
3815
3816 #[doc(hidden)]
3817 impl crate::RequestBuilder for DeleteSession {
3818 fn request_options(&mut self) -> &mut crate::RequestOptions {
3819 &mut self.0.options
3820 }
3821 }
3822
3823 #[derive(Clone, Debug)]
3840 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
3841
3842 impl UpdateSession {
3843 pub(crate) fn new(
3844 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3845 ) -> Self {
3846 Self(RequestBuilder::new(stub))
3847 }
3848
3849 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
3851 self.0.request = v.into();
3852 self
3853 }
3854
3855 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3857 self.0.options = v.into();
3858 self
3859 }
3860
3861 pub async fn send(self) -> Result<crate::model::Session> {
3863 (*self.0.stub)
3864 .update_session(self.0.request, self.0.options)
3865 .await
3866 .map(crate::Response::into_body)
3867 }
3868
3869 pub fn set_session<T>(mut self, v: T) -> Self
3873 where
3874 T: std::convert::Into<crate::model::Session>,
3875 {
3876 self.0.request.session = std::option::Option::Some(v.into());
3877 self
3878 }
3879
3880 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3884 where
3885 T: std::convert::Into<crate::model::Session>,
3886 {
3887 self.0.request.session = v.map(|x| x.into());
3888 self
3889 }
3890
3891 pub fn set_update_mask<T>(mut self, v: T) -> Self
3893 where
3894 T: std::convert::Into<wkt::FieldMask>,
3895 {
3896 self.0.request.update_mask = std::option::Option::Some(v.into());
3897 self
3898 }
3899
3900 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3902 where
3903 T: std::convert::Into<wkt::FieldMask>,
3904 {
3905 self.0.request.update_mask = v.map(|x| x.into());
3906 self
3907 }
3908 }
3909
3910 #[doc(hidden)]
3911 impl crate::RequestBuilder for UpdateSession {
3912 fn request_options(&mut self) -> &mut crate::RequestOptions {
3913 &mut self.0.options
3914 }
3915 }
3916
3917 #[derive(Clone, Debug)]
3934 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
3935
3936 impl GetSession {
3937 pub(crate) fn new(
3938 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3939 ) -> Self {
3940 Self(RequestBuilder::new(stub))
3941 }
3942
3943 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
3945 self.0.request = v.into();
3946 self
3947 }
3948
3949 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3951 self.0.options = v.into();
3952 self
3953 }
3954
3955 pub async fn send(self) -> Result<crate::model::Session> {
3957 (*self.0.stub)
3958 .get_session(self.0.request, self.0.options)
3959 .await
3960 .map(crate::Response::into_body)
3961 }
3962
3963 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3967 self.0.request.name = v.into();
3968 self
3969 }
3970
3971 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
3973 self.0.request.include_answer_details = v.into();
3974 self
3975 }
3976 }
3977
3978 #[doc(hidden)]
3979 impl crate::RequestBuilder for GetSession {
3980 fn request_options(&mut self) -> &mut crate::RequestOptions {
3981 &mut self.0.options
3982 }
3983 }
3984
3985 #[derive(Clone, Debug)]
4006 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
4007
4008 impl ListSessions {
4009 pub(crate) fn new(
4010 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4011 ) -> Self {
4012 Self(RequestBuilder::new(stub))
4013 }
4014
4015 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
4017 self.0.request = v.into();
4018 self
4019 }
4020
4021 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4023 self.0.options = v.into();
4024 self
4025 }
4026
4027 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
4029 (*self.0.stub)
4030 .list_sessions(self.0.request, self.0.options)
4031 .await
4032 .map(crate::Response::into_body)
4033 }
4034
4035 pub fn by_page(
4037 self,
4038 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
4039 {
4040 use std::clone::Clone;
4041 let token = self.0.request.page_token.clone();
4042 let execute = move |token: String| {
4043 let mut builder = self.clone();
4044 builder.0.request = builder.0.request.set_page_token(token);
4045 builder.send()
4046 };
4047 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4048 }
4049
4050 pub fn by_item(
4052 self,
4053 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4054 crate::model::ListSessionsResponse,
4055 crate::Error,
4056 > {
4057 use google_cloud_gax::paginator::Paginator;
4058 self.by_page().items()
4059 }
4060
4061 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4065 self.0.request.parent = v.into();
4066 self
4067 }
4068
4069 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4071 self.0.request.page_size = v.into();
4072 self
4073 }
4074
4075 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4077 self.0.request.page_token = v.into();
4078 self
4079 }
4080
4081 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4083 self.0.request.filter = v.into();
4084 self
4085 }
4086
4087 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4089 self.0.request.order_by = v.into();
4090 self
4091 }
4092 }
4093
4094 #[doc(hidden)]
4095 impl crate::RequestBuilder for ListSessions {
4096 fn request_options(&mut self) -> &mut crate::RequestOptions {
4097 &mut self.0.options
4098 }
4099 }
4100
4101 #[derive(Clone, Debug)]
4122 pub struct ListOperations(
4123 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4124 );
4125
4126 impl ListOperations {
4127 pub(crate) fn new(
4128 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4129 ) -> Self {
4130 Self(RequestBuilder::new(stub))
4131 }
4132
4133 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4135 mut self,
4136 v: V,
4137 ) -> Self {
4138 self.0.request = v.into();
4139 self
4140 }
4141
4142 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4144 self.0.options = v.into();
4145 self
4146 }
4147
4148 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4150 (*self.0.stub)
4151 .list_operations(self.0.request, self.0.options)
4152 .await
4153 .map(crate::Response::into_body)
4154 }
4155
4156 pub fn by_page(
4158 self,
4159 ) -> impl google_cloud_gax::paginator::Paginator<
4160 google_cloud_longrunning::model::ListOperationsResponse,
4161 crate::Error,
4162 > {
4163 use std::clone::Clone;
4164 let token = self.0.request.page_token.clone();
4165 let execute = move |token: String| {
4166 let mut builder = self.clone();
4167 builder.0.request = builder.0.request.set_page_token(token);
4168 builder.send()
4169 };
4170 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4171 }
4172
4173 pub fn by_item(
4175 self,
4176 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4177 google_cloud_longrunning::model::ListOperationsResponse,
4178 crate::Error,
4179 > {
4180 use google_cloud_gax::paginator::Paginator;
4181 self.by_page().items()
4182 }
4183
4184 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4186 self.0.request.name = v.into();
4187 self
4188 }
4189
4190 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4192 self.0.request.filter = v.into();
4193 self
4194 }
4195
4196 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4198 self.0.request.page_size = v.into();
4199 self
4200 }
4201
4202 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4204 self.0.request.page_token = v.into();
4205 self
4206 }
4207
4208 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4210 self.0.request.return_partial_success = v.into();
4211 self
4212 }
4213 }
4214
4215 #[doc(hidden)]
4216 impl crate::RequestBuilder for ListOperations {
4217 fn request_options(&mut self) -> &mut crate::RequestOptions {
4218 &mut self.0.options
4219 }
4220 }
4221
4222 #[derive(Clone, Debug)]
4239 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4240
4241 impl GetOperation {
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<google_cloud_longrunning::model::GetOperationRequest>>(
4250 mut self,
4251 v: V,
4252 ) -> Self {
4253 self.0.request = v.into();
4254 self
4255 }
4256
4257 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4259 self.0.options = v.into();
4260 self
4261 }
4262
4263 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4265 (*self.0.stub)
4266 .get_operation(self.0.request, self.0.options)
4267 .await
4268 .map(crate::Response::into_body)
4269 }
4270
4271 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4273 self.0.request.name = v.into();
4274 self
4275 }
4276 }
4277
4278 #[doc(hidden)]
4279 impl crate::RequestBuilder for GetOperation {
4280 fn request_options(&mut self) -> &mut crate::RequestOptions {
4281 &mut self.0.options
4282 }
4283 }
4284
4285 #[derive(Clone, Debug)]
4302 pub struct CancelOperation(
4303 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
4304 );
4305
4306 impl CancelOperation {
4307 pub(crate) fn new(
4308 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4309 ) -> Self {
4310 Self(RequestBuilder::new(stub))
4311 }
4312
4313 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
4315 mut self,
4316 v: V,
4317 ) -> Self {
4318 self.0.request = v.into();
4319 self
4320 }
4321
4322 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4324 self.0.options = v.into();
4325 self
4326 }
4327
4328 pub async fn send(self) -> Result<()> {
4330 (*self.0.stub)
4331 .cancel_operation(self.0.request, self.0.options)
4332 .await
4333 .map(crate::Response::into_body)
4334 }
4335
4336 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4338 self.0.request.name = v.into();
4339 self
4340 }
4341 }
4342
4343 #[doc(hidden)]
4344 impl crate::RequestBuilder for CancelOperation {
4345 fn request_options(&mut self) -> &mut crate::RequestOptions {
4346 &mut self.0.options
4347 }
4348 }
4349}
4350
4351#[cfg(feature = "data-store-service")]
4352#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4353pub mod data_store_service {
4354 use crate::Result;
4355
4356 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4370
4371 pub(crate) mod client {
4372 use super::super::super::client::DataStoreService;
4373 pub struct Factory;
4374 impl crate::ClientFactory for Factory {
4375 type Client = DataStoreService;
4376 type Credentials = gaxi::options::Credentials;
4377 async fn build(
4378 self,
4379 config: gaxi::options::ClientConfig,
4380 ) -> crate::ClientBuilderResult<Self::Client> {
4381 Self::Client::new(config).await
4382 }
4383 }
4384 }
4385
4386 #[derive(Clone, Debug)]
4388 pub(crate) struct RequestBuilder<R: std::default::Default> {
4389 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4390 request: R,
4391 options: crate::RequestOptions,
4392 }
4393
4394 impl<R> RequestBuilder<R>
4395 where
4396 R: std::default::Default,
4397 {
4398 pub(crate) fn new(
4399 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4400 ) -> Self {
4401 Self {
4402 stub,
4403 request: R::default(),
4404 options: crate::RequestOptions::default(),
4405 }
4406 }
4407 }
4408
4409 #[derive(Clone, Debug)]
4427 pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4428
4429 impl CreateDataStore {
4430 pub(crate) fn new(
4431 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4432 ) -> Self {
4433 Self(RequestBuilder::new(stub))
4434 }
4435
4436 pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4438 self.0.request = v.into();
4439 self
4440 }
4441
4442 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4444 self.0.options = v.into();
4445 self
4446 }
4447
4448 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4455 (*self.0.stub)
4456 .create_data_store(self.0.request, self.0.options)
4457 .await
4458 .map(crate::Response::into_body)
4459 }
4460
4461 pub fn poller(
4463 self,
4464 ) -> impl google_cloud_lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4465 {
4466 type Operation = google_cloud_lro::internal::Operation<
4467 crate::model::DataStore,
4468 crate::model::CreateDataStoreMetadata,
4469 >;
4470 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4471 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4472
4473 let stub = self.0.stub.clone();
4474 let mut options = self.0.options.clone();
4475 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4476 let query = move |name| {
4477 let stub = stub.clone();
4478 let options = options.clone();
4479 async {
4480 let op = GetOperation::new(stub)
4481 .set_name(name)
4482 .with_options(options)
4483 .send()
4484 .await?;
4485 Ok(Operation::new(op))
4486 }
4487 };
4488
4489 let start = move || async {
4490 let op = self.send().await?;
4491 Ok(Operation::new(op))
4492 };
4493
4494 google_cloud_lro::internal::new_poller(
4495 polling_error_policy,
4496 polling_backoff_policy,
4497 start,
4498 query,
4499 )
4500 }
4501
4502 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4506 self.0.request.parent = v.into();
4507 self
4508 }
4509
4510 pub fn set_data_store<T>(mut self, v: T) -> Self
4514 where
4515 T: std::convert::Into<crate::model::DataStore>,
4516 {
4517 self.0.request.data_store = std::option::Option::Some(v.into());
4518 self
4519 }
4520
4521 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4525 where
4526 T: std::convert::Into<crate::model::DataStore>,
4527 {
4528 self.0.request.data_store = v.map(|x| x.into());
4529 self
4530 }
4531
4532 pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4536 self.0.request.data_store_id = v.into();
4537 self
4538 }
4539
4540 pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
4542 self.0.request.create_advanced_site_search = v.into();
4543 self
4544 }
4545
4546 pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
4548 self.0.request.skip_default_schema_creation = v.into();
4549 self
4550 }
4551
4552 pub fn set_cmek_options<
4557 T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
4558 >(
4559 mut self,
4560 v: T,
4561 ) -> Self {
4562 self.0.request.cmek_options = v.into();
4563 self
4564 }
4565
4566 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
4572 mut self,
4573 v: T,
4574 ) -> Self {
4575 self.0.request = self.0.request.set_cmek_config_name(v);
4576 self
4577 }
4578
4579 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4585 self.0.request = self.0.request.set_disable_cmek(v);
4586 self
4587 }
4588 }
4589
4590 #[doc(hidden)]
4591 impl crate::RequestBuilder for CreateDataStore {
4592 fn request_options(&mut self) -> &mut crate::RequestOptions {
4593 &mut self.0.options
4594 }
4595 }
4596
4597 #[derive(Clone, Debug)]
4614 pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
4615
4616 impl GetDataStore {
4617 pub(crate) fn new(
4618 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4619 ) -> Self {
4620 Self(RequestBuilder::new(stub))
4621 }
4622
4623 pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
4625 self.0.request = v.into();
4626 self
4627 }
4628
4629 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4631 self.0.options = v.into();
4632 self
4633 }
4634
4635 pub async fn send(self) -> Result<crate::model::DataStore> {
4637 (*self.0.stub)
4638 .get_data_store(self.0.request, self.0.options)
4639 .await
4640 .map(crate::Response::into_body)
4641 }
4642
4643 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
4652 #[doc(hidden)]
4653 impl crate::RequestBuilder for GetDataStore {
4654 fn request_options(&mut self) -> &mut crate::RequestOptions {
4655 &mut self.0.options
4656 }
4657 }
4658
4659 #[derive(Clone, Debug)]
4680 pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
4681
4682 impl ListDataStores {
4683 pub(crate) fn new(
4684 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4685 ) -> Self {
4686 Self(RequestBuilder::new(stub))
4687 }
4688
4689 pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
4691 self.0.request = v.into();
4692 self
4693 }
4694
4695 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4697 self.0.options = v.into();
4698 self
4699 }
4700
4701 pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
4703 (*self.0.stub)
4704 .list_data_stores(self.0.request, self.0.options)
4705 .await
4706 .map(crate::Response::into_body)
4707 }
4708
4709 pub fn by_page(
4711 self,
4712 ) -> impl google_cloud_gax::paginator::Paginator<
4713 crate::model::ListDataStoresResponse,
4714 crate::Error,
4715 > {
4716 use std::clone::Clone;
4717 let token = self.0.request.page_token.clone();
4718 let execute = move |token: String| {
4719 let mut builder = self.clone();
4720 builder.0.request = builder.0.request.set_page_token(token);
4721 builder.send()
4722 };
4723 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4724 }
4725
4726 pub fn by_item(
4728 self,
4729 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4730 crate::model::ListDataStoresResponse,
4731 crate::Error,
4732 > {
4733 use google_cloud_gax::paginator::Paginator;
4734 self.by_page().items()
4735 }
4736
4737 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4741 self.0.request.parent = v.into();
4742 self
4743 }
4744
4745 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4747 self.0.request.page_size = v.into();
4748 self
4749 }
4750
4751 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4753 self.0.request.page_token = v.into();
4754 self
4755 }
4756
4757 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4759 self.0.request.filter = v.into();
4760 self
4761 }
4762 }
4763
4764 #[doc(hidden)]
4765 impl crate::RequestBuilder for ListDataStores {
4766 fn request_options(&mut self) -> &mut crate::RequestOptions {
4767 &mut self.0.options
4768 }
4769 }
4770
4771 #[derive(Clone, Debug)]
4789 pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
4790
4791 impl DeleteDataStore {
4792 pub(crate) fn new(
4793 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4794 ) -> Self {
4795 Self(RequestBuilder::new(stub))
4796 }
4797
4798 pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
4800 self.0.request = v.into();
4801 self
4802 }
4803
4804 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4806 self.0.options = v.into();
4807 self
4808 }
4809
4810 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4817 (*self.0.stub)
4818 .delete_data_store(self.0.request, self.0.options)
4819 .await
4820 .map(crate::Response::into_body)
4821 }
4822
4823 pub fn poller(
4825 self,
4826 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
4827 type Operation = google_cloud_lro::internal::Operation<
4828 wkt::Empty,
4829 crate::model::DeleteDataStoreMetadata,
4830 >;
4831 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4832 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4833
4834 let stub = self.0.stub.clone();
4835 let mut options = self.0.options.clone();
4836 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4837 let query = move |name| {
4838 let stub = stub.clone();
4839 let options = options.clone();
4840 async {
4841 let op = GetOperation::new(stub)
4842 .set_name(name)
4843 .with_options(options)
4844 .send()
4845 .await?;
4846 Ok(Operation::new(op))
4847 }
4848 };
4849
4850 let start = move || async {
4851 let op = self.send().await?;
4852 Ok(Operation::new(op))
4853 };
4854
4855 google_cloud_lro::internal::new_unit_response_poller(
4856 polling_error_policy,
4857 polling_backoff_policy,
4858 start,
4859 query,
4860 )
4861 }
4862
4863 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4867 self.0.request.name = v.into();
4868 self
4869 }
4870 }
4871
4872 #[doc(hidden)]
4873 impl crate::RequestBuilder for DeleteDataStore {
4874 fn request_options(&mut self) -> &mut crate::RequestOptions {
4875 &mut self.0.options
4876 }
4877 }
4878
4879 #[derive(Clone, Debug)]
4896 pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
4897
4898 impl UpdateDataStore {
4899 pub(crate) fn new(
4900 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4901 ) -> Self {
4902 Self(RequestBuilder::new(stub))
4903 }
4904
4905 pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
4907 self.0.request = v.into();
4908 self
4909 }
4910
4911 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4913 self.0.options = v.into();
4914 self
4915 }
4916
4917 pub async fn send(self) -> Result<crate::model::DataStore> {
4919 (*self.0.stub)
4920 .update_data_store(self.0.request, self.0.options)
4921 .await
4922 .map(crate::Response::into_body)
4923 }
4924
4925 pub fn set_data_store<T>(mut self, v: T) -> Self
4929 where
4930 T: std::convert::Into<crate::model::DataStore>,
4931 {
4932 self.0.request.data_store = std::option::Option::Some(v.into());
4933 self
4934 }
4935
4936 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4940 where
4941 T: std::convert::Into<crate::model::DataStore>,
4942 {
4943 self.0.request.data_store = v.map(|x| x.into());
4944 self
4945 }
4946
4947 pub fn set_update_mask<T>(mut self, v: T) -> Self
4949 where
4950 T: std::convert::Into<wkt::FieldMask>,
4951 {
4952 self.0.request.update_mask = std::option::Option::Some(v.into());
4953 self
4954 }
4955
4956 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4958 where
4959 T: std::convert::Into<wkt::FieldMask>,
4960 {
4961 self.0.request.update_mask = v.map(|x| x.into());
4962 self
4963 }
4964 }
4965
4966 #[doc(hidden)]
4967 impl crate::RequestBuilder for UpdateDataStore {
4968 fn request_options(&mut self) -> &mut crate::RequestOptions {
4969 &mut self.0.options
4970 }
4971 }
4972
4973 #[derive(Clone, Debug)]
4994 pub struct ListOperations(
4995 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4996 );
4997
4998 impl ListOperations {
4999 pub(crate) fn new(
5000 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5001 ) -> Self {
5002 Self(RequestBuilder::new(stub))
5003 }
5004
5005 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5007 mut self,
5008 v: V,
5009 ) -> Self {
5010 self.0.request = v.into();
5011 self
5012 }
5013
5014 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5016 self.0.options = v.into();
5017 self
5018 }
5019
5020 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5022 (*self.0.stub)
5023 .list_operations(self.0.request, self.0.options)
5024 .await
5025 .map(crate::Response::into_body)
5026 }
5027
5028 pub fn by_page(
5030 self,
5031 ) -> impl google_cloud_gax::paginator::Paginator<
5032 google_cloud_longrunning::model::ListOperationsResponse,
5033 crate::Error,
5034 > {
5035 use std::clone::Clone;
5036 let token = self.0.request.page_token.clone();
5037 let execute = move |token: String| {
5038 let mut builder = self.clone();
5039 builder.0.request = builder.0.request.set_page_token(token);
5040 builder.send()
5041 };
5042 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5043 }
5044
5045 pub fn by_item(
5047 self,
5048 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5049 google_cloud_longrunning::model::ListOperationsResponse,
5050 crate::Error,
5051 > {
5052 use google_cloud_gax::paginator::Paginator;
5053 self.by_page().items()
5054 }
5055
5056 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5058 self.0.request.name = v.into();
5059 self
5060 }
5061
5062 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5064 self.0.request.filter = v.into();
5065 self
5066 }
5067
5068 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5070 self.0.request.page_size = v.into();
5071 self
5072 }
5073
5074 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5076 self.0.request.page_token = v.into();
5077 self
5078 }
5079
5080 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5082 self.0.request.return_partial_success = v.into();
5083 self
5084 }
5085 }
5086
5087 #[doc(hidden)]
5088 impl crate::RequestBuilder for ListOperations {
5089 fn request_options(&mut self) -> &mut crate::RequestOptions {
5090 &mut self.0.options
5091 }
5092 }
5093
5094 #[derive(Clone, Debug)]
5111 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5112
5113 impl GetOperation {
5114 pub(crate) fn new(
5115 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5116 ) -> Self {
5117 Self(RequestBuilder::new(stub))
5118 }
5119
5120 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5122 mut self,
5123 v: V,
5124 ) -> Self {
5125 self.0.request = v.into();
5126 self
5127 }
5128
5129 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5131 self.0.options = v.into();
5132 self
5133 }
5134
5135 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5137 (*self.0.stub)
5138 .get_operation(self.0.request, self.0.options)
5139 .await
5140 .map(crate::Response::into_body)
5141 }
5142
5143 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5145 self.0.request.name = v.into();
5146 self
5147 }
5148 }
5149
5150 #[doc(hidden)]
5151 impl crate::RequestBuilder for GetOperation {
5152 fn request_options(&mut self) -> &mut crate::RequestOptions {
5153 &mut self.0.options
5154 }
5155 }
5156
5157 #[derive(Clone, Debug)]
5174 pub struct CancelOperation(
5175 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
5176 );
5177
5178 impl CancelOperation {
5179 pub(crate) fn new(
5180 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5181 ) -> Self {
5182 Self(RequestBuilder::new(stub))
5183 }
5184
5185 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
5187 mut self,
5188 v: V,
5189 ) -> Self {
5190 self.0.request = v.into();
5191 self
5192 }
5193
5194 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5196 self.0.options = v.into();
5197 self
5198 }
5199
5200 pub async fn send(self) -> Result<()> {
5202 (*self.0.stub)
5203 .cancel_operation(self.0.request, self.0.options)
5204 .await
5205 .map(crate::Response::into_body)
5206 }
5207
5208 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5210 self.0.request.name = v.into();
5211 self
5212 }
5213 }
5214
5215 #[doc(hidden)]
5216 impl crate::RequestBuilder for CancelOperation {
5217 fn request_options(&mut self) -> &mut crate::RequestOptions {
5218 &mut self.0.options
5219 }
5220 }
5221}
5222
5223#[cfg(feature = "document-service")]
5224#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5225pub mod document_service {
5226 use crate::Result;
5227
5228 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5242
5243 pub(crate) mod client {
5244 use super::super::super::client::DocumentService;
5245 pub struct Factory;
5246 impl crate::ClientFactory for Factory {
5247 type Client = DocumentService;
5248 type Credentials = gaxi::options::Credentials;
5249 async fn build(
5250 self,
5251 config: gaxi::options::ClientConfig,
5252 ) -> crate::ClientBuilderResult<Self::Client> {
5253 Self::Client::new(config).await
5254 }
5255 }
5256 }
5257
5258 #[derive(Clone, Debug)]
5260 pub(crate) struct RequestBuilder<R: std::default::Default> {
5261 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5262 request: R,
5263 options: crate::RequestOptions,
5264 }
5265
5266 impl<R> RequestBuilder<R>
5267 where
5268 R: std::default::Default,
5269 {
5270 pub(crate) fn new(
5271 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5272 ) -> Self {
5273 Self {
5274 stub,
5275 request: R::default(),
5276 options: crate::RequestOptions::default(),
5277 }
5278 }
5279 }
5280
5281 #[derive(Clone, Debug)]
5298 pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5299
5300 impl GetDocument {
5301 pub(crate) fn new(
5302 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5303 ) -> Self {
5304 Self(RequestBuilder::new(stub))
5305 }
5306
5307 pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5309 self.0.request = v.into();
5310 self
5311 }
5312
5313 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5315 self.0.options = v.into();
5316 self
5317 }
5318
5319 pub async fn send(self) -> Result<crate::model::Document> {
5321 (*self.0.stub)
5322 .get_document(self.0.request, self.0.options)
5323 .await
5324 .map(crate::Response::into_body)
5325 }
5326
5327 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5331 self.0.request.name = v.into();
5332 self
5333 }
5334 }
5335
5336 #[doc(hidden)]
5337 impl crate::RequestBuilder for GetDocument {
5338 fn request_options(&mut self) -> &mut crate::RequestOptions {
5339 &mut self.0.options
5340 }
5341 }
5342
5343 #[derive(Clone, Debug)]
5364 pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5365
5366 impl ListDocuments {
5367 pub(crate) fn new(
5368 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5369 ) -> Self {
5370 Self(RequestBuilder::new(stub))
5371 }
5372
5373 pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5375 self.0.request = v.into();
5376 self
5377 }
5378
5379 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5381 self.0.options = v.into();
5382 self
5383 }
5384
5385 pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5387 (*self.0.stub)
5388 .list_documents(self.0.request, self.0.options)
5389 .await
5390 .map(crate::Response::into_body)
5391 }
5392
5393 pub fn by_page(
5395 self,
5396 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDocumentsResponse, crate::Error>
5397 {
5398 use std::clone::Clone;
5399 let token = self.0.request.page_token.clone();
5400 let execute = move |token: String| {
5401 let mut builder = self.clone();
5402 builder.0.request = builder.0.request.set_page_token(token);
5403 builder.send()
5404 };
5405 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5406 }
5407
5408 pub fn by_item(
5410 self,
5411 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5412 crate::model::ListDocumentsResponse,
5413 crate::Error,
5414 > {
5415 use google_cloud_gax::paginator::Paginator;
5416 self.by_page().items()
5417 }
5418
5419 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5423 self.0.request.parent = v.into();
5424 self
5425 }
5426
5427 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5429 self.0.request.page_size = v.into();
5430 self
5431 }
5432
5433 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5435 self.0.request.page_token = v.into();
5436 self
5437 }
5438 }
5439
5440 #[doc(hidden)]
5441 impl crate::RequestBuilder for ListDocuments {
5442 fn request_options(&mut self) -> &mut crate::RequestOptions {
5443 &mut self.0.options
5444 }
5445 }
5446
5447 #[derive(Clone, Debug)]
5464 pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5465
5466 impl CreateDocument {
5467 pub(crate) fn new(
5468 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5469 ) -> Self {
5470 Self(RequestBuilder::new(stub))
5471 }
5472
5473 pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5475 self.0.request = v.into();
5476 self
5477 }
5478
5479 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5481 self.0.options = v.into();
5482 self
5483 }
5484
5485 pub async fn send(self) -> Result<crate::model::Document> {
5487 (*self.0.stub)
5488 .create_document(self.0.request, self.0.options)
5489 .await
5490 .map(crate::Response::into_body)
5491 }
5492
5493 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5497 self.0.request.parent = v.into();
5498 self
5499 }
5500
5501 pub fn set_document<T>(mut self, v: T) -> Self
5505 where
5506 T: std::convert::Into<crate::model::Document>,
5507 {
5508 self.0.request.document = std::option::Option::Some(v.into());
5509 self
5510 }
5511
5512 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5516 where
5517 T: std::convert::Into<crate::model::Document>,
5518 {
5519 self.0.request.document = v.map(|x| x.into());
5520 self
5521 }
5522
5523 pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5527 self.0.request.document_id = v.into();
5528 self
5529 }
5530 }
5531
5532 #[doc(hidden)]
5533 impl crate::RequestBuilder for CreateDocument {
5534 fn request_options(&mut self) -> &mut crate::RequestOptions {
5535 &mut self.0.options
5536 }
5537 }
5538
5539 #[derive(Clone, Debug)]
5556 pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
5557
5558 impl UpdateDocument {
5559 pub(crate) fn new(
5560 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5561 ) -> Self {
5562 Self(RequestBuilder::new(stub))
5563 }
5564
5565 pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
5567 self.0.request = v.into();
5568 self
5569 }
5570
5571 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5573 self.0.options = v.into();
5574 self
5575 }
5576
5577 pub async fn send(self) -> Result<crate::model::Document> {
5579 (*self.0.stub)
5580 .update_document(self.0.request, self.0.options)
5581 .await
5582 .map(crate::Response::into_body)
5583 }
5584
5585 pub fn set_document<T>(mut self, v: T) -> Self
5589 where
5590 T: std::convert::Into<crate::model::Document>,
5591 {
5592 self.0.request.document = std::option::Option::Some(v.into());
5593 self
5594 }
5595
5596 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5600 where
5601 T: std::convert::Into<crate::model::Document>,
5602 {
5603 self.0.request.document = v.map(|x| x.into());
5604 self
5605 }
5606
5607 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5609 self.0.request.allow_missing = v.into();
5610 self
5611 }
5612
5613 pub fn set_update_mask<T>(mut self, v: T) -> Self
5615 where
5616 T: std::convert::Into<wkt::FieldMask>,
5617 {
5618 self.0.request.update_mask = std::option::Option::Some(v.into());
5619 self
5620 }
5621
5622 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5624 where
5625 T: std::convert::Into<wkt::FieldMask>,
5626 {
5627 self.0.request.update_mask = v.map(|x| x.into());
5628 self
5629 }
5630 }
5631
5632 #[doc(hidden)]
5633 impl crate::RequestBuilder for UpdateDocument {
5634 fn request_options(&mut self) -> &mut crate::RequestOptions {
5635 &mut self.0.options
5636 }
5637 }
5638
5639 #[derive(Clone, Debug)]
5656 pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
5657
5658 impl DeleteDocument {
5659 pub(crate) fn new(
5660 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5661 ) -> Self {
5662 Self(RequestBuilder::new(stub))
5663 }
5664
5665 pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
5667 self.0.request = v.into();
5668 self
5669 }
5670
5671 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5673 self.0.options = v.into();
5674 self
5675 }
5676
5677 pub async fn send(self) -> Result<()> {
5679 (*self.0.stub)
5680 .delete_document(self.0.request, self.0.options)
5681 .await
5682 .map(crate::Response::into_body)
5683 }
5684
5685 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5689 self.0.request.name = v.into();
5690 self
5691 }
5692 }
5693
5694 #[doc(hidden)]
5695 impl crate::RequestBuilder for DeleteDocument {
5696 fn request_options(&mut self) -> &mut crate::RequestOptions {
5697 &mut self.0.options
5698 }
5699 }
5700
5701 #[derive(Clone, Debug)]
5719 pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
5720
5721 impl ImportDocuments {
5722 pub(crate) fn new(
5723 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5724 ) -> Self {
5725 Self(RequestBuilder::new(stub))
5726 }
5727
5728 pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
5730 self.0.request = v.into();
5731 self
5732 }
5733
5734 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5736 self.0.options = v.into();
5737 self
5738 }
5739
5740 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5747 (*self.0.stub)
5748 .import_documents(self.0.request, self.0.options)
5749 .await
5750 .map(crate::Response::into_body)
5751 }
5752
5753 pub fn poller(
5755 self,
5756 ) -> impl google_cloud_lro::Poller<
5757 crate::model::ImportDocumentsResponse,
5758 crate::model::ImportDocumentsMetadata,
5759 > {
5760 type Operation = google_cloud_lro::internal::Operation<
5761 crate::model::ImportDocumentsResponse,
5762 crate::model::ImportDocumentsMetadata,
5763 >;
5764 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5765 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5766
5767 let stub = self.0.stub.clone();
5768 let mut options = self.0.options.clone();
5769 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5770 let query = move |name| {
5771 let stub = stub.clone();
5772 let options = options.clone();
5773 async {
5774 let op = GetOperation::new(stub)
5775 .set_name(name)
5776 .with_options(options)
5777 .send()
5778 .await?;
5779 Ok(Operation::new(op))
5780 }
5781 };
5782
5783 let start = move || async {
5784 let op = self.send().await?;
5785 Ok(Operation::new(op))
5786 };
5787
5788 google_cloud_lro::internal::new_poller(
5789 polling_error_policy,
5790 polling_backoff_policy,
5791 start,
5792 query,
5793 )
5794 }
5795
5796 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5800 self.0.request.parent = v.into();
5801 self
5802 }
5803
5804 pub fn set_error_config<T>(mut self, v: T) -> Self
5806 where
5807 T: std::convert::Into<crate::model::ImportErrorConfig>,
5808 {
5809 self.0.request.error_config = std::option::Option::Some(v.into());
5810 self
5811 }
5812
5813 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
5815 where
5816 T: std::convert::Into<crate::model::ImportErrorConfig>,
5817 {
5818 self.0.request.error_config = v.map(|x| x.into());
5819 self
5820 }
5821
5822 pub fn set_reconciliation_mode<
5824 T: Into<crate::model::import_documents_request::ReconciliationMode>,
5825 >(
5826 mut self,
5827 v: T,
5828 ) -> Self {
5829 self.0.request.reconciliation_mode = v.into();
5830 self
5831 }
5832
5833 pub fn set_update_mask<T>(mut self, v: T) -> Self
5835 where
5836 T: std::convert::Into<wkt::FieldMask>,
5837 {
5838 self.0.request.update_mask = std::option::Option::Some(v.into());
5839 self
5840 }
5841
5842 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5844 where
5845 T: std::convert::Into<wkt::FieldMask>,
5846 {
5847 self.0.request.update_mask = v.map(|x| x.into());
5848 self
5849 }
5850
5851 pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
5853 self.0.request.auto_generate_ids = v.into();
5854 self
5855 }
5856
5857 pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
5859 self.0.request.id_field = v.into();
5860 self
5861 }
5862
5863 pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
5865 self.0.request.force_refresh_content = v.into();
5866 self
5867 }
5868
5869 pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
5874 mut self,
5875 v: T,
5876 ) -> Self {
5877 self.0.request.source = v.into();
5878 self
5879 }
5880
5881 pub fn set_inline_source<
5887 T: std::convert::Into<
5888 std::boxed::Box<crate::model::import_documents_request::InlineSource>,
5889 >,
5890 >(
5891 mut self,
5892 v: T,
5893 ) -> Self {
5894 self.0.request = self.0.request.set_inline_source(v);
5895 self
5896 }
5897
5898 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
5904 mut self,
5905 v: T,
5906 ) -> Self {
5907 self.0.request = self.0.request.set_gcs_source(v);
5908 self
5909 }
5910
5911 pub fn set_bigquery_source<
5917 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
5918 >(
5919 mut self,
5920 v: T,
5921 ) -> Self {
5922 self.0.request = self.0.request.set_bigquery_source(v);
5923 self
5924 }
5925
5926 pub fn set_fhir_store_source<
5932 T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
5933 >(
5934 mut self,
5935 v: T,
5936 ) -> Self {
5937 self.0.request = self.0.request.set_fhir_store_source(v);
5938 self
5939 }
5940
5941 pub fn set_spanner_source<
5947 T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
5948 >(
5949 mut self,
5950 v: T,
5951 ) -> Self {
5952 self.0.request = self.0.request.set_spanner_source(v);
5953 self
5954 }
5955
5956 pub fn set_cloud_sql_source<
5962 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
5963 >(
5964 mut self,
5965 v: T,
5966 ) -> Self {
5967 self.0.request = self.0.request.set_cloud_sql_source(v);
5968 self
5969 }
5970
5971 pub fn set_firestore_source<
5977 T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
5978 >(
5979 mut self,
5980 v: T,
5981 ) -> Self {
5982 self.0.request = self.0.request.set_firestore_source(v);
5983 self
5984 }
5985
5986 pub fn set_alloy_db_source<
5992 T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
5993 >(
5994 mut self,
5995 v: T,
5996 ) -> Self {
5997 self.0.request = self.0.request.set_alloy_db_source(v);
5998 self
5999 }
6000
6001 pub fn set_bigtable_source<
6007 T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
6008 >(
6009 mut self,
6010 v: T,
6011 ) -> Self {
6012 self.0.request = self.0.request.set_bigtable_source(v);
6013 self
6014 }
6015 }
6016
6017 #[doc(hidden)]
6018 impl crate::RequestBuilder for ImportDocuments {
6019 fn request_options(&mut self) -> &mut crate::RequestOptions {
6020 &mut self.0.options
6021 }
6022 }
6023
6024 #[derive(Clone, Debug)]
6042 pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
6043
6044 impl PurgeDocuments {
6045 pub(crate) fn new(
6046 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6047 ) -> Self {
6048 Self(RequestBuilder::new(stub))
6049 }
6050
6051 pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
6053 self.0.request = v.into();
6054 self
6055 }
6056
6057 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6059 self.0.options = v.into();
6060 self
6061 }
6062
6063 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6070 (*self.0.stub)
6071 .purge_documents(self.0.request, self.0.options)
6072 .await
6073 .map(crate::Response::into_body)
6074 }
6075
6076 pub fn poller(
6078 self,
6079 ) -> impl google_cloud_lro::Poller<
6080 crate::model::PurgeDocumentsResponse,
6081 crate::model::PurgeDocumentsMetadata,
6082 > {
6083 type Operation = google_cloud_lro::internal::Operation<
6084 crate::model::PurgeDocumentsResponse,
6085 crate::model::PurgeDocumentsMetadata,
6086 >;
6087 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6088 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6089
6090 let stub = self.0.stub.clone();
6091 let mut options = self.0.options.clone();
6092 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6093 let query = move |name| {
6094 let stub = stub.clone();
6095 let options = options.clone();
6096 async {
6097 let op = GetOperation::new(stub)
6098 .set_name(name)
6099 .with_options(options)
6100 .send()
6101 .await?;
6102 Ok(Operation::new(op))
6103 }
6104 };
6105
6106 let start = move || async {
6107 let op = self.send().await?;
6108 Ok(Operation::new(op))
6109 };
6110
6111 google_cloud_lro::internal::new_poller(
6112 polling_error_policy,
6113 polling_backoff_policy,
6114 start,
6115 query,
6116 )
6117 }
6118
6119 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6123 self.0.request.parent = v.into();
6124 self
6125 }
6126
6127 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6131 self.0.request.filter = v.into();
6132 self
6133 }
6134
6135 pub fn set_error_config<T>(mut self, v: T) -> Self
6137 where
6138 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6139 {
6140 self.0.request.error_config = std::option::Option::Some(v.into());
6141 self
6142 }
6143
6144 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6146 where
6147 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6148 {
6149 self.0.request.error_config = v.map(|x| x.into());
6150 self
6151 }
6152
6153 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6155 self.0.request.force = v.into();
6156 self
6157 }
6158
6159 pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6164 mut self,
6165 v: T,
6166 ) -> Self {
6167 self.0.request.source = v.into();
6168 self
6169 }
6170
6171 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6177 mut self,
6178 v: T,
6179 ) -> Self {
6180 self.0.request = self.0.request.set_gcs_source(v);
6181 self
6182 }
6183
6184 pub fn set_inline_source<
6190 T: std::convert::Into<
6191 std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6192 >,
6193 >(
6194 mut self,
6195 v: T,
6196 ) -> Self {
6197 self.0.request = self.0.request.set_inline_source(v);
6198 self
6199 }
6200 }
6201
6202 #[doc(hidden)]
6203 impl crate::RequestBuilder for PurgeDocuments {
6204 fn request_options(&mut self) -> &mut crate::RequestOptions {
6205 &mut self.0.options
6206 }
6207 }
6208
6209 #[derive(Clone, Debug)]
6226 pub struct BatchGetDocumentsMetadata(
6227 RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6228 );
6229
6230 impl BatchGetDocumentsMetadata {
6231 pub(crate) fn new(
6232 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6233 ) -> Self {
6234 Self(RequestBuilder::new(stub))
6235 }
6236
6237 pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6239 mut self,
6240 v: V,
6241 ) -> Self {
6242 self.0.request = v.into();
6243 self
6244 }
6245
6246 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6248 self.0.options = v.into();
6249 self
6250 }
6251
6252 pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6254 (*self.0.stub)
6255 .batch_get_documents_metadata(self.0.request, self.0.options)
6256 .await
6257 .map(crate::Response::into_body)
6258 }
6259
6260 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6264 self.0.request.parent = v.into();
6265 self
6266 }
6267
6268 pub fn set_matcher<T>(mut self, v: T) -> Self
6272 where
6273 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6274 {
6275 self.0.request.matcher = std::option::Option::Some(v.into());
6276 self
6277 }
6278
6279 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6283 where
6284 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6285 {
6286 self.0.request.matcher = v.map(|x| x.into());
6287 self
6288 }
6289 }
6290
6291 #[doc(hidden)]
6292 impl crate::RequestBuilder for BatchGetDocumentsMetadata {
6293 fn request_options(&mut self) -> &mut crate::RequestOptions {
6294 &mut self.0.options
6295 }
6296 }
6297
6298 #[derive(Clone, Debug)]
6319 pub struct ListOperations(
6320 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6321 );
6322
6323 impl ListOperations {
6324 pub(crate) fn new(
6325 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6326 ) -> Self {
6327 Self(RequestBuilder::new(stub))
6328 }
6329
6330 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6332 mut self,
6333 v: V,
6334 ) -> Self {
6335 self.0.request = v.into();
6336 self
6337 }
6338
6339 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6341 self.0.options = v.into();
6342 self
6343 }
6344
6345 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6347 (*self.0.stub)
6348 .list_operations(self.0.request, self.0.options)
6349 .await
6350 .map(crate::Response::into_body)
6351 }
6352
6353 pub fn by_page(
6355 self,
6356 ) -> impl google_cloud_gax::paginator::Paginator<
6357 google_cloud_longrunning::model::ListOperationsResponse,
6358 crate::Error,
6359 > {
6360 use std::clone::Clone;
6361 let token = self.0.request.page_token.clone();
6362 let execute = move |token: String| {
6363 let mut builder = self.clone();
6364 builder.0.request = builder.0.request.set_page_token(token);
6365 builder.send()
6366 };
6367 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6368 }
6369
6370 pub fn by_item(
6372 self,
6373 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6374 google_cloud_longrunning::model::ListOperationsResponse,
6375 crate::Error,
6376 > {
6377 use google_cloud_gax::paginator::Paginator;
6378 self.by_page().items()
6379 }
6380
6381 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6383 self.0.request.name = v.into();
6384 self
6385 }
6386
6387 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6389 self.0.request.filter = v.into();
6390 self
6391 }
6392
6393 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6395 self.0.request.page_size = v.into();
6396 self
6397 }
6398
6399 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6401 self.0.request.page_token = v.into();
6402 self
6403 }
6404
6405 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6407 self.0.request.return_partial_success = v.into();
6408 self
6409 }
6410 }
6411
6412 #[doc(hidden)]
6413 impl crate::RequestBuilder for ListOperations {
6414 fn request_options(&mut self) -> &mut crate::RequestOptions {
6415 &mut self.0.options
6416 }
6417 }
6418
6419 #[derive(Clone, Debug)]
6436 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6437
6438 impl GetOperation {
6439 pub(crate) fn new(
6440 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6441 ) -> Self {
6442 Self(RequestBuilder::new(stub))
6443 }
6444
6445 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6447 mut self,
6448 v: V,
6449 ) -> Self {
6450 self.0.request = v.into();
6451 self
6452 }
6453
6454 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6456 self.0.options = v.into();
6457 self
6458 }
6459
6460 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6462 (*self.0.stub)
6463 .get_operation(self.0.request, self.0.options)
6464 .await
6465 .map(crate::Response::into_body)
6466 }
6467
6468 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6470 self.0.request.name = v.into();
6471 self
6472 }
6473 }
6474
6475 #[doc(hidden)]
6476 impl crate::RequestBuilder for GetOperation {
6477 fn request_options(&mut self) -> &mut crate::RequestOptions {
6478 &mut self.0.options
6479 }
6480 }
6481
6482 #[derive(Clone, Debug)]
6499 pub struct CancelOperation(
6500 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
6501 );
6502
6503 impl CancelOperation {
6504 pub(crate) fn new(
6505 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6506 ) -> Self {
6507 Self(RequestBuilder::new(stub))
6508 }
6509
6510 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
6512 mut self,
6513 v: V,
6514 ) -> Self {
6515 self.0.request = v.into();
6516 self
6517 }
6518
6519 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6521 self.0.options = v.into();
6522 self
6523 }
6524
6525 pub async fn send(self) -> Result<()> {
6527 (*self.0.stub)
6528 .cancel_operation(self.0.request, self.0.options)
6529 .await
6530 .map(crate::Response::into_body)
6531 }
6532
6533 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6535 self.0.request.name = v.into();
6536 self
6537 }
6538 }
6539
6540 #[doc(hidden)]
6541 impl crate::RequestBuilder for CancelOperation {
6542 fn request_options(&mut self) -> &mut crate::RequestOptions {
6543 &mut self.0.options
6544 }
6545 }
6546}
6547
6548#[cfg(feature = "engine-service")]
6549#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
6550pub mod engine_service {
6551 use crate::Result;
6552
6553 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6567
6568 pub(crate) mod client {
6569 use super::super::super::client::EngineService;
6570 pub struct Factory;
6571 impl crate::ClientFactory for Factory {
6572 type Client = EngineService;
6573 type Credentials = gaxi::options::Credentials;
6574 async fn build(
6575 self,
6576 config: gaxi::options::ClientConfig,
6577 ) -> crate::ClientBuilderResult<Self::Client> {
6578 Self::Client::new(config).await
6579 }
6580 }
6581 }
6582
6583 #[derive(Clone, Debug)]
6585 pub(crate) struct RequestBuilder<R: std::default::Default> {
6586 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6587 request: R,
6588 options: crate::RequestOptions,
6589 }
6590
6591 impl<R> RequestBuilder<R>
6592 where
6593 R: std::default::Default,
6594 {
6595 pub(crate) fn new(
6596 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6597 ) -> Self {
6598 Self {
6599 stub,
6600 request: R::default(),
6601 options: crate::RequestOptions::default(),
6602 }
6603 }
6604 }
6605
6606 #[derive(Clone, Debug)]
6624 pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
6625
6626 impl CreateEngine {
6627 pub(crate) fn new(
6628 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6629 ) -> Self {
6630 Self(RequestBuilder::new(stub))
6631 }
6632
6633 pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
6635 self.0.request = v.into();
6636 self
6637 }
6638
6639 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6641 self.0.options = v.into();
6642 self
6643 }
6644
6645 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6652 (*self.0.stub)
6653 .create_engine(self.0.request, self.0.options)
6654 .await
6655 .map(crate::Response::into_body)
6656 }
6657
6658 pub fn poller(
6660 self,
6661 ) -> impl google_cloud_lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata>
6662 {
6663 type Operation = google_cloud_lro::internal::Operation<
6664 crate::model::Engine,
6665 crate::model::CreateEngineMetadata,
6666 >;
6667 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6668 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6669
6670 let stub = self.0.stub.clone();
6671 let mut options = self.0.options.clone();
6672 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6673 let query = move |name| {
6674 let stub = stub.clone();
6675 let options = options.clone();
6676 async {
6677 let op = GetOperation::new(stub)
6678 .set_name(name)
6679 .with_options(options)
6680 .send()
6681 .await?;
6682 Ok(Operation::new(op))
6683 }
6684 };
6685
6686 let start = move || async {
6687 let op = self.send().await?;
6688 Ok(Operation::new(op))
6689 };
6690
6691 google_cloud_lro::internal::new_poller(
6692 polling_error_policy,
6693 polling_backoff_policy,
6694 start,
6695 query,
6696 )
6697 }
6698
6699 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6703 self.0.request.parent = v.into();
6704 self
6705 }
6706
6707 pub fn set_engine<T>(mut self, v: T) -> Self
6711 where
6712 T: std::convert::Into<crate::model::Engine>,
6713 {
6714 self.0.request.engine = std::option::Option::Some(v.into());
6715 self
6716 }
6717
6718 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6722 where
6723 T: std::convert::Into<crate::model::Engine>,
6724 {
6725 self.0.request.engine = v.map(|x| x.into());
6726 self
6727 }
6728
6729 pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6733 self.0.request.engine_id = v.into();
6734 self
6735 }
6736 }
6737
6738 #[doc(hidden)]
6739 impl crate::RequestBuilder for CreateEngine {
6740 fn request_options(&mut self) -> &mut crate::RequestOptions {
6741 &mut self.0.options
6742 }
6743 }
6744
6745 #[derive(Clone, Debug)]
6763 pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
6764
6765 impl DeleteEngine {
6766 pub(crate) fn new(
6767 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6768 ) -> Self {
6769 Self(RequestBuilder::new(stub))
6770 }
6771
6772 pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
6774 self.0.request = v.into();
6775 self
6776 }
6777
6778 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6780 self.0.options = v.into();
6781 self
6782 }
6783
6784 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6791 (*self.0.stub)
6792 .delete_engine(self.0.request, self.0.options)
6793 .await
6794 .map(crate::Response::into_body)
6795 }
6796
6797 pub fn poller(
6799 self,
6800 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteEngineMetadata> {
6801 type Operation = google_cloud_lro::internal::Operation<
6802 wkt::Empty,
6803 crate::model::DeleteEngineMetadata,
6804 >;
6805 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6806 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6807
6808 let stub = self.0.stub.clone();
6809 let mut options = self.0.options.clone();
6810 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6811 let query = move |name| {
6812 let stub = stub.clone();
6813 let options = options.clone();
6814 async {
6815 let op = GetOperation::new(stub)
6816 .set_name(name)
6817 .with_options(options)
6818 .send()
6819 .await?;
6820 Ok(Operation::new(op))
6821 }
6822 };
6823
6824 let start = move || async {
6825 let op = self.send().await?;
6826 Ok(Operation::new(op))
6827 };
6828
6829 google_cloud_lro::internal::new_unit_response_poller(
6830 polling_error_policy,
6831 polling_backoff_policy,
6832 start,
6833 query,
6834 )
6835 }
6836
6837 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6841 self.0.request.name = v.into();
6842 self
6843 }
6844 }
6845
6846 #[doc(hidden)]
6847 impl crate::RequestBuilder for DeleteEngine {
6848 fn request_options(&mut self) -> &mut crate::RequestOptions {
6849 &mut self.0.options
6850 }
6851 }
6852
6853 #[derive(Clone, Debug)]
6870 pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
6871
6872 impl UpdateEngine {
6873 pub(crate) fn new(
6874 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6875 ) -> Self {
6876 Self(RequestBuilder::new(stub))
6877 }
6878
6879 pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
6881 self.0.request = v.into();
6882 self
6883 }
6884
6885 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6887 self.0.options = v.into();
6888 self
6889 }
6890
6891 pub async fn send(self) -> Result<crate::model::Engine> {
6893 (*self.0.stub)
6894 .update_engine(self.0.request, self.0.options)
6895 .await
6896 .map(crate::Response::into_body)
6897 }
6898
6899 pub fn set_engine<T>(mut self, v: T) -> Self
6903 where
6904 T: std::convert::Into<crate::model::Engine>,
6905 {
6906 self.0.request.engine = std::option::Option::Some(v.into());
6907 self
6908 }
6909
6910 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6914 where
6915 T: std::convert::Into<crate::model::Engine>,
6916 {
6917 self.0.request.engine = v.map(|x| x.into());
6918 self
6919 }
6920
6921 pub fn set_update_mask<T>(mut self, v: T) -> Self
6923 where
6924 T: std::convert::Into<wkt::FieldMask>,
6925 {
6926 self.0.request.update_mask = std::option::Option::Some(v.into());
6927 self
6928 }
6929
6930 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6932 where
6933 T: std::convert::Into<wkt::FieldMask>,
6934 {
6935 self.0.request.update_mask = v.map(|x| x.into());
6936 self
6937 }
6938 }
6939
6940 #[doc(hidden)]
6941 impl crate::RequestBuilder for UpdateEngine {
6942 fn request_options(&mut self) -> &mut crate::RequestOptions {
6943 &mut self.0.options
6944 }
6945 }
6946
6947 #[derive(Clone, Debug)]
6964 pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
6965
6966 impl GetEngine {
6967 pub(crate) fn new(
6968 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6969 ) -> Self {
6970 Self(RequestBuilder::new(stub))
6971 }
6972
6973 pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
6975 self.0.request = v.into();
6976 self
6977 }
6978
6979 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6981 self.0.options = v.into();
6982 self
6983 }
6984
6985 pub async fn send(self) -> Result<crate::model::Engine> {
6987 (*self.0.stub)
6988 .get_engine(self.0.request, self.0.options)
6989 .await
6990 .map(crate::Response::into_body)
6991 }
6992
6993 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6997 self.0.request.name = v.into();
6998 self
6999 }
7000 }
7001
7002 #[doc(hidden)]
7003 impl crate::RequestBuilder for GetEngine {
7004 fn request_options(&mut self) -> &mut crate::RequestOptions {
7005 &mut self.0.options
7006 }
7007 }
7008
7009 #[derive(Clone, Debug)]
7030 pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
7031
7032 impl ListEngines {
7033 pub(crate) fn new(
7034 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7035 ) -> Self {
7036 Self(RequestBuilder::new(stub))
7037 }
7038
7039 pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
7041 self.0.request = v.into();
7042 self
7043 }
7044
7045 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7047 self.0.options = v.into();
7048 self
7049 }
7050
7051 pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
7053 (*self.0.stub)
7054 .list_engines(self.0.request, self.0.options)
7055 .await
7056 .map(crate::Response::into_body)
7057 }
7058
7059 pub fn by_page(
7061 self,
7062 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListEnginesResponse, crate::Error>
7063 {
7064 use std::clone::Clone;
7065 let token = self.0.request.page_token.clone();
7066 let execute = move |token: String| {
7067 let mut builder = self.clone();
7068 builder.0.request = builder.0.request.set_page_token(token);
7069 builder.send()
7070 };
7071 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7072 }
7073
7074 pub fn by_item(
7076 self,
7077 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7078 crate::model::ListEnginesResponse,
7079 crate::Error,
7080 > {
7081 use google_cloud_gax::paginator::Paginator;
7082 self.by_page().items()
7083 }
7084
7085 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7089 self.0.request.parent = v.into();
7090 self
7091 }
7092
7093 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7095 self.0.request.page_size = v.into();
7096 self
7097 }
7098
7099 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7101 self.0.request.page_token = v.into();
7102 self
7103 }
7104
7105 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7107 self.0.request.filter = v.into();
7108 self
7109 }
7110 }
7111
7112 #[doc(hidden)]
7113 impl crate::RequestBuilder for ListEngines {
7114 fn request_options(&mut self) -> &mut crate::RequestOptions {
7115 &mut self.0.options
7116 }
7117 }
7118
7119 #[derive(Clone, Debug)]
7140 pub struct ListOperations(
7141 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7142 );
7143
7144 impl ListOperations {
7145 pub(crate) fn new(
7146 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7147 ) -> Self {
7148 Self(RequestBuilder::new(stub))
7149 }
7150
7151 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7153 mut self,
7154 v: V,
7155 ) -> Self {
7156 self.0.request = v.into();
7157 self
7158 }
7159
7160 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7162 self.0.options = v.into();
7163 self
7164 }
7165
7166 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7168 (*self.0.stub)
7169 .list_operations(self.0.request, self.0.options)
7170 .await
7171 .map(crate::Response::into_body)
7172 }
7173
7174 pub fn by_page(
7176 self,
7177 ) -> impl google_cloud_gax::paginator::Paginator<
7178 google_cloud_longrunning::model::ListOperationsResponse,
7179 crate::Error,
7180 > {
7181 use std::clone::Clone;
7182 let token = self.0.request.page_token.clone();
7183 let execute = move |token: String| {
7184 let mut builder = self.clone();
7185 builder.0.request = builder.0.request.set_page_token(token);
7186 builder.send()
7187 };
7188 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7189 }
7190
7191 pub fn by_item(
7193 self,
7194 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7195 google_cloud_longrunning::model::ListOperationsResponse,
7196 crate::Error,
7197 > {
7198 use google_cloud_gax::paginator::Paginator;
7199 self.by_page().items()
7200 }
7201
7202 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7204 self.0.request.name = v.into();
7205 self
7206 }
7207
7208 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7210 self.0.request.filter = v.into();
7211 self
7212 }
7213
7214 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7216 self.0.request.page_size = v.into();
7217 self
7218 }
7219
7220 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7222 self.0.request.page_token = v.into();
7223 self
7224 }
7225
7226 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7228 self.0.request.return_partial_success = v.into();
7229 self
7230 }
7231 }
7232
7233 #[doc(hidden)]
7234 impl crate::RequestBuilder for ListOperations {
7235 fn request_options(&mut self) -> &mut crate::RequestOptions {
7236 &mut self.0.options
7237 }
7238 }
7239
7240 #[derive(Clone, Debug)]
7257 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7258
7259 impl GetOperation {
7260 pub(crate) fn new(
7261 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7262 ) -> Self {
7263 Self(RequestBuilder::new(stub))
7264 }
7265
7266 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7268 mut self,
7269 v: V,
7270 ) -> Self {
7271 self.0.request = v.into();
7272 self
7273 }
7274
7275 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7277 self.0.options = v.into();
7278 self
7279 }
7280
7281 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7283 (*self.0.stub)
7284 .get_operation(self.0.request, self.0.options)
7285 .await
7286 .map(crate::Response::into_body)
7287 }
7288
7289 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7291 self.0.request.name = v.into();
7292 self
7293 }
7294 }
7295
7296 #[doc(hidden)]
7297 impl crate::RequestBuilder for GetOperation {
7298 fn request_options(&mut self) -> &mut crate::RequestOptions {
7299 &mut self.0.options
7300 }
7301 }
7302
7303 #[derive(Clone, Debug)]
7320 pub struct CancelOperation(
7321 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7322 );
7323
7324 impl CancelOperation {
7325 pub(crate) fn new(
7326 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7327 ) -> Self {
7328 Self(RequestBuilder::new(stub))
7329 }
7330
7331 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7333 mut self,
7334 v: V,
7335 ) -> Self {
7336 self.0.request = v.into();
7337 self
7338 }
7339
7340 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7342 self.0.options = v.into();
7343 self
7344 }
7345
7346 pub async fn send(self) -> Result<()> {
7348 (*self.0.stub)
7349 .cancel_operation(self.0.request, self.0.options)
7350 .await
7351 .map(crate::Response::into_body)
7352 }
7353
7354 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7356 self.0.request.name = v.into();
7357 self
7358 }
7359 }
7360
7361 #[doc(hidden)]
7362 impl crate::RequestBuilder for CancelOperation {
7363 fn request_options(&mut self) -> &mut crate::RequestOptions {
7364 &mut self.0.options
7365 }
7366 }
7367}
7368
7369#[cfg(feature = "grounded-generation-service")]
7370#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7371pub mod grounded_generation_service {
7372 use crate::Result;
7373
7374 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7388
7389 pub(crate) mod client {
7390 use super::super::super::client::GroundedGenerationService;
7391 pub struct Factory;
7392 impl crate::ClientFactory for Factory {
7393 type Client = GroundedGenerationService;
7394 type Credentials = gaxi::options::Credentials;
7395 async fn build(
7396 self,
7397 config: gaxi::options::ClientConfig,
7398 ) -> crate::ClientBuilderResult<Self::Client> {
7399 Self::Client::new(config).await
7400 }
7401 }
7402 }
7403
7404 #[derive(Clone, Debug)]
7406 pub(crate) struct RequestBuilder<R: std::default::Default> {
7407 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7408 request: R,
7409 options: crate::RequestOptions,
7410 }
7411
7412 impl<R> RequestBuilder<R>
7413 where
7414 R: std::default::Default,
7415 {
7416 pub(crate) fn new(
7417 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7418 ) -> Self {
7419 Self {
7420 stub,
7421 request: R::default(),
7422 options: crate::RequestOptions::default(),
7423 }
7424 }
7425 }
7426
7427 #[derive(Clone, Debug)]
7444 pub struct GenerateGroundedContent(
7445 RequestBuilder<crate::model::GenerateGroundedContentRequest>,
7446 );
7447
7448 impl GenerateGroundedContent {
7449 pub(crate) fn new(
7450 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7451 ) -> Self {
7452 Self(RequestBuilder::new(stub))
7453 }
7454
7455 pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
7457 mut self,
7458 v: V,
7459 ) -> Self {
7460 self.0.request = v.into();
7461 self
7462 }
7463
7464 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7466 self.0.options = v.into();
7467 self
7468 }
7469
7470 pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
7472 (*self.0.stub)
7473 .generate_grounded_content(self.0.request, self.0.options)
7474 .await
7475 .map(crate::Response::into_body)
7476 }
7477
7478 pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7482 self.0.request.location = v.into();
7483 self
7484 }
7485
7486 pub fn set_system_instruction<T>(mut self, v: T) -> Self
7488 where
7489 T: std::convert::Into<crate::model::GroundedGenerationContent>,
7490 {
7491 self.0.request.system_instruction = std::option::Option::Some(v.into());
7492 self
7493 }
7494
7495 pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
7497 where
7498 T: std::convert::Into<crate::model::GroundedGenerationContent>,
7499 {
7500 self.0.request.system_instruction = v.map(|x| x.into());
7501 self
7502 }
7503
7504 pub fn set_contents<T, V>(mut self, v: T) -> Self
7506 where
7507 T: std::iter::IntoIterator<Item = V>,
7508 V: std::convert::Into<crate::model::GroundedGenerationContent>,
7509 {
7510 use std::iter::Iterator;
7511 self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
7512 self
7513 }
7514
7515 pub fn set_generation_spec<T>(mut self, v: T) -> Self
7517 where
7518 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7519 {
7520 self.0.request.generation_spec = std::option::Option::Some(v.into());
7521 self
7522 }
7523
7524 pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7526 where
7527 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7528 {
7529 self.0.request.generation_spec = v.map(|x| x.into());
7530 self
7531 }
7532
7533 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7535 where
7536 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7537 {
7538 self.0.request.grounding_spec = std::option::Option::Some(v.into());
7539 self
7540 }
7541
7542 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7544 where
7545 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7546 {
7547 self.0.request.grounding_spec = v.map(|x| x.into());
7548 self
7549 }
7550
7551 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7553 where
7554 T: std::iter::IntoIterator<Item = (K, V)>,
7555 K: std::convert::Into<std::string::String>,
7556 V: std::convert::Into<std::string::String>,
7557 {
7558 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7559 self
7560 }
7561 }
7562
7563 #[doc(hidden)]
7564 impl crate::RequestBuilder for GenerateGroundedContent {
7565 fn request_options(&mut self) -> &mut crate::RequestOptions {
7566 &mut self.0.options
7567 }
7568 }
7569
7570 #[derive(Clone, Debug)]
7587 pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
7588
7589 impl CheckGrounding {
7590 pub(crate) fn new(
7591 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7592 ) -> Self {
7593 Self(RequestBuilder::new(stub))
7594 }
7595
7596 pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
7598 self.0.request = v.into();
7599 self
7600 }
7601
7602 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7604 self.0.options = v.into();
7605 self
7606 }
7607
7608 pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
7610 (*self.0.stub)
7611 .check_grounding(self.0.request, self.0.options)
7612 .await
7613 .map(crate::Response::into_body)
7614 }
7615
7616 pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7620 self.0.request.grounding_config = v.into();
7621 self
7622 }
7623
7624 pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
7626 self.0.request.answer_candidate = v.into();
7627 self
7628 }
7629
7630 pub fn set_facts<T, V>(mut self, v: T) -> Self
7632 where
7633 T: std::iter::IntoIterator<Item = V>,
7634 V: std::convert::Into<crate::model::GroundingFact>,
7635 {
7636 use std::iter::Iterator;
7637 self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
7638 self
7639 }
7640
7641 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7643 where
7644 T: std::convert::Into<crate::model::CheckGroundingSpec>,
7645 {
7646 self.0.request.grounding_spec = std::option::Option::Some(v.into());
7647 self
7648 }
7649
7650 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7652 where
7653 T: std::convert::Into<crate::model::CheckGroundingSpec>,
7654 {
7655 self.0.request.grounding_spec = v.map(|x| x.into());
7656 self
7657 }
7658
7659 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7661 where
7662 T: std::iter::IntoIterator<Item = (K, V)>,
7663 K: std::convert::Into<std::string::String>,
7664 V: std::convert::Into<std::string::String>,
7665 {
7666 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7667 self
7668 }
7669 }
7670
7671 #[doc(hidden)]
7672 impl crate::RequestBuilder for CheckGrounding {
7673 fn request_options(&mut self) -> &mut crate::RequestOptions {
7674 &mut self.0.options
7675 }
7676 }
7677
7678 #[derive(Clone, Debug)]
7699 pub struct ListOperations(
7700 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7701 );
7702
7703 impl ListOperations {
7704 pub(crate) fn new(
7705 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7706 ) -> Self {
7707 Self(RequestBuilder::new(stub))
7708 }
7709
7710 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7712 mut self,
7713 v: V,
7714 ) -> Self {
7715 self.0.request = v.into();
7716 self
7717 }
7718
7719 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7721 self.0.options = v.into();
7722 self
7723 }
7724
7725 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7727 (*self.0.stub)
7728 .list_operations(self.0.request, self.0.options)
7729 .await
7730 .map(crate::Response::into_body)
7731 }
7732
7733 pub fn by_page(
7735 self,
7736 ) -> impl google_cloud_gax::paginator::Paginator<
7737 google_cloud_longrunning::model::ListOperationsResponse,
7738 crate::Error,
7739 > {
7740 use std::clone::Clone;
7741 let token = self.0.request.page_token.clone();
7742 let execute = move |token: String| {
7743 let mut builder = self.clone();
7744 builder.0.request = builder.0.request.set_page_token(token);
7745 builder.send()
7746 };
7747 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7748 }
7749
7750 pub fn by_item(
7752 self,
7753 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7754 google_cloud_longrunning::model::ListOperationsResponse,
7755 crate::Error,
7756 > {
7757 use google_cloud_gax::paginator::Paginator;
7758 self.by_page().items()
7759 }
7760
7761 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7763 self.0.request.name = v.into();
7764 self
7765 }
7766
7767 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7769 self.0.request.filter = v.into();
7770 self
7771 }
7772
7773 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7775 self.0.request.page_size = v.into();
7776 self
7777 }
7778
7779 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7781 self.0.request.page_token = v.into();
7782 self
7783 }
7784
7785 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7787 self.0.request.return_partial_success = v.into();
7788 self
7789 }
7790 }
7791
7792 #[doc(hidden)]
7793 impl crate::RequestBuilder for ListOperations {
7794 fn request_options(&mut self) -> &mut crate::RequestOptions {
7795 &mut self.0.options
7796 }
7797 }
7798
7799 #[derive(Clone, Debug)]
7816 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7817
7818 impl GetOperation {
7819 pub(crate) fn new(
7820 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7821 ) -> Self {
7822 Self(RequestBuilder::new(stub))
7823 }
7824
7825 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7827 mut self,
7828 v: V,
7829 ) -> Self {
7830 self.0.request = v.into();
7831 self
7832 }
7833
7834 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7836 self.0.options = v.into();
7837 self
7838 }
7839
7840 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7842 (*self.0.stub)
7843 .get_operation(self.0.request, self.0.options)
7844 .await
7845 .map(crate::Response::into_body)
7846 }
7847
7848 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7850 self.0.request.name = v.into();
7851 self
7852 }
7853 }
7854
7855 #[doc(hidden)]
7856 impl crate::RequestBuilder for GetOperation {
7857 fn request_options(&mut self) -> &mut crate::RequestOptions {
7858 &mut self.0.options
7859 }
7860 }
7861
7862 #[derive(Clone, Debug)]
7879 pub struct CancelOperation(
7880 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7881 );
7882
7883 impl CancelOperation {
7884 pub(crate) fn new(
7885 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7886 ) -> Self {
7887 Self(RequestBuilder::new(stub))
7888 }
7889
7890 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7892 mut self,
7893 v: V,
7894 ) -> Self {
7895 self.0.request = v.into();
7896 self
7897 }
7898
7899 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7901 self.0.options = v.into();
7902 self
7903 }
7904
7905 pub async fn send(self) -> Result<()> {
7907 (*self.0.stub)
7908 .cancel_operation(self.0.request, self.0.options)
7909 .await
7910 .map(crate::Response::into_body)
7911 }
7912
7913 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7915 self.0.request.name = v.into();
7916 self
7917 }
7918 }
7919
7920 #[doc(hidden)]
7921 impl crate::RequestBuilder for CancelOperation {
7922 fn request_options(&mut self) -> &mut crate::RequestOptions {
7923 &mut self.0.options
7924 }
7925 }
7926}
7927
7928#[cfg(feature = "identity-mapping-store-service")]
7929#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
7930pub mod identity_mapping_store_service {
7931 use crate::Result;
7932
7933 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7947
7948 pub(crate) mod client {
7949 use super::super::super::client::IdentityMappingStoreService;
7950 pub struct Factory;
7951 impl crate::ClientFactory for Factory {
7952 type Client = IdentityMappingStoreService;
7953 type Credentials = gaxi::options::Credentials;
7954 async fn build(
7955 self,
7956 config: gaxi::options::ClientConfig,
7957 ) -> crate::ClientBuilderResult<Self::Client> {
7958 Self::Client::new(config).await
7959 }
7960 }
7961 }
7962
7963 #[derive(Clone, Debug)]
7965 pub(crate) struct RequestBuilder<R: std::default::Default> {
7966 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7967 request: R,
7968 options: crate::RequestOptions,
7969 }
7970
7971 impl<R> RequestBuilder<R>
7972 where
7973 R: std::default::Default,
7974 {
7975 pub(crate) fn new(
7976 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7977 ) -> Self {
7978 Self {
7979 stub,
7980 request: R::default(),
7981 options: crate::RequestOptions::default(),
7982 }
7983 }
7984 }
7985
7986 #[derive(Clone, Debug)]
8003 pub struct CreateIdentityMappingStore(
8004 RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
8005 );
8006
8007 impl CreateIdentityMappingStore {
8008 pub(crate) fn new(
8009 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8010 ) -> Self {
8011 Self(RequestBuilder::new(stub))
8012 }
8013
8014 pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
8016 mut self,
8017 v: V,
8018 ) -> Self {
8019 self.0.request = v.into();
8020 self
8021 }
8022
8023 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8025 self.0.options = v.into();
8026 self
8027 }
8028
8029 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8031 (*self.0.stub)
8032 .create_identity_mapping_store(self.0.request, self.0.options)
8033 .await
8034 .map(crate::Response::into_body)
8035 }
8036
8037 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8041 self.0.request.parent = v.into();
8042 self
8043 }
8044
8045 pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8049 self.0.request.identity_mapping_store_id = v.into();
8050 self
8051 }
8052
8053 pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
8057 where
8058 T: std::convert::Into<crate::model::IdentityMappingStore>,
8059 {
8060 self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
8061 self
8062 }
8063
8064 pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
8068 where
8069 T: std::convert::Into<crate::model::IdentityMappingStore>,
8070 {
8071 self.0.request.identity_mapping_store = v.map(|x| x.into());
8072 self
8073 }
8074
8075 pub fn set_cmek_options<
8080 T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
8081 >(
8082 mut self,
8083 v: T,
8084 ) -> Self {
8085 self.0.request.cmek_options = v.into();
8086 self
8087 }
8088
8089 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
8095 mut self,
8096 v: T,
8097 ) -> Self {
8098 self.0.request = self.0.request.set_cmek_config_name(v);
8099 self
8100 }
8101
8102 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8108 self.0.request = self.0.request.set_disable_cmek(v);
8109 self
8110 }
8111 }
8112
8113 #[doc(hidden)]
8114 impl crate::RequestBuilder for CreateIdentityMappingStore {
8115 fn request_options(&mut self) -> &mut crate::RequestOptions {
8116 &mut self.0.options
8117 }
8118 }
8119
8120 #[derive(Clone, Debug)]
8137 pub struct GetIdentityMappingStore(
8138 RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8139 );
8140
8141 impl GetIdentityMappingStore {
8142 pub(crate) fn new(
8143 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8144 ) -> Self {
8145 Self(RequestBuilder::new(stub))
8146 }
8147
8148 pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8150 mut self,
8151 v: V,
8152 ) -> Self {
8153 self.0.request = v.into();
8154 self
8155 }
8156
8157 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8159 self.0.options = v.into();
8160 self
8161 }
8162
8163 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8165 (*self.0.stub)
8166 .get_identity_mapping_store(self.0.request, self.0.options)
8167 .await
8168 .map(crate::Response::into_body)
8169 }
8170
8171 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8175 self.0.request.name = v.into();
8176 self
8177 }
8178 }
8179
8180 #[doc(hidden)]
8181 impl crate::RequestBuilder for GetIdentityMappingStore {
8182 fn request_options(&mut self) -> &mut crate::RequestOptions {
8183 &mut self.0.options
8184 }
8185 }
8186
8187 #[derive(Clone, Debug)]
8205 pub struct DeleteIdentityMappingStore(
8206 RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8207 );
8208
8209 impl DeleteIdentityMappingStore {
8210 pub(crate) fn new(
8211 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8212 ) -> Self {
8213 Self(RequestBuilder::new(stub))
8214 }
8215
8216 pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8218 mut self,
8219 v: V,
8220 ) -> Self {
8221 self.0.request = v.into();
8222 self
8223 }
8224
8225 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8227 self.0.options = v.into();
8228 self
8229 }
8230
8231 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8238 (*self.0.stub)
8239 .delete_identity_mapping_store(self.0.request, self.0.options)
8240 .await
8241 .map(crate::Response::into_body)
8242 }
8243
8244 pub fn poller(
8246 self,
8247 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata>
8248 {
8249 type Operation = google_cloud_lro::internal::Operation<
8250 wkt::Empty,
8251 crate::model::DeleteIdentityMappingStoreMetadata,
8252 >;
8253 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8254 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8255
8256 let stub = self.0.stub.clone();
8257 let mut options = self.0.options.clone();
8258 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8259 let query = move |name| {
8260 let stub = stub.clone();
8261 let options = options.clone();
8262 async {
8263 let op = GetOperation::new(stub)
8264 .set_name(name)
8265 .with_options(options)
8266 .send()
8267 .await?;
8268 Ok(Operation::new(op))
8269 }
8270 };
8271
8272 let start = move || async {
8273 let op = self.send().await?;
8274 Ok(Operation::new(op))
8275 };
8276
8277 google_cloud_lro::internal::new_unit_response_poller(
8278 polling_error_policy,
8279 polling_backoff_policy,
8280 start,
8281 query,
8282 )
8283 }
8284
8285 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8289 self.0.request.name = v.into();
8290 self
8291 }
8292 }
8293
8294 #[doc(hidden)]
8295 impl crate::RequestBuilder for DeleteIdentityMappingStore {
8296 fn request_options(&mut self) -> &mut crate::RequestOptions {
8297 &mut self.0.options
8298 }
8299 }
8300
8301 #[derive(Clone, Debug)]
8319 pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8320
8321 impl ImportIdentityMappings {
8322 pub(crate) fn new(
8323 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8324 ) -> Self {
8325 Self(RequestBuilder::new(stub))
8326 }
8327
8328 pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8330 mut self,
8331 v: V,
8332 ) -> Self {
8333 self.0.request = v.into();
8334 self
8335 }
8336
8337 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8339 self.0.options = v.into();
8340 self
8341 }
8342
8343 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8350 (*self.0.stub)
8351 .import_identity_mappings(self.0.request, self.0.options)
8352 .await
8353 .map(crate::Response::into_body)
8354 }
8355
8356 pub fn poller(
8358 self,
8359 ) -> impl google_cloud_lro::Poller<
8360 crate::model::ImportIdentityMappingsResponse,
8361 crate::model::IdentityMappingEntryOperationMetadata,
8362 > {
8363 type Operation = google_cloud_lro::internal::Operation<
8364 crate::model::ImportIdentityMappingsResponse,
8365 crate::model::IdentityMappingEntryOperationMetadata,
8366 >;
8367 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8368 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8369
8370 let stub = self.0.stub.clone();
8371 let mut options = self.0.options.clone();
8372 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8373 let query = move |name| {
8374 let stub = stub.clone();
8375 let options = options.clone();
8376 async {
8377 let op = GetOperation::new(stub)
8378 .set_name(name)
8379 .with_options(options)
8380 .send()
8381 .await?;
8382 Ok(Operation::new(op))
8383 }
8384 };
8385
8386 let start = move || async {
8387 let op = self.send().await?;
8388 Ok(Operation::new(op))
8389 };
8390
8391 google_cloud_lro::internal::new_poller(
8392 polling_error_policy,
8393 polling_backoff_policy,
8394 start,
8395 query,
8396 )
8397 }
8398
8399 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8403 self.0.request.identity_mapping_store = v.into();
8404 self
8405 }
8406
8407 pub fn set_source<
8412 T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
8413 >(
8414 mut self,
8415 v: T,
8416 ) -> Self {
8417 self.0.request.source = v.into();
8418 self
8419 }
8420
8421 pub fn set_inline_source<
8427 T: std::convert::Into<
8428 std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
8429 >,
8430 >(
8431 mut self,
8432 v: T,
8433 ) -> Self {
8434 self.0.request = self.0.request.set_inline_source(v);
8435 self
8436 }
8437 }
8438
8439 #[doc(hidden)]
8440 impl crate::RequestBuilder for ImportIdentityMappings {
8441 fn request_options(&mut self) -> &mut crate::RequestOptions {
8442 &mut self.0.options
8443 }
8444 }
8445
8446 #[derive(Clone, Debug)]
8464 pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
8465
8466 impl PurgeIdentityMappings {
8467 pub(crate) fn new(
8468 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8469 ) -> Self {
8470 Self(RequestBuilder::new(stub))
8471 }
8472
8473 pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
8475 mut self,
8476 v: V,
8477 ) -> Self {
8478 self.0.request = v.into();
8479 self
8480 }
8481
8482 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8484 self.0.options = v.into();
8485 self
8486 }
8487
8488 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8495 (*self.0.stub)
8496 .purge_identity_mappings(self.0.request, self.0.options)
8497 .await
8498 .map(crate::Response::into_body)
8499 }
8500
8501 pub fn poller(
8503 self,
8504 ) -> impl google_cloud_lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata>
8505 {
8506 type Operation = google_cloud_lro::internal::Operation<
8507 wkt::Empty,
8508 crate::model::IdentityMappingEntryOperationMetadata,
8509 >;
8510 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8511 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8512
8513 let stub = self.0.stub.clone();
8514 let mut options = self.0.options.clone();
8515 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8516 let query = move |name| {
8517 let stub = stub.clone();
8518 let options = options.clone();
8519 async {
8520 let op = GetOperation::new(stub)
8521 .set_name(name)
8522 .with_options(options)
8523 .send()
8524 .await?;
8525 Ok(Operation::new(op))
8526 }
8527 };
8528
8529 let start = move || async {
8530 let op = self.send().await?;
8531 Ok(Operation::new(op))
8532 };
8533
8534 google_cloud_lro::internal::new_unit_response_poller(
8535 polling_error_policy,
8536 polling_backoff_policy,
8537 start,
8538 query,
8539 )
8540 }
8541
8542 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8546 self.0.request.identity_mapping_store = v.into();
8547 self
8548 }
8549
8550 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8552 self.0.request.filter = v.into();
8553 self
8554 }
8555
8556 pub fn set_force<T>(mut self, v: T) -> Self
8558 where
8559 T: std::convert::Into<bool>,
8560 {
8561 self.0.request.force = std::option::Option::Some(v.into());
8562 self
8563 }
8564
8565 pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
8567 where
8568 T: std::convert::Into<bool>,
8569 {
8570 self.0.request.force = v.map(|x| x.into());
8571 self
8572 }
8573
8574 pub fn set_source<
8579 T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
8580 >(
8581 mut self,
8582 v: T,
8583 ) -> Self {
8584 self.0.request.source = v.into();
8585 self
8586 }
8587
8588 pub fn set_inline_source<
8594 T: std::convert::Into<
8595 std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
8596 >,
8597 >(
8598 mut self,
8599 v: T,
8600 ) -> Self {
8601 self.0.request = self.0.request.set_inline_source(v);
8602 self
8603 }
8604 }
8605
8606 #[doc(hidden)]
8607 impl crate::RequestBuilder for PurgeIdentityMappings {
8608 fn request_options(&mut self) -> &mut crate::RequestOptions {
8609 &mut self.0.options
8610 }
8611 }
8612
8613 #[derive(Clone, Debug)]
8634 pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
8635
8636 impl ListIdentityMappings {
8637 pub(crate) fn new(
8638 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8639 ) -> Self {
8640 Self(RequestBuilder::new(stub))
8641 }
8642
8643 pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
8645 mut self,
8646 v: V,
8647 ) -> Self {
8648 self.0.request = v.into();
8649 self
8650 }
8651
8652 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8654 self.0.options = v.into();
8655 self
8656 }
8657
8658 pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
8660 (*self.0.stub)
8661 .list_identity_mappings(self.0.request, self.0.options)
8662 .await
8663 .map(crate::Response::into_body)
8664 }
8665
8666 pub fn by_page(
8668 self,
8669 ) -> impl google_cloud_gax::paginator::Paginator<
8670 crate::model::ListIdentityMappingsResponse,
8671 crate::Error,
8672 > {
8673 use std::clone::Clone;
8674 let token = self.0.request.page_token.clone();
8675 let execute = move |token: String| {
8676 let mut builder = self.clone();
8677 builder.0.request = builder.0.request.set_page_token(token);
8678 builder.send()
8679 };
8680 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8681 }
8682
8683 pub fn by_item(
8685 self,
8686 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8687 crate::model::ListIdentityMappingsResponse,
8688 crate::Error,
8689 > {
8690 use google_cloud_gax::paginator::Paginator;
8691 self.by_page().items()
8692 }
8693
8694 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8698 self.0.request.identity_mapping_store = v.into();
8699 self
8700 }
8701
8702 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8704 self.0.request.page_size = v.into();
8705 self
8706 }
8707
8708 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8710 self.0.request.page_token = v.into();
8711 self
8712 }
8713 }
8714
8715 #[doc(hidden)]
8716 impl crate::RequestBuilder for ListIdentityMappings {
8717 fn request_options(&mut self) -> &mut crate::RequestOptions {
8718 &mut self.0.options
8719 }
8720 }
8721
8722 #[derive(Clone, Debug)]
8743 pub struct ListIdentityMappingStores(
8744 RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
8745 );
8746
8747 impl ListIdentityMappingStores {
8748 pub(crate) fn new(
8749 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8750 ) -> Self {
8751 Self(RequestBuilder::new(stub))
8752 }
8753
8754 pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
8756 mut self,
8757 v: V,
8758 ) -> Self {
8759 self.0.request = v.into();
8760 self
8761 }
8762
8763 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8765 self.0.options = v.into();
8766 self
8767 }
8768
8769 pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
8771 (*self.0.stub)
8772 .list_identity_mapping_stores(self.0.request, self.0.options)
8773 .await
8774 .map(crate::Response::into_body)
8775 }
8776
8777 pub fn by_page(
8779 self,
8780 ) -> impl google_cloud_gax::paginator::Paginator<
8781 crate::model::ListIdentityMappingStoresResponse,
8782 crate::Error,
8783 > {
8784 use std::clone::Clone;
8785 let token = self.0.request.page_token.clone();
8786 let execute = move |token: String| {
8787 let mut builder = self.clone();
8788 builder.0.request = builder.0.request.set_page_token(token);
8789 builder.send()
8790 };
8791 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8792 }
8793
8794 pub fn by_item(
8796 self,
8797 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8798 crate::model::ListIdentityMappingStoresResponse,
8799 crate::Error,
8800 > {
8801 use google_cloud_gax::paginator::Paginator;
8802 self.by_page().items()
8803 }
8804
8805 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8809 self.0.request.parent = v.into();
8810 self
8811 }
8812
8813 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8815 self.0.request.page_size = v.into();
8816 self
8817 }
8818
8819 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8821 self.0.request.page_token = v.into();
8822 self
8823 }
8824 }
8825
8826 #[doc(hidden)]
8827 impl crate::RequestBuilder for ListIdentityMappingStores {
8828 fn request_options(&mut self) -> &mut crate::RequestOptions {
8829 &mut self.0.options
8830 }
8831 }
8832
8833 #[derive(Clone, Debug)]
8854 pub struct ListOperations(
8855 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8856 );
8857
8858 impl ListOperations {
8859 pub(crate) fn new(
8860 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8861 ) -> Self {
8862 Self(RequestBuilder::new(stub))
8863 }
8864
8865 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8867 mut self,
8868 v: V,
8869 ) -> Self {
8870 self.0.request = v.into();
8871 self
8872 }
8873
8874 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8876 self.0.options = v.into();
8877 self
8878 }
8879
8880 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8882 (*self.0.stub)
8883 .list_operations(self.0.request, self.0.options)
8884 .await
8885 .map(crate::Response::into_body)
8886 }
8887
8888 pub fn by_page(
8890 self,
8891 ) -> impl google_cloud_gax::paginator::Paginator<
8892 google_cloud_longrunning::model::ListOperationsResponse,
8893 crate::Error,
8894 > {
8895 use std::clone::Clone;
8896 let token = self.0.request.page_token.clone();
8897 let execute = move |token: String| {
8898 let mut builder = self.clone();
8899 builder.0.request = builder.0.request.set_page_token(token);
8900 builder.send()
8901 };
8902 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8903 }
8904
8905 pub fn by_item(
8907 self,
8908 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8909 google_cloud_longrunning::model::ListOperationsResponse,
8910 crate::Error,
8911 > {
8912 use google_cloud_gax::paginator::Paginator;
8913 self.by_page().items()
8914 }
8915
8916 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8918 self.0.request.name = v.into();
8919 self
8920 }
8921
8922 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8924 self.0.request.filter = v.into();
8925 self
8926 }
8927
8928 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8930 self.0.request.page_size = v.into();
8931 self
8932 }
8933
8934 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8936 self.0.request.page_token = v.into();
8937 self
8938 }
8939
8940 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8942 self.0.request.return_partial_success = v.into();
8943 self
8944 }
8945 }
8946
8947 #[doc(hidden)]
8948 impl crate::RequestBuilder for ListOperations {
8949 fn request_options(&mut self) -> &mut crate::RequestOptions {
8950 &mut self.0.options
8951 }
8952 }
8953
8954 #[derive(Clone, Debug)]
8971 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8972
8973 impl GetOperation {
8974 pub(crate) fn new(
8975 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8976 ) -> Self {
8977 Self(RequestBuilder::new(stub))
8978 }
8979
8980 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8982 mut self,
8983 v: V,
8984 ) -> Self {
8985 self.0.request = v.into();
8986 self
8987 }
8988
8989 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8991 self.0.options = v.into();
8992 self
8993 }
8994
8995 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8997 (*self.0.stub)
8998 .get_operation(self.0.request, self.0.options)
8999 .await
9000 .map(crate::Response::into_body)
9001 }
9002
9003 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9005 self.0.request.name = v.into();
9006 self
9007 }
9008 }
9009
9010 #[doc(hidden)]
9011 impl crate::RequestBuilder for GetOperation {
9012 fn request_options(&mut self) -> &mut crate::RequestOptions {
9013 &mut self.0.options
9014 }
9015 }
9016
9017 #[derive(Clone, Debug)]
9034 pub struct CancelOperation(
9035 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9036 );
9037
9038 impl CancelOperation {
9039 pub(crate) fn new(
9040 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9041 ) -> Self {
9042 Self(RequestBuilder::new(stub))
9043 }
9044
9045 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9047 mut self,
9048 v: V,
9049 ) -> Self {
9050 self.0.request = v.into();
9051 self
9052 }
9053
9054 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9056 self.0.options = v.into();
9057 self
9058 }
9059
9060 pub async fn send(self) -> Result<()> {
9062 (*self.0.stub)
9063 .cancel_operation(self.0.request, self.0.options)
9064 .await
9065 .map(crate::Response::into_body)
9066 }
9067
9068 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9070 self.0.request.name = v.into();
9071 self
9072 }
9073 }
9074
9075 #[doc(hidden)]
9076 impl crate::RequestBuilder for CancelOperation {
9077 fn request_options(&mut self) -> &mut crate::RequestOptions {
9078 &mut self.0.options
9079 }
9080 }
9081}
9082
9083#[cfg(feature = "project-service")]
9084#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
9085pub mod project_service {
9086 use crate::Result;
9087
9088 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9102
9103 pub(crate) mod client {
9104 use super::super::super::client::ProjectService;
9105 pub struct Factory;
9106 impl crate::ClientFactory for Factory {
9107 type Client = ProjectService;
9108 type Credentials = gaxi::options::Credentials;
9109 async fn build(
9110 self,
9111 config: gaxi::options::ClientConfig,
9112 ) -> crate::ClientBuilderResult<Self::Client> {
9113 Self::Client::new(config).await
9114 }
9115 }
9116 }
9117
9118 #[derive(Clone, Debug)]
9120 pub(crate) struct RequestBuilder<R: std::default::Default> {
9121 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9122 request: R,
9123 options: crate::RequestOptions,
9124 }
9125
9126 impl<R> RequestBuilder<R>
9127 where
9128 R: std::default::Default,
9129 {
9130 pub(crate) fn new(
9131 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9132 ) -> Self {
9133 Self {
9134 stub,
9135 request: R::default(),
9136 options: crate::RequestOptions::default(),
9137 }
9138 }
9139 }
9140
9141 #[derive(Clone, Debug)]
9159 pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9160
9161 impl ProvisionProject {
9162 pub(crate) fn new(
9163 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9164 ) -> Self {
9165 Self(RequestBuilder::new(stub))
9166 }
9167
9168 pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9170 mut self,
9171 v: V,
9172 ) -> Self {
9173 self.0.request = v.into();
9174 self
9175 }
9176
9177 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9179 self.0.options = v.into();
9180 self
9181 }
9182
9183 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9190 (*self.0.stub)
9191 .provision_project(self.0.request, self.0.options)
9192 .await
9193 .map(crate::Response::into_body)
9194 }
9195
9196 pub fn poller(
9198 self,
9199 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9200 {
9201 type Operation = google_cloud_lro::internal::Operation<
9202 crate::model::Project,
9203 crate::model::ProvisionProjectMetadata,
9204 >;
9205 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9206 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9207
9208 let stub = self.0.stub.clone();
9209 let mut options = self.0.options.clone();
9210 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9211 let query = move |name| {
9212 let stub = stub.clone();
9213 let options = options.clone();
9214 async {
9215 let op = GetOperation::new(stub)
9216 .set_name(name)
9217 .with_options(options)
9218 .send()
9219 .await?;
9220 Ok(Operation::new(op))
9221 }
9222 };
9223
9224 let start = move || async {
9225 let op = self.send().await?;
9226 Ok(Operation::new(op))
9227 };
9228
9229 google_cloud_lro::internal::new_poller(
9230 polling_error_policy,
9231 polling_backoff_policy,
9232 start,
9233 query,
9234 )
9235 }
9236
9237 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9241 self.0.request.name = v.into();
9242 self
9243 }
9244
9245 pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9249 self.0.request.accept_data_use_terms = v.into();
9250 self
9251 }
9252
9253 pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9257 self.0.request.data_use_terms_version = v.into();
9258 self
9259 }
9260 }
9261
9262 #[doc(hidden)]
9263 impl crate::RequestBuilder for ProvisionProject {
9264 fn request_options(&mut self) -> &mut crate::RequestOptions {
9265 &mut self.0.options
9266 }
9267 }
9268
9269 #[derive(Clone, Debug)]
9290 pub struct ListOperations(
9291 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9292 );
9293
9294 impl ListOperations {
9295 pub(crate) fn new(
9296 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9297 ) -> Self {
9298 Self(RequestBuilder::new(stub))
9299 }
9300
9301 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9303 mut self,
9304 v: V,
9305 ) -> Self {
9306 self.0.request = v.into();
9307 self
9308 }
9309
9310 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9312 self.0.options = v.into();
9313 self
9314 }
9315
9316 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9318 (*self.0.stub)
9319 .list_operations(self.0.request, self.0.options)
9320 .await
9321 .map(crate::Response::into_body)
9322 }
9323
9324 pub fn by_page(
9326 self,
9327 ) -> impl google_cloud_gax::paginator::Paginator<
9328 google_cloud_longrunning::model::ListOperationsResponse,
9329 crate::Error,
9330 > {
9331 use std::clone::Clone;
9332 let token = self.0.request.page_token.clone();
9333 let execute = move |token: String| {
9334 let mut builder = self.clone();
9335 builder.0.request = builder.0.request.set_page_token(token);
9336 builder.send()
9337 };
9338 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9339 }
9340
9341 pub fn by_item(
9343 self,
9344 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9345 google_cloud_longrunning::model::ListOperationsResponse,
9346 crate::Error,
9347 > {
9348 use google_cloud_gax::paginator::Paginator;
9349 self.by_page().items()
9350 }
9351
9352 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9354 self.0.request.name = v.into();
9355 self
9356 }
9357
9358 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9360 self.0.request.filter = v.into();
9361 self
9362 }
9363
9364 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9366 self.0.request.page_size = v.into();
9367 self
9368 }
9369
9370 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9372 self.0.request.page_token = v.into();
9373 self
9374 }
9375
9376 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9378 self.0.request.return_partial_success = v.into();
9379 self
9380 }
9381 }
9382
9383 #[doc(hidden)]
9384 impl crate::RequestBuilder for ListOperations {
9385 fn request_options(&mut self) -> &mut crate::RequestOptions {
9386 &mut self.0.options
9387 }
9388 }
9389
9390 #[derive(Clone, Debug)]
9407 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9408
9409 impl GetOperation {
9410 pub(crate) fn new(
9411 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9412 ) -> Self {
9413 Self(RequestBuilder::new(stub))
9414 }
9415
9416 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9418 mut self,
9419 v: V,
9420 ) -> Self {
9421 self.0.request = v.into();
9422 self
9423 }
9424
9425 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9427 self.0.options = v.into();
9428 self
9429 }
9430
9431 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9433 (*self.0.stub)
9434 .get_operation(self.0.request, self.0.options)
9435 .await
9436 .map(crate::Response::into_body)
9437 }
9438
9439 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9441 self.0.request.name = v.into();
9442 self
9443 }
9444 }
9445
9446 #[doc(hidden)]
9447 impl crate::RequestBuilder for GetOperation {
9448 fn request_options(&mut self) -> &mut crate::RequestOptions {
9449 &mut self.0.options
9450 }
9451 }
9452
9453 #[derive(Clone, Debug)]
9470 pub struct CancelOperation(
9471 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9472 );
9473
9474 impl CancelOperation {
9475 pub(crate) fn new(
9476 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9477 ) -> Self {
9478 Self(RequestBuilder::new(stub))
9479 }
9480
9481 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9483 mut self,
9484 v: V,
9485 ) -> Self {
9486 self.0.request = v.into();
9487 self
9488 }
9489
9490 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9492 self.0.options = v.into();
9493 self
9494 }
9495
9496 pub async fn send(self) -> Result<()> {
9498 (*self.0.stub)
9499 .cancel_operation(self.0.request, self.0.options)
9500 .await
9501 .map(crate::Response::into_body)
9502 }
9503
9504 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9506 self.0.request.name = v.into();
9507 self
9508 }
9509 }
9510
9511 #[doc(hidden)]
9512 impl crate::RequestBuilder for CancelOperation {
9513 fn request_options(&mut self) -> &mut crate::RequestOptions {
9514 &mut self.0.options
9515 }
9516 }
9517}
9518
9519#[cfg(feature = "rank-service")]
9520#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
9521pub mod rank_service {
9522 use crate::Result;
9523
9524 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9538
9539 pub(crate) mod client {
9540 use super::super::super::client::RankService;
9541 pub struct Factory;
9542 impl crate::ClientFactory for Factory {
9543 type Client = RankService;
9544 type Credentials = gaxi::options::Credentials;
9545 async fn build(
9546 self,
9547 config: gaxi::options::ClientConfig,
9548 ) -> crate::ClientBuilderResult<Self::Client> {
9549 Self::Client::new(config).await
9550 }
9551 }
9552 }
9553
9554 #[derive(Clone, Debug)]
9556 pub(crate) struct RequestBuilder<R: std::default::Default> {
9557 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9558 request: R,
9559 options: crate::RequestOptions,
9560 }
9561
9562 impl<R> RequestBuilder<R>
9563 where
9564 R: std::default::Default,
9565 {
9566 pub(crate) fn new(
9567 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9568 ) -> Self {
9569 Self {
9570 stub,
9571 request: R::default(),
9572 options: crate::RequestOptions::default(),
9573 }
9574 }
9575 }
9576
9577 #[derive(Clone, Debug)]
9594 pub struct Rank(RequestBuilder<crate::model::RankRequest>);
9595
9596 impl Rank {
9597 pub(crate) fn new(
9598 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9599 ) -> Self {
9600 Self(RequestBuilder::new(stub))
9601 }
9602
9603 pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
9605 self.0.request = v.into();
9606 self
9607 }
9608
9609 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9611 self.0.options = v.into();
9612 self
9613 }
9614
9615 pub async fn send(self) -> Result<crate::model::RankResponse> {
9617 (*self.0.stub)
9618 .rank(self.0.request, self.0.options)
9619 .await
9620 .map(crate::Response::into_body)
9621 }
9622
9623 pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9627 self.0.request.ranking_config = v.into();
9628 self
9629 }
9630
9631 pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
9633 self.0.request.model = v.into();
9634 self
9635 }
9636
9637 pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
9639 self.0.request.top_n = v.into();
9640 self
9641 }
9642
9643 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
9645 self.0.request.query = v.into();
9646 self
9647 }
9648
9649 pub fn set_records<T, V>(mut self, v: T) -> Self
9653 where
9654 T: std::iter::IntoIterator<Item = V>,
9655 V: std::convert::Into<crate::model::RankingRecord>,
9656 {
9657 use std::iter::Iterator;
9658 self.0.request.records = v.into_iter().map(|i| i.into()).collect();
9659 self
9660 }
9661
9662 pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
9664 self.0.request.ignore_record_details_in_response = v.into();
9665 self
9666 }
9667
9668 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9670 where
9671 T: std::iter::IntoIterator<Item = (K, V)>,
9672 K: std::convert::Into<std::string::String>,
9673 V: std::convert::Into<std::string::String>,
9674 {
9675 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9676 self
9677 }
9678 }
9679
9680 #[doc(hidden)]
9681 impl crate::RequestBuilder for Rank {
9682 fn request_options(&mut self) -> &mut crate::RequestOptions {
9683 &mut self.0.options
9684 }
9685 }
9686
9687 #[derive(Clone, Debug)]
9708 pub struct ListOperations(
9709 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9710 );
9711
9712 impl ListOperations {
9713 pub(crate) fn new(
9714 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9715 ) -> Self {
9716 Self(RequestBuilder::new(stub))
9717 }
9718
9719 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9721 mut self,
9722 v: V,
9723 ) -> Self {
9724 self.0.request = v.into();
9725 self
9726 }
9727
9728 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9730 self.0.options = v.into();
9731 self
9732 }
9733
9734 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9736 (*self.0.stub)
9737 .list_operations(self.0.request, self.0.options)
9738 .await
9739 .map(crate::Response::into_body)
9740 }
9741
9742 pub fn by_page(
9744 self,
9745 ) -> impl google_cloud_gax::paginator::Paginator<
9746 google_cloud_longrunning::model::ListOperationsResponse,
9747 crate::Error,
9748 > {
9749 use std::clone::Clone;
9750 let token = self.0.request.page_token.clone();
9751 let execute = move |token: String| {
9752 let mut builder = self.clone();
9753 builder.0.request = builder.0.request.set_page_token(token);
9754 builder.send()
9755 };
9756 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9757 }
9758
9759 pub fn by_item(
9761 self,
9762 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9763 google_cloud_longrunning::model::ListOperationsResponse,
9764 crate::Error,
9765 > {
9766 use google_cloud_gax::paginator::Paginator;
9767 self.by_page().items()
9768 }
9769
9770 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9772 self.0.request.name = v.into();
9773 self
9774 }
9775
9776 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9778 self.0.request.filter = v.into();
9779 self
9780 }
9781
9782 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9784 self.0.request.page_size = v.into();
9785 self
9786 }
9787
9788 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9790 self.0.request.page_token = v.into();
9791 self
9792 }
9793
9794 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9796 self.0.request.return_partial_success = v.into();
9797 self
9798 }
9799 }
9800
9801 #[doc(hidden)]
9802 impl crate::RequestBuilder for ListOperations {
9803 fn request_options(&mut self) -> &mut crate::RequestOptions {
9804 &mut self.0.options
9805 }
9806 }
9807
9808 #[derive(Clone, Debug)]
9825 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9826
9827 impl GetOperation {
9828 pub(crate) fn new(
9829 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9830 ) -> Self {
9831 Self(RequestBuilder::new(stub))
9832 }
9833
9834 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9836 mut self,
9837 v: V,
9838 ) -> Self {
9839 self.0.request = v.into();
9840 self
9841 }
9842
9843 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9845 self.0.options = v.into();
9846 self
9847 }
9848
9849 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9851 (*self.0.stub)
9852 .get_operation(self.0.request, self.0.options)
9853 .await
9854 .map(crate::Response::into_body)
9855 }
9856
9857 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9859 self.0.request.name = v.into();
9860 self
9861 }
9862 }
9863
9864 #[doc(hidden)]
9865 impl crate::RequestBuilder for GetOperation {
9866 fn request_options(&mut self) -> &mut crate::RequestOptions {
9867 &mut self.0.options
9868 }
9869 }
9870
9871 #[derive(Clone, Debug)]
9888 pub struct CancelOperation(
9889 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9890 );
9891
9892 impl CancelOperation {
9893 pub(crate) fn new(
9894 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9895 ) -> Self {
9896 Self(RequestBuilder::new(stub))
9897 }
9898
9899 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9901 mut self,
9902 v: V,
9903 ) -> Self {
9904 self.0.request = v.into();
9905 self
9906 }
9907
9908 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9910 self.0.options = v.into();
9911 self
9912 }
9913
9914 pub async fn send(self) -> Result<()> {
9916 (*self.0.stub)
9917 .cancel_operation(self.0.request, self.0.options)
9918 .await
9919 .map(crate::Response::into_body)
9920 }
9921
9922 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9924 self.0.request.name = v.into();
9925 self
9926 }
9927 }
9928
9929 #[doc(hidden)]
9930 impl crate::RequestBuilder for CancelOperation {
9931 fn request_options(&mut self) -> &mut crate::RequestOptions {
9932 &mut self.0.options
9933 }
9934 }
9935}
9936
9937#[cfg(feature = "recommendation-service")]
9938#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
9939pub mod recommendation_service {
9940 use crate::Result;
9941
9942 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9956
9957 pub(crate) mod client {
9958 use super::super::super::client::RecommendationService;
9959 pub struct Factory;
9960 impl crate::ClientFactory for Factory {
9961 type Client = RecommendationService;
9962 type Credentials = gaxi::options::Credentials;
9963 async fn build(
9964 self,
9965 config: gaxi::options::ClientConfig,
9966 ) -> crate::ClientBuilderResult<Self::Client> {
9967 Self::Client::new(config).await
9968 }
9969 }
9970 }
9971
9972 #[derive(Clone, Debug)]
9974 pub(crate) struct RequestBuilder<R: std::default::Default> {
9975 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9976 request: R,
9977 options: crate::RequestOptions,
9978 }
9979
9980 impl<R> RequestBuilder<R>
9981 where
9982 R: std::default::Default,
9983 {
9984 pub(crate) fn new(
9985 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9986 ) -> Self {
9987 Self {
9988 stub,
9989 request: R::default(),
9990 options: crate::RequestOptions::default(),
9991 }
9992 }
9993 }
9994
9995 #[derive(Clone, Debug)]
10012 pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
10013
10014 impl Recommend {
10015 pub(crate) fn new(
10016 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10017 ) -> Self {
10018 Self(RequestBuilder::new(stub))
10019 }
10020
10021 pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
10023 self.0.request = v.into();
10024 self
10025 }
10026
10027 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10029 self.0.options = v.into();
10030 self
10031 }
10032
10033 pub async fn send(self) -> Result<crate::model::RecommendResponse> {
10035 (*self.0.stub)
10036 .recommend(self.0.request, self.0.options)
10037 .await
10038 .map(crate::Response::into_body)
10039 }
10040
10041 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
10045 self.0.request.serving_config = v.into();
10046 self
10047 }
10048
10049 pub fn set_user_event<T>(mut self, v: T) -> Self
10053 where
10054 T: std::convert::Into<crate::model::UserEvent>,
10055 {
10056 self.0.request.user_event = std::option::Option::Some(v.into());
10057 self
10058 }
10059
10060 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
10064 where
10065 T: std::convert::Into<crate::model::UserEvent>,
10066 {
10067 self.0.request.user_event = v.map(|x| x.into());
10068 self
10069 }
10070
10071 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10073 self.0.request.page_size = v.into();
10074 self
10075 }
10076
10077 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10079 self.0.request.filter = v.into();
10080 self
10081 }
10082
10083 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
10085 self.0.request.validate_only = v.into();
10086 self
10087 }
10088
10089 pub fn set_params<T, K, V>(mut self, v: T) -> Self
10091 where
10092 T: std::iter::IntoIterator<Item = (K, V)>,
10093 K: std::convert::Into<std::string::String>,
10094 V: std::convert::Into<wkt::Value>,
10095 {
10096 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10097 self
10098 }
10099
10100 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
10102 where
10103 T: std::iter::IntoIterator<Item = (K, V)>,
10104 K: std::convert::Into<std::string::String>,
10105 V: std::convert::Into<std::string::String>,
10106 {
10107 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10108 self
10109 }
10110 }
10111
10112 #[doc(hidden)]
10113 impl crate::RequestBuilder for Recommend {
10114 fn request_options(&mut self) -> &mut crate::RequestOptions {
10115 &mut self.0.options
10116 }
10117 }
10118
10119 #[derive(Clone, Debug)]
10140 pub struct ListOperations(
10141 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10142 );
10143
10144 impl ListOperations {
10145 pub(crate) fn new(
10146 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10147 ) -> Self {
10148 Self(RequestBuilder::new(stub))
10149 }
10150
10151 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
10153 mut self,
10154 v: V,
10155 ) -> Self {
10156 self.0.request = v.into();
10157 self
10158 }
10159
10160 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10162 self.0.options = v.into();
10163 self
10164 }
10165
10166 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
10168 (*self.0.stub)
10169 .list_operations(self.0.request, self.0.options)
10170 .await
10171 .map(crate::Response::into_body)
10172 }
10173
10174 pub fn by_page(
10176 self,
10177 ) -> impl google_cloud_gax::paginator::Paginator<
10178 google_cloud_longrunning::model::ListOperationsResponse,
10179 crate::Error,
10180 > {
10181 use std::clone::Clone;
10182 let token = self.0.request.page_token.clone();
10183 let execute = move |token: String| {
10184 let mut builder = self.clone();
10185 builder.0.request = builder.0.request.set_page_token(token);
10186 builder.send()
10187 };
10188 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10189 }
10190
10191 pub fn by_item(
10193 self,
10194 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10195 google_cloud_longrunning::model::ListOperationsResponse,
10196 crate::Error,
10197 > {
10198 use google_cloud_gax::paginator::Paginator;
10199 self.by_page().items()
10200 }
10201
10202 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10204 self.0.request.name = v.into();
10205 self
10206 }
10207
10208 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10210 self.0.request.filter = v.into();
10211 self
10212 }
10213
10214 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10216 self.0.request.page_size = v.into();
10217 self
10218 }
10219
10220 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10222 self.0.request.page_token = v.into();
10223 self
10224 }
10225
10226 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10228 self.0.request.return_partial_success = v.into();
10229 self
10230 }
10231 }
10232
10233 #[doc(hidden)]
10234 impl crate::RequestBuilder for ListOperations {
10235 fn request_options(&mut self) -> &mut crate::RequestOptions {
10236 &mut self.0.options
10237 }
10238 }
10239
10240 #[derive(Clone, Debug)]
10257 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10258
10259 impl GetOperation {
10260 pub(crate) fn new(
10261 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10262 ) -> Self {
10263 Self(RequestBuilder::new(stub))
10264 }
10265
10266 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10268 mut self,
10269 v: V,
10270 ) -> Self {
10271 self.0.request = v.into();
10272 self
10273 }
10274
10275 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10277 self.0.options = v.into();
10278 self
10279 }
10280
10281 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10283 (*self.0.stub)
10284 .get_operation(self.0.request, self.0.options)
10285 .await
10286 .map(crate::Response::into_body)
10287 }
10288
10289 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10291 self.0.request.name = v.into();
10292 self
10293 }
10294 }
10295
10296 #[doc(hidden)]
10297 impl crate::RequestBuilder for GetOperation {
10298 fn request_options(&mut self) -> &mut crate::RequestOptions {
10299 &mut self.0.options
10300 }
10301 }
10302
10303 #[derive(Clone, Debug)]
10320 pub struct CancelOperation(
10321 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10322 );
10323
10324 impl CancelOperation {
10325 pub(crate) fn new(
10326 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10327 ) -> Self {
10328 Self(RequestBuilder::new(stub))
10329 }
10330
10331 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10333 mut self,
10334 v: V,
10335 ) -> Self {
10336 self.0.request = v.into();
10337 self
10338 }
10339
10340 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10342 self.0.options = v.into();
10343 self
10344 }
10345
10346 pub async fn send(self) -> Result<()> {
10348 (*self.0.stub)
10349 .cancel_operation(self.0.request, self.0.options)
10350 .await
10351 .map(crate::Response::into_body)
10352 }
10353
10354 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10356 self.0.request.name = v.into();
10357 self
10358 }
10359 }
10360
10361 #[doc(hidden)]
10362 impl crate::RequestBuilder for CancelOperation {
10363 fn request_options(&mut self) -> &mut crate::RequestOptions {
10364 &mut self.0.options
10365 }
10366 }
10367}
10368
10369#[cfg(feature = "schema-service")]
10370#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
10371pub mod schema_service {
10372 use crate::Result;
10373
10374 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10388
10389 pub(crate) mod client {
10390 use super::super::super::client::SchemaService;
10391 pub struct Factory;
10392 impl crate::ClientFactory for Factory {
10393 type Client = SchemaService;
10394 type Credentials = gaxi::options::Credentials;
10395 async fn build(
10396 self,
10397 config: gaxi::options::ClientConfig,
10398 ) -> crate::ClientBuilderResult<Self::Client> {
10399 Self::Client::new(config).await
10400 }
10401 }
10402 }
10403
10404 #[derive(Clone, Debug)]
10406 pub(crate) struct RequestBuilder<R: std::default::Default> {
10407 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10408 request: R,
10409 options: crate::RequestOptions,
10410 }
10411
10412 impl<R> RequestBuilder<R>
10413 where
10414 R: std::default::Default,
10415 {
10416 pub(crate) fn new(
10417 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10418 ) -> Self {
10419 Self {
10420 stub,
10421 request: R::default(),
10422 options: crate::RequestOptions::default(),
10423 }
10424 }
10425 }
10426
10427 #[derive(Clone, Debug)]
10444 pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
10445
10446 impl GetSchema {
10447 pub(crate) fn new(
10448 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10449 ) -> Self {
10450 Self(RequestBuilder::new(stub))
10451 }
10452
10453 pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
10455 self.0.request = v.into();
10456 self
10457 }
10458
10459 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10461 self.0.options = v.into();
10462 self
10463 }
10464
10465 pub async fn send(self) -> Result<crate::model::Schema> {
10467 (*self.0.stub)
10468 .get_schema(self.0.request, self.0.options)
10469 .await
10470 .map(crate::Response::into_body)
10471 }
10472
10473 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10477 self.0.request.name = v.into();
10478 self
10479 }
10480 }
10481
10482 #[doc(hidden)]
10483 impl crate::RequestBuilder for GetSchema {
10484 fn request_options(&mut self) -> &mut crate::RequestOptions {
10485 &mut self.0.options
10486 }
10487 }
10488
10489 #[derive(Clone, Debug)]
10510 pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
10511
10512 impl ListSchemas {
10513 pub(crate) fn new(
10514 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10515 ) -> Self {
10516 Self(RequestBuilder::new(stub))
10517 }
10518
10519 pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
10521 self.0.request = v.into();
10522 self
10523 }
10524
10525 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10527 self.0.options = v.into();
10528 self
10529 }
10530
10531 pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
10533 (*self.0.stub)
10534 .list_schemas(self.0.request, self.0.options)
10535 .await
10536 .map(crate::Response::into_body)
10537 }
10538
10539 pub fn by_page(
10541 self,
10542 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSchemasResponse, crate::Error>
10543 {
10544 use std::clone::Clone;
10545 let token = self.0.request.page_token.clone();
10546 let execute = move |token: String| {
10547 let mut builder = self.clone();
10548 builder.0.request = builder.0.request.set_page_token(token);
10549 builder.send()
10550 };
10551 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10552 }
10553
10554 pub fn by_item(
10556 self,
10557 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10558 crate::model::ListSchemasResponse,
10559 crate::Error,
10560 > {
10561 use google_cloud_gax::paginator::Paginator;
10562 self.by_page().items()
10563 }
10564
10565 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10569 self.0.request.parent = v.into();
10570 self
10571 }
10572
10573 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10575 self.0.request.page_size = v.into();
10576 self
10577 }
10578
10579 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10581 self.0.request.page_token = v.into();
10582 self
10583 }
10584 }
10585
10586 #[doc(hidden)]
10587 impl crate::RequestBuilder for ListSchemas {
10588 fn request_options(&mut self) -> &mut crate::RequestOptions {
10589 &mut self.0.options
10590 }
10591 }
10592
10593 #[derive(Clone, Debug)]
10611 pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
10612
10613 impl CreateSchema {
10614 pub(crate) fn new(
10615 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10616 ) -> Self {
10617 Self(RequestBuilder::new(stub))
10618 }
10619
10620 pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
10622 self.0.request = v.into();
10623 self
10624 }
10625
10626 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10628 self.0.options = v.into();
10629 self
10630 }
10631
10632 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10639 (*self.0.stub)
10640 .create_schema(self.0.request, self.0.options)
10641 .await
10642 .map(crate::Response::into_body)
10643 }
10644
10645 pub fn poller(
10647 self,
10648 ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata>
10649 {
10650 type Operation = google_cloud_lro::internal::Operation<
10651 crate::model::Schema,
10652 crate::model::CreateSchemaMetadata,
10653 >;
10654 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10655 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10656
10657 let stub = self.0.stub.clone();
10658 let mut options = self.0.options.clone();
10659 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10660 let query = move |name| {
10661 let stub = stub.clone();
10662 let options = options.clone();
10663 async {
10664 let op = GetOperation::new(stub)
10665 .set_name(name)
10666 .with_options(options)
10667 .send()
10668 .await?;
10669 Ok(Operation::new(op))
10670 }
10671 };
10672
10673 let start = move || async {
10674 let op = self.send().await?;
10675 Ok(Operation::new(op))
10676 };
10677
10678 google_cloud_lro::internal::new_poller(
10679 polling_error_policy,
10680 polling_backoff_policy,
10681 start,
10682 query,
10683 )
10684 }
10685
10686 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10690 self.0.request.parent = v.into();
10691 self
10692 }
10693
10694 pub fn set_schema<T>(mut self, v: T) -> Self
10698 where
10699 T: std::convert::Into<crate::model::Schema>,
10700 {
10701 self.0.request.schema = std::option::Option::Some(v.into());
10702 self
10703 }
10704
10705 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10709 where
10710 T: std::convert::Into<crate::model::Schema>,
10711 {
10712 self.0.request.schema = v.map(|x| x.into());
10713 self
10714 }
10715
10716 pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
10720 self.0.request.schema_id = v.into();
10721 self
10722 }
10723 }
10724
10725 #[doc(hidden)]
10726 impl crate::RequestBuilder for CreateSchema {
10727 fn request_options(&mut self) -> &mut crate::RequestOptions {
10728 &mut self.0.options
10729 }
10730 }
10731
10732 #[derive(Clone, Debug)]
10750 pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
10751
10752 impl UpdateSchema {
10753 pub(crate) fn new(
10754 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10755 ) -> Self {
10756 Self(RequestBuilder::new(stub))
10757 }
10758
10759 pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
10761 self.0.request = v.into();
10762 self
10763 }
10764
10765 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10767 self.0.options = v.into();
10768 self
10769 }
10770
10771 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10778 (*self.0.stub)
10779 .update_schema(self.0.request, self.0.options)
10780 .await
10781 .map(crate::Response::into_body)
10782 }
10783
10784 pub fn poller(
10786 self,
10787 ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata>
10788 {
10789 type Operation = google_cloud_lro::internal::Operation<
10790 crate::model::Schema,
10791 crate::model::UpdateSchemaMetadata,
10792 >;
10793 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10794 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10795
10796 let stub = self.0.stub.clone();
10797 let mut options = self.0.options.clone();
10798 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10799 let query = move |name| {
10800 let stub = stub.clone();
10801 let options = options.clone();
10802 async {
10803 let op = GetOperation::new(stub)
10804 .set_name(name)
10805 .with_options(options)
10806 .send()
10807 .await?;
10808 Ok(Operation::new(op))
10809 }
10810 };
10811
10812 let start = move || async {
10813 let op = self.send().await?;
10814 Ok(Operation::new(op))
10815 };
10816
10817 google_cloud_lro::internal::new_poller(
10818 polling_error_policy,
10819 polling_backoff_policy,
10820 start,
10821 query,
10822 )
10823 }
10824
10825 pub fn set_schema<T>(mut self, v: T) -> Self
10829 where
10830 T: std::convert::Into<crate::model::Schema>,
10831 {
10832 self.0.request.schema = std::option::Option::Some(v.into());
10833 self
10834 }
10835
10836 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10840 where
10841 T: std::convert::Into<crate::model::Schema>,
10842 {
10843 self.0.request.schema = v.map(|x| x.into());
10844 self
10845 }
10846
10847 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
10849 self.0.request.allow_missing = v.into();
10850 self
10851 }
10852 }
10853
10854 #[doc(hidden)]
10855 impl crate::RequestBuilder for UpdateSchema {
10856 fn request_options(&mut self) -> &mut crate::RequestOptions {
10857 &mut self.0.options
10858 }
10859 }
10860
10861 #[derive(Clone, Debug)]
10879 pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
10880
10881 impl DeleteSchema {
10882 pub(crate) fn new(
10883 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10884 ) -> Self {
10885 Self(RequestBuilder::new(stub))
10886 }
10887
10888 pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
10890 self.0.request = v.into();
10891 self
10892 }
10893
10894 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10896 self.0.options = v.into();
10897 self
10898 }
10899
10900 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10907 (*self.0.stub)
10908 .delete_schema(self.0.request, self.0.options)
10909 .await
10910 .map(crate::Response::into_body)
10911 }
10912
10913 pub fn poller(
10915 self,
10916 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSchemaMetadata> {
10917 type Operation = google_cloud_lro::internal::Operation<
10918 wkt::Empty,
10919 crate::model::DeleteSchemaMetadata,
10920 >;
10921 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10922 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10923
10924 let stub = self.0.stub.clone();
10925 let mut options = self.0.options.clone();
10926 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10927 let query = move |name| {
10928 let stub = stub.clone();
10929 let options = options.clone();
10930 async {
10931 let op = GetOperation::new(stub)
10932 .set_name(name)
10933 .with_options(options)
10934 .send()
10935 .await?;
10936 Ok(Operation::new(op))
10937 }
10938 };
10939
10940 let start = move || async {
10941 let op = self.send().await?;
10942 Ok(Operation::new(op))
10943 };
10944
10945 google_cloud_lro::internal::new_unit_response_poller(
10946 polling_error_policy,
10947 polling_backoff_policy,
10948 start,
10949 query,
10950 )
10951 }
10952
10953 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10957 self.0.request.name = v.into();
10958 self
10959 }
10960 }
10961
10962 #[doc(hidden)]
10963 impl crate::RequestBuilder for DeleteSchema {
10964 fn request_options(&mut self) -> &mut crate::RequestOptions {
10965 &mut self.0.options
10966 }
10967 }
10968
10969 #[derive(Clone, Debug)]
10990 pub struct ListOperations(
10991 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10992 );
10993
10994 impl ListOperations {
10995 pub(crate) fn new(
10996 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10997 ) -> Self {
10998 Self(RequestBuilder::new(stub))
10999 }
11000
11001 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
11003 mut self,
11004 v: V,
11005 ) -> Self {
11006 self.0.request = v.into();
11007 self
11008 }
11009
11010 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11012 self.0.options = v.into();
11013 self
11014 }
11015
11016 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
11018 (*self.0.stub)
11019 .list_operations(self.0.request, self.0.options)
11020 .await
11021 .map(crate::Response::into_body)
11022 }
11023
11024 pub fn by_page(
11026 self,
11027 ) -> impl google_cloud_gax::paginator::Paginator<
11028 google_cloud_longrunning::model::ListOperationsResponse,
11029 crate::Error,
11030 > {
11031 use std::clone::Clone;
11032 let token = self.0.request.page_token.clone();
11033 let execute = move |token: String| {
11034 let mut builder = self.clone();
11035 builder.0.request = builder.0.request.set_page_token(token);
11036 builder.send()
11037 };
11038 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11039 }
11040
11041 pub fn by_item(
11043 self,
11044 ) -> impl google_cloud_gax::paginator::ItemPaginator<
11045 google_cloud_longrunning::model::ListOperationsResponse,
11046 crate::Error,
11047 > {
11048 use google_cloud_gax::paginator::Paginator;
11049 self.by_page().items()
11050 }
11051
11052 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11054 self.0.request.name = v.into();
11055 self
11056 }
11057
11058 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11060 self.0.request.filter = v.into();
11061 self
11062 }
11063
11064 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11066 self.0.request.page_size = v.into();
11067 self
11068 }
11069
11070 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11072 self.0.request.page_token = v.into();
11073 self
11074 }
11075
11076 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
11078 self.0.request.return_partial_success = v.into();
11079 self
11080 }
11081 }
11082
11083 #[doc(hidden)]
11084 impl crate::RequestBuilder for ListOperations {
11085 fn request_options(&mut self) -> &mut crate::RequestOptions {
11086 &mut self.0.options
11087 }
11088 }
11089
11090 #[derive(Clone, Debug)]
11107 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
11108
11109 impl GetOperation {
11110 pub(crate) fn new(
11111 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11112 ) -> Self {
11113 Self(RequestBuilder::new(stub))
11114 }
11115
11116 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
11118 mut self,
11119 v: V,
11120 ) -> Self {
11121 self.0.request = v.into();
11122 self
11123 }
11124
11125 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11127 self.0.options = v.into();
11128 self
11129 }
11130
11131 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11133 (*self.0.stub)
11134 .get_operation(self.0.request, self.0.options)
11135 .await
11136 .map(crate::Response::into_body)
11137 }
11138
11139 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11141 self.0.request.name = v.into();
11142 self
11143 }
11144 }
11145
11146 #[doc(hidden)]
11147 impl crate::RequestBuilder for GetOperation {
11148 fn request_options(&mut self) -> &mut crate::RequestOptions {
11149 &mut self.0.options
11150 }
11151 }
11152
11153 #[derive(Clone, Debug)]
11170 pub struct CancelOperation(
11171 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
11172 );
11173
11174 impl CancelOperation {
11175 pub(crate) fn new(
11176 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11177 ) -> Self {
11178 Self(RequestBuilder::new(stub))
11179 }
11180
11181 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
11183 mut self,
11184 v: V,
11185 ) -> Self {
11186 self.0.request = v.into();
11187 self
11188 }
11189
11190 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11192 self.0.options = v.into();
11193 self
11194 }
11195
11196 pub async fn send(self) -> Result<()> {
11198 (*self.0.stub)
11199 .cancel_operation(self.0.request, self.0.options)
11200 .await
11201 .map(crate::Response::into_body)
11202 }
11203
11204 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11206 self.0.request.name = v.into();
11207 self
11208 }
11209 }
11210
11211 #[doc(hidden)]
11212 impl crate::RequestBuilder for CancelOperation {
11213 fn request_options(&mut self) -> &mut crate::RequestOptions {
11214 &mut self.0.options
11215 }
11216 }
11217}
11218
11219#[cfg(feature = "search-service")]
11220#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11221pub mod search_service {
11222 use crate::Result;
11223
11224 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11238
11239 pub(crate) mod client {
11240 use super::super::super::client::SearchService;
11241 pub struct Factory;
11242 impl crate::ClientFactory for Factory {
11243 type Client = SearchService;
11244 type Credentials = gaxi::options::Credentials;
11245 async fn build(
11246 self,
11247 config: gaxi::options::ClientConfig,
11248 ) -> crate::ClientBuilderResult<Self::Client> {
11249 Self::Client::new(config).await
11250 }
11251 }
11252 }
11253
11254 #[derive(Clone, Debug)]
11256 pub(crate) struct RequestBuilder<R: std::default::Default> {
11257 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11258 request: R,
11259 options: crate::RequestOptions,
11260 }
11261
11262 impl<R> RequestBuilder<R>
11263 where
11264 R: std::default::Default,
11265 {
11266 pub(crate) fn new(
11267 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11268 ) -> Self {
11269 Self {
11270 stub,
11271 request: R::default(),
11272 options: crate::RequestOptions::default(),
11273 }
11274 }
11275 }
11276
11277 #[derive(Clone, Debug)]
11298 pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11299
11300 impl Search {
11301 pub(crate) fn new(
11302 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11303 ) -> Self {
11304 Self(RequestBuilder::new(stub))
11305 }
11306
11307 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11309 self.0.request = v.into();
11310 self
11311 }
11312
11313 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11315 self.0.options = v.into();
11316 self
11317 }
11318
11319 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11321 (*self.0.stub)
11322 .search(self.0.request, self.0.options)
11323 .await
11324 .map(crate::Response::into_body)
11325 }
11326
11327 pub fn by_page(
11329 self,
11330 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11331 {
11332 use std::clone::Clone;
11333 let token = self.0.request.page_token.clone();
11334 let execute = move |token: String| {
11335 let mut builder = self.clone();
11336 builder.0.request = builder.0.request.set_page_token(token);
11337 builder.send()
11338 };
11339 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11340 }
11341
11342 pub fn by_item(
11344 self,
11345 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11346 {
11347 use google_cloud_gax::paginator::Paginator;
11348 self.by_page().items()
11349 }
11350
11351 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11355 self.0.request.serving_config = v.into();
11356 self
11357 }
11358
11359 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11361 self.0.request.branch = v.into();
11362 self
11363 }
11364
11365 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11367 self.0.request.query = v.into();
11368 self
11369 }
11370
11371 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
11373 where
11374 T: std::iter::IntoIterator<Item = V>,
11375 V: std::convert::Into<std::string::String>,
11376 {
11377 use std::iter::Iterator;
11378 self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
11379 self
11380 }
11381
11382 pub fn set_image_query<T>(mut self, v: T) -> Self
11384 where
11385 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11386 {
11387 self.0.request.image_query = std::option::Option::Some(v.into());
11388 self
11389 }
11390
11391 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11393 where
11394 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11395 {
11396 self.0.request.image_query = v.map(|x| x.into());
11397 self
11398 }
11399
11400 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11402 self.0.request.page_size = v.into();
11403 self
11404 }
11405
11406 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11408 self.0.request.page_token = v.into();
11409 self
11410 }
11411
11412 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11414 self.0.request.offset = v.into();
11415 self
11416 }
11417
11418 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11420 self.0.request.one_box_page_size = v.into();
11421 self
11422 }
11423
11424 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11426 where
11427 T: std::iter::IntoIterator<Item = V>,
11428 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11429 {
11430 use std::iter::Iterator;
11431 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11432 self
11433 }
11434
11435 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11437 self.0.request.filter = v.into();
11438 self
11439 }
11440
11441 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11443 self.0.request.canonical_filter = v.into();
11444 self
11445 }
11446
11447 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11449 self.0.request.order_by = v.into();
11450 self
11451 }
11452
11453 pub fn set_user_info<T>(mut self, v: T) -> Self
11455 where
11456 T: std::convert::Into<crate::model::UserInfo>,
11457 {
11458 self.0.request.user_info = std::option::Option::Some(v.into());
11459 self
11460 }
11461
11462 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11464 where
11465 T: std::convert::Into<crate::model::UserInfo>,
11466 {
11467 self.0.request.user_info = v.map(|x| x.into());
11468 self
11469 }
11470
11471 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11473 self.0.request.language_code = v.into();
11474 self
11475 }
11476
11477 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11479 where
11480 T: std::iter::IntoIterator<Item = V>,
11481 V: std::convert::Into<crate::model::search_request::FacetSpec>,
11482 {
11483 use std::iter::Iterator;
11484 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11485 self
11486 }
11487
11488 pub fn set_boost_spec<T>(mut self, v: T) -> Self
11490 where
11491 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11492 {
11493 self.0.request.boost_spec = std::option::Option::Some(v.into());
11494 self
11495 }
11496
11497 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11499 where
11500 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11501 {
11502 self.0.request.boost_spec = v.map(|x| x.into());
11503 self
11504 }
11505
11506 pub fn set_params<T, K, V>(mut self, v: T) -> Self
11508 where
11509 T: std::iter::IntoIterator<Item = (K, V)>,
11510 K: std::convert::Into<std::string::String>,
11511 V: std::convert::Into<wkt::Value>,
11512 {
11513 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11514 self
11515 }
11516
11517 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11519 where
11520 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11521 {
11522 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11523 self
11524 }
11525
11526 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11528 where
11529 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11530 {
11531 self.0.request.query_expansion_spec = v.map(|x| x.into());
11532 self
11533 }
11534
11535 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11537 where
11538 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11539 {
11540 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11541 self
11542 }
11543
11544 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11546 where
11547 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11548 {
11549 self.0.request.spell_correction_spec = v.map(|x| x.into());
11550 self
11551 }
11552
11553 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11555 self.0.request.user_pseudo_id = v.into();
11556 self
11557 }
11558
11559 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11561 where
11562 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11563 {
11564 self.0.request.content_search_spec = std::option::Option::Some(v.into());
11565 self
11566 }
11567
11568 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11570 where
11571 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11572 {
11573 self.0.request.content_search_spec = v.map(|x| x.into());
11574 self
11575 }
11576
11577 pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
11579 self.0.request.ranking_expression = v.into();
11580 self
11581 }
11582
11583 pub fn set_ranking_expression_backend<
11585 T: Into<crate::model::search_request::RankingExpressionBackend>,
11586 >(
11587 mut self,
11588 v: T,
11589 ) -> Self {
11590 self.0.request.ranking_expression_backend = v.into();
11591 self
11592 }
11593
11594 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11596 self.0.request.safe_search = v.into();
11597 self
11598 }
11599
11600 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11602 where
11603 T: std::iter::IntoIterator<Item = (K, V)>,
11604 K: std::convert::Into<std::string::String>,
11605 V: std::convert::Into<std::string::String>,
11606 {
11607 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11608 self
11609 }
11610
11611 pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
11613 where
11614 T: std::convert::Into<
11615 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
11616 >,
11617 {
11618 self.0.request.natural_language_query_understanding_spec =
11619 std::option::Option::Some(v.into());
11620 self
11621 }
11622
11623 pub fn set_or_clear_natural_language_query_understanding_spec<T>(
11625 mut self,
11626 v: std::option::Option<T>,
11627 ) -> Self
11628 where
11629 T: std::convert::Into<
11630 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
11631 >,
11632 {
11633 self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
11634 self
11635 }
11636
11637 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11639 where
11640 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11641 {
11642 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11643 self
11644 }
11645
11646 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11648 where
11649 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11650 {
11651 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11652 self
11653 }
11654
11655 pub fn set_display_spec<T>(mut self, v: T) -> Self
11657 where
11658 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11659 {
11660 self.0.request.display_spec = std::option::Option::Some(v.into());
11661 self
11662 }
11663
11664 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11666 where
11667 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11668 {
11669 self.0.request.display_spec = v.map(|x| x.into());
11670 self
11671 }
11672
11673 pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
11675 where
11676 T: std::iter::IntoIterator<Item = V>,
11677 V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
11678 {
11679 use std::iter::Iterator;
11680 self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
11681 self
11682 }
11683
11684 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11686 self.0.request.session = v.into();
11687 self
11688 }
11689
11690 pub fn set_session_spec<T>(mut self, v: T) -> Self
11692 where
11693 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11694 {
11695 self.0.request.session_spec = std::option::Option::Some(v.into());
11696 self
11697 }
11698
11699 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11701 where
11702 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11703 {
11704 self.0.request.session_spec = v.map(|x| x.into());
11705 self
11706 }
11707
11708 pub fn set_relevance_threshold<
11710 T: Into<crate::model::search_request::RelevanceThreshold>,
11711 >(
11712 mut self,
11713 v: T,
11714 ) -> Self {
11715 self.0.request.relevance_threshold = v.into();
11716 self
11717 }
11718
11719 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11721 where
11722 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11723 {
11724 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11725 self
11726 }
11727
11728 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11730 where
11731 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11732 {
11733 self.0.request.relevance_score_spec = v.map(|x| x.into());
11734 self
11735 }
11736 }
11737
11738 #[doc(hidden)]
11739 impl crate::RequestBuilder for Search {
11740 fn request_options(&mut self) -> &mut crate::RequestOptions {
11741 &mut self.0.options
11742 }
11743 }
11744
11745 #[derive(Clone, Debug)]
11766 pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11767
11768 impl SearchLite {
11769 pub(crate) fn new(
11770 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11771 ) -> Self {
11772 Self(RequestBuilder::new(stub))
11773 }
11774
11775 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11777 self.0.request = v.into();
11778 self
11779 }
11780
11781 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11783 self.0.options = v.into();
11784 self
11785 }
11786
11787 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11789 (*self.0.stub)
11790 .search_lite(self.0.request, self.0.options)
11791 .await
11792 .map(crate::Response::into_body)
11793 }
11794
11795 pub fn by_page(
11797 self,
11798 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11799 {
11800 use std::clone::Clone;
11801 let token = self.0.request.page_token.clone();
11802 let execute = move |token: String| {
11803 let mut builder = self.clone();
11804 builder.0.request = builder.0.request.set_page_token(token);
11805 builder.send()
11806 };
11807 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11808 }
11809
11810 pub fn by_item(
11812 self,
11813 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11814 {
11815 use google_cloud_gax::paginator::Paginator;
11816 self.by_page().items()
11817 }
11818
11819 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11823 self.0.request.serving_config = v.into();
11824 self
11825 }
11826
11827 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11829 self.0.request.branch = v.into();
11830 self
11831 }
11832
11833 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11835 self.0.request.query = v.into();
11836 self
11837 }
11838
11839 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
11841 where
11842 T: std::iter::IntoIterator<Item = V>,
11843 V: std::convert::Into<std::string::String>,
11844 {
11845 use std::iter::Iterator;
11846 self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
11847 self
11848 }
11849
11850 pub fn set_image_query<T>(mut self, v: T) -> Self
11852 where
11853 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11854 {
11855 self.0.request.image_query = std::option::Option::Some(v.into());
11856 self
11857 }
11858
11859 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11861 where
11862 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11863 {
11864 self.0.request.image_query = v.map(|x| x.into());
11865 self
11866 }
11867
11868 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11870 self.0.request.page_size = v.into();
11871 self
11872 }
11873
11874 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11876 self.0.request.page_token = v.into();
11877 self
11878 }
11879
11880 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11882 self.0.request.offset = v.into();
11883 self
11884 }
11885
11886 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11888 self.0.request.one_box_page_size = v.into();
11889 self
11890 }
11891
11892 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11894 where
11895 T: std::iter::IntoIterator<Item = V>,
11896 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11897 {
11898 use std::iter::Iterator;
11899 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11900 self
11901 }
11902
11903 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11905 self.0.request.filter = v.into();
11906 self
11907 }
11908
11909 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11911 self.0.request.canonical_filter = v.into();
11912 self
11913 }
11914
11915 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11917 self.0.request.order_by = v.into();
11918 self
11919 }
11920
11921 pub fn set_user_info<T>(mut self, v: T) -> Self
11923 where
11924 T: std::convert::Into<crate::model::UserInfo>,
11925 {
11926 self.0.request.user_info = std::option::Option::Some(v.into());
11927 self
11928 }
11929
11930 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11932 where
11933 T: std::convert::Into<crate::model::UserInfo>,
11934 {
11935 self.0.request.user_info = v.map(|x| x.into());
11936 self
11937 }
11938
11939 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11941 self.0.request.language_code = v.into();
11942 self
11943 }
11944
11945 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11947 where
11948 T: std::iter::IntoIterator<Item = V>,
11949 V: std::convert::Into<crate::model::search_request::FacetSpec>,
11950 {
11951 use std::iter::Iterator;
11952 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11953 self
11954 }
11955
11956 pub fn set_boost_spec<T>(mut self, v: T) -> Self
11958 where
11959 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11960 {
11961 self.0.request.boost_spec = std::option::Option::Some(v.into());
11962 self
11963 }
11964
11965 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11967 where
11968 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11969 {
11970 self.0.request.boost_spec = v.map(|x| x.into());
11971 self
11972 }
11973
11974 pub fn set_params<T, K, V>(mut self, v: T) -> Self
11976 where
11977 T: std::iter::IntoIterator<Item = (K, V)>,
11978 K: std::convert::Into<std::string::String>,
11979 V: std::convert::Into<wkt::Value>,
11980 {
11981 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11982 self
11983 }
11984
11985 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11987 where
11988 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11989 {
11990 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11991 self
11992 }
11993
11994 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11996 where
11997 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11998 {
11999 self.0.request.query_expansion_spec = v.map(|x| x.into());
12000 self
12001 }
12002
12003 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
12005 where
12006 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12007 {
12008 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
12009 self
12010 }
12011
12012 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
12014 where
12015 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12016 {
12017 self.0.request.spell_correction_spec = v.map(|x| x.into());
12018 self
12019 }
12020
12021 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12023 self.0.request.user_pseudo_id = v.into();
12024 self
12025 }
12026
12027 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
12029 where
12030 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12031 {
12032 self.0.request.content_search_spec = std::option::Option::Some(v.into());
12033 self
12034 }
12035
12036 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
12038 where
12039 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12040 {
12041 self.0.request.content_search_spec = v.map(|x| x.into());
12042 self
12043 }
12044
12045 pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12047 self.0.request.ranking_expression = v.into();
12048 self
12049 }
12050
12051 pub fn set_ranking_expression_backend<
12053 T: Into<crate::model::search_request::RankingExpressionBackend>,
12054 >(
12055 mut self,
12056 v: T,
12057 ) -> Self {
12058 self.0.request.ranking_expression_backend = v.into();
12059 self
12060 }
12061
12062 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
12064 self.0.request.safe_search = v.into();
12065 self
12066 }
12067
12068 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12070 where
12071 T: std::iter::IntoIterator<Item = (K, V)>,
12072 K: std::convert::Into<std::string::String>,
12073 V: std::convert::Into<std::string::String>,
12074 {
12075 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12076 self
12077 }
12078
12079 pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> Self
12081 where
12082 T: std::convert::Into<
12083 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12084 >,
12085 {
12086 self.0.request.natural_language_query_understanding_spec =
12087 std::option::Option::Some(v.into());
12088 self
12089 }
12090
12091 pub fn set_or_clear_natural_language_query_understanding_spec<T>(
12093 mut self,
12094 v: std::option::Option<T>,
12095 ) -> Self
12096 where
12097 T: std::convert::Into<
12098 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12099 >,
12100 {
12101 self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
12102 self
12103 }
12104
12105 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
12107 where
12108 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12109 {
12110 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
12111 self
12112 }
12113
12114 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
12116 where
12117 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12118 {
12119 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
12120 self
12121 }
12122
12123 pub fn set_display_spec<T>(mut self, v: T) -> Self
12125 where
12126 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12127 {
12128 self.0.request.display_spec = std::option::Option::Some(v.into());
12129 self
12130 }
12131
12132 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
12134 where
12135 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12136 {
12137 self.0.request.display_spec = v.map(|x| x.into());
12138 self
12139 }
12140
12141 pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
12143 where
12144 T: std::iter::IntoIterator<Item = V>,
12145 V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
12146 {
12147 use std::iter::Iterator;
12148 self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
12149 self
12150 }
12151
12152 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
12154 self.0.request.session = v.into();
12155 self
12156 }
12157
12158 pub fn set_session_spec<T>(mut self, v: T) -> Self
12160 where
12161 T: std::convert::Into<crate::model::search_request::SessionSpec>,
12162 {
12163 self.0.request.session_spec = std::option::Option::Some(v.into());
12164 self
12165 }
12166
12167 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
12169 where
12170 T: std::convert::Into<crate::model::search_request::SessionSpec>,
12171 {
12172 self.0.request.session_spec = v.map(|x| x.into());
12173 self
12174 }
12175
12176 pub fn set_relevance_threshold<
12178 T: Into<crate::model::search_request::RelevanceThreshold>,
12179 >(
12180 mut self,
12181 v: T,
12182 ) -> Self {
12183 self.0.request.relevance_threshold = v.into();
12184 self
12185 }
12186
12187 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
12189 where
12190 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12191 {
12192 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
12193 self
12194 }
12195
12196 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12198 where
12199 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12200 {
12201 self.0.request.relevance_score_spec = v.map(|x| x.into());
12202 self
12203 }
12204 }
12205
12206 #[doc(hidden)]
12207 impl crate::RequestBuilder for SearchLite {
12208 fn request_options(&mut self) -> &mut crate::RequestOptions {
12209 &mut self.0.options
12210 }
12211 }
12212
12213 #[derive(Clone, Debug)]
12234 pub struct ListOperations(
12235 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12236 );
12237
12238 impl ListOperations {
12239 pub(crate) fn new(
12240 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12241 ) -> Self {
12242 Self(RequestBuilder::new(stub))
12243 }
12244
12245 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12247 mut self,
12248 v: V,
12249 ) -> Self {
12250 self.0.request = v.into();
12251 self
12252 }
12253
12254 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12256 self.0.options = v.into();
12257 self
12258 }
12259
12260 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12262 (*self.0.stub)
12263 .list_operations(self.0.request, self.0.options)
12264 .await
12265 .map(crate::Response::into_body)
12266 }
12267
12268 pub fn by_page(
12270 self,
12271 ) -> impl google_cloud_gax::paginator::Paginator<
12272 google_cloud_longrunning::model::ListOperationsResponse,
12273 crate::Error,
12274 > {
12275 use std::clone::Clone;
12276 let token = self.0.request.page_token.clone();
12277 let execute = move |token: String| {
12278 let mut builder = self.clone();
12279 builder.0.request = builder.0.request.set_page_token(token);
12280 builder.send()
12281 };
12282 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12283 }
12284
12285 pub fn by_item(
12287 self,
12288 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12289 google_cloud_longrunning::model::ListOperationsResponse,
12290 crate::Error,
12291 > {
12292 use google_cloud_gax::paginator::Paginator;
12293 self.by_page().items()
12294 }
12295
12296 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12298 self.0.request.name = v.into();
12299 self
12300 }
12301
12302 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12304 self.0.request.filter = v.into();
12305 self
12306 }
12307
12308 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12310 self.0.request.page_size = v.into();
12311 self
12312 }
12313
12314 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12316 self.0.request.page_token = v.into();
12317 self
12318 }
12319
12320 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12322 self.0.request.return_partial_success = v.into();
12323 self
12324 }
12325 }
12326
12327 #[doc(hidden)]
12328 impl crate::RequestBuilder for ListOperations {
12329 fn request_options(&mut self) -> &mut crate::RequestOptions {
12330 &mut self.0.options
12331 }
12332 }
12333
12334 #[derive(Clone, Debug)]
12351 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12352
12353 impl GetOperation {
12354 pub(crate) fn new(
12355 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12356 ) -> Self {
12357 Self(RequestBuilder::new(stub))
12358 }
12359
12360 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12362 mut self,
12363 v: V,
12364 ) -> Self {
12365 self.0.request = v.into();
12366 self
12367 }
12368
12369 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12371 self.0.options = v.into();
12372 self
12373 }
12374
12375 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12377 (*self.0.stub)
12378 .get_operation(self.0.request, self.0.options)
12379 .await
12380 .map(crate::Response::into_body)
12381 }
12382
12383 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12385 self.0.request.name = v.into();
12386 self
12387 }
12388 }
12389
12390 #[doc(hidden)]
12391 impl crate::RequestBuilder for GetOperation {
12392 fn request_options(&mut self) -> &mut crate::RequestOptions {
12393 &mut self.0.options
12394 }
12395 }
12396
12397 #[derive(Clone, Debug)]
12414 pub struct CancelOperation(
12415 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12416 );
12417
12418 impl CancelOperation {
12419 pub(crate) fn new(
12420 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12421 ) -> Self {
12422 Self(RequestBuilder::new(stub))
12423 }
12424
12425 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12427 mut self,
12428 v: V,
12429 ) -> Self {
12430 self.0.request = v.into();
12431 self
12432 }
12433
12434 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12436 self.0.options = v.into();
12437 self
12438 }
12439
12440 pub async fn send(self) -> Result<()> {
12442 (*self.0.stub)
12443 .cancel_operation(self.0.request, self.0.options)
12444 .await
12445 .map(crate::Response::into_body)
12446 }
12447
12448 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12450 self.0.request.name = v.into();
12451 self
12452 }
12453 }
12454
12455 #[doc(hidden)]
12456 impl crate::RequestBuilder for CancelOperation {
12457 fn request_options(&mut self) -> &mut crate::RequestOptions {
12458 &mut self.0.options
12459 }
12460 }
12461}
12462
12463#[cfg(feature = "search-tuning-service")]
12464#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12465pub mod search_tuning_service {
12466 use crate::Result;
12467
12468 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12482
12483 pub(crate) mod client {
12484 use super::super::super::client::SearchTuningService;
12485 pub struct Factory;
12486 impl crate::ClientFactory for Factory {
12487 type Client = SearchTuningService;
12488 type Credentials = gaxi::options::Credentials;
12489 async fn build(
12490 self,
12491 config: gaxi::options::ClientConfig,
12492 ) -> crate::ClientBuilderResult<Self::Client> {
12493 Self::Client::new(config).await
12494 }
12495 }
12496 }
12497
12498 #[derive(Clone, Debug)]
12500 pub(crate) struct RequestBuilder<R: std::default::Default> {
12501 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12502 request: R,
12503 options: crate::RequestOptions,
12504 }
12505
12506 impl<R> RequestBuilder<R>
12507 where
12508 R: std::default::Default,
12509 {
12510 pub(crate) fn new(
12511 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12512 ) -> Self {
12513 Self {
12514 stub,
12515 request: R::default(),
12516 options: crate::RequestOptions::default(),
12517 }
12518 }
12519 }
12520
12521 #[derive(Clone, Debug)]
12539 pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12540
12541 impl TrainCustomModel {
12542 pub(crate) fn new(
12543 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12544 ) -> Self {
12545 Self(RequestBuilder::new(stub))
12546 }
12547
12548 pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12550 mut self,
12551 v: V,
12552 ) -> Self {
12553 self.0.request = v.into();
12554 self
12555 }
12556
12557 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12559 self.0.options = v.into();
12560 self
12561 }
12562
12563 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12570 (*self.0.stub)
12571 .train_custom_model(self.0.request, self.0.options)
12572 .await
12573 .map(crate::Response::into_body)
12574 }
12575
12576 pub fn poller(
12578 self,
12579 ) -> impl google_cloud_lro::Poller<
12580 crate::model::TrainCustomModelResponse,
12581 crate::model::TrainCustomModelMetadata,
12582 > {
12583 type Operation = google_cloud_lro::internal::Operation<
12584 crate::model::TrainCustomModelResponse,
12585 crate::model::TrainCustomModelMetadata,
12586 >;
12587 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12588 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12589
12590 let stub = self.0.stub.clone();
12591 let mut options = self.0.options.clone();
12592 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
12593 let query = move |name| {
12594 let stub = stub.clone();
12595 let options = options.clone();
12596 async {
12597 let op = GetOperation::new(stub)
12598 .set_name(name)
12599 .with_options(options)
12600 .send()
12601 .await?;
12602 Ok(Operation::new(op))
12603 }
12604 };
12605
12606 let start = move || async {
12607 let op = self.send().await?;
12608 Ok(Operation::new(op))
12609 };
12610
12611 google_cloud_lro::internal::new_poller(
12612 polling_error_policy,
12613 polling_backoff_policy,
12614 start,
12615 query,
12616 )
12617 }
12618
12619 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12623 self.0.request.data_store = v.into();
12624 self
12625 }
12626
12627 pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12629 self.0.request.model_type = v.into();
12630 self
12631 }
12632
12633 pub fn set_error_config<T>(mut self, v: T) -> Self
12635 where
12636 T: std::convert::Into<crate::model::ImportErrorConfig>,
12637 {
12638 self.0.request.error_config = std::option::Option::Some(v.into());
12639 self
12640 }
12641
12642 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12644 where
12645 T: std::convert::Into<crate::model::ImportErrorConfig>,
12646 {
12647 self.0.request.error_config = v.map(|x| x.into());
12648 self
12649 }
12650
12651 pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12653 self.0.request.model_id = v.into();
12654 self
12655 }
12656
12657 pub fn set_training_input<
12662 T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12663 >(
12664 mut self,
12665 v: T,
12666 ) -> Self {
12667 self.0.request.training_input = v.into();
12668 self
12669 }
12670
12671 pub fn set_gcs_training_input<
12677 T: std::convert::Into<
12678 std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12679 >,
12680 >(
12681 mut self,
12682 v: T,
12683 ) -> Self {
12684 self.0.request = self.0.request.set_gcs_training_input(v);
12685 self
12686 }
12687 }
12688
12689 #[doc(hidden)]
12690 impl crate::RequestBuilder for TrainCustomModel {
12691 fn request_options(&mut self) -> &mut crate::RequestOptions {
12692 &mut self.0.options
12693 }
12694 }
12695
12696 #[derive(Clone, Debug)]
12713 pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12714
12715 impl ListCustomModels {
12716 pub(crate) fn new(
12717 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12718 ) -> Self {
12719 Self(RequestBuilder::new(stub))
12720 }
12721
12722 pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12724 mut self,
12725 v: V,
12726 ) -> Self {
12727 self.0.request = v.into();
12728 self
12729 }
12730
12731 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12733 self.0.options = v.into();
12734 self
12735 }
12736
12737 pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12739 (*self.0.stub)
12740 .list_custom_models(self.0.request, self.0.options)
12741 .await
12742 .map(crate::Response::into_body)
12743 }
12744
12745 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12749 self.0.request.data_store = v.into();
12750 self
12751 }
12752 }
12753
12754 #[doc(hidden)]
12755 impl crate::RequestBuilder for ListCustomModels {
12756 fn request_options(&mut self) -> &mut crate::RequestOptions {
12757 &mut self.0.options
12758 }
12759 }
12760
12761 #[derive(Clone, Debug)]
12782 pub struct ListOperations(
12783 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12784 );
12785
12786 impl ListOperations {
12787 pub(crate) fn new(
12788 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12789 ) -> Self {
12790 Self(RequestBuilder::new(stub))
12791 }
12792
12793 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12795 mut self,
12796 v: V,
12797 ) -> Self {
12798 self.0.request = v.into();
12799 self
12800 }
12801
12802 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12804 self.0.options = v.into();
12805 self
12806 }
12807
12808 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12810 (*self.0.stub)
12811 .list_operations(self.0.request, self.0.options)
12812 .await
12813 .map(crate::Response::into_body)
12814 }
12815
12816 pub fn by_page(
12818 self,
12819 ) -> impl google_cloud_gax::paginator::Paginator<
12820 google_cloud_longrunning::model::ListOperationsResponse,
12821 crate::Error,
12822 > {
12823 use std::clone::Clone;
12824 let token = self.0.request.page_token.clone();
12825 let execute = move |token: String| {
12826 let mut builder = self.clone();
12827 builder.0.request = builder.0.request.set_page_token(token);
12828 builder.send()
12829 };
12830 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12831 }
12832
12833 pub fn by_item(
12835 self,
12836 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12837 google_cloud_longrunning::model::ListOperationsResponse,
12838 crate::Error,
12839 > {
12840 use google_cloud_gax::paginator::Paginator;
12841 self.by_page().items()
12842 }
12843
12844 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12846 self.0.request.name = v.into();
12847 self
12848 }
12849
12850 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12852 self.0.request.filter = v.into();
12853 self
12854 }
12855
12856 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12858 self.0.request.page_size = v.into();
12859 self
12860 }
12861
12862 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12864 self.0.request.page_token = v.into();
12865 self
12866 }
12867
12868 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12870 self.0.request.return_partial_success = v.into();
12871 self
12872 }
12873 }
12874
12875 #[doc(hidden)]
12876 impl crate::RequestBuilder for ListOperations {
12877 fn request_options(&mut self) -> &mut crate::RequestOptions {
12878 &mut self.0.options
12879 }
12880 }
12881
12882 #[derive(Clone, Debug)]
12899 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12900
12901 impl GetOperation {
12902 pub(crate) fn new(
12903 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12904 ) -> Self {
12905 Self(RequestBuilder::new(stub))
12906 }
12907
12908 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12910 mut self,
12911 v: V,
12912 ) -> Self {
12913 self.0.request = v.into();
12914 self
12915 }
12916
12917 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12919 self.0.options = v.into();
12920 self
12921 }
12922
12923 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12925 (*self.0.stub)
12926 .get_operation(self.0.request, self.0.options)
12927 .await
12928 .map(crate::Response::into_body)
12929 }
12930
12931 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12933 self.0.request.name = v.into();
12934 self
12935 }
12936 }
12937
12938 #[doc(hidden)]
12939 impl crate::RequestBuilder for GetOperation {
12940 fn request_options(&mut self) -> &mut crate::RequestOptions {
12941 &mut self.0.options
12942 }
12943 }
12944
12945 #[derive(Clone, Debug)]
12962 pub struct CancelOperation(
12963 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12964 );
12965
12966 impl CancelOperation {
12967 pub(crate) fn new(
12968 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12969 ) -> Self {
12970 Self(RequestBuilder::new(stub))
12971 }
12972
12973 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12975 mut self,
12976 v: V,
12977 ) -> Self {
12978 self.0.request = v.into();
12979 self
12980 }
12981
12982 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12984 self.0.options = v.into();
12985 self
12986 }
12987
12988 pub async fn send(self) -> Result<()> {
12990 (*self.0.stub)
12991 .cancel_operation(self.0.request, self.0.options)
12992 .await
12993 .map(crate::Response::into_body)
12994 }
12995
12996 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12998 self.0.request.name = v.into();
12999 self
13000 }
13001 }
13002
13003 #[doc(hidden)]
13004 impl crate::RequestBuilder for CancelOperation {
13005 fn request_options(&mut self) -> &mut crate::RequestOptions {
13006 &mut self.0.options
13007 }
13008 }
13009}
13010
13011#[cfg(feature = "serving-config-service")]
13012#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
13013pub mod serving_config_service {
13014 use crate::Result;
13015
13016 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13030
13031 pub(crate) mod client {
13032 use super::super::super::client::ServingConfigService;
13033 pub struct Factory;
13034 impl crate::ClientFactory for Factory {
13035 type Client = ServingConfigService;
13036 type Credentials = gaxi::options::Credentials;
13037 async fn build(
13038 self,
13039 config: gaxi::options::ClientConfig,
13040 ) -> crate::ClientBuilderResult<Self::Client> {
13041 Self::Client::new(config).await
13042 }
13043 }
13044 }
13045
13046 #[derive(Clone, Debug)]
13048 pub(crate) struct RequestBuilder<R: std::default::Default> {
13049 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13050 request: R,
13051 options: crate::RequestOptions,
13052 }
13053
13054 impl<R> RequestBuilder<R>
13055 where
13056 R: std::default::Default,
13057 {
13058 pub(crate) fn new(
13059 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13060 ) -> Self {
13061 Self {
13062 stub,
13063 request: R::default(),
13064 options: crate::RequestOptions::default(),
13065 }
13066 }
13067 }
13068
13069 #[derive(Clone, Debug)]
13086 pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
13087
13088 impl UpdateServingConfig {
13089 pub(crate) fn new(
13090 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13091 ) -> Self {
13092 Self(RequestBuilder::new(stub))
13093 }
13094
13095 pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
13097 mut self,
13098 v: V,
13099 ) -> Self {
13100 self.0.request = v.into();
13101 self
13102 }
13103
13104 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13106 self.0.options = v.into();
13107 self
13108 }
13109
13110 pub async fn send(self) -> Result<crate::model::ServingConfig> {
13112 (*self.0.stub)
13113 .update_serving_config(self.0.request, self.0.options)
13114 .await
13115 .map(crate::Response::into_body)
13116 }
13117
13118 pub fn set_serving_config<T>(mut self, v: T) -> Self
13122 where
13123 T: std::convert::Into<crate::model::ServingConfig>,
13124 {
13125 self.0.request.serving_config = std::option::Option::Some(v.into());
13126 self
13127 }
13128
13129 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
13133 where
13134 T: std::convert::Into<crate::model::ServingConfig>,
13135 {
13136 self.0.request.serving_config = v.map(|x| x.into());
13137 self
13138 }
13139
13140 pub fn set_update_mask<T>(mut self, v: T) -> Self
13142 where
13143 T: std::convert::Into<wkt::FieldMask>,
13144 {
13145 self.0.request.update_mask = std::option::Option::Some(v.into());
13146 self
13147 }
13148
13149 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13151 where
13152 T: std::convert::Into<wkt::FieldMask>,
13153 {
13154 self.0.request.update_mask = v.map(|x| x.into());
13155 self
13156 }
13157 }
13158
13159 #[doc(hidden)]
13160 impl crate::RequestBuilder for UpdateServingConfig {
13161 fn request_options(&mut self) -> &mut crate::RequestOptions {
13162 &mut self.0.options
13163 }
13164 }
13165
13166 #[derive(Clone, Debug)]
13187 pub struct ListOperations(
13188 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13189 );
13190
13191 impl ListOperations {
13192 pub(crate) fn new(
13193 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13194 ) -> Self {
13195 Self(RequestBuilder::new(stub))
13196 }
13197
13198 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13200 mut self,
13201 v: V,
13202 ) -> Self {
13203 self.0.request = v.into();
13204 self
13205 }
13206
13207 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13209 self.0.options = v.into();
13210 self
13211 }
13212
13213 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13215 (*self.0.stub)
13216 .list_operations(self.0.request, self.0.options)
13217 .await
13218 .map(crate::Response::into_body)
13219 }
13220
13221 pub fn by_page(
13223 self,
13224 ) -> impl google_cloud_gax::paginator::Paginator<
13225 google_cloud_longrunning::model::ListOperationsResponse,
13226 crate::Error,
13227 > {
13228 use std::clone::Clone;
13229 let token = self.0.request.page_token.clone();
13230 let execute = move |token: String| {
13231 let mut builder = self.clone();
13232 builder.0.request = builder.0.request.set_page_token(token);
13233 builder.send()
13234 };
13235 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13236 }
13237
13238 pub fn by_item(
13240 self,
13241 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13242 google_cloud_longrunning::model::ListOperationsResponse,
13243 crate::Error,
13244 > {
13245 use google_cloud_gax::paginator::Paginator;
13246 self.by_page().items()
13247 }
13248
13249 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13251 self.0.request.name = v.into();
13252 self
13253 }
13254
13255 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13257 self.0.request.filter = v.into();
13258 self
13259 }
13260
13261 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13263 self.0.request.page_size = v.into();
13264 self
13265 }
13266
13267 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13269 self.0.request.page_token = v.into();
13270 self
13271 }
13272
13273 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13275 self.0.request.return_partial_success = v.into();
13276 self
13277 }
13278 }
13279
13280 #[doc(hidden)]
13281 impl crate::RequestBuilder for ListOperations {
13282 fn request_options(&mut self) -> &mut crate::RequestOptions {
13283 &mut self.0.options
13284 }
13285 }
13286
13287 #[derive(Clone, Debug)]
13304 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13305
13306 impl GetOperation {
13307 pub(crate) fn new(
13308 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13309 ) -> Self {
13310 Self(RequestBuilder::new(stub))
13311 }
13312
13313 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13315 mut self,
13316 v: V,
13317 ) -> Self {
13318 self.0.request = v.into();
13319 self
13320 }
13321
13322 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13324 self.0.options = v.into();
13325 self
13326 }
13327
13328 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13330 (*self.0.stub)
13331 .get_operation(self.0.request, self.0.options)
13332 .await
13333 .map(crate::Response::into_body)
13334 }
13335
13336 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13338 self.0.request.name = v.into();
13339 self
13340 }
13341 }
13342
13343 #[doc(hidden)]
13344 impl crate::RequestBuilder for GetOperation {
13345 fn request_options(&mut self) -> &mut crate::RequestOptions {
13346 &mut self.0.options
13347 }
13348 }
13349
13350 #[derive(Clone, Debug)]
13367 pub struct CancelOperation(
13368 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13369 );
13370
13371 impl CancelOperation {
13372 pub(crate) fn new(
13373 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13374 ) -> Self {
13375 Self(RequestBuilder::new(stub))
13376 }
13377
13378 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13380 mut self,
13381 v: V,
13382 ) -> Self {
13383 self.0.request = v.into();
13384 self
13385 }
13386
13387 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13389 self.0.options = v.into();
13390 self
13391 }
13392
13393 pub async fn send(self) -> Result<()> {
13395 (*self.0.stub)
13396 .cancel_operation(self.0.request, self.0.options)
13397 .await
13398 .map(crate::Response::into_body)
13399 }
13400
13401 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13403 self.0.request.name = v.into();
13404 self
13405 }
13406 }
13407
13408 #[doc(hidden)]
13409 impl crate::RequestBuilder for CancelOperation {
13410 fn request_options(&mut self) -> &mut crate::RequestOptions {
13411 &mut self.0.options
13412 }
13413 }
13414}
13415
13416#[cfg(feature = "session-service")]
13417#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13418pub mod session_service {
13419 use crate::Result;
13420
13421 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13435
13436 pub(crate) mod client {
13437 use super::super::super::client::SessionService;
13438 pub struct Factory;
13439 impl crate::ClientFactory for Factory {
13440 type Client = SessionService;
13441 type Credentials = gaxi::options::Credentials;
13442 async fn build(
13443 self,
13444 config: gaxi::options::ClientConfig,
13445 ) -> crate::ClientBuilderResult<Self::Client> {
13446 Self::Client::new(config).await
13447 }
13448 }
13449 }
13450
13451 #[derive(Clone, Debug)]
13453 pub(crate) struct RequestBuilder<R: std::default::Default> {
13454 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13455 request: R,
13456 options: crate::RequestOptions,
13457 }
13458
13459 impl<R> RequestBuilder<R>
13460 where
13461 R: std::default::Default,
13462 {
13463 pub(crate) fn new(
13464 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13465 ) -> Self {
13466 Self {
13467 stub,
13468 request: R::default(),
13469 options: crate::RequestOptions::default(),
13470 }
13471 }
13472 }
13473
13474 #[derive(Clone, Debug)]
13491 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13492
13493 impl CreateSession {
13494 pub(crate) fn new(
13495 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13496 ) -> Self {
13497 Self(RequestBuilder::new(stub))
13498 }
13499
13500 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13502 self.0.request = v.into();
13503 self
13504 }
13505
13506 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13508 self.0.options = v.into();
13509 self
13510 }
13511
13512 pub async fn send(self) -> Result<crate::model::Session> {
13514 (*self.0.stub)
13515 .create_session(self.0.request, self.0.options)
13516 .await
13517 .map(crate::Response::into_body)
13518 }
13519
13520 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13524 self.0.request.parent = v.into();
13525 self
13526 }
13527
13528 pub fn set_session<T>(mut self, v: T) -> Self
13532 where
13533 T: std::convert::Into<crate::model::Session>,
13534 {
13535 self.0.request.session = std::option::Option::Some(v.into());
13536 self
13537 }
13538
13539 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13543 where
13544 T: std::convert::Into<crate::model::Session>,
13545 {
13546 self.0.request.session = v.map(|x| x.into());
13547 self
13548 }
13549 }
13550
13551 #[doc(hidden)]
13552 impl crate::RequestBuilder for CreateSession {
13553 fn request_options(&mut self) -> &mut crate::RequestOptions {
13554 &mut self.0.options
13555 }
13556 }
13557
13558 #[derive(Clone, Debug)]
13575 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13576
13577 impl DeleteSession {
13578 pub(crate) fn new(
13579 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13580 ) -> Self {
13581 Self(RequestBuilder::new(stub))
13582 }
13583
13584 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13586 self.0.request = v.into();
13587 self
13588 }
13589
13590 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13592 self.0.options = v.into();
13593 self
13594 }
13595
13596 pub async fn send(self) -> Result<()> {
13598 (*self.0.stub)
13599 .delete_session(self.0.request, self.0.options)
13600 .await
13601 .map(crate::Response::into_body)
13602 }
13603
13604 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13608 self.0.request.name = v.into();
13609 self
13610 }
13611 }
13612
13613 #[doc(hidden)]
13614 impl crate::RequestBuilder for DeleteSession {
13615 fn request_options(&mut self) -> &mut crate::RequestOptions {
13616 &mut self.0.options
13617 }
13618 }
13619
13620 #[derive(Clone, Debug)]
13637 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13638
13639 impl UpdateSession {
13640 pub(crate) fn new(
13641 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13642 ) -> Self {
13643 Self(RequestBuilder::new(stub))
13644 }
13645
13646 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13648 self.0.request = v.into();
13649 self
13650 }
13651
13652 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13654 self.0.options = v.into();
13655 self
13656 }
13657
13658 pub async fn send(self) -> Result<crate::model::Session> {
13660 (*self.0.stub)
13661 .update_session(self.0.request, self.0.options)
13662 .await
13663 .map(crate::Response::into_body)
13664 }
13665
13666 pub fn set_session<T>(mut self, v: T) -> Self
13670 where
13671 T: std::convert::Into<crate::model::Session>,
13672 {
13673 self.0.request.session = std::option::Option::Some(v.into());
13674 self
13675 }
13676
13677 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13681 where
13682 T: std::convert::Into<crate::model::Session>,
13683 {
13684 self.0.request.session = v.map(|x| x.into());
13685 self
13686 }
13687
13688 pub fn set_update_mask<T>(mut self, v: T) -> Self
13690 where
13691 T: std::convert::Into<wkt::FieldMask>,
13692 {
13693 self.0.request.update_mask = std::option::Option::Some(v.into());
13694 self
13695 }
13696
13697 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13699 where
13700 T: std::convert::Into<wkt::FieldMask>,
13701 {
13702 self.0.request.update_mask = v.map(|x| x.into());
13703 self
13704 }
13705 }
13706
13707 #[doc(hidden)]
13708 impl crate::RequestBuilder for UpdateSession {
13709 fn request_options(&mut self) -> &mut crate::RequestOptions {
13710 &mut self.0.options
13711 }
13712 }
13713
13714 #[derive(Clone, Debug)]
13731 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13732
13733 impl GetSession {
13734 pub(crate) fn new(
13735 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13736 ) -> Self {
13737 Self(RequestBuilder::new(stub))
13738 }
13739
13740 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13742 self.0.request = v.into();
13743 self
13744 }
13745
13746 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13748 self.0.options = v.into();
13749 self
13750 }
13751
13752 pub async fn send(self) -> Result<crate::model::Session> {
13754 (*self.0.stub)
13755 .get_session(self.0.request, self.0.options)
13756 .await
13757 .map(crate::Response::into_body)
13758 }
13759
13760 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13764 self.0.request.name = v.into();
13765 self
13766 }
13767
13768 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13770 self.0.request.include_answer_details = v.into();
13771 self
13772 }
13773 }
13774
13775 #[doc(hidden)]
13776 impl crate::RequestBuilder for GetSession {
13777 fn request_options(&mut self) -> &mut crate::RequestOptions {
13778 &mut self.0.options
13779 }
13780 }
13781
13782 #[derive(Clone, Debug)]
13803 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
13804
13805 impl ListSessions {
13806 pub(crate) fn new(
13807 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13808 ) -> Self {
13809 Self(RequestBuilder::new(stub))
13810 }
13811
13812 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
13814 self.0.request = v.into();
13815 self
13816 }
13817
13818 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13820 self.0.options = v.into();
13821 self
13822 }
13823
13824 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
13826 (*self.0.stub)
13827 .list_sessions(self.0.request, self.0.options)
13828 .await
13829 .map(crate::Response::into_body)
13830 }
13831
13832 pub fn by_page(
13834 self,
13835 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
13836 {
13837 use std::clone::Clone;
13838 let token = self.0.request.page_token.clone();
13839 let execute = move |token: String| {
13840 let mut builder = self.clone();
13841 builder.0.request = builder.0.request.set_page_token(token);
13842 builder.send()
13843 };
13844 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13845 }
13846
13847 pub fn by_item(
13849 self,
13850 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13851 crate::model::ListSessionsResponse,
13852 crate::Error,
13853 > {
13854 use google_cloud_gax::paginator::Paginator;
13855 self.by_page().items()
13856 }
13857
13858 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13862 self.0.request.parent = v.into();
13863 self
13864 }
13865
13866 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13868 self.0.request.page_size = v.into();
13869 self
13870 }
13871
13872 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13874 self.0.request.page_token = v.into();
13875 self
13876 }
13877
13878 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13880 self.0.request.filter = v.into();
13881 self
13882 }
13883
13884 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
13886 self.0.request.order_by = v.into();
13887 self
13888 }
13889 }
13890
13891 #[doc(hidden)]
13892 impl crate::RequestBuilder for ListSessions {
13893 fn request_options(&mut self) -> &mut crate::RequestOptions {
13894 &mut self.0.options
13895 }
13896 }
13897
13898 #[derive(Clone, Debug)]
13919 pub struct ListOperations(
13920 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13921 );
13922
13923 impl ListOperations {
13924 pub(crate) fn new(
13925 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13926 ) -> Self {
13927 Self(RequestBuilder::new(stub))
13928 }
13929
13930 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13932 mut self,
13933 v: V,
13934 ) -> Self {
13935 self.0.request = v.into();
13936 self
13937 }
13938
13939 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13941 self.0.options = v.into();
13942 self
13943 }
13944
13945 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13947 (*self.0.stub)
13948 .list_operations(self.0.request, self.0.options)
13949 .await
13950 .map(crate::Response::into_body)
13951 }
13952
13953 pub fn by_page(
13955 self,
13956 ) -> impl google_cloud_gax::paginator::Paginator<
13957 google_cloud_longrunning::model::ListOperationsResponse,
13958 crate::Error,
13959 > {
13960 use std::clone::Clone;
13961 let token = self.0.request.page_token.clone();
13962 let execute = move |token: String| {
13963 let mut builder = self.clone();
13964 builder.0.request = builder.0.request.set_page_token(token);
13965 builder.send()
13966 };
13967 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13968 }
13969
13970 pub fn by_item(
13972 self,
13973 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13974 google_cloud_longrunning::model::ListOperationsResponse,
13975 crate::Error,
13976 > {
13977 use google_cloud_gax::paginator::Paginator;
13978 self.by_page().items()
13979 }
13980
13981 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13983 self.0.request.name = v.into();
13984 self
13985 }
13986
13987 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13989 self.0.request.filter = v.into();
13990 self
13991 }
13992
13993 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13995 self.0.request.page_size = v.into();
13996 self
13997 }
13998
13999 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14001 self.0.request.page_token = v.into();
14002 self
14003 }
14004
14005 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14007 self.0.request.return_partial_success = v.into();
14008 self
14009 }
14010 }
14011
14012 #[doc(hidden)]
14013 impl crate::RequestBuilder for ListOperations {
14014 fn request_options(&mut self) -> &mut crate::RequestOptions {
14015 &mut self.0.options
14016 }
14017 }
14018
14019 #[derive(Clone, Debug)]
14036 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14037
14038 impl GetOperation {
14039 pub(crate) fn new(
14040 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14041 ) -> Self {
14042 Self(RequestBuilder::new(stub))
14043 }
14044
14045 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14047 mut self,
14048 v: V,
14049 ) -> Self {
14050 self.0.request = v.into();
14051 self
14052 }
14053
14054 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14056 self.0.options = v.into();
14057 self
14058 }
14059
14060 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14062 (*self.0.stub)
14063 .get_operation(self.0.request, self.0.options)
14064 .await
14065 .map(crate::Response::into_body)
14066 }
14067
14068 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14070 self.0.request.name = v.into();
14071 self
14072 }
14073 }
14074
14075 #[doc(hidden)]
14076 impl crate::RequestBuilder for GetOperation {
14077 fn request_options(&mut self) -> &mut crate::RequestOptions {
14078 &mut self.0.options
14079 }
14080 }
14081
14082 #[derive(Clone, Debug)]
14099 pub struct CancelOperation(
14100 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14101 );
14102
14103 impl CancelOperation {
14104 pub(crate) fn new(
14105 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14106 ) -> Self {
14107 Self(RequestBuilder::new(stub))
14108 }
14109
14110 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
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<()> {
14127 (*self.0.stub)
14128 .cancel_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 CancelOperation {
14142 fn request_options(&mut self) -> &mut crate::RequestOptions {
14143 &mut self.0.options
14144 }
14145 }
14146}
14147
14148#[cfg(feature = "site-search-engine-service")]
14149#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
14150pub mod site_search_engine_service {
14151 use crate::Result;
14152
14153 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14167
14168 pub(crate) mod client {
14169 use super::super::super::client::SiteSearchEngineService;
14170 pub struct Factory;
14171 impl crate::ClientFactory for Factory {
14172 type Client = SiteSearchEngineService;
14173 type Credentials = gaxi::options::Credentials;
14174 async fn build(
14175 self,
14176 config: gaxi::options::ClientConfig,
14177 ) -> crate::ClientBuilderResult<Self::Client> {
14178 Self::Client::new(config).await
14179 }
14180 }
14181 }
14182
14183 #[derive(Clone, Debug)]
14185 pub(crate) struct RequestBuilder<R: std::default::Default> {
14186 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14187 request: R,
14188 options: crate::RequestOptions,
14189 }
14190
14191 impl<R> RequestBuilder<R>
14192 where
14193 R: std::default::Default,
14194 {
14195 pub(crate) fn new(
14196 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14197 ) -> Self {
14198 Self {
14199 stub,
14200 request: R::default(),
14201 options: crate::RequestOptions::default(),
14202 }
14203 }
14204 }
14205
14206 #[derive(Clone, Debug)]
14223 pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
14224
14225 impl GetSiteSearchEngine {
14226 pub(crate) fn new(
14227 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14228 ) -> Self {
14229 Self(RequestBuilder::new(stub))
14230 }
14231
14232 pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
14234 mut self,
14235 v: V,
14236 ) -> Self {
14237 self.0.request = v.into();
14238 self
14239 }
14240
14241 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14243 self.0.options = v.into();
14244 self
14245 }
14246
14247 pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
14249 (*self.0.stub)
14250 .get_site_search_engine(self.0.request, self.0.options)
14251 .await
14252 .map(crate::Response::into_body)
14253 }
14254
14255 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14259 self.0.request.name = v.into();
14260 self
14261 }
14262 }
14263
14264 #[doc(hidden)]
14265 impl crate::RequestBuilder for GetSiteSearchEngine {
14266 fn request_options(&mut self) -> &mut crate::RequestOptions {
14267 &mut self.0.options
14268 }
14269 }
14270
14271 #[derive(Clone, Debug)]
14289 pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
14290
14291 impl CreateTargetSite {
14292 pub(crate) fn new(
14293 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14294 ) -> Self {
14295 Self(RequestBuilder::new(stub))
14296 }
14297
14298 pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
14300 mut self,
14301 v: V,
14302 ) -> Self {
14303 self.0.request = v.into();
14304 self
14305 }
14306
14307 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14309 self.0.options = v.into();
14310 self
14311 }
14312
14313 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14320 (*self.0.stub)
14321 .create_target_site(self.0.request, self.0.options)
14322 .await
14323 .map(crate::Response::into_body)
14324 }
14325
14326 pub fn poller(
14328 self,
14329 ) -> impl google_cloud_lro::Poller<
14330 crate::model::TargetSite,
14331 crate::model::CreateTargetSiteMetadata,
14332 > {
14333 type Operation = google_cloud_lro::internal::Operation<
14334 crate::model::TargetSite,
14335 crate::model::CreateTargetSiteMetadata,
14336 >;
14337 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14338 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14339
14340 let stub = self.0.stub.clone();
14341 let mut options = self.0.options.clone();
14342 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14343 let query = move |name| {
14344 let stub = stub.clone();
14345 let options = options.clone();
14346 async {
14347 let op = GetOperation::new(stub)
14348 .set_name(name)
14349 .with_options(options)
14350 .send()
14351 .await?;
14352 Ok(Operation::new(op))
14353 }
14354 };
14355
14356 let start = move || async {
14357 let op = self.send().await?;
14358 Ok(Operation::new(op))
14359 };
14360
14361 google_cloud_lro::internal::new_poller(
14362 polling_error_policy,
14363 polling_backoff_policy,
14364 start,
14365 query,
14366 )
14367 }
14368
14369 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14373 self.0.request.parent = v.into();
14374 self
14375 }
14376
14377 pub fn set_target_site<T>(mut self, v: T) -> Self
14381 where
14382 T: std::convert::Into<crate::model::TargetSite>,
14383 {
14384 self.0.request.target_site = std::option::Option::Some(v.into());
14385 self
14386 }
14387
14388 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14392 where
14393 T: std::convert::Into<crate::model::TargetSite>,
14394 {
14395 self.0.request.target_site = v.map(|x| x.into());
14396 self
14397 }
14398 }
14399
14400 #[doc(hidden)]
14401 impl crate::RequestBuilder for CreateTargetSite {
14402 fn request_options(&mut self) -> &mut crate::RequestOptions {
14403 &mut self.0.options
14404 }
14405 }
14406
14407 #[derive(Clone, Debug)]
14425 pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14426
14427 impl BatchCreateTargetSites {
14428 pub(crate) fn new(
14429 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14430 ) -> Self {
14431 Self(RequestBuilder::new(stub))
14432 }
14433
14434 pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14436 mut self,
14437 v: V,
14438 ) -> Self {
14439 self.0.request = v.into();
14440 self
14441 }
14442
14443 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14445 self.0.options = v.into();
14446 self
14447 }
14448
14449 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14456 (*self.0.stub)
14457 .batch_create_target_sites(self.0.request, self.0.options)
14458 .await
14459 .map(crate::Response::into_body)
14460 }
14461
14462 pub fn poller(
14464 self,
14465 ) -> impl google_cloud_lro::Poller<
14466 crate::model::BatchCreateTargetSitesResponse,
14467 crate::model::BatchCreateTargetSiteMetadata,
14468 > {
14469 type Operation = google_cloud_lro::internal::Operation<
14470 crate::model::BatchCreateTargetSitesResponse,
14471 crate::model::BatchCreateTargetSiteMetadata,
14472 >;
14473 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14474 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14475
14476 let stub = self.0.stub.clone();
14477 let mut options = self.0.options.clone();
14478 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14479 let query = move |name| {
14480 let stub = stub.clone();
14481 let options = options.clone();
14482 async {
14483 let op = GetOperation::new(stub)
14484 .set_name(name)
14485 .with_options(options)
14486 .send()
14487 .await?;
14488 Ok(Operation::new(op))
14489 }
14490 };
14491
14492 let start = move || async {
14493 let op = self.send().await?;
14494 Ok(Operation::new(op))
14495 };
14496
14497 google_cloud_lro::internal::new_poller(
14498 polling_error_policy,
14499 polling_backoff_policy,
14500 start,
14501 query,
14502 )
14503 }
14504
14505 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14509 self.0.request.parent = v.into();
14510 self
14511 }
14512
14513 pub fn set_requests<T, V>(mut self, v: T) -> Self
14517 where
14518 T: std::iter::IntoIterator<Item = V>,
14519 V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14520 {
14521 use std::iter::Iterator;
14522 self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14523 self
14524 }
14525 }
14526
14527 #[doc(hidden)]
14528 impl crate::RequestBuilder for BatchCreateTargetSites {
14529 fn request_options(&mut self) -> &mut crate::RequestOptions {
14530 &mut self.0.options
14531 }
14532 }
14533
14534 #[derive(Clone, Debug)]
14551 pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14552
14553 impl GetTargetSite {
14554 pub(crate) fn new(
14555 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14556 ) -> Self {
14557 Self(RequestBuilder::new(stub))
14558 }
14559
14560 pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14562 self.0.request = v.into();
14563 self
14564 }
14565
14566 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14568 self.0.options = v.into();
14569 self
14570 }
14571
14572 pub async fn send(self) -> Result<crate::model::TargetSite> {
14574 (*self.0.stub)
14575 .get_target_site(self.0.request, self.0.options)
14576 .await
14577 .map(crate::Response::into_body)
14578 }
14579
14580 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14584 self.0.request.name = v.into();
14585 self
14586 }
14587 }
14588
14589 #[doc(hidden)]
14590 impl crate::RequestBuilder for GetTargetSite {
14591 fn request_options(&mut self) -> &mut crate::RequestOptions {
14592 &mut self.0.options
14593 }
14594 }
14595
14596 #[derive(Clone, Debug)]
14614 pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14615
14616 impl UpdateTargetSite {
14617 pub(crate) fn new(
14618 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14619 ) -> Self {
14620 Self(RequestBuilder::new(stub))
14621 }
14622
14623 pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14625 mut self,
14626 v: V,
14627 ) -> Self {
14628 self.0.request = v.into();
14629 self
14630 }
14631
14632 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14634 self.0.options = v.into();
14635 self
14636 }
14637
14638 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14645 (*self.0.stub)
14646 .update_target_site(self.0.request, self.0.options)
14647 .await
14648 .map(crate::Response::into_body)
14649 }
14650
14651 pub fn poller(
14653 self,
14654 ) -> impl google_cloud_lro::Poller<
14655 crate::model::TargetSite,
14656 crate::model::UpdateTargetSiteMetadata,
14657 > {
14658 type Operation = google_cloud_lro::internal::Operation<
14659 crate::model::TargetSite,
14660 crate::model::UpdateTargetSiteMetadata,
14661 >;
14662 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14663 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14664
14665 let stub = self.0.stub.clone();
14666 let mut options = self.0.options.clone();
14667 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14668 let query = move |name| {
14669 let stub = stub.clone();
14670 let options = options.clone();
14671 async {
14672 let op = GetOperation::new(stub)
14673 .set_name(name)
14674 .with_options(options)
14675 .send()
14676 .await?;
14677 Ok(Operation::new(op))
14678 }
14679 };
14680
14681 let start = move || async {
14682 let op = self.send().await?;
14683 Ok(Operation::new(op))
14684 };
14685
14686 google_cloud_lro::internal::new_poller(
14687 polling_error_policy,
14688 polling_backoff_policy,
14689 start,
14690 query,
14691 )
14692 }
14693
14694 pub fn set_target_site<T>(mut self, v: T) -> Self
14698 where
14699 T: std::convert::Into<crate::model::TargetSite>,
14700 {
14701 self.0.request.target_site = std::option::Option::Some(v.into());
14702 self
14703 }
14704
14705 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14709 where
14710 T: std::convert::Into<crate::model::TargetSite>,
14711 {
14712 self.0.request.target_site = v.map(|x| x.into());
14713 self
14714 }
14715 }
14716
14717 #[doc(hidden)]
14718 impl crate::RequestBuilder for UpdateTargetSite {
14719 fn request_options(&mut self) -> &mut crate::RequestOptions {
14720 &mut self.0.options
14721 }
14722 }
14723
14724 #[derive(Clone, Debug)]
14742 pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14743
14744 impl DeleteTargetSite {
14745 pub(crate) fn new(
14746 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14747 ) -> Self {
14748 Self(RequestBuilder::new(stub))
14749 }
14750
14751 pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14753 mut self,
14754 v: V,
14755 ) -> Self {
14756 self.0.request = v.into();
14757 self
14758 }
14759
14760 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14762 self.0.options = v.into();
14763 self
14764 }
14765
14766 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14773 (*self.0.stub)
14774 .delete_target_site(self.0.request, self.0.options)
14775 .await
14776 .map(crate::Response::into_body)
14777 }
14778
14779 pub fn poller(
14781 self,
14782 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
14783 type Operation = google_cloud_lro::internal::Operation<
14784 wkt::Empty,
14785 crate::model::DeleteTargetSiteMetadata,
14786 >;
14787 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14788 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14789
14790 let stub = self.0.stub.clone();
14791 let mut options = self.0.options.clone();
14792 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14793 let query = move |name| {
14794 let stub = stub.clone();
14795 let options = options.clone();
14796 async {
14797 let op = GetOperation::new(stub)
14798 .set_name(name)
14799 .with_options(options)
14800 .send()
14801 .await?;
14802 Ok(Operation::new(op))
14803 }
14804 };
14805
14806 let start = move || async {
14807 let op = self.send().await?;
14808 Ok(Operation::new(op))
14809 };
14810
14811 google_cloud_lro::internal::new_unit_response_poller(
14812 polling_error_policy,
14813 polling_backoff_policy,
14814 start,
14815 query,
14816 )
14817 }
14818
14819 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14823 self.0.request.name = v.into();
14824 self
14825 }
14826 }
14827
14828 #[doc(hidden)]
14829 impl crate::RequestBuilder for DeleteTargetSite {
14830 fn request_options(&mut self) -> &mut crate::RequestOptions {
14831 &mut self.0.options
14832 }
14833 }
14834
14835 #[derive(Clone, Debug)]
14856 pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
14857
14858 impl ListTargetSites {
14859 pub(crate) fn new(
14860 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14861 ) -> Self {
14862 Self(RequestBuilder::new(stub))
14863 }
14864
14865 pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
14867 self.0.request = v.into();
14868 self
14869 }
14870
14871 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14873 self.0.options = v.into();
14874 self
14875 }
14876
14877 pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
14879 (*self.0.stub)
14880 .list_target_sites(self.0.request, self.0.options)
14881 .await
14882 .map(crate::Response::into_body)
14883 }
14884
14885 pub fn by_page(
14887 self,
14888 ) -> impl google_cloud_gax::paginator::Paginator<
14889 crate::model::ListTargetSitesResponse,
14890 crate::Error,
14891 > {
14892 use std::clone::Clone;
14893 let token = self.0.request.page_token.clone();
14894 let execute = move |token: String| {
14895 let mut builder = self.clone();
14896 builder.0.request = builder.0.request.set_page_token(token);
14897 builder.send()
14898 };
14899 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14900 }
14901
14902 pub fn by_item(
14904 self,
14905 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14906 crate::model::ListTargetSitesResponse,
14907 crate::Error,
14908 > {
14909 use google_cloud_gax::paginator::Paginator;
14910 self.by_page().items()
14911 }
14912
14913 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14917 self.0.request.parent = v.into();
14918 self
14919 }
14920
14921 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14923 self.0.request.page_size = v.into();
14924 self
14925 }
14926
14927 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14929 self.0.request.page_token = v.into();
14930 self
14931 }
14932 }
14933
14934 #[doc(hidden)]
14935 impl crate::RequestBuilder for ListTargetSites {
14936 fn request_options(&mut self) -> &mut crate::RequestOptions {
14937 &mut self.0.options
14938 }
14939 }
14940
14941 #[derive(Clone, Debug)]
14959 pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
14960
14961 impl CreateSitemap {
14962 pub(crate) fn new(
14963 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14964 ) -> Self {
14965 Self(RequestBuilder::new(stub))
14966 }
14967
14968 pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
14970 self.0.request = v.into();
14971 self
14972 }
14973
14974 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14976 self.0.options = v.into();
14977 self
14978 }
14979
14980 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14987 (*self.0.stub)
14988 .create_sitemap(self.0.request, self.0.options)
14989 .await
14990 .map(crate::Response::into_body)
14991 }
14992
14993 pub fn poller(
14995 self,
14996 ) -> impl google_cloud_lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata>
14997 {
14998 type Operation = google_cloud_lro::internal::Operation<
14999 crate::model::Sitemap,
15000 crate::model::CreateSitemapMetadata,
15001 >;
15002 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15003 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15004
15005 let stub = self.0.stub.clone();
15006 let mut options = self.0.options.clone();
15007 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15008 let query = move |name| {
15009 let stub = stub.clone();
15010 let options = options.clone();
15011 async {
15012 let op = GetOperation::new(stub)
15013 .set_name(name)
15014 .with_options(options)
15015 .send()
15016 .await?;
15017 Ok(Operation::new(op))
15018 }
15019 };
15020
15021 let start = move || async {
15022 let op = self.send().await?;
15023 Ok(Operation::new(op))
15024 };
15025
15026 google_cloud_lro::internal::new_poller(
15027 polling_error_policy,
15028 polling_backoff_policy,
15029 start,
15030 query,
15031 )
15032 }
15033
15034 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15038 self.0.request.parent = v.into();
15039 self
15040 }
15041
15042 pub fn set_sitemap<T>(mut self, v: T) -> Self
15046 where
15047 T: std::convert::Into<crate::model::Sitemap>,
15048 {
15049 self.0.request.sitemap = std::option::Option::Some(v.into());
15050 self
15051 }
15052
15053 pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
15057 where
15058 T: std::convert::Into<crate::model::Sitemap>,
15059 {
15060 self.0.request.sitemap = v.map(|x| x.into());
15061 self
15062 }
15063 }
15064
15065 #[doc(hidden)]
15066 impl crate::RequestBuilder for CreateSitemap {
15067 fn request_options(&mut self) -> &mut crate::RequestOptions {
15068 &mut self.0.options
15069 }
15070 }
15071
15072 #[derive(Clone, Debug)]
15090 pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
15091
15092 impl DeleteSitemap {
15093 pub(crate) fn new(
15094 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15095 ) -> Self {
15096 Self(RequestBuilder::new(stub))
15097 }
15098
15099 pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
15101 self.0.request = v.into();
15102 self
15103 }
15104
15105 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15107 self.0.options = v.into();
15108 self
15109 }
15110
15111 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15118 (*self.0.stub)
15119 .delete_sitemap(self.0.request, self.0.options)
15120 .await
15121 .map(crate::Response::into_body)
15122 }
15123
15124 pub fn poller(
15126 self,
15127 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSitemapMetadata> {
15128 type Operation = google_cloud_lro::internal::Operation<
15129 wkt::Empty,
15130 crate::model::DeleteSitemapMetadata,
15131 >;
15132 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15133 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15134
15135 let stub = self.0.stub.clone();
15136 let mut options = self.0.options.clone();
15137 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15138 let query = move |name| {
15139 let stub = stub.clone();
15140 let options = options.clone();
15141 async {
15142 let op = GetOperation::new(stub)
15143 .set_name(name)
15144 .with_options(options)
15145 .send()
15146 .await?;
15147 Ok(Operation::new(op))
15148 }
15149 };
15150
15151 let start = move || async {
15152 let op = self.send().await?;
15153 Ok(Operation::new(op))
15154 };
15155
15156 google_cloud_lro::internal::new_unit_response_poller(
15157 polling_error_policy,
15158 polling_backoff_policy,
15159 start,
15160 query,
15161 )
15162 }
15163
15164 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15168 self.0.request.name = v.into();
15169 self
15170 }
15171 }
15172
15173 #[doc(hidden)]
15174 impl crate::RequestBuilder for DeleteSitemap {
15175 fn request_options(&mut self) -> &mut crate::RequestOptions {
15176 &mut self.0.options
15177 }
15178 }
15179
15180 #[derive(Clone, Debug)]
15197 pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
15198
15199 impl FetchSitemaps {
15200 pub(crate) fn new(
15201 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15202 ) -> Self {
15203 Self(RequestBuilder::new(stub))
15204 }
15205
15206 pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
15208 self.0.request = v.into();
15209 self
15210 }
15211
15212 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15214 self.0.options = v.into();
15215 self
15216 }
15217
15218 pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
15220 (*self.0.stub)
15221 .fetch_sitemaps(self.0.request, self.0.options)
15222 .await
15223 .map(crate::Response::into_body)
15224 }
15225
15226 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15230 self.0.request.parent = v.into();
15231 self
15232 }
15233
15234 pub fn set_matcher<T>(mut self, v: T) -> Self
15236 where
15237 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15238 {
15239 self.0.request.matcher = std::option::Option::Some(v.into());
15240 self
15241 }
15242
15243 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
15245 where
15246 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15247 {
15248 self.0.request.matcher = v.map(|x| x.into());
15249 self
15250 }
15251 }
15252
15253 #[doc(hidden)]
15254 impl crate::RequestBuilder for FetchSitemaps {
15255 fn request_options(&mut self) -> &mut crate::RequestOptions {
15256 &mut self.0.options
15257 }
15258 }
15259
15260 #[derive(Clone, Debug)]
15278 pub struct EnableAdvancedSiteSearch(
15279 RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
15280 );
15281
15282 impl EnableAdvancedSiteSearch {
15283 pub(crate) fn new(
15284 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15285 ) -> Self {
15286 Self(RequestBuilder::new(stub))
15287 }
15288
15289 pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
15291 mut self,
15292 v: V,
15293 ) -> Self {
15294 self.0.request = v.into();
15295 self
15296 }
15297
15298 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15300 self.0.options = v.into();
15301 self
15302 }
15303
15304 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15311 (*self.0.stub)
15312 .enable_advanced_site_search(self.0.request, self.0.options)
15313 .await
15314 .map(crate::Response::into_body)
15315 }
15316
15317 pub fn poller(
15319 self,
15320 ) -> impl google_cloud_lro::Poller<
15321 crate::model::EnableAdvancedSiteSearchResponse,
15322 crate::model::EnableAdvancedSiteSearchMetadata,
15323 > {
15324 type Operation = google_cloud_lro::internal::Operation<
15325 crate::model::EnableAdvancedSiteSearchResponse,
15326 crate::model::EnableAdvancedSiteSearchMetadata,
15327 >;
15328 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15329 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15330
15331 let stub = self.0.stub.clone();
15332 let mut options = self.0.options.clone();
15333 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15334 let query = move |name| {
15335 let stub = stub.clone();
15336 let options = options.clone();
15337 async {
15338 let op = GetOperation::new(stub)
15339 .set_name(name)
15340 .with_options(options)
15341 .send()
15342 .await?;
15343 Ok(Operation::new(op))
15344 }
15345 };
15346
15347 let start = move || async {
15348 let op = self.send().await?;
15349 Ok(Operation::new(op))
15350 };
15351
15352 google_cloud_lro::internal::new_poller(
15353 polling_error_policy,
15354 polling_backoff_policy,
15355 start,
15356 query,
15357 )
15358 }
15359
15360 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15364 self.0.request.site_search_engine = v.into();
15365 self
15366 }
15367 }
15368
15369 #[doc(hidden)]
15370 impl crate::RequestBuilder for EnableAdvancedSiteSearch {
15371 fn request_options(&mut self) -> &mut crate::RequestOptions {
15372 &mut self.0.options
15373 }
15374 }
15375
15376 #[derive(Clone, Debug)]
15394 pub struct DisableAdvancedSiteSearch(
15395 RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15396 );
15397
15398 impl DisableAdvancedSiteSearch {
15399 pub(crate) fn new(
15400 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15401 ) -> Self {
15402 Self(RequestBuilder::new(stub))
15403 }
15404
15405 pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15407 mut self,
15408 v: V,
15409 ) -> Self {
15410 self.0.request = v.into();
15411 self
15412 }
15413
15414 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15416 self.0.options = v.into();
15417 self
15418 }
15419
15420 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15427 (*self.0.stub)
15428 .disable_advanced_site_search(self.0.request, self.0.options)
15429 .await
15430 .map(crate::Response::into_body)
15431 }
15432
15433 pub fn poller(
15435 self,
15436 ) -> impl google_cloud_lro::Poller<
15437 crate::model::DisableAdvancedSiteSearchResponse,
15438 crate::model::DisableAdvancedSiteSearchMetadata,
15439 > {
15440 type Operation = google_cloud_lro::internal::Operation<
15441 crate::model::DisableAdvancedSiteSearchResponse,
15442 crate::model::DisableAdvancedSiteSearchMetadata,
15443 >;
15444 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15445 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15446
15447 let stub = self.0.stub.clone();
15448 let mut options = self.0.options.clone();
15449 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15450 let query = move |name| {
15451 let stub = stub.clone();
15452 let options = options.clone();
15453 async {
15454 let op = GetOperation::new(stub)
15455 .set_name(name)
15456 .with_options(options)
15457 .send()
15458 .await?;
15459 Ok(Operation::new(op))
15460 }
15461 };
15462
15463 let start = move || async {
15464 let op = self.send().await?;
15465 Ok(Operation::new(op))
15466 };
15467
15468 google_cloud_lro::internal::new_poller(
15469 polling_error_policy,
15470 polling_backoff_policy,
15471 start,
15472 query,
15473 )
15474 }
15475
15476 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15480 self.0.request.site_search_engine = v.into();
15481 self
15482 }
15483 }
15484
15485 #[doc(hidden)]
15486 impl crate::RequestBuilder for DisableAdvancedSiteSearch {
15487 fn request_options(&mut self) -> &mut crate::RequestOptions {
15488 &mut self.0.options
15489 }
15490 }
15491
15492 #[derive(Clone, Debug)]
15510 pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15511
15512 impl RecrawlUris {
15513 pub(crate) fn new(
15514 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15515 ) -> Self {
15516 Self(RequestBuilder::new(stub))
15517 }
15518
15519 pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15521 self.0.request = v.into();
15522 self
15523 }
15524
15525 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15527 self.0.options = v.into();
15528 self
15529 }
15530
15531 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15538 (*self.0.stub)
15539 .recrawl_uris(self.0.request, self.0.options)
15540 .await
15541 .map(crate::Response::into_body)
15542 }
15543
15544 pub fn poller(
15546 self,
15547 ) -> impl google_cloud_lro::Poller<
15548 crate::model::RecrawlUrisResponse,
15549 crate::model::RecrawlUrisMetadata,
15550 > {
15551 type Operation = google_cloud_lro::internal::Operation<
15552 crate::model::RecrawlUrisResponse,
15553 crate::model::RecrawlUrisMetadata,
15554 >;
15555 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15556 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15557
15558 let stub = self.0.stub.clone();
15559 let mut options = self.0.options.clone();
15560 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15561 let query = move |name| {
15562 let stub = stub.clone();
15563 let options = options.clone();
15564 async {
15565 let op = GetOperation::new(stub)
15566 .set_name(name)
15567 .with_options(options)
15568 .send()
15569 .await?;
15570 Ok(Operation::new(op))
15571 }
15572 };
15573
15574 let start = move || async {
15575 let op = self.send().await?;
15576 Ok(Operation::new(op))
15577 };
15578
15579 google_cloud_lro::internal::new_poller(
15580 polling_error_policy,
15581 polling_backoff_policy,
15582 start,
15583 query,
15584 )
15585 }
15586
15587 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15591 self.0.request.site_search_engine = v.into();
15592 self
15593 }
15594
15595 pub fn set_uris<T, V>(mut self, v: T) -> Self
15599 where
15600 T: std::iter::IntoIterator<Item = V>,
15601 V: std::convert::Into<std::string::String>,
15602 {
15603 use std::iter::Iterator;
15604 self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15605 self
15606 }
15607
15608 pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15610 self.0.request.site_credential = v.into();
15611 self
15612 }
15613 }
15614
15615 #[doc(hidden)]
15616 impl crate::RequestBuilder for RecrawlUris {
15617 fn request_options(&mut self) -> &mut crate::RequestOptions {
15618 &mut self.0.options
15619 }
15620 }
15621
15622 #[derive(Clone, Debug)]
15640 pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15641
15642 impl BatchVerifyTargetSites {
15643 pub(crate) fn new(
15644 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15645 ) -> Self {
15646 Self(RequestBuilder::new(stub))
15647 }
15648
15649 pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15651 mut self,
15652 v: V,
15653 ) -> Self {
15654 self.0.request = v.into();
15655 self
15656 }
15657
15658 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15660 self.0.options = v.into();
15661 self
15662 }
15663
15664 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15671 (*self.0.stub)
15672 .batch_verify_target_sites(self.0.request, self.0.options)
15673 .await
15674 .map(crate::Response::into_body)
15675 }
15676
15677 pub fn poller(
15679 self,
15680 ) -> impl google_cloud_lro::Poller<
15681 crate::model::BatchVerifyTargetSitesResponse,
15682 crate::model::BatchVerifyTargetSitesMetadata,
15683 > {
15684 type Operation = google_cloud_lro::internal::Operation<
15685 crate::model::BatchVerifyTargetSitesResponse,
15686 crate::model::BatchVerifyTargetSitesMetadata,
15687 >;
15688 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15689 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15690
15691 let stub = self.0.stub.clone();
15692 let mut options = self.0.options.clone();
15693 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15694 let query = move |name| {
15695 let stub = stub.clone();
15696 let options = options.clone();
15697 async {
15698 let op = GetOperation::new(stub)
15699 .set_name(name)
15700 .with_options(options)
15701 .send()
15702 .await?;
15703 Ok(Operation::new(op))
15704 }
15705 };
15706
15707 let start = move || async {
15708 let op = self.send().await?;
15709 Ok(Operation::new(op))
15710 };
15711
15712 google_cloud_lro::internal::new_poller(
15713 polling_error_policy,
15714 polling_backoff_policy,
15715 start,
15716 query,
15717 )
15718 }
15719
15720 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15724 self.0.request.parent = v.into();
15725 self
15726 }
15727 }
15728
15729 #[doc(hidden)]
15730 impl crate::RequestBuilder for BatchVerifyTargetSites {
15731 fn request_options(&mut self) -> &mut crate::RequestOptions {
15732 &mut self.0.options
15733 }
15734 }
15735
15736 #[derive(Clone, Debug)]
15757 pub struct FetchDomainVerificationStatus(
15758 RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
15759 );
15760
15761 impl FetchDomainVerificationStatus {
15762 pub(crate) fn new(
15763 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15764 ) -> Self {
15765 Self(RequestBuilder::new(stub))
15766 }
15767
15768 pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
15770 mut self,
15771 v: V,
15772 ) -> Self {
15773 self.0.request = v.into();
15774 self
15775 }
15776
15777 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15779 self.0.options = v.into();
15780 self
15781 }
15782
15783 pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
15785 (*self.0.stub)
15786 .fetch_domain_verification_status(self.0.request, self.0.options)
15787 .await
15788 .map(crate::Response::into_body)
15789 }
15790
15791 pub fn by_page(
15793 self,
15794 ) -> impl google_cloud_gax::paginator::Paginator<
15795 crate::model::FetchDomainVerificationStatusResponse,
15796 crate::Error,
15797 > {
15798 use std::clone::Clone;
15799 let token = self.0.request.page_token.clone();
15800 let execute = move |token: String| {
15801 let mut builder = self.clone();
15802 builder.0.request = builder.0.request.set_page_token(token);
15803 builder.send()
15804 };
15805 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15806 }
15807
15808 pub fn by_item(
15810 self,
15811 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15812 crate::model::FetchDomainVerificationStatusResponse,
15813 crate::Error,
15814 > {
15815 use google_cloud_gax::paginator::Paginator;
15816 self.by_page().items()
15817 }
15818
15819 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15823 self.0.request.site_search_engine = v.into();
15824 self
15825 }
15826
15827 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15829 self.0.request.page_size = v.into();
15830 self
15831 }
15832
15833 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15835 self.0.request.page_token = v.into();
15836 self
15837 }
15838 }
15839
15840 #[doc(hidden)]
15841 impl crate::RequestBuilder for FetchDomainVerificationStatus {
15842 fn request_options(&mut self) -> &mut crate::RequestOptions {
15843 &mut self.0.options
15844 }
15845 }
15846
15847 #[derive(Clone, Debug)]
15868 pub struct ListOperations(
15869 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
15870 );
15871
15872 impl ListOperations {
15873 pub(crate) fn new(
15874 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15875 ) -> Self {
15876 Self(RequestBuilder::new(stub))
15877 }
15878
15879 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
15881 mut self,
15882 v: V,
15883 ) -> Self {
15884 self.0.request = v.into();
15885 self
15886 }
15887
15888 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15890 self.0.options = v.into();
15891 self
15892 }
15893
15894 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
15896 (*self.0.stub)
15897 .list_operations(self.0.request, self.0.options)
15898 .await
15899 .map(crate::Response::into_body)
15900 }
15901
15902 pub fn by_page(
15904 self,
15905 ) -> impl google_cloud_gax::paginator::Paginator<
15906 google_cloud_longrunning::model::ListOperationsResponse,
15907 crate::Error,
15908 > {
15909 use std::clone::Clone;
15910 let token = self.0.request.page_token.clone();
15911 let execute = move |token: String| {
15912 let mut builder = self.clone();
15913 builder.0.request = builder.0.request.set_page_token(token);
15914 builder.send()
15915 };
15916 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15917 }
15918
15919 pub fn by_item(
15921 self,
15922 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15923 google_cloud_longrunning::model::ListOperationsResponse,
15924 crate::Error,
15925 > {
15926 use google_cloud_gax::paginator::Paginator;
15927 self.by_page().items()
15928 }
15929
15930 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15932 self.0.request.name = v.into();
15933 self
15934 }
15935
15936 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15938 self.0.request.filter = v.into();
15939 self
15940 }
15941
15942 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15944 self.0.request.page_size = v.into();
15945 self
15946 }
15947
15948 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15950 self.0.request.page_token = v.into();
15951 self
15952 }
15953
15954 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
15956 self.0.request.return_partial_success = v.into();
15957 self
15958 }
15959 }
15960
15961 #[doc(hidden)]
15962 impl crate::RequestBuilder for ListOperations {
15963 fn request_options(&mut self) -> &mut crate::RequestOptions {
15964 &mut self.0.options
15965 }
15966 }
15967
15968 #[derive(Clone, Debug)]
15985 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
15986
15987 impl GetOperation {
15988 pub(crate) fn new(
15989 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15990 ) -> Self {
15991 Self(RequestBuilder::new(stub))
15992 }
15993
15994 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
15996 mut self,
15997 v: V,
15998 ) -> Self {
15999 self.0.request = v.into();
16000 self
16001 }
16002
16003 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16005 self.0.options = v.into();
16006 self
16007 }
16008
16009 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16011 (*self.0.stub)
16012 .get_operation(self.0.request, self.0.options)
16013 .await
16014 .map(crate::Response::into_body)
16015 }
16016
16017 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16019 self.0.request.name = v.into();
16020 self
16021 }
16022 }
16023
16024 #[doc(hidden)]
16025 impl crate::RequestBuilder for GetOperation {
16026 fn request_options(&mut self) -> &mut crate::RequestOptions {
16027 &mut self.0.options
16028 }
16029 }
16030
16031 #[derive(Clone, Debug)]
16048 pub struct CancelOperation(
16049 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16050 );
16051
16052 impl CancelOperation {
16053 pub(crate) fn new(
16054 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16055 ) -> Self {
16056 Self(RequestBuilder::new(stub))
16057 }
16058
16059 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16061 mut self,
16062 v: V,
16063 ) -> Self {
16064 self.0.request = v.into();
16065 self
16066 }
16067
16068 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16070 self.0.options = v.into();
16071 self
16072 }
16073
16074 pub async fn send(self) -> Result<()> {
16076 (*self.0.stub)
16077 .cancel_operation(self.0.request, self.0.options)
16078 .await
16079 .map(crate::Response::into_body)
16080 }
16081
16082 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16084 self.0.request.name = v.into();
16085 self
16086 }
16087 }
16088
16089 #[doc(hidden)]
16090 impl crate::RequestBuilder for CancelOperation {
16091 fn request_options(&mut self) -> &mut crate::RequestOptions {
16092 &mut self.0.options
16093 }
16094 }
16095}
16096
16097#[cfg(feature = "user-event-service")]
16098#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
16099pub mod user_event_service {
16100 use crate::Result;
16101
16102 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16116
16117 pub(crate) mod client {
16118 use super::super::super::client::UserEventService;
16119 pub struct Factory;
16120 impl crate::ClientFactory for Factory {
16121 type Client = UserEventService;
16122 type Credentials = gaxi::options::Credentials;
16123 async fn build(
16124 self,
16125 config: gaxi::options::ClientConfig,
16126 ) -> crate::ClientBuilderResult<Self::Client> {
16127 Self::Client::new(config).await
16128 }
16129 }
16130 }
16131
16132 #[derive(Clone, Debug)]
16134 pub(crate) struct RequestBuilder<R: std::default::Default> {
16135 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16136 request: R,
16137 options: crate::RequestOptions,
16138 }
16139
16140 impl<R> RequestBuilder<R>
16141 where
16142 R: std::default::Default,
16143 {
16144 pub(crate) fn new(
16145 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16146 ) -> Self {
16147 Self {
16148 stub,
16149 request: R::default(),
16150 options: crate::RequestOptions::default(),
16151 }
16152 }
16153 }
16154
16155 #[derive(Clone, Debug)]
16172 pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
16173
16174 impl WriteUserEvent {
16175 pub(crate) fn new(
16176 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16177 ) -> Self {
16178 Self(RequestBuilder::new(stub))
16179 }
16180
16181 pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
16183 self.0.request = v.into();
16184 self
16185 }
16186
16187 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16189 self.0.options = v.into();
16190 self
16191 }
16192
16193 pub async fn send(self) -> Result<crate::model::UserEvent> {
16195 (*self.0.stub)
16196 .write_user_event(self.0.request, self.0.options)
16197 .await
16198 .map(crate::Response::into_body)
16199 }
16200
16201 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16205 self.0.request.parent = v.into();
16206 self
16207 }
16208
16209 pub fn set_user_event<T>(mut self, v: T) -> Self
16213 where
16214 T: std::convert::Into<crate::model::UserEvent>,
16215 {
16216 self.0.request.user_event = std::option::Option::Some(v.into());
16217 self
16218 }
16219
16220 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
16224 where
16225 T: std::convert::Into<crate::model::UserEvent>,
16226 {
16227 self.0.request.user_event = v.map(|x| x.into());
16228 self
16229 }
16230
16231 pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
16233 self.0.request.write_async = v.into();
16234 self
16235 }
16236 }
16237
16238 #[doc(hidden)]
16239 impl crate::RequestBuilder for WriteUserEvent {
16240 fn request_options(&mut self) -> &mut crate::RequestOptions {
16241 &mut self.0.options
16242 }
16243 }
16244
16245 #[derive(Clone, Debug)]
16262 pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
16263
16264 impl CollectUserEvent {
16265 pub(crate) fn new(
16266 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16267 ) -> Self {
16268 Self(RequestBuilder::new(stub))
16269 }
16270
16271 pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
16273 mut self,
16274 v: V,
16275 ) -> Self {
16276 self.0.request = v.into();
16277 self
16278 }
16279
16280 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16282 self.0.options = v.into();
16283 self
16284 }
16285
16286 pub async fn send(self) -> Result<google_cloud_api::model::HttpBody> {
16288 (*self.0.stub)
16289 .collect_user_event(self.0.request, self.0.options)
16290 .await
16291 .map(crate::Response::into_body)
16292 }
16293
16294 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16298 self.0.request.parent = v.into();
16299 self
16300 }
16301
16302 pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
16306 self.0.request.user_event = v.into();
16307 self
16308 }
16309
16310 pub fn set_uri<T>(mut self, v: T) -> Self
16312 where
16313 T: std::convert::Into<std::string::String>,
16314 {
16315 self.0.request.uri = std::option::Option::Some(v.into());
16316 self
16317 }
16318
16319 pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
16321 where
16322 T: std::convert::Into<std::string::String>,
16323 {
16324 self.0.request.uri = v.map(|x| x.into());
16325 self
16326 }
16327
16328 pub fn set_ets<T>(mut self, v: T) -> Self
16330 where
16331 T: std::convert::Into<i64>,
16332 {
16333 self.0.request.ets = std::option::Option::Some(v.into());
16334 self
16335 }
16336
16337 pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
16339 where
16340 T: std::convert::Into<i64>,
16341 {
16342 self.0.request.ets = v.map(|x| x.into());
16343 self
16344 }
16345 }
16346
16347 #[doc(hidden)]
16348 impl crate::RequestBuilder for CollectUserEvent {
16349 fn request_options(&mut self) -> &mut crate::RequestOptions {
16350 &mut self.0.options
16351 }
16352 }
16353
16354 #[derive(Clone, Debug)]
16372 pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
16373
16374 impl PurgeUserEvents {
16375 pub(crate) fn new(
16376 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16377 ) -> Self {
16378 Self(RequestBuilder::new(stub))
16379 }
16380
16381 pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16383 self.0.request = v.into();
16384 self
16385 }
16386
16387 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16389 self.0.options = v.into();
16390 self
16391 }
16392
16393 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16400 (*self.0.stub)
16401 .purge_user_events(self.0.request, self.0.options)
16402 .await
16403 .map(crate::Response::into_body)
16404 }
16405
16406 pub fn poller(
16408 self,
16409 ) -> impl google_cloud_lro::Poller<
16410 crate::model::PurgeUserEventsResponse,
16411 crate::model::PurgeUserEventsMetadata,
16412 > {
16413 type Operation = google_cloud_lro::internal::Operation<
16414 crate::model::PurgeUserEventsResponse,
16415 crate::model::PurgeUserEventsMetadata,
16416 >;
16417 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16418 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16419
16420 let stub = self.0.stub.clone();
16421 let mut options = self.0.options.clone();
16422 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16423 let query = move |name| {
16424 let stub = stub.clone();
16425 let options = options.clone();
16426 async {
16427 let op = GetOperation::new(stub)
16428 .set_name(name)
16429 .with_options(options)
16430 .send()
16431 .await?;
16432 Ok(Operation::new(op))
16433 }
16434 };
16435
16436 let start = move || async {
16437 let op = self.send().await?;
16438 Ok(Operation::new(op))
16439 };
16440
16441 google_cloud_lro::internal::new_poller(
16442 polling_error_policy,
16443 polling_backoff_policy,
16444 start,
16445 query,
16446 )
16447 }
16448
16449 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16453 self.0.request.parent = v.into();
16454 self
16455 }
16456
16457 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16461 self.0.request.filter = v.into();
16462 self
16463 }
16464
16465 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16467 self.0.request.force = v.into();
16468 self
16469 }
16470 }
16471
16472 #[doc(hidden)]
16473 impl crate::RequestBuilder for PurgeUserEvents {
16474 fn request_options(&mut self) -> &mut crate::RequestOptions {
16475 &mut self.0.options
16476 }
16477 }
16478
16479 #[derive(Clone, Debug)]
16497 pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
16498
16499 impl ImportUserEvents {
16500 pub(crate) fn new(
16501 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16502 ) -> Self {
16503 Self(RequestBuilder::new(stub))
16504 }
16505
16506 pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
16508 mut self,
16509 v: V,
16510 ) -> Self {
16511 self.0.request = v.into();
16512 self
16513 }
16514
16515 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16517 self.0.options = v.into();
16518 self
16519 }
16520
16521 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16528 (*self.0.stub)
16529 .import_user_events(self.0.request, self.0.options)
16530 .await
16531 .map(crate::Response::into_body)
16532 }
16533
16534 pub fn poller(
16536 self,
16537 ) -> impl google_cloud_lro::Poller<
16538 crate::model::ImportUserEventsResponse,
16539 crate::model::ImportUserEventsMetadata,
16540 > {
16541 type Operation = google_cloud_lro::internal::Operation<
16542 crate::model::ImportUserEventsResponse,
16543 crate::model::ImportUserEventsMetadata,
16544 >;
16545 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16546 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16547
16548 let stub = self.0.stub.clone();
16549 let mut options = self.0.options.clone();
16550 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16551 let query = move |name| {
16552 let stub = stub.clone();
16553 let options = options.clone();
16554 async {
16555 let op = GetOperation::new(stub)
16556 .set_name(name)
16557 .with_options(options)
16558 .send()
16559 .await?;
16560 Ok(Operation::new(op))
16561 }
16562 };
16563
16564 let start = move || async {
16565 let op = self.send().await?;
16566 Ok(Operation::new(op))
16567 };
16568
16569 google_cloud_lro::internal::new_poller(
16570 polling_error_policy,
16571 polling_backoff_policy,
16572 start,
16573 query,
16574 )
16575 }
16576
16577 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16581 self.0.request.parent = v.into();
16582 self
16583 }
16584
16585 pub fn set_error_config<T>(mut self, v: T) -> Self
16587 where
16588 T: std::convert::Into<crate::model::ImportErrorConfig>,
16589 {
16590 self.0.request.error_config = std::option::Option::Some(v.into());
16591 self
16592 }
16593
16594 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
16596 where
16597 T: std::convert::Into<crate::model::ImportErrorConfig>,
16598 {
16599 self.0.request.error_config = v.map(|x| x.into());
16600 self
16601 }
16602
16603 pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
16608 mut self,
16609 v: T,
16610 ) -> Self {
16611 self.0.request.source = v.into();
16612 self
16613 }
16614
16615 pub fn set_inline_source<
16621 T: std::convert::Into<
16622 std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
16623 >,
16624 >(
16625 mut self,
16626 v: T,
16627 ) -> Self {
16628 self.0.request = self.0.request.set_inline_source(v);
16629 self
16630 }
16631
16632 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
16638 mut self,
16639 v: T,
16640 ) -> Self {
16641 self.0.request = self.0.request.set_gcs_source(v);
16642 self
16643 }
16644
16645 pub fn set_bigquery_source<
16651 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
16652 >(
16653 mut self,
16654 v: T,
16655 ) -> Self {
16656 self.0.request = self.0.request.set_bigquery_source(v);
16657 self
16658 }
16659 }
16660
16661 #[doc(hidden)]
16662 impl crate::RequestBuilder for ImportUserEvents {
16663 fn request_options(&mut self) -> &mut crate::RequestOptions {
16664 &mut self.0.options
16665 }
16666 }
16667
16668 #[derive(Clone, Debug)]
16689 pub struct ListOperations(
16690 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16691 );
16692
16693 impl ListOperations {
16694 pub(crate) fn new(
16695 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16696 ) -> Self {
16697 Self(RequestBuilder::new(stub))
16698 }
16699
16700 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16702 mut self,
16703 v: V,
16704 ) -> Self {
16705 self.0.request = v.into();
16706 self
16707 }
16708
16709 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16711 self.0.options = v.into();
16712 self
16713 }
16714
16715 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16717 (*self.0.stub)
16718 .list_operations(self.0.request, self.0.options)
16719 .await
16720 .map(crate::Response::into_body)
16721 }
16722
16723 pub fn by_page(
16725 self,
16726 ) -> impl google_cloud_gax::paginator::Paginator<
16727 google_cloud_longrunning::model::ListOperationsResponse,
16728 crate::Error,
16729 > {
16730 use std::clone::Clone;
16731 let token = self.0.request.page_token.clone();
16732 let execute = move |token: String| {
16733 let mut builder = self.clone();
16734 builder.0.request = builder.0.request.set_page_token(token);
16735 builder.send()
16736 };
16737 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16738 }
16739
16740 pub fn by_item(
16742 self,
16743 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16744 google_cloud_longrunning::model::ListOperationsResponse,
16745 crate::Error,
16746 > {
16747 use google_cloud_gax::paginator::Paginator;
16748 self.by_page().items()
16749 }
16750
16751 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16753 self.0.request.name = v.into();
16754 self
16755 }
16756
16757 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16759 self.0.request.filter = v.into();
16760 self
16761 }
16762
16763 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16765 self.0.request.page_size = v.into();
16766 self
16767 }
16768
16769 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16771 self.0.request.page_token = v.into();
16772 self
16773 }
16774
16775 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16777 self.0.request.return_partial_success = v.into();
16778 self
16779 }
16780 }
16781
16782 #[doc(hidden)]
16783 impl crate::RequestBuilder for ListOperations {
16784 fn request_options(&mut self) -> &mut crate::RequestOptions {
16785 &mut self.0.options
16786 }
16787 }
16788
16789 #[derive(Clone, Debug)]
16806 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16807
16808 impl GetOperation {
16809 pub(crate) fn new(
16810 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16811 ) -> Self {
16812 Self(RequestBuilder::new(stub))
16813 }
16814
16815 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16817 mut self,
16818 v: V,
16819 ) -> Self {
16820 self.0.request = v.into();
16821 self
16822 }
16823
16824 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16826 self.0.options = v.into();
16827 self
16828 }
16829
16830 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16832 (*self.0.stub)
16833 .get_operation(self.0.request, self.0.options)
16834 .await
16835 .map(crate::Response::into_body)
16836 }
16837
16838 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16840 self.0.request.name = v.into();
16841 self
16842 }
16843 }
16844
16845 #[doc(hidden)]
16846 impl crate::RequestBuilder for GetOperation {
16847 fn request_options(&mut self) -> &mut crate::RequestOptions {
16848 &mut self.0.options
16849 }
16850 }
16851
16852 #[derive(Clone, Debug)]
16869 pub struct CancelOperation(
16870 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16871 );
16872
16873 impl CancelOperation {
16874 pub(crate) fn new(
16875 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16876 ) -> Self {
16877 Self(RequestBuilder::new(stub))
16878 }
16879
16880 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16882 mut self,
16883 v: V,
16884 ) -> Self {
16885 self.0.request = v.into();
16886 self
16887 }
16888
16889 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16891 self.0.options = v.into();
16892 self
16893 }
16894
16895 pub async fn send(self) -> Result<()> {
16897 (*self.0.stub)
16898 .cancel_operation(self.0.request, self.0.options)
16899 .await
16900 .map(crate::Response::into_body)
16901 }
16902
16903 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16905 self.0.request.name = v.into();
16906 self
16907 }
16908 }
16909
16910 #[doc(hidden)]
16911 impl crate::RequestBuilder for CancelOperation {
16912 fn request_options(&mut self) -> &mut crate::RequestOptions {
16913 &mut self.0.options
16914 }
16915 }
16916}
16917
16918#[cfg(feature = "user-license-service")]
16919#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
16920pub mod user_license_service {
16921 use crate::Result;
16922
16923 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16937
16938 pub(crate) mod client {
16939 use super::super::super::client::UserLicenseService;
16940 pub struct Factory;
16941 impl crate::ClientFactory for Factory {
16942 type Client = UserLicenseService;
16943 type Credentials = gaxi::options::Credentials;
16944 async fn build(
16945 self,
16946 config: gaxi::options::ClientConfig,
16947 ) -> crate::ClientBuilderResult<Self::Client> {
16948 Self::Client::new(config).await
16949 }
16950 }
16951 }
16952
16953 #[derive(Clone, Debug)]
16955 pub(crate) struct RequestBuilder<R: std::default::Default> {
16956 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16957 request: R,
16958 options: crate::RequestOptions,
16959 }
16960
16961 impl<R> RequestBuilder<R>
16962 where
16963 R: std::default::Default,
16964 {
16965 pub(crate) fn new(
16966 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16967 ) -> Self {
16968 Self {
16969 stub,
16970 request: R::default(),
16971 options: crate::RequestOptions::default(),
16972 }
16973 }
16974 }
16975
16976 #[derive(Clone, Debug)]
16997 pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
16998
16999 impl ListUserLicenses {
17000 pub(crate) fn new(
17001 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17002 ) -> Self {
17003 Self(RequestBuilder::new(stub))
17004 }
17005
17006 pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
17008 mut self,
17009 v: V,
17010 ) -> Self {
17011 self.0.request = v.into();
17012 self
17013 }
17014
17015 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17017 self.0.options = v.into();
17018 self
17019 }
17020
17021 pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
17023 (*self.0.stub)
17024 .list_user_licenses(self.0.request, self.0.options)
17025 .await
17026 .map(crate::Response::into_body)
17027 }
17028
17029 pub fn by_page(
17031 self,
17032 ) -> impl google_cloud_gax::paginator::Paginator<
17033 crate::model::ListUserLicensesResponse,
17034 crate::Error,
17035 > {
17036 use std::clone::Clone;
17037 let token = self.0.request.page_token.clone();
17038 let execute = move |token: String| {
17039 let mut builder = self.clone();
17040 builder.0.request = builder.0.request.set_page_token(token);
17041 builder.send()
17042 };
17043 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17044 }
17045
17046 pub fn by_item(
17048 self,
17049 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17050 crate::model::ListUserLicensesResponse,
17051 crate::Error,
17052 > {
17053 use google_cloud_gax::paginator::Paginator;
17054 self.by_page().items()
17055 }
17056
17057 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17061 self.0.request.parent = v.into();
17062 self
17063 }
17064
17065 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17067 self.0.request.page_size = v.into();
17068 self
17069 }
17070
17071 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17073 self.0.request.page_token = v.into();
17074 self
17075 }
17076
17077 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17079 self.0.request.filter = v.into();
17080 self
17081 }
17082 }
17083
17084 #[doc(hidden)]
17085 impl crate::RequestBuilder for ListUserLicenses {
17086 fn request_options(&mut self) -> &mut crate::RequestOptions {
17087 &mut self.0.options
17088 }
17089 }
17090
17091 #[derive(Clone, Debug)]
17109 pub struct BatchUpdateUserLicenses(
17110 RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
17111 );
17112
17113 impl BatchUpdateUserLicenses {
17114 pub(crate) fn new(
17115 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17116 ) -> Self {
17117 Self(RequestBuilder::new(stub))
17118 }
17119
17120 pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
17122 mut self,
17123 v: V,
17124 ) -> Self {
17125 self.0.request = v.into();
17126 self
17127 }
17128
17129 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17131 self.0.options = v.into();
17132 self
17133 }
17134
17135 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17142 (*self.0.stub)
17143 .batch_update_user_licenses(self.0.request, self.0.options)
17144 .await
17145 .map(crate::Response::into_body)
17146 }
17147
17148 pub fn poller(
17150 self,
17151 ) -> impl google_cloud_lro::Poller<
17152 crate::model::BatchUpdateUserLicensesResponse,
17153 crate::model::BatchUpdateUserLicensesMetadata,
17154 > {
17155 type Operation = google_cloud_lro::internal::Operation<
17156 crate::model::BatchUpdateUserLicensesResponse,
17157 crate::model::BatchUpdateUserLicensesMetadata,
17158 >;
17159 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
17160 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
17161
17162 let stub = self.0.stub.clone();
17163 let mut options = self.0.options.clone();
17164 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
17165 let query = move |name| {
17166 let stub = stub.clone();
17167 let options = options.clone();
17168 async {
17169 let op = GetOperation::new(stub)
17170 .set_name(name)
17171 .with_options(options)
17172 .send()
17173 .await?;
17174 Ok(Operation::new(op))
17175 }
17176 };
17177
17178 let start = move || async {
17179 let op = self.send().await?;
17180 Ok(Operation::new(op))
17181 };
17182
17183 google_cloud_lro::internal::new_poller(
17184 polling_error_policy,
17185 polling_backoff_policy,
17186 start,
17187 query,
17188 )
17189 }
17190
17191 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17195 self.0.request.parent = v.into();
17196 self
17197 }
17198
17199 pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
17201 self.0.request.delete_unassigned_user_licenses = v.into();
17202 self
17203 }
17204
17205 pub fn set_source<
17210 T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
17211 >(
17212 mut self,
17213 v: T,
17214 ) -> Self {
17215 self.0.request.source = v.into();
17216 self
17217 }
17218
17219 pub fn set_inline_source<
17225 T: std::convert::Into<
17226 std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
17227 >,
17228 >(
17229 mut self,
17230 v: T,
17231 ) -> Self {
17232 self.0.request = self.0.request.set_inline_source(v);
17233 self
17234 }
17235 }
17236
17237 #[doc(hidden)]
17238 impl crate::RequestBuilder for BatchUpdateUserLicenses {
17239 fn request_options(&mut self) -> &mut crate::RequestOptions {
17240 &mut self.0.options
17241 }
17242 }
17243
17244 #[derive(Clone, Debug)]
17265 pub struct ListOperations(
17266 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17267 );
17268
17269 impl ListOperations {
17270 pub(crate) fn new(
17271 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17272 ) -> Self {
17273 Self(RequestBuilder::new(stub))
17274 }
17275
17276 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17278 mut self,
17279 v: V,
17280 ) -> Self {
17281 self.0.request = v.into();
17282 self
17283 }
17284
17285 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17287 self.0.options = v.into();
17288 self
17289 }
17290
17291 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17293 (*self.0.stub)
17294 .list_operations(self.0.request, self.0.options)
17295 .await
17296 .map(crate::Response::into_body)
17297 }
17298
17299 pub fn by_page(
17301 self,
17302 ) -> impl google_cloud_gax::paginator::Paginator<
17303 google_cloud_longrunning::model::ListOperationsResponse,
17304 crate::Error,
17305 > {
17306 use std::clone::Clone;
17307 let token = self.0.request.page_token.clone();
17308 let execute = move |token: String| {
17309 let mut builder = self.clone();
17310 builder.0.request = builder.0.request.set_page_token(token);
17311 builder.send()
17312 };
17313 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17314 }
17315
17316 pub fn by_item(
17318 self,
17319 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17320 google_cloud_longrunning::model::ListOperationsResponse,
17321 crate::Error,
17322 > {
17323 use google_cloud_gax::paginator::Paginator;
17324 self.by_page().items()
17325 }
17326
17327 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17329 self.0.request.name = v.into();
17330 self
17331 }
17332
17333 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17335 self.0.request.filter = v.into();
17336 self
17337 }
17338
17339 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17341 self.0.request.page_size = v.into();
17342 self
17343 }
17344
17345 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17347 self.0.request.page_token = v.into();
17348 self
17349 }
17350
17351 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17353 self.0.request.return_partial_success = v.into();
17354 self
17355 }
17356 }
17357
17358 #[doc(hidden)]
17359 impl crate::RequestBuilder for ListOperations {
17360 fn request_options(&mut self) -> &mut crate::RequestOptions {
17361 &mut self.0.options
17362 }
17363 }
17364
17365 #[derive(Clone, Debug)]
17382 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17383
17384 impl GetOperation {
17385 pub(crate) fn new(
17386 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17387 ) -> Self {
17388 Self(RequestBuilder::new(stub))
17389 }
17390
17391 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17393 mut self,
17394 v: V,
17395 ) -> Self {
17396 self.0.request = v.into();
17397 self
17398 }
17399
17400 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17402 self.0.options = v.into();
17403 self
17404 }
17405
17406 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17408 (*self.0.stub)
17409 .get_operation(self.0.request, self.0.options)
17410 .await
17411 .map(crate::Response::into_body)
17412 }
17413
17414 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17416 self.0.request.name = v.into();
17417 self
17418 }
17419 }
17420
17421 #[doc(hidden)]
17422 impl crate::RequestBuilder for GetOperation {
17423 fn request_options(&mut self) -> &mut crate::RequestOptions {
17424 &mut self.0.options
17425 }
17426 }
17427
17428 #[derive(Clone, Debug)]
17445 pub struct CancelOperation(
17446 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17447 );
17448
17449 impl CancelOperation {
17450 pub(crate) fn new(
17451 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17452 ) -> Self {
17453 Self(RequestBuilder::new(stub))
17454 }
17455
17456 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17458 mut self,
17459 v: V,
17460 ) -> Self {
17461 self.0.request = v.into();
17462 self
17463 }
17464
17465 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17467 self.0.options = v.into();
17468 self
17469 }
17470
17471 pub async fn send(self) -> Result<()> {
17473 (*self.0.stub)
17474 .cancel_operation(self.0.request, self.0.options)
17475 .await
17476 .map(crate::Response::into_body)
17477 }
17478
17479 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17481 self.0.request.name = v.into();
17482 self
17483 }
17484 }
17485
17486 #[doc(hidden)]
17487 impl crate::RequestBuilder for CancelOperation {
17488 fn request_options(&mut self) -> &mut crate::RequestOptions {
17489 &mut self.0.options
17490 }
17491 }
17492}