1#[cfg(feature = "assistant-service")]
19#[cfg_attr(docsrs, doc(cfg(feature = "assistant-service")))]
20pub mod assistant_service {
21 use crate::Result;
22
23 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
37
38 pub(crate) mod client {
39 use super::super::super::client::AssistantService;
40 pub struct Factory;
41 impl crate::ClientFactory for Factory {
42 type Client = AssistantService;
43 type Credentials = gaxi::options::Credentials;
44 async fn build(
45 self,
46 config: gaxi::options::ClientConfig,
47 ) -> crate::ClientBuilderResult<Self::Client> {
48 Self::Client::new(config).await
49 }
50 }
51 }
52
53 #[derive(Clone, Debug)]
55 pub(crate) struct RequestBuilder<R: std::default::Default> {
56 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
57 request: R,
58 options: crate::RequestOptions,
59 }
60
61 impl<R> RequestBuilder<R>
62 where
63 R: std::default::Default,
64 {
65 pub(crate) fn new(
66 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
67 ) -> Self {
68 Self {
69 stub,
70 request: R::default(),
71 options: crate::RequestOptions::default(),
72 }
73 }
74 }
75
76 #[derive(Clone, Debug)]
97 pub struct ListOperations(
98 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
99 );
100
101 impl ListOperations {
102 pub(crate) fn new(
103 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
104 ) -> Self {
105 Self(RequestBuilder::new(stub))
106 }
107
108 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
110 mut self,
111 v: V,
112 ) -> Self {
113 self.0.request = v.into();
114 self
115 }
116
117 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
119 self.0.options = v.into();
120 self
121 }
122
123 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
125 (*self.0.stub)
126 .list_operations(self.0.request, self.0.options)
127 .await
128 .map(crate::Response::into_body)
129 }
130
131 pub fn by_page(
133 self,
134 ) -> impl google_cloud_gax::paginator::Paginator<
135 google_cloud_longrunning::model::ListOperationsResponse,
136 crate::Error,
137 > {
138 use std::clone::Clone;
139 let token = self.0.request.page_token.clone();
140 let execute = move |token: String| {
141 let mut builder = self.clone();
142 builder.0.request = builder.0.request.set_page_token(token);
143 builder.send()
144 };
145 google_cloud_gax::paginator::internal::new_paginator(token, execute)
146 }
147
148 pub fn by_item(
150 self,
151 ) -> impl google_cloud_gax::paginator::ItemPaginator<
152 google_cloud_longrunning::model::ListOperationsResponse,
153 crate::Error,
154 > {
155 use google_cloud_gax::paginator::Paginator;
156 self.by_page().items()
157 }
158
159 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
161 self.0.request.name = v.into();
162 self
163 }
164
165 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
167 self.0.request.filter = v.into();
168 self
169 }
170
171 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
173 self.0.request.page_size = v.into();
174 self
175 }
176
177 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
179 self.0.request.page_token = v.into();
180 self
181 }
182
183 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
185 self.0.request.return_partial_success = v.into();
186 self
187 }
188 }
189
190 #[doc(hidden)]
191 impl crate::RequestBuilder for ListOperations {
192 fn request_options(&mut self) -> &mut crate::RequestOptions {
193 &mut self.0.options
194 }
195 }
196
197 #[derive(Clone, Debug)]
214 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
215
216 impl GetOperation {
217 pub(crate) fn new(
218 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
219 ) -> Self {
220 Self(RequestBuilder::new(stub))
221 }
222
223 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
225 mut self,
226 v: V,
227 ) -> Self {
228 self.0.request = v.into();
229 self
230 }
231
232 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
234 self.0.options = v.into();
235 self
236 }
237
238 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
240 (*self.0.stub)
241 .get_operation(self.0.request, self.0.options)
242 .await
243 .map(crate::Response::into_body)
244 }
245
246 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
248 self.0.request.name = v.into();
249 self
250 }
251 }
252
253 #[doc(hidden)]
254 impl crate::RequestBuilder for GetOperation {
255 fn request_options(&mut self) -> &mut crate::RequestOptions {
256 &mut self.0.options
257 }
258 }
259
260 #[derive(Clone, Debug)]
277 pub struct CancelOperation(
278 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
279 );
280
281 impl CancelOperation {
282 pub(crate) fn new(
283 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
284 ) -> Self {
285 Self(RequestBuilder::new(stub))
286 }
287
288 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
290 mut self,
291 v: V,
292 ) -> Self {
293 self.0.request = v.into();
294 self
295 }
296
297 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
299 self.0.options = v.into();
300 self
301 }
302
303 pub async fn send(self) -> Result<()> {
305 (*self.0.stub)
306 .cancel_operation(self.0.request, self.0.options)
307 .await
308 .map(crate::Response::into_body)
309 }
310
311 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
313 self.0.request.name = v.into();
314 self
315 }
316 }
317
318 #[doc(hidden)]
319 impl crate::RequestBuilder for CancelOperation {
320 fn request_options(&mut self) -> &mut crate::RequestOptions {
321 &mut self.0.options
322 }
323 }
324}
325
326#[cfg(feature = "cmek-config-service")]
328#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
329pub mod cmek_config_service {
330 use crate::Result;
331
332 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
346
347 pub(crate) mod client {
348 use super::super::super::client::CmekConfigService;
349 pub struct Factory;
350 impl crate::ClientFactory for Factory {
351 type Client = CmekConfigService;
352 type Credentials = gaxi::options::Credentials;
353 async fn build(
354 self,
355 config: gaxi::options::ClientConfig,
356 ) -> crate::ClientBuilderResult<Self::Client> {
357 Self::Client::new(config).await
358 }
359 }
360 }
361
362 #[derive(Clone, Debug)]
364 pub(crate) struct RequestBuilder<R: std::default::Default> {
365 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
366 request: R,
367 options: crate::RequestOptions,
368 }
369
370 impl<R> RequestBuilder<R>
371 where
372 R: std::default::Default,
373 {
374 pub(crate) fn new(
375 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
376 ) -> Self {
377 Self {
378 stub,
379 request: R::default(),
380 options: crate::RequestOptions::default(),
381 }
382 }
383 }
384
385 #[derive(Clone, Debug)]
403 pub struct UpdateCmekConfig(RequestBuilder<crate::model::UpdateCmekConfigRequest>);
404
405 impl UpdateCmekConfig {
406 pub(crate) fn new(
407 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
408 ) -> Self {
409 Self(RequestBuilder::new(stub))
410 }
411
412 pub fn with_request<V: Into<crate::model::UpdateCmekConfigRequest>>(
414 mut self,
415 v: V,
416 ) -> Self {
417 self.0.request = v.into();
418 self
419 }
420
421 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
423 self.0.options = v.into();
424 self
425 }
426
427 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
434 (*self.0.stub)
435 .update_cmek_config(self.0.request, self.0.options)
436 .await
437 .map(crate::Response::into_body)
438 }
439
440 pub fn poller(
442 self,
443 ) -> impl google_cloud_lro::Poller<
444 crate::model::CmekConfig,
445 crate::model::UpdateCmekConfigMetadata,
446 > {
447 type Operation = google_cloud_lro::internal::Operation<
448 crate::model::CmekConfig,
449 crate::model::UpdateCmekConfigMetadata,
450 >;
451 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
452 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
453
454 let stub = self.0.stub.clone();
455 let mut options = self.0.options.clone();
456 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
457 let query = move |name| {
458 let stub = stub.clone();
459 let options = options.clone();
460 async {
461 let op = GetOperation::new(stub)
462 .set_name(name)
463 .with_options(options)
464 .send()
465 .await?;
466 Ok(Operation::new(op))
467 }
468 };
469
470 let start = move || async {
471 let op = self.send().await?;
472 Ok(Operation::new(op))
473 };
474
475 google_cloud_lro::internal::new_poller(
476 polling_error_policy,
477 polling_backoff_policy,
478 start,
479 query,
480 )
481 }
482
483 pub fn set_config<T>(mut self, v: T) -> Self
487 where
488 T: std::convert::Into<crate::model::CmekConfig>,
489 {
490 self.0.request.config = std::option::Option::Some(v.into());
491 self
492 }
493
494 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
498 where
499 T: std::convert::Into<crate::model::CmekConfig>,
500 {
501 self.0.request.config = v.map(|x| x.into());
502 self
503 }
504
505 pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
507 self.0.request.set_default = v.into();
508 self
509 }
510 }
511
512 #[doc(hidden)]
513 impl crate::RequestBuilder for UpdateCmekConfig {
514 fn request_options(&mut self) -> &mut crate::RequestOptions {
515 &mut self.0.options
516 }
517 }
518
519 #[derive(Clone, Debug)]
536 pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
537
538 impl GetCmekConfig {
539 pub(crate) fn new(
540 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
541 ) -> Self {
542 Self(RequestBuilder::new(stub))
543 }
544
545 pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
547 self.0.request = v.into();
548 self
549 }
550
551 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
553 self.0.options = v.into();
554 self
555 }
556
557 pub async fn send(self) -> Result<crate::model::CmekConfig> {
559 (*self.0.stub)
560 .get_cmek_config(self.0.request, self.0.options)
561 .await
562 .map(crate::Response::into_body)
563 }
564
565 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
569 self.0.request.name = v.into();
570 self
571 }
572 }
573
574 #[doc(hidden)]
575 impl crate::RequestBuilder for GetCmekConfig {
576 fn request_options(&mut self) -> &mut crate::RequestOptions {
577 &mut self.0.options
578 }
579 }
580
581 #[derive(Clone, Debug)]
598 pub struct ListCmekConfigs(RequestBuilder<crate::model::ListCmekConfigsRequest>);
599
600 impl ListCmekConfigs {
601 pub(crate) fn new(
602 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
603 ) -> Self {
604 Self(RequestBuilder::new(stub))
605 }
606
607 pub fn with_request<V: Into<crate::model::ListCmekConfigsRequest>>(mut self, v: V) -> Self {
609 self.0.request = v.into();
610 self
611 }
612
613 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
615 self.0.options = v.into();
616 self
617 }
618
619 pub async fn send(self) -> Result<crate::model::ListCmekConfigsResponse> {
621 (*self.0.stub)
622 .list_cmek_configs(self.0.request, self.0.options)
623 .await
624 .map(crate::Response::into_body)
625 }
626
627 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
631 self.0.request.parent = v.into();
632 self
633 }
634 }
635
636 #[doc(hidden)]
637 impl crate::RequestBuilder for ListCmekConfigs {
638 fn request_options(&mut self) -> &mut crate::RequestOptions {
639 &mut self.0.options
640 }
641 }
642
643 #[derive(Clone, Debug)]
661 pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
662
663 impl DeleteCmekConfig {
664 pub(crate) fn new(
665 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
666 ) -> Self {
667 Self(RequestBuilder::new(stub))
668 }
669
670 pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
672 mut self,
673 v: V,
674 ) -> Self {
675 self.0.request = v.into();
676 self
677 }
678
679 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
681 self.0.options = v.into();
682 self
683 }
684
685 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
692 (*self.0.stub)
693 .delete_cmek_config(self.0.request, self.0.options)
694 .await
695 .map(crate::Response::into_body)
696 }
697
698 pub fn poller(
700 self,
701 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
702 type Operation = google_cloud_lro::internal::Operation<
703 wkt::Empty,
704 crate::model::DeleteCmekConfigMetadata,
705 >;
706 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
707 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
708
709 let stub = self.0.stub.clone();
710 let mut options = self.0.options.clone();
711 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
712 let query = move |name| {
713 let stub = stub.clone();
714 let options = options.clone();
715 async {
716 let op = GetOperation::new(stub)
717 .set_name(name)
718 .with_options(options)
719 .send()
720 .await?;
721 Ok(Operation::new(op))
722 }
723 };
724
725 let start = move || async {
726 let op = self.send().await?;
727 Ok(Operation::new(op))
728 };
729
730 google_cloud_lro::internal::new_unit_response_poller(
731 polling_error_policy,
732 polling_backoff_policy,
733 start,
734 query,
735 )
736 }
737
738 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
742 self.0.request.name = v.into();
743 self
744 }
745 }
746
747 #[doc(hidden)]
748 impl crate::RequestBuilder for DeleteCmekConfig {
749 fn request_options(&mut self) -> &mut crate::RequestOptions {
750 &mut self.0.options
751 }
752 }
753
754 #[derive(Clone, Debug)]
775 pub struct ListOperations(
776 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
777 );
778
779 impl ListOperations {
780 pub(crate) fn new(
781 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
782 ) -> Self {
783 Self(RequestBuilder::new(stub))
784 }
785
786 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
788 mut self,
789 v: V,
790 ) -> Self {
791 self.0.request = v.into();
792 self
793 }
794
795 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
797 self.0.options = v.into();
798 self
799 }
800
801 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
803 (*self.0.stub)
804 .list_operations(self.0.request, self.0.options)
805 .await
806 .map(crate::Response::into_body)
807 }
808
809 pub fn by_page(
811 self,
812 ) -> impl google_cloud_gax::paginator::Paginator<
813 google_cloud_longrunning::model::ListOperationsResponse,
814 crate::Error,
815 > {
816 use std::clone::Clone;
817 let token = self.0.request.page_token.clone();
818 let execute = move |token: String| {
819 let mut builder = self.clone();
820 builder.0.request = builder.0.request.set_page_token(token);
821 builder.send()
822 };
823 google_cloud_gax::paginator::internal::new_paginator(token, execute)
824 }
825
826 pub fn by_item(
828 self,
829 ) -> impl google_cloud_gax::paginator::ItemPaginator<
830 google_cloud_longrunning::model::ListOperationsResponse,
831 crate::Error,
832 > {
833 use google_cloud_gax::paginator::Paginator;
834 self.by_page().items()
835 }
836
837 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
839 self.0.request.name = v.into();
840 self
841 }
842
843 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
845 self.0.request.filter = v.into();
846 self
847 }
848
849 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
851 self.0.request.page_size = v.into();
852 self
853 }
854
855 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
857 self.0.request.page_token = v.into();
858 self
859 }
860
861 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
863 self.0.request.return_partial_success = v.into();
864 self
865 }
866 }
867
868 #[doc(hidden)]
869 impl crate::RequestBuilder for ListOperations {
870 fn request_options(&mut self) -> &mut crate::RequestOptions {
871 &mut self.0.options
872 }
873 }
874
875 #[derive(Clone, Debug)]
892 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
893
894 impl GetOperation {
895 pub(crate) fn new(
896 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
897 ) -> Self {
898 Self(RequestBuilder::new(stub))
899 }
900
901 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
903 mut self,
904 v: V,
905 ) -> Self {
906 self.0.request = v.into();
907 self
908 }
909
910 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
912 self.0.options = v.into();
913 self
914 }
915
916 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
918 (*self.0.stub)
919 .get_operation(self.0.request, self.0.options)
920 .await
921 .map(crate::Response::into_body)
922 }
923
924 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
926 self.0.request.name = v.into();
927 self
928 }
929 }
930
931 #[doc(hidden)]
932 impl crate::RequestBuilder for GetOperation {
933 fn request_options(&mut self) -> &mut crate::RequestOptions {
934 &mut self.0.options
935 }
936 }
937
938 #[derive(Clone, Debug)]
955 pub struct CancelOperation(
956 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
957 );
958
959 impl CancelOperation {
960 pub(crate) fn new(
961 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
962 ) -> Self {
963 Self(RequestBuilder::new(stub))
964 }
965
966 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
968 mut self,
969 v: V,
970 ) -> Self {
971 self.0.request = v.into();
972 self
973 }
974
975 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
977 self.0.options = v.into();
978 self
979 }
980
981 pub async fn send(self) -> Result<()> {
983 (*self.0.stub)
984 .cancel_operation(self.0.request, self.0.options)
985 .await
986 .map(crate::Response::into_body)
987 }
988
989 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
991 self.0.request.name = v.into();
992 self
993 }
994 }
995
996 #[doc(hidden)]
997 impl crate::RequestBuilder for CancelOperation {
998 fn request_options(&mut self) -> &mut crate::RequestOptions {
999 &mut self.0.options
1000 }
1001 }
1002}
1003
1004#[cfg(feature = "completion-service")]
1006#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
1007pub mod completion_service {
1008 use crate::Result;
1009
1010 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1024
1025 pub(crate) mod client {
1026 use super::super::super::client::CompletionService;
1027 pub struct Factory;
1028 impl crate::ClientFactory for Factory {
1029 type Client = CompletionService;
1030 type Credentials = gaxi::options::Credentials;
1031 async fn build(
1032 self,
1033 config: gaxi::options::ClientConfig,
1034 ) -> crate::ClientBuilderResult<Self::Client> {
1035 Self::Client::new(config).await
1036 }
1037 }
1038 }
1039
1040 #[derive(Clone, Debug)]
1042 pub(crate) struct RequestBuilder<R: std::default::Default> {
1043 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1044 request: R,
1045 options: crate::RequestOptions,
1046 }
1047
1048 impl<R> RequestBuilder<R>
1049 where
1050 R: std::default::Default,
1051 {
1052 pub(crate) fn new(
1053 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1054 ) -> Self {
1055 Self {
1056 stub,
1057 request: R::default(),
1058 options: crate::RequestOptions::default(),
1059 }
1060 }
1061 }
1062
1063 #[derive(Clone, Debug)]
1080 pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1081
1082 impl CompleteQuery {
1083 pub(crate) fn new(
1084 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1085 ) -> Self {
1086 Self(RequestBuilder::new(stub))
1087 }
1088
1089 pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1091 self.0.request = v.into();
1092 self
1093 }
1094
1095 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1097 self.0.options = v.into();
1098 self
1099 }
1100
1101 pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1103 (*self.0.stub)
1104 .complete_query(self.0.request, self.0.options)
1105 .await
1106 .map(crate::Response::into_body)
1107 }
1108
1109 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1113 self.0.request.data_store = v.into();
1114 self
1115 }
1116
1117 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1121 self.0.request.query = v.into();
1122 self
1123 }
1124
1125 pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1127 self.0.request.query_model = v.into();
1128 self
1129 }
1130
1131 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1133 self.0.request.user_pseudo_id = v.into();
1134 self
1135 }
1136
1137 pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1139 self.0.request.include_tail_suggestions = v.into();
1140 self
1141 }
1142 }
1143
1144 #[doc(hidden)]
1145 impl crate::RequestBuilder for CompleteQuery {
1146 fn request_options(&mut self) -> &mut crate::RequestOptions {
1147 &mut self.0.options
1148 }
1149 }
1150
1151 #[derive(Clone, Debug)]
1169 pub struct ImportSuggestionDenyListEntries(
1170 RequestBuilder<crate::model::ImportSuggestionDenyListEntriesRequest>,
1171 );
1172
1173 impl ImportSuggestionDenyListEntries {
1174 pub(crate) fn new(
1175 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1176 ) -> Self {
1177 Self(RequestBuilder::new(stub))
1178 }
1179
1180 pub fn with_request<V: Into<crate::model::ImportSuggestionDenyListEntriesRequest>>(
1182 mut self,
1183 v: V,
1184 ) -> Self {
1185 self.0.request = v.into();
1186 self
1187 }
1188
1189 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1191 self.0.options = v.into();
1192 self
1193 }
1194
1195 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1202 (*self.0.stub)
1203 .import_suggestion_deny_list_entries(self.0.request, self.0.options)
1204 .await
1205 .map(crate::Response::into_body)
1206 }
1207
1208 pub fn poller(
1210 self,
1211 ) -> impl google_cloud_lro::Poller<
1212 crate::model::ImportSuggestionDenyListEntriesResponse,
1213 crate::model::ImportSuggestionDenyListEntriesMetadata,
1214 > {
1215 type Operation = google_cloud_lro::internal::Operation<
1216 crate::model::ImportSuggestionDenyListEntriesResponse,
1217 crate::model::ImportSuggestionDenyListEntriesMetadata,
1218 >;
1219 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1220 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1221
1222 let stub = self.0.stub.clone();
1223 let mut options = self.0.options.clone();
1224 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1225 let query = move |name| {
1226 let stub = stub.clone();
1227 let options = options.clone();
1228 async {
1229 let op = GetOperation::new(stub)
1230 .set_name(name)
1231 .with_options(options)
1232 .send()
1233 .await?;
1234 Ok(Operation::new(op))
1235 }
1236 };
1237
1238 let start = move || async {
1239 let op = self.send().await?;
1240 Ok(Operation::new(op))
1241 };
1242
1243 google_cloud_lro::internal::new_poller(
1244 polling_error_policy,
1245 polling_backoff_policy,
1246 start,
1247 query,
1248 )
1249 }
1250
1251 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1255 self.0.request.parent = v.into();
1256 self
1257 }
1258
1259 pub fn set_source<
1264 T: Into<Option<crate::model::import_suggestion_deny_list_entries_request::Source>>,
1265 >(
1266 mut self,
1267 v: T,
1268 ) -> Self {
1269 self.0.request.source = v.into();
1270 self
1271 }
1272
1273 pub fn set_inline_source<
1279 T: std::convert::Into<
1280 std::boxed::Box<
1281 crate::model::import_suggestion_deny_list_entries_request::InlineSource,
1282 >,
1283 >,
1284 >(
1285 mut self,
1286 v: T,
1287 ) -> Self {
1288 self.0.request = self.0.request.set_inline_source(v);
1289 self
1290 }
1291
1292 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1298 mut self,
1299 v: T,
1300 ) -> Self {
1301 self.0.request = self.0.request.set_gcs_source(v);
1302 self
1303 }
1304 }
1305
1306 #[doc(hidden)]
1307 impl crate::RequestBuilder for ImportSuggestionDenyListEntries {
1308 fn request_options(&mut self) -> &mut crate::RequestOptions {
1309 &mut self.0.options
1310 }
1311 }
1312
1313 #[derive(Clone, Debug)]
1331 pub struct PurgeSuggestionDenyListEntries(
1332 RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1333 );
1334
1335 impl PurgeSuggestionDenyListEntries {
1336 pub(crate) fn new(
1337 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1338 ) -> Self {
1339 Self(RequestBuilder::new(stub))
1340 }
1341
1342 pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1344 mut self,
1345 v: V,
1346 ) -> Self {
1347 self.0.request = v.into();
1348 self
1349 }
1350
1351 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1353 self.0.options = v.into();
1354 self
1355 }
1356
1357 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1364 (*self.0.stub)
1365 .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1366 .await
1367 .map(crate::Response::into_body)
1368 }
1369
1370 pub fn poller(
1372 self,
1373 ) -> impl google_cloud_lro::Poller<
1374 crate::model::PurgeSuggestionDenyListEntriesResponse,
1375 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1376 > {
1377 type Operation = google_cloud_lro::internal::Operation<
1378 crate::model::PurgeSuggestionDenyListEntriesResponse,
1379 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1380 >;
1381 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1382 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1383
1384 let stub = self.0.stub.clone();
1385 let mut options = self.0.options.clone();
1386 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1387 let query = move |name| {
1388 let stub = stub.clone();
1389 let options = options.clone();
1390 async {
1391 let op = GetOperation::new(stub)
1392 .set_name(name)
1393 .with_options(options)
1394 .send()
1395 .await?;
1396 Ok(Operation::new(op))
1397 }
1398 };
1399
1400 let start = move || async {
1401 let op = self.send().await?;
1402 Ok(Operation::new(op))
1403 };
1404
1405 google_cloud_lro::internal::new_poller(
1406 polling_error_policy,
1407 polling_backoff_policy,
1408 start,
1409 query,
1410 )
1411 }
1412
1413 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1417 self.0.request.parent = v.into();
1418 self
1419 }
1420 }
1421
1422 #[doc(hidden)]
1423 impl crate::RequestBuilder for PurgeSuggestionDenyListEntries {
1424 fn request_options(&mut self) -> &mut crate::RequestOptions {
1425 &mut self.0.options
1426 }
1427 }
1428
1429 #[derive(Clone, Debug)]
1447 pub struct ImportCompletionSuggestions(
1448 RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1449 );
1450
1451 impl ImportCompletionSuggestions {
1452 pub(crate) fn new(
1453 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1454 ) -> Self {
1455 Self(RequestBuilder::new(stub))
1456 }
1457
1458 pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1460 mut self,
1461 v: V,
1462 ) -> Self {
1463 self.0.request = v.into();
1464 self
1465 }
1466
1467 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1469 self.0.options = v.into();
1470 self
1471 }
1472
1473 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1480 (*self.0.stub)
1481 .import_completion_suggestions(self.0.request, self.0.options)
1482 .await
1483 .map(crate::Response::into_body)
1484 }
1485
1486 pub fn poller(
1488 self,
1489 ) -> impl google_cloud_lro::Poller<
1490 crate::model::ImportCompletionSuggestionsResponse,
1491 crate::model::ImportCompletionSuggestionsMetadata,
1492 > {
1493 type Operation = google_cloud_lro::internal::Operation<
1494 crate::model::ImportCompletionSuggestionsResponse,
1495 crate::model::ImportCompletionSuggestionsMetadata,
1496 >;
1497 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1498 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1499
1500 let stub = self.0.stub.clone();
1501 let mut options = self.0.options.clone();
1502 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1503 let query = move |name| {
1504 let stub = stub.clone();
1505 let options = options.clone();
1506 async {
1507 let op = GetOperation::new(stub)
1508 .set_name(name)
1509 .with_options(options)
1510 .send()
1511 .await?;
1512 Ok(Operation::new(op))
1513 }
1514 };
1515
1516 let start = move || async {
1517 let op = self.send().await?;
1518 Ok(Operation::new(op))
1519 };
1520
1521 google_cloud_lro::internal::new_poller(
1522 polling_error_policy,
1523 polling_backoff_policy,
1524 start,
1525 query,
1526 )
1527 }
1528
1529 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1533 self.0.request.parent = v.into();
1534 self
1535 }
1536
1537 pub fn set_error_config<T>(mut self, v: T) -> Self
1539 where
1540 T: std::convert::Into<crate::model::ImportErrorConfig>,
1541 {
1542 self.0.request.error_config = std::option::Option::Some(v.into());
1543 self
1544 }
1545
1546 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1548 where
1549 T: std::convert::Into<crate::model::ImportErrorConfig>,
1550 {
1551 self.0.request.error_config = v.map(|x| x.into());
1552 self
1553 }
1554
1555 pub fn set_source<
1560 T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1561 >(
1562 mut self,
1563 v: T,
1564 ) -> Self {
1565 self.0.request.source = v.into();
1566 self
1567 }
1568
1569 pub fn set_inline_source<
1575 T: std::convert::Into<
1576 std::boxed::Box<
1577 crate::model::import_completion_suggestions_request::InlineSource,
1578 >,
1579 >,
1580 >(
1581 mut self,
1582 v: T,
1583 ) -> Self {
1584 self.0.request = self.0.request.set_inline_source(v);
1585 self
1586 }
1587
1588 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1594 mut self,
1595 v: T,
1596 ) -> Self {
1597 self.0.request = self.0.request.set_gcs_source(v);
1598 self
1599 }
1600
1601 pub fn set_bigquery_source<
1607 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1608 >(
1609 mut self,
1610 v: T,
1611 ) -> Self {
1612 self.0.request = self.0.request.set_bigquery_source(v);
1613 self
1614 }
1615 }
1616
1617 #[doc(hidden)]
1618 impl crate::RequestBuilder for ImportCompletionSuggestions {
1619 fn request_options(&mut self) -> &mut crate::RequestOptions {
1620 &mut self.0.options
1621 }
1622 }
1623
1624 #[derive(Clone, Debug)]
1642 pub struct PurgeCompletionSuggestions(
1643 RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1644 );
1645
1646 impl PurgeCompletionSuggestions {
1647 pub(crate) fn new(
1648 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1649 ) -> Self {
1650 Self(RequestBuilder::new(stub))
1651 }
1652
1653 pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1655 mut self,
1656 v: V,
1657 ) -> Self {
1658 self.0.request = v.into();
1659 self
1660 }
1661
1662 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1664 self.0.options = v.into();
1665 self
1666 }
1667
1668 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1675 (*self.0.stub)
1676 .purge_completion_suggestions(self.0.request, self.0.options)
1677 .await
1678 .map(crate::Response::into_body)
1679 }
1680
1681 pub fn poller(
1683 self,
1684 ) -> impl google_cloud_lro::Poller<
1685 crate::model::PurgeCompletionSuggestionsResponse,
1686 crate::model::PurgeCompletionSuggestionsMetadata,
1687 > {
1688 type Operation = google_cloud_lro::internal::Operation<
1689 crate::model::PurgeCompletionSuggestionsResponse,
1690 crate::model::PurgeCompletionSuggestionsMetadata,
1691 >;
1692 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1693 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1694
1695 let stub = self.0.stub.clone();
1696 let mut options = self.0.options.clone();
1697 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
1698 let query = move |name| {
1699 let stub = stub.clone();
1700 let options = options.clone();
1701 async {
1702 let op = GetOperation::new(stub)
1703 .set_name(name)
1704 .with_options(options)
1705 .send()
1706 .await?;
1707 Ok(Operation::new(op))
1708 }
1709 };
1710
1711 let start = move || async {
1712 let op = self.send().await?;
1713 Ok(Operation::new(op))
1714 };
1715
1716 google_cloud_lro::internal::new_poller(
1717 polling_error_policy,
1718 polling_backoff_policy,
1719 start,
1720 query,
1721 )
1722 }
1723
1724 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1728 self.0.request.parent = v.into();
1729 self
1730 }
1731 }
1732
1733 #[doc(hidden)]
1734 impl crate::RequestBuilder for PurgeCompletionSuggestions {
1735 fn request_options(&mut self) -> &mut crate::RequestOptions {
1736 &mut self.0.options
1737 }
1738 }
1739
1740 #[derive(Clone, Debug)]
1761 pub struct ListOperations(
1762 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1763 );
1764
1765 impl ListOperations {
1766 pub(crate) fn new(
1767 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1768 ) -> Self {
1769 Self(RequestBuilder::new(stub))
1770 }
1771
1772 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1774 mut self,
1775 v: V,
1776 ) -> Self {
1777 self.0.request = v.into();
1778 self
1779 }
1780
1781 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1783 self.0.options = v.into();
1784 self
1785 }
1786
1787 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1789 (*self.0.stub)
1790 .list_operations(self.0.request, self.0.options)
1791 .await
1792 .map(crate::Response::into_body)
1793 }
1794
1795 pub fn by_page(
1797 self,
1798 ) -> impl google_cloud_gax::paginator::Paginator<
1799 google_cloud_longrunning::model::ListOperationsResponse,
1800 crate::Error,
1801 > {
1802 use std::clone::Clone;
1803 let token = self.0.request.page_token.clone();
1804 let execute = move |token: String| {
1805 let mut builder = self.clone();
1806 builder.0.request = builder.0.request.set_page_token(token);
1807 builder.send()
1808 };
1809 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1810 }
1811
1812 pub fn by_item(
1814 self,
1815 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1816 google_cloud_longrunning::model::ListOperationsResponse,
1817 crate::Error,
1818 > {
1819 use google_cloud_gax::paginator::Paginator;
1820 self.by_page().items()
1821 }
1822
1823 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1825 self.0.request.name = v.into();
1826 self
1827 }
1828
1829 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1831 self.0.request.filter = v.into();
1832 self
1833 }
1834
1835 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1837 self.0.request.page_size = v.into();
1838 self
1839 }
1840
1841 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1843 self.0.request.page_token = v.into();
1844 self
1845 }
1846
1847 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1849 self.0.request.return_partial_success = v.into();
1850 self
1851 }
1852 }
1853
1854 #[doc(hidden)]
1855 impl crate::RequestBuilder for ListOperations {
1856 fn request_options(&mut self) -> &mut crate::RequestOptions {
1857 &mut self.0.options
1858 }
1859 }
1860
1861 #[derive(Clone, Debug)]
1878 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1879
1880 impl GetOperation {
1881 pub(crate) fn new(
1882 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1883 ) -> Self {
1884 Self(RequestBuilder::new(stub))
1885 }
1886
1887 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1889 mut self,
1890 v: V,
1891 ) -> Self {
1892 self.0.request = v.into();
1893 self
1894 }
1895
1896 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1898 self.0.options = v.into();
1899 self
1900 }
1901
1902 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1904 (*self.0.stub)
1905 .get_operation(self.0.request, self.0.options)
1906 .await
1907 .map(crate::Response::into_body)
1908 }
1909
1910 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1912 self.0.request.name = v.into();
1913 self
1914 }
1915 }
1916
1917 #[doc(hidden)]
1918 impl crate::RequestBuilder for GetOperation {
1919 fn request_options(&mut self) -> &mut crate::RequestOptions {
1920 &mut self.0.options
1921 }
1922 }
1923
1924 #[derive(Clone, Debug)]
1941 pub struct CancelOperation(
1942 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1943 );
1944
1945 impl CancelOperation {
1946 pub(crate) fn new(
1947 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1948 ) -> Self {
1949 Self(RequestBuilder::new(stub))
1950 }
1951
1952 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1954 mut self,
1955 v: V,
1956 ) -> Self {
1957 self.0.request = v.into();
1958 self
1959 }
1960
1961 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1963 self.0.options = v.into();
1964 self
1965 }
1966
1967 pub async fn send(self) -> Result<()> {
1969 (*self.0.stub)
1970 .cancel_operation(self.0.request, self.0.options)
1971 .await
1972 .map(crate::Response::into_body)
1973 }
1974
1975 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1977 self.0.request.name = v.into();
1978 self
1979 }
1980 }
1981
1982 #[doc(hidden)]
1983 impl crate::RequestBuilder for CancelOperation {
1984 fn request_options(&mut self) -> &mut crate::RequestOptions {
1985 &mut self.0.options
1986 }
1987 }
1988}
1989
1990#[cfg(feature = "control-service")]
1992#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
1993pub mod control_service {
1994 use crate::Result;
1995
1996 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2010
2011 pub(crate) mod client {
2012 use super::super::super::client::ControlService;
2013 pub struct Factory;
2014 impl crate::ClientFactory for Factory {
2015 type Client = ControlService;
2016 type Credentials = gaxi::options::Credentials;
2017 async fn build(
2018 self,
2019 config: gaxi::options::ClientConfig,
2020 ) -> crate::ClientBuilderResult<Self::Client> {
2021 Self::Client::new(config).await
2022 }
2023 }
2024 }
2025
2026 #[derive(Clone, Debug)]
2028 pub(crate) struct RequestBuilder<R: std::default::Default> {
2029 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2030 request: R,
2031 options: crate::RequestOptions,
2032 }
2033
2034 impl<R> RequestBuilder<R>
2035 where
2036 R: std::default::Default,
2037 {
2038 pub(crate) fn new(
2039 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2040 ) -> Self {
2041 Self {
2042 stub,
2043 request: R::default(),
2044 options: crate::RequestOptions::default(),
2045 }
2046 }
2047 }
2048
2049 #[derive(Clone, Debug)]
2066 pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2067
2068 impl CreateControl {
2069 pub(crate) fn new(
2070 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2071 ) -> Self {
2072 Self(RequestBuilder::new(stub))
2073 }
2074
2075 pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2077 self.0.request = v.into();
2078 self
2079 }
2080
2081 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2083 self.0.options = v.into();
2084 self
2085 }
2086
2087 pub async fn send(self) -> Result<crate::model::Control> {
2089 (*self.0.stub)
2090 .create_control(self.0.request, self.0.options)
2091 .await
2092 .map(crate::Response::into_body)
2093 }
2094
2095 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2099 self.0.request.parent = v.into();
2100 self
2101 }
2102
2103 pub fn set_control<T>(mut self, v: T) -> Self
2107 where
2108 T: std::convert::Into<crate::model::Control>,
2109 {
2110 self.0.request.control = std::option::Option::Some(v.into());
2111 self
2112 }
2113
2114 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2118 where
2119 T: std::convert::Into<crate::model::Control>,
2120 {
2121 self.0.request.control = v.map(|x| x.into());
2122 self
2123 }
2124
2125 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2129 self.0.request.control_id = v.into();
2130 self
2131 }
2132 }
2133
2134 #[doc(hidden)]
2135 impl crate::RequestBuilder for CreateControl {
2136 fn request_options(&mut self) -> &mut crate::RequestOptions {
2137 &mut self.0.options
2138 }
2139 }
2140
2141 #[derive(Clone, Debug)]
2158 pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2159
2160 impl DeleteControl {
2161 pub(crate) fn new(
2162 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2163 ) -> Self {
2164 Self(RequestBuilder::new(stub))
2165 }
2166
2167 pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2169 self.0.request = v.into();
2170 self
2171 }
2172
2173 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2175 self.0.options = v.into();
2176 self
2177 }
2178
2179 pub async fn send(self) -> Result<()> {
2181 (*self.0.stub)
2182 .delete_control(self.0.request, self.0.options)
2183 .await
2184 .map(crate::Response::into_body)
2185 }
2186
2187 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2191 self.0.request.name = v.into();
2192 self
2193 }
2194 }
2195
2196 #[doc(hidden)]
2197 impl crate::RequestBuilder for DeleteControl {
2198 fn request_options(&mut self) -> &mut crate::RequestOptions {
2199 &mut self.0.options
2200 }
2201 }
2202
2203 #[derive(Clone, Debug)]
2220 pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2221
2222 impl UpdateControl {
2223 pub(crate) fn new(
2224 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2225 ) -> Self {
2226 Self(RequestBuilder::new(stub))
2227 }
2228
2229 pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2231 self.0.request = v.into();
2232 self
2233 }
2234
2235 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2237 self.0.options = v.into();
2238 self
2239 }
2240
2241 pub async fn send(self) -> Result<crate::model::Control> {
2243 (*self.0.stub)
2244 .update_control(self.0.request, self.0.options)
2245 .await
2246 .map(crate::Response::into_body)
2247 }
2248
2249 pub fn set_control<T>(mut self, v: T) -> Self
2253 where
2254 T: std::convert::Into<crate::model::Control>,
2255 {
2256 self.0.request.control = std::option::Option::Some(v.into());
2257 self
2258 }
2259
2260 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2264 where
2265 T: std::convert::Into<crate::model::Control>,
2266 {
2267 self.0.request.control = v.map(|x| x.into());
2268 self
2269 }
2270
2271 pub fn set_update_mask<T>(mut self, v: T) -> Self
2273 where
2274 T: std::convert::Into<wkt::FieldMask>,
2275 {
2276 self.0.request.update_mask = std::option::Option::Some(v.into());
2277 self
2278 }
2279
2280 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2282 where
2283 T: std::convert::Into<wkt::FieldMask>,
2284 {
2285 self.0.request.update_mask = v.map(|x| x.into());
2286 self
2287 }
2288 }
2289
2290 #[doc(hidden)]
2291 impl crate::RequestBuilder for UpdateControl {
2292 fn request_options(&mut self) -> &mut crate::RequestOptions {
2293 &mut self.0.options
2294 }
2295 }
2296
2297 #[derive(Clone, Debug)]
2314 pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2315
2316 impl GetControl {
2317 pub(crate) fn new(
2318 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2319 ) -> Self {
2320 Self(RequestBuilder::new(stub))
2321 }
2322
2323 pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2325 self.0.request = v.into();
2326 self
2327 }
2328
2329 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2331 self.0.options = v.into();
2332 self
2333 }
2334
2335 pub async fn send(self) -> Result<crate::model::Control> {
2337 (*self.0.stub)
2338 .get_control(self.0.request, self.0.options)
2339 .await
2340 .map(crate::Response::into_body)
2341 }
2342
2343 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2347 self.0.request.name = v.into();
2348 self
2349 }
2350 }
2351
2352 #[doc(hidden)]
2353 impl crate::RequestBuilder for GetControl {
2354 fn request_options(&mut self) -> &mut crate::RequestOptions {
2355 &mut self.0.options
2356 }
2357 }
2358
2359 #[derive(Clone, Debug)]
2380 pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2381
2382 impl ListControls {
2383 pub(crate) fn new(
2384 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2385 ) -> Self {
2386 Self(RequestBuilder::new(stub))
2387 }
2388
2389 pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2391 self.0.request = v.into();
2392 self
2393 }
2394
2395 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2397 self.0.options = v.into();
2398 self
2399 }
2400
2401 pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2403 (*self.0.stub)
2404 .list_controls(self.0.request, self.0.options)
2405 .await
2406 .map(crate::Response::into_body)
2407 }
2408
2409 pub fn by_page(
2411 self,
2412 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListControlsResponse, crate::Error>
2413 {
2414 use std::clone::Clone;
2415 let token = self.0.request.page_token.clone();
2416 let execute = move |token: String| {
2417 let mut builder = self.clone();
2418 builder.0.request = builder.0.request.set_page_token(token);
2419 builder.send()
2420 };
2421 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2422 }
2423
2424 pub fn by_item(
2426 self,
2427 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2428 crate::model::ListControlsResponse,
2429 crate::Error,
2430 > {
2431 use google_cloud_gax::paginator::Paginator;
2432 self.by_page().items()
2433 }
2434
2435 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2439 self.0.request.parent = v.into();
2440 self
2441 }
2442
2443 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2445 self.0.request.page_size = v.into();
2446 self
2447 }
2448
2449 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2451 self.0.request.page_token = v.into();
2452 self
2453 }
2454
2455 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2457 self.0.request.filter = v.into();
2458 self
2459 }
2460 }
2461
2462 #[doc(hidden)]
2463 impl crate::RequestBuilder for ListControls {
2464 fn request_options(&mut self) -> &mut crate::RequestOptions {
2465 &mut self.0.options
2466 }
2467 }
2468
2469 #[derive(Clone, Debug)]
2490 pub struct ListOperations(
2491 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2492 );
2493
2494 impl ListOperations {
2495 pub(crate) fn new(
2496 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2497 ) -> Self {
2498 Self(RequestBuilder::new(stub))
2499 }
2500
2501 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2503 mut self,
2504 v: V,
2505 ) -> Self {
2506 self.0.request = v.into();
2507 self
2508 }
2509
2510 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2512 self.0.options = v.into();
2513 self
2514 }
2515
2516 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2518 (*self.0.stub)
2519 .list_operations(self.0.request, self.0.options)
2520 .await
2521 .map(crate::Response::into_body)
2522 }
2523
2524 pub fn by_page(
2526 self,
2527 ) -> impl google_cloud_gax::paginator::Paginator<
2528 google_cloud_longrunning::model::ListOperationsResponse,
2529 crate::Error,
2530 > {
2531 use std::clone::Clone;
2532 let token = self.0.request.page_token.clone();
2533 let execute = move |token: String| {
2534 let mut builder = self.clone();
2535 builder.0.request = builder.0.request.set_page_token(token);
2536 builder.send()
2537 };
2538 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2539 }
2540
2541 pub fn by_item(
2543 self,
2544 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2545 google_cloud_longrunning::model::ListOperationsResponse,
2546 crate::Error,
2547 > {
2548 use google_cloud_gax::paginator::Paginator;
2549 self.by_page().items()
2550 }
2551
2552 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2554 self.0.request.name = v.into();
2555 self
2556 }
2557
2558 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2560 self.0.request.filter = v.into();
2561 self
2562 }
2563
2564 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2566 self.0.request.page_size = v.into();
2567 self
2568 }
2569
2570 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2572 self.0.request.page_token = v.into();
2573 self
2574 }
2575
2576 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2578 self.0.request.return_partial_success = v.into();
2579 self
2580 }
2581 }
2582
2583 #[doc(hidden)]
2584 impl crate::RequestBuilder for ListOperations {
2585 fn request_options(&mut self) -> &mut crate::RequestOptions {
2586 &mut self.0.options
2587 }
2588 }
2589
2590 #[derive(Clone, Debug)]
2607 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2608
2609 impl GetOperation {
2610 pub(crate) fn new(
2611 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2612 ) -> Self {
2613 Self(RequestBuilder::new(stub))
2614 }
2615
2616 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2618 mut self,
2619 v: V,
2620 ) -> Self {
2621 self.0.request = v.into();
2622 self
2623 }
2624
2625 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2627 self.0.options = v.into();
2628 self
2629 }
2630
2631 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2633 (*self.0.stub)
2634 .get_operation(self.0.request, self.0.options)
2635 .await
2636 .map(crate::Response::into_body)
2637 }
2638
2639 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2641 self.0.request.name = v.into();
2642 self
2643 }
2644 }
2645
2646 #[doc(hidden)]
2647 impl crate::RequestBuilder for GetOperation {
2648 fn request_options(&mut self) -> &mut crate::RequestOptions {
2649 &mut self.0.options
2650 }
2651 }
2652
2653 #[derive(Clone, Debug)]
2670 pub struct CancelOperation(
2671 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2672 );
2673
2674 impl CancelOperation {
2675 pub(crate) fn new(
2676 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2677 ) -> Self {
2678 Self(RequestBuilder::new(stub))
2679 }
2680
2681 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2683 mut self,
2684 v: V,
2685 ) -> Self {
2686 self.0.request = v.into();
2687 self
2688 }
2689
2690 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2692 self.0.options = v.into();
2693 self
2694 }
2695
2696 pub async fn send(self) -> Result<()> {
2698 (*self.0.stub)
2699 .cancel_operation(self.0.request, self.0.options)
2700 .await
2701 .map(crate::Response::into_body)
2702 }
2703
2704 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2706 self.0.request.name = v.into();
2707 self
2708 }
2709 }
2710
2711 #[doc(hidden)]
2712 impl crate::RequestBuilder for CancelOperation {
2713 fn request_options(&mut self) -> &mut crate::RequestOptions {
2714 &mut self.0.options
2715 }
2716 }
2717}
2718
2719#[cfg(feature = "conversational-search-service")]
2721#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2722pub mod conversational_search_service {
2723 use crate::Result;
2724
2725 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2739
2740 pub(crate) mod client {
2741 use super::super::super::client::ConversationalSearchService;
2742 pub struct Factory;
2743 impl crate::ClientFactory for Factory {
2744 type Client = ConversationalSearchService;
2745 type Credentials = gaxi::options::Credentials;
2746 async fn build(
2747 self,
2748 config: gaxi::options::ClientConfig,
2749 ) -> crate::ClientBuilderResult<Self::Client> {
2750 Self::Client::new(config).await
2751 }
2752 }
2753 }
2754
2755 #[derive(Clone, Debug)]
2757 pub(crate) struct RequestBuilder<R: std::default::Default> {
2758 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2759 request: R,
2760 options: crate::RequestOptions,
2761 }
2762
2763 impl<R> RequestBuilder<R>
2764 where
2765 R: std::default::Default,
2766 {
2767 pub(crate) fn new(
2768 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2769 ) -> Self {
2770 Self {
2771 stub,
2772 request: R::default(),
2773 options: crate::RequestOptions::default(),
2774 }
2775 }
2776 }
2777
2778 #[derive(Clone, Debug)]
2795 pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
2796
2797 impl ConverseConversation {
2798 pub(crate) fn new(
2799 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2800 ) -> Self {
2801 Self(RequestBuilder::new(stub))
2802 }
2803
2804 pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
2806 mut self,
2807 v: V,
2808 ) -> Self {
2809 self.0.request = v.into();
2810 self
2811 }
2812
2813 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2815 self.0.options = v.into();
2816 self
2817 }
2818
2819 pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
2821 (*self.0.stub)
2822 .converse_conversation(self.0.request, self.0.options)
2823 .await
2824 .map(crate::Response::into_body)
2825 }
2826
2827 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2831 self.0.request.name = v.into();
2832 self
2833 }
2834
2835 pub fn set_query<T>(mut self, v: T) -> Self
2839 where
2840 T: std::convert::Into<crate::model::TextInput>,
2841 {
2842 self.0.request.query = std::option::Option::Some(v.into());
2843 self
2844 }
2845
2846 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
2850 where
2851 T: std::convert::Into<crate::model::TextInput>,
2852 {
2853 self.0.request.query = v.map(|x| x.into());
2854 self
2855 }
2856
2857 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2859 self.0.request.serving_config = v.into();
2860 self
2861 }
2862
2863 pub fn set_conversation<T>(mut self, v: T) -> Self
2865 where
2866 T: std::convert::Into<crate::model::Conversation>,
2867 {
2868 self.0.request.conversation = std::option::Option::Some(v.into());
2869 self
2870 }
2871
2872 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2874 where
2875 T: std::convert::Into<crate::model::Conversation>,
2876 {
2877 self.0.request.conversation = v.map(|x| x.into());
2878 self
2879 }
2880
2881 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
2883 self.0.request.safe_search = v.into();
2884 self
2885 }
2886
2887 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
2889 where
2890 T: std::iter::IntoIterator<Item = (K, V)>,
2891 K: std::convert::Into<std::string::String>,
2892 V: std::convert::Into<std::string::String>,
2893 {
2894 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2895 self
2896 }
2897
2898 pub fn set_summary_spec<T>(mut self, v: T) -> Self
2900 where
2901 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2902 {
2903 self.0.request.summary_spec = std::option::Option::Some(v.into());
2904 self
2905 }
2906
2907 pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
2909 where
2910 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2911 {
2912 self.0.request.summary_spec = v.map(|x| x.into());
2913 self
2914 }
2915
2916 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2918 self.0.request.filter = v.into();
2919 self
2920 }
2921
2922 pub fn set_boost_spec<T>(mut self, v: T) -> Self
2924 where
2925 T: std::convert::Into<crate::model::search_request::BoostSpec>,
2926 {
2927 self.0.request.boost_spec = std::option::Option::Some(v.into());
2928 self
2929 }
2930
2931 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
2933 where
2934 T: std::convert::Into<crate::model::search_request::BoostSpec>,
2935 {
2936 self.0.request.boost_spec = v.map(|x| x.into());
2937 self
2938 }
2939 }
2940
2941 #[doc(hidden)]
2942 impl crate::RequestBuilder for ConverseConversation {
2943 fn request_options(&mut self) -> &mut crate::RequestOptions {
2944 &mut self.0.options
2945 }
2946 }
2947
2948 #[derive(Clone, Debug)]
2965 pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
2966
2967 impl CreateConversation {
2968 pub(crate) fn new(
2969 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2970 ) -> Self {
2971 Self(RequestBuilder::new(stub))
2972 }
2973
2974 pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
2976 mut self,
2977 v: V,
2978 ) -> Self {
2979 self.0.request = v.into();
2980 self
2981 }
2982
2983 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2985 self.0.options = v.into();
2986 self
2987 }
2988
2989 pub async fn send(self) -> Result<crate::model::Conversation> {
2991 (*self.0.stub)
2992 .create_conversation(self.0.request, self.0.options)
2993 .await
2994 .map(crate::Response::into_body)
2995 }
2996
2997 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3001 self.0.request.parent = v.into();
3002 self
3003 }
3004
3005 pub fn set_conversation<T>(mut self, v: T) -> Self
3009 where
3010 T: std::convert::Into<crate::model::Conversation>,
3011 {
3012 self.0.request.conversation = std::option::Option::Some(v.into());
3013 self
3014 }
3015
3016 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3020 where
3021 T: std::convert::Into<crate::model::Conversation>,
3022 {
3023 self.0.request.conversation = v.map(|x| x.into());
3024 self
3025 }
3026 }
3027
3028 #[doc(hidden)]
3029 impl crate::RequestBuilder for CreateConversation {
3030 fn request_options(&mut self) -> &mut crate::RequestOptions {
3031 &mut self.0.options
3032 }
3033 }
3034
3035 #[derive(Clone, Debug)]
3052 pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
3053
3054 impl DeleteConversation {
3055 pub(crate) fn new(
3056 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3057 ) -> Self {
3058 Self(RequestBuilder::new(stub))
3059 }
3060
3061 pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3063 mut self,
3064 v: V,
3065 ) -> Self {
3066 self.0.request = v.into();
3067 self
3068 }
3069
3070 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3072 self.0.options = v.into();
3073 self
3074 }
3075
3076 pub async fn send(self) -> Result<()> {
3078 (*self.0.stub)
3079 .delete_conversation(self.0.request, self.0.options)
3080 .await
3081 .map(crate::Response::into_body)
3082 }
3083
3084 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3088 self.0.request.name = v.into();
3089 self
3090 }
3091 }
3092
3093 #[doc(hidden)]
3094 impl crate::RequestBuilder for DeleteConversation {
3095 fn request_options(&mut self) -> &mut crate::RequestOptions {
3096 &mut self.0.options
3097 }
3098 }
3099
3100 #[derive(Clone, Debug)]
3117 pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3118
3119 impl UpdateConversation {
3120 pub(crate) fn new(
3121 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3122 ) -> Self {
3123 Self(RequestBuilder::new(stub))
3124 }
3125
3126 pub fn with_request<V: Into<crate::model::UpdateConversationRequest>>(
3128 mut self,
3129 v: V,
3130 ) -> Self {
3131 self.0.request = v.into();
3132 self
3133 }
3134
3135 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3137 self.0.options = v.into();
3138 self
3139 }
3140
3141 pub async fn send(self) -> Result<crate::model::Conversation> {
3143 (*self.0.stub)
3144 .update_conversation(self.0.request, self.0.options)
3145 .await
3146 .map(crate::Response::into_body)
3147 }
3148
3149 pub fn set_conversation<T>(mut self, v: T) -> Self
3153 where
3154 T: std::convert::Into<crate::model::Conversation>,
3155 {
3156 self.0.request.conversation = std::option::Option::Some(v.into());
3157 self
3158 }
3159
3160 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3164 where
3165 T: std::convert::Into<crate::model::Conversation>,
3166 {
3167 self.0.request.conversation = v.map(|x| x.into());
3168 self
3169 }
3170
3171 pub fn set_update_mask<T>(mut self, v: T) -> Self
3173 where
3174 T: std::convert::Into<wkt::FieldMask>,
3175 {
3176 self.0.request.update_mask = std::option::Option::Some(v.into());
3177 self
3178 }
3179
3180 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3182 where
3183 T: std::convert::Into<wkt::FieldMask>,
3184 {
3185 self.0.request.update_mask = v.map(|x| x.into());
3186 self
3187 }
3188 }
3189
3190 #[doc(hidden)]
3191 impl crate::RequestBuilder for UpdateConversation {
3192 fn request_options(&mut self) -> &mut crate::RequestOptions {
3193 &mut self.0.options
3194 }
3195 }
3196
3197 #[derive(Clone, Debug)]
3214 pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3215
3216 impl GetConversation {
3217 pub(crate) fn new(
3218 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3219 ) -> Self {
3220 Self(RequestBuilder::new(stub))
3221 }
3222
3223 pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3225 self.0.request = v.into();
3226 self
3227 }
3228
3229 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3231 self.0.options = v.into();
3232 self
3233 }
3234
3235 pub async fn send(self) -> Result<crate::model::Conversation> {
3237 (*self.0.stub)
3238 .get_conversation(self.0.request, self.0.options)
3239 .await
3240 .map(crate::Response::into_body)
3241 }
3242
3243 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3247 self.0.request.name = v.into();
3248 self
3249 }
3250 }
3251
3252 #[doc(hidden)]
3253 impl crate::RequestBuilder for GetConversation {
3254 fn request_options(&mut self) -> &mut crate::RequestOptions {
3255 &mut self.0.options
3256 }
3257 }
3258
3259 #[derive(Clone, Debug)]
3280 pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3281
3282 impl ListConversations {
3283 pub(crate) fn new(
3284 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3285 ) -> Self {
3286 Self(RequestBuilder::new(stub))
3287 }
3288
3289 pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3291 mut self,
3292 v: V,
3293 ) -> Self {
3294 self.0.request = v.into();
3295 self
3296 }
3297
3298 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3300 self.0.options = v.into();
3301 self
3302 }
3303
3304 pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3306 (*self.0.stub)
3307 .list_conversations(self.0.request, self.0.options)
3308 .await
3309 .map(crate::Response::into_body)
3310 }
3311
3312 pub fn by_page(
3314 self,
3315 ) -> impl google_cloud_gax::paginator::Paginator<
3316 crate::model::ListConversationsResponse,
3317 crate::Error,
3318 > {
3319 use std::clone::Clone;
3320 let token = self.0.request.page_token.clone();
3321 let execute = move |token: String| {
3322 let mut builder = self.clone();
3323 builder.0.request = builder.0.request.set_page_token(token);
3324 builder.send()
3325 };
3326 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3327 }
3328
3329 pub fn by_item(
3331 self,
3332 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3333 crate::model::ListConversationsResponse,
3334 crate::Error,
3335 > {
3336 use google_cloud_gax::paginator::Paginator;
3337 self.by_page().items()
3338 }
3339
3340 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3344 self.0.request.parent = v.into();
3345 self
3346 }
3347
3348 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3350 self.0.request.page_size = v.into();
3351 self
3352 }
3353
3354 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3356 self.0.request.page_token = v.into();
3357 self
3358 }
3359
3360 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3362 self.0.request.filter = v.into();
3363 self
3364 }
3365
3366 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3368 self.0.request.order_by = v.into();
3369 self
3370 }
3371 }
3372
3373 #[doc(hidden)]
3374 impl crate::RequestBuilder for ListConversations {
3375 fn request_options(&mut self) -> &mut crate::RequestOptions {
3376 &mut self.0.options
3377 }
3378 }
3379
3380 #[derive(Clone, Debug)]
3397 pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3398
3399 impl AnswerQuery {
3400 pub(crate) fn new(
3401 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3402 ) -> Self {
3403 Self(RequestBuilder::new(stub))
3404 }
3405
3406 pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3408 self.0.request = v.into();
3409 self
3410 }
3411
3412 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3414 self.0.options = v.into();
3415 self
3416 }
3417
3418 pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3420 (*self.0.stub)
3421 .answer_query(self.0.request, self.0.options)
3422 .await
3423 .map(crate::Response::into_body)
3424 }
3425
3426 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3430 self.0.request.serving_config = v.into();
3431 self
3432 }
3433
3434 pub fn set_query<T>(mut self, v: T) -> Self
3438 where
3439 T: std::convert::Into<crate::model::Query>,
3440 {
3441 self.0.request.query = std::option::Option::Some(v.into());
3442 self
3443 }
3444
3445 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3449 where
3450 T: std::convert::Into<crate::model::Query>,
3451 {
3452 self.0.request.query = v.map(|x| x.into());
3453 self
3454 }
3455
3456 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3458 self.0.request.session = v.into();
3459 self
3460 }
3461
3462 pub fn set_safety_spec<T>(mut self, v: T) -> Self
3464 where
3465 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3466 {
3467 self.0.request.safety_spec = std::option::Option::Some(v.into());
3468 self
3469 }
3470
3471 pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3473 where
3474 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3475 {
3476 self.0.request.safety_spec = v.map(|x| x.into());
3477 self
3478 }
3479
3480 pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3482 where
3483 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3484 {
3485 self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3486 self
3487 }
3488
3489 pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3491 where
3492 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3493 {
3494 self.0.request.related_questions_spec = v.map(|x| x.into());
3495 self
3496 }
3497
3498 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3500 where
3501 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3502 {
3503 self.0.request.grounding_spec = std::option::Option::Some(v.into());
3504 self
3505 }
3506
3507 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3509 where
3510 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3511 {
3512 self.0.request.grounding_spec = v.map(|x| x.into());
3513 self
3514 }
3515
3516 pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3518 where
3519 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3520 {
3521 self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3522 self
3523 }
3524
3525 pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3527 where
3528 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3529 {
3530 self.0.request.answer_generation_spec = v.map(|x| x.into());
3531 self
3532 }
3533
3534 pub fn set_search_spec<T>(mut self, v: T) -> Self
3536 where
3537 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3538 {
3539 self.0.request.search_spec = std::option::Option::Some(v.into());
3540 self
3541 }
3542
3543 pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3545 where
3546 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3547 {
3548 self.0.request.search_spec = v.map(|x| x.into());
3549 self
3550 }
3551
3552 pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3554 where
3555 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3556 {
3557 self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3558 self
3559 }
3560
3561 pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3563 where
3564 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3565 {
3566 self.0.request.query_understanding_spec = v.map(|x| x.into());
3567 self
3568 }
3569
3570 #[deprecated]
3572 pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3573 self.0.request.asynchronous_mode = v.into();
3574 self
3575 }
3576
3577 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3579 self.0.request.user_pseudo_id = v.into();
3580 self
3581 }
3582
3583 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3585 where
3586 T: std::iter::IntoIterator<Item = (K, V)>,
3587 K: std::convert::Into<std::string::String>,
3588 V: std::convert::Into<std::string::String>,
3589 {
3590 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3591 self
3592 }
3593
3594 pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3596 where
3597 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3598 {
3599 self.0.request.end_user_spec = std::option::Option::Some(v.into());
3600 self
3601 }
3602
3603 pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3605 where
3606 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3607 {
3608 self.0.request.end_user_spec = v.map(|x| x.into());
3609 self
3610 }
3611 }
3612
3613 #[doc(hidden)]
3614 impl crate::RequestBuilder for AnswerQuery {
3615 fn request_options(&mut self) -> &mut crate::RequestOptions {
3616 &mut self.0.options
3617 }
3618 }
3619
3620 #[derive(Clone, Debug)]
3637 pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
3638
3639 impl GetAnswer {
3640 pub(crate) fn new(
3641 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3642 ) -> Self {
3643 Self(RequestBuilder::new(stub))
3644 }
3645
3646 pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
3648 self.0.request = v.into();
3649 self
3650 }
3651
3652 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3654 self.0.options = v.into();
3655 self
3656 }
3657
3658 pub async fn send(self) -> Result<crate::model::Answer> {
3660 (*self.0.stub)
3661 .get_answer(self.0.request, self.0.options)
3662 .await
3663 .map(crate::Response::into_body)
3664 }
3665
3666 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3670 self.0.request.name = v.into();
3671 self
3672 }
3673 }
3674
3675 #[doc(hidden)]
3676 impl crate::RequestBuilder for GetAnswer {
3677 fn request_options(&mut self) -> &mut crate::RequestOptions {
3678 &mut self.0.options
3679 }
3680 }
3681
3682 #[derive(Clone, Debug)]
3699 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
3700
3701 impl CreateSession {
3702 pub(crate) fn new(
3703 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3704 ) -> Self {
3705 Self(RequestBuilder::new(stub))
3706 }
3707
3708 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
3710 self.0.request = v.into();
3711 self
3712 }
3713
3714 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3716 self.0.options = v.into();
3717 self
3718 }
3719
3720 pub async fn send(self) -> Result<crate::model::Session> {
3722 (*self.0.stub)
3723 .create_session(self.0.request, self.0.options)
3724 .await
3725 .map(crate::Response::into_body)
3726 }
3727
3728 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3732 self.0.request.parent = v.into();
3733 self
3734 }
3735
3736 pub fn set_session<T>(mut self, v: T) -> Self
3740 where
3741 T: std::convert::Into<crate::model::Session>,
3742 {
3743 self.0.request.session = std::option::Option::Some(v.into());
3744 self
3745 }
3746
3747 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3751 where
3752 T: std::convert::Into<crate::model::Session>,
3753 {
3754 self.0.request.session = v.map(|x| x.into());
3755 self
3756 }
3757 }
3758
3759 #[doc(hidden)]
3760 impl crate::RequestBuilder for CreateSession {
3761 fn request_options(&mut self) -> &mut crate::RequestOptions {
3762 &mut self.0.options
3763 }
3764 }
3765
3766 #[derive(Clone, Debug)]
3783 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
3784
3785 impl DeleteSession {
3786 pub(crate) fn new(
3787 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3788 ) -> Self {
3789 Self(RequestBuilder::new(stub))
3790 }
3791
3792 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
3794 self.0.request = v.into();
3795 self
3796 }
3797
3798 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3800 self.0.options = v.into();
3801 self
3802 }
3803
3804 pub async fn send(self) -> Result<()> {
3806 (*self.0.stub)
3807 .delete_session(self.0.request, self.0.options)
3808 .await
3809 .map(crate::Response::into_body)
3810 }
3811
3812 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3816 self.0.request.name = v.into();
3817 self
3818 }
3819 }
3820
3821 #[doc(hidden)]
3822 impl crate::RequestBuilder for DeleteSession {
3823 fn request_options(&mut self) -> &mut crate::RequestOptions {
3824 &mut self.0.options
3825 }
3826 }
3827
3828 #[derive(Clone, Debug)]
3845 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
3846
3847 impl UpdateSession {
3848 pub(crate) fn new(
3849 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3850 ) -> Self {
3851 Self(RequestBuilder::new(stub))
3852 }
3853
3854 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
3856 self.0.request = v.into();
3857 self
3858 }
3859
3860 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3862 self.0.options = v.into();
3863 self
3864 }
3865
3866 pub async fn send(self) -> Result<crate::model::Session> {
3868 (*self.0.stub)
3869 .update_session(self.0.request, self.0.options)
3870 .await
3871 .map(crate::Response::into_body)
3872 }
3873
3874 pub fn set_session<T>(mut self, v: T) -> Self
3878 where
3879 T: std::convert::Into<crate::model::Session>,
3880 {
3881 self.0.request.session = std::option::Option::Some(v.into());
3882 self
3883 }
3884
3885 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3889 where
3890 T: std::convert::Into<crate::model::Session>,
3891 {
3892 self.0.request.session = v.map(|x| x.into());
3893 self
3894 }
3895
3896 pub fn set_update_mask<T>(mut self, v: T) -> Self
3898 where
3899 T: std::convert::Into<wkt::FieldMask>,
3900 {
3901 self.0.request.update_mask = std::option::Option::Some(v.into());
3902 self
3903 }
3904
3905 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3907 where
3908 T: std::convert::Into<wkt::FieldMask>,
3909 {
3910 self.0.request.update_mask = v.map(|x| x.into());
3911 self
3912 }
3913 }
3914
3915 #[doc(hidden)]
3916 impl crate::RequestBuilder for UpdateSession {
3917 fn request_options(&mut self) -> &mut crate::RequestOptions {
3918 &mut self.0.options
3919 }
3920 }
3921
3922 #[derive(Clone, Debug)]
3939 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
3940
3941 impl GetSession {
3942 pub(crate) fn new(
3943 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3944 ) -> Self {
3945 Self(RequestBuilder::new(stub))
3946 }
3947
3948 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
3950 self.0.request = v.into();
3951 self
3952 }
3953
3954 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3956 self.0.options = v.into();
3957 self
3958 }
3959
3960 pub async fn send(self) -> Result<crate::model::Session> {
3962 (*self.0.stub)
3963 .get_session(self.0.request, self.0.options)
3964 .await
3965 .map(crate::Response::into_body)
3966 }
3967
3968 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3972 self.0.request.name = v.into();
3973 self
3974 }
3975
3976 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
3978 self.0.request.include_answer_details = v.into();
3979 self
3980 }
3981 }
3982
3983 #[doc(hidden)]
3984 impl crate::RequestBuilder for GetSession {
3985 fn request_options(&mut self) -> &mut crate::RequestOptions {
3986 &mut self.0.options
3987 }
3988 }
3989
3990 #[derive(Clone, Debug)]
4011 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
4012
4013 impl ListSessions {
4014 pub(crate) fn new(
4015 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4016 ) -> Self {
4017 Self(RequestBuilder::new(stub))
4018 }
4019
4020 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
4022 self.0.request = v.into();
4023 self
4024 }
4025
4026 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4028 self.0.options = v.into();
4029 self
4030 }
4031
4032 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
4034 (*self.0.stub)
4035 .list_sessions(self.0.request, self.0.options)
4036 .await
4037 .map(crate::Response::into_body)
4038 }
4039
4040 pub fn by_page(
4042 self,
4043 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
4044 {
4045 use std::clone::Clone;
4046 let token = self.0.request.page_token.clone();
4047 let execute = move |token: String| {
4048 let mut builder = self.clone();
4049 builder.0.request = builder.0.request.set_page_token(token);
4050 builder.send()
4051 };
4052 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4053 }
4054
4055 pub fn by_item(
4057 self,
4058 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4059 crate::model::ListSessionsResponse,
4060 crate::Error,
4061 > {
4062 use google_cloud_gax::paginator::Paginator;
4063 self.by_page().items()
4064 }
4065
4066 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4070 self.0.request.parent = v.into();
4071 self
4072 }
4073
4074 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4076 self.0.request.page_size = v.into();
4077 self
4078 }
4079
4080 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4082 self.0.request.page_token = v.into();
4083 self
4084 }
4085
4086 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4088 self.0.request.filter = v.into();
4089 self
4090 }
4091
4092 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4094 self.0.request.order_by = v.into();
4095 self
4096 }
4097 }
4098
4099 #[doc(hidden)]
4100 impl crate::RequestBuilder for ListSessions {
4101 fn request_options(&mut self) -> &mut crate::RequestOptions {
4102 &mut self.0.options
4103 }
4104 }
4105
4106 #[derive(Clone, Debug)]
4127 pub struct ListOperations(
4128 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4129 );
4130
4131 impl ListOperations {
4132 pub(crate) fn new(
4133 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4134 ) -> Self {
4135 Self(RequestBuilder::new(stub))
4136 }
4137
4138 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4140 mut self,
4141 v: V,
4142 ) -> Self {
4143 self.0.request = v.into();
4144 self
4145 }
4146
4147 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4149 self.0.options = v.into();
4150 self
4151 }
4152
4153 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4155 (*self.0.stub)
4156 .list_operations(self.0.request, self.0.options)
4157 .await
4158 .map(crate::Response::into_body)
4159 }
4160
4161 pub fn by_page(
4163 self,
4164 ) -> impl google_cloud_gax::paginator::Paginator<
4165 google_cloud_longrunning::model::ListOperationsResponse,
4166 crate::Error,
4167 > {
4168 use std::clone::Clone;
4169 let token = self.0.request.page_token.clone();
4170 let execute = move |token: String| {
4171 let mut builder = self.clone();
4172 builder.0.request = builder.0.request.set_page_token(token);
4173 builder.send()
4174 };
4175 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4176 }
4177
4178 pub fn by_item(
4180 self,
4181 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4182 google_cloud_longrunning::model::ListOperationsResponse,
4183 crate::Error,
4184 > {
4185 use google_cloud_gax::paginator::Paginator;
4186 self.by_page().items()
4187 }
4188
4189 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4191 self.0.request.name = v.into();
4192 self
4193 }
4194
4195 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4197 self.0.request.filter = v.into();
4198 self
4199 }
4200
4201 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4203 self.0.request.page_size = v.into();
4204 self
4205 }
4206
4207 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4209 self.0.request.page_token = v.into();
4210 self
4211 }
4212
4213 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4215 self.0.request.return_partial_success = v.into();
4216 self
4217 }
4218 }
4219
4220 #[doc(hidden)]
4221 impl crate::RequestBuilder for ListOperations {
4222 fn request_options(&mut self) -> &mut crate::RequestOptions {
4223 &mut self.0.options
4224 }
4225 }
4226
4227 #[derive(Clone, Debug)]
4244 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4245
4246 impl GetOperation {
4247 pub(crate) fn new(
4248 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4249 ) -> Self {
4250 Self(RequestBuilder::new(stub))
4251 }
4252
4253 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4255 mut self,
4256 v: V,
4257 ) -> Self {
4258 self.0.request = v.into();
4259 self
4260 }
4261
4262 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4264 self.0.options = v.into();
4265 self
4266 }
4267
4268 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4270 (*self.0.stub)
4271 .get_operation(self.0.request, self.0.options)
4272 .await
4273 .map(crate::Response::into_body)
4274 }
4275
4276 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4278 self.0.request.name = v.into();
4279 self
4280 }
4281 }
4282
4283 #[doc(hidden)]
4284 impl crate::RequestBuilder for GetOperation {
4285 fn request_options(&mut self) -> &mut crate::RequestOptions {
4286 &mut self.0.options
4287 }
4288 }
4289
4290 #[derive(Clone, Debug)]
4307 pub struct CancelOperation(
4308 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
4309 );
4310
4311 impl CancelOperation {
4312 pub(crate) fn new(
4313 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4314 ) -> Self {
4315 Self(RequestBuilder::new(stub))
4316 }
4317
4318 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
4320 mut self,
4321 v: V,
4322 ) -> Self {
4323 self.0.request = v.into();
4324 self
4325 }
4326
4327 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4329 self.0.options = v.into();
4330 self
4331 }
4332
4333 pub async fn send(self) -> Result<()> {
4335 (*self.0.stub)
4336 .cancel_operation(self.0.request, self.0.options)
4337 .await
4338 .map(crate::Response::into_body)
4339 }
4340
4341 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4343 self.0.request.name = v.into();
4344 self
4345 }
4346 }
4347
4348 #[doc(hidden)]
4349 impl crate::RequestBuilder for CancelOperation {
4350 fn request_options(&mut self) -> &mut crate::RequestOptions {
4351 &mut self.0.options
4352 }
4353 }
4354}
4355
4356#[cfg(feature = "data-store-service")]
4358#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4359pub mod data_store_service {
4360 use crate::Result;
4361
4362 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4376
4377 pub(crate) mod client {
4378 use super::super::super::client::DataStoreService;
4379 pub struct Factory;
4380 impl crate::ClientFactory for Factory {
4381 type Client = DataStoreService;
4382 type Credentials = gaxi::options::Credentials;
4383 async fn build(
4384 self,
4385 config: gaxi::options::ClientConfig,
4386 ) -> crate::ClientBuilderResult<Self::Client> {
4387 Self::Client::new(config).await
4388 }
4389 }
4390 }
4391
4392 #[derive(Clone, Debug)]
4394 pub(crate) struct RequestBuilder<R: std::default::Default> {
4395 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4396 request: R,
4397 options: crate::RequestOptions,
4398 }
4399
4400 impl<R> RequestBuilder<R>
4401 where
4402 R: std::default::Default,
4403 {
4404 pub(crate) fn new(
4405 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4406 ) -> Self {
4407 Self {
4408 stub,
4409 request: R::default(),
4410 options: crate::RequestOptions::default(),
4411 }
4412 }
4413 }
4414
4415 #[derive(Clone, Debug)]
4433 pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4434
4435 impl CreateDataStore {
4436 pub(crate) fn new(
4437 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4438 ) -> Self {
4439 Self(RequestBuilder::new(stub))
4440 }
4441
4442 pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4444 self.0.request = v.into();
4445 self
4446 }
4447
4448 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4450 self.0.options = v.into();
4451 self
4452 }
4453
4454 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4461 (*self.0.stub)
4462 .create_data_store(self.0.request, self.0.options)
4463 .await
4464 .map(crate::Response::into_body)
4465 }
4466
4467 pub fn poller(
4469 self,
4470 ) -> impl google_cloud_lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4471 {
4472 type Operation = google_cloud_lro::internal::Operation<
4473 crate::model::DataStore,
4474 crate::model::CreateDataStoreMetadata,
4475 >;
4476 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4477 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4478
4479 let stub = self.0.stub.clone();
4480 let mut options = self.0.options.clone();
4481 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4482 let query = move |name| {
4483 let stub = stub.clone();
4484 let options = options.clone();
4485 async {
4486 let op = GetOperation::new(stub)
4487 .set_name(name)
4488 .with_options(options)
4489 .send()
4490 .await?;
4491 Ok(Operation::new(op))
4492 }
4493 };
4494
4495 let start = move || async {
4496 let op = self.send().await?;
4497 Ok(Operation::new(op))
4498 };
4499
4500 google_cloud_lro::internal::new_poller(
4501 polling_error_policy,
4502 polling_backoff_policy,
4503 start,
4504 query,
4505 )
4506 }
4507
4508 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4512 self.0.request.parent = v.into();
4513 self
4514 }
4515
4516 pub fn set_data_store<T>(mut self, v: T) -> Self
4520 where
4521 T: std::convert::Into<crate::model::DataStore>,
4522 {
4523 self.0.request.data_store = std::option::Option::Some(v.into());
4524 self
4525 }
4526
4527 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4531 where
4532 T: std::convert::Into<crate::model::DataStore>,
4533 {
4534 self.0.request.data_store = v.map(|x| x.into());
4535 self
4536 }
4537
4538 pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4542 self.0.request.data_store_id = v.into();
4543 self
4544 }
4545
4546 pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
4548 self.0.request.create_advanced_site_search = v.into();
4549 self
4550 }
4551
4552 pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
4554 self.0.request.skip_default_schema_creation = v.into();
4555 self
4556 }
4557
4558 pub fn set_cmek_options<
4563 T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
4564 >(
4565 mut self,
4566 v: T,
4567 ) -> Self {
4568 self.0.request.cmek_options = v.into();
4569 self
4570 }
4571
4572 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
4578 mut self,
4579 v: T,
4580 ) -> Self {
4581 self.0.request = self.0.request.set_cmek_config_name(v);
4582 self
4583 }
4584
4585 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4591 self.0.request = self.0.request.set_disable_cmek(v);
4592 self
4593 }
4594 }
4595
4596 #[doc(hidden)]
4597 impl crate::RequestBuilder for CreateDataStore {
4598 fn request_options(&mut self) -> &mut crate::RequestOptions {
4599 &mut self.0.options
4600 }
4601 }
4602
4603 #[derive(Clone, Debug)]
4620 pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
4621
4622 impl GetDataStore {
4623 pub(crate) fn new(
4624 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4625 ) -> Self {
4626 Self(RequestBuilder::new(stub))
4627 }
4628
4629 pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
4631 self.0.request = v.into();
4632 self
4633 }
4634
4635 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4637 self.0.options = v.into();
4638 self
4639 }
4640
4641 pub async fn send(self) -> Result<crate::model::DataStore> {
4643 (*self.0.stub)
4644 .get_data_store(self.0.request, self.0.options)
4645 .await
4646 .map(crate::Response::into_body)
4647 }
4648
4649 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4653 self.0.request.name = v.into();
4654 self
4655 }
4656 }
4657
4658 #[doc(hidden)]
4659 impl crate::RequestBuilder for GetDataStore {
4660 fn request_options(&mut self) -> &mut crate::RequestOptions {
4661 &mut self.0.options
4662 }
4663 }
4664
4665 #[derive(Clone, Debug)]
4686 pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
4687
4688 impl ListDataStores {
4689 pub(crate) fn new(
4690 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4691 ) -> Self {
4692 Self(RequestBuilder::new(stub))
4693 }
4694
4695 pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
4697 self.0.request = v.into();
4698 self
4699 }
4700
4701 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4703 self.0.options = v.into();
4704 self
4705 }
4706
4707 pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
4709 (*self.0.stub)
4710 .list_data_stores(self.0.request, self.0.options)
4711 .await
4712 .map(crate::Response::into_body)
4713 }
4714
4715 pub fn by_page(
4717 self,
4718 ) -> impl google_cloud_gax::paginator::Paginator<
4719 crate::model::ListDataStoresResponse,
4720 crate::Error,
4721 > {
4722 use std::clone::Clone;
4723 let token = self.0.request.page_token.clone();
4724 let execute = move |token: String| {
4725 let mut builder = self.clone();
4726 builder.0.request = builder.0.request.set_page_token(token);
4727 builder.send()
4728 };
4729 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4730 }
4731
4732 pub fn by_item(
4734 self,
4735 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4736 crate::model::ListDataStoresResponse,
4737 crate::Error,
4738 > {
4739 use google_cloud_gax::paginator::Paginator;
4740 self.by_page().items()
4741 }
4742
4743 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4747 self.0.request.parent = v.into();
4748 self
4749 }
4750
4751 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4753 self.0.request.page_size = v.into();
4754 self
4755 }
4756
4757 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4759 self.0.request.page_token = v.into();
4760 self
4761 }
4762
4763 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4765 self.0.request.filter = v.into();
4766 self
4767 }
4768 }
4769
4770 #[doc(hidden)]
4771 impl crate::RequestBuilder for ListDataStores {
4772 fn request_options(&mut self) -> &mut crate::RequestOptions {
4773 &mut self.0.options
4774 }
4775 }
4776
4777 #[derive(Clone, Debug)]
4795 pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
4796
4797 impl DeleteDataStore {
4798 pub(crate) fn new(
4799 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4800 ) -> Self {
4801 Self(RequestBuilder::new(stub))
4802 }
4803
4804 pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
4806 self.0.request = v.into();
4807 self
4808 }
4809
4810 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4812 self.0.options = v.into();
4813 self
4814 }
4815
4816 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4823 (*self.0.stub)
4824 .delete_data_store(self.0.request, self.0.options)
4825 .await
4826 .map(crate::Response::into_body)
4827 }
4828
4829 pub fn poller(
4831 self,
4832 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
4833 type Operation = google_cloud_lro::internal::Operation<
4834 wkt::Empty,
4835 crate::model::DeleteDataStoreMetadata,
4836 >;
4837 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4838 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4839
4840 let stub = self.0.stub.clone();
4841 let mut options = self.0.options.clone();
4842 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4843 let query = move |name| {
4844 let stub = stub.clone();
4845 let options = options.clone();
4846 async {
4847 let op = GetOperation::new(stub)
4848 .set_name(name)
4849 .with_options(options)
4850 .send()
4851 .await?;
4852 Ok(Operation::new(op))
4853 }
4854 };
4855
4856 let start = move || async {
4857 let op = self.send().await?;
4858 Ok(Operation::new(op))
4859 };
4860
4861 google_cloud_lro::internal::new_unit_response_poller(
4862 polling_error_policy,
4863 polling_backoff_policy,
4864 start,
4865 query,
4866 )
4867 }
4868
4869 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4873 self.0.request.name = v.into();
4874 self
4875 }
4876 }
4877
4878 #[doc(hidden)]
4879 impl crate::RequestBuilder for DeleteDataStore {
4880 fn request_options(&mut self) -> &mut crate::RequestOptions {
4881 &mut self.0.options
4882 }
4883 }
4884
4885 #[derive(Clone, Debug)]
4902 pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
4903
4904 impl UpdateDataStore {
4905 pub(crate) fn new(
4906 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4907 ) -> Self {
4908 Self(RequestBuilder::new(stub))
4909 }
4910
4911 pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
4913 self.0.request = v.into();
4914 self
4915 }
4916
4917 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4919 self.0.options = v.into();
4920 self
4921 }
4922
4923 pub async fn send(self) -> Result<crate::model::DataStore> {
4925 (*self.0.stub)
4926 .update_data_store(self.0.request, self.0.options)
4927 .await
4928 .map(crate::Response::into_body)
4929 }
4930
4931 pub fn set_data_store<T>(mut self, v: T) -> Self
4935 where
4936 T: std::convert::Into<crate::model::DataStore>,
4937 {
4938 self.0.request.data_store = std::option::Option::Some(v.into());
4939 self
4940 }
4941
4942 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4946 where
4947 T: std::convert::Into<crate::model::DataStore>,
4948 {
4949 self.0.request.data_store = v.map(|x| x.into());
4950 self
4951 }
4952
4953 pub fn set_update_mask<T>(mut self, v: T) -> Self
4955 where
4956 T: std::convert::Into<wkt::FieldMask>,
4957 {
4958 self.0.request.update_mask = std::option::Option::Some(v.into());
4959 self
4960 }
4961
4962 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4964 where
4965 T: std::convert::Into<wkt::FieldMask>,
4966 {
4967 self.0.request.update_mask = v.map(|x| x.into());
4968 self
4969 }
4970 }
4971
4972 #[doc(hidden)]
4973 impl crate::RequestBuilder for UpdateDataStore {
4974 fn request_options(&mut self) -> &mut crate::RequestOptions {
4975 &mut self.0.options
4976 }
4977 }
4978
4979 #[derive(Clone, Debug)]
5000 pub struct ListOperations(
5001 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5002 );
5003
5004 impl ListOperations {
5005 pub(crate) fn new(
5006 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5007 ) -> Self {
5008 Self(RequestBuilder::new(stub))
5009 }
5010
5011 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5013 mut self,
5014 v: V,
5015 ) -> Self {
5016 self.0.request = v.into();
5017 self
5018 }
5019
5020 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5022 self.0.options = v.into();
5023 self
5024 }
5025
5026 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5028 (*self.0.stub)
5029 .list_operations(self.0.request, self.0.options)
5030 .await
5031 .map(crate::Response::into_body)
5032 }
5033
5034 pub fn by_page(
5036 self,
5037 ) -> impl google_cloud_gax::paginator::Paginator<
5038 google_cloud_longrunning::model::ListOperationsResponse,
5039 crate::Error,
5040 > {
5041 use std::clone::Clone;
5042 let token = self.0.request.page_token.clone();
5043 let execute = move |token: String| {
5044 let mut builder = self.clone();
5045 builder.0.request = builder.0.request.set_page_token(token);
5046 builder.send()
5047 };
5048 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5049 }
5050
5051 pub fn by_item(
5053 self,
5054 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5055 google_cloud_longrunning::model::ListOperationsResponse,
5056 crate::Error,
5057 > {
5058 use google_cloud_gax::paginator::Paginator;
5059 self.by_page().items()
5060 }
5061
5062 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5064 self.0.request.name = v.into();
5065 self
5066 }
5067
5068 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5070 self.0.request.filter = v.into();
5071 self
5072 }
5073
5074 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5076 self.0.request.page_size = v.into();
5077 self
5078 }
5079
5080 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5082 self.0.request.page_token = v.into();
5083 self
5084 }
5085
5086 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5088 self.0.request.return_partial_success = v.into();
5089 self
5090 }
5091 }
5092
5093 #[doc(hidden)]
5094 impl crate::RequestBuilder for ListOperations {
5095 fn request_options(&mut self) -> &mut crate::RequestOptions {
5096 &mut self.0.options
5097 }
5098 }
5099
5100 #[derive(Clone, Debug)]
5117 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5118
5119 impl GetOperation {
5120 pub(crate) fn new(
5121 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5122 ) -> Self {
5123 Self(RequestBuilder::new(stub))
5124 }
5125
5126 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5128 mut self,
5129 v: V,
5130 ) -> Self {
5131 self.0.request = v.into();
5132 self
5133 }
5134
5135 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5137 self.0.options = v.into();
5138 self
5139 }
5140
5141 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5143 (*self.0.stub)
5144 .get_operation(self.0.request, self.0.options)
5145 .await
5146 .map(crate::Response::into_body)
5147 }
5148
5149 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5151 self.0.request.name = v.into();
5152 self
5153 }
5154 }
5155
5156 #[doc(hidden)]
5157 impl crate::RequestBuilder for GetOperation {
5158 fn request_options(&mut self) -> &mut crate::RequestOptions {
5159 &mut self.0.options
5160 }
5161 }
5162
5163 #[derive(Clone, Debug)]
5180 pub struct CancelOperation(
5181 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
5182 );
5183
5184 impl CancelOperation {
5185 pub(crate) fn new(
5186 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5187 ) -> Self {
5188 Self(RequestBuilder::new(stub))
5189 }
5190
5191 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
5193 mut self,
5194 v: V,
5195 ) -> Self {
5196 self.0.request = v.into();
5197 self
5198 }
5199
5200 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5202 self.0.options = v.into();
5203 self
5204 }
5205
5206 pub async fn send(self) -> Result<()> {
5208 (*self.0.stub)
5209 .cancel_operation(self.0.request, self.0.options)
5210 .await
5211 .map(crate::Response::into_body)
5212 }
5213
5214 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5216 self.0.request.name = v.into();
5217 self
5218 }
5219 }
5220
5221 #[doc(hidden)]
5222 impl crate::RequestBuilder for CancelOperation {
5223 fn request_options(&mut self) -> &mut crate::RequestOptions {
5224 &mut self.0.options
5225 }
5226 }
5227}
5228
5229#[cfg(feature = "document-service")]
5231#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5232pub mod document_service {
5233 use crate::Result;
5234
5235 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5249
5250 pub(crate) mod client {
5251 use super::super::super::client::DocumentService;
5252 pub struct Factory;
5253 impl crate::ClientFactory for Factory {
5254 type Client = DocumentService;
5255 type Credentials = gaxi::options::Credentials;
5256 async fn build(
5257 self,
5258 config: gaxi::options::ClientConfig,
5259 ) -> crate::ClientBuilderResult<Self::Client> {
5260 Self::Client::new(config).await
5261 }
5262 }
5263 }
5264
5265 #[derive(Clone, Debug)]
5267 pub(crate) struct RequestBuilder<R: std::default::Default> {
5268 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5269 request: R,
5270 options: crate::RequestOptions,
5271 }
5272
5273 impl<R> RequestBuilder<R>
5274 where
5275 R: std::default::Default,
5276 {
5277 pub(crate) fn new(
5278 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5279 ) -> Self {
5280 Self {
5281 stub,
5282 request: R::default(),
5283 options: crate::RequestOptions::default(),
5284 }
5285 }
5286 }
5287
5288 #[derive(Clone, Debug)]
5305 pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5306
5307 impl GetDocument {
5308 pub(crate) fn new(
5309 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5310 ) -> Self {
5311 Self(RequestBuilder::new(stub))
5312 }
5313
5314 pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5316 self.0.request = v.into();
5317 self
5318 }
5319
5320 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5322 self.0.options = v.into();
5323 self
5324 }
5325
5326 pub async fn send(self) -> Result<crate::model::Document> {
5328 (*self.0.stub)
5329 .get_document(self.0.request, self.0.options)
5330 .await
5331 .map(crate::Response::into_body)
5332 }
5333
5334 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5338 self.0.request.name = v.into();
5339 self
5340 }
5341 }
5342
5343 #[doc(hidden)]
5344 impl crate::RequestBuilder for GetDocument {
5345 fn request_options(&mut self) -> &mut crate::RequestOptions {
5346 &mut self.0.options
5347 }
5348 }
5349
5350 #[derive(Clone, Debug)]
5371 pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5372
5373 impl ListDocuments {
5374 pub(crate) fn new(
5375 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5376 ) -> Self {
5377 Self(RequestBuilder::new(stub))
5378 }
5379
5380 pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5382 self.0.request = v.into();
5383 self
5384 }
5385
5386 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5388 self.0.options = v.into();
5389 self
5390 }
5391
5392 pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5394 (*self.0.stub)
5395 .list_documents(self.0.request, self.0.options)
5396 .await
5397 .map(crate::Response::into_body)
5398 }
5399
5400 pub fn by_page(
5402 self,
5403 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDocumentsResponse, crate::Error>
5404 {
5405 use std::clone::Clone;
5406 let token = self.0.request.page_token.clone();
5407 let execute = move |token: String| {
5408 let mut builder = self.clone();
5409 builder.0.request = builder.0.request.set_page_token(token);
5410 builder.send()
5411 };
5412 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5413 }
5414
5415 pub fn by_item(
5417 self,
5418 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5419 crate::model::ListDocumentsResponse,
5420 crate::Error,
5421 > {
5422 use google_cloud_gax::paginator::Paginator;
5423 self.by_page().items()
5424 }
5425
5426 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5430 self.0.request.parent = v.into();
5431 self
5432 }
5433
5434 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5436 self.0.request.page_size = v.into();
5437 self
5438 }
5439
5440 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5442 self.0.request.page_token = v.into();
5443 self
5444 }
5445 }
5446
5447 #[doc(hidden)]
5448 impl crate::RequestBuilder for ListDocuments {
5449 fn request_options(&mut self) -> &mut crate::RequestOptions {
5450 &mut self.0.options
5451 }
5452 }
5453
5454 #[derive(Clone, Debug)]
5471 pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5472
5473 impl CreateDocument {
5474 pub(crate) fn new(
5475 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5476 ) -> Self {
5477 Self(RequestBuilder::new(stub))
5478 }
5479
5480 pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5482 self.0.request = v.into();
5483 self
5484 }
5485
5486 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5488 self.0.options = v.into();
5489 self
5490 }
5491
5492 pub async fn send(self) -> Result<crate::model::Document> {
5494 (*self.0.stub)
5495 .create_document(self.0.request, self.0.options)
5496 .await
5497 .map(crate::Response::into_body)
5498 }
5499
5500 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5504 self.0.request.parent = v.into();
5505 self
5506 }
5507
5508 pub fn set_document<T>(mut self, v: T) -> Self
5512 where
5513 T: std::convert::Into<crate::model::Document>,
5514 {
5515 self.0.request.document = std::option::Option::Some(v.into());
5516 self
5517 }
5518
5519 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5523 where
5524 T: std::convert::Into<crate::model::Document>,
5525 {
5526 self.0.request.document = v.map(|x| x.into());
5527 self
5528 }
5529
5530 pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5534 self.0.request.document_id = v.into();
5535 self
5536 }
5537 }
5538
5539 #[doc(hidden)]
5540 impl crate::RequestBuilder for CreateDocument {
5541 fn request_options(&mut self) -> &mut crate::RequestOptions {
5542 &mut self.0.options
5543 }
5544 }
5545
5546 #[derive(Clone, Debug)]
5563 pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
5564
5565 impl UpdateDocument {
5566 pub(crate) fn new(
5567 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5568 ) -> Self {
5569 Self(RequestBuilder::new(stub))
5570 }
5571
5572 pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
5574 self.0.request = v.into();
5575 self
5576 }
5577
5578 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5580 self.0.options = v.into();
5581 self
5582 }
5583
5584 pub async fn send(self) -> Result<crate::model::Document> {
5586 (*self.0.stub)
5587 .update_document(self.0.request, self.0.options)
5588 .await
5589 .map(crate::Response::into_body)
5590 }
5591
5592 pub fn set_document<T>(mut self, v: T) -> Self
5596 where
5597 T: std::convert::Into<crate::model::Document>,
5598 {
5599 self.0.request.document = std::option::Option::Some(v.into());
5600 self
5601 }
5602
5603 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5607 where
5608 T: std::convert::Into<crate::model::Document>,
5609 {
5610 self.0.request.document = v.map(|x| x.into());
5611 self
5612 }
5613
5614 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5616 self.0.request.allow_missing = v.into();
5617 self
5618 }
5619
5620 pub fn set_update_mask<T>(mut self, v: T) -> Self
5622 where
5623 T: std::convert::Into<wkt::FieldMask>,
5624 {
5625 self.0.request.update_mask = std::option::Option::Some(v.into());
5626 self
5627 }
5628
5629 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5631 where
5632 T: std::convert::Into<wkt::FieldMask>,
5633 {
5634 self.0.request.update_mask = v.map(|x| x.into());
5635 self
5636 }
5637 }
5638
5639 #[doc(hidden)]
5640 impl crate::RequestBuilder for UpdateDocument {
5641 fn request_options(&mut self) -> &mut crate::RequestOptions {
5642 &mut self.0.options
5643 }
5644 }
5645
5646 #[derive(Clone, Debug)]
5663 pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
5664
5665 impl DeleteDocument {
5666 pub(crate) fn new(
5667 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5668 ) -> Self {
5669 Self(RequestBuilder::new(stub))
5670 }
5671
5672 pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
5674 self.0.request = v.into();
5675 self
5676 }
5677
5678 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5680 self.0.options = v.into();
5681 self
5682 }
5683
5684 pub async fn send(self) -> Result<()> {
5686 (*self.0.stub)
5687 .delete_document(self.0.request, self.0.options)
5688 .await
5689 .map(crate::Response::into_body)
5690 }
5691
5692 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5696 self.0.request.name = v.into();
5697 self
5698 }
5699 }
5700
5701 #[doc(hidden)]
5702 impl crate::RequestBuilder for DeleteDocument {
5703 fn request_options(&mut self) -> &mut crate::RequestOptions {
5704 &mut self.0.options
5705 }
5706 }
5707
5708 #[derive(Clone, Debug)]
5726 pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
5727
5728 impl ImportDocuments {
5729 pub(crate) fn new(
5730 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5731 ) -> Self {
5732 Self(RequestBuilder::new(stub))
5733 }
5734
5735 pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
5737 self.0.request = v.into();
5738 self
5739 }
5740
5741 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5743 self.0.options = v.into();
5744 self
5745 }
5746
5747 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5754 (*self.0.stub)
5755 .import_documents(self.0.request, self.0.options)
5756 .await
5757 .map(crate::Response::into_body)
5758 }
5759
5760 pub fn poller(
5762 self,
5763 ) -> impl google_cloud_lro::Poller<
5764 crate::model::ImportDocumentsResponse,
5765 crate::model::ImportDocumentsMetadata,
5766 > {
5767 type Operation = google_cloud_lro::internal::Operation<
5768 crate::model::ImportDocumentsResponse,
5769 crate::model::ImportDocumentsMetadata,
5770 >;
5771 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5772 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5773
5774 let stub = self.0.stub.clone();
5775 let mut options = self.0.options.clone();
5776 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5777 let query = move |name| {
5778 let stub = stub.clone();
5779 let options = options.clone();
5780 async {
5781 let op = GetOperation::new(stub)
5782 .set_name(name)
5783 .with_options(options)
5784 .send()
5785 .await?;
5786 Ok(Operation::new(op))
5787 }
5788 };
5789
5790 let start = move || async {
5791 let op = self.send().await?;
5792 Ok(Operation::new(op))
5793 };
5794
5795 google_cloud_lro::internal::new_poller(
5796 polling_error_policy,
5797 polling_backoff_policy,
5798 start,
5799 query,
5800 )
5801 }
5802
5803 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5807 self.0.request.parent = v.into();
5808 self
5809 }
5810
5811 pub fn set_error_config<T>(mut self, v: T) -> Self
5813 where
5814 T: std::convert::Into<crate::model::ImportErrorConfig>,
5815 {
5816 self.0.request.error_config = std::option::Option::Some(v.into());
5817 self
5818 }
5819
5820 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
5822 where
5823 T: std::convert::Into<crate::model::ImportErrorConfig>,
5824 {
5825 self.0.request.error_config = v.map(|x| x.into());
5826 self
5827 }
5828
5829 pub fn set_reconciliation_mode<
5831 T: Into<crate::model::import_documents_request::ReconciliationMode>,
5832 >(
5833 mut self,
5834 v: T,
5835 ) -> Self {
5836 self.0.request.reconciliation_mode = v.into();
5837 self
5838 }
5839
5840 pub fn set_update_mask<T>(mut self, v: T) -> Self
5842 where
5843 T: std::convert::Into<wkt::FieldMask>,
5844 {
5845 self.0.request.update_mask = std::option::Option::Some(v.into());
5846 self
5847 }
5848
5849 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5851 where
5852 T: std::convert::Into<wkt::FieldMask>,
5853 {
5854 self.0.request.update_mask = v.map(|x| x.into());
5855 self
5856 }
5857
5858 pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
5860 self.0.request.auto_generate_ids = v.into();
5861 self
5862 }
5863
5864 pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
5866 self.0.request.id_field = v.into();
5867 self
5868 }
5869
5870 pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
5872 self.0.request.force_refresh_content = v.into();
5873 self
5874 }
5875
5876 pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
5881 mut self,
5882 v: T,
5883 ) -> Self {
5884 self.0.request.source = v.into();
5885 self
5886 }
5887
5888 pub fn set_inline_source<
5894 T: std::convert::Into<
5895 std::boxed::Box<crate::model::import_documents_request::InlineSource>,
5896 >,
5897 >(
5898 mut self,
5899 v: T,
5900 ) -> Self {
5901 self.0.request = self.0.request.set_inline_source(v);
5902 self
5903 }
5904
5905 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
5911 mut self,
5912 v: T,
5913 ) -> Self {
5914 self.0.request = self.0.request.set_gcs_source(v);
5915 self
5916 }
5917
5918 pub fn set_bigquery_source<
5924 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
5925 >(
5926 mut self,
5927 v: T,
5928 ) -> Self {
5929 self.0.request = self.0.request.set_bigquery_source(v);
5930 self
5931 }
5932
5933 pub fn set_fhir_store_source<
5939 T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
5940 >(
5941 mut self,
5942 v: T,
5943 ) -> Self {
5944 self.0.request = self.0.request.set_fhir_store_source(v);
5945 self
5946 }
5947
5948 pub fn set_spanner_source<
5954 T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
5955 >(
5956 mut self,
5957 v: T,
5958 ) -> Self {
5959 self.0.request = self.0.request.set_spanner_source(v);
5960 self
5961 }
5962
5963 pub fn set_cloud_sql_source<
5969 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
5970 >(
5971 mut self,
5972 v: T,
5973 ) -> Self {
5974 self.0.request = self.0.request.set_cloud_sql_source(v);
5975 self
5976 }
5977
5978 pub fn set_firestore_source<
5984 T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
5985 >(
5986 mut self,
5987 v: T,
5988 ) -> Self {
5989 self.0.request = self.0.request.set_firestore_source(v);
5990 self
5991 }
5992
5993 pub fn set_alloy_db_source<
5999 T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
6000 >(
6001 mut self,
6002 v: T,
6003 ) -> Self {
6004 self.0.request = self.0.request.set_alloy_db_source(v);
6005 self
6006 }
6007
6008 pub fn set_bigtable_source<
6014 T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
6015 >(
6016 mut self,
6017 v: T,
6018 ) -> Self {
6019 self.0.request = self.0.request.set_bigtable_source(v);
6020 self
6021 }
6022 }
6023
6024 #[doc(hidden)]
6025 impl crate::RequestBuilder for ImportDocuments {
6026 fn request_options(&mut self) -> &mut crate::RequestOptions {
6027 &mut self.0.options
6028 }
6029 }
6030
6031 #[derive(Clone, Debug)]
6049 pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
6050
6051 impl PurgeDocuments {
6052 pub(crate) fn new(
6053 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6054 ) -> Self {
6055 Self(RequestBuilder::new(stub))
6056 }
6057
6058 pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
6060 self.0.request = v.into();
6061 self
6062 }
6063
6064 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6066 self.0.options = v.into();
6067 self
6068 }
6069
6070 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6077 (*self.0.stub)
6078 .purge_documents(self.0.request, self.0.options)
6079 .await
6080 .map(crate::Response::into_body)
6081 }
6082
6083 pub fn poller(
6085 self,
6086 ) -> impl google_cloud_lro::Poller<
6087 crate::model::PurgeDocumentsResponse,
6088 crate::model::PurgeDocumentsMetadata,
6089 > {
6090 type Operation = google_cloud_lro::internal::Operation<
6091 crate::model::PurgeDocumentsResponse,
6092 crate::model::PurgeDocumentsMetadata,
6093 >;
6094 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6095 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6096
6097 let stub = self.0.stub.clone();
6098 let mut options = self.0.options.clone();
6099 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6100 let query = move |name| {
6101 let stub = stub.clone();
6102 let options = options.clone();
6103 async {
6104 let op = GetOperation::new(stub)
6105 .set_name(name)
6106 .with_options(options)
6107 .send()
6108 .await?;
6109 Ok(Operation::new(op))
6110 }
6111 };
6112
6113 let start = move || async {
6114 let op = self.send().await?;
6115 Ok(Operation::new(op))
6116 };
6117
6118 google_cloud_lro::internal::new_poller(
6119 polling_error_policy,
6120 polling_backoff_policy,
6121 start,
6122 query,
6123 )
6124 }
6125
6126 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6130 self.0.request.parent = v.into();
6131 self
6132 }
6133
6134 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6138 self.0.request.filter = v.into();
6139 self
6140 }
6141
6142 pub fn set_error_config<T>(mut self, v: T) -> Self
6144 where
6145 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6146 {
6147 self.0.request.error_config = std::option::Option::Some(v.into());
6148 self
6149 }
6150
6151 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6153 where
6154 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6155 {
6156 self.0.request.error_config = v.map(|x| x.into());
6157 self
6158 }
6159
6160 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6162 self.0.request.force = v.into();
6163 self
6164 }
6165
6166 pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6171 mut self,
6172 v: T,
6173 ) -> Self {
6174 self.0.request.source = v.into();
6175 self
6176 }
6177
6178 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6184 mut self,
6185 v: T,
6186 ) -> Self {
6187 self.0.request = self.0.request.set_gcs_source(v);
6188 self
6189 }
6190
6191 pub fn set_inline_source<
6197 T: std::convert::Into<
6198 std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6199 >,
6200 >(
6201 mut self,
6202 v: T,
6203 ) -> Self {
6204 self.0.request = self.0.request.set_inline_source(v);
6205 self
6206 }
6207 }
6208
6209 #[doc(hidden)]
6210 impl crate::RequestBuilder for PurgeDocuments {
6211 fn request_options(&mut self) -> &mut crate::RequestOptions {
6212 &mut self.0.options
6213 }
6214 }
6215
6216 #[derive(Clone, Debug)]
6233 pub struct BatchGetDocumentsMetadata(
6234 RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6235 );
6236
6237 impl BatchGetDocumentsMetadata {
6238 pub(crate) fn new(
6239 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6240 ) -> Self {
6241 Self(RequestBuilder::new(stub))
6242 }
6243
6244 pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6246 mut self,
6247 v: V,
6248 ) -> Self {
6249 self.0.request = v.into();
6250 self
6251 }
6252
6253 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6255 self.0.options = v.into();
6256 self
6257 }
6258
6259 pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6261 (*self.0.stub)
6262 .batch_get_documents_metadata(self.0.request, self.0.options)
6263 .await
6264 .map(crate::Response::into_body)
6265 }
6266
6267 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6271 self.0.request.parent = v.into();
6272 self
6273 }
6274
6275 pub fn set_matcher<T>(mut self, v: T) -> Self
6279 where
6280 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6281 {
6282 self.0.request.matcher = std::option::Option::Some(v.into());
6283 self
6284 }
6285
6286 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6290 where
6291 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6292 {
6293 self.0.request.matcher = v.map(|x| x.into());
6294 self
6295 }
6296 }
6297
6298 #[doc(hidden)]
6299 impl crate::RequestBuilder for BatchGetDocumentsMetadata {
6300 fn request_options(&mut self) -> &mut crate::RequestOptions {
6301 &mut self.0.options
6302 }
6303 }
6304
6305 #[derive(Clone, Debug)]
6326 pub struct ListOperations(
6327 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6328 );
6329
6330 impl ListOperations {
6331 pub(crate) fn new(
6332 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6333 ) -> Self {
6334 Self(RequestBuilder::new(stub))
6335 }
6336
6337 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6339 mut self,
6340 v: V,
6341 ) -> Self {
6342 self.0.request = v.into();
6343 self
6344 }
6345
6346 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6348 self.0.options = v.into();
6349 self
6350 }
6351
6352 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6354 (*self.0.stub)
6355 .list_operations(self.0.request, self.0.options)
6356 .await
6357 .map(crate::Response::into_body)
6358 }
6359
6360 pub fn by_page(
6362 self,
6363 ) -> impl google_cloud_gax::paginator::Paginator<
6364 google_cloud_longrunning::model::ListOperationsResponse,
6365 crate::Error,
6366 > {
6367 use std::clone::Clone;
6368 let token = self.0.request.page_token.clone();
6369 let execute = move |token: String| {
6370 let mut builder = self.clone();
6371 builder.0.request = builder.0.request.set_page_token(token);
6372 builder.send()
6373 };
6374 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6375 }
6376
6377 pub fn by_item(
6379 self,
6380 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6381 google_cloud_longrunning::model::ListOperationsResponse,
6382 crate::Error,
6383 > {
6384 use google_cloud_gax::paginator::Paginator;
6385 self.by_page().items()
6386 }
6387
6388 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6390 self.0.request.name = v.into();
6391 self
6392 }
6393
6394 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6396 self.0.request.filter = v.into();
6397 self
6398 }
6399
6400 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6402 self.0.request.page_size = v.into();
6403 self
6404 }
6405
6406 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6408 self.0.request.page_token = v.into();
6409 self
6410 }
6411
6412 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6414 self.0.request.return_partial_success = v.into();
6415 self
6416 }
6417 }
6418
6419 #[doc(hidden)]
6420 impl crate::RequestBuilder for ListOperations {
6421 fn request_options(&mut self) -> &mut crate::RequestOptions {
6422 &mut self.0.options
6423 }
6424 }
6425
6426 #[derive(Clone, Debug)]
6443 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
6444
6445 impl GetOperation {
6446 pub(crate) fn new(
6447 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6448 ) -> Self {
6449 Self(RequestBuilder::new(stub))
6450 }
6451
6452 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
6454 mut self,
6455 v: V,
6456 ) -> Self {
6457 self.0.request = v.into();
6458 self
6459 }
6460
6461 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6463 self.0.options = v.into();
6464 self
6465 }
6466
6467 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6469 (*self.0.stub)
6470 .get_operation(self.0.request, self.0.options)
6471 .await
6472 .map(crate::Response::into_body)
6473 }
6474
6475 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6477 self.0.request.name = v.into();
6478 self
6479 }
6480 }
6481
6482 #[doc(hidden)]
6483 impl crate::RequestBuilder for GetOperation {
6484 fn request_options(&mut self) -> &mut crate::RequestOptions {
6485 &mut self.0.options
6486 }
6487 }
6488
6489 #[derive(Clone, Debug)]
6506 pub struct CancelOperation(
6507 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
6508 );
6509
6510 impl CancelOperation {
6511 pub(crate) fn new(
6512 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6513 ) -> Self {
6514 Self(RequestBuilder::new(stub))
6515 }
6516
6517 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
6519 mut self,
6520 v: V,
6521 ) -> Self {
6522 self.0.request = v.into();
6523 self
6524 }
6525
6526 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6528 self.0.options = v.into();
6529 self
6530 }
6531
6532 pub async fn send(self) -> Result<()> {
6534 (*self.0.stub)
6535 .cancel_operation(self.0.request, self.0.options)
6536 .await
6537 .map(crate::Response::into_body)
6538 }
6539
6540 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6542 self.0.request.name = v.into();
6543 self
6544 }
6545 }
6546
6547 #[doc(hidden)]
6548 impl crate::RequestBuilder for CancelOperation {
6549 fn request_options(&mut self) -> &mut crate::RequestOptions {
6550 &mut self.0.options
6551 }
6552 }
6553}
6554
6555#[cfg(feature = "engine-service")]
6557#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
6558pub mod engine_service {
6559 use crate::Result;
6560
6561 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6575
6576 pub(crate) mod client {
6577 use super::super::super::client::EngineService;
6578 pub struct Factory;
6579 impl crate::ClientFactory for Factory {
6580 type Client = EngineService;
6581 type Credentials = gaxi::options::Credentials;
6582 async fn build(
6583 self,
6584 config: gaxi::options::ClientConfig,
6585 ) -> crate::ClientBuilderResult<Self::Client> {
6586 Self::Client::new(config).await
6587 }
6588 }
6589 }
6590
6591 #[derive(Clone, Debug)]
6593 pub(crate) struct RequestBuilder<R: std::default::Default> {
6594 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6595 request: R,
6596 options: crate::RequestOptions,
6597 }
6598
6599 impl<R> RequestBuilder<R>
6600 where
6601 R: std::default::Default,
6602 {
6603 pub(crate) fn new(
6604 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6605 ) -> Self {
6606 Self {
6607 stub,
6608 request: R::default(),
6609 options: crate::RequestOptions::default(),
6610 }
6611 }
6612 }
6613
6614 #[derive(Clone, Debug)]
6632 pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
6633
6634 impl CreateEngine {
6635 pub(crate) fn new(
6636 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6637 ) -> Self {
6638 Self(RequestBuilder::new(stub))
6639 }
6640
6641 pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
6643 self.0.request = v.into();
6644 self
6645 }
6646
6647 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6649 self.0.options = v.into();
6650 self
6651 }
6652
6653 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6660 (*self.0.stub)
6661 .create_engine(self.0.request, self.0.options)
6662 .await
6663 .map(crate::Response::into_body)
6664 }
6665
6666 pub fn poller(
6668 self,
6669 ) -> impl google_cloud_lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata>
6670 {
6671 type Operation = google_cloud_lro::internal::Operation<
6672 crate::model::Engine,
6673 crate::model::CreateEngineMetadata,
6674 >;
6675 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6676 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6677
6678 let stub = self.0.stub.clone();
6679 let mut options = self.0.options.clone();
6680 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6681 let query = move |name| {
6682 let stub = stub.clone();
6683 let options = options.clone();
6684 async {
6685 let op = GetOperation::new(stub)
6686 .set_name(name)
6687 .with_options(options)
6688 .send()
6689 .await?;
6690 Ok(Operation::new(op))
6691 }
6692 };
6693
6694 let start = move || async {
6695 let op = self.send().await?;
6696 Ok(Operation::new(op))
6697 };
6698
6699 google_cloud_lro::internal::new_poller(
6700 polling_error_policy,
6701 polling_backoff_policy,
6702 start,
6703 query,
6704 )
6705 }
6706
6707 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6711 self.0.request.parent = v.into();
6712 self
6713 }
6714
6715 pub fn set_engine<T>(mut self, v: T) -> Self
6719 where
6720 T: std::convert::Into<crate::model::Engine>,
6721 {
6722 self.0.request.engine = std::option::Option::Some(v.into());
6723 self
6724 }
6725
6726 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6730 where
6731 T: std::convert::Into<crate::model::Engine>,
6732 {
6733 self.0.request.engine = v.map(|x| x.into());
6734 self
6735 }
6736
6737 pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6741 self.0.request.engine_id = v.into();
6742 self
6743 }
6744 }
6745
6746 #[doc(hidden)]
6747 impl crate::RequestBuilder for CreateEngine {
6748 fn request_options(&mut self) -> &mut crate::RequestOptions {
6749 &mut self.0.options
6750 }
6751 }
6752
6753 #[derive(Clone, Debug)]
6771 pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
6772
6773 impl DeleteEngine {
6774 pub(crate) fn new(
6775 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6776 ) -> Self {
6777 Self(RequestBuilder::new(stub))
6778 }
6779
6780 pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
6782 self.0.request = v.into();
6783 self
6784 }
6785
6786 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6788 self.0.options = v.into();
6789 self
6790 }
6791
6792 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6799 (*self.0.stub)
6800 .delete_engine(self.0.request, self.0.options)
6801 .await
6802 .map(crate::Response::into_body)
6803 }
6804
6805 pub fn poller(
6807 self,
6808 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteEngineMetadata> {
6809 type Operation = google_cloud_lro::internal::Operation<
6810 wkt::Empty,
6811 crate::model::DeleteEngineMetadata,
6812 >;
6813 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6814 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6815
6816 let stub = self.0.stub.clone();
6817 let mut options = self.0.options.clone();
6818 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6819 let query = move |name| {
6820 let stub = stub.clone();
6821 let options = options.clone();
6822 async {
6823 let op = GetOperation::new(stub)
6824 .set_name(name)
6825 .with_options(options)
6826 .send()
6827 .await?;
6828 Ok(Operation::new(op))
6829 }
6830 };
6831
6832 let start = move || async {
6833 let op = self.send().await?;
6834 Ok(Operation::new(op))
6835 };
6836
6837 google_cloud_lro::internal::new_unit_response_poller(
6838 polling_error_policy,
6839 polling_backoff_policy,
6840 start,
6841 query,
6842 )
6843 }
6844
6845 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6849 self.0.request.name = v.into();
6850 self
6851 }
6852 }
6853
6854 #[doc(hidden)]
6855 impl crate::RequestBuilder for DeleteEngine {
6856 fn request_options(&mut self) -> &mut crate::RequestOptions {
6857 &mut self.0.options
6858 }
6859 }
6860
6861 #[derive(Clone, Debug)]
6878 pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
6879
6880 impl UpdateEngine {
6881 pub(crate) fn new(
6882 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6883 ) -> Self {
6884 Self(RequestBuilder::new(stub))
6885 }
6886
6887 pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
6889 self.0.request = v.into();
6890 self
6891 }
6892
6893 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6895 self.0.options = v.into();
6896 self
6897 }
6898
6899 pub async fn send(self) -> Result<crate::model::Engine> {
6901 (*self.0.stub)
6902 .update_engine(self.0.request, self.0.options)
6903 .await
6904 .map(crate::Response::into_body)
6905 }
6906
6907 pub fn set_engine<T>(mut self, v: T) -> Self
6911 where
6912 T: std::convert::Into<crate::model::Engine>,
6913 {
6914 self.0.request.engine = std::option::Option::Some(v.into());
6915 self
6916 }
6917
6918 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6922 where
6923 T: std::convert::Into<crate::model::Engine>,
6924 {
6925 self.0.request.engine = v.map(|x| x.into());
6926 self
6927 }
6928
6929 pub fn set_update_mask<T>(mut self, v: T) -> Self
6931 where
6932 T: std::convert::Into<wkt::FieldMask>,
6933 {
6934 self.0.request.update_mask = std::option::Option::Some(v.into());
6935 self
6936 }
6937
6938 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6940 where
6941 T: std::convert::Into<wkt::FieldMask>,
6942 {
6943 self.0.request.update_mask = v.map(|x| x.into());
6944 self
6945 }
6946 }
6947
6948 #[doc(hidden)]
6949 impl crate::RequestBuilder for UpdateEngine {
6950 fn request_options(&mut self) -> &mut crate::RequestOptions {
6951 &mut self.0.options
6952 }
6953 }
6954
6955 #[derive(Clone, Debug)]
6972 pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
6973
6974 impl GetEngine {
6975 pub(crate) fn new(
6976 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6977 ) -> Self {
6978 Self(RequestBuilder::new(stub))
6979 }
6980
6981 pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
6983 self.0.request = v.into();
6984 self
6985 }
6986
6987 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6989 self.0.options = v.into();
6990 self
6991 }
6992
6993 pub async fn send(self) -> Result<crate::model::Engine> {
6995 (*self.0.stub)
6996 .get_engine(self.0.request, self.0.options)
6997 .await
6998 .map(crate::Response::into_body)
6999 }
7000
7001 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7005 self.0.request.name = v.into();
7006 self
7007 }
7008 }
7009
7010 #[doc(hidden)]
7011 impl crate::RequestBuilder for GetEngine {
7012 fn request_options(&mut self) -> &mut crate::RequestOptions {
7013 &mut self.0.options
7014 }
7015 }
7016
7017 #[derive(Clone, Debug)]
7038 pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
7039
7040 impl ListEngines {
7041 pub(crate) fn new(
7042 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7043 ) -> Self {
7044 Self(RequestBuilder::new(stub))
7045 }
7046
7047 pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
7049 self.0.request = v.into();
7050 self
7051 }
7052
7053 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7055 self.0.options = v.into();
7056 self
7057 }
7058
7059 pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
7061 (*self.0.stub)
7062 .list_engines(self.0.request, self.0.options)
7063 .await
7064 .map(crate::Response::into_body)
7065 }
7066
7067 pub fn by_page(
7069 self,
7070 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListEnginesResponse, crate::Error>
7071 {
7072 use std::clone::Clone;
7073 let token = self.0.request.page_token.clone();
7074 let execute = move |token: String| {
7075 let mut builder = self.clone();
7076 builder.0.request = builder.0.request.set_page_token(token);
7077 builder.send()
7078 };
7079 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7080 }
7081
7082 pub fn by_item(
7084 self,
7085 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7086 crate::model::ListEnginesResponse,
7087 crate::Error,
7088 > {
7089 use google_cloud_gax::paginator::Paginator;
7090 self.by_page().items()
7091 }
7092
7093 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7097 self.0.request.parent = v.into();
7098 self
7099 }
7100
7101 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7103 self.0.request.page_size = v.into();
7104 self
7105 }
7106
7107 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7109 self.0.request.page_token = v.into();
7110 self
7111 }
7112
7113 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7115 self.0.request.filter = v.into();
7116 self
7117 }
7118 }
7119
7120 #[doc(hidden)]
7121 impl crate::RequestBuilder for ListEngines {
7122 fn request_options(&mut self) -> &mut crate::RequestOptions {
7123 &mut self.0.options
7124 }
7125 }
7126
7127 #[derive(Clone, Debug)]
7148 pub struct ListOperations(
7149 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7150 );
7151
7152 impl ListOperations {
7153 pub(crate) fn new(
7154 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7155 ) -> Self {
7156 Self(RequestBuilder::new(stub))
7157 }
7158
7159 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7161 mut self,
7162 v: V,
7163 ) -> Self {
7164 self.0.request = v.into();
7165 self
7166 }
7167
7168 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7170 self.0.options = v.into();
7171 self
7172 }
7173
7174 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7176 (*self.0.stub)
7177 .list_operations(self.0.request, self.0.options)
7178 .await
7179 .map(crate::Response::into_body)
7180 }
7181
7182 pub fn by_page(
7184 self,
7185 ) -> impl google_cloud_gax::paginator::Paginator<
7186 google_cloud_longrunning::model::ListOperationsResponse,
7187 crate::Error,
7188 > {
7189 use std::clone::Clone;
7190 let token = self.0.request.page_token.clone();
7191 let execute = move |token: String| {
7192 let mut builder = self.clone();
7193 builder.0.request = builder.0.request.set_page_token(token);
7194 builder.send()
7195 };
7196 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7197 }
7198
7199 pub fn by_item(
7201 self,
7202 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7203 google_cloud_longrunning::model::ListOperationsResponse,
7204 crate::Error,
7205 > {
7206 use google_cloud_gax::paginator::Paginator;
7207 self.by_page().items()
7208 }
7209
7210 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7212 self.0.request.name = v.into();
7213 self
7214 }
7215
7216 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7218 self.0.request.filter = v.into();
7219 self
7220 }
7221
7222 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7224 self.0.request.page_size = v.into();
7225 self
7226 }
7227
7228 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7230 self.0.request.page_token = v.into();
7231 self
7232 }
7233
7234 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7236 self.0.request.return_partial_success = v.into();
7237 self
7238 }
7239 }
7240
7241 #[doc(hidden)]
7242 impl crate::RequestBuilder for ListOperations {
7243 fn request_options(&mut self) -> &mut crate::RequestOptions {
7244 &mut self.0.options
7245 }
7246 }
7247
7248 #[derive(Clone, Debug)]
7265 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7266
7267 impl GetOperation {
7268 pub(crate) fn new(
7269 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7270 ) -> Self {
7271 Self(RequestBuilder::new(stub))
7272 }
7273
7274 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7276 mut self,
7277 v: V,
7278 ) -> Self {
7279 self.0.request = v.into();
7280 self
7281 }
7282
7283 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7285 self.0.options = v.into();
7286 self
7287 }
7288
7289 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7291 (*self.0.stub)
7292 .get_operation(self.0.request, self.0.options)
7293 .await
7294 .map(crate::Response::into_body)
7295 }
7296
7297 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7299 self.0.request.name = v.into();
7300 self
7301 }
7302 }
7303
7304 #[doc(hidden)]
7305 impl crate::RequestBuilder for GetOperation {
7306 fn request_options(&mut self) -> &mut crate::RequestOptions {
7307 &mut self.0.options
7308 }
7309 }
7310
7311 #[derive(Clone, Debug)]
7328 pub struct CancelOperation(
7329 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7330 );
7331
7332 impl CancelOperation {
7333 pub(crate) fn new(
7334 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7335 ) -> Self {
7336 Self(RequestBuilder::new(stub))
7337 }
7338
7339 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7341 mut self,
7342 v: V,
7343 ) -> Self {
7344 self.0.request = v.into();
7345 self
7346 }
7347
7348 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7350 self.0.options = v.into();
7351 self
7352 }
7353
7354 pub async fn send(self) -> Result<()> {
7356 (*self.0.stub)
7357 .cancel_operation(self.0.request, self.0.options)
7358 .await
7359 .map(crate::Response::into_body)
7360 }
7361
7362 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7364 self.0.request.name = v.into();
7365 self
7366 }
7367 }
7368
7369 #[doc(hidden)]
7370 impl crate::RequestBuilder for CancelOperation {
7371 fn request_options(&mut self) -> &mut crate::RequestOptions {
7372 &mut self.0.options
7373 }
7374 }
7375}
7376
7377#[cfg(feature = "grounded-generation-service")]
7379#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7380pub mod grounded_generation_service {
7381 use crate::Result;
7382
7383 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7397
7398 pub(crate) mod client {
7399 use super::super::super::client::GroundedGenerationService;
7400 pub struct Factory;
7401 impl crate::ClientFactory for Factory {
7402 type Client = GroundedGenerationService;
7403 type Credentials = gaxi::options::Credentials;
7404 async fn build(
7405 self,
7406 config: gaxi::options::ClientConfig,
7407 ) -> crate::ClientBuilderResult<Self::Client> {
7408 Self::Client::new(config).await
7409 }
7410 }
7411 }
7412
7413 #[derive(Clone, Debug)]
7415 pub(crate) struct RequestBuilder<R: std::default::Default> {
7416 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7417 request: R,
7418 options: crate::RequestOptions,
7419 }
7420
7421 impl<R> RequestBuilder<R>
7422 where
7423 R: std::default::Default,
7424 {
7425 pub(crate) fn new(
7426 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7427 ) -> Self {
7428 Self {
7429 stub,
7430 request: R::default(),
7431 options: crate::RequestOptions::default(),
7432 }
7433 }
7434 }
7435
7436 #[derive(Clone, Debug)]
7453 pub struct GenerateGroundedContent(
7454 RequestBuilder<crate::model::GenerateGroundedContentRequest>,
7455 );
7456
7457 impl GenerateGroundedContent {
7458 pub(crate) fn new(
7459 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7460 ) -> Self {
7461 Self(RequestBuilder::new(stub))
7462 }
7463
7464 pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
7466 mut self,
7467 v: V,
7468 ) -> Self {
7469 self.0.request = v.into();
7470 self
7471 }
7472
7473 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7475 self.0.options = v.into();
7476 self
7477 }
7478
7479 pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
7481 (*self.0.stub)
7482 .generate_grounded_content(self.0.request, self.0.options)
7483 .await
7484 .map(crate::Response::into_body)
7485 }
7486
7487 pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7491 self.0.request.location = v.into();
7492 self
7493 }
7494
7495 pub fn set_system_instruction<T>(mut self, v: T) -> Self
7497 where
7498 T: std::convert::Into<crate::model::GroundedGenerationContent>,
7499 {
7500 self.0.request.system_instruction = std::option::Option::Some(v.into());
7501 self
7502 }
7503
7504 pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
7506 where
7507 T: std::convert::Into<crate::model::GroundedGenerationContent>,
7508 {
7509 self.0.request.system_instruction = v.map(|x| x.into());
7510 self
7511 }
7512
7513 pub fn set_contents<T, V>(mut self, v: T) -> Self
7515 where
7516 T: std::iter::IntoIterator<Item = V>,
7517 V: std::convert::Into<crate::model::GroundedGenerationContent>,
7518 {
7519 use std::iter::Iterator;
7520 self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
7521 self
7522 }
7523
7524 pub fn set_generation_spec<T>(mut self, v: T) -> Self
7526 where
7527 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7528 {
7529 self.0.request.generation_spec = std::option::Option::Some(v.into());
7530 self
7531 }
7532
7533 pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7535 where
7536 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7537 {
7538 self.0.request.generation_spec = v.map(|x| x.into());
7539 self
7540 }
7541
7542 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7544 where
7545 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7546 {
7547 self.0.request.grounding_spec = std::option::Option::Some(v.into());
7548 self
7549 }
7550
7551 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7553 where
7554 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7555 {
7556 self.0.request.grounding_spec = v.map(|x| x.into());
7557 self
7558 }
7559
7560 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7562 where
7563 T: std::iter::IntoIterator<Item = (K, V)>,
7564 K: std::convert::Into<std::string::String>,
7565 V: std::convert::Into<std::string::String>,
7566 {
7567 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7568 self
7569 }
7570 }
7571
7572 #[doc(hidden)]
7573 impl crate::RequestBuilder for GenerateGroundedContent {
7574 fn request_options(&mut self) -> &mut crate::RequestOptions {
7575 &mut self.0.options
7576 }
7577 }
7578
7579 #[derive(Clone, Debug)]
7596 pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
7597
7598 impl CheckGrounding {
7599 pub(crate) fn new(
7600 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7601 ) -> Self {
7602 Self(RequestBuilder::new(stub))
7603 }
7604
7605 pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
7607 self.0.request = v.into();
7608 self
7609 }
7610
7611 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7613 self.0.options = v.into();
7614 self
7615 }
7616
7617 pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
7619 (*self.0.stub)
7620 .check_grounding(self.0.request, self.0.options)
7621 .await
7622 .map(crate::Response::into_body)
7623 }
7624
7625 pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7629 self.0.request.grounding_config = v.into();
7630 self
7631 }
7632
7633 pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
7635 self.0.request.answer_candidate = v.into();
7636 self
7637 }
7638
7639 pub fn set_facts<T, V>(mut self, v: T) -> Self
7641 where
7642 T: std::iter::IntoIterator<Item = V>,
7643 V: std::convert::Into<crate::model::GroundingFact>,
7644 {
7645 use std::iter::Iterator;
7646 self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
7647 self
7648 }
7649
7650 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7652 where
7653 T: std::convert::Into<crate::model::CheckGroundingSpec>,
7654 {
7655 self.0.request.grounding_spec = std::option::Option::Some(v.into());
7656 self
7657 }
7658
7659 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7661 where
7662 T: std::convert::Into<crate::model::CheckGroundingSpec>,
7663 {
7664 self.0.request.grounding_spec = v.map(|x| x.into());
7665 self
7666 }
7667
7668 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7670 where
7671 T: std::iter::IntoIterator<Item = (K, V)>,
7672 K: std::convert::Into<std::string::String>,
7673 V: std::convert::Into<std::string::String>,
7674 {
7675 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7676 self
7677 }
7678 }
7679
7680 #[doc(hidden)]
7681 impl crate::RequestBuilder for CheckGrounding {
7682 fn request_options(&mut self) -> &mut crate::RequestOptions {
7683 &mut self.0.options
7684 }
7685 }
7686
7687 #[derive(Clone, Debug)]
7708 pub struct ListOperations(
7709 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
7710 );
7711
7712 impl ListOperations {
7713 pub(crate) fn new(
7714 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7715 ) -> Self {
7716 Self(RequestBuilder::new(stub))
7717 }
7718
7719 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
7721 mut self,
7722 v: V,
7723 ) -> Self {
7724 self.0.request = v.into();
7725 self
7726 }
7727
7728 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7730 self.0.options = v.into();
7731 self
7732 }
7733
7734 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
7736 (*self.0.stub)
7737 .list_operations(self.0.request, self.0.options)
7738 .await
7739 .map(crate::Response::into_body)
7740 }
7741
7742 pub fn by_page(
7744 self,
7745 ) -> impl google_cloud_gax::paginator::Paginator<
7746 google_cloud_longrunning::model::ListOperationsResponse,
7747 crate::Error,
7748 > {
7749 use std::clone::Clone;
7750 let token = self.0.request.page_token.clone();
7751 let execute = move |token: String| {
7752 let mut builder = self.clone();
7753 builder.0.request = builder.0.request.set_page_token(token);
7754 builder.send()
7755 };
7756 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7757 }
7758
7759 pub fn by_item(
7761 self,
7762 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7763 google_cloud_longrunning::model::ListOperationsResponse,
7764 crate::Error,
7765 > {
7766 use google_cloud_gax::paginator::Paginator;
7767 self.by_page().items()
7768 }
7769
7770 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7772 self.0.request.name = v.into();
7773 self
7774 }
7775
7776 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7778 self.0.request.filter = v.into();
7779 self
7780 }
7781
7782 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7784 self.0.request.page_size = v.into();
7785 self
7786 }
7787
7788 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7790 self.0.request.page_token = v.into();
7791 self
7792 }
7793
7794 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7796 self.0.request.return_partial_success = v.into();
7797 self
7798 }
7799 }
7800
7801 #[doc(hidden)]
7802 impl crate::RequestBuilder for ListOperations {
7803 fn request_options(&mut self) -> &mut crate::RequestOptions {
7804 &mut self.0.options
7805 }
7806 }
7807
7808 #[derive(Clone, Debug)]
7825 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7826
7827 impl GetOperation {
7828 pub(crate) fn new(
7829 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7830 ) -> Self {
7831 Self(RequestBuilder::new(stub))
7832 }
7833
7834 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7836 mut self,
7837 v: V,
7838 ) -> Self {
7839 self.0.request = v.into();
7840 self
7841 }
7842
7843 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7845 self.0.options = v.into();
7846 self
7847 }
7848
7849 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7851 (*self.0.stub)
7852 .get_operation(self.0.request, self.0.options)
7853 .await
7854 .map(crate::Response::into_body)
7855 }
7856
7857 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7859 self.0.request.name = v.into();
7860 self
7861 }
7862 }
7863
7864 #[doc(hidden)]
7865 impl crate::RequestBuilder for GetOperation {
7866 fn request_options(&mut self) -> &mut crate::RequestOptions {
7867 &mut self.0.options
7868 }
7869 }
7870
7871 #[derive(Clone, Debug)]
7888 pub struct CancelOperation(
7889 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7890 );
7891
7892 impl CancelOperation {
7893 pub(crate) fn new(
7894 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7895 ) -> Self {
7896 Self(RequestBuilder::new(stub))
7897 }
7898
7899 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7901 mut self,
7902 v: V,
7903 ) -> Self {
7904 self.0.request = v.into();
7905 self
7906 }
7907
7908 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7910 self.0.options = v.into();
7911 self
7912 }
7913
7914 pub async fn send(self) -> Result<()> {
7916 (*self.0.stub)
7917 .cancel_operation(self.0.request, self.0.options)
7918 .await
7919 .map(crate::Response::into_body)
7920 }
7921
7922 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7924 self.0.request.name = v.into();
7925 self
7926 }
7927 }
7928
7929 #[doc(hidden)]
7930 impl crate::RequestBuilder for CancelOperation {
7931 fn request_options(&mut self) -> &mut crate::RequestOptions {
7932 &mut self.0.options
7933 }
7934 }
7935}
7936
7937#[cfg(feature = "identity-mapping-store-service")]
7939#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
7940pub mod identity_mapping_store_service {
7941 use crate::Result;
7942
7943 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7957
7958 pub(crate) mod client {
7959 use super::super::super::client::IdentityMappingStoreService;
7960 pub struct Factory;
7961 impl crate::ClientFactory for Factory {
7962 type Client = IdentityMappingStoreService;
7963 type Credentials = gaxi::options::Credentials;
7964 async fn build(
7965 self,
7966 config: gaxi::options::ClientConfig,
7967 ) -> crate::ClientBuilderResult<Self::Client> {
7968 Self::Client::new(config).await
7969 }
7970 }
7971 }
7972
7973 #[derive(Clone, Debug)]
7975 pub(crate) struct RequestBuilder<R: std::default::Default> {
7976 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7977 request: R,
7978 options: crate::RequestOptions,
7979 }
7980
7981 impl<R> RequestBuilder<R>
7982 where
7983 R: std::default::Default,
7984 {
7985 pub(crate) fn new(
7986 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7987 ) -> Self {
7988 Self {
7989 stub,
7990 request: R::default(),
7991 options: crate::RequestOptions::default(),
7992 }
7993 }
7994 }
7995
7996 #[derive(Clone, Debug)]
8013 pub struct CreateIdentityMappingStore(
8014 RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
8015 );
8016
8017 impl CreateIdentityMappingStore {
8018 pub(crate) fn new(
8019 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8020 ) -> Self {
8021 Self(RequestBuilder::new(stub))
8022 }
8023
8024 pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
8026 mut self,
8027 v: V,
8028 ) -> Self {
8029 self.0.request = v.into();
8030 self
8031 }
8032
8033 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8035 self.0.options = v.into();
8036 self
8037 }
8038
8039 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8041 (*self.0.stub)
8042 .create_identity_mapping_store(self.0.request, self.0.options)
8043 .await
8044 .map(crate::Response::into_body)
8045 }
8046
8047 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8051 self.0.request.parent = v.into();
8052 self
8053 }
8054
8055 pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
8059 self.0.request.identity_mapping_store_id = v.into();
8060 self
8061 }
8062
8063 pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
8067 where
8068 T: std::convert::Into<crate::model::IdentityMappingStore>,
8069 {
8070 self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
8071 self
8072 }
8073
8074 pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
8078 where
8079 T: std::convert::Into<crate::model::IdentityMappingStore>,
8080 {
8081 self.0.request.identity_mapping_store = v.map(|x| x.into());
8082 self
8083 }
8084
8085 pub fn set_cmek_options<
8090 T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
8091 >(
8092 mut self,
8093 v: T,
8094 ) -> Self {
8095 self.0.request.cmek_options = v.into();
8096 self
8097 }
8098
8099 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
8105 mut self,
8106 v: T,
8107 ) -> Self {
8108 self.0.request = self.0.request.set_cmek_config_name(v);
8109 self
8110 }
8111
8112 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8118 self.0.request = self.0.request.set_disable_cmek(v);
8119 self
8120 }
8121 }
8122
8123 #[doc(hidden)]
8124 impl crate::RequestBuilder for CreateIdentityMappingStore {
8125 fn request_options(&mut self) -> &mut crate::RequestOptions {
8126 &mut self.0.options
8127 }
8128 }
8129
8130 #[derive(Clone, Debug)]
8147 pub struct GetIdentityMappingStore(
8148 RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8149 );
8150
8151 impl GetIdentityMappingStore {
8152 pub(crate) fn new(
8153 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8154 ) -> Self {
8155 Self(RequestBuilder::new(stub))
8156 }
8157
8158 pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8160 mut self,
8161 v: V,
8162 ) -> Self {
8163 self.0.request = v.into();
8164 self
8165 }
8166
8167 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8169 self.0.options = v.into();
8170 self
8171 }
8172
8173 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8175 (*self.0.stub)
8176 .get_identity_mapping_store(self.0.request, self.0.options)
8177 .await
8178 .map(crate::Response::into_body)
8179 }
8180
8181 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8185 self.0.request.name = v.into();
8186 self
8187 }
8188 }
8189
8190 #[doc(hidden)]
8191 impl crate::RequestBuilder for GetIdentityMappingStore {
8192 fn request_options(&mut self) -> &mut crate::RequestOptions {
8193 &mut self.0.options
8194 }
8195 }
8196
8197 #[derive(Clone, Debug)]
8215 pub struct DeleteIdentityMappingStore(
8216 RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8217 );
8218
8219 impl DeleteIdentityMappingStore {
8220 pub(crate) fn new(
8221 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8222 ) -> Self {
8223 Self(RequestBuilder::new(stub))
8224 }
8225
8226 pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8228 mut self,
8229 v: V,
8230 ) -> Self {
8231 self.0.request = v.into();
8232 self
8233 }
8234
8235 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8237 self.0.options = v.into();
8238 self
8239 }
8240
8241 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8248 (*self.0.stub)
8249 .delete_identity_mapping_store(self.0.request, self.0.options)
8250 .await
8251 .map(crate::Response::into_body)
8252 }
8253
8254 pub fn poller(
8256 self,
8257 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata>
8258 {
8259 type Operation = google_cloud_lro::internal::Operation<
8260 wkt::Empty,
8261 crate::model::DeleteIdentityMappingStoreMetadata,
8262 >;
8263 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8264 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8265
8266 let stub = self.0.stub.clone();
8267 let mut options = self.0.options.clone();
8268 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8269 let query = move |name| {
8270 let stub = stub.clone();
8271 let options = options.clone();
8272 async {
8273 let op = GetOperation::new(stub)
8274 .set_name(name)
8275 .with_options(options)
8276 .send()
8277 .await?;
8278 Ok(Operation::new(op))
8279 }
8280 };
8281
8282 let start = move || async {
8283 let op = self.send().await?;
8284 Ok(Operation::new(op))
8285 };
8286
8287 google_cloud_lro::internal::new_unit_response_poller(
8288 polling_error_policy,
8289 polling_backoff_policy,
8290 start,
8291 query,
8292 )
8293 }
8294
8295 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8299 self.0.request.name = v.into();
8300 self
8301 }
8302 }
8303
8304 #[doc(hidden)]
8305 impl crate::RequestBuilder for DeleteIdentityMappingStore {
8306 fn request_options(&mut self) -> &mut crate::RequestOptions {
8307 &mut self.0.options
8308 }
8309 }
8310
8311 #[derive(Clone, Debug)]
8329 pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8330
8331 impl ImportIdentityMappings {
8332 pub(crate) fn new(
8333 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8334 ) -> Self {
8335 Self(RequestBuilder::new(stub))
8336 }
8337
8338 pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8340 mut self,
8341 v: V,
8342 ) -> Self {
8343 self.0.request = v.into();
8344 self
8345 }
8346
8347 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8349 self.0.options = v.into();
8350 self
8351 }
8352
8353 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8360 (*self.0.stub)
8361 .import_identity_mappings(self.0.request, self.0.options)
8362 .await
8363 .map(crate::Response::into_body)
8364 }
8365
8366 pub fn poller(
8368 self,
8369 ) -> impl google_cloud_lro::Poller<
8370 crate::model::ImportIdentityMappingsResponse,
8371 crate::model::IdentityMappingEntryOperationMetadata,
8372 > {
8373 type Operation = google_cloud_lro::internal::Operation<
8374 crate::model::ImportIdentityMappingsResponse,
8375 crate::model::IdentityMappingEntryOperationMetadata,
8376 >;
8377 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8378 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8379
8380 let stub = self.0.stub.clone();
8381 let mut options = self.0.options.clone();
8382 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8383 let query = move |name| {
8384 let stub = stub.clone();
8385 let options = options.clone();
8386 async {
8387 let op = GetOperation::new(stub)
8388 .set_name(name)
8389 .with_options(options)
8390 .send()
8391 .await?;
8392 Ok(Operation::new(op))
8393 }
8394 };
8395
8396 let start = move || async {
8397 let op = self.send().await?;
8398 Ok(Operation::new(op))
8399 };
8400
8401 google_cloud_lro::internal::new_poller(
8402 polling_error_policy,
8403 polling_backoff_policy,
8404 start,
8405 query,
8406 )
8407 }
8408
8409 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8413 self.0.request.identity_mapping_store = v.into();
8414 self
8415 }
8416
8417 pub fn set_source<
8422 T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
8423 >(
8424 mut self,
8425 v: T,
8426 ) -> Self {
8427 self.0.request.source = v.into();
8428 self
8429 }
8430
8431 pub fn set_inline_source<
8437 T: std::convert::Into<
8438 std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
8439 >,
8440 >(
8441 mut self,
8442 v: T,
8443 ) -> Self {
8444 self.0.request = self.0.request.set_inline_source(v);
8445 self
8446 }
8447 }
8448
8449 #[doc(hidden)]
8450 impl crate::RequestBuilder for ImportIdentityMappings {
8451 fn request_options(&mut self) -> &mut crate::RequestOptions {
8452 &mut self.0.options
8453 }
8454 }
8455
8456 #[derive(Clone, Debug)]
8474 pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
8475
8476 impl PurgeIdentityMappings {
8477 pub(crate) fn new(
8478 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8479 ) -> Self {
8480 Self(RequestBuilder::new(stub))
8481 }
8482
8483 pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
8485 mut self,
8486 v: V,
8487 ) -> Self {
8488 self.0.request = v.into();
8489 self
8490 }
8491
8492 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8494 self.0.options = v.into();
8495 self
8496 }
8497
8498 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8505 (*self.0.stub)
8506 .purge_identity_mappings(self.0.request, self.0.options)
8507 .await
8508 .map(crate::Response::into_body)
8509 }
8510
8511 pub fn poller(
8513 self,
8514 ) -> impl google_cloud_lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata>
8515 {
8516 type Operation = google_cloud_lro::internal::Operation<
8517 wkt::Empty,
8518 crate::model::IdentityMappingEntryOperationMetadata,
8519 >;
8520 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8521 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8522
8523 let stub = self.0.stub.clone();
8524 let mut options = self.0.options.clone();
8525 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8526 let query = move |name| {
8527 let stub = stub.clone();
8528 let options = options.clone();
8529 async {
8530 let op = GetOperation::new(stub)
8531 .set_name(name)
8532 .with_options(options)
8533 .send()
8534 .await?;
8535 Ok(Operation::new(op))
8536 }
8537 };
8538
8539 let start = move || async {
8540 let op = self.send().await?;
8541 Ok(Operation::new(op))
8542 };
8543
8544 google_cloud_lro::internal::new_unit_response_poller(
8545 polling_error_policy,
8546 polling_backoff_policy,
8547 start,
8548 query,
8549 )
8550 }
8551
8552 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8556 self.0.request.identity_mapping_store = v.into();
8557 self
8558 }
8559
8560 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8562 self.0.request.filter = v.into();
8563 self
8564 }
8565
8566 pub fn set_force<T>(mut self, v: T) -> Self
8568 where
8569 T: std::convert::Into<bool>,
8570 {
8571 self.0.request.force = std::option::Option::Some(v.into());
8572 self
8573 }
8574
8575 pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
8577 where
8578 T: std::convert::Into<bool>,
8579 {
8580 self.0.request.force = v.map(|x| x.into());
8581 self
8582 }
8583
8584 pub fn set_source<
8589 T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
8590 >(
8591 mut self,
8592 v: T,
8593 ) -> Self {
8594 self.0.request.source = v.into();
8595 self
8596 }
8597
8598 pub fn set_inline_source<
8604 T: std::convert::Into<
8605 std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
8606 >,
8607 >(
8608 mut self,
8609 v: T,
8610 ) -> Self {
8611 self.0.request = self.0.request.set_inline_source(v);
8612 self
8613 }
8614 }
8615
8616 #[doc(hidden)]
8617 impl crate::RequestBuilder for PurgeIdentityMappings {
8618 fn request_options(&mut self) -> &mut crate::RequestOptions {
8619 &mut self.0.options
8620 }
8621 }
8622
8623 #[derive(Clone, Debug)]
8644 pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
8645
8646 impl ListIdentityMappings {
8647 pub(crate) fn new(
8648 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8649 ) -> Self {
8650 Self(RequestBuilder::new(stub))
8651 }
8652
8653 pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
8655 mut self,
8656 v: V,
8657 ) -> Self {
8658 self.0.request = v.into();
8659 self
8660 }
8661
8662 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8664 self.0.options = v.into();
8665 self
8666 }
8667
8668 pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
8670 (*self.0.stub)
8671 .list_identity_mappings(self.0.request, self.0.options)
8672 .await
8673 .map(crate::Response::into_body)
8674 }
8675
8676 pub fn by_page(
8678 self,
8679 ) -> impl google_cloud_gax::paginator::Paginator<
8680 crate::model::ListIdentityMappingsResponse,
8681 crate::Error,
8682 > {
8683 use std::clone::Clone;
8684 let token = self.0.request.page_token.clone();
8685 let execute = move |token: String| {
8686 let mut builder = self.clone();
8687 builder.0.request = builder.0.request.set_page_token(token);
8688 builder.send()
8689 };
8690 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8691 }
8692
8693 pub fn by_item(
8695 self,
8696 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8697 crate::model::ListIdentityMappingsResponse,
8698 crate::Error,
8699 > {
8700 use google_cloud_gax::paginator::Paginator;
8701 self.by_page().items()
8702 }
8703
8704 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8708 self.0.request.identity_mapping_store = v.into();
8709 self
8710 }
8711
8712 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8714 self.0.request.page_size = v.into();
8715 self
8716 }
8717
8718 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8720 self.0.request.page_token = v.into();
8721 self
8722 }
8723 }
8724
8725 #[doc(hidden)]
8726 impl crate::RequestBuilder for ListIdentityMappings {
8727 fn request_options(&mut self) -> &mut crate::RequestOptions {
8728 &mut self.0.options
8729 }
8730 }
8731
8732 #[derive(Clone, Debug)]
8753 pub struct ListIdentityMappingStores(
8754 RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
8755 );
8756
8757 impl ListIdentityMappingStores {
8758 pub(crate) fn new(
8759 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8760 ) -> Self {
8761 Self(RequestBuilder::new(stub))
8762 }
8763
8764 pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
8766 mut self,
8767 v: V,
8768 ) -> Self {
8769 self.0.request = v.into();
8770 self
8771 }
8772
8773 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8775 self.0.options = v.into();
8776 self
8777 }
8778
8779 pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
8781 (*self.0.stub)
8782 .list_identity_mapping_stores(self.0.request, self.0.options)
8783 .await
8784 .map(crate::Response::into_body)
8785 }
8786
8787 pub fn by_page(
8789 self,
8790 ) -> impl google_cloud_gax::paginator::Paginator<
8791 crate::model::ListIdentityMappingStoresResponse,
8792 crate::Error,
8793 > {
8794 use std::clone::Clone;
8795 let token = self.0.request.page_token.clone();
8796 let execute = move |token: String| {
8797 let mut builder = self.clone();
8798 builder.0.request = builder.0.request.set_page_token(token);
8799 builder.send()
8800 };
8801 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8802 }
8803
8804 pub fn by_item(
8806 self,
8807 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8808 crate::model::ListIdentityMappingStoresResponse,
8809 crate::Error,
8810 > {
8811 use google_cloud_gax::paginator::Paginator;
8812 self.by_page().items()
8813 }
8814
8815 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8819 self.0.request.parent = v.into();
8820 self
8821 }
8822
8823 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8825 self.0.request.page_size = v.into();
8826 self
8827 }
8828
8829 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8831 self.0.request.page_token = v.into();
8832 self
8833 }
8834 }
8835
8836 #[doc(hidden)]
8837 impl crate::RequestBuilder for ListIdentityMappingStores {
8838 fn request_options(&mut self) -> &mut crate::RequestOptions {
8839 &mut self.0.options
8840 }
8841 }
8842
8843 #[derive(Clone, Debug)]
8864 pub struct ListOperations(
8865 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8866 );
8867
8868 impl ListOperations {
8869 pub(crate) fn new(
8870 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8871 ) -> Self {
8872 Self(RequestBuilder::new(stub))
8873 }
8874
8875 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8877 mut self,
8878 v: V,
8879 ) -> Self {
8880 self.0.request = v.into();
8881 self
8882 }
8883
8884 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8886 self.0.options = v.into();
8887 self
8888 }
8889
8890 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8892 (*self.0.stub)
8893 .list_operations(self.0.request, self.0.options)
8894 .await
8895 .map(crate::Response::into_body)
8896 }
8897
8898 pub fn by_page(
8900 self,
8901 ) -> impl google_cloud_gax::paginator::Paginator<
8902 google_cloud_longrunning::model::ListOperationsResponse,
8903 crate::Error,
8904 > {
8905 use std::clone::Clone;
8906 let token = self.0.request.page_token.clone();
8907 let execute = move |token: String| {
8908 let mut builder = self.clone();
8909 builder.0.request = builder.0.request.set_page_token(token);
8910 builder.send()
8911 };
8912 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8913 }
8914
8915 pub fn by_item(
8917 self,
8918 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8919 google_cloud_longrunning::model::ListOperationsResponse,
8920 crate::Error,
8921 > {
8922 use google_cloud_gax::paginator::Paginator;
8923 self.by_page().items()
8924 }
8925
8926 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8928 self.0.request.name = v.into();
8929 self
8930 }
8931
8932 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8934 self.0.request.filter = v.into();
8935 self
8936 }
8937
8938 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8940 self.0.request.page_size = v.into();
8941 self
8942 }
8943
8944 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8946 self.0.request.page_token = v.into();
8947 self
8948 }
8949
8950 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8952 self.0.request.return_partial_success = v.into();
8953 self
8954 }
8955 }
8956
8957 #[doc(hidden)]
8958 impl crate::RequestBuilder for ListOperations {
8959 fn request_options(&mut self) -> &mut crate::RequestOptions {
8960 &mut self.0.options
8961 }
8962 }
8963
8964 #[derive(Clone, Debug)]
8981 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8982
8983 impl GetOperation {
8984 pub(crate) fn new(
8985 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8986 ) -> Self {
8987 Self(RequestBuilder::new(stub))
8988 }
8989
8990 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8992 mut self,
8993 v: V,
8994 ) -> Self {
8995 self.0.request = v.into();
8996 self
8997 }
8998
8999 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9001 self.0.options = v.into();
9002 self
9003 }
9004
9005 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9007 (*self.0.stub)
9008 .get_operation(self.0.request, self.0.options)
9009 .await
9010 .map(crate::Response::into_body)
9011 }
9012
9013 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9015 self.0.request.name = v.into();
9016 self
9017 }
9018 }
9019
9020 #[doc(hidden)]
9021 impl crate::RequestBuilder for GetOperation {
9022 fn request_options(&mut self) -> &mut crate::RequestOptions {
9023 &mut self.0.options
9024 }
9025 }
9026
9027 #[derive(Clone, Debug)]
9044 pub struct CancelOperation(
9045 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9046 );
9047
9048 impl CancelOperation {
9049 pub(crate) fn new(
9050 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
9051 ) -> Self {
9052 Self(RequestBuilder::new(stub))
9053 }
9054
9055 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9057 mut self,
9058 v: V,
9059 ) -> Self {
9060 self.0.request = v.into();
9061 self
9062 }
9063
9064 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9066 self.0.options = v.into();
9067 self
9068 }
9069
9070 pub async fn send(self) -> Result<()> {
9072 (*self.0.stub)
9073 .cancel_operation(self.0.request, self.0.options)
9074 .await
9075 .map(crate::Response::into_body)
9076 }
9077
9078 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9080 self.0.request.name = v.into();
9081 self
9082 }
9083 }
9084
9085 #[doc(hidden)]
9086 impl crate::RequestBuilder for CancelOperation {
9087 fn request_options(&mut self) -> &mut crate::RequestOptions {
9088 &mut self.0.options
9089 }
9090 }
9091}
9092
9093#[cfg(feature = "project-service")]
9095#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
9096pub mod project_service {
9097 use crate::Result;
9098
9099 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9113
9114 pub(crate) mod client {
9115 use super::super::super::client::ProjectService;
9116 pub struct Factory;
9117 impl crate::ClientFactory for Factory {
9118 type Client = ProjectService;
9119 type Credentials = gaxi::options::Credentials;
9120 async fn build(
9121 self,
9122 config: gaxi::options::ClientConfig,
9123 ) -> crate::ClientBuilderResult<Self::Client> {
9124 Self::Client::new(config).await
9125 }
9126 }
9127 }
9128
9129 #[derive(Clone, Debug)]
9131 pub(crate) struct RequestBuilder<R: std::default::Default> {
9132 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9133 request: R,
9134 options: crate::RequestOptions,
9135 }
9136
9137 impl<R> RequestBuilder<R>
9138 where
9139 R: std::default::Default,
9140 {
9141 pub(crate) fn new(
9142 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9143 ) -> Self {
9144 Self {
9145 stub,
9146 request: R::default(),
9147 options: crate::RequestOptions::default(),
9148 }
9149 }
9150 }
9151
9152 #[derive(Clone, Debug)]
9170 pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9171
9172 impl ProvisionProject {
9173 pub(crate) fn new(
9174 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9175 ) -> Self {
9176 Self(RequestBuilder::new(stub))
9177 }
9178
9179 pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9181 mut self,
9182 v: V,
9183 ) -> Self {
9184 self.0.request = v.into();
9185 self
9186 }
9187
9188 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9190 self.0.options = v.into();
9191 self
9192 }
9193
9194 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9201 (*self.0.stub)
9202 .provision_project(self.0.request, self.0.options)
9203 .await
9204 .map(crate::Response::into_body)
9205 }
9206
9207 pub fn poller(
9209 self,
9210 ) -> impl google_cloud_lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9211 {
9212 type Operation = google_cloud_lro::internal::Operation<
9213 crate::model::Project,
9214 crate::model::ProvisionProjectMetadata,
9215 >;
9216 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9217 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9218
9219 let stub = self.0.stub.clone();
9220 let mut options = self.0.options.clone();
9221 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9222 let query = move |name| {
9223 let stub = stub.clone();
9224 let options = options.clone();
9225 async {
9226 let op = GetOperation::new(stub)
9227 .set_name(name)
9228 .with_options(options)
9229 .send()
9230 .await?;
9231 Ok(Operation::new(op))
9232 }
9233 };
9234
9235 let start = move || async {
9236 let op = self.send().await?;
9237 Ok(Operation::new(op))
9238 };
9239
9240 google_cloud_lro::internal::new_poller(
9241 polling_error_policy,
9242 polling_backoff_policy,
9243 start,
9244 query,
9245 )
9246 }
9247
9248 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9252 self.0.request.name = v.into();
9253 self
9254 }
9255
9256 pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9260 self.0.request.accept_data_use_terms = v.into();
9261 self
9262 }
9263
9264 pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9268 self.0.request.data_use_terms_version = v.into();
9269 self
9270 }
9271 }
9272
9273 #[doc(hidden)]
9274 impl crate::RequestBuilder for ProvisionProject {
9275 fn request_options(&mut self) -> &mut crate::RequestOptions {
9276 &mut self.0.options
9277 }
9278 }
9279
9280 #[derive(Clone, Debug)]
9301 pub struct ListOperations(
9302 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9303 );
9304
9305 impl ListOperations {
9306 pub(crate) fn new(
9307 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9308 ) -> Self {
9309 Self(RequestBuilder::new(stub))
9310 }
9311
9312 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9314 mut self,
9315 v: V,
9316 ) -> Self {
9317 self.0.request = v.into();
9318 self
9319 }
9320
9321 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9323 self.0.options = v.into();
9324 self
9325 }
9326
9327 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9329 (*self.0.stub)
9330 .list_operations(self.0.request, self.0.options)
9331 .await
9332 .map(crate::Response::into_body)
9333 }
9334
9335 pub fn by_page(
9337 self,
9338 ) -> impl google_cloud_gax::paginator::Paginator<
9339 google_cloud_longrunning::model::ListOperationsResponse,
9340 crate::Error,
9341 > {
9342 use std::clone::Clone;
9343 let token = self.0.request.page_token.clone();
9344 let execute = move |token: String| {
9345 let mut builder = self.clone();
9346 builder.0.request = builder.0.request.set_page_token(token);
9347 builder.send()
9348 };
9349 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9350 }
9351
9352 pub fn by_item(
9354 self,
9355 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9356 google_cloud_longrunning::model::ListOperationsResponse,
9357 crate::Error,
9358 > {
9359 use google_cloud_gax::paginator::Paginator;
9360 self.by_page().items()
9361 }
9362
9363 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9365 self.0.request.name = v.into();
9366 self
9367 }
9368
9369 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9371 self.0.request.filter = v.into();
9372 self
9373 }
9374
9375 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9377 self.0.request.page_size = v.into();
9378 self
9379 }
9380
9381 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9383 self.0.request.page_token = v.into();
9384 self
9385 }
9386
9387 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9389 self.0.request.return_partial_success = v.into();
9390 self
9391 }
9392 }
9393
9394 #[doc(hidden)]
9395 impl crate::RequestBuilder for ListOperations {
9396 fn request_options(&mut self) -> &mut crate::RequestOptions {
9397 &mut self.0.options
9398 }
9399 }
9400
9401 #[derive(Clone, Debug)]
9418 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9419
9420 impl GetOperation {
9421 pub(crate) fn new(
9422 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9423 ) -> Self {
9424 Self(RequestBuilder::new(stub))
9425 }
9426
9427 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9429 mut self,
9430 v: V,
9431 ) -> Self {
9432 self.0.request = v.into();
9433 self
9434 }
9435
9436 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9438 self.0.options = v.into();
9439 self
9440 }
9441
9442 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9444 (*self.0.stub)
9445 .get_operation(self.0.request, self.0.options)
9446 .await
9447 .map(crate::Response::into_body)
9448 }
9449
9450 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9452 self.0.request.name = v.into();
9453 self
9454 }
9455 }
9456
9457 #[doc(hidden)]
9458 impl crate::RequestBuilder for GetOperation {
9459 fn request_options(&mut self) -> &mut crate::RequestOptions {
9460 &mut self.0.options
9461 }
9462 }
9463
9464 #[derive(Clone, Debug)]
9481 pub struct CancelOperation(
9482 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9483 );
9484
9485 impl CancelOperation {
9486 pub(crate) fn new(
9487 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9488 ) -> Self {
9489 Self(RequestBuilder::new(stub))
9490 }
9491
9492 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9494 mut self,
9495 v: V,
9496 ) -> Self {
9497 self.0.request = v.into();
9498 self
9499 }
9500
9501 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9503 self.0.options = v.into();
9504 self
9505 }
9506
9507 pub async fn send(self) -> Result<()> {
9509 (*self.0.stub)
9510 .cancel_operation(self.0.request, self.0.options)
9511 .await
9512 .map(crate::Response::into_body)
9513 }
9514
9515 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9517 self.0.request.name = v.into();
9518 self
9519 }
9520 }
9521
9522 #[doc(hidden)]
9523 impl crate::RequestBuilder for CancelOperation {
9524 fn request_options(&mut self) -> &mut crate::RequestOptions {
9525 &mut self.0.options
9526 }
9527 }
9528}
9529
9530#[cfg(feature = "rank-service")]
9532#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
9533pub mod rank_service {
9534 use crate::Result;
9535
9536 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9550
9551 pub(crate) mod client {
9552 use super::super::super::client::RankService;
9553 pub struct Factory;
9554 impl crate::ClientFactory for Factory {
9555 type Client = RankService;
9556 type Credentials = gaxi::options::Credentials;
9557 async fn build(
9558 self,
9559 config: gaxi::options::ClientConfig,
9560 ) -> crate::ClientBuilderResult<Self::Client> {
9561 Self::Client::new(config).await
9562 }
9563 }
9564 }
9565
9566 #[derive(Clone, Debug)]
9568 pub(crate) struct RequestBuilder<R: std::default::Default> {
9569 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9570 request: R,
9571 options: crate::RequestOptions,
9572 }
9573
9574 impl<R> RequestBuilder<R>
9575 where
9576 R: std::default::Default,
9577 {
9578 pub(crate) fn new(
9579 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9580 ) -> Self {
9581 Self {
9582 stub,
9583 request: R::default(),
9584 options: crate::RequestOptions::default(),
9585 }
9586 }
9587 }
9588
9589 #[derive(Clone, Debug)]
9606 pub struct Rank(RequestBuilder<crate::model::RankRequest>);
9607
9608 impl Rank {
9609 pub(crate) fn new(
9610 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9611 ) -> Self {
9612 Self(RequestBuilder::new(stub))
9613 }
9614
9615 pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
9617 self.0.request = v.into();
9618 self
9619 }
9620
9621 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9623 self.0.options = v.into();
9624 self
9625 }
9626
9627 pub async fn send(self) -> Result<crate::model::RankResponse> {
9629 (*self.0.stub)
9630 .rank(self.0.request, self.0.options)
9631 .await
9632 .map(crate::Response::into_body)
9633 }
9634
9635 pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9639 self.0.request.ranking_config = v.into();
9640 self
9641 }
9642
9643 pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
9645 self.0.request.model = v.into();
9646 self
9647 }
9648
9649 pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
9651 self.0.request.top_n = v.into();
9652 self
9653 }
9654
9655 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
9657 self.0.request.query = v.into();
9658 self
9659 }
9660
9661 pub fn set_records<T, V>(mut self, v: T) -> Self
9665 where
9666 T: std::iter::IntoIterator<Item = V>,
9667 V: std::convert::Into<crate::model::RankingRecord>,
9668 {
9669 use std::iter::Iterator;
9670 self.0.request.records = v.into_iter().map(|i| i.into()).collect();
9671 self
9672 }
9673
9674 pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
9676 self.0.request.ignore_record_details_in_response = v.into();
9677 self
9678 }
9679
9680 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9682 where
9683 T: std::iter::IntoIterator<Item = (K, V)>,
9684 K: std::convert::Into<std::string::String>,
9685 V: std::convert::Into<std::string::String>,
9686 {
9687 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9688 self
9689 }
9690 }
9691
9692 #[doc(hidden)]
9693 impl crate::RequestBuilder for Rank {
9694 fn request_options(&mut self) -> &mut crate::RequestOptions {
9695 &mut self.0.options
9696 }
9697 }
9698
9699 #[derive(Clone, Debug)]
9720 pub struct ListOperations(
9721 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9722 );
9723
9724 impl ListOperations {
9725 pub(crate) fn new(
9726 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9727 ) -> Self {
9728 Self(RequestBuilder::new(stub))
9729 }
9730
9731 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9733 mut self,
9734 v: V,
9735 ) -> Self {
9736 self.0.request = v.into();
9737 self
9738 }
9739
9740 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9742 self.0.options = v.into();
9743 self
9744 }
9745
9746 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9748 (*self.0.stub)
9749 .list_operations(self.0.request, self.0.options)
9750 .await
9751 .map(crate::Response::into_body)
9752 }
9753
9754 pub fn by_page(
9756 self,
9757 ) -> impl google_cloud_gax::paginator::Paginator<
9758 google_cloud_longrunning::model::ListOperationsResponse,
9759 crate::Error,
9760 > {
9761 use std::clone::Clone;
9762 let token = self.0.request.page_token.clone();
9763 let execute = move |token: String| {
9764 let mut builder = self.clone();
9765 builder.0.request = builder.0.request.set_page_token(token);
9766 builder.send()
9767 };
9768 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9769 }
9770
9771 pub fn by_item(
9773 self,
9774 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9775 google_cloud_longrunning::model::ListOperationsResponse,
9776 crate::Error,
9777 > {
9778 use google_cloud_gax::paginator::Paginator;
9779 self.by_page().items()
9780 }
9781
9782 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9784 self.0.request.name = v.into();
9785 self
9786 }
9787
9788 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9790 self.0.request.filter = v.into();
9791 self
9792 }
9793
9794 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9796 self.0.request.page_size = v.into();
9797 self
9798 }
9799
9800 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9802 self.0.request.page_token = v.into();
9803 self
9804 }
9805
9806 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9808 self.0.request.return_partial_success = v.into();
9809 self
9810 }
9811 }
9812
9813 #[doc(hidden)]
9814 impl crate::RequestBuilder for ListOperations {
9815 fn request_options(&mut self) -> &mut crate::RequestOptions {
9816 &mut self.0.options
9817 }
9818 }
9819
9820 #[derive(Clone, Debug)]
9837 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9838
9839 impl GetOperation {
9840 pub(crate) fn new(
9841 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9842 ) -> Self {
9843 Self(RequestBuilder::new(stub))
9844 }
9845
9846 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9848 mut self,
9849 v: V,
9850 ) -> Self {
9851 self.0.request = v.into();
9852 self
9853 }
9854
9855 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9857 self.0.options = v.into();
9858 self
9859 }
9860
9861 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9863 (*self.0.stub)
9864 .get_operation(self.0.request, self.0.options)
9865 .await
9866 .map(crate::Response::into_body)
9867 }
9868
9869 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9871 self.0.request.name = v.into();
9872 self
9873 }
9874 }
9875
9876 #[doc(hidden)]
9877 impl crate::RequestBuilder for GetOperation {
9878 fn request_options(&mut self) -> &mut crate::RequestOptions {
9879 &mut self.0.options
9880 }
9881 }
9882
9883 #[derive(Clone, Debug)]
9900 pub struct CancelOperation(
9901 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9902 );
9903
9904 impl CancelOperation {
9905 pub(crate) fn new(
9906 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9907 ) -> Self {
9908 Self(RequestBuilder::new(stub))
9909 }
9910
9911 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9913 mut self,
9914 v: V,
9915 ) -> Self {
9916 self.0.request = v.into();
9917 self
9918 }
9919
9920 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9922 self.0.options = v.into();
9923 self
9924 }
9925
9926 pub async fn send(self) -> Result<()> {
9928 (*self.0.stub)
9929 .cancel_operation(self.0.request, self.0.options)
9930 .await
9931 .map(crate::Response::into_body)
9932 }
9933
9934 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9936 self.0.request.name = v.into();
9937 self
9938 }
9939 }
9940
9941 #[doc(hidden)]
9942 impl crate::RequestBuilder for CancelOperation {
9943 fn request_options(&mut self) -> &mut crate::RequestOptions {
9944 &mut self.0.options
9945 }
9946 }
9947}
9948
9949#[cfg(feature = "recommendation-service")]
9951#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
9952pub mod recommendation_service {
9953 use crate::Result;
9954
9955 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9969
9970 pub(crate) mod client {
9971 use super::super::super::client::RecommendationService;
9972 pub struct Factory;
9973 impl crate::ClientFactory for Factory {
9974 type Client = RecommendationService;
9975 type Credentials = gaxi::options::Credentials;
9976 async fn build(
9977 self,
9978 config: gaxi::options::ClientConfig,
9979 ) -> crate::ClientBuilderResult<Self::Client> {
9980 Self::Client::new(config).await
9981 }
9982 }
9983 }
9984
9985 #[derive(Clone, Debug)]
9987 pub(crate) struct RequestBuilder<R: std::default::Default> {
9988 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9989 request: R,
9990 options: crate::RequestOptions,
9991 }
9992
9993 impl<R> RequestBuilder<R>
9994 where
9995 R: std::default::Default,
9996 {
9997 pub(crate) fn new(
9998 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9999 ) -> Self {
10000 Self {
10001 stub,
10002 request: R::default(),
10003 options: crate::RequestOptions::default(),
10004 }
10005 }
10006 }
10007
10008 #[derive(Clone, Debug)]
10025 pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
10026
10027 impl Recommend {
10028 pub(crate) fn new(
10029 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10030 ) -> Self {
10031 Self(RequestBuilder::new(stub))
10032 }
10033
10034 pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
10036 self.0.request = v.into();
10037 self
10038 }
10039
10040 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10042 self.0.options = v.into();
10043 self
10044 }
10045
10046 pub async fn send(self) -> Result<crate::model::RecommendResponse> {
10048 (*self.0.stub)
10049 .recommend(self.0.request, self.0.options)
10050 .await
10051 .map(crate::Response::into_body)
10052 }
10053
10054 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
10058 self.0.request.serving_config = v.into();
10059 self
10060 }
10061
10062 pub fn set_user_event<T>(mut self, v: T) -> Self
10066 where
10067 T: std::convert::Into<crate::model::UserEvent>,
10068 {
10069 self.0.request.user_event = std::option::Option::Some(v.into());
10070 self
10071 }
10072
10073 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
10077 where
10078 T: std::convert::Into<crate::model::UserEvent>,
10079 {
10080 self.0.request.user_event = v.map(|x| x.into());
10081 self
10082 }
10083
10084 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10086 self.0.request.page_size = v.into();
10087 self
10088 }
10089
10090 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10092 self.0.request.filter = v.into();
10093 self
10094 }
10095
10096 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
10098 self.0.request.validate_only = v.into();
10099 self
10100 }
10101
10102 pub fn set_params<T, K, V>(mut self, v: T) -> Self
10104 where
10105 T: std::iter::IntoIterator<Item = (K, V)>,
10106 K: std::convert::Into<std::string::String>,
10107 V: std::convert::Into<wkt::Value>,
10108 {
10109 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10110 self
10111 }
10112
10113 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
10115 where
10116 T: std::iter::IntoIterator<Item = (K, V)>,
10117 K: std::convert::Into<std::string::String>,
10118 V: std::convert::Into<std::string::String>,
10119 {
10120 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10121 self
10122 }
10123 }
10124
10125 #[doc(hidden)]
10126 impl crate::RequestBuilder for Recommend {
10127 fn request_options(&mut self) -> &mut crate::RequestOptions {
10128 &mut self.0.options
10129 }
10130 }
10131
10132 #[derive(Clone, Debug)]
10153 pub struct ListOperations(
10154 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10155 );
10156
10157 impl ListOperations {
10158 pub(crate) fn new(
10159 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10160 ) -> Self {
10161 Self(RequestBuilder::new(stub))
10162 }
10163
10164 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
10166 mut self,
10167 v: V,
10168 ) -> Self {
10169 self.0.request = v.into();
10170 self
10171 }
10172
10173 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10175 self.0.options = v.into();
10176 self
10177 }
10178
10179 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
10181 (*self.0.stub)
10182 .list_operations(self.0.request, self.0.options)
10183 .await
10184 .map(crate::Response::into_body)
10185 }
10186
10187 pub fn by_page(
10189 self,
10190 ) -> impl google_cloud_gax::paginator::Paginator<
10191 google_cloud_longrunning::model::ListOperationsResponse,
10192 crate::Error,
10193 > {
10194 use std::clone::Clone;
10195 let token = self.0.request.page_token.clone();
10196 let execute = move |token: String| {
10197 let mut builder = self.clone();
10198 builder.0.request = builder.0.request.set_page_token(token);
10199 builder.send()
10200 };
10201 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10202 }
10203
10204 pub fn by_item(
10206 self,
10207 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10208 google_cloud_longrunning::model::ListOperationsResponse,
10209 crate::Error,
10210 > {
10211 use google_cloud_gax::paginator::Paginator;
10212 self.by_page().items()
10213 }
10214
10215 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10217 self.0.request.name = v.into();
10218 self
10219 }
10220
10221 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10223 self.0.request.filter = v.into();
10224 self
10225 }
10226
10227 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10229 self.0.request.page_size = v.into();
10230 self
10231 }
10232
10233 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10235 self.0.request.page_token = v.into();
10236 self
10237 }
10238
10239 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10241 self.0.request.return_partial_success = v.into();
10242 self
10243 }
10244 }
10245
10246 #[doc(hidden)]
10247 impl crate::RequestBuilder for ListOperations {
10248 fn request_options(&mut self) -> &mut crate::RequestOptions {
10249 &mut self.0.options
10250 }
10251 }
10252
10253 #[derive(Clone, Debug)]
10270 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10271
10272 impl GetOperation {
10273 pub(crate) fn new(
10274 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10275 ) -> Self {
10276 Self(RequestBuilder::new(stub))
10277 }
10278
10279 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10281 mut self,
10282 v: V,
10283 ) -> Self {
10284 self.0.request = v.into();
10285 self
10286 }
10287
10288 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10290 self.0.options = v.into();
10291 self
10292 }
10293
10294 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10296 (*self.0.stub)
10297 .get_operation(self.0.request, self.0.options)
10298 .await
10299 .map(crate::Response::into_body)
10300 }
10301
10302 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10304 self.0.request.name = v.into();
10305 self
10306 }
10307 }
10308
10309 #[doc(hidden)]
10310 impl crate::RequestBuilder for GetOperation {
10311 fn request_options(&mut self) -> &mut crate::RequestOptions {
10312 &mut self.0.options
10313 }
10314 }
10315
10316 #[derive(Clone, Debug)]
10333 pub struct CancelOperation(
10334 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10335 );
10336
10337 impl CancelOperation {
10338 pub(crate) fn new(
10339 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10340 ) -> Self {
10341 Self(RequestBuilder::new(stub))
10342 }
10343
10344 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10346 mut self,
10347 v: V,
10348 ) -> Self {
10349 self.0.request = v.into();
10350 self
10351 }
10352
10353 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10355 self.0.options = v.into();
10356 self
10357 }
10358
10359 pub async fn send(self) -> Result<()> {
10361 (*self.0.stub)
10362 .cancel_operation(self.0.request, self.0.options)
10363 .await
10364 .map(crate::Response::into_body)
10365 }
10366
10367 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10369 self.0.request.name = v.into();
10370 self
10371 }
10372 }
10373
10374 #[doc(hidden)]
10375 impl crate::RequestBuilder for CancelOperation {
10376 fn request_options(&mut self) -> &mut crate::RequestOptions {
10377 &mut self.0.options
10378 }
10379 }
10380}
10381
10382#[cfg(feature = "schema-service")]
10384#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
10385pub mod schema_service {
10386 use crate::Result;
10387
10388 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10402
10403 pub(crate) mod client {
10404 use super::super::super::client::SchemaService;
10405 pub struct Factory;
10406 impl crate::ClientFactory for Factory {
10407 type Client = SchemaService;
10408 type Credentials = gaxi::options::Credentials;
10409 async fn build(
10410 self,
10411 config: gaxi::options::ClientConfig,
10412 ) -> crate::ClientBuilderResult<Self::Client> {
10413 Self::Client::new(config).await
10414 }
10415 }
10416 }
10417
10418 #[derive(Clone, Debug)]
10420 pub(crate) struct RequestBuilder<R: std::default::Default> {
10421 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10422 request: R,
10423 options: crate::RequestOptions,
10424 }
10425
10426 impl<R> RequestBuilder<R>
10427 where
10428 R: std::default::Default,
10429 {
10430 pub(crate) fn new(
10431 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10432 ) -> Self {
10433 Self {
10434 stub,
10435 request: R::default(),
10436 options: crate::RequestOptions::default(),
10437 }
10438 }
10439 }
10440
10441 #[derive(Clone, Debug)]
10458 pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
10459
10460 impl GetSchema {
10461 pub(crate) fn new(
10462 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10463 ) -> Self {
10464 Self(RequestBuilder::new(stub))
10465 }
10466
10467 pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
10469 self.0.request = v.into();
10470 self
10471 }
10472
10473 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10475 self.0.options = v.into();
10476 self
10477 }
10478
10479 pub async fn send(self) -> Result<crate::model::Schema> {
10481 (*self.0.stub)
10482 .get_schema(self.0.request, self.0.options)
10483 .await
10484 .map(crate::Response::into_body)
10485 }
10486
10487 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10491 self.0.request.name = v.into();
10492 self
10493 }
10494 }
10495
10496 #[doc(hidden)]
10497 impl crate::RequestBuilder for GetSchema {
10498 fn request_options(&mut self) -> &mut crate::RequestOptions {
10499 &mut self.0.options
10500 }
10501 }
10502
10503 #[derive(Clone, Debug)]
10524 pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
10525
10526 impl ListSchemas {
10527 pub(crate) fn new(
10528 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10529 ) -> Self {
10530 Self(RequestBuilder::new(stub))
10531 }
10532
10533 pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
10535 self.0.request = v.into();
10536 self
10537 }
10538
10539 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10541 self.0.options = v.into();
10542 self
10543 }
10544
10545 pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
10547 (*self.0.stub)
10548 .list_schemas(self.0.request, self.0.options)
10549 .await
10550 .map(crate::Response::into_body)
10551 }
10552
10553 pub fn by_page(
10555 self,
10556 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSchemasResponse, crate::Error>
10557 {
10558 use std::clone::Clone;
10559 let token = self.0.request.page_token.clone();
10560 let execute = move |token: String| {
10561 let mut builder = self.clone();
10562 builder.0.request = builder.0.request.set_page_token(token);
10563 builder.send()
10564 };
10565 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10566 }
10567
10568 pub fn by_item(
10570 self,
10571 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10572 crate::model::ListSchemasResponse,
10573 crate::Error,
10574 > {
10575 use google_cloud_gax::paginator::Paginator;
10576 self.by_page().items()
10577 }
10578
10579 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10583 self.0.request.parent = v.into();
10584 self
10585 }
10586
10587 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10589 self.0.request.page_size = v.into();
10590 self
10591 }
10592
10593 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10595 self.0.request.page_token = v.into();
10596 self
10597 }
10598 }
10599
10600 #[doc(hidden)]
10601 impl crate::RequestBuilder for ListSchemas {
10602 fn request_options(&mut self) -> &mut crate::RequestOptions {
10603 &mut self.0.options
10604 }
10605 }
10606
10607 #[derive(Clone, Debug)]
10625 pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
10626
10627 impl CreateSchema {
10628 pub(crate) fn new(
10629 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10630 ) -> Self {
10631 Self(RequestBuilder::new(stub))
10632 }
10633
10634 pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
10636 self.0.request = v.into();
10637 self
10638 }
10639
10640 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10642 self.0.options = v.into();
10643 self
10644 }
10645
10646 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10653 (*self.0.stub)
10654 .create_schema(self.0.request, self.0.options)
10655 .await
10656 .map(crate::Response::into_body)
10657 }
10658
10659 pub fn poller(
10661 self,
10662 ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata>
10663 {
10664 type Operation = google_cloud_lro::internal::Operation<
10665 crate::model::Schema,
10666 crate::model::CreateSchemaMetadata,
10667 >;
10668 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10669 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10670
10671 let stub = self.0.stub.clone();
10672 let mut options = self.0.options.clone();
10673 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10674 let query = move |name| {
10675 let stub = stub.clone();
10676 let options = options.clone();
10677 async {
10678 let op = GetOperation::new(stub)
10679 .set_name(name)
10680 .with_options(options)
10681 .send()
10682 .await?;
10683 Ok(Operation::new(op))
10684 }
10685 };
10686
10687 let start = move || async {
10688 let op = self.send().await?;
10689 Ok(Operation::new(op))
10690 };
10691
10692 google_cloud_lro::internal::new_poller(
10693 polling_error_policy,
10694 polling_backoff_policy,
10695 start,
10696 query,
10697 )
10698 }
10699
10700 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10704 self.0.request.parent = v.into();
10705 self
10706 }
10707
10708 pub fn set_schema<T>(mut self, v: T) -> Self
10712 where
10713 T: std::convert::Into<crate::model::Schema>,
10714 {
10715 self.0.request.schema = std::option::Option::Some(v.into());
10716 self
10717 }
10718
10719 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10723 where
10724 T: std::convert::Into<crate::model::Schema>,
10725 {
10726 self.0.request.schema = v.map(|x| x.into());
10727 self
10728 }
10729
10730 pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
10734 self.0.request.schema_id = v.into();
10735 self
10736 }
10737 }
10738
10739 #[doc(hidden)]
10740 impl crate::RequestBuilder for CreateSchema {
10741 fn request_options(&mut self) -> &mut crate::RequestOptions {
10742 &mut self.0.options
10743 }
10744 }
10745
10746 #[derive(Clone, Debug)]
10764 pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
10765
10766 impl UpdateSchema {
10767 pub(crate) fn new(
10768 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10769 ) -> Self {
10770 Self(RequestBuilder::new(stub))
10771 }
10772
10773 pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
10775 self.0.request = v.into();
10776 self
10777 }
10778
10779 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10781 self.0.options = v.into();
10782 self
10783 }
10784
10785 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10792 (*self.0.stub)
10793 .update_schema(self.0.request, self.0.options)
10794 .await
10795 .map(crate::Response::into_body)
10796 }
10797
10798 pub fn poller(
10800 self,
10801 ) -> impl google_cloud_lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata>
10802 {
10803 type Operation = google_cloud_lro::internal::Operation<
10804 crate::model::Schema,
10805 crate::model::UpdateSchemaMetadata,
10806 >;
10807 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10808 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10809
10810 let stub = self.0.stub.clone();
10811 let mut options = self.0.options.clone();
10812 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10813 let query = move |name| {
10814 let stub = stub.clone();
10815 let options = options.clone();
10816 async {
10817 let op = GetOperation::new(stub)
10818 .set_name(name)
10819 .with_options(options)
10820 .send()
10821 .await?;
10822 Ok(Operation::new(op))
10823 }
10824 };
10825
10826 let start = move || async {
10827 let op = self.send().await?;
10828 Ok(Operation::new(op))
10829 };
10830
10831 google_cloud_lro::internal::new_poller(
10832 polling_error_policy,
10833 polling_backoff_policy,
10834 start,
10835 query,
10836 )
10837 }
10838
10839 pub fn set_schema<T>(mut self, v: T) -> Self
10843 where
10844 T: std::convert::Into<crate::model::Schema>,
10845 {
10846 self.0.request.schema = std::option::Option::Some(v.into());
10847 self
10848 }
10849
10850 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10854 where
10855 T: std::convert::Into<crate::model::Schema>,
10856 {
10857 self.0.request.schema = v.map(|x| x.into());
10858 self
10859 }
10860
10861 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
10863 self.0.request.allow_missing = v.into();
10864 self
10865 }
10866 }
10867
10868 #[doc(hidden)]
10869 impl crate::RequestBuilder for UpdateSchema {
10870 fn request_options(&mut self) -> &mut crate::RequestOptions {
10871 &mut self.0.options
10872 }
10873 }
10874
10875 #[derive(Clone, Debug)]
10893 pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
10894
10895 impl DeleteSchema {
10896 pub(crate) fn new(
10897 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10898 ) -> Self {
10899 Self(RequestBuilder::new(stub))
10900 }
10901
10902 pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
10904 self.0.request = v.into();
10905 self
10906 }
10907
10908 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10910 self.0.options = v.into();
10911 self
10912 }
10913
10914 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10921 (*self.0.stub)
10922 .delete_schema(self.0.request, self.0.options)
10923 .await
10924 .map(crate::Response::into_body)
10925 }
10926
10927 pub fn poller(
10929 self,
10930 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSchemaMetadata> {
10931 type Operation = google_cloud_lro::internal::Operation<
10932 wkt::Empty,
10933 crate::model::DeleteSchemaMetadata,
10934 >;
10935 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10936 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10937
10938 let stub = self.0.stub.clone();
10939 let mut options = self.0.options.clone();
10940 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10941 let query = move |name| {
10942 let stub = stub.clone();
10943 let options = options.clone();
10944 async {
10945 let op = GetOperation::new(stub)
10946 .set_name(name)
10947 .with_options(options)
10948 .send()
10949 .await?;
10950 Ok(Operation::new(op))
10951 }
10952 };
10953
10954 let start = move || async {
10955 let op = self.send().await?;
10956 Ok(Operation::new(op))
10957 };
10958
10959 google_cloud_lro::internal::new_unit_response_poller(
10960 polling_error_policy,
10961 polling_backoff_policy,
10962 start,
10963 query,
10964 )
10965 }
10966
10967 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10971 self.0.request.name = v.into();
10972 self
10973 }
10974 }
10975
10976 #[doc(hidden)]
10977 impl crate::RequestBuilder for DeleteSchema {
10978 fn request_options(&mut self) -> &mut crate::RequestOptions {
10979 &mut self.0.options
10980 }
10981 }
10982
10983 #[derive(Clone, Debug)]
11004 pub struct ListOperations(
11005 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
11006 );
11007
11008 impl ListOperations {
11009 pub(crate) fn new(
11010 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11011 ) -> Self {
11012 Self(RequestBuilder::new(stub))
11013 }
11014
11015 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
11017 mut self,
11018 v: V,
11019 ) -> Self {
11020 self.0.request = v.into();
11021 self
11022 }
11023
11024 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11026 self.0.options = v.into();
11027 self
11028 }
11029
11030 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
11032 (*self.0.stub)
11033 .list_operations(self.0.request, self.0.options)
11034 .await
11035 .map(crate::Response::into_body)
11036 }
11037
11038 pub fn by_page(
11040 self,
11041 ) -> impl google_cloud_gax::paginator::Paginator<
11042 google_cloud_longrunning::model::ListOperationsResponse,
11043 crate::Error,
11044 > {
11045 use std::clone::Clone;
11046 let token = self.0.request.page_token.clone();
11047 let execute = move |token: String| {
11048 let mut builder = self.clone();
11049 builder.0.request = builder.0.request.set_page_token(token);
11050 builder.send()
11051 };
11052 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11053 }
11054
11055 pub fn by_item(
11057 self,
11058 ) -> impl google_cloud_gax::paginator::ItemPaginator<
11059 google_cloud_longrunning::model::ListOperationsResponse,
11060 crate::Error,
11061 > {
11062 use google_cloud_gax::paginator::Paginator;
11063 self.by_page().items()
11064 }
11065
11066 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11068 self.0.request.name = v.into();
11069 self
11070 }
11071
11072 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11074 self.0.request.filter = v.into();
11075 self
11076 }
11077
11078 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11080 self.0.request.page_size = v.into();
11081 self
11082 }
11083
11084 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11086 self.0.request.page_token = v.into();
11087 self
11088 }
11089
11090 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
11092 self.0.request.return_partial_success = v.into();
11093 self
11094 }
11095 }
11096
11097 #[doc(hidden)]
11098 impl crate::RequestBuilder for ListOperations {
11099 fn request_options(&mut self) -> &mut crate::RequestOptions {
11100 &mut self.0.options
11101 }
11102 }
11103
11104 #[derive(Clone, Debug)]
11121 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
11122
11123 impl GetOperation {
11124 pub(crate) fn new(
11125 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11126 ) -> Self {
11127 Self(RequestBuilder::new(stub))
11128 }
11129
11130 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
11132 mut self,
11133 v: V,
11134 ) -> Self {
11135 self.0.request = v.into();
11136 self
11137 }
11138
11139 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11141 self.0.options = v.into();
11142 self
11143 }
11144
11145 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11147 (*self.0.stub)
11148 .get_operation(self.0.request, self.0.options)
11149 .await
11150 .map(crate::Response::into_body)
11151 }
11152
11153 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11155 self.0.request.name = v.into();
11156 self
11157 }
11158 }
11159
11160 #[doc(hidden)]
11161 impl crate::RequestBuilder for GetOperation {
11162 fn request_options(&mut self) -> &mut crate::RequestOptions {
11163 &mut self.0.options
11164 }
11165 }
11166
11167 #[derive(Clone, Debug)]
11184 pub struct CancelOperation(
11185 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
11186 );
11187
11188 impl CancelOperation {
11189 pub(crate) fn new(
11190 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11191 ) -> Self {
11192 Self(RequestBuilder::new(stub))
11193 }
11194
11195 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
11197 mut self,
11198 v: V,
11199 ) -> Self {
11200 self.0.request = v.into();
11201 self
11202 }
11203
11204 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11206 self.0.options = v.into();
11207 self
11208 }
11209
11210 pub async fn send(self) -> Result<()> {
11212 (*self.0.stub)
11213 .cancel_operation(self.0.request, self.0.options)
11214 .await
11215 .map(crate::Response::into_body)
11216 }
11217
11218 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11220 self.0.request.name = v.into();
11221 self
11222 }
11223 }
11224
11225 #[doc(hidden)]
11226 impl crate::RequestBuilder for CancelOperation {
11227 fn request_options(&mut self) -> &mut crate::RequestOptions {
11228 &mut self.0.options
11229 }
11230 }
11231}
11232
11233#[cfg(feature = "search-service")]
11235#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11236pub mod search_service {
11237 use crate::Result;
11238
11239 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11253
11254 pub(crate) mod client {
11255 use super::super::super::client::SearchService;
11256 pub struct Factory;
11257 impl crate::ClientFactory for Factory {
11258 type Client = SearchService;
11259 type Credentials = gaxi::options::Credentials;
11260 async fn build(
11261 self,
11262 config: gaxi::options::ClientConfig,
11263 ) -> crate::ClientBuilderResult<Self::Client> {
11264 Self::Client::new(config).await
11265 }
11266 }
11267 }
11268
11269 #[derive(Clone, Debug)]
11271 pub(crate) struct RequestBuilder<R: std::default::Default> {
11272 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11273 request: R,
11274 options: crate::RequestOptions,
11275 }
11276
11277 impl<R> RequestBuilder<R>
11278 where
11279 R: std::default::Default,
11280 {
11281 pub(crate) fn new(
11282 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11283 ) -> Self {
11284 Self {
11285 stub,
11286 request: R::default(),
11287 options: crate::RequestOptions::default(),
11288 }
11289 }
11290 }
11291
11292 #[derive(Clone, Debug)]
11313 pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11314
11315 impl Search {
11316 pub(crate) fn new(
11317 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11318 ) -> Self {
11319 Self(RequestBuilder::new(stub))
11320 }
11321
11322 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11324 self.0.request = v.into();
11325 self
11326 }
11327
11328 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11330 self.0.options = v.into();
11331 self
11332 }
11333
11334 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11336 (*self.0.stub)
11337 .search(self.0.request, self.0.options)
11338 .await
11339 .map(crate::Response::into_body)
11340 }
11341
11342 pub fn by_page(
11344 self,
11345 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11346 {
11347 use std::clone::Clone;
11348 let token = self.0.request.page_token.clone();
11349 let execute = move |token: String| {
11350 let mut builder = self.clone();
11351 builder.0.request = builder.0.request.set_page_token(token);
11352 builder.send()
11353 };
11354 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11355 }
11356
11357 pub fn by_item(
11359 self,
11360 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11361 {
11362 use google_cloud_gax::paginator::Paginator;
11363 self.by_page().items()
11364 }
11365
11366 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11370 self.0.request.serving_config = v.into();
11371 self
11372 }
11373
11374 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11376 self.0.request.branch = v.into();
11377 self
11378 }
11379
11380 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11382 self.0.request.query = v.into();
11383 self
11384 }
11385
11386 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
11388 where
11389 T: std::iter::IntoIterator<Item = V>,
11390 V: std::convert::Into<std::string::String>,
11391 {
11392 use std::iter::Iterator;
11393 self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
11394 self
11395 }
11396
11397 pub fn set_image_query<T>(mut self, v: T) -> Self
11399 where
11400 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11401 {
11402 self.0.request.image_query = std::option::Option::Some(v.into());
11403 self
11404 }
11405
11406 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11408 where
11409 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11410 {
11411 self.0.request.image_query = v.map(|x| x.into());
11412 self
11413 }
11414
11415 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11417 self.0.request.page_size = v.into();
11418 self
11419 }
11420
11421 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11423 self.0.request.page_token = v.into();
11424 self
11425 }
11426
11427 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11429 self.0.request.offset = v.into();
11430 self
11431 }
11432
11433 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11435 self.0.request.one_box_page_size = v.into();
11436 self
11437 }
11438
11439 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11441 where
11442 T: std::iter::IntoIterator<Item = V>,
11443 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11444 {
11445 use std::iter::Iterator;
11446 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11447 self
11448 }
11449
11450 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11452 self.0.request.filter = v.into();
11453 self
11454 }
11455
11456 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11458 self.0.request.canonical_filter = v.into();
11459 self
11460 }
11461
11462 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11464 self.0.request.order_by = v.into();
11465 self
11466 }
11467
11468 pub fn set_user_info<T>(mut self, v: T) -> Self
11470 where
11471 T: std::convert::Into<crate::model::UserInfo>,
11472 {
11473 self.0.request.user_info = std::option::Option::Some(v.into());
11474 self
11475 }
11476
11477 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11479 where
11480 T: std::convert::Into<crate::model::UserInfo>,
11481 {
11482 self.0.request.user_info = v.map(|x| x.into());
11483 self
11484 }
11485
11486 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11488 self.0.request.language_code = v.into();
11489 self
11490 }
11491
11492 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11494 where
11495 T: std::iter::IntoIterator<Item = V>,
11496 V: std::convert::Into<crate::model::search_request::FacetSpec>,
11497 {
11498 use std::iter::Iterator;
11499 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11500 self
11501 }
11502
11503 pub fn set_boost_spec<T>(mut self, v: T) -> Self
11505 where
11506 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11507 {
11508 self.0.request.boost_spec = std::option::Option::Some(v.into());
11509 self
11510 }
11511
11512 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11514 where
11515 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11516 {
11517 self.0.request.boost_spec = v.map(|x| x.into());
11518 self
11519 }
11520
11521 pub fn set_params<T, K, V>(mut self, v: T) -> Self
11523 where
11524 T: std::iter::IntoIterator<Item = (K, V)>,
11525 K: std::convert::Into<std::string::String>,
11526 V: std::convert::Into<wkt::Value>,
11527 {
11528 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11529 self
11530 }
11531
11532 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11534 where
11535 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11536 {
11537 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11538 self
11539 }
11540
11541 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11543 where
11544 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11545 {
11546 self.0.request.query_expansion_spec = v.map(|x| x.into());
11547 self
11548 }
11549
11550 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11552 where
11553 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11554 {
11555 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11556 self
11557 }
11558
11559 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11561 where
11562 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11563 {
11564 self.0.request.spell_correction_spec = v.map(|x| x.into());
11565 self
11566 }
11567
11568 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11570 self.0.request.user_pseudo_id = v.into();
11571 self
11572 }
11573
11574 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11576 where
11577 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11578 {
11579 self.0.request.content_search_spec = std::option::Option::Some(v.into());
11580 self
11581 }
11582
11583 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11585 where
11586 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11587 {
11588 self.0.request.content_search_spec = v.map(|x| x.into());
11589 self
11590 }
11591
11592 pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
11594 self.0.request.ranking_expression = v.into();
11595 self
11596 }
11597
11598 pub fn set_ranking_expression_backend<
11600 T: Into<crate::model::search_request::RankingExpressionBackend>,
11601 >(
11602 mut self,
11603 v: T,
11604 ) -> Self {
11605 self.0.request.ranking_expression_backend = v.into();
11606 self
11607 }
11608
11609 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11611 self.0.request.safe_search = v.into();
11612 self
11613 }
11614
11615 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11617 where
11618 T: std::iter::IntoIterator<Item = (K, V)>,
11619 K: std::convert::Into<std::string::String>,
11620 V: std::convert::Into<std::string::String>,
11621 {
11622 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11623 self
11624 }
11625
11626 pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> 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 =
11634 std::option::Option::Some(v.into());
11635 self
11636 }
11637
11638 pub fn set_or_clear_natural_language_query_understanding_spec<T>(
11640 mut self,
11641 v: std::option::Option<T>,
11642 ) -> Self
11643 where
11644 T: std::convert::Into<
11645 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
11646 >,
11647 {
11648 self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
11649 self
11650 }
11651
11652 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11654 where
11655 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11656 {
11657 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11658 self
11659 }
11660
11661 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11663 where
11664 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11665 {
11666 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11667 self
11668 }
11669
11670 pub fn set_display_spec<T>(mut self, v: T) -> Self
11672 where
11673 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11674 {
11675 self.0.request.display_spec = std::option::Option::Some(v.into());
11676 self
11677 }
11678
11679 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11681 where
11682 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11683 {
11684 self.0.request.display_spec = v.map(|x| x.into());
11685 self
11686 }
11687
11688 pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
11690 where
11691 T: std::iter::IntoIterator<Item = V>,
11692 V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
11693 {
11694 use std::iter::Iterator;
11695 self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
11696 self
11697 }
11698
11699 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11701 self.0.request.session = v.into();
11702 self
11703 }
11704
11705 pub fn set_session_spec<T>(mut self, v: T) -> Self
11707 where
11708 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11709 {
11710 self.0.request.session_spec = std::option::Option::Some(v.into());
11711 self
11712 }
11713
11714 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11716 where
11717 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11718 {
11719 self.0.request.session_spec = v.map(|x| x.into());
11720 self
11721 }
11722
11723 pub fn set_relevance_threshold<
11725 T: Into<crate::model::search_request::RelevanceThreshold>,
11726 >(
11727 mut self,
11728 v: T,
11729 ) -> Self {
11730 self.0.request.relevance_threshold = v.into();
11731 self
11732 }
11733
11734 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11736 where
11737 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11738 {
11739 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11740 self
11741 }
11742
11743 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11745 where
11746 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11747 {
11748 self.0.request.relevance_score_spec = v.map(|x| x.into());
11749 self
11750 }
11751 }
11752
11753 #[doc(hidden)]
11754 impl crate::RequestBuilder for Search {
11755 fn request_options(&mut self) -> &mut crate::RequestOptions {
11756 &mut self.0.options
11757 }
11758 }
11759
11760 #[derive(Clone, Debug)]
11781 pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11782
11783 impl SearchLite {
11784 pub(crate) fn new(
11785 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11786 ) -> Self {
11787 Self(RequestBuilder::new(stub))
11788 }
11789
11790 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11792 self.0.request = v.into();
11793 self
11794 }
11795
11796 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11798 self.0.options = v.into();
11799 self
11800 }
11801
11802 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11804 (*self.0.stub)
11805 .search_lite(self.0.request, self.0.options)
11806 .await
11807 .map(crate::Response::into_body)
11808 }
11809
11810 pub fn by_page(
11812 self,
11813 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchResponse, crate::Error>
11814 {
11815 use std::clone::Clone;
11816 let token = self.0.request.page_token.clone();
11817 let execute = move |token: String| {
11818 let mut builder = self.clone();
11819 builder.0.request = builder.0.request.set_page_token(token);
11820 builder.send()
11821 };
11822 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11823 }
11824
11825 pub fn by_item(
11827 self,
11828 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::SearchResponse, crate::Error>
11829 {
11830 use google_cloud_gax::paginator::Paginator;
11831 self.by_page().items()
11832 }
11833
11834 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11838 self.0.request.serving_config = v.into();
11839 self
11840 }
11841
11842 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11844 self.0.request.branch = v.into();
11845 self
11846 }
11847
11848 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11850 self.0.request.query = v.into();
11851 self
11852 }
11853
11854 pub fn set_page_categories<T, V>(mut self, v: T) -> Self
11856 where
11857 T: std::iter::IntoIterator<Item = V>,
11858 V: std::convert::Into<std::string::String>,
11859 {
11860 use std::iter::Iterator;
11861 self.0.request.page_categories = v.into_iter().map(|i| i.into()).collect();
11862 self
11863 }
11864
11865 pub fn set_image_query<T>(mut self, v: T) -> Self
11867 where
11868 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11869 {
11870 self.0.request.image_query = std::option::Option::Some(v.into());
11871 self
11872 }
11873
11874 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11876 where
11877 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11878 {
11879 self.0.request.image_query = v.map(|x| x.into());
11880 self
11881 }
11882
11883 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11885 self.0.request.page_size = v.into();
11886 self
11887 }
11888
11889 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11891 self.0.request.page_token = v.into();
11892 self
11893 }
11894
11895 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11897 self.0.request.offset = v.into();
11898 self
11899 }
11900
11901 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11903 self.0.request.one_box_page_size = v.into();
11904 self
11905 }
11906
11907 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11909 where
11910 T: std::iter::IntoIterator<Item = V>,
11911 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11912 {
11913 use std::iter::Iterator;
11914 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11915 self
11916 }
11917
11918 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11920 self.0.request.filter = v.into();
11921 self
11922 }
11923
11924 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11926 self.0.request.canonical_filter = v.into();
11927 self
11928 }
11929
11930 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11932 self.0.request.order_by = v.into();
11933 self
11934 }
11935
11936 pub fn set_user_info<T>(mut self, v: T) -> Self
11938 where
11939 T: std::convert::Into<crate::model::UserInfo>,
11940 {
11941 self.0.request.user_info = std::option::Option::Some(v.into());
11942 self
11943 }
11944
11945 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11947 where
11948 T: std::convert::Into<crate::model::UserInfo>,
11949 {
11950 self.0.request.user_info = v.map(|x| x.into());
11951 self
11952 }
11953
11954 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11956 self.0.request.language_code = v.into();
11957 self
11958 }
11959
11960 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11962 where
11963 T: std::iter::IntoIterator<Item = V>,
11964 V: std::convert::Into<crate::model::search_request::FacetSpec>,
11965 {
11966 use std::iter::Iterator;
11967 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11968 self
11969 }
11970
11971 pub fn set_boost_spec<T>(mut self, v: T) -> Self
11973 where
11974 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11975 {
11976 self.0.request.boost_spec = std::option::Option::Some(v.into());
11977 self
11978 }
11979
11980 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11982 where
11983 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11984 {
11985 self.0.request.boost_spec = v.map(|x| x.into());
11986 self
11987 }
11988
11989 pub fn set_params<T, K, V>(mut self, v: T) -> Self
11991 where
11992 T: std::iter::IntoIterator<Item = (K, V)>,
11993 K: std::convert::Into<std::string::String>,
11994 V: std::convert::Into<wkt::Value>,
11995 {
11996 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11997 self
11998 }
11999
12000 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
12002 where
12003 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12004 {
12005 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
12006 self
12007 }
12008
12009 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
12011 where
12012 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
12013 {
12014 self.0.request.query_expansion_spec = v.map(|x| x.into());
12015 self
12016 }
12017
12018 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
12020 where
12021 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12022 {
12023 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
12024 self
12025 }
12026
12027 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
12029 where
12030 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
12031 {
12032 self.0.request.spell_correction_spec = v.map(|x| x.into());
12033 self
12034 }
12035
12036 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12038 self.0.request.user_pseudo_id = v.into();
12039 self
12040 }
12041
12042 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
12044 where
12045 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12046 {
12047 self.0.request.content_search_spec = std::option::Option::Some(v.into());
12048 self
12049 }
12050
12051 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
12053 where
12054 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
12055 {
12056 self.0.request.content_search_spec = v.map(|x| x.into());
12057 self
12058 }
12059
12060 pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12062 self.0.request.ranking_expression = v.into();
12063 self
12064 }
12065
12066 pub fn set_ranking_expression_backend<
12068 T: Into<crate::model::search_request::RankingExpressionBackend>,
12069 >(
12070 mut self,
12071 v: T,
12072 ) -> Self {
12073 self.0.request.ranking_expression_backend = v.into();
12074 self
12075 }
12076
12077 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
12079 self.0.request.safe_search = v.into();
12080 self
12081 }
12082
12083 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
12085 where
12086 T: std::iter::IntoIterator<Item = (K, V)>,
12087 K: std::convert::Into<std::string::String>,
12088 V: std::convert::Into<std::string::String>,
12089 {
12090 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
12091 self
12092 }
12093
12094 pub fn set_natural_language_query_understanding_spec<T>(mut self, v: T) -> 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 =
12102 std::option::Option::Some(v.into());
12103 self
12104 }
12105
12106 pub fn set_or_clear_natural_language_query_understanding_spec<T>(
12108 mut self,
12109 v: std::option::Option<T>,
12110 ) -> Self
12111 where
12112 T: std::convert::Into<
12113 crate::model::search_request::NaturalLanguageQueryUnderstandingSpec,
12114 >,
12115 {
12116 self.0.request.natural_language_query_understanding_spec = v.map(|x| x.into());
12117 self
12118 }
12119
12120 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
12122 where
12123 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12124 {
12125 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
12126 self
12127 }
12128
12129 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
12131 where
12132 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
12133 {
12134 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
12135 self
12136 }
12137
12138 pub fn set_display_spec<T>(mut self, v: T) -> Self
12140 where
12141 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12142 {
12143 self.0.request.display_spec = std::option::Option::Some(v.into());
12144 self
12145 }
12146
12147 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
12149 where
12150 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
12151 {
12152 self.0.request.display_spec = v.map(|x| x.into());
12153 self
12154 }
12155
12156 pub fn set_crowding_specs<T, V>(mut self, v: T) -> Self
12158 where
12159 T: std::iter::IntoIterator<Item = V>,
12160 V: std::convert::Into<crate::model::search_request::CrowdingSpec>,
12161 {
12162 use std::iter::Iterator;
12163 self.0.request.crowding_specs = v.into_iter().map(|i| i.into()).collect();
12164 self
12165 }
12166
12167 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
12169 self.0.request.session = v.into();
12170 self
12171 }
12172
12173 pub fn set_session_spec<T>(mut self, v: T) -> Self
12175 where
12176 T: std::convert::Into<crate::model::search_request::SessionSpec>,
12177 {
12178 self.0.request.session_spec = std::option::Option::Some(v.into());
12179 self
12180 }
12181
12182 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
12184 where
12185 T: std::convert::Into<crate::model::search_request::SessionSpec>,
12186 {
12187 self.0.request.session_spec = v.map(|x| x.into());
12188 self
12189 }
12190
12191 pub fn set_relevance_threshold<
12193 T: Into<crate::model::search_request::RelevanceThreshold>,
12194 >(
12195 mut self,
12196 v: T,
12197 ) -> Self {
12198 self.0.request.relevance_threshold = v.into();
12199 self
12200 }
12201
12202 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
12204 where
12205 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12206 {
12207 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
12208 self
12209 }
12210
12211 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12213 where
12214 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12215 {
12216 self.0.request.relevance_score_spec = v.map(|x| x.into());
12217 self
12218 }
12219 }
12220
12221 #[doc(hidden)]
12222 impl crate::RequestBuilder for SearchLite {
12223 fn request_options(&mut self) -> &mut crate::RequestOptions {
12224 &mut self.0.options
12225 }
12226 }
12227
12228 #[derive(Clone, Debug)]
12249 pub struct ListOperations(
12250 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12251 );
12252
12253 impl ListOperations {
12254 pub(crate) fn new(
12255 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12256 ) -> Self {
12257 Self(RequestBuilder::new(stub))
12258 }
12259
12260 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12262 mut self,
12263 v: V,
12264 ) -> Self {
12265 self.0.request = v.into();
12266 self
12267 }
12268
12269 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12271 self.0.options = v.into();
12272 self
12273 }
12274
12275 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12277 (*self.0.stub)
12278 .list_operations(self.0.request, self.0.options)
12279 .await
12280 .map(crate::Response::into_body)
12281 }
12282
12283 pub fn by_page(
12285 self,
12286 ) -> impl google_cloud_gax::paginator::Paginator<
12287 google_cloud_longrunning::model::ListOperationsResponse,
12288 crate::Error,
12289 > {
12290 use std::clone::Clone;
12291 let token = self.0.request.page_token.clone();
12292 let execute = move |token: String| {
12293 let mut builder = self.clone();
12294 builder.0.request = builder.0.request.set_page_token(token);
12295 builder.send()
12296 };
12297 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12298 }
12299
12300 pub fn by_item(
12302 self,
12303 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12304 google_cloud_longrunning::model::ListOperationsResponse,
12305 crate::Error,
12306 > {
12307 use google_cloud_gax::paginator::Paginator;
12308 self.by_page().items()
12309 }
12310
12311 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12313 self.0.request.name = v.into();
12314 self
12315 }
12316
12317 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12319 self.0.request.filter = v.into();
12320 self
12321 }
12322
12323 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12325 self.0.request.page_size = v.into();
12326 self
12327 }
12328
12329 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12331 self.0.request.page_token = v.into();
12332 self
12333 }
12334
12335 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12337 self.0.request.return_partial_success = v.into();
12338 self
12339 }
12340 }
12341
12342 #[doc(hidden)]
12343 impl crate::RequestBuilder for ListOperations {
12344 fn request_options(&mut self) -> &mut crate::RequestOptions {
12345 &mut self.0.options
12346 }
12347 }
12348
12349 #[derive(Clone, Debug)]
12366 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12367
12368 impl GetOperation {
12369 pub(crate) fn new(
12370 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12371 ) -> Self {
12372 Self(RequestBuilder::new(stub))
12373 }
12374
12375 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12377 mut self,
12378 v: V,
12379 ) -> Self {
12380 self.0.request = v.into();
12381 self
12382 }
12383
12384 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12386 self.0.options = v.into();
12387 self
12388 }
12389
12390 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12392 (*self.0.stub)
12393 .get_operation(self.0.request, self.0.options)
12394 .await
12395 .map(crate::Response::into_body)
12396 }
12397
12398 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12400 self.0.request.name = v.into();
12401 self
12402 }
12403 }
12404
12405 #[doc(hidden)]
12406 impl crate::RequestBuilder for GetOperation {
12407 fn request_options(&mut self) -> &mut crate::RequestOptions {
12408 &mut self.0.options
12409 }
12410 }
12411
12412 #[derive(Clone, Debug)]
12429 pub struct CancelOperation(
12430 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12431 );
12432
12433 impl CancelOperation {
12434 pub(crate) fn new(
12435 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12436 ) -> Self {
12437 Self(RequestBuilder::new(stub))
12438 }
12439
12440 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12442 mut self,
12443 v: V,
12444 ) -> Self {
12445 self.0.request = v.into();
12446 self
12447 }
12448
12449 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12451 self.0.options = v.into();
12452 self
12453 }
12454
12455 pub async fn send(self) -> Result<()> {
12457 (*self.0.stub)
12458 .cancel_operation(self.0.request, self.0.options)
12459 .await
12460 .map(crate::Response::into_body)
12461 }
12462
12463 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12465 self.0.request.name = v.into();
12466 self
12467 }
12468 }
12469
12470 #[doc(hidden)]
12471 impl crate::RequestBuilder for CancelOperation {
12472 fn request_options(&mut self) -> &mut crate::RequestOptions {
12473 &mut self.0.options
12474 }
12475 }
12476}
12477
12478#[cfg(feature = "search-tuning-service")]
12480#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12481pub mod search_tuning_service {
12482 use crate::Result;
12483
12484 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12498
12499 pub(crate) mod client {
12500 use super::super::super::client::SearchTuningService;
12501 pub struct Factory;
12502 impl crate::ClientFactory for Factory {
12503 type Client = SearchTuningService;
12504 type Credentials = gaxi::options::Credentials;
12505 async fn build(
12506 self,
12507 config: gaxi::options::ClientConfig,
12508 ) -> crate::ClientBuilderResult<Self::Client> {
12509 Self::Client::new(config).await
12510 }
12511 }
12512 }
12513
12514 #[derive(Clone, Debug)]
12516 pub(crate) struct RequestBuilder<R: std::default::Default> {
12517 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12518 request: R,
12519 options: crate::RequestOptions,
12520 }
12521
12522 impl<R> RequestBuilder<R>
12523 where
12524 R: std::default::Default,
12525 {
12526 pub(crate) fn new(
12527 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12528 ) -> Self {
12529 Self {
12530 stub,
12531 request: R::default(),
12532 options: crate::RequestOptions::default(),
12533 }
12534 }
12535 }
12536
12537 #[derive(Clone, Debug)]
12555 pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12556
12557 impl TrainCustomModel {
12558 pub(crate) fn new(
12559 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12560 ) -> Self {
12561 Self(RequestBuilder::new(stub))
12562 }
12563
12564 pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12566 mut self,
12567 v: V,
12568 ) -> Self {
12569 self.0.request = v.into();
12570 self
12571 }
12572
12573 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12575 self.0.options = v.into();
12576 self
12577 }
12578
12579 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12586 (*self.0.stub)
12587 .train_custom_model(self.0.request, self.0.options)
12588 .await
12589 .map(crate::Response::into_body)
12590 }
12591
12592 pub fn poller(
12594 self,
12595 ) -> impl google_cloud_lro::Poller<
12596 crate::model::TrainCustomModelResponse,
12597 crate::model::TrainCustomModelMetadata,
12598 > {
12599 type Operation = google_cloud_lro::internal::Operation<
12600 crate::model::TrainCustomModelResponse,
12601 crate::model::TrainCustomModelMetadata,
12602 >;
12603 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12604 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12605
12606 let stub = self.0.stub.clone();
12607 let mut options = self.0.options.clone();
12608 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
12609 let query = move |name| {
12610 let stub = stub.clone();
12611 let options = options.clone();
12612 async {
12613 let op = GetOperation::new(stub)
12614 .set_name(name)
12615 .with_options(options)
12616 .send()
12617 .await?;
12618 Ok(Operation::new(op))
12619 }
12620 };
12621
12622 let start = move || async {
12623 let op = self.send().await?;
12624 Ok(Operation::new(op))
12625 };
12626
12627 google_cloud_lro::internal::new_poller(
12628 polling_error_policy,
12629 polling_backoff_policy,
12630 start,
12631 query,
12632 )
12633 }
12634
12635 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12639 self.0.request.data_store = v.into();
12640 self
12641 }
12642
12643 pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12645 self.0.request.model_type = v.into();
12646 self
12647 }
12648
12649 pub fn set_error_config<T>(mut self, v: T) -> Self
12651 where
12652 T: std::convert::Into<crate::model::ImportErrorConfig>,
12653 {
12654 self.0.request.error_config = std::option::Option::Some(v.into());
12655 self
12656 }
12657
12658 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12660 where
12661 T: std::convert::Into<crate::model::ImportErrorConfig>,
12662 {
12663 self.0.request.error_config = v.map(|x| x.into());
12664 self
12665 }
12666
12667 pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12669 self.0.request.model_id = v.into();
12670 self
12671 }
12672
12673 pub fn set_training_input<
12678 T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12679 >(
12680 mut self,
12681 v: T,
12682 ) -> Self {
12683 self.0.request.training_input = v.into();
12684 self
12685 }
12686
12687 pub fn set_gcs_training_input<
12693 T: std::convert::Into<
12694 std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12695 >,
12696 >(
12697 mut self,
12698 v: T,
12699 ) -> Self {
12700 self.0.request = self.0.request.set_gcs_training_input(v);
12701 self
12702 }
12703 }
12704
12705 #[doc(hidden)]
12706 impl crate::RequestBuilder for TrainCustomModel {
12707 fn request_options(&mut self) -> &mut crate::RequestOptions {
12708 &mut self.0.options
12709 }
12710 }
12711
12712 #[derive(Clone, Debug)]
12729 pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12730
12731 impl ListCustomModels {
12732 pub(crate) fn new(
12733 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12734 ) -> Self {
12735 Self(RequestBuilder::new(stub))
12736 }
12737
12738 pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12740 mut self,
12741 v: V,
12742 ) -> Self {
12743 self.0.request = v.into();
12744 self
12745 }
12746
12747 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12749 self.0.options = v.into();
12750 self
12751 }
12752
12753 pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12755 (*self.0.stub)
12756 .list_custom_models(self.0.request, self.0.options)
12757 .await
12758 .map(crate::Response::into_body)
12759 }
12760
12761 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12765 self.0.request.data_store = v.into();
12766 self
12767 }
12768 }
12769
12770 #[doc(hidden)]
12771 impl crate::RequestBuilder for ListCustomModels {
12772 fn request_options(&mut self) -> &mut crate::RequestOptions {
12773 &mut self.0.options
12774 }
12775 }
12776
12777 #[derive(Clone, Debug)]
12798 pub struct ListOperations(
12799 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12800 );
12801
12802 impl ListOperations {
12803 pub(crate) fn new(
12804 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12805 ) -> Self {
12806 Self(RequestBuilder::new(stub))
12807 }
12808
12809 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12811 mut self,
12812 v: V,
12813 ) -> Self {
12814 self.0.request = v.into();
12815 self
12816 }
12817
12818 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12820 self.0.options = v.into();
12821 self
12822 }
12823
12824 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12826 (*self.0.stub)
12827 .list_operations(self.0.request, self.0.options)
12828 .await
12829 .map(crate::Response::into_body)
12830 }
12831
12832 pub fn by_page(
12834 self,
12835 ) -> impl google_cloud_gax::paginator::Paginator<
12836 google_cloud_longrunning::model::ListOperationsResponse,
12837 crate::Error,
12838 > {
12839 use std::clone::Clone;
12840 let token = self.0.request.page_token.clone();
12841 let execute = move |token: String| {
12842 let mut builder = self.clone();
12843 builder.0.request = builder.0.request.set_page_token(token);
12844 builder.send()
12845 };
12846 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12847 }
12848
12849 pub fn by_item(
12851 self,
12852 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12853 google_cloud_longrunning::model::ListOperationsResponse,
12854 crate::Error,
12855 > {
12856 use google_cloud_gax::paginator::Paginator;
12857 self.by_page().items()
12858 }
12859
12860 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12862 self.0.request.name = v.into();
12863 self
12864 }
12865
12866 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12868 self.0.request.filter = v.into();
12869 self
12870 }
12871
12872 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12874 self.0.request.page_size = v.into();
12875 self
12876 }
12877
12878 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12880 self.0.request.page_token = v.into();
12881 self
12882 }
12883
12884 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12886 self.0.request.return_partial_success = v.into();
12887 self
12888 }
12889 }
12890
12891 #[doc(hidden)]
12892 impl crate::RequestBuilder for ListOperations {
12893 fn request_options(&mut self) -> &mut crate::RequestOptions {
12894 &mut self.0.options
12895 }
12896 }
12897
12898 #[derive(Clone, Debug)]
12915 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12916
12917 impl GetOperation {
12918 pub(crate) fn new(
12919 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12920 ) -> Self {
12921 Self(RequestBuilder::new(stub))
12922 }
12923
12924 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12926 mut self,
12927 v: V,
12928 ) -> Self {
12929 self.0.request = v.into();
12930 self
12931 }
12932
12933 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12935 self.0.options = v.into();
12936 self
12937 }
12938
12939 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12941 (*self.0.stub)
12942 .get_operation(self.0.request, self.0.options)
12943 .await
12944 .map(crate::Response::into_body)
12945 }
12946
12947 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12949 self.0.request.name = v.into();
12950 self
12951 }
12952 }
12953
12954 #[doc(hidden)]
12955 impl crate::RequestBuilder for GetOperation {
12956 fn request_options(&mut self) -> &mut crate::RequestOptions {
12957 &mut self.0.options
12958 }
12959 }
12960
12961 #[derive(Clone, Debug)]
12978 pub struct CancelOperation(
12979 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12980 );
12981
12982 impl CancelOperation {
12983 pub(crate) fn new(
12984 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12985 ) -> Self {
12986 Self(RequestBuilder::new(stub))
12987 }
12988
12989 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12991 mut self,
12992 v: V,
12993 ) -> Self {
12994 self.0.request = v.into();
12995 self
12996 }
12997
12998 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13000 self.0.options = v.into();
13001 self
13002 }
13003
13004 pub async fn send(self) -> Result<()> {
13006 (*self.0.stub)
13007 .cancel_operation(self.0.request, self.0.options)
13008 .await
13009 .map(crate::Response::into_body)
13010 }
13011
13012 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13014 self.0.request.name = v.into();
13015 self
13016 }
13017 }
13018
13019 #[doc(hidden)]
13020 impl crate::RequestBuilder for CancelOperation {
13021 fn request_options(&mut self) -> &mut crate::RequestOptions {
13022 &mut self.0.options
13023 }
13024 }
13025}
13026
13027#[cfg(feature = "serving-config-service")]
13029#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
13030pub mod serving_config_service {
13031 use crate::Result;
13032
13033 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13047
13048 pub(crate) mod client {
13049 use super::super::super::client::ServingConfigService;
13050 pub struct Factory;
13051 impl crate::ClientFactory for Factory {
13052 type Client = ServingConfigService;
13053 type Credentials = gaxi::options::Credentials;
13054 async fn build(
13055 self,
13056 config: gaxi::options::ClientConfig,
13057 ) -> crate::ClientBuilderResult<Self::Client> {
13058 Self::Client::new(config).await
13059 }
13060 }
13061 }
13062
13063 #[derive(Clone, Debug)]
13065 pub(crate) struct RequestBuilder<R: std::default::Default> {
13066 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13067 request: R,
13068 options: crate::RequestOptions,
13069 }
13070
13071 impl<R> RequestBuilder<R>
13072 where
13073 R: std::default::Default,
13074 {
13075 pub(crate) fn new(
13076 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13077 ) -> Self {
13078 Self {
13079 stub,
13080 request: R::default(),
13081 options: crate::RequestOptions::default(),
13082 }
13083 }
13084 }
13085
13086 #[derive(Clone, Debug)]
13103 pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
13104
13105 impl UpdateServingConfig {
13106 pub(crate) fn new(
13107 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13108 ) -> Self {
13109 Self(RequestBuilder::new(stub))
13110 }
13111
13112 pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
13114 mut self,
13115 v: V,
13116 ) -> Self {
13117 self.0.request = v.into();
13118 self
13119 }
13120
13121 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13123 self.0.options = v.into();
13124 self
13125 }
13126
13127 pub async fn send(self) -> Result<crate::model::ServingConfig> {
13129 (*self.0.stub)
13130 .update_serving_config(self.0.request, self.0.options)
13131 .await
13132 .map(crate::Response::into_body)
13133 }
13134
13135 pub fn set_serving_config<T>(mut self, v: T) -> Self
13139 where
13140 T: std::convert::Into<crate::model::ServingConfig>,
13141 {
13142 self.0.request.serving_config = std::option::Option::Some(v.into());
13143 self
13144 }
13145
13146 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
13150 where
13151 T: std::convert::Into<crate::model::ServingConfig>,
13152 {
13153 self.0.request.serving_config = v.map(|x| x.into());
13154 self
13155 }
13156
13157 pub fn set_update_mask<T>(mut self, v: T) -> Self
13159 where
13160 T: std::convert::Into<wkt::FieldMask>,
13161 {
13162 self.0.request.update_mask = std::option::Option::Some(v.into());
13163 self
13164 }
13165
13166 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13168 where
13169 T: std::convert::Into<wkt::FieldMask>,
13170 {
13171 self.0.request.update_mask = v.map(|x| x.into());
13172 self
13173 }
13174 }
13175
13176 #[doc(hidden)]
13177 impl crate::RequestBuilder for UpdateServingConfig {
13178 fn request_options(&mut self) -> &mut crate::RequestOptions {
13179 &mut self.0.options
13180 }
13181 }
13182
13183 #[derive(Clone, Debug)]
13204 pub struct ListOperations(
13205 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13206 );
13207
13208 impl ListOperations {
13209 pub(crate) fn new(
13210 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13211 ) -> Self {
13212 Self(RequestBuilder::new(stub))
13213 }
13214
13215 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13217 mut self,
13218 v: V,
13219 ) -> Self {
13220 self.0.request = v.into();
13221 self
13222 }
13223
13224 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13226 self.0.options = v.into();
13227 self
13228 }
13229
13230 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13232 (*self.0.stub)
13233 .list_operations(self.0.request, self.0.options)
13234 .await
13235 .map(crate::Response::into_body)
13236 }
13237
13238 pub fn by_page(
13240 self,
13241 ) -> impl google_cloud_gax::paginator::Paginator<
13242 google_cloud_longrunning::model::ListOperationsResponse,
13243 crate::Error,
13244 > {
13245 use std::clone::Clone;
13246 let token = self.0.request.page_token.clone();
13247 let execute = move |token: String| {
13248 let mut builder = self.clone();
13249 builder.0.request = builder.0.request.set_page_token(token);
13250 builder.send()
13251 };
13252 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13253 }
13254
13255 pub fn by_item(
13257 self,
13258 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13259 google_cloud_longrunning::model::ListOperationsResponse,
13260 crate::Error,
13261 > {
13262 use google_cloud_gax::paginator::Paginator;
13263 self.by_page().items()
13264 }
13265
13266 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13268 self.0.request.name = v.into();
13269 self
13270 }
13271
13272 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13274 self.0.request.filter = v.into();
13275 self
13276 }
13277
13278 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13280 self.0.request.page_size = v.into();
13281 self
13282 }
13283
13284 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13286 self.0.request.page_token = v.into();
13287 self
13288 }
13289
13290 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13292 self.0.request.return_partial_success = v.into();
13293 self
13294 }
13295 }
13296
13297 #[doc(hidden)]
13298 impl crate::RequestBuilder for ListOperations {
13299 fn request_options(&mut self) -> &mut crate::RequestOptions {
13300 &mut self.0.options
13301 }
13302 }
13303
13304 #[derive(Clone, Debug)]
13321 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13322
13323 impl GetOperation {
13324 pub(crate) fn new(
13325 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13326 ) -> Self {
13327 Self(RequestBuilder::new(stub))
13328 }
13329
13330 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13332 mut self,
13333 v: V,
13334 ) -> Self {
13335 self.0.request = v.into();
13336 self
13337 }
13338
13339 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13341 self.0.options = v.into();
13342 self
13343 }
13344
13345 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13347 (*self.0.stub)
13348 .get_operation(self.0.request, self.0.options)
13349 .await
13350 .map(crate::Response::into_body)
13351 }
13352
13353 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13355 self.0.request.name = v.into();
13356 self
13357 }
13358 }
13359
13360 #[doc(hidden)]
13361 impl crate::RequestBuilder for GetOperation {
13362 fn request_options(&mut self) -> &mut crate::RequestOptions {
13363 &mut self.0.options
13364 }
13365 }
13366
13367 #[derive(Clone, Debug)]
13384 pub struct CancelOperation(
13385 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13386 );
13387
13388 impl CancelOperation {
13389 pub(crate) fn new(
13390 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13391 ) -> Self {
13392 Self(RequestBuilder::new(stub))
13393 }
13394
13395 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13397 mut self,
13398 v: V,
13399 ) -> Self {
13400 self.0.request = v.into();
13401 self
13402 }
13403
13404 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13406 self.0.options = v.into();
13407 self
13408 }
13409
13410 pub async fn send(self) -> Result<()> {
13412 (*self.0.stub)
13413 .cancel_operation(self.0.request, self.0.options)
13414 .await
13415 .map(crate::Response::into_body)
13416 }
13417
13418 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13420 self.0.request.name = v.into();
13421 self
13422 }
13423 }
13424
13425 #[doc(hidden)]
13426 impl crate::RequestBuilder for CancelOperation {
13427 fn request_options(&mut self) -> &mut crate::RequestOptions {
13428 &mut self.0.options
13429 }
13430 }
13431}
13432
13433#[cfg(feature = "session-service")]
13435#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13436pub mod session_service {
13437 use crate::Result;
13438
13439 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13453
13454 pub(crate) mod client {
13455 use super::super::super::client::SessionService;
13456 pub struct Factory;
13457 impl crate::ClientFactory for Factory {
13458 type Client = SessionService;
13459 type Credentials = gaxi::options::Credentials;
13460 async fn build(
13461 self,
13462 config: gaxi::options::ClientConfig,
13463 ) -> crate::ClientBuilderResult<Self::Client> {
13464 Self::Client::new(config).await
13465 }
13466 }
13467 }
13468
13469 #[derive(Clone, Debug)]
13471 pub(crate) struct RequestBuilder<R: std::default::Default> {
13472 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13473 request: R,
13474 options: crate::RequestOptions,
13475 }
13476
13477 impl<R> RequestBuilder<R>
13478 where
13479 R: std::default::Default,
13480 {
13481 pub(crate) fn new(
13482 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13483 ) -> Self {
13484 Self {
13485 stub,
13486 request: R::default(),
13487 options: crate::RequestOptions::default(),
13488 }
13489 }
13490 }
13491
13492 #[derive(Clone, Debug)]
13509 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13510
13511 impl CreateSession {
13512 pub(crate) fn new(
13513 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13514 ) -> Self {
13515 Self(RequestBuilder::new(stub))
13516 }
13517
13518 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13520 self.0.request = v.into();
13521 self
13522 }
13523
13524 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13526 self.0.options = v.into();
13527 self
13528 }
13529
13530 pub async fn send(self) -> Result<crate::model::Session> {
13532 (*self.0.stub)
13533 .create_session(self.0.request, self.0.options)
13534 .await
13535 .map(crate::Response::into_body)
13536 }
13537
13538 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13542 self.0.request.parent = v.into();
13543 self
13544 }
13545
13546 pub fn set_session<T>(mut self, v: T) -> Self
13550 where
13551 T: std::convert::Into<crate::model::Session>,
13552 {
13553 self.0.request.session = std::option::Option::Some(v.into());
13554 self
13555 }
13556
13557 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13561 where
13562 T: std::convert::Into<crate::model::Session>,
13563 {
13564 self.0.request.session = v.map(|x| x.into());
13565 self
13566 }
13567 }
13568
13569 #[doc(hidden)]
13570 impl crate::RequestBuilder for CreateSession {
13571 fn request_options(&mut self) -> &mut crate::RequestOptions {
13572 &mut self.0.options
13573 }
13574 }
13575
13576 #[derive(Clone, Debug)]
13593 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13594
13595 impl DeleteSession {
13596 pub(crate) fn new(
13597 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13598 ) -> Self {
13599 Self(RequestBuilder::new(stub))
13600 }
13601
13602 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13604 self.0.request = v.into();
13605 self
13606 }
13607
13608 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13610 self.0.options = v.into();
13611 self
13612 }
13613
13614 pub async fn send(self) -> Result<()> {
13616 (*self.0.stub)
13617 .delete_session(self.0.request, self.0.options)
13618 .await
13619 .map(crate::Response::into_body)
13620 }
13621
13622 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13626 self.0.request.name = v.into();
13627 self
13628 }
13629 }
13630
13631 #[doc(hidden)]
13632 impl crate::RequestBuilder for DeleteSession {
13633 fn request_options(&mut self) -> &mut crate::RequestOptions {
13634 &mut self.0.options
13635 }
13636 }
13637
13638 #[derive(Clone, Debug)]
13655 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13656
13657 impl UpdateSession {
13658 pub(crate) fn new(
13659 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13660 ) -> Self {
13661 Self(RequestBuilder::new(stub))
13662 }
13663
13664 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13666 self.0.request = v.into();
13667 self
13668 }
13669
13670 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13672 self.0.options = v.into();
13673 self
13674 }
13675
13676 pub async fn send(self) -> Result<crate::model::Session> {
13678 (*self.0.stub)
13679 .update_session(self.0.request, self.0.options)
13680 .await
13681 .map(crate::Response::into_body)
13682 }
13683
13684 pub fn set_session<T>(mut self, v: T) -> Self
13688 where
13689 T: std::convert::Into<crate::model::Session>,
13690 {
13691 self.0.request.session = std::option::Option::Some(v.into());
13692 self
13693 }
13694
13695 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13699 where
13700 T: std::convert::Into<crate::model::Session>,
13701 {
13702 self.0.request.session = v.map(|x| x.into());
13703 self
13704 }
13705
13706 pub fn set_update_mask<T>(mut self, v: T) -> Self
13708 where
13709 T: std::convert::Into<wkt::FieldMask>,
13710 {
13711 self.0.request.update_mask = std::option::Option::Some(v.into());
13712 self
13713 }
13714
13715 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13717 where
13718 T: std::convert::Into<wkt::FieldMask>,
13719 {
13720 self.0.request.update_mask = v.map(|x| x.into());
13721 self
13722 }
13723 }
13724
13725 #[doc(hidden)]
13726 impl crate::RequestBuilder for UpdateSession {
13727 fn request_options(&mut self) -> &mut crate::RequestOptions {
13728 &mut self.0.options
13729 }
13730 }
13731
13732 #[derive(Clone, Debug)]
13749 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13750
13751 impl GetSession {
13752 pub(crate) fn new(
13753 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13754 ) -> Self {
13755 Self(RequestBuilder::new(stub))
13756 }
13757
13758 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13760 self.0.request = v.into();
13761 self
13762 }
13763
13764 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13766 self.0.options = v.into();
13767 self
13768 }
13769
13770 pub async fn send(self) -> Result<crate::model::Session> {
13772 (*self.0.stub)
13773 .get_session(self.0.request, self.0.options)
13774 .await
13775 .map(crate::Response::into_body)
13776 }
13777
13778 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13782 self.0.request.name = v.into();
13783 self
13784 }
13785
13786 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13788 self.0.request.include_answer_details = v.into();
13789 self
13790 }
13791 }
13792
13793 #[doc(hidden)]
13794 impl crate::RequestBuilder for GetSession {
13795 fn request_options(&mut self) -> &mut crate::RequestOptions {
13796 &mut self.0.options
13797 }
13798 }
13799
13800 #[derive(Clone, Debug)]
13821 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
13822
13823 impl ListSessions {
13824 pub(crate) fn new(
13825 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13826 ) -> Self {
13827 Self(RequestBuilder::new(stub))
13828 }
13829
13830 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
13832 self.0.request = v.into();
13833 self
13834 }
13835
13836 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13838 self.0.options = v.into();
13839 self
13840 }
13841
13842 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
13844 (*self.0.stub)
13845 .list_sessions(self.0.request, self.0.options)
13846 .await
13847 .map(crate::Response::into_body)
13848 }
13849
13850 pub fn by_page(
13852 self,
13853 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSessionsResponse, crate::Error>
13854 {
13855 use std::clone::Clone;
13856 let token = self.0.request.page_token.clone();
13857 let execute = move |token: String| {
13858 let mut builder = self.clone();
13859 builder.0.request = builder.0.request.set_page_token(token);
13860 builder.send()
13861 };
13862 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13863 }
13864
13865 pub fn by_item(
13867 self,
13868 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13869 crate::model::ListSessionsResponse,
13870 crate::Error,
13871 > {
13872 use google_cloud_gax::paginator::Paginator;
13873 self.by_page().items()
13874 }
13875
13876 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13880 self.0.request.parent = v.into();
13881 self
13882 }
13883
13884 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13886 self.0.request.page_size = v.into();
13887 self
13888 }
13889
13890 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13892 self.0.request.page_token = v.into();
13893 self
13894 }
13895
13896 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13898 self.0.request.filter = v.into();
13899 self
13900 }
13901
13902 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
13904 self.0.request.order_by = v.into();
13905 self
13906 }
13907 }
13908
13909 #[doc(hidden)]
13910 impl crate::RequestBuilder for ListSessions {
13911 fn request_options(&mut self) -> &mut crate::RequestOptions {
13912 &mut self.0.options
13913 }
13914 }
13915
13916 #[derive(Clone, Debug)]
13937 pub struct ListOperations(
13938 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13939 );
13940
13941 impl ListOperations {
13942 pub(crate) fn new(
13943 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13944 ) -> Self {
13945 Self(RequestBuilder::new(stub))
13946 }
13947
13948 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13950 mut self,
13951 v: V,
13952 ) -> Self {
13953 self.0.request = v.into();
13954 self
13955 }
13956
13957 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13959 self.0.options = v.into();
13960 self
13961 }
13962
13963 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13965 (*self.0.stub)
13966 .list_operations(self.0.request, self.0.options)
13967 .await
13968 .map(crate::Response::into_body)
13969 }
13970
13971 pub fn by_page(
13973 self,
13974 ) -> impl google_cloud_gax::paginator::Paginator<
13975 google_cloud_longrunning::model::ListOperationsResponse,
13976 crate::Error,
13977 > {
13978 use std::clone::Clone;
13979 let token = self.0.request.page_token.clone();
13980 let execute = move |token: String| {
13981 let mut builder = self.clone();
13982 builder.0.request = builder.0.request.set_page_token(token);
13983 builder.send()
13984 };
13985 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13986 }
13987
13988 pub fn by_item(
13990 self,
13991 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13992 google_cloud_longrunning::model::ListOperationsResponse,
13993 crate::Error,
13994 > {
13995 use google_cloud_gax::paginator::Paginator;
13996 self.by_page().items()
13997 }
13998
13999 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14001 self.0.request.name = v.into();
14002 self
14003 }
14004
14005 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14007 self.0.request.filter = v.into();
14008 self
14009 }
14010
14011 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14013 self.0.request.page_size = v.into();
14014 self
14015 }
14016
14017 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14019 self.0.request.page_token = v.into();
14020 self
14021 }
14022
14023 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14025 self.0.request.return_partial_success = v.into();
14026 self
14027 }
14028 }
14029
14030 #[doc(hidden)]
14031 impl crate::RequestBuilder for ListOperations {
14032 fn request_options(&mut self) -> &mut crate::RequestOptions {
14033 &mut self.0.options
14034 }
14035 }
14036
14037 #[derive(Clone, Debug)]
14054 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14055
14056 impl GetOperation {
14057 pub(crate) fn new(
14058 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14059 ) -> Self {
14060 Self(RequestBuilder::new(stub))
14061 }
14062
14063 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14065 mut self,
14066 v: V,
14067 ) -> Self {
14068 self.0.request = v.into();
14069 self
14070 }
14071
14072 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14074 self.0.options = v.into();
14075 self
14076 }
14077
14078 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14080 (*self.0.stub)
14081 .get_operation(self.0.request, self.0.options)
14082 .await
14083 .map(crate::Response::into_body)
14084 }
14085
14086 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14088 self.0.request.name = v.into();
14089 self
14090 }
14091 }
14092
14093 #[doc(hidden)]
14094 impl crate::RequestBuilder for GetOperation {
14095 fn request_options(&mut self) -> &mut crate::RequestOptions {
14096 &mut self.0.options
14097 }
14098 }
14099
14100 #[derive(Clone, Debug)]
14117 pub struct CancelOperation(
14118 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14119 );
14120
14121 impl CancelOperation {
14122 pub(crate) fn new(
14123 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
14124 ) -> Self {
14125 Self(RequestBuilder::new(stub))
14126 }
14127
14128 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
14130 mut self,
14131 v: V,
14132 ) -> Self {
14133 self.0.request = v.into();
14134 self
14135 }
14136
14137 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14139 self.0.options = v.into();
14140 self
14141 }
14142
14143 pub async fn send(self) -> Result<()> {
14145 (*self.0.stub)
14146 .cancel_operation(self.0.request, self.0.options)
14147 .await
14148 .map(crate::Response::into_body)
14149 }
14150
14151 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14153 self.0.request.name = v.into();
14154 self
14155 }
14156 }
14157
14158 #[doc(hidden)]
14159 impl crate::RequestBuilder for CancelOperation {
14160 fn request_options(&mut self) -> &mut crate::RequestOptions {
14161 &mut self.0.options
14162 }
14163 }
14164}
14165
14166#[cfg(feature = "site-search-engine-service")]
14168#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
14169pub mod site_search_engine_service {
14170 use crate::Result;
14171
14172 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14186
14187 pub(crate) mod client {
14188 use super::super::super::client::SiteSearchEngineService;
14189 pub struct Factory;
14190 impl crate::ClientFactory for Factory {
14191 type Client = SiteSearchEngineService;
14192 type Credentials = gaxi::options::Credentials;
14193 async fn build(
14194 self,
14195 config: gaxi::options::ClientConfig,
14196 ) -> crate::ClientBuilderResult<Self::Client> {
14197 Self::Client::new(config).await
14198 }
14199 }
14200 }
14201
14202 #[derive(Clone, Debug)]
14204 pub(crate) struct RequestBuilder<R: std::default::Default> {
14205 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14206 request: R,
14207 options: crate::RequestOptions,
14208 }
14209
14210 impl<R> RequestBuilder<R>
14211 where
14212 R: std::default::Default,
14213 {
14214 pub(crate) fn new(
14215 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14216 ) -> Self {
14217 Self {
14218 stub,
14219 request: R::default(),
14220 options: crate::RequestOptions::default(),
14221 }
14222 }
14223 }
14224
14225 #[derive(Clone, Debug)]
14242 pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
14243
14244 impl GetSiteSearchEngine {
14245 pub(crate) fn new(
14246 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14247 ) -> Self {
14248 Self(RequestBuilder::new(stub))
14249 }
14250
14251 pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
14253 mut self,
14254 v: V,
14255 ) -> Self {
14256 self.0.request = v.into();
14257 self
14258 }
14259
14260 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14262 self.0.options = v.into();
14263 self
14264 }
14265
14266 pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
14268 (*self.0.stub)
14269 .get_site_search_engine(self.0.request, self.0.options)
14270 .await
14271 .map(crate::Response::into_body)
14272 }
14273
14274 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14278 self.0.request.name = v.into();
14279 self
14280 }
14281 }
14282
14283 #[doc(hidden)]
14284 impl crate::RequestBuilder for GetSiteSearchEngine {
14285 fn request_options(&mut self) -> &mut crate::RequestOptions {
14286 &mut self.0.options
14287 }
14288 }
14289
14290 #[derive(Clone, Debug)]
14308 pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
14309
14310 impl CreateTargetSite {
14311 pub(crate) fn new(
14312 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14313 ) -> Self {
14314 Self(RequestBuilder::new(stub))
14315 }
14316
14317 pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
14319 mut self,
14320 v: V,
14321 ) -> Self {
14322 self.0.request = v.into();
14323 self
14324 }
14325
14326 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14328 self.0.options = v.into();
14329 self
14330 }
14331
14332 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14339 (*self.0.stub)
14340 .create_target_site(self.0.request, self.0.options)
14341 .await
14342 .map(crate::Response::into_body)
14343 }
14344
14345 pub fn poller(
14347 self,
14348 ) -> impl google_cloud_lro::Poller<
14349 crate::model::TargetSite,
14350 crate::model::CreateTargetSiteMetadata,
14351 > {
14352 type Operation = google_cloud_lro::internal::Operation<
14353 crate::model::TargetSite,
14354 crate::model::CreateTargetSiteMetadata,
14355 >;
14356 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14357 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14358
14359 let stub = self.0.stub.clone();
14360 let mut options = self.0.options.clone();
14361 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14362 let query = move |name| {
14363 let stub = stub.clone();
14364 let options = options.clone();
14365 async {
14366 let op = GetOperation::new(stub)
14367 .set_name(name)
14368 .with_options(options)
14369 .send()
14370 .await?;
14371 Ok(Operation::new(op))
14372 }
14373 };
14374
14375 let start = move || async {
14376 let op = self.send().await?;
14377 Ok(Operation::new(op))
14378 };
14379
14380 google_cloud_lro::internal::new_poller(
14381 polling_error_policy,
14382 polling_backoff_policy,
14383 start,
14384 query,
14385 )
14386 }
14387
14388 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14392 self.0.request.parent = v.into();
14393 self
14394 }
14395
14396 pub fn set_target_site<T>(mut self, v: T) -> Self
14400 where
14401 T: std::convert::Into<crate::model::TargetSite>,
14402 {
14403 self.0.request.target_site = std::option::Option::Some(v.into());
14404 self
14405 }
14406
14407 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14411 where
14412 T: std::convert::Into<crate::model::TargetSite>,
14413 {
14414 self.0.request.target_site = v.map(|x| x.into());
14415 self
14416 }
14417 }
14418
14419 #[doc(hidden)]
14420 impl crate::RequestBuilder for CreateTargetSite {
14421 fn request_options(&mut self) -> &mut crate::RequestOptions {
14422 &mut self.0.options
14423 }
14424 }
14425
14426 #[derive(Clone, Debug)]
14444 pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14445
14446 impl BatchCreateTargetSites {
14447 pub(crate) fn new(
14448 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14449 ) -> Self {
14450 Self(RequestBuilder::new(stub))
14451 }
14452
14453 pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14455 mut self,
14456 v: V,
14457 ) -> Self {
14458 self.0.request = v.into();
14459 self
14460 }
14461
14462 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14464 self.0.options = v.into();
14465 self
14466 }
14467
14468 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14475 (*self.0.stub)
14476 .batch_create_target_sites(self.0.request, self.0.options)
14477 .await
14478 .map(crate::Response::into_body)
14479 }
14480
14481 pub fn poller(
14483 self,
14484 ) -> impl google_cloud_lro::Poller<
14485 crate::model::BatchCreateTargetSitesResponse,
14486 crate::model::BatchCreateTargetSiteMetadata,
14487 > {
14488 type Operation = google_cloud_lro::internal::Operation<
14489 crate::model::BatchCreateTargetSitesResponse,
14490 crate::model::BatchCreateTargetSiteMetadata,
14491 >;
14492 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14493 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14494
14495 let stub = self.0.stub.clone();
14496 let mut options = self.0.options.clone();
14497 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14498 let query = move |name| {
14499 let stub = stub.clone();
14500 let options = options.clone();
14501 async {
14502 let op = GetOperation::new(stub)
14503 .set_name(name)
14504 .with_options(options)
14505 .send()
14506 .await?;
14507 Ok(Operation::new(op))
14508 }
14509 };
14510
14511 let start = move || async {
14512 let op = self.send().await?;
14513 Ok(Operation::new(op))
14514 };
14515
14516 google_cloud_lro::internal::new_poller(
14517 polling_error_policy,
14518 polling_backoff_policy,
14519 start,
14520 query,
14521 )
14522 }
14523
14524 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14528 self.0.request.parent = v.into();
14529 self
14530 }
14531
14532 pub fn set_requests<T, V>(mut self, v: T) -> Self
14536 where
14537 T: std::iter::IntoIterator<Item = V>,
14538 V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14539 {
14540 use std::iter::Iterator;
14541 self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14542 self
14543 }
14544 }
14545
14546 #[doc(hidden)]
14547 impl crate::RequestBuilder for BatchCreateTargetSites {
14548 fn request_options(&mut self) -> &mut crate::RequestOptions {
14549 &mut self.0.options
14550 }
14551 }
14552
14553 #[derive(Clone, Debug)]
14570 pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14571
14572 impl GetTargetSite {
14573 pub(crate) fn new(
14574 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14575 ) -> Self {
14576 Self(RequestBuilder::new(stub))
14577 }
14578
14579 pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14581 self.0.request = v.into();
14582 self
14583 }
14584
14585 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14587 self.0.options = v.into();
14588 self
14589 }
14590
14591 pub async fn send(self) -> Result<crate::model::TargetSite> {
14593 (*self.0.stub)
14594 .get_target_site(self.0.request, self.0.options)
14595 .await
14596 .map(crate::Response::into_body)
14597 }
14598
14599 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14603 self.0.request.name = v.into();
14604 self
14605 }
14606 }
14607
14608 #[doc(hidden)]
14609 impl crate::RequestBuilder for GetTargetSite {
14610 fn request_options(&mut self) -> &mut crate::RequestOptions {
14611 &mut self.0.options
14612 }
14613 }
14614
14615 #[derive(Clone, Debug)]
14633 pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14634
14635 impl UpdateTargetSite {
14636 pub(crate) fn new(
14637 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14638 ) -> Self {
14639 Self(RequestBuilder::new(stub))
14640 }
14641
14642 pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14644 mut self,
14645 v: V,
14646 ) -> Self {
14647 self.0.request = v.into();
14648 self
14649 }
14650
14651 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14653 self.0.options = v.into();
14654 self
14655 }
14656
14657 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14664 (*self.0.stub)
14665 .update_target_site(self.0.request, self.0.options)
14666 .await
14667 .map(crate::Response::into_body)
14668 }
14669
14670 pub fn poller(
14672 self,
14673 ) -> impl google_cloud_lro::Poller<
14674 crate::model::TargetSite,
14675 crate::model::UpdateTargetSiteMetadata,
14676 > {
14677 type Operation = google_cloud_lro::internal::Operation<
14678 crate::model::TargetSite,
14679 crate::model::UpdateTargetSiteMetadata,
14680 >;
14681 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14682 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14683
14684 let stub = self.0.stub.clone();
14685 let mut options = self.0.options.clone();
14686 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14687 let query = move |name| {
14688 let stub = stub.clone();
14689 let options = options.clone();
14690 async {
14691 let op = GetOperation::new(stub)
14692 .set_name(name)
14693 .with_options(options)
14694 .send()
14695 .await?;
14696 Ok(Operation::new(op))
14697 }
14698 };
14699
14700 let start = move || async {
14701 let op = self.send().await?;
14702 Ok(Operation::new(op))
14703 };
14704
14705 google_cloud_lro::internal::new_poller(
14706 polling_error_policy,
14707 polling_backoff_policy,
14708 start,
14709 query,
14710 )
14711 }
14712
14713 pub fn set_target_site<T>(mut self, v: T) -> Self
14717 where
14718 T: std::convert::Into<crate::model::TargetSite>,
14719 {
14720 self.0.request.target_site = std::option::Option::Some(v.into());
14721 self
14722 }
14723
14724 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14728 where
14729 T: std::convert::Into<crate::model::TargetSite>,
14730 {
14731 self.0.request.target_site = v.map(|x| x.into());
14732 self
14733 }
14734 }
14735
14736 #[doc(hidden)]
14737 impl crate::RequestBuilder for UpdateTargetSite {
14738 fn request_options(&mut self) -> &mut crate::RequestOptions {
14739 &mut self.0.options
14740 }
14741 }
14742
14743 #[derive(Clone, Debug)]
14761 pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14762
14763 impl DeleteTargetSite {
14764 pub(crate) fn new(
14765 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14766 ) -> Self {
14767 Self(RequestBuilder::new(stub))
14768 }
14769
14770 pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14772 mut self,
14773 v: V,
14774 ) -> Self {
14775 self.0.request = v.into();
14776 self
14777 }
14778
14779 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14781 self.0.options = v.into();
14782 self
14783 }
14784
14785 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14792 (*self.0.stub)
14793 .delete_target_site(self.0.request, self.0.options)
14794 .await
14795 .map(crate::Response::into_body)
14796 }
14797
14798 pub fn poller(
14800 self,
14801 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
14802 type Operation = google_cloud_lro::internal::Operation<
14803 wkt::Empty,
14804 crate::model::DeleteTargetSiteMetadata,
14805 >;
14806 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14807 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14808
14809 let stub = self.0.stub.clone();
14810 let mut options = self.0.options.clone();
14811 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14812 let query = move |name| {
14813 let stub = stub.clone();
14814 let options = options.clone();
14815 async {
14816 let op = GetOperation::new(stub)
14817 .set_name(name)
14818 .with_options(options)
14819 .send()
14820 .await?;
14821 Ok(Operation::new(op))
14822 }
14823 };
14824
14825 let start = move || async {
14826 let op = self.send().await?;
14827 Ok(Operation::new(op))
14828 };
14829
14830 google_cloud_lro::internal::new_unit_response_poller(
14831 polling_error_policy,
14832 polling_backoff_policy,
14833 start,
14834 query,
14835 )
14836 }
14837
14838 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14842 self.0.request.name = v.into();
14843 self
14844 }
14845 }
14846
14847 #[doc(hidden)]
14848 impl crate::RequestBuilder for DeleteTargetSite {
14849 fn request_options(&mut self) -> &mut crate::RequestOptions {
14850 &mut self.0.options
14851 }
14852 }
14853
14854 #[derive(Clone, Debug)]
14875 pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
14876
14877 impl ListTargetSites {
14878 pub(crate) fn new(
14879 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14880 ) -> Self {
14881 Self(RequestBuilder::new(stub))
14882 }
14883
14884 pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
14886 self.0.request = v.into();
14887 self
14888 }
14889
14890 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14892 self.0.options = v.into();
14893 self
14894 }
14895
14896 pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
14898 (*self.0.stub)
14899 .list_target_sites(self.0.request, self.0.options)
14900 .await
14901 .map(crate::Response::into_body)
14902 }
14903
14904 pub fn by_page(
14906 self,
14907 ) -> impl google_cloud_gax::paginator::Paginator<
14908 crate::model::ListTargetSitesResponse,
14909 crate::Error,
14910 > {
14911 use std::clone::Clone;
14912 let token = self.0.request.page_token.clone();
14913 let execute = move |token: String| {
14914 let mut builder = self.clone();
14915 builder.0.request = builder.0.request.set_page_token(token);
14916 builder.send()
14917 };
14918 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14919 }
14920
14921 pub fn by_item(
14923 self,
14924 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14925 crate::model::ListTargetSitesResponse,
14926 crate::Error,
14927 > {
14928 use google_cloud_gax::paginator::Paginator;
14929 self.by_page().items()
14930 }
14931
14932 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14936 self.0.request.parent = v.into();
14937 self
14938 }
14939
14940 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14942 self.0.request.page_size = v.into();
14943 self
14944 }
14945
14946 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14948 self.0.request.page_token = v.into();
14949 self
14950 }
14951 }
14952
14953 #[doc(hidden)]
14954 impl crate::RequestBuilder for ListTargetSites {
14955 fn request_options(&mut self) -> &mut crate::RequestOptions {
14956 &mut self.0.options
14957 }
14958 }
14959
14960 #[derive(Clone, Debug)]
14978 pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
14979
14980 impl CreateSitemap {
14981 pub(crate) fn new(
14982 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14983 ) -> Self {
14984 Self(RequestBuilder::new(stub))
14985 }
14986
14987 pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
14989 self.0.request = v.into();
14990 self
14991 }
14992
14993 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14995 self.0.options = v.into();
14996 self
14997 }
14998
14999 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15006 (*self.0.stub)
15007 .create_sitemap(self.0.request, self.0.options)
15008 .await
15009 .map(crate::Response::into_body)
15010 }
15011
15012 pub fn poller(
15014 self,
15015 ) -> impl google_cloud_lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata>
15016 {
15017 type Operation = google_cloud_lro::internal::Operation<
15018 crate::model::Sitemap,
15019 crate::model::CreateSitemapMetadata,
15020 >;
15021 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15022 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15023
15024 let stub = self.0.stub.clone();
15025 let mut options = self.0.options.clone();
15026 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15027 let query = move |name| {
15028 let stub = stub.clone();
15029 let options = options.clone();
15030 async {
15031 let op = GetOperation::new(stub)
15032 .set_name(name)
15033 .with_options(options)
15034 .send()
15035 .await?;
15036 Ok(Operation::new(op))
15037 }
15038 };
15039
15040 let start = move || async {
15041 let op = self.send().await?;
15042 Ok(Operation::new(op))
15043 };
15044
15045 google_cloud_lro::internal::new_poller(
15046 polling_error_policy,
15047 polling_backoff_policy,
15048 start,
15049 query,
15050 )
15051 }
15052
15053 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15057 self.0.request.parent = v.into();
15058 self
15059 }
15060
15061 pub fn set_sitemap<T>(mut self, v: T) -> Self
15065 where
15066 T: std::convert::Into<crate::model::Sitemap>,
15067 {
15068 self.0.request.sitemap = std::option::Option::Some(v.into());
15069 self
15070 }
15071
15072 pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
15076 where
15077 T: std::convert::Into<crate::model::Sitemap>,
15078 {
15079 self.0.request.sitemap = v.map(|x| x.into());
15080 self
15081 }
15082 }
15083
15084 #[doc(hidden)]
15085 impl crate::RequestBuilder for CreateSitemap {
15086 fn request_options(&mut self) -> &mut crate::RequestOptions {
15087 &mut self.0.options
15088 }
15089 }
15090
15091 #[derive(Clone, Debug)]
15109 pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
15110
15111 impl DeleteSitemap {
15112 pub(crate) fn new(
15113 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15114 ) -> Self {
15115 Self(RequestBuilder::new(stub))
15116 }
15117
15118 pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
15120 self.0.request = v.into();
15121 self
15122 }
15123
15124 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15126 self.0.options = v.into();
15127 self
15128 }
15129
15130 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15137 (*self.0.stub)
15138 .delete_sitemap(self.0.request, self.0.options)
15139 .await
15140 .map(crate::Response::into_body)
15141 }
15142
15143 pub fn poller(
15145 self,
15146 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteSitemapMetadata> {
15147 type Operation = google_cloud_lro::internal::Operation<
15148 wkt::Empty,
15149 crate::model::DeleteSitemapMetadata,
15150 >;
15151 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15152 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15153
15154 let stub = self.0.stub.clone();
15155 let mut options = self.0.options.clone();
15156 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15157 let query = move |name| {
15158 let stub = stub.clone();
15159 let options = options.clone();
15160 async {
15161 let op = GetOperation::new(stub)
15162 .set_name(name)
15163 .with_options(options)
15164 .send()
15165 .await?;
15166 Ok(Operation::new(op))
15167 }
15168 };
15169
15170 let start = move || async {
15171 let op = self.send().await?;
15172 Ok(Operation::new(op))
15173 };
15174
15175 google_cloud_lro::internal::new_unit_response_poller(
15176 polling_error_policy,
15177 polling_backoff_policy,
15178 start,
15179 query,
15180 )
15181 }
15182
15183 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15187 self.0.request.name = v.into();
15188 self
15189 }
15190 }
15191
15192 #[doc(hidden)]
15193 impl crate::RequestBuilder for DeleteSitemap {
15194 fn request_options(&mut self) -> &mut crate::RequestOptions {
15195 &mut self.0.options
15196 }
15197 }
15198
15199 #[derive(Clone, Debug)]
15216 pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
15217
15218 impl FetchSitemaps {
15219 pub(crate) fn new(
15220 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15221 ) -> Self {
15222 Self(RequestBuilder::new(stub))
15223 }
15224
15225 pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
15227 self.0.request = v.into();
15228 self
15229 }
15230
15231 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15233 self.0.options = v.into();
15234 self
15235 }
15236
15237 pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
15239 (*self.0.stub)
15240 .fetch_sitemaps(self.0.request, self.0.options)
15241 .await
15242 .map(crate::Response::into_body)
15243 }
15244
15245 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15249 self.0.request.parent = v.into();
15250 self
15251 }
15252
15253 pub fn set_matcher<T>(mut self, v: T) -> Self
15255 where
15256 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15257 {
15258 self.0.request.matcher = std::option::Option::Some(v.into());
15259 self
15260 }
15261
15262 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
15264 where
15265 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15266 {
15267 self.0.request.matcher = v.map(|x| x.into());
15268 self
15269 }
15270 }
15271
15272 #[doc(hidden)]
15273 impl crate::RequestBuilder for FetchSitemaps {
15274 fn request_options(&mut self) -> &mut crate::RequestOptions {
15275 &mut self.0.options
15276 }
15277 }
15278
15279 #[derive(Clone, Debug)]
15297 pub struct EnableAdvancedSiteSearch(
15298 RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
15299 );
15300
15301 impl EnableAdvancedSiteSearch {
15302 pub(crate) fn new(
15303 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15304 ) -> Self {
15305 Self(RequestBuilder::new(stub))
15306 }
15307
15308 pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
15310 mut self,
15311 v: V,
15312 ) -> Self {
15313 self.0.request = v.into();
15314 self
15315 }
15316
15317 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15319 self.0.options = v.into();
15320 self
15321 }
15322
15323 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15330 (*self.0.stub)
15331 .enable_advanced_site_search(self.0.request, self.0.options)
15332 .await
15333 .map(crate::Response::into_body)
15334 }
15335
15336 pub fn poller(
15338 self,
15339 ) -> impl google_cloud_lro::Poller<
15340 crate::model::EnableAdvancedSiteSearchResponse,
15341 crate::model::EnableAdvancedSiteSearchMetadata,
15342 > {
15343 type Operation = google_cloud_lro::internal::Operation<
15344 crate::model::EnableAdvancedSiteSearchResponse,
15345 crate::model::EnableAdvancedSiteSearchMetadata,
15346 >;
15347 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15348 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15349
15350 let stub = self.0.stub.clone();
15351 let mut options = self.0.options.clone();
15352 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15353 let query = move |name| {
15354 let stub = stub.clone();
15355 let options = options.clone();
15356 async {
15357 let op = GetOperation::new(stub)
15358 .set_name(name)
15359 .with_options(options)
15360 .send()
15361 .await?;
15362 Ok(Operation::new(op))
15363 }
15364 };
15365
15366 let start = move || async {
15367 let op = self.send().await?;
15368 Ok(Operation::new(op))
15369 };
15370
15371 google_cloud_lro::internal::new_poller(
15372 polling_error_policy,
15373 polling_backoff_policy,
15374 start,
15375 query,
15376 )
15377 }
15378
15379 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15383 self.0.request.site_search_engine = v.into();
15384 self
15385 }
15386 }
15387
15388 #[doc(hidden)]
15389 impl crate::RequestBuilder for EnableAdvancedSiteSearch {
15390 fn request_options(&mut self) -> &mut crate::RequestOptions {
15391 &mut self.0.options
15392 }
15393 }
15394
15395 #[derive(Clone, Debug)]
15413 pub struct DisableAdvancedSiteSearch(
15414 RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15415 );
15416
15417 impl DisableAdvancedSiteSearch {
15418 pub(crate) fn new(
15419 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15420 ) -> Self {
15421 Self(RequestBuilder::new(stub))
15422 }
15423
15424 pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15426 mut self,
15427 v: V,
15428 ) -> Self {
15429 self.0.request = v.into();
15430 self
15431 }
15432
15433 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15435 self.0.options = v.into();
15436 self
15437 }
15438
15439 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15446 (*self.0.stub)
15447 .disable_advanced_site_search(self.0.request, self.0.options)
15448 .await
15449 .map(crate::Response::into_body)
15450 }
15451
15452 pub fn poller(
15454 self,
15455 ) -> impl google_cloud_lro::Poller<
15456 crate::model::DisableAdvancedSiteSearchResponse,
15457 crate::model::DisableAdvancedSiteSearchMetadata,
15458 > {
15459 type Operation = google_cloud_lro::internal::Operation<
15460 crate::model::DisableAdvancedSiteSearchResponse,
15461 crate::model::DisableAdvancedSiteSearchMetadata,
15462 >;
15463 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15464 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15465
15466 let stub = self.0.stub.clone();
15467 let mut options = self.0.options.clone();
15468 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15469 let query = move |name| {
15470 let stub = stub.clone();
15471 let options = options.clone();
15472 async {
15473 let op = GetOperation::new(stub)
15474 .set_name(name)
15475 .with_options(options)
15476 .send()
15477 .await?;
15478 Ok(Operation::new(op))
15479 }
15480 };
15481
15482 let start = move || async {
15483 let op = self.send().await?;
15484 Ok(Operation::new(op))
15485 };
15486
15487 google_cloud_lro::internal::new_poller(
15488 polling_error_policy,
15489 polling_backoff_policy,
15490 start,
15491 query,
15492 )
15493 }
15494
15495 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15499 self.0.request.site_search_engine = v.into();
15500 self
15501 }
15502 }
15503
15504 #[doc(hidden)]
15505 impl crate::RequestBuilder for DisableAdvancedSiteSearch {
15506 fn request_options(&mut self) -> &mut crate::RequestOptions {
15507 &mut self.0.options
15508 }
15509 }
15510
15511 #[derive(Clone, Debug)]
15529 pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15530
15531 impl RecrawlUris {
15532 pub(crate) fn new(
15533 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15534 ) -> Self {
15535 Self(RequestBuilder::new(stub))
15536 }
15537
15538 pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15540 self.0.request = v.into();
15541 self
15542 }
15543
15544 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15546 self.0.options = v.into();
15547 self
15548 }
15549
15550 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15557 (*self.0.stub)
15558 .recrawl_uris(self.0.request, self.0.options)
15559 .await
15560 .map(crate::Response::into_body)
15561 }
15562
15563 pub fn poller(
15565 self,
15566 ) -> impl google_cloud_lro::Poller<
15567 crate::model::RecrawlUrisResponse,
15568 crate::model::RecrawlUrisMetadata,
15569 > {
15570 type Operation = google_cloud_lro::internal::Operation<
15571 crate::model::RecrawlUrisResponse,
15572 crate::model::RecrawlUrisMetadata,
15573 >;
15574 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15575 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15576
15577 let stub = self.0.stub.clone();
15578 let mut options = self.0.options.clone();
15579 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15580 let query = move |name| {
15581 let stub = stub.clone();
15582 let options = options.clone();
15583 async {
15584 let op = GetOperation::new(stub)
15585 .set_name(name)
15586 .with_options(options)
15587 .send()
15588 .await?;
15589 Ok(Operation::new(op))
15590 }
15591 };
15592
15593 let start = move || async {
15594 let op = self.send().await?;
15595 Ok(Operation::new(op))
15596 };
15597
15598 google_cloud_lro::internal::new_poller(
15599 polling_error_policy,
15600 polling_backoff_policy,
15601 start,
15602 query,
15603 )
15604 }
15605
15606 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15610 self.0.request.site_search_engine = v.into();
15611 self
15612 }
15613
15614 pub fn set_uris<T, V>(mut self, v: T) -> Self
15618 where
15619 T: std::iter::IntoIterator<Item = V>,
15620 V: std::convert::Into<std::string::String>,
15621 {
15622 use std::iter::Iterator;
15623 self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15624 self
15625 }
15626
15627 pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15629 self.0.request.site_credential = v.into();
15630 self
15631 }
15632 }
15633
15634 #[doc(hidden)]
15635 impl crate::RequestBuilder for RecrawlUris {
15636 fn request_options(&mut self) -> &mut crate::RequestOptions {
15637 &mut self.0.options
15638 }
15639 }
15640
15641 #[derive(Clone, Debug)]
15659 pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15660
15661 impl BatchVerifyTargetSites {
15662 pub(crate) fn new(
15663 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15664 ) -> Self {
15665 Self(RequestBuilder::new(stub))
15666 }
15667
15668 pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15670 mut self,
15671 v: V,
15672 ) -> Self {
15673 self.0.request = v.into();
15674 self
15675 }
15676
15677 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15679 self.0.options = v.into();
15680 self
15681 }
15682
15683 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15690 (*self.0.stub)
15691 .batch_verify_target_sites(self.0.request, self.0.options)
15692 .await
15693 .map(crate::Response::into_body)
15694 }
15695
15696 pub fn poller(
15698 self,
15699 ) -> impl google_cloud_lro::Poller<
15700 crate::model::BatchVerifyTargetSitesResponse,
15701 crate::model::BatchVerifyTargetSitesMetadata,
15702 > {
15703 type Operation = google_cloud_lro::internal::Operation<
15704 crate::model::BatchVerifyTargetSitesResponse,
15705 crate::model::BatchVerifyTargetSitesMetadata,
15706 >;
15707 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15708 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15709
15710 let stub = self.0.stub.clone();
15711 let mut options = self.0.options.clone();
15712 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
15713 let query = move |name| {
15714 let stub = stub.clone();
15715 let options = options.clone();
15716 async {
15717 let op = GetOperation::new(stub)
15718 .set_name(name)
15719 .with_options(options)
15720 .send()
15721 .await?;
15722 Ok(Operation::new(op))
15723 }
15724 };
15725
15726 let start = move || async {
15727 let op = self.send().await?;
15728 Ok(Operation::new(op))
15729 };
15730
15731 google_cloud_lro::internal::new_poller(
15732 polling_error_policy,
15733 polling_backoff_policy,
15734 start,
15735 query,
15736 )
15737 }
15738
15739 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15743 self.0.request.parent = v.into();
15744 self
15745 }
15746 }
15747
15748 #[doc(hidden)]
15749 impl crate::RequestBuilder for BatchVerifyTargetSites {
15750 fn request_options(&mut self) -> &mut crate::RequestOptions {
15751 &mut self.0.options
15752 }
15753 }
15754
15755 #[derive(Clone, Debug)]
15776 pub struct FetchDomainVerificationStatus(
15777 RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
15778 );
15779
15780 impl FetchDomainVerificationStatus {
15781 pub(crate) fn new(
15782 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15783 ) -> Self {
15784 Self(RequestBuilder::new(stub))
15785 }
15786
15787 pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
15789 mut self,
15790 v: V,
15791 ) -> Self {
15792 self.0.request = v.into();
15793 self
15794 }
15795
15796 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15798 self.0.options = v.into();
15799 self
15800 }
15801
15802 pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
15804 (*self.0.stub)
15805 .fetch_domain_verification_status(self.0.request, self.0.options)
15806 .await
15807 .map(crate::Response::into_body)
15808 }
15809
15810 pub fn by_page(
15812 self,
15813 ) -> impl google_cloud_gax::paginator::Paginator<
15814 crate::model::FetchDomainVerificationStatusResponse,
15815 crate::Error,
15816 > {
15817 use std::clone::Clone;
15818 let token = self.0.request.page_token.clone();
15819 let execute = move |token: String| {
15820 let mut builder = self.clone();
15821 builder.0.request = builder.0.request.set_page_token(token);
15822 builder.send()
15823 };
15824 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15825 }
15826
15827 pub fn by_item(
15829 self,
15830 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15831 crate::model::FetchDomainVerificationStatusResponse,
15832 crate::Error,
15833 > {
15834 use google_cloud_gax::paginator::Paginator;
15835 self.by_page().items()
15836 }
15837
15838 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15842 self.0.request.site_search_engine = v.into();
15843 self
15844 }
15845
15846 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15848 self.0.request.page_size = v.into();
15849 self
15850 }
15851
15852 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15854 self.0.request.page_token = v.into();
15855 self
15856 }
15857 }
15858
15859 #[doc(hidden)]
15860 impl crate::RequestBuilder for FetchDomainVerificationStatus {
15861 fn request_options(&mut self) -> &mut crate::RequestOptions {
15862 &mut self.0.options
15863 }
15864 }
15865
15866 #[derive(Clone, Debug)]
15887 pub struct ListOperations(
15888 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
15889 );
15890
15891 impl ListOperations {
15892 pub(crate) fn new(
15893 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15894 ) -> Self {
15895 Self(RequestBuilder::new(stub))
15896 }
15897
15898 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
15900 mut self,
15901 v: V,
15902 ) -> Self {
15903 self.0.request = v.into();
15904 self
15905 }
15906
15907 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15909 self.0.options = v.into();
15910 self
15911 }
15912
15913 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
15915 (*self.0.stub)
15916 .list_operations(self.0.request, self.0.options)
15917 .await
15918 .map(crate::Response::into_body)
15919 }
15920
15921 pub fn by_page(
15923 self,
15924 ) -> impl google_cloud_gax::paginator::Paginator<
15925 google_cloud_longrunning::model::ListOperationsResponse,
15926 crate::Error,
15927 > {
15928 use std::clone::Clone;
15929 let token = self.0.request.page_token.clone();
15930 let execute = move |token: String| {
15931 let mut builder = self.clone();
15932 builder.0.request = builder.0.request.set_page_token(token);
15933 builder.send()
15934 };
15935 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15936 }
15937
15938 pub fn by_item(
15940 self,
15941 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15942 google_cloud_longrunning::model::ListOperationsResponse,
15943 crate::Error,
15944 > {
15945 use google_cloud_gax::paginator::Paginator;
15946 self.by_page().items()
15947 }
15948
15949 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15951 self.0.request.name = v.into();
15952 self
15953 }
15954
15955 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15957 self.0.request.filter = v.into();
15958 self
15959 }
15960
15961 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15963 self.0.request.page_size = v.into();
15964 self
15965 }
15966
15967 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15969 self.0.request.page_token = v.into();
15970 self
15971 }
15972
15973 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
15975 self.0.request.return_partial_success = v.into();
15976 self
15977 }
15978 }
15979
15980 #[doc(hidden)]
15981 impl crate::RequestBuilder for ListOperations {
15982 fn request_options(&mut self) -> &mut crate::RequestOptions {
15983 &mut self.0.options
15984 }
15985 }
15986
15987 #[derive(Clone, Debug)]
16004 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16005
16006 impl GetOperation {
16007 pub(crate) fn new(
16008 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16009 ) -> Self {
16010 Self(RequestBuilder::new(stub))
16011 }
16012
16013 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16015 mut self,
16016 v: V,
16017 ) -> Self {
16018 self.0.request = v.into();
16019 self
16020 }
16021
16022 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16024 self.0.options = v.into();
16025 self
16026 }
16027
16028 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16030 (*self.0.stub)
16031 .get_operation(self.0.request, self.0.options)
16032 .await
16033 .map(crate::Response::into_body)
16034 }
16035
16036 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16038 self.0.request.name = v.into();
16039 self
16040 }
16041 }
16042
16043 #[doc(hidden)]
16044 impl crate::RequestBuilder for GetOperation {
16045 fn request_options(&mut self) -> &mut crate::RequestOptions {
16046 &mut self.0.options
16047 }
16048 }
16049
16050 #[derive(Clone, Debug)]
16067 pub struct CancelOperation(
16068 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16069 );
16070
16071 impl CancelOperation {
16072 pub(crate) fn new(
16073 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
16074 ) -> Self {
16075 Self(RequestBuilder::new(stub))
16076 }
16077
16078 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16080 mut self,
16081 v: V,
16082 ) -> Self {
16083 self.0.request = v.into();
16084 self
16085 }
16086
16087 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16089 self.0.options = v.into();
16090 self
16091 }
16092
16093 pub async fn send(self) -> Result<()> {
16095 (*self.0.stub)
16096 .cancel_operation(self.0.request, self.0.options)
16097 .await
16098 .map(crate::Response::into_body)
16099 }
16100
16101 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16103 self.0.request.name = v.into();
16104 self
16105 }
16106 }
16107
16108 #[doc(hidden)]
16109 impl crate::RequestBuilder for CancelOperation {
16110 fn request_options(&mut self) -> &mut crate::RequestOptions {
16111 &mut self.0.options
16112 }
16113 }
16114}
16115
16116#[cfg(feature = "user-event-service")]
16118#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
16119pub mod user_event_service {
16120 use crate::Result;
16121
16122 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16136
16137 pub(crate) mod client {
16138 use super::super::super::client::UserEventService;
16139 pub struct Factory;
16140 impl crate::ClientFactory for Factory {
16141 type Client = UserEventService;
16142 type Credentials = gaxi::options::Credentials;
16143 async fn build(
16144 self,
16145 config: gaxi::options::ClientConfig,
16146 ) -> crate::ClientBuilderResult<Self::Client> {
16147 Self::Client::new(config).await
16148 }
16149 }
16150 }
16151
16152 #[derive(Clone, Debug)]
16154 pub(crate) struct RequestBuilder<R: std::default::Default> {
16155 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16156 request: R,
16157 options: crate::RequestOptions,
16158 }
16159
16160 impl<R> RequestBuilder<R>
16161 where
16162 R: std::default::Default,
16163 {
16164 pub(crate) fn new(
16165 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16166 ) -> Self {
16167 Self {
16168 stub,
16169 request: R::default(),
16170 options: crate::RequestOptions::default(),
16171 }
16172 }
16173 }
16174
16175 #[derive(Clone, Debug)]
16192 pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
16193
16194 impl WriteUserEvent {
16195 pub(crate) fn new(
16196 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16197 ) -> Self {
16198 Self(RequestBuilder::new(stub))
16199 }
16200
16201 pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
16203 self.0.request = v.into();
16204 self
16205 }
16206
16207 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16209 self.0.options = v.into();
16210 self
16211 }
16212
16213 pub async fn send(self) -> Result<crate::model::UserEvent> {
16215 (*self.0.stub)
16216 .write_user_event(self.0.request, self.0.options)
16217 .await
16218 .map(crate::Response::into_body)
16219 }
16220
16221 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16225 self.0.request.parent = v.into();
16226 self
16227 }
16228
16229 pub fn set_user_event<T>(mut self, v: T) -> Self
16233 where
16234 T: std::convert::Into<crate::model::UserEvent>,
16235 {
16236 self.0.request.user_event = std::option::Option::Some(v.into());
16237 self
16238 }
16239
16240 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
16244 where
16245 T: std::convert::Into<crate::model::UserEvent>,
16246 {
16247 self.0.request.user_event = v.map(|x| x.into());
16248 self
16249 }
16250
16251 pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
16253 self.0.request.write_async = v.into();
16254 self
16255 }
16256 }
16257
16258 #[doc(hidden)]
16259 impl crate::RequestBuilder for WriteUserEvent {
16260 fn request_options(&mut self) -> &mut crate::RequestOptions {
16261 &mut self.0.options
16262 }
16263 }
16264
16265 #[derive(Clone, Debug)]
16282 pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
16283
16284 impl CollectUserEvent {
16285 pub(crate) fn new(
16286 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16287 ) -> Self {
16288 Self(RequestBuilder::new(stub))
16289 }
16290
16291 pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
16293 mut self,
16294 v: V,
16295 ) -> Self {
16296 self.0.request = v.into();
16297 self
16298 }
16299
16300 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16302 self.0.options = v.into();
16303 self
16304 }
16305
16306 pub async fn send(self) -> Result<google_cloud_api::model::HttpBody> {
16308 (*self.0.stub)
16309 .collect_user_event(self.0.request, self.0.options)
16310 .await
16311 .map(crate::Response::into_body)
16312 }
16313
16314 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16318 self.0.request.parent = v.into();
16319 self
16320 }
16321
16322 pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
16326 self.0.request.user_event = v.into();
16327 self
16328 }
16329
16330 pub fn set_uri<T>(mut self, v: T) -> Self
16332 where
16333 T: std::convert::Into<std::string::String>,
16334 {
16335 self.0.request.uri = std::option::Option::Some(v.into());
16336 self
16337 }
16338
16339 pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
16341 where
16342 T: std::convert::Into<std::string::String>,
16343 {
16344 self.0.request.uri = v.map(|x| x.into());
16345 self
16346 }
16347
16348 pub fn set_ets<T>(mut self, v: T) -> Self
16350 where
16351 T: std::convert::Into<i64>,
16352 {
16353 self.0.request.ets = std::option::Option::Some(v.into());
16354 self
16355 }
16356
16357 pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
16359 where
16360 T: std::convert::Into<i64>,
16361 {
16362 self.0.request.ets = v.map(|x| x.into());
16363 self
16364 }
16365 }
16366
16367 #[doc(hidden)]
16368 impl crate::RequestBuilder for CollectUserEvent {
16369 fn request_options(&mut self) -> &mut crate::RequestOptions {
16370 &mut self.0.options
16371 }
16372 }
16373
16374 #[derive(Clone, Debug)]
16392 pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
16393
16394 impl PurgeUserEvents {
16395 pub(crate) fn new(
16396 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16397 ) -> Self {
16398 Self(RequestBuilder::new(stub))
16399 }
16400
16401 pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16403 self.0.request = v.into();
16404 self
16405 }
16406
16407 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16409 self.0.options = v.into();
16410 self
16411 }
16412
16413 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16420 (*self.0.stub)
16421 .purge_user_events(self.0.request, self.0.options)
16422 .await
16423 .map(crate::Response::into_body)
16424 }
16425
16426 pub fn poller(
16428 self,
16429 ) -> impl google_cloud_lro::Poller<
16430 crate::model::PurgeUserEventsResponse,
16431 crate::model::PurgeUserEventsMetadata,
16432 > {
16433 type Operation = google_cloud_lro::internal::Operation<
16434 crate::model::PurgeUserEventsResponse,
16435 crate::model::PurgeUserEventsMetadata,
16436 >;
16437 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16438 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16439
16440 let stub = self.0.stub.clone();
16441 let mut options = self.0.options.clone();
16442 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16443 let query = move |name| {
16444 let stub = stub.clone();
16445 let options = options.clone();
16446 async {
16447 let op = GetOperation::new(stub)
16448 .set_name(name)
16449 .with_options(options)
16450 .send()
16451 .await?;
16452 Ok(Operation::new(op))
16453 }
16454 };
16455
16456 let start = move || async {
16457 let op = self.send().await?;
16458 Ok(Operation::new(op))
16459 };
16460
16461 google_cloud_lro::internal::new_poller(
16462 polling_error_policy,
16463 polling_backoff_policy,
16464 start,
16465 query,
16466 )
16467 }
16468
16469 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16473 self.0.request.parent = v.into();
16474 self
16475 }
16476
16477 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16481 self.0.request.filter = v.into();
16482 self
16483 }
16484
16485 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16487 self.0.request.force = v.into();
16488 self
16489 }
16490 }
16491
16492 #[doc(hidden)]
16493 impl crate::RequestBuilder for PurgeUserEvents {
16494 fn request_options(&mut self) -> &mut crate::RequestOptions {
16495 &mut self.0.options
16496 }
16497 }
16498
16499 #[derive(Clone, Debug)]
16517 pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
16518
16519 impl ImportUserEvents {
16520 pub(crate) fn new(
16521 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16522 ) -> Self {
16523 Self(RequestBuilder::new(stub))
16524 }
16525
16526 pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
16528 mut self,
16529 v: V,
16530 ) -> Self {
16531 self.0.request = v.into();
16532 self
16533 }
16534
16535 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16537 self.0.options = v.into();
16538 self
16539 }
16540
16541 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16548 (*self.0.stub)
16549 .import_user_events(self.0.request, self.0.options)
16550 .await
16551 .map(crate::Response::into_body)
16552 }
16553
16554 pub fn poller(
16556 self,
16557 ) -> impl google_cloud_lro::Poller<
16558 crate::model::ImportUserEventsResponse,
16559 crate::model::ImportUserEventsMetadata,
16560 > {
16561 type Operation = google_cloud_lro::internal::Operation<
16562 crate::model::ImportUserEventsResponse,
16563 crate::model::ImportUserEventsMetadata,
16564 >;
16565 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16566 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16567
16568 let stub = self.0.stub.clone();
16569 let mut options = self.0.options.clone();
16570 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16571 let query = move |name| {
16572 let stub = stub.clone();
16573 let options = options.clone();
16574 async {
16575 let op = GetOperation::new(stub)
16576 .set_name(name)
16577 .with_options(options)
16578 .send()
16579 .await?;
16580 Ok(Operation::new(op))
16581 }
16582 };
16583
16584 let start = move || async {
16585 let op = self.send().await?;
16586 Ok(Operation::new(op))
16587 };
16588
16589 google_cloud_lro::internal::new_poller(
16590 polling_error_policy,
16591 polling_backoff_policy,
16592 start,
16593 query,
16594 )
16595 }
16596
16597 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16601 self.0.request.parent = v.into();
16602 self
16603 }
16604
16605 pub fn set_error_config<T>(mut self, v: T) -> Self
16607 where
16608 T: std::convert::Into<crate::model::ImportErrorConfig>,
16609 {
16610 self.0.request.error_config = std::option::Option::Some(v.into());
16611 self
16612 }
16613
16614 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
16616 where
16617 T: std::convert::Into<crate::model::ImportErrorConfig>,
16618 {
16619 self.0.request.error_config = v.map(|x| x.into());
16620 self
16621 }
16622
16623 pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
16628 mut self,
16629 v: T,
16630 ) -> Self {
16631 self.0.request.source = v.into();
16632 self
16633 }
16634
16635 pub fn set_inline_source<
16641 T: std::convert::Into<
16642 std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
16643 >,
16644 >(
16645 mut self,
16646 v: T,
16647 ) -> Self {
16648 self.0.request = self.0.request.set_inline_source(v);
16649 self
16650 }
16651
16652 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
16658 mut self,
16659 v: T,
16660 ) -> Self {
16661 self.0.request = self.0.request.set_gcs_source(v);
16662 self
16663 }
16664
16665 pub fn set_bigquery_source<
16671 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
16672 >(
16673 mut self,
16674 v: T,
16675 ) -> Self {
16676 self.0.request = self.0.request.set_bigquery_source(v);
16677 self
16678 }
16679 }
16680
16681 #[doc(hidden)]
16682 impl crate::RequestBuilder for ImportUserEvents {
16683 fn request_options(&mut self) -> &mut crate::RequestOptions {
16684 &mut self.0.options
16685 }
16686 }
16687
16688 #[derive(Clone, Debug)]
16709 pub struct ListOperations(
16710 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16711 );
16712
16713 impl ListOperations {
16714 pub(crate) fn new(
16715 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16716 ) -> Self {
16717 Self(RequestBuilder::new(stub))
16718 }
16719
16720 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16722 mut self,
16723 v: V,
16724 ) -> Self {
16725 self.0.request = v.into();
16726 self
16727 }
16728
16729 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16731 self.0.options = v.into();
16732 self
16733 }
16734
16735 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16737 (*self.0.stub)
16738 .list_operations(self.0.request, self.0.options)
16739 .await
16740 .map(crate::Response::into_body)
16741 }
16742
16743 pub fn by_page(
16745 self,
16746 ) -> impl google_cloud_gax::paginator::Paginator<
16747 google_cloud_longrunning::model::ListOperationsResponse,
16748 crate::Error,
16749 > {
16750 use std::clone::Clone;
16751 let token = self.0.request.page_token.clone();
16752 let execute = move |token: String| {
16753 let mut builder = self.clone();
16754 builder.0.request = builder.0.request.set_page_token(token);
16755 builder.send()
16756 };
16757 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16758 }
16759
16760 pub fn by_item(
16762 self,
16763 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16764 google_cloud_longrunning::model::ListOperationsResponse,
16765 crate::Error,
16766 > {
16767 use google_cloud_gax::paginator::Paginator;
16768 self.by_page().items()
16769 }
16770
16771 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16773 self.0.request.name = v.into();
16774 self
16775 }
16776
16777 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16779 self.0.request.filter = v.into();
16780 self
16781 }
16782
16783 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16785 self.0.request.page_size = v.into();
16786 self
16787 }
16788
16789 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16791 self.0.request.page_token = v.into();
16792 self
16793 }
16794
16795 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16797 self.0.request.return_partial_success = v.into();
16798 self
16799 }
16800 }
16801
16802 #[doc(hidden)]
16803 impl crate::RequestBuilder for ListOperations {
16804 fn request_options(&mut self) -> &mut crate::RequestOptions {
16805 &mut self.0.options
16806 }
16807 }
16808
16809 #[derive(Clone, Debug)]
16826 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16827
16828 impl GetOperation {
16829 pub(crate) fn new(
16830 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16831 ) -> Self {
16832 Self(RequestBuilder::new(stub))
16833 }
16834
16835 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16837 mut self,
16838 v: V,
16839 ) -> Self {
16840 self.0.request = v.into();
16841 self
16842 }
16843
16844 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16846 self.0.options = v.into();
16847 self
16848 }
16849
16850 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16852 (*self.0.stub)
16853 .get_operation(self.0.request, self.0.options)
16854 .await
16855 .map(crate::Response::into_body)
16856 }
16857
16858 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16860 self.0.request.name = v.into();
16861 self
16862 }
16863 }
16864
16865 #[doc(hidden)]
16866 impl crate::RequestBuilder for GetOperation {
16867 fn request_options(&mut self) -> &mut crate::RequestOptions {
16868 &mut self.0.options
16869 }
16870 }
16871
16872 #[derive(Clone, Debug)]
16889 pub struct CancelOperation(
16890 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16891 );
16892
16893 impl CancelOperation {
16894 pub(crate) fn new(
16895 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16896 ) -> Self {
16897 Self(RequestBuilder::new(stub))
16898 }
16899
16900 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16902 mut self,
16903 v: V,
16904 ) -> Self {
16905 self.0.request = v.into();
16906 self
16907 }
16908
16909 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16911 self.0.options = v.into();
16912 self
16913 }
16914
16915 pub async fn send(self) -> Result<()> {
16917 (*self.0.stub)
16918 .cancel_operation(self.0.request, self.0.options)
16919 .await
16920 .map(crate::Response::into_body)
16921 }
16922
16923 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16925 self.0.request.name = v.into();
16926 self
16927 }
16928 }
16929
16930 #[doc(hidden)]
16931 impl crate::RequestBuilder for CancelOperation {
16932 fn request_options(&mut self) -> &mut crate::RequestOptions {
16933 &mut self.0.options
16934 }
16935 }
16936}
16937
16938#[cfg(feature = "user-license-service")]
16940#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
16941pub mod user_license_service {
16942 use crate::Result;
16943
16944 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16958
16959 pub(crate) mod client {
16960 use super::super::super::client::UserLicenseService;
16961 pub struct Factory;
16962 impl crate::ClientFactory for Factory {
16963 type Client = UserLicenseService;
16964 type Credentials = gaxi::options::Credentials;
16965 async fn build(
16966 self,
16967 config: gaxi::options::ClientConfig,
16968 ) -> crate::ClientBuilderResult<Self::Client> {
16969 Self::Client::new(config).await
16970 }
16971 }
16972 }
16973
16974 #[derive(Clone, Debug)]
16976 pub(crate) struct RequestBuilder<R: std::default::Default> {
16977 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16978 request: R,
16979 options: crate::RequestOptions,
16980 }
16981
16982 impl<R> RequestBuilder<R>
16983 where
16984 R: std::default::Default,
16985 {
16986 pub(crate) fn new(
16987 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16988 ) -> Self {
16989 Self {
16990 stub,
16991 request: R::default(),
16992 options: crate::RequestOptions::default(),
16993 }
16994 }
16995 }
16996
16997 #[derive(Clone, Debug)]
17018 pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
17019
17020 impl ListUserLicenses {
17021 pub(crate) fn new(
17022 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17023 ) -> Self {
17024 Self(RequestBuilder::new(stub))
17025 }
17026
17027 pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
17029 mut self,
17030 v: V,
17031 ) -> Self {
17032 self.0.request = v.into();
17033 self
17034 }
17035
17036 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17038 self.0.options = v.into();
17039 self
17040 }
17041
17042 pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
17044 (*self.0.stub)
17045 .list_user_licenses(self.0.request, self.0.options)
17046 .await
17047 .map(crate::Response::into_body)
17048 }
17049
17050 pub fn by_page(
17052 self,
17053 ) -> impl google_cloud_gax::paginator::Paginator<
17054 crate::model::ListUserLicensesResponse,
17055 crate::Error,
17056 > {
17057 use std::clone::Clone;
17058 let token = self.0.request.page_token.clone();
17059 let execute = move |token: String| {
17060 let mut builder = self.clone();
17061 builder.0.request = builder.0.request.set_page_token(token);
17062 builder.send()
17063 };
17064 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17065 }
17066
17067 pub fn by_item(
17069 self,
17070 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17071 crate::model::ListUserLicensesResponse,
17072 crate::Error,
17073 > {
17074 use google_cloud_gax::paginator::Paginator;
17075 self.by_page().items()
17076 }
17077
17078 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17082 self.0.request.parent = v.into();
17083 self
17084 }
17085
17086 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17088 self.0.request.page_size = v.into();
17089 self
17090 }
17091
17092 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17094 self.0.request.page_token = v.into();
17095 self
17096 }
17097
17098 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17100 self.0.request.filter = v.into();
17101 self
17102 }
17103 }
17104
17105 #[doc(hidden)]
17106 impl crate::RequestBuilder for ListUserLicenses {
17107 fn request_options(&mut self) -> &mut crate::RequestOptions {
17108 &mut self.0.options
17109 }
17110 }
17111
17112 #[derive(Clone, Debug)]
17130 pub struct BatchUpdateUserLicenses(
17131 RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
17132 );
17133
17134 impl BatchUpdateUserLicenses {
17135 pub(crate) fn new(
17136 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17137 ) -> Self {
17138 Self(RequestBuilder::new(stub))
17139 }
17140
17141 pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
17143 mut self,
17144 v: V,
17145 ) -> Self {
17146 self.0.request = v.into();
17147 self
17148 }
17149
17150 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17152 self.0.options = v.into();
17153 self
17154 }
17155
17156 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17163 (*self.0.stub)
17164 .batch_update_user_licenses(self.0.request, self.0.options)
17165 .await
17166 .map(crate::Response::into_body)
17167 }
17168
17169 pub fn poller(
17171 self,
17172 ) -> impl google_cloud_lro::Poller<
17173 crate::model::BatchUpdateUserLicensesResponse,
17174 crate::model::BatchUpdateUserLicensesMetadata,
17175 > {
17176 type Operation = google_cloud_lro::internal::Operation<
17177 crate::model::BatchUpdateUserLicensesResponse,
17178 crate::model::BatchUpdateUserLicensesMetadata,
17179 >;
17180 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
17181 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
17182
17183 let stub = self.0.stub.clone();
17184 let mut options = self.0.options.clone();
17185 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
17186 let query = move |name| {
17187 let stub = stub.clone();
17188 let options = options.clone();
17189 async {
17190 let op = GetOperation::new(stub)
17191 .set_name(name)
17192 .with_options(options)
17193 .send()
17194 .await?;
17195 Ok(Operation::new(op))
17196 }
17197 };
17198
17199 let start = move || async {
17200 let op = self.send().await?;
17201 Ok(Operation::new(op))
17202 };
17203
17204 google_cloud_lro::internal::new_poller(
17205 polling_error_policy,
17206 polling_backoff_policy,
17207 start,
17208 query,
17209 )
17210 }
17211
17212 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17216 self.0.request.parent = v.into();
17217 self
17218 }
17219
17220 pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
17222 self.0.request.delete_unassigned_user_licenses = v.into();
17223 self
17224 }
17225
17226 pub fn set_source<
17231 T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
17232 >(
17233 mut self,
17234 v: T,
17235 ) -> Self {
17236 self.0.request.source = v.into();
17237 self
17238 }
17239
17240 pub fn set_inline_source<
17246 T: std::convert::Into<
17247 std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
17248 >,
17249 >(
17250 mut self,
17251 v: T,
17252 ) -> Self {
17253 self.0.request = self.0.request.set_inline_source(v);
17254 self
17255 }
17256 }
17257
17258 #[doc(hidden)]
17259 impl crate::RequestBuilder for BatchUpdateUserLicenses {
17260 fn request_options(&mut self) -> &mut crate::RequestOptions {
17261 &mut self.0.options
17262 }
17263 }
17264
17265 #[derive(Clone, Debug)]
17286 pub struct ListOperations(
17287 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17288 );
17289
17290 impl ListOperations {
17291 pub(crate) fn new(
17292 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17293 ) -> Self {
17294 Self(RequestBuilder::new(stub))
17295 }
17296
17297 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17299 mut self,
17300 v: V,
17301 ) -> Self {
17302 self.0.request = v.into();
17303 self
17304 }
17305
17306 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17308 self.0.options = v.into();
17309 self
17310 }
17311
17312 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17314 (*self.0.stub)
17315 .list_operations(self.0.request, self.0.options)
17316 .await
17317 .map(crate::Response::into_body)
17318 }
17319
17320 pub fn by_page(
17322 self,
17323 ) -> impl google_cloud_gax::paginator::Paginator<
17324 google_cloud_longrunning::model::ListOperationsResponse,
17325 crate::Error,
17326 > {
17327 use std::clone::Clone;
17328 let token = self.0.request.page_token.clone();
17329 let execute = move |token: String| {
17330 let mut builder = self.clone();
17331 builder.0.request = builder.0.request.set_page_token(token);
17332 builder.send()
17333 };
17334 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17335 }
17336
17337 pub fn by_item(
17339 self,
17340 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17341 google_cloud_longrunning::model::ListOperationsResponse,
17342 crate::Error,
17343 > {
17344 use google_cloud_gax::paginator::Paginator;
17345 self.by_page().items()
17346 }
17347
17348 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17350 self.0.request.name = v.into();
17351 self
17352 }
17353
17354 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17356 self.0.request.filter = v.into();
17357 self
17358 }
17359
17360 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17362 self.0.request.page_size = v.into();
17363 self
17364 }
17365
17366 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17368 self.0.request.page_token = v.into();
17369 self
17370 }
17371
17372 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17374 self.0.request.return_partial_success = v.into();
17375 self
17376 }
17377 }
17378
17379 #[doc(hidden)]
17380 impl crate::RequestBuilder for ListOperations {
17381 fn request_options(&mut self) -> &mut crate::RequestOptions {
17382 &mut self.0.options
17383 }
17384 }
17385
17386 #[derive(Clone, Debug)]
17403 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17404
17405 impl GetOperation {
17406 pub(crate) fn new(
17407 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17408 ) -> Self {
17409 Self(RequestBuilder::new(stub))
17410 }
17411
17412 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17414 mut self,
17415 v: V,
17416 ) -> Self {
17417 self.0.request = v.into();
17418 self
17419 }
17420
17421 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17423 self.0.options = v.into();
17424 self
17425 }
17426
17427 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17429 (*self.0.stub)
17430 .get_operation(self.0.request, self.0.options)
17431 .await
17432 .map(crate::Response::into_body)
17433 }
17434
17435 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17437 self.0.request.name = v.into();
17438 self
17439 }
17440 }
17441
17442 #[doc(hidden)]
17443 impl crate::RequestBuilder for GetOperation {
17444 fn request_options(&mut self) -> &mut crate::RequestOptions {
17445 &mut self.0.options
17446 }
17447 }
17448
17449 #[derive(Clone, Debug)]
17466 pub struct CancelOperation(
17467 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17468 );
17469
17470 impl CancelOperation {
17471 pub(crate) fn new(
17472 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17473 ) -> Self {
17474 Self(RequestBuilder::new(stub))
17475 }
17476
17477 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17479 mut self,
17480 v: V,
17481 ) -> Self {
17482 self.0.request = v.into();
17483 self
17484 }
17485
17486 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17488 self.0.options = v.into();
17489 self
17490 }
17491
17492 pub async fn send(self) -> Result<()> {
17494 (*self.0.stub)
17495 .cancel_operation(self.0.request, self.0.options)
17496 .await
17497 .map(crate::Response::into_body)
17498 }
17499
17500 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17502 self.0.request.name = v.into();
17503 self
17504 }
17505 }
17506
17507 #[doc(hidden)]
17508 impl crate::RequestBuilder for CancelOperation {
17509 fn request_options(&mut self) -> &mut crate::RequestOptions {
17510 &mut self.0.options
17511 }
17512 }
17513}