1#[cfg(feature = "assistant-service")]
18#[cfg_attr(docsrs, doc(cfg(feature = "assistant-service")))]
19pub mod assistant_service {
20 use crate::Result;
21
22 pub type ClientBuilder =
36 gax::client_builder::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 gax::client_builder::internal::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 ) -> gax::client_builder::Result<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: gax::options::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: gax::options::RequestOptions::default(),
72 }
73 }
74 }
75
76 #[derive(Clone, Debug)]
98 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
99
100 impl ListOperations {
101 pub(crate) fn new(
102 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
103 ) -> Self {
104 Self(RequestBuilder::new(stub))
105 }
106
107 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
109 mut self,
110 v: V,
111 ) -> Self {
112 self.0.request = v.into();
113 self
114 }
115
116 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
118 self.0.options = v.into();
119 self
120 }
121
122 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
124 (*self.0.stub)
125 .list_operations(self.0.request, self.0.options)
126 .await
127 .map(gax::response::Response::into_body)
128 }
129
130 pub fn by_page(
132 self,
133 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
134 {
135 use std::clone::Clone;
136 let token = self.0.request.page_token.clone();
137 let execute = move |token: String| {
138 let mut builder = self.clone();
139 builder.0.request = builder.0.request.set_page_token(token);
140 builder.send()
141 };
142 gax::paginator::internal::new_paginator(token, execute)
143 }
144
145 pub fn by_item(
147 self,
148 ) -> impl gax::paginator::ItemPaginator<
149 longrunning::model::ListOperationsResponse,
150 gax::error::Error,
151 > {
152 use gax::paginator::Paginator;
153 self.by_page().items()
154 }
155
156 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
158 self.0.request.name = v.into();
159 self
160 }
161
162 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
164 self.0.request.filter = v.into();
165 self
166 }
167
168 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
170 self.0.request.page_size = v.into();
171 self
172 }
173
174 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
176 self.0.request.page_token = v.into();
177 self
178 }
179
180 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
182 self.0.request.return_partial_success = v.into();
183 self
184 }
185 }
186
187 #[doc(hidden)]
188 impl gax::options::internal::RequestBuilder for ListOperations {
189 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
190 &mut self.0.options
191 }
192 }
193
194 #[derive(Clone, Debug)]
212 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
213
214 impl GetOperation {
215 pub(crate) fn new(
216 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
217 ) -> Self {
218 Self(RequestBuilder::new(stub))
219 }
220
221 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
223 mut self,
224 v: V,
225 ) -> Self {
226 self.0.request = v.into();
227 self
228 }
229
230 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
232 self.0.options = v.into();
233 self
234 }
235
236 pub async fn send(self) -> Result<longrunning::model::Operation> {
238 (*self.0.stub)
239 .get_operation(self.0.request, self.0.options)
240 .await
241 .map(gax::response::Response::into_body)
242 }
243
244 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
246 self.0.request.name = v.into();
247 self
248 }
249 }
250
251 #[doc(hidden)]
252 impl gax::options::internal::RequestBuilder for GetOperation {
253 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
254 &mut self.0.options
255 }
256 }
257
258 #[derive(Clone, Debug)]
276 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
277
278 impl CancelOperation {
279 pub(crate) fn new(
280 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
281 ) -> Self {
282 Self(RequestBuilder::new(stub))
283 }
284
285 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
287 mut self,
288 v: V,
289 ) -> Self {
290 self.0.request = v.into();
291 self
292 }
293
294 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
296 self.0.options = v.into();
297 self
298 }
299
300 pub async fn send(self) -> Result<()> {
302 (*self.0.stub)
303 .cancel_operation(self.0.request, self.0.options)
304 .await
305 .map(gax::response::Response::into_body)
306 }
307
308 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
310 self.0.request.name = v.into();
311 self
312 }
313 }
314
315 #[doc(hidden)]
316 impl gax::options::internal::RequestBuilder for CancelOperation {
317 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
318 &mut self.0.options
319 }
320 }
321}
322
323#[cfg(feature = "cmek-config-service")]
324#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
325pub mod cmek_config_service {
326 use crate::Result;
327
328 pub type ClientBuilder =
342 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
343
344 pub(crate) mod client {
345 use super::super::super::client::CmekConfigService;
346 pub struct Factory;
347 impl gax::client_builder::internal::ClientFactory for Factory {
348 type Client = CmekConfigService;
349 type Credentials = gaxi::options::Credentials;
350 async fn build(
351 self,
352 config: gaxi::options::ClientConfig,
353 ) -> gax::client_builder::Result<Self::Client> {
354 Self::Client::new(config).await
355 }
356 }
357 }
358
359 #[derive(Clone, Debug)]
361 pub(crate) struct RequestBuilder<R: std::default::Default> {
362 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
363 request: R,
364 options: gax::options::RequestOptions,
365 }
366
367 impl<R> RequestBuilder<R>
368 where
369 R: std::default::Default,
370 {
371 pub(crate) fn new(
372 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
373 ) -> Self {
374 Self {
375 stub,
376 request: R::default(),
377 options: gax::options::RequestOptions::default(),
378 }
379 }
380 }
381
382 #[derive(Clone, Debug)]
401 pub struct UpdateCmekConfig(RequestBuilder<crate::model::UpdateCmekConfigRequest>);
402
403 impl UpdateCmekConfig {
404 pub(crate) fn new(
405 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
406 ) -> Self {
407 Self(RequestBuilder::new(stub))
408 }
409
410 pub fn with_request<V: Into<crate::model::UpdateCmekConfigRequest>>(
412 mut self,
413 v: V,
414 ) -> Self {
415 self.0.request = v.into();
416 self
417 }
418
419 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
421 self.0.options = v.into();
422 self
423 }
424
425 pub async fn send(self) -> Result<longrunning::model::Operation> {
432 (*self.0.stub)
433 .update_cmek_config(self.0.request, self.0.options)
434 .await
435 .map(gax::response::Response::into_body)
436 }
437
438 pub fn poller(
440 self,
441 ) -> impl lro::Poller<crate::model::CmekConfig, crate::model::UpdateCmekConfigMetadata>
442 {
443 type Operation = lro::internal::Operation<
444 crate::model::CmekConfig,
445 crate::model::UpdateCmekConfigMetadata,
446 >;
447 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
448 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
449
450 let stub = self.0.stub.clone();
451 let mut options = self.0.options.clone();
452 options.set_retry_policy(gax::retry_policy::NeverRetry);
453 let query = move |name| {
454 let stub = stub.clone();
455 let options = options.clone();
456 async {
457 let op = GetOperation::new(stub)
458 .set_name(name)
459 .with_options(options)
460 .send()
461 .await?;
462 Ok(Operation::new(op))
463 }
464 };
465
466 let start = move || async {
467 let op = self.send().await?;
468 Ok(Operation::new(op))
469 };
470
471 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
472 }
473
474 pub fn set_config<T>(mut self, v: T) -> Self
478 where
479 T: std::convert::Into<crate::model::CmekConfig>,
480 {
481 self.0.request.config = std::option::Option::Some(v.into());
482 self
483 }
484
485 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
489 where
490 T: std::convert::Into<crate::model::CmekConfig>,
491 {
492 self.0.request.config = v.map(|x| x.into());
493 self
494 }
495
496 pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
498 self.0.request.set_default = v.into();
499 self
500 }
501 }
502
503 #[doc(hidden)]
504 impl gax::options::internal::RequestBuilder for UpdateCmekConfig {
505 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
506 &mut self.0.options
507 }
508 }
509
510 #[derive(Clone, Debug)]
528 pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
529
530 impl GetCmekConfig {
531 pub(crate) fn new(
532 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
533 ) -> Self {
534 Self(RequestBuilder::new(stub))
535 }
536
537 pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
539 self.0.request = v.into();
540 self
541 }
542
543 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
545 self.0.options = v.into();
546 self
547 }
548
549 pub async fn send(self) -> Result<crate::model::CmekConfig> {
551 (*self.0.stub)
552 .get_cmek_config(self.0.request, self.0.options)
553 .await
554 .map(gax::response::Response::into_body)
555 }
556
557 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
561 self.0.request.name = v.into();
562 self
563 }
564 }
565
566 #[doc(hidden)]
567 impl gax::options::internal::RequestBuilder for GetCmekConfig {
568 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
569 &mut self.0.options
570 }
571 }
572
573 #[derive(Clone, Debug)]
591 pub struct ListCmekConfigs(RequestBuilder<crate::model::ListCmekConfigsRequest>);
592
593 impl ListCmekConfigs {
594 pub(crate) fn new(
595 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
596 ) -> Self {
597 Self(RequestBuilder::new(stub))
598 }
599
600 pub fn with_request<V: Into<crate::model::ListCmekConfigsRequest>>(mut self, v: V) -> Self {
602 self.0.request = v.into();
603 self
604 }
605
606 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
608 self.0.options = v.into();
609 self
610 }
611
612 pub async fn send(self) -> Result<crate::model::ListCmekConfigsResponse> {
614 (*self.0.stub)
615 .list_cmek_configs(self.0.request, self.0.options)
616 .await
617 .map(gax::response::Response::into_body)
618 }
619
620 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
624 self.0.request.parent = v.into();
625 self
626 }
627 }
628
629 #[doc(hidden)]
630 impl gax::options::internal::RequestBuilder for ListCmekConfigs {
631 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
632 &mut self.0.options
633 }
634 }
635
636 #[derive(Clone, Debug)]
655 pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
656
657 impl DeleteCmekConfig {
658 pub(crate) fn new(
659 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
660 ) -> Self {
661 Self(RequestBuilder::new(stub))
662 }
663
664 pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
666 mut self,
667 v: V,
668 ) -> Self {
669 self.0.request = v.into();
670 self
671 }
672
673 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
675 self.0.options = v.into();
676 self
677 }
678
679 pub async fn send(self) -> Result<longrunning::model::Operation> {
686 (*self.0.stub)
687 .delete_cmek_config(self.0.request, self.0.options)
688 .await
689 .map(gax::response::Response::into_body)
690 }
691
692 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
694 type Operation =
695 lro::internal::Operation<wkt::Empty, crate::model::DeleteCmekConfigMetadata>;
696 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
697 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
698
699 let stub = self.0.stub.clone();
700 let mut options = self.0.options.clone();
701 options.set_retry_policy(gax::retry_policy::NeverRetry);
702 let query = move |name| {
703 let stub = stub.clone();
704 let options = options.clone();
705 async {
706 let op = GetOperation::new(stub)
707 .set_name(name)
708 .with_options(options)
709 .send()
710 .await?;
711 Ok(Operation::new(op))
712 }
713 };
714
715 let start = move || async {
716 let op = self.send().await?;
717 Ok(Operation::new(op))
718 };
719
720 lro::internal::new_unit_response_poller(
721 polling_error_policy,
722 polling_backoff_policy,
723 start,
724 query,
725 )
726 }
727
728 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
732 self.0.request.name = v.into();
733 self
734 }
735 }
736
737 #[doc(hidden)]
738 impl gax::options::internal::RequestBuilder for DeleteCmekConfig {
739 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
740 &mut self.0.options
741 }
742 }
743
744 #[derive(Clone, Debug)]
766 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
767
768 impl ListOperations {
769 pub(crate) fn new(
770 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
771 ) -> Self {
772 Self(RequestBuilder::new(stub))
773 }
774
775 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
777 mut self,
778 v: V,
779 ) -> Self {
780 self.0.request = v.into();
781 self
782 }
783
784 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
786 self.0.options = v.into();
787 self
788 }
789
790 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
792 (*self.0.stub)
793 .list_operations(self.0.request, self.0.options)
794 .await
795 .map(gax::response::Response::into_body)
796 }
797
798 pub fn by_page(
800 self,
801 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
802 {
803 use std::clone::Clone;
804 let token = self.0.request.page_token.clone();
805 let execute = move |token: String| {
806 let mut builder = self.clone();
807 builder.0.request = builder.0.request.set_page_token(token);
808 builder.send()
809 };
810 gax::paginator::internal::new_paginator(token, execute)
811 }
812
813 pub fn by_item(
815 self,
816 ) -> impl gax::paginator::ItemPaginator<
817 longrunning::model::ListOperationsResponse,
818 gax::error::Error,
819 > {
820 use gax::paginator::Paginator;
821 self.by_page().items()
822 }
823
824 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
826 self.0.request.name = v.into();
827 self
828 }
829
830 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
832 self.0.request.filter = v.into();
833 self
834 }
835
836 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
838 self.0.request.page_size = v.into();
839 self
840 }
841
842 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
844 self.0.request.page_token = v.into();
845 self
846 }
847
848 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
850 self.0.request.return_partial_success = v.into();
851 self
852 }
853 }
854
855 #[doc(hidden)]
856 impl gax::options::internal::RequestBuilder for ListOperations {
857 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
858 &mut self.0.options
859 }
860 }
861
862 #[derive(Clone, Debug)]
880 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
881
882 impl GetOperation {
883 pub(crate) fn new(
884 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
885 ) -> Self {
886 Self(RequestBuilder::new(stub))
887 }
888
889 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
891 mut self,
892 v: V,
893 ) -> Self {
894 self.0.request = v.into();
895 self
896 }
897
898 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
900 self.0.options = v.into();
901 self
902 }
903
904 pub async fn send(self) -> Result<longrunning::model::Operation> {
906 (*self.0.stub)
907 .get_operation(self.0.request, self.0.options)
908 .await
909 .map(gax::response::Response::into_body)
910 }
911
912 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
914 self.0.request.name = v.into();
915 self
916 }
917 }
918
919 #[doc(hidden)]
920 impl gax::options::internal::RequestBuilder for GetOperation {
921 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
922 &mut self.0.options
923 }
924 }
925
926 #[derive(Clone, Debug)]
944 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
945
946 impl CancelOperation {
947 pub(crate) fn new(
948 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
949 ) -> Self {
950 Self(RequestBuilder::new(stub))
951 }
952
953 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
955 mut self,
956 v: V,
957 ) -> Self {
958 self.0.request = v.into();
959 self
960 }
961
962 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
964 self.0.options = v.into();
965 self
966 }
967
968 pub async fn send(self) -> Result<()> {
970 (*self.0.stub)
971 .cancel_operation(self.0.request, self.0.options)
972 .await
973 .map(gax::response::Response::into_body)
974 }
975
976 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
978 self.0.request.name = v.into();
979 self
980 }
981 }
982
983 #[doc(hidden)]
984 impl gax::options::internal::RequestBuilder for CancelOperation {
985 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
986 &mut self.0.options
987 }
988 }
989}
990
991#[cfg(feature = "completion-service")]
992#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
993pub mod completion_service {
994 use crate::Result;
995
996 pub type ClientBuilder =
1010 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1011
1012 pub(crate) mod client {
1013 use super::super::super::client::CompletionService;
1014 pub struct Factory;
1015 impl gax::client_builder::internal::ClientFactory for Factory {
1016 type Client = CompletionService;
1017 type Credentials = gaxi::options::Credentials;
1018 async fn build(
1019 self,
1020 config: gaxi::options::ClientConfig,
1021 ) -> gax::client_builder::Result<Self::Client> {
1022 Self::Client::new(config).await
1023 }
1024 }
1025 }
1026
1027 #[derive(Clone, Debug)]
1029 pub(crate) struct RequestBuilder<R: std::default::Default> {
1030 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1031 request: R,
1032 options: gax::options::RequestOptions,
1033 }
1034
1035 impl<R> RequestBuilder<R>
1036 where
1037 R: std::default::Default,
1038 {
1039 pub(crate) fn new(
1040 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1041 ) -> Self {
1042 Self {
1043 stub,
1044 request: R::default(),
1045 options: gax::options::RequestOptions::default(),
1046 }
1047 }
1048 }
1049
1050 #[derive(Clone, Debug)]
1068 pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1069
1070 impl CompleteQuery {
1071 pub(crate) fn new(
1072 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1073 ) -> Self {
1074 Self(RequestBuilder::new(stub))
1075 }
1076
1077 pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1079 self.0.request = v.into();
1080 self
1081 }
1082
1083 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1085 self.0.options = v.into();
1086 self
1087 }
1088
1089 pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1091 (*self.0.stub)
1092 .complete_query(self.0.request, self.0.options)
1093 .await
1094 .map(gax::response::Response::into_body)
1095 }
1096
1097 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1101 self.0.request.data_store = v.into();
1102 self
1103 }
1104
1105 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1109 self.0.request.query = v.into();
1110 self
1111 }
1112
1113 pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1115 self.0.request.query_model = v.into();
1116 self
1117 }
1118
1119 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1121 self.0.request.user_pseudo_id = v.into();
1122 self
1123 }
1124
1125 pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1127 self.0.request.include_tail_suggestions = v.into();
1128 self
1129 }
1130 }
1131
1132 #[doc(hidden)]
1133 impl gax::options::internal::RequestBuilder for CompleteQuery {
1134 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1135 &mut self.0.options
1136 }
1137 }
1138
1139 #[derive(Clone, Debug)]
1158 pub struct ImportSuggestionDenyListEntries(
1159 RequestBuilder<crate::model::ImportSuggestionDenyListEntriesRequest>,
1160 );
1161
1162 impl ImportSuggestionDenyListEntries {
1163 pub(crate) fn new(
1164 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1165 ) -> Self {
1166 Self(RequestBuilder::new(stub))
1167 }
1168
1169 pub fn with_request<V: Into<crate::model::ImportSuggestionDenyListEntriesRequest>>(
1171 mut self,
1172 v: V,
1173 ) -> Self {
1174 self.0.request = v.into();
1175 self
1176 }
1177
1178 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1180 self.0.options = v.into();
1181 self
1182 }
1183
1184 pub async fn send(self) -> Result<longrunning::model::Operation> {
1191 (*self.0.stub)
1192 .import_suggestion_deny_list_entries(self.0.request, self.0.options)
1193 .await
1194 .map(gax::response::Response::into_body)
1195 }
1196
1197 pub fn poller(
1199 self,
1200 ) -> impl lro::Poller<
1201 crate::model::ImportSuggestionDenyListEntriesResponse,
1202 crate::model::ImportSuggestionDenyListEntriesMetadata,
1203 > {
1204 type Operation = lro::internal::Operation<
1205 crate::model::ImportSuggestionDenyListEntriesResponse,
1206 crate::model::ImportSuggestionDenyListEntriesMetadata,
1207 >;
1208 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1209 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1210
1211 let stub = self.0.stub.clone();
1212 let mut options = self.0.options.clone();
1213 options.set_retry_policy(gax::retry_policy::NeverRetry);
1214 let query = move |name| {
1215 let stub = stub.clone();
1216 let options = options.clone();
1217 async {
1218 let op = GetOperation::new(stub)
1219 .set_name(name)
1220 .with_options(options)
1221 .send()
1222 .await?;
1223 Ok(Operation::new(op))
1224 }
1225 };
1226
1227 let start = move || async {
1228 let op = self.send().await?;
1229 Ok(Operation::new(op))
1230 };
1231
1232 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1233 }
1234
1235 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1239 self.0.request.parent = v.into();
1240 self
1241 }
1242
1243 pub fn set_source<
1248 T: Into<Option<crate::model::import_suggestion_deny_list_entries_request::Source>>,
1249 >(
1250 mut self,
1251 v: T,
1252 ) -> Self {
1253 self.0.request.source = v.into();
1254 self
1255 }
1256
1257 pub fn set_inline_source<
1263 T: std::convert::Into<
1264 std::boxed::Box<
1265 crate::model::import_suggestion_deny_list_entries_request::InlineSource,
1266 >,
1267 >,
1268 >(
1269 mut self,
1270 v: T,
1271 ) -> Self {
1272 self.0.request = self.0.request.set_inline_source(v);
1273 self
1274 }
1275
1276 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1282 mut self,
1283 v: T,
1284 ) -> Self {
1285 self.0.request = self.0.request.set_gcs_source(v);
1286 self
1287 }
1288 }
1289
1290 #[doc(hidden)]
1291 impl gax::options::internal::RequestBuilder for ImportSuggestionDenyListEntries {
1292 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1293 &mut self.0.options
1294 }
1295 }
1296
1297 #[derive(Clone, Debug)]
1316 pub struct PurgeSuggestionDenyListEntries(
1317 RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1318 );
1319
1320 impl PurgeSuggestionDenyListEntries {
1321 pub(crate) fn new(
1322 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1323 ) -> Self {
1324 Self(RequestBuilder::new(stub))
1325 }
1326
1327 pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1329 mut self,
1330 v: V,
1331 ) -> Self {
1332 self.0.request = v.into();
1333 self
1334 }
1335
1336 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1338 self.0.options = v.into();
1339 self
1340 }
1341
1342 pub async fn send(self) -> Result<longrunning::model::Operation> {
1349 (*self.0.stub)
1350 .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1351 .await
1352 .map(gax::response::Response::into_body)
1353 }
1354
1355 pub fn poller(
1357 self,
1358 ) -> impl lro::Poller<
1359 crate::model::PurgeSuggestionDenyListEntriesResponse,
1360 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1361 > {
1362 type Operation = lro::internal::Operation<
1363 crate::model::PurgeSuggestionDenyListEntriesResponse,
1364 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1365 >;
1366 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1367 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1368
1369 let stub = self.0.stub.clone();
1370 let mut options = self.0.options.clone();
1371 options.set_retry_policy(gax::retry_policy::NeverRetry);
1372 let query = move |name| {
1373 let stub = stub.clone();
1374 let options = options.clone();
1375 async {
1376 let op = GetOperation::new(stub)
1377 .set_name(name)
1378 .with_options(options)
1379 .send()
1380 .await?;
1381 Ok(Operation::new(op))
1382 }
1383 };
1384
1385 let start = move || async {
1386 let op = self.send().await?;
1387 Ok(Operation::new(op))
1388 };
1389
1390 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1391 }
1392
1393 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1397 self.0.request.parent = v.into();
1398 self
1399 }
1400 }
1401
1402 #[doc(hidden)]
1403 impl gax::options::internal::RequestBuilder for PurgeSuggestionDenyListEntries {
1404 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1405 &mut self.0.options
1406 }
1407 }
1408
1409 #[derive(Clone, Debug)]
1428 pub struct ImportCompletionSuggestions(
1429 RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1430 );
1431
1432 impl ImportCompletionSuggestions {
1433 pub(crate) fn new(
1434 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1435 ) -> Self {
1436 Self(RequestBuilder::new(stub))
1437 }
1438
1439 pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1441 mut self,
1442 v: V,
1443 ) -> Self {
1444 self.0.request = v.into();
1445 self
1446 }
1447
1448 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1450 self.0.options = v.into();
1451 self
1452 }
1453
1454 pub async fn send(self) -> Result<longrunning::model::Operation> {
1461 (*self.0.stub)
1462 .import_completion_suggestions(self.0.request, self.0.options)
1463 .await
1464 .map(gax::response::Response::into_body)
1465 }
1466
1467 pub fn poller(
1469 self,
1470 ) -> impl lro::Poller<
1471 crate::model::ImportCompletionSuggestionsResponse,
1472 crate::model::ImportCompletionSuggestionsMetadata,
1473 > {
1474 type Operation = lro::internal::Operation<
1475 crate::model::ImportCompletionSuggestionsResponse,
1476 crate::model::ImportCompletionSuggestionsMetadata,
1477 >;
1478 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1479 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1480
1481 let stub = self.0.stub.clone();
1482 let mut options = self.0.options.clone();
1483 options.set_retry_policy(gax::retry_policy::NeverRetry);
1484 let query = move |name| {
1485 let stub = stub.clone();
1486 let options = options.clone();
1487 async {
1488 let op = GetOperation::new(stub)
1489 .set_name(name)
1490 .with_options(options)
1491 .send()
1492 .await?;
1493 Ok(Operation::new(op))
1494 }
1495 };
1496
1497 let start = move || async {
1498 let op = self.send().await?;
1499 Ok(Operation::new(op))
1500 };
1501
1502 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1503 }
1504
1505 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1509 self.0.request.parent = v.into();
1510 self
1511 }
1512
1513 pub fn set_error_config<T>(mut self, v: T) -> Self
1515 where
1516 T: std::convert::Into<crate::model::ImportErrorConfig>,
1517 {
1518 self.0.request.error_config = std::option::Option::Some(v.into());
1519 self
1520 }
1521
1522 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1524 where
1525 T: std::convert::Into<crate::model::ImportErrorConfig>,
1526 {
1527 self.0.request.error_config = v.map(|x| x.into());
1528 self
1529 }
1530
1531 pub fn set_source<
1536 T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1537 >(
1538 mut self,
1539 v: T,
1540 ) -> Self {
1541 self.0.request.source = v.into();
1542 self
1543 }
1544
1545 pub fn set_inline_source<
1551 T: std::convert::Into<
1552 std::boxed::Box<
1553 crate::model::import_completion_suggestions_request::InlineSource,
1554 >,
1555 >,
1556 >(
1557 mut self,
1558 v: T,
1559 ) -> Self {
1560 self.0.request = self.0.request.set_inline_source(v);
1561 self
1562 }
1563
1564 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1570 mut self,
1571 v: T,
1572 ) -> Self {
1573 self.0.request = self.0.request.set_gcs_source(v);
1574 self
1575 }
1576
1577 pub fn set_bigquery_source<
1583 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1584 >(
1585 mut self,
1586 v: T,
1587 ) -> Self {
1588 self.0.request = self.0.request.set_bigquery_source(v);
1589 self
1590 }
1591 }
1592
1593 #[doc(hidden)]
1594 impl gax::options::internal::RequestBuilder for ImportCompletionSuggestions {
1595 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1596 &mut self.0.options
1597 }
1598 }
1599
1600 #[derive(Clone, Debug)]
1619 pub struct PurgeCompletionSuggestions(
1620 RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1621 );
1622
1623 impl PurgeCompletionSuggestions {
1624 pub(crate) fn new(
1625 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1626 ) -> Self {
1627 Self(RequestBuilder::new(stub))
1628 }
1629
1630 pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1632 mut self,
1633 v: V,
1634 ) -> Self {
1635 self.0.request = v.into();
1636 self
1637 }
1638
1639 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1641 self.0.options = v.into();
1642 self
1643 }
1644
1645 pub async fn send(self) -> Result<longrunning::model::Operation> {
1652 (*self.0.stub)
1653 .purge_completion_suggestions(self.0.request, self.0.options)
1654 .await
1655 .map(gax::response::Response::into_body)
1656 }
1657
1658 pub fn poller(
1660 self,
1661 ) -> impl lro::Poller<
1662 crate::model::PurgeCompletionSuggestionsResponse,
1663 crate::model::PurgeCompletionSuggestionsMetadata,
1664 > {
1665 type Operation = lro::internal::Operation<
1666 crate::model::PurgeCompletionSuggestionsResponse,
1667 crate::model::PurgeCompletionSuggestionsMetadata,
1668 >;
1669 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1670 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1671
1672 let stub = self.0.stub.clone();
1673 let mut options = self.0.options.clone();
1674 options.set_retry_policy(gax::retry_policy::NeverRetry);
1675 let query = move |name| {
1676 let stub = stub.clone();
1677 let options = options.clone();
1678 async {
1679 let op = GetOperation::new(stub)
1680 .set_name(name)
1681 .with_options(options)
1682 .send()
1683 .await?;
1684 Ok(Operation::new(op))
1685 }
1686 };
1687
1688 let start = move || async {
1689 let op = self.send().await?;
1690 Ok(Operation::new(op))
1691 };
1692
1693 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1694 }
1695
1696 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1700 self.0.request.parent = v.into();
1701 self
1702 }
1703 }
1704
1705 #[doc(hidden)]
1706 impl gax::options::internal::RequestBuilder for PurgeCompletionSuggestions {
1707 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1708 &mut self.0.options
1709 }
1710 }
1711
1712 #[derive(Clone, Debug)]
1734 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1735
1736 impl ListOperations {
1737 pub(crate) fn new(
1738 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1739 ) -> Self {
1740 Self(RequestBuilder::new(stub))
1741 }
1742
1743 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1745 mut self,
1746 v: V,
1747 ) -> Self {
1748 self.0.request = v.into();
1749 self
1750 }
1751
1752 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1754 self.0.options = v.into();
1755 self
1756 }
1757
1758 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1760 (*self.0.stub)
1761 .list_operations(self.0.request, self.0.options)
1762 .await
1763 .map(gax::response::Response::into_body)
1764 }
1765
1766 pub fn by_page(
1768 self,
1769 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1770 {
1771 use std::clone::Clone;
1772 let token = self.0.request.page_token.clone();
1773 let execute = move |token: String| {
1774 let mut builder = self.clone();
1775 builder.0.request = builder.0.request.set_page_token(token);
1776 builder.send()
1777 };
1778 gax::paginator::internal::new_paginator(token, execute)
1779 }
1780
1781 pub fn by_item(
1783 self,
1784 ) -> impl gax::paginator::ItemPaginator<
1785 longrunning::model::ListOperationsResponse,
1786 gax::error::Error,
1787 > {
1788 use gax::paginator::Paginator;
1789 self.by_page().items()
1790 }
1791
1792 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1794 self.0.request.name = v.into();
1795 self
1796 }
1797
1798 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1800 self.0.request.filter = v.into();
1801 self
1802 }
1803
1804 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1806 self.0.request.page_size = v.into();
1807 self
1808 }
1809
1810 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1812 self.0.request.page_token = v.into();
1813 self
1814 }
1815
1816 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1818 self.0.request.return_partial_success = v.into();
1819 self
1820 }
1821 }
1822
1823 #[doc(hidden)]
1824 impl gax::options::internal::RequestBuilder for ListOperations {
1825 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1826 &mut self.0.options
1827 }
1828 }
1829
1830 #[derive(Clone, Debug)]
1848 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1849
1850 impl GetOperation {
1851 pub(crate) fn new(
1852 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1853 ) -> Self {
1854 Self(RequestBuilder::new(stub))
1855 }
1856
1857 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1859 mut self,
1860 v: V,
1861 ) -> Self {
1862 self.0.request = v.into();
1863 self
1864 }
1865
1866 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1868 self.0.options = v.into();
1869 self
1870 }
1871
1872 pub async fn send(self) -> Result<longrunning::model::Operation> {
1874 (*self.0.stub)
1875 .get_operation(self.0.request, self.0.options)
1876 .await
1877 .map(gax::response::Response::into_body)
1878 }
1879
1880 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1882 self.0.request.name = v.into();
1883 self
1884 }
1885 }
1886
1887 #[doc(hidden)]
1888 impl gax::options::internal::RequestBuilder for GetOperation {
1889 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1890 &mut self.0.options
1891 }
1892 }
1893
1894 #[derive(Clone, Debug)]
1912 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1913
1914 impl CancelOperation {
1915 pub(crate) fn new(
1916 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1917 ) -> Self {
1918 Self(RequestBuilder::new(stub))
1919 }
1920
1921 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1923 mut self,
1924 v: V,
1925 ) -> Self {
1926 self.0.request = v.into();
1927 self
1928 }
1929
1930 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1932 self.0.options = v.into();
1933 self
1934 }
1935
1936 pub async fn send(self) -> Result<()> {
1938 (*self.0.stub)
1939 .cancel_operation(self.0.request, self.0.options)
1940 .await
1941 .map(gax::response::Response::into_body)
1942 }
1943
1944 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1946 self.0.request.name = v.into();
1947 self
1948 }
1949 }
1950
1951 #[doc(hidden)]
1952 impl gax::options::internal::RequestBuilder for CancelOperation {
1953 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1954 &mut self.0.options
1955 }
1956 }
1957}
1958
1959#[cfg(feature = "control-service")]
1960#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
1961pub mod control_service {
1962 use crate::Result;
1963
1964 pub type ClientBuilder =
1978 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1979
1980 pub(crate) mod client {
1981 use super::super::super::client::ControlService;
1982 pub struct Factory;
1983 impl gax::client_builder::internal::ClientFactory for Factory {
1984 type Client = ControlService;
1985 type Credentials = gaxi::options::Credentials;
1986 async fn build(
1987 self,
1988 config: gaxi::options::ClientConfig,
1989 ) -> gax::client_builder::Result<Self::Client> {
1990 Self::Client::new(config).await
1991 }
1992 }
1993 }
1994
1995 #[derive(Clone, Debug)]
1997 pub(crate) struct RequestBuilder<R: std::default::Default> {
1998 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
1999 request: R,
2000 options: gax::options::RequestOptions,
2001 }
2002
2003 impl<R> RequestBuilder<R>
2004 where
2005 R: std::default::Default,
2006 {
2007 pub(crate) fn new(
2008 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2009 ) -> Self {
2010 Self {
2011 stub,
2012 request: R::default(),
2013 options: gax::options::RequestOptions::default(),
2014 }
2015 }
2016 }
2017
2018 #[derive(Clone, Debug)]
2036 pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2037
2038 impl CreateControl {
2039 pub(crate) fn new(
2040 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2041 ) -> Self {
2042 Self(RequestBuilder::new(stub))
2043 }
2044
2045 pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2047 self.0.request = v.into();
2048 self
2049 }
2050
2051 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2053 self.0.options = v.into();
2054 self
2055 }
2056
2057 pub async fn send(self) -> Result<crate::model::Control> {
2059 (*self.0.stub)
2060 .create_control(self.0.request, self.0.options)
2061 .await
2062 .map(gax::response::Response::into_body)
2063 }
2064
2065 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2069 self.0.request.parent = v.into();
2070 self
2071 }
2072
2073 pub fn set_control<T>(mut self, v: T) -> Self
2077 where
2078 T: std::convert::Into<crate::model::Control>,
2079 {
2080 self.0.request.control = std::option::Option::Some(v.into());
2081 self
2082 }
2083
2084 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2088 where
2089 T: std::convert::Into<crate::model::Control>,
2090 {
2091 self.0.request.control = v.map(|x| x.into());
2092 self
2093 }
2094
2095 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2099 self.0.request.control_id = v.into();
2100 self
2101 }
2102 }
2103
2104 #[doc(hidden)]
2105 impl gax::options::internal::RequestBuilder for CreateControl {
2106 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2107 &mut self.0.options
2108 }
2109 }
2110
2111 #[derive(Clone, Debug)]
2129 pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2130
2131 impl DeleteControl {
2132 pub(crate) fn new(
2133 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2134 ) -> Self {
2135 Self(RequestBuilder::new(stub))
2136 }
2137
2138 pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2140 self.0.request = v.into();
2141 self
2142 }
2143
2144 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2146 self.0.options = v.into();
2147 self
2148 }
2149
2150 pub async fn send(self) -> Result<()> {
2152 (*self.0.stub)
2153 .delete_control(self.0.request, self.0.options)
2154 .await
2155 .map(gax::response::Response::into_body)
2156 }
2157
2158 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2162 self.0.request.name = v.into();
2163 self
2164 }
2165 }
2166
2167 #[doc(hidden)]
2168 impl gax::options::internal::RequestBuilder for DeleteControl {
2169 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2170 &mut self.0.options
2171 }
2172 }
2173
2174 #[derive(Clone, Debug)]
2192 pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2193
2194 impl UpdateControl {
2195 pub(crate) fn new(
2196 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2197 ) -> Self {
2198 Self(RequestBuilder::new(stub))
2199 }
2200
2201 pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2203 self.0.request = v.into();
2204 self
2205 }
2206
2207 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2209 self.0.options = v.into();
2210 self
2211 }
2212
2213 pub async fn send(self) -> Result<crate::model::Control> {
2215 (*self.0.stub)
2216 .update_control(self.0.request, self.0.options)
2217 .await
2218 .map(gax::response::Response::into_body)
2219 }
2220
2221 pub fn set_control<T>(mut self, v: T) -> Self
2225 where
2226 T: std::convert::Into<crate::model::Control>,
2227 {
2228 self.0.request.control = std::option::Option::Some(v.into());
2229 self
2230 }
2231
2232 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2236 where
2237 T: std::convert::Into<crate::model::Control>,
2238 {
2239 self.0.request.control = v.map(|x| x.into());
2240 self
2241 }
2242
2243 pub fn set_update_mask<T>(mut self, v: T) -> Self
2245 where
2246 T: std::convert::Into<wkt::FieldMask>,
2247 {
2248 self.0.request.update_mask = std::option::Option::Some(v.into());
2249 self
2250 }
2251
2252 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2254 where
2255 T: std::convert::Into<wkt::FieldMask>,
2256 {
2257 self.0.request.update_mask = v.map(|x| x.into());
2258 self
2259 }
2260 }
2261
2262 #[doc(hidden)]
2263 impl gax::options::internal::RequestBuilder for UpdateControl {
2264 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2265 &mut self.0.options
2266 }
2267 }
2268
2269 #[derive(Clone, Debug)]
2287 pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2288
2289 impl GetControl {
2290 pub(crate) fn new(
2291 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2292 ) -> Self {
2293 Self(RequestBuilder::new(stub))
2294 }
2295
2296 pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2298 self.0.request = v.into();
2299 self
2300 }
2301
2302 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2304 self.0.options = v.into();
2305 self
2306 }
2307
2308 pub async fn send(self) -> Result<crate::model::Control> {
2310 (*self.0.stub)
2311 .get_control(self.0.request, self.0.options)
2312 .await
2313 .map(gax::response::Response::into_body)
2314 }
2315
2316 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2320 self.0.request.name = v.into();
2321 self
2322 }
2323 }
2324
2325 #[doc(hidden)]
2326 impl gax::options::internal::RequestBuilder for GetControl {
2327 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2328 &mut self.0.options
2329 }
2330 }
2331
2332 #[derive(Clone, Debug)]
2354 pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2355
2356 impl ListControls {
2357 pub(crate) fn new(
2358 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2359 ) -> Self {
2360 Self(RequestBuilder::new(stub))
2361 }
2362
2363 pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2365 self.0.request = v.into();
2366 self
2367 }
2368
2369 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2371 self.0.options = v.into();
2372 self
2373 }
2374
2375 pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2377 (*self.0.stub)
2378 .list_controls(self.0.request, self.0.options)
2379 .await
2380 .map(gax::response::Response::into_body)
2381 }
2382
2383 pub fn by_page(
2385 self,
2386 ) -> impl gax::paginator::Paginator<crate::model::ListControlsResponse, gax::error::Error>
2387 {
2388 use std::clone::Clone;
2389 let token = self.0.request.page_token.clone();
2390 let execute = move |token: String| {
2391 let mut builder = self.clone();
2392 builder.0.request = builder.0.request.set_page_token(token);
2393 builder.send()
2394 };
2395 gax::paginator::internal::new_paginator(token, execute)
2396 }
2397
2398 pub fn by_item(
2400 self,
2401 ) -> impl gax::paginator::ItemPaginator<crate::model::ListControlsResponse, gax::error::Error>
2402 {
2403 use gax::paginator::Paginator;
2404 self.by_page().items()
2405 }
2406
2407 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2411 self.0.request.parent = v.into();
2412 self
2413 }
2414
2415 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2417 self.0.request.page_size = v.into();
2418 self
2419 }
2420
2421 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2423 self.0.request.page_token = v.into();
2424 self
2425 }
2426
2427 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2429 self.0.request.filter = v.into();
2430 self
2431 }
2432 }
2433
2434 #[doc(hidden)]
2435 impl gax::options::internal::RequestBuilder for ListControls {
2436 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2437 &mut self.0.options
2438 }
2439 }
2440
2441 #[derive(Clone, Debug)]
2463 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2464
2465 impl ListOperations {
2466 pub(crate) fn new(
2467 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2468 ) -> Self {
2469 Self(RequestBuilder::new(stub))
2470 }
2471
2472 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2474 mut self,
2475 v: V,
2476 ) -> Self {
2477 self.0.request = v.into();
2478 self
2479 }
2480
2481 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2483 self.0.options = v.into();
2484 self
2485 }
2486
2487 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2489 (*self.0.stub)
2490 .list_operations(self.0.request, self.0.options)
2491 .await
2492 .map(gax::response::Response::into_body)
2493 }
2494
2495 pub fn by_page(
2497 self,
2498 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2499 {
2500 use std::clone::Clone;
2501 let token = self.0.request.page_token.clone();
2502 let execute = move |token: String| {
2503 let mut builder = self.clone();
2504 builder.0.request = builder.0.request.set_page_token(token);
2505 builder.send()
2506 };
2507 gax::paginator::internal::new_paginator(token, execute)
2508 }
2509
2510 pub fn by_item(
2512 self,
2513 ) -> impl gax::paginator::ItemPaginator<
2514 longrunning::model::ListOperationsResponse,
2515 gax::error::Error,
2516 > {
2517 use gax::paginator::Paginator;
2518 self.by_page().items()
2519 }
2520
2521 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2523 self.0.request.name = v.into();
2524 self
2525 }
2526
2527 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2529 self.0.request.filter = v.into();
2530 self
2531 }
2532
2533 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2535 self.0.request.page_size = v.into();
2536 self
2537 }
2538
2539 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2541 self.0.request.page_token = v.into();
2542 self
2543 }
2544
2545 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2547 self.0.request.return_partial_success = v.into();
2548 self
2549 }
2550 }
2551
2552 #[doc(hidden)]
2553 impl gax::options::internal::RequestBuilder for ListOperations {
2554 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2555 &mut self.0.options
2556 }
2557 }
2558
2559 #[derive(Clone, Debug)]
2577 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2578
2579 impl GetOperation {
2580 pub(crate) fn new(
2581 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2582 ) -> Self {
2583 Self(RequestBuilder::new(stub))
2584 }
2585
2586 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2588 mut self,
2589 v: V,
2590 ) -> Self {
2591 self.0.request = v.into();
2592 self
2593 }
2594
2595 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2597 self.0.options = v.into();
2598 self
2599 }
2600
2601 pub async fn send(self) -> Result<longrunning::model::Operation> {
2603 (*self.0.stub)
2604 .get_operation(self.0.request, self.0.options)
2605 .await
2606 .map(gax::response::Response::into_body)
2607 }
2608
2609 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2611 self.0.request.name = v.into();
2612 self
2613 }
2614 }
2615
2616 #[doc(hidden)]
2617 impl gax::options::internal::RequestBuilder for GetOperation {
2618 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2619 &mut self.0.options
2620 }
2621 }
2622
2623 #[derive(Clone, Debug)]
2641 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2642
2643 impl CancelOperation {
2644 pub(crate) fn new(
2645 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2646 ) -> Self {
2647 Self(RequestBuilder::new(stub))
2648 }
2649
2650 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2652 mut self,
2653 v: V,
2654 ) -> Self {
2655 self.0.request = v.into();
2656 self
2657 }
2658
2659 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2661 self.0.options = v.into();
2662 self
2663 }
2664
2665 pub async fn send(self) -> Result<()> {
2667 (*self.0.stub)
2668 .cancel_operation(self.0.request, self.0.options)
2669 .await
2670 .map(gax::response::Response::into_body)
2671 }
2672
2673 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2675 self.0.request.name = v.into();
2676 self
2677 }
2678 }
2679
2680 #[doc(hidden)]
2681 impl gax::options::internal::RequestBuilder for CancelOperation {
2682 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2683 &mut self.0.options
2684 }
2685 }
2686}
2687
2688#[cfg(feature = "conversational-search-service")]
2689#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2690pub mod conversational_search_service {
2691 use crate::Result;
2692
2693 pub type ClientBuilder =
2707 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2708
2709 pub(crate) mod client {
2710 use super::super::super::client::ConversationalSearchService;
2711 pub struct Factory;
2712 impl gax::client_builder::internal::ClientFactory for Factory {
2713 type Client = ConversationalSearchService;
2714 type Credentials = gaxi::options::Credentials;
2715 async fn build(
2716 self,
2717 config: gaxi::options::ClientConfig,
2718 ) -> gax::client_builder::Result<Self::Client> {
2719 Self::Client::new(config).await
2720 }
2721 }
2722 }
2723
2724 #[derive(Clone, Debug)]
2726 pub(crate) struct RequestBuilder<R: std::default::Default> {
2727 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2728 request: R,
2729 options: gax::options::RequestOptions,
2730 }
2731
2732 impl<R> RequestBuilder<R>
2733 where
2734 R: std::default::Default,
2735 {
2736 pub(crate) fn new(
2737 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2738 ) -> Self {
2739 Self {
2740 stub,
2741 request: R::default(),
2742 options: gax::options::RequestOptions::default(),
2743 }
2744 }
2745 }
2746
2747 #[derive(Clone, Debug)]
2765 pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
2766
2767 impl ConverseConversation {
2768 pub(crate) fn new(
2769 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2770 ) -> Self {
2771 Self(RequestBuilder::new(stub))
2772 }
2773
2774 pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
2776 mut self,
2777 v: V,
2778 ) -> Self {
2779 self.0.request = v.into();
2780 self
2781 }
2782
2783 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2785 self.0.options = v.into();
2786 self
2787 }
2788
2789 pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
2791 (*self.0.stub)
2792 .converse_conversation(self.0.request, self.0.options)
2793 .await
2794 .map(gax::response::Response::into_body)
2795 }
2796
2797 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2801 self.0.request.name = v.into();
2802 self
2803 }
2804
2805 pub fn set_query<T>(mut self, v: T) -> Self
2809 where
2810 T: std::convert::Into<crate::model::TextInput>,
2811 {
2812 self.0.request.query = std::option::Option::Some(v.into());
2813 self
2814 }
2815
2816 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
2820 where
2821 T: std::convert::Into<crate::model::TextInput>,
2822 {
2823 self.0.request.query = v.map(|x| x.into());
2824 self
2825 }
2826
2827 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2829 self.0.request.serving_config = v.into();
2830 self
2831 }
2832
2833 pub fn set_conversation<T>(mut self, v: T) -> Self
2835 where
2836 T: std::convert::Into<crate::model::Conversation>,
2837 {
2838 self.0.request.conversation = std::option::Option::Some(v.into());
2839 self
2840 }
2841
2842 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2844 where
2845 T: std::convert::Into<crate::model::Conversation>,
2846 {
2847 self.0.request.conversation = v.map(|x| x.into());
2848 self
2849 }
2850
2851 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
2853 self.0.request.safe_search = v.into();
2854 self
2855 }
2856
2857 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
2859 where
2860 T: std::iter::IntoIterator<Item = (K, V)>,
2861 K: std::convert::Into<std::string::String>,
2862 V: std::convert::Into<std::string::String>,
2863 {
2864 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2865 self
2866 }
2867
2868 pub fn set_summary_spec<T>(mut self, v: T) -> Self
2870 where
2871 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2872 {
2873 self.0.request.summary_spec = std::option::Option::Some(v.into());
2874 self
2875 }
2876
2877 pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
2879 where
2880 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2881 {
2882 self.0.request.summary_spec = v.map(|x| x.into());
2883 self
2884 }
2885
2886 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2888 self.0.request.filter = v.into();
2889 self
2890 }
2891
2892 pub fn set_boost_spec<T>(mut self, v: T) -> Self
2894 where
2895 T: std::convert::Into<crate::model::search_request::BoostSpec>,
2896 {
2897 self.0.request.boost_spec = std::option::Option::Some(v.into());
2898 self
2899 }
2900
2901 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
2903 where
2904 T: std::convert::Into<crate::model::search_request::BoostSpec>,
2905 {
2906 self.0.request.boost_spec = v.map(|x| x.into());
2907 self
2908 }
2909 }
2910
2911 #[doc(hidden)]
2912 impl gax::options::internal::RequestBuilder for ConverseConversation {
2913 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2914 &mut self.0.options
2915 }
2916 }
2917
2918 #[derive(Clone, Debug)]
2936 pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
2937
2938 impl CreateConversation {
2939 pub(crate) fn new(
2940 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2941 ) -> Self {
2942 Self(RequestBuilder::new(stub))
2943 }
2944
2945 pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
2947 mut self,
2948 v: V,
2949 ) -> Self {
2950 self.0.request = v.into();
2951 self
2952 }
2953
2954 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2956 self.0.options = v.into();
2957 self
2958 }
2959
2960 pub async fn send(self) -> Result<crate::model::Conversation> {
2962 (*self.0.stub)
2963 .create_conversation(self.0.request, self.0.options)
2964 .await
2965 .map(gax::response::Response::into_body)
2966 }
2967
2968 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2972 self.0.request.parent = v.into();
2973 self
2974 }
2975
2976 pub fn set_conversation<T>(mut self, v: T) -> Self
2980 where
2981 T: std::convert::Into<crate::model::Conversation>,
2982 {
2983 self.0.request.conversation = std::option::Option::Some(v.into());
2984 self
2985 }
2986
2987 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2991 where
2992 T: std::convert::Into<crate::model::Conversation>,
2993 {
2994 self.0.request.conversation = v.map(|x| x.into());
2995 self
2996 }
2997 }
2998
2999 #[doc(hidden)]
3000 impl gax::options::internal::RequestBuilder for CreateConversation {
3001 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3002 &mut self.0.options
3003 }
3004 }
3005
3006 #[derive(Clone, Debug)]
3024 pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
3025
3026 impl DeleteConversation {
3027 pub(crate) fn new(
3028 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3029 ) -> Self {
3030 Self(RequestBuilder::new(stub))
3031 }
3032
3033 pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3035 mut self,
3036 v: V,
3037 ) -> Self {
3038 self.0.request = v.into();
3039 self
3040 }
3041
3042 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3044 self.0.options = v.into();
3045 self
3046 }
3047
3048 pub async fn send(self) -> Result<()> {
3050 (*self.0.stub)
3051 .delete_conversation(self.0.request, self.0.options)
3052 .await
3053 .map(gax::response::Response::into_body)
3054 }
3055
3056 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3060 self.0.request.name = v.into();
3061 self
3062 }
3063 }
3064
3065 #[doc(hidden)]
3066 impl gax::options::internal::RequestBuilder for DeleteConversation {
3067 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3068 &mut self.0.options
3069 }
3070 }
3071
3072 #[derive(Clone, Debug)]
3090 pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3091
3092 impl UpdateConversation {
3093 pub(crate) fn new(
3094 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3095 ) -> Self {
3096 Self(RequestBuilder::new(stub))
3097 }
3098
3099 pub fn with_request<V: Into<crate::model::UpdateConversationRequest>>(
3101 mut self,
3102 v: V,
3103 ) -> Self {
3104 self.0.request = v.into();
3105 self
3106 }
3107
3108 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3110 self.0.options = v.into();
3111 self
3112 }
3113
3114 pub async fn send(self) -> Result<crate::model::Conversation> {
3116 (*self.0.stub)
3117 .update_conversation(self.0.request, self.0.options)
3118 .await
3119 .map(gax::response::Response::into_body)
3120 }
3121
3122 pub fn set_conversation<T>(mut self, v: T) -> Self
3126 where
3127 T: std::convert::Into<crate::model::Conversation>,
3128 {
3129 self.0.request.conversation = std::option::Option::Some(v.into());
3130 self
3131 }
3132
3133 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3137 where
3138 T: std::convert::Into<crate::model::Conversation>,
3139 {
3140 self.0.request.conversation = v.map(|x| x.into());
3141 self
3142 }
3143
3144 pub fn set_update_mask<T>(mut self, v: T) -> Self
3146 where
3147 T: std::convert::Into<wkt::FieldMask>,
3148 {
3149 self.0.request.update_mask = std::option::Option::Some(v.into());
3150 self
3151 }
3152
3153 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3155 where
3156 T: std::convert::Into<wkt::FieldMask>,
3157 {
3158 self.0.request.update_mask = v.map(|x| x.into());
3159 self
3160 }
3161 }
3162
3163 #[doc(hidden)]
3164 impl gax::options::internal::RequestBuilder for UpdateConversation {
3165 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3166 &mut self.0.options
3167 }
3168 }
3169
3170 #[derive(Clone, Debug)]
3188 pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3189
3190 impl GetConversation {
3191 pub(crate) fn new(
3192 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3193 ) -> Self {
3194 Self(RequestBuilder::new(stub))
3195 }
3196
3197 pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3199 self.0.request = v.into();
3200 self
3201 }
3202
3203 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3205 self.0.options = v.into();
3206 self
3207 }
3208
3209 pub async fn send(self) -> Result<crate::model::Conversation> {
3211 (*self.0.stub)
3212 .get_conversation(self.0.request, self.0.options)
3213 .await
3214 .map(gax::response::Response::into_body)
3215 }
3216
3217 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3221 self.0.request.name = v.into();
3222 self
3223 }
3224 }
3225
3226 #[doc(hidden)]
3227 impl gax::options::internal::RequestBuilder for GetConversation {
3228 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3229 &mut self.0.options
3230 }
3231 }
3232
3233 #[derive(Clone, Debug)]
3255 pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3256
3257 impl ListConversations {
3258 pub(crate) fn new(
3259 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3260 ) -> Self {
3261 Self(RequestBuilder::new(stub))
3262 }
3263
3264 pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3266 mut self,
3267 v: V,
3268 ) -> Self {
3269 self.0.request = v.into();
3270 self
3271 }
3272
3273 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3275 self.0.options = v.into();
3276 self
3277 }
3278
3279 pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3281 (*self.0.stub)
3282 .list_conversations(self.0.request, self.0.options)
3283 .await
3284 .map(gax::response::Response::into_body)
3285 }
3286
3287 pub fn by_page(
3289 self,
3290 ) -> impl gax::paginator::Paginator<crate::model::ListConversationsResponse, gax::error::Error>
3291 {
3292 use std::clone::Clone;
3293 let token = self.0.request.page_token.clone();
3294 let execute = move |token: String| {
3295 let mut builder = self.clone();
3296 builder.0.request = builder.0.request.set_page_token(token);
3297 builder.send()
3298 };
3299 gax::paginator::internal::new_paginator(token, execute)
3300 }
3301
3302 pub fn by_item(
3304 self,
3305 ) -> impl gax::paginator::ItemPaginator<crate::model::ListConversationsResponse, gax::error::Error>
3306 {
3307 use gax::paginator::Paginator;
3308 self.by_page().items()
3309 }
3310
3311 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3315 self.0.request.parent = v.into();
3316 self
3317 }
3318
3319 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3321 self.0.request.page_size = v.into();
3322 self
3323 }
3324
3325 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3327 self.0.request.page_token = v.into();
3328 self
3329 }
3330
3331 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3333 self.0.request.filter = v.into();
3334 self
3335 }
3336
3337 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3339 self.0.request.order_by = v.into();
3340 self
3341 }
3342 }
3343
3344 #[doc(hidden)]
3345 impl gax::options::internal::RequestBuilder for ListConversations {
3346 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3347 &mut self.0.options
3348 }
3349 }
3350
3351 #[derive(Clone, Debug)]
3369 pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3370
3371 impl AnswerQuery {
3372 pub(crate) fn new(
3373 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3374 ) -> Self {
3375 Self(RequestBuilder::new(stub))
3376 }
3377
3378 pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3380 self.0.request = v.into();
3381 self
3382 }
3383
3384 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3386 self.0.options = v.into();
3387 self
3388 }
3389
3390 pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3392 (*self.0.stub)
3393 .answer_query(self.0.request, self.0.options)
3394 .await
3395 .map(gax::response::Response::into_body)
3396 }
3397
3398 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3402 self.0.request.serving_config = v.into();
3403 self
3404 }
3405
3406 pub fn set_query<T>(mut self, v: T) -> Self
3410 where
3411 T: std::convert::Into<crate::model::Query>,
3412 {
3413 self.0.request.query = std::option::Option::Some(v.into());
3414 self
3415 }
3416
3417 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3421 where
3422 T: std::convert::Into<crate::model::Query>,
3423 {
3424 self.0.request.query = v.map(|x| x.into());
3425 self
3426 }
3427
3428 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3430 self.0.request.session = v.into();
3431 self
3432 }
3433
3434 pub fn set_safety_spec<T>(mut self, v: T) -> Self
3436 where
3437 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3438 {
3439 self.0.request.safety_spec = std::option::Option::Some(v.into());
3440 self
3441 }
3442
3443 pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3445 where
3446 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3447 {
3448 self.0.request.safety_spec = v.map(|x| x.into());
3449 self
3450 }
3451
3452 pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3454 where
3455 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3456 {
3457 self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3458 self
3459 }
3460
3461 pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3463 where
3464 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3465 {
3466 self.0.request.related_questions_spec = v.map(|x| x.into());
3467 self
3468 }
3469
3470 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3472 where
3473 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3474 {
3475 self.0.request.grounding_spec = std::option::Option::Some(v.into());
3476 self
3477 }
3478
3479 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3481 where
3482 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3483 {
3484 self.0.request.grounding_spec = v.map(|x| x.into());
3485 self
3486 }
3487
3488 pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3490 where
3491 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3492 {
3493 self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3494 self
3495 }
3496
3497 pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3499 where
3500 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3501 {
3502 self.0.request.answer_generation_spec = v.map(|x| x.into());
3503 self
3504 }
3505
3506 pub fn set_search_spec<T>(mut self, v: T) -> Self
3508 where
3509 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3510 {
3511 self.0.request.search_spec = std::option::Option::Some(v.into());
3512 self
3513 }
3514
3515 pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3517 where
3518 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3519 {
3520 self.0.request.search_spec = v.map(|x| x.into());
3521 self
3522 }
3523
3524 pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3526 where
3527 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3528 {
3529 self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3530 self
3531 }
3532
3533 pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3535 where
3536 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3537 {
3538 self.0.request.query_understanding_spec = v.map(|x| x.into());
3539 self
3540 }
3541
3542 #[deprecated]
3544 pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3545 self.0.request.asynchronous_mode = v.into();
3546 self
3547 }
3548
3549 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3551 self.0.request.user_pseudo_id = v.into();
3552 self
3553 }
3554
3555 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3557 where
3558 T: std::iter::IntoIterator<Item = (K, V)>,
3559 K: std::convert::Into<std::string::String>,
3560 V: std::convert::Into<std::string::String>,
3561 {
3562 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3563 self
3564 }
3565
3566 pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3568 where
3569 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3570 {
3571 self.0.request.end_user_spec = std::option::Option::Some(v.into());
3572 self
3573 }
3574
3575 pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3577 where
3578 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3579 {
3580 self.0.request.end_user_spec = v.map(|x| x.into());
3581 self
3582 }
3583 }
3584
3585 #[doc(hidden)]
3586 impl gax::options::internal::RequestBuilder for AnswerQuery {
3587 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3588 &mut self.0.options
3589 }
3590 }
3591
3592 #[derive(Clone, Debug)]
3610 pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
3611
3612 impl GetAnswer {
3613 pub(crate) fn new(
3614 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3615 ) -> Self {
3616 Self(RequestBuilder::new(stub))
3617 }
3618
3619 pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
3621 self.0.request = v.into();
3622 self
3623 }
3624
3625 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3627 self.0.options = v.into();
3628 self
3629 }
3630
3631 pub async fn send(self) -> Result<crate::model::Answer> {
3633 (*self.0.stub)
3634 .get_answer(self.0.request, self.0.options)
3635 .await
3636 .map(gax::response::Response::into_body)
3637 }
3638
3639 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3643 self.0.request.name = v.into();
3644 self
3645 }
3646 }
3647
3648 #[doc(hidden)]
3649 impl gax::options::internal::RequestBuilder for GetAnswer {
3650 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3651 &mut self.0.options
3652 }
3653 }
3654
3655 #[derive(Clone, Debug)]
3673 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
3674
3675 impl CreateSession {
3676 pub(crate) fn new(
3677 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3678 ) -> Self {
3679 Self(RequestBuilder::new(stub))
3680 }
3681
3682 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
3684 self.0.request = v.into();
3685 self
3686 }
3687
3688 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3690 self.0.options = v.into();
3691 self
3692 }
3693
3694 pub async fn send(self) -> Result<crate::model::Session> {
3696 (*self.0.stub)
3697 .create_session(self.0.request, self.0.options)
3698 .await
3699 .map(gax::response::Response::into_body)
3700 }
3701
3702 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3706 self.0.request.parent = v.into();
3707 self
3708 }
3709
3710 pub fn set_session<T>(mut self, v: T) -> Self
3714 where
3715 T: std::convert::Into<crate::model::Session>,
3716 {
3717 self.0.request.session = std::option::Option::Some(v.into());
3718 self
3719 }
3720
3721 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3725 where
3726 T: std::convert::Into<crate::model::Session>,
3727 {
3728 self.0.request.session = v.map(|x| x.into());
3729 self
3730 }
3731 }
3732
3733 #[doc(hidden)]
3734 impl gax::options::internal::RequestBuilder for CreateSession {
3735 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3736 &mut self.0.options
3737 }
3738 }
3739
3740 #[derive(Clone, Debug)]
3758 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
3759
3760 impl DeleteSession {
3761 pub(crate) fn new(
3762 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3763 ) -> Self {
3764 Self(RequestBuilder::new(stub))
3765 }
3766
3767 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
3769 self.0.request = v.into();
3770 self
3771 }
3772
3773 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3775 self.0.options = v.into();
3776 self
3777 }
3778
3779 pub async fn send(self) -> Result<()> {
3781 (*self.0.stub)
3782 .delete_session(self.0.request, self.0.options)
3783 .await
3784 .map(gax::response::Response::into_body)
3785 }
3786
3787 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3791 self.0.request.name = v.into();
3792 self
3793 }
3794 }
3795
3796 #[doc(hidden)]
3797 impl gax::options::internal::RequestBuilder for DeleteSession {
3798 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3799 &mut self.0.options
3800 }
3801 }
3802
3803 #[derive(Clone, Debug)]
3821 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
3822
3823 impl UpdateSession {
3824 pub(crate) fn new(
3825 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3826 ) -> Self {
3827 Self(RequestBuilder::new(stub))
3828 }
3829
3830 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
3832 self.0.request = v.into();
3833 self
3834 }
3835
3836 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3838 self.0.options = v.into();
3839 self
3840 }
3841
3842 pub async fn send(self) -> Result<crate::model::Session> {
3844 (*self.0.stub)
3845 .update_session(self.0.request, self.0.options)
3846 .await
3847 .map(gax::response::Response::into_body)
3848 }
3849
3850 pub fn set_session<T>(mut self, v: T) -> Self
3854 where
3855 T: std::convert::Into<crate::model::Session>,
3856 {
3857 self.0.request.session = std::option::Option::Some(v.into());
3858 self
3859 }
3860
3861 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3865 where
3866 T: std::convert::Into<crate::model::Session>,
3867 {
3868 self.0.request.session = v.map(|x| x.into());
3869 self
3870 }
3871
3872 pub fn set_update_mask<T>(mut self, v: T) -> Self
3874 where
3875 T: std::convert::Into<wkt::FieldMask>,
3876 {
3877 self.0.request.update_mask = std::option::Option::Some(v.into());
3878 self
3879 }
3880
3881 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3883 where
3884 T: std::convert::Into<wkt::FieldMask>,
3885 {
3886 self.0.request.update_mask = v.map(|x| x.into());
3887 self
3888 }
3889 }
3890
3891 #[doc(hidden)]
3892 impl gax::options::internal::RequestBuilder for UpdateSession {
3893 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3894 &mut self.0.options
3895 }
3896 }
3897
3898 #[derive(Clone, Debug)]
3916 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
3917
3918 impl GetSession {
3919 pub(crate) fn new(
3920 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3921 ) -> Self {
3922 Self(RequestBuilder::new(stub))
3923 }
3924
3925 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
3927 self.0.request = v.into();
3928 self
3929 }
3930
3931 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3933 self.0.options = v.into();
3934 self
3935 }
3936
3937 pub async fn send(self) -> Result<crate::model::Session> {
3939 (*self.0.stub)
3940 .get_session(self.0.request, self.0.options)
3941 .await
3942 .map(gax::response::Response::into_body)
3943 }
3944
3945 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3949 self.0.request.name = v.into();
3950 self
3951 }
3952
3953 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
3955 self.0.request.include_answer_details = v.into();
3956 self
3957 }
3958 }
3959
3960 #[doc(hidden)]
3961 impl gax::options::internal::RequestBuilder for GetSession {
3962 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3963 &mut self.0.options
3964 }
3965 }
3966
3967 #[derive(Clone, Debug)]
3989 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
3990
3991 impl ListSessions {
3992 pub(crate) fn new(
3993 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3994 ) -> Self {
3995 Self(RequestBuilder::new(stub))
3996 }
3997
3998 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
4000 self.0.request = v.into();
4001 self
4002 }
4003
4004 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4006 self.0.options = v.into();
4007 self
4008 }
4009
4010 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
4012 (*self.0.stub)
4013 .list_sessions(self.0.request, self.0.options)
4014 .await
4015 .map(gax::response::Response::into_body)
4016 }
4017
4018 pub fn by_page(
4020 self,
4021 ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
4022 {
4023 use std::clone::Clone;
4024 let token = self.0.request.page_token.clone();
4025 let execute = move |token: String| {
4026 let mut builder = self.clone();
4027 builder.0.request = builder.0.request.set_page_token(token);
4028 builder.send()
4029 };
4030 gax::paginator::internal::new_paginator(token, execute)
4031 }
4032
4033 pub fn by_item(
4035 self,
4036 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
4037 {
4038 use gax::paginator::Paginator;
4039 self.by_page().items()
4040 }
4041
4042 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4046 self.0.request.parent = v.into();
4047 self
4048 }
4049
4050 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4052 self.0.request.page_size = v.into();
4053 self
4054 }
4055
4056 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4058 self.0.request.page_token = v.into();
4059 self
4060 }
4061
4062 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4064 self.0.request.filter = v.into();
4065 self
4066 }
4067
4068 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4070 self.0.request.order_by = v.into();
4071 self
4072 }
4073 }
4074
4075 #[doc(hidden)]
4076 impl gax::options::internal::RequestBuilder for ListSessions {
4077 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4078 &mut self.0.options
4079 }
4080 }
4081
4082 #[derive(Clone, Debug)]
4104 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4105
4106 impl ListOperations {
4107 pub(crate) fn new(
4108 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4109 ) -> Self {
4110 Self(RequestBuilder::new(stub))
4111 }
4112
4113 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4115 mut self,
4116 v: V,
4117 ) -> Self {
4118 self.0.request = v.into();
4119 self
4120 }
4121
4122 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4124 self.0.options = v.into();
4125 self
4126 }
4127
4128 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4130 (*self.0.stub)
4131 .list_operations(self.0.request, self.0.options)
4132 .await
4133 .map(gax::response::Response::into_body)
4134 }
4135
4136 pub fn by_page(
4138 self,
4139 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4140 {
4141 use std::clone::Clone;
4142 let token = self.0.request.page_token.clone();
4143 let execute = move |token: String| {
4144 let mut builder = self.clone();
4145 builder.0.request = builder.0.request.set_page_token(token);
4146 builder.send()
4147 };
4148 gax::paginator::internal::new_paginator(token, execute)
4149 }
4150
4151 pub fn by_item(
4153 self,
4154 ) -> impl gax::paginator::ItemPaginator<
4155 longrunning::model::ListOperationsResponse,
4156 gax::error::Error,
4157 > {
4158 use gax::paginator::Paginator;
4159 self.by_page().items()
4160 }
4161
4162 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4164 self.0.request.name = v.into();
4165 self
4166 }
4167
4168 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4170 self.0.request.filter = v.into();
4171 self
4172 }
4173
4174 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4176 self.0.request.page_size = v.into();
4177 self
4178 }
4179
4180 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4182 self.0.request.page_token = v.into();
4183 self
4184 }
4185
4186 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4188 self.0.request.return_partial_success = v.into();
4189 self
4190 }
4191 }
4192
4193 #[doc(hidden)]
4194 impl gax::options::internal::RequestBuilder for ListOperations {
4195 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4196 &mut self.0.options
4197 }
4198 }
4199
4200 #[derive(Clone, Debug)]
4218 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4219
4220 impl GetOperation {
4221 pub(crate) fn new(
4222 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4223 ) -> Self {
4224 Self(RequestBuilder::new(stub))
4225 }
4226
4227 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4229 mut self,
4230 v: V,
4231 ) -> Self {
4232 self.0.request = v.into();
4233 self
4234 }
4235
4236 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4238 self.0.options = v.into();
4239 self
4240 }
4241
4242 pub async fn send(self) -> Result<longrunning::model::Operation> {
4244 (*self.0.stub)
4245 .get_operation(self.0.request, self.0.options)
4246 .await
4247 .map(gax::response::Response::into_body)
4248 }
4249
4250 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4252 self.0.request.name = v.into();
4253 self
4254 }
4255 }
4256
4257 #[doc(hidden)]
4258 impl gax::options::internal::RequestBuilder for GetOperation {
4259 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4260 &mut self.0.options
4261 }
4262 }
4263
4264 #[derive(Clone, Debug)]
4282 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
4283
4284 impl CancelOperation {
4285 pub(crate) fn new(
4286 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4287 ) -> Self {
4288 Self(RequestBuilder::new(stub))
4289 }
4290
4291 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
4293 mut self,
4294 v: V,
4295 ) -> Self {
4296 self.0.request = v.into();
4297 self
4298 }
4299
4300 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4302 self.0.options = v.into();
4303 self
4304 }
4305
4306 pub async fn send(self) -> Result<()> {
4308 (*self.0.stub)
4309 .cancel_operation(self.0.request, self.0.options)
4310 .await
4311 .map(gax::response::Response::into_body)
4312 }
4313
4314 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4316 self.0.request.name = v.into();
4317 self
4318 }
4319 }
4320
4321 #[doc(hidden)]
4322 impl gax::options::internal::RequestBuilder for CancelOperation {
4323 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4324 &mut self.0.options
4325 }
4326 }
4327}
4328
4329#[cfg(feature = "data-store-service")]
4330#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4331pub mod data_store_service {
4332 use crate::Result;
4333
4334 pub type ClientBuilder =
4348 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4349
4350 pub(crate) mod client {
4351 use super::super::super::client::DataStoreService;
4352 pub struct Factory;
4353 impl gax::client_builder::internal::ClientFactory for Factory {
4354 type Client = DataStoreService;
4355 type Credentials = gaxi::options::Credentials;
4356 async fn build(
4357 self,
4358 config: gaxi::options::ClientConfig,
4359 ) -> gax::client_builder::Result<Self::Client> {
4360 Self::Client::new(config).await
4361 }
4362 }
4363 }
4364
4365 #[derive(Clone, Debug)]
4367 pub(crate) struct RequestBuilder<R: std::default::Default> {
4368 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4369 request: R,
4370 options: gax::options::RequestOptions,
4371 }
4372
4373 impl<R> RequestBuilder<R>
4374 where
4375 R: std::default::Default,
4376 {
4377 pub(crate) fn new(
4378 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4379 ) -> Self {
4380 Self {
4381 stub,
4382 request: R::default(),
4383 options: gax::options::RequestOptions::default(),
4384 }
4385 }
4386 }
4387
4388 #[derive(Clone, Debug)]
4407 pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4408
4409 impl CreateDataStore {
4410 pub(crate) fn new(
4411 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4412 ) -> Self {
4413 Self(RequestBuilder::new(stub))
4414 }
4415
4416 pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4418 self.0.request = v.into();
4419 self
4420 }
4421
4422 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4424 self.0.options = v.into();
4425 self
4426 }
4427
4428 pub async fn send(self) -> Result<longrunning::model::Operation> {
4435 (*self.0.stub)
4436 .create_data_store(self.0.request, self.0.options)
4437 .await
4438 .map(gax::response::Response::into_body)
4439 }
4440
4441 pub fn poller(
4443 self,
4444 ) -> impl lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4445 {
4446 type Operation = lro::internal::Operation<
4447 crate::model::DataStore,
4448 crate::model::CreateDataStoreMetadata,
4449 >;
4450 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4451 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4452
4453 let stub = self.0.stub.clone();
4454 let mut options = self.0.options.clone();
4455 options.set_retry_policy(gax::retry_policy::NeverRetry);
4456 let query = move |name| {
4457 let stub = stub.clone();
4458 let options = options.clone();
4459 async {
4460 let op = GetOperation::new(stub)
4461 .set_name(name)
4462 .with_options(options)
4463 .send()
4464 .await?;
4465 Ok(Operation::new(op))
4466 }
4467 };
4468
4469 let start = move || async {
4470 let op = self.send().await?;
4471 Ok(Operation::new(op))
4472 };
4473
4474 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4475 }
4476
4477 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4481 self.0.request.parent = v.into();
4482 self
4483 }
4484
4485 pub fn set_data_store<T>(mut self, v: T) -> Self
4489 where
4490 T: std::convert::Into<crate::model::DataStore>,
4491 {
4492 self.0.request.data_store = std::option::Option::Some(v.into());
4493 self
4494 }
4495
4496 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4500 where
4501 T: std::convert::Into<crate::model::DataStore>,
4502 {
4503 self.0.request.data_store = v.map(|x| x.into());
4504 self
4505 }
4506
4507 pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4511 self.0.request.data_store_id = v.into();
4512 self
4513 }
4514
4515 pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
4517 self.0.request.create_advanced_site_search = v.into();
4518 self
4519 }
4520
4521 pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
4523 self.0.request.skip_default_schema_creation = v.into();
4524 self
4525 }
4526
4527 pub fn set_cmek_options<
4532 T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
4533 >(
4534 mut self,
4535 v: T,
4536 ) -> Self {
4537 self.0.request.cmek_options = v.into();
4538 self
4539 }
4540
4541 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
4547 mut self,
4548 v: T,
4549 ) -> Self {
4550 self.0.request = self.0.request.set_cmek_config_name(v);
4551 self
4552 }
4553
4554 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4560 self.0.request = self.0.request.set_disable_cmek(v);
4561 self
4562 }
4563 }
4564
4565 #[doc(hidden)]
4566 impl gax::options::internal::RequestBuilder for CreateDataStore {
4567 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4568 &mut self.0.options
4569 }
4570 }
4571
4572 #[derive(Clone, Debug)]
4590 pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
4591
4592 impl GetDataStore {
4593 pub(crate) fn new(
4594 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4595 ) -> Self {
4596 Self(RequestBuilder::new(stub))
4597 }
4598
4599 pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
4601 self.0.request = v.into();
4602 self
4603 }
4604
4605 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4607 self.0.options = v.into();
4608 self
4609 }
4610
4611 pub async fn send(self) -> Result<crate::model::DataStore> {
4613 (*self.0.stub)
4614 .get_data_store(self.0.request, self.0.options)
4615 .await
4616 .map(gax::response::Response::into_body)
4617 }
4618
4619 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4623 self.0.request.name = v.into();
4624 self
4625 }
4626 }
4627
4628 #[doc(hidden)]
4629 impl gax::options::internal::RequestBuilder for GetDataStore {
4630 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4631 &mut self.0.options
4632 }
4633 }
4634
4635 #[derive(Clone, Debug)]
4657 pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
4658
4659 impl ListDataStores {
4660 pub(crate) fn new(
4661 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4662 ) -> Self {
4663 Self(RequestBuilder::new(stub))
4664 }
4665
4666 pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
4668 self.0.request = v.into();
4669 self
4670 }
4671
4672 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4674 self.0.options = v.into();
4675 self
4676 }
4677
4678 pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
4680 (*self.0.stub)
4681 .list_data_stores(self.0.request, self.0.options)
4682 .await
4683 .map(gax::response::Response::into_body)
4684 }
4685
4686 pub fn by_page(
4688 self,
4689 ) -> impl gax::paginator::Paginator<crate::model::ListDataStoresResponse, gax::error::Error>
4690 {
4691 use std::clone::Clone;
4692 let token = self.0.request.page_token.clone();
4693 let execute = move |token: String| {
4694 let mut builder = self.clone();
4695 builder.0.request = builder.0.request.set_page_token(token);
4696 builder.send()
4697 };
4698 gax::paginator::internal::new_paginator(token, execute)
4699 }
4700
4701 pub fn by_item(
4703 self,
4704 ) -> impl gax::paginator::ItemPaginator<crate::model::ListDataStoresResponse, gax::error::Error>
4705 {
4706 use gax::paginator::Paginator;
4707 self.by_page().items()
4708 }
4709
4710 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4714 self.0.request.parent = v.into();
4715 self
4716 }
4717
4718 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4720 self.0.request.page_size = v.into();
4721 self
4722 }
4723
4724 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4726 self.0.request.page_token = v.into();
4727 self
4728 }
4729
4730 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4732 self.0.request.filter = v.into();
4733 self
4734 }
4735 }
4736
4737 #[doc(hidden)]
4738 impl gax::options::internal::RequestBuilder for ListDataStores {
4739 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4740 &mut self.0.options
4741 }
4742 }
4743
4744 #[derive(Clone, Debug)]
4763 pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
4764
4765 impl DeleteDataStore {
4766 pub(crate) fn new(
4767 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4768 ) -> Self {
4769 Self(RequestBuilder::new(stub))
4770 }
4771
4772 pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
4774 self.0.request = v.into();
4775 self
4776 }
4777
4778 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4780 self.0.options = v.into();
4781 self
4782 }
4783
4784 pub async fn send(self) -> Result<longrunning::model::Operation> {
4791 (*self.0.stub)
4792 .delete_data_store(self.0.request, self.0.options)
4793 .await
4794 .map(gax::response::Response::into_body)
4795 }
4796
4797 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
4799 type Operation =
4800 lro::internal::Operation<wkt::Empty, crate::model::DeleteDataStoreMetadata>;
4801 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4802 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4803
4804 let stub = self.0.stub.clone();
4805 let mut options = self.0.options.clone();
4806 options.set_retry_policy(gax::retry_policy::NeverRetry);
4807 let query = move |name| {
4808 let stub = stub.clone();
4809 let options = options.clone();
4810 async {
4811 let op = GetOperation::new(stub)
4812 .set_name(name)
4813 .with_options(options)
4814 .send()
4815 .await?;
4816 Ok(Operation::new(op))
4817 }
4818 };
4819
4820 let start = move || async {
4821 let op = self.send().await?;
4822 Ok(Operation::new(op))
4823 };
4824
4825 lro::internal::new_unit_response_poller(
4826 polling_error_policy,
4827 polling_backoff_policy,
4828 start,
4829 query,
4830 )
4831 }
4832
4833 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4837 self.0.request.name = v.into();
4838 self
4839 }
4840 }
4841
4842 #[doc(hidden)]
4843 impl gax::options::internal::RequestBuilder for DeleteDataStore {
4844 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4845 &mut self.0.options
4846 }
4847 }
4848
4849 #[derive(Clone, Debug)]
4867 pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
4868
4869 impl UpdateDataStore {
4870 pub(crate) fn new(
4871 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4872 ) -> Self {
4873 Self(RequestBuilder::new(stub))
4874 }
4875
4876 pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
4878 self.0.request = v.into();
4879 self
4880 }
4881
4882 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4884 self.0.options = v.into();
4885 self
4886 }
4887
4888 pub async fn send(self) -> Result<crate::model::DataStore> {
4890 (*self.0.stub)
4891 .update_data_store(self.0.request, self.0.options)
4892 .await
4893 .map(gax::response::Response::into_body)
4894 }
4895
4896 pub fn set_data_store<T>(mut self, v: T) -> Self
4900 where
4901 T: std::convert::Into<crate::model::DataStore>,
4902 {
4903 self.0.request.data_store = std::option::Option::Some(v.into());
4904 self
4905 }
4906
4907 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4911 where
4912 T: std::convert::Into<crate::model::DataStore>,
4913 {
4914 self.0.request.data_store = v.map(|x| x.into());
4915 self
4916 }
4917
4918 pub fn set_update_mask<T>(mut self, v: T) -> Self
4920 where
4921 T: std::convert::Into<wkt::FieldMask>,
4922 {
4923 self.0.request.update_mask = std::option::Option::Some(v.into());
4924 self
4925 }
4926
4927 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4929 where
4930 T: std::convert::Into<wkt::FieldMask>,
4931 {
4932 self.0.request.update_mask = v.map(|x| x.into());
4933 self
4934 }
4935 }
4936
4937 #[doc(hidden)]
4938 impl gax::options::internal::RequestBuilder for UpdateDataStore {
4939 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4940 &mut self.0.options
4941 }
4942 }
4943
4944 #[derive(Clone, Debug)]
4966 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4967
4968 impl ListOperations {
4969 pub(crate) fn new(
4970 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4971 ) -> Self {
4972 Self(RequestBuilder::new(stub))
4973 }
4974
4975 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4977 mut self,
4978 v: V,
4979 ) -> Self {
4980 self.0.request = v.into();
4981 self
4982 }
4983
4984 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4986 self.0.options = v.into();
4987 self
4988 }
4989
4990 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4992 (*self.0.stub)
4993 .list_operations(self.0.request, self.0.options)
4994 .await
4995 .map(gax::response::Response::into_body)
4996 }
4997
4998 pub fn by_page(
5000 self,
5001 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
5002 {
5003 use std::clone::Clone;
5004 let token = self.0.request.page_token.clone();
5005 let execute = move |token: String| {
5006 let mut builder = self.clone();
5007 builder.0.request = builder.0.request.set_page_token(token);
5008 builder.send()
5009 };
5010 gax::paginator::internal::new_paginator(token, execute)
5011 }
5012
5013 pub fn by_item(
5015 self,
5016 ) -> impl gax::paginator::ItemPaginator<
5017 longrunning::model::ListOperationsResponse,
5018 gax::error::Error,
5019 > {
5020 use gax::paginator::Paginator;
5021 self.by_page().items()
5022 }
5023
5024 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5026 self.0.request.name = v.into();
5027 self
5028 }
5029
5030 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5032 self.0.request.filter = v.into();
5033 self
5034 }
5035
5036 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5038 self.0.request.page_size = v.into();
5039 self
5040 }
5041
5042 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5044 self.0.request.page_token = v.into();
5045 self
5046 }
5047
5048 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5050 self.0.request.return_partial_success = v.into();
5051 self
5052 }
5053 }
5054
5055 #[doc(hidden)]
5056 impl gax::options::internal::RequestBuilder for ListOperations {
5057 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5058 &mut self.0.options
5059 }
5060 }
5061
5062 #[derive(Clone, Debug)]
5080 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5081
5082 impl GetOperation {
5083 pub(crate) fn new(
5084 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5085 ) -> Self {
5086 Self(RequestBuilder::new(stub))
5087 }
5088
5089 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5091 mut self,
5092 v: V,
5093 ) -> Self {
5094 self.0.request = v.into();
5095 self
5096 }
5097
5098 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5100 self.0.options = v.into();
5101 self
5102 }
5103
5104 pub async fn send(self) -> Result<longrunning::model::Operation> {
5106 (*self.0.stub)
5107 .get_operation(self.0.request, self.0.options)
5108 .await
5109 .map(gax::response::Response::into_body)
5110 }
5111
5112 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5114 self.0.request.name = v.into();
5115 self
5116 }
5117 }
5118
5119 #[doc(hidden)]
5120 impl gax::options::internal::RequestBuilder for GetOperation {
5121 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5122 &mut self.0.options
5123 }
5124 }
5125
5126 #[derive(Clone, Debug)]
5144 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5145
5146 impl CancelOperation {
5147 pub(crate) fn new(
5148 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5149 ) -> Self {
5150 Self(RequestBuilder::new(stub))
5151 }
5152
5153 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5155 mut self,
5156 v: V,
5157 ) -> Self {
5158 self.0.request = v.into();
5159 self
5160 }
5161
5162 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5164 self.0.options = v.into();
5165 self
5166 }
5167
5168 pub async fn send(self) -> Result<()> {
5170 (*self.0.stub)
5171 .cancel_operation(self.0.request, self.0.options)
5172 .await
5173 .map(gax::response::Response::into_body)
5174 }
5175
5176 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5178 self.0.request.name = v.into();
5179 self
5180 }
5181 }
5182
5183 #[doc(hidden)]
5184 impl gax::options::internal::RequestBuilder for CancelOperation {
5185 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5186 &mut self.0.options
5187 }
5188 }
5189}
5190
5191#[cfg(feature = "document-service")]
5192#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5193pub mod document_service {
5194 use crate::Result;
5195
5196 pub type ClientBuilder =
5210 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5211
5212 pub(crate) mod client {
5213 use super::super::super::client::DocumentService;
5214 pub struct Factory;
5215 impl gax::client_builder::internal::ClientFactory for Factory {
5216 type Client = DocumentService;
5217 type Credentials = gaxi::options::Credentials;
5218 async fn build(
5219 self,
5220 config: gaxi::options::ClientConfig,
5221 ) -> gax::client_builder::Result<Self::Client> {
5222 Self::Client::new(config).await
5223 }
5224 }
5225 }
5226
5227 #[derive(Clone, Debug)]
5229 pub(crate) struct RequestBuilder<R: std::default::Default> {
5230 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5231 request: R,
5232 options: gax::options::RequestOptions,
5233 }
5234
5235 impl<R> RequestBuilder<R>
5236 where
5237 R: std::default::Default,
5238 {
5239 pub(crate) fn new(
5240 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5241 ) -> Self {
5242 Self {
5243 stub,
5244 request: R::default(),
5245 options: gax::options::RequestOptions::default(),
5246 }
5247 }
5248 }
5249
5250 #[derive(Clone, Debug)]
5268 pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5269
5270 impl GetDocument {
5271 pub(crate) fn new(
5272 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5273 ) -> Self {
5274 Self(RequestBuilder::new(stub))
5275 }
5276
5277 pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5279 self.0.request = v.into();
5280 self
5281 }
5282
5283 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5285 self.0.options = v.into();
5286 self
5287 }
5288
5289 pub async fn send(self) -> Result<crate::model::Document> {
5291 (*self.0.stub)
5292 .get_document(self.0.request, self.0.options)
5293 .await
5294 .map(gax::response::Response::into_body)
5295 }
5296
5297 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5301 self.0.request.name = v.into();
5302 self
5303 }
5304 }
5305
5306 #[doc(hidden)]
5307 impl gax::options::internal::RequestBuilder for GetDocument {
5308 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5309 &mut self.0.options
5310 }
5311 }
5312
5313 #[derive(Clone, Debug)]
5335 pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5336
5337 impl ListDocuments {
5338 pub(crate) fn new(
5339 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5340 ) -> Self {
5341 Self(RequestBuilder::new(stub))
5342 }
5343
5344 pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5346 self.0.request = v.into();
5347 self
5348 }
5349
5350 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5352 self.0.options = v.into();
5353 self
5354 }
5355
5356 pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5358 (*self.0.stub)
5359 .list_documents(self.0.request, self.0.options)
5360 .await
5361 .map(gax::response::Response::into_body)
5362 }
5363
5364 pub fn by_page(
5366 self,
5367 ) -> impl gax::paginator::Paginator<crate::model::ListDocumentsResponse, gax::error::Error>
5368 {
5369 use std::clone::Clone;
5370 let token = self.0.request.page_token.clone();
5371 let execute = move |token: String| {
5372 let mut builder = self.clone();
5373 builder.0.request = builder.0.request.set_page_token(token);
5374 builder.send()
5375 };
5376 gax::paginator::internal::new_paginator(token, execute)
5377 }
5378
5379 pub fn by_item(
5381 self,
5382 ) -> impl gax::paginator::ItemPaginator<crate::model::ListDocumentsResponse, gax::error::Error>
5383 {
5384 use gax::paginator::Paginator;
5385 self.by_page().items()
5386 }
5387
5388 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5392 self.0.request.parent = v.into();
5393 self
5394 }
5395
5396 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5398 self.0.request.page_size = v.into();
5399 self
5400 }
5401
5402 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5404 self.0.request.page_token = v.into();
5405 self
5406 }
5407 }
5408
5409 #[doc(hidden)]
5410 impl gax::options::internal::RequestBuilder for ListDocuments {
5411 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5412 &mut self.0.options
5413 }
5414 }
5415
5416 #[derive(Clone, Debug)]
5434 pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5435
5436 impl CreateDocument {
5437 pub(crate) fn new(
5438 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5439 ) -> Self {
5440 Self(RequestBuilder::new(stub))
5441 }
5442
5443 pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5445 self.0.request = v.into();
5446 self
5447 }
5448
5449 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5451 self.0.options = v.into();
5452 self
5453 }
5454
5455 pub async fn send(self) -> Result<crate::model::Document> {
5457 (*self.0.stub)
5458 .create_document(self.0.request, self.0.options)
5459 .await
5460 .map(gax::response::Response::into_body)
5461 }
5462
5463 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5467 self.0.request.parent = v.into();
5468 self
5469 }
5470
5471 pub fn set_document<T>(mut self, v: T) -> Self
5475 where
5476 T: std::convert::Into<crate::model::Document>,
5477 {
5478 self.0.request.document = std::option::Option::Some(v.into());
5479 self
5480 }
5481
5482 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5486 where
5487 T: std::convert::Into<crate::model::Document>,
5488 {
5489 self.0.request.document = v.map(|x| x.into());
5490 self
5491 }
5492
5493 pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5497 self.0.request.document_id = v.into();
5498 self
5499 }
5500 }
5501
5502 #[doc(hidden)]
5503 impl gax::options::internal::RequestBuilder for CreateDocument {
5504 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5505 &mut self.0.options
5506 }
5507 }
5508
5509 #[derive(Clone, Debug)]
5527 pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
5528
5529 impl UpdateDocument {
5530 pub(crate) fn new(
5531 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5532 ) -> Self {
5533 Self(RequestBuilder::new(stub))
5534 }
5535
5536 pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
5538 self.0.request = v.into();
5539 self
5540 }
5541
5542 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5544 self.0.options = v.into();
5545 self
5546 }
5547
5548 pub async fn send(self) -> Result<crate::model::Document> {
5550 (*self.0.stub)
5551 .update_document(self.0.request, self.0.options)
5552 .await
5553 .map(gax::response::Response::into_body)
5554 }
5555
5556 pub fn set_document<T>(mut self, v: T) -> Self
5560 where
5561 T: std::convert::Into<crate::model::Document>,
5562 {
5563 self.0.request.document = std::option::Option::Some(v.into());
5564 self
5565 }
5566
5567 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5571 where
5572 T: std::convert::Into<crate::model::Document>,
5573 {
5574 self.0.request.document = v.map(|x| x.into());
5575 self
5576 }
5577
5578 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5580 self.0.request.allow_missing = v.into();
5581 self
5582 }
5583
5584 pub fn set_update_mask<T>(mut self, v: T) -> Self
5586 where
5587 T: std::convert::Into<wkt::FieldMask>,
5588 {
5589 self.0.request.update_mask = std::option::Option::Some(v.into());
5590 self
5591 }
5592
5593 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5595 where
5596 T: std::convert::Into<wkt::FieldMask>,
5597 {
5598 self.0.request.update_mask = v.map(|x| x.into());
5599 self
5600 }
5601 }
5602
5603 #[doc(hidden)]
5604 impl gax::options::internal::RequestBuilder for UpdateDocument {
5605 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5606 &mut self.0.options
5607 }
5608 }
5609
5610 #[derive(Clone, Debug)]
5628 pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
5629
5630 impl DeleteDocument {
5631 pub(crate) fn new(
5632 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5633 ) -> Self {
5634 Self(RequestBuilder::new(stub))
5635 }
5636
5637 pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
5639 self.0.request = v.into();
5640 self
5641 }
5642
5643 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5645 self.0.options = v.into();
5646 self
5647 }
5648
5649 pub async fn send(self) -> Result<()> {
5651 (*self.0.stub)
5652 .delete_document(self.0.request, self.0.options)
5653 .await
5654 .map(gax::response::Response::into_body)
5655 }
5656
5657 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5661 self.0.request.name = v.into();
5662 self
5663 }
5664 }
5665
5666 #[doc(hidden)]
5667 impl gax::options::internal::RequestBuilder for DeleteDocument {
5668 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5669 &mut self.0.options
5670 }
5671 }
5672
5673 #[derive(Clone, Debug)]
5692 pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
5693
5694 impl ImportDocuments {
5695 pub(crate) fn new(
5696 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5697 ) -> Self {
5698 Self(RequestBuilder::new(stub))
5699 }
5700
5701 pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
5703 self.0.request = v.into();
5704 self
5705 }
5706
5707 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5709 self.0.options = v.into();
5710 self
5711 }
5712
5713 pub async fn send(self) -> Result<longrunning::model::Operation> {
5720 (*self.0.stub)
5721 .import_documents(self.0.request, self.0.options)
5722 .await
5723 .map(gax::response::Response::into_body)
5724 }
5725
5726 pub fn poller(
5728 self,
5729 ) -> impl lro::Poller<crate::model::ImportDocumentsResponse, crate::model::ImportDocumentsMetadata>
5730 {
5731 type Operation = lro::internal::Operation<
5732 crate::model::ImportDocumentsResponse,
5733 crate::model::ImportDocumentsMetadata,
5734 >;
5735 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5736 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5737
5738 let stub = self.0.stub.clone();
5739 let mut options = self.0.options.clone();
5740 options.set_retry_policy(gax::retry_policy::NeverRetry);
5741 let query = move |name| {
5742 let stub = stub.clone();
5743 let options = options.clone();
5744 async {
5745 let op = GetOperation::new(stub)
5746 .set_name(name)
5747 .with_options(options)
5748 .send()
5749 .await?;
5750 Ok(Operation::new(op))
5751 }
5752 };
5753
5754 let start = move || async {
5755 let op = self.send().await?;
5756 Ok(Operation::new(op))
5757 };
5758
5759 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5760 }
5761
5762 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5766 self.0.request.parent = v.into();
5767 self
5768 }
5769
5770 pub fn set_error_config<T>(mut self, v: T) -> Self
5772 where
5773 T: std::convert::Into<crate::model::ImportErrorConfig>,
5774 {
5775 self.0.request.error_config = std::option::Option::Some(v.into());
5776 self
5777 }
5778
5779 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
5781 where
5782 T: std::convert::Into<crate::model::ImportErrorConfig>,
5783 {
5784 self.0.request.error_config = v.map(|x| x.into());
5785 self
5786 }
5787
5788 pub fn set_reconciliation_mode<
5790 T: Into<crate::model::import_documents_request::ReconciliationMode>,
5791 >(
5792 mut self,
5793 v: T,
5794 ) -> Self {
5795 self.0.request.reconciliation_mode = v.into();
5796 self
5797 }
5798
5799 pub fn set_update_mask<T>(mut self, v: T) -> Self
5801 where
5802 T: std::convert::Into<wkt::FieldMask>,
5803 {
5804 self.0.request.update_mask = std::option::Option::Some(v.into());
5805 self
5806 }
5807
5808 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5810 where
5811 T: std::convert::Into<wkt::FieldMask>,
5812 {
5813 self.0.request.update_mask = v.map(|x| x.into());
5814 self
5815 }
5816
5817 pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
5819 self.0.request.auto_generate_ids = v.into();
5820 self
5821 }
5822
5823 pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
5825 self.0.request.id_field = v.into();
5826 self
5827 }
5828
5829 pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
5831 self.0.request.force_refresh_content = v.into();
5832 self
5833 }
5834
5835 pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
5840 mut self,
5841 v: T,
5842 ) -> Self {
5843 self.0.request.source = v.into();
5844 self
5845 }
5846
5847 pub fn set_inline_source<
5853 T: std::convert::Into<
5854 std::boxed::Box<crate::model::import_documents_request::InlineSource>,
5855 >,
5856 >(
5857 mut self,
5858 v: T,
5859 ) -> Self {
5860 self.0.request = self.0.request.set_inline_source(v);
5861 self
5862 }
5863
5864 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
5870 mut self,
5871 v: T,
5872 ) -> Self {
5873 self.0.request = self.0.request.set_gcs_source(v);
5874 self
5875 }
5876
5877 pub fn set_bigquery_source<
5883 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
5884 >(
5885 mut self,
5886 v: T,
5887 ) -> Self {
5888 self.0.request = self.0.request.set_bigquery_source(v);
5889 self
5890 }
5891
5892 pub fn set_fhir_store_source<
5898 T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
5899 >(
5900 mut self,
5901 v: T,
5902 ) -> Self {
5903 self.0.request = self.0.request.set_fhir_store_source(v);
5904 self
5905 }
5906
5907 pub fn set_spanner_source<
5913 T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
5914 >(
5915 mut self,
5916 v: T,
5917 ) -> Self {
5918 self.0.request = self.0.request.set_spanner_source(v);
5919 self
5920 }
5921
5922 pub fn set_cloud_sql_source<
5928 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
5929 >(
5930 mut self,
5931 v: T,
5932 ) -> Self {
5933 self.0.request = self.0.request.set_cloud_sql_source(v);
5934 self
5935 }
5936
5937 pub fn set_firestore_source<
5943 T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
5944 >(
5945 mut self,
5946 v: T,
5947 ) -> Self {
5948 self.0.request = self.0.request.set_firestore_source(v);
5949 self
5950 }
5951
5952 pub fn set_alloy_db_source<
5958 T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
5959 >(
5960 mut self,
5961 v: T,
5962 ) -> Self {
5963 self.0.request = self.0.request.set_alloy_db_source(v);
5964 self
5965 }
5966
5967 pub fn set_bigtable_source<
5973 T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
5974 >(
5975 mut self,
5976 v: T,
5977 ) -> Self {
5978 self.0.request = self.0.request.set_bigtable_source(v);
5979 self
5980 }
5981 }
5982
5983 #[doc(hidden)]
5984 impl gax::options::internal::RequestBuilder for ImportDocuments {
5985 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5986 &mut self.0.options
5987 }
5988 }
5989
5990 #[derive(Clone, Debug)]
6009 pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
6010
6011 impl PurgeDocuments {
6012 pub(crate) fn new(
6013 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6014 ) -> Self {
6015 Self(RequestBuilder::new(stub))
6016 }
6017
6018 pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
6020 self.0.request = v.into();
6021 self
6022 }
6023
6024 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6026 self.0.options = v.into();
6027 self
6028 }
6029
6030 pub async fn send(self) -> Result<longrunning::model::Operation> {
6037 (*self.0.stub)
6038 .purge_documents(self.0.request, self.0.options)
6039 .await
6040 .map(gax::response::Response::into_body)
6041 }
6042
6043 pub fn poller(
6045 self,
6046 ) -> impl lro::Poller<crate::model::PurgeDocumentsResponse, crate::model::PurgeDocumentsMetadata>
6047 {
6048 type Operation = lro::internal::Operation<
6049 crate::model::PurgeDocumentsResponse,
6050 crate::model::PurgeDocumentsMetadata,
6051 >;
6052 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6053 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6054
6055 let stub = self.0.stub.clone();
6056 let mut options = self.0.options.clone();
6057 options.set_retry_policy(gax::retry_policy::NeverRetry);
6058 let query = move |name| {
6059 let stub = stub.clone();
6060 let options = options.clone();
6061 async {
6062 let op = GetOperation::new(stub)
6063 .set_name(name)
6064 .with_options(options)
6065 .send()
6066 .await?;
6067 Ok(Operation::new(op))
6068 }
6069 };
6070
6071 let start = move || async {
6072 let op = self.send().await?;
6073 Ok(Operation::new(op))
6074 };
6075
6076 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6077 }
6078
6079 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6083 self.0.request.parent = v.into();
6084 self
6085 }
6086
6087 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6091 self.0.request.filter = v.into();
6092 self
6093 }
6094
6095 pub fn set_error_config<T>(mut self, v: T) -> Self
6097 where
6098 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6099 {
6100 self.0.request.error_config = std::option::Option::Some(v.into());
6101 self
6102 }
6103
6104 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6106 where
6107 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6108 {
6109 self.0.request.error_config = v.map(|x| x.into());
6110 self
6111 }
6112
6113 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6115 self.0.request.force = v.into();
6116 self
6117 }
6118
6119 pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6124 mut self,
6125 v: T,
6126 ) -> Self {
6127 self.0.request.source = v.into();
6128 self
6129 }
6130
6131 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6137 mut self,
6138 v: T,
6139 ) -> Self {
6140 self.0.request = self.0.request.set_gcs_source(v);
6141 self
6142 }
6143
6144 pub fn set_inline_source<
6150 T: std::convert::Into<
6151 std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6152 >,
6153 >(
6154 mut self,
6155 v: T,
6156 ) -> Self {
6157 self.0.request = self.0.request.set_inline_source(v);
6158 self
6159 }
6160 }
6161
6162 #[doc(hidden)]
6163 impl gax::options::internal::RequestBuilder for PurgeDocuments {
6164 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6165 &mut self.0.options
6166 }
6167 }
6168
6169 #[derive(Clone, Debug)]
6187 pub struct BatchGetDocumentsMetadata(
6188 RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6189 );
6190
6191 impl BatchGetDocumentsMetadata {
6192 pub(crate) fn new(
6193 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6194 ) -> Self {
6195 Self(RequestBuilder::new(stub))
6196 }
6197
6198 pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6200 mut self,
6201 v: V,
6202 ) -> Self {
6203 self.0.request = v.into();
6204 self
6205 }
6206
6207 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6209 self.0.options = v.into();
6210 self
6211 }
6212
6213 pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6215 (*self.0.stub)
6216 .batch_get_documents_metadata(self.0.request, self.0.options)
6217 .await
6218 .map(gax::response::Response::into_body)
6219 }
6220
6221 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6225 self.0.request.parent = v.into();
6226 self
6227 }
6228
6229 pub fn set_matcher<T>(mut self, v: T) -> Self
6233 where
6234 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6235 {
6236 self.0.request.matcher = std::option::Option::Some(v.into());
6237 self
6238 }
6239
6240 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6244 where
6245 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6246 {
6247 self.0.request.matcher = v.map(|x| x.into());
6248 self
6249 }
6250 }
6251
6252 #[doc(hidden)]
6253 impl gax::options::internal::RequestBuilder for BatchGetDocumentsMetadata {
6254 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6255 &mut self.0.options
6256 }
6257 }
6258
6259 #[derive(Clone, Debug)]
6281 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6282
6283 impl ListOperations {
6284 pub(crate) fn new(
6285 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6286 ) -> Self {
6287 Self(RequestBuilder::new(stub))
6288 }
6289
6290 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6292 mut self,
6293 v: V,
6294 ) -> Self {
6295 self.0.request = v.into();
6296 self
6297 }
6298
6299 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6301 self.0.options = v.into();
6302 self
6303 }
6304
6305 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6307 (*self.0.stub)
6308 .list_operations(self.0.request, self.0.options)
6309 .await
6310 .map(gax::response::Response::into_body)
6311 }
6312
6313 pub fn by_page(
6315 self,
6316 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6317 {
6318 use std::clone::Clone;
6319 let token = self.0.request.page_token.clone();
6320 let execute = move |token: String| {
6321 let mut builder = self.clone();
6322 builder.0.request = builder.0.request.set_page_token(token);
6323 builder.send()
6324 };
6325 gax::paginator::internal::new_paginator(token, execute)
6326 }
6327
6328 pub fn by_item(
6330 self,
6331 ) -> impl gax::paginator::ItemPaginator<
6332 longrunning::model::ListOperationsResponse,
6333 gax::error::Error,
6334 > {
6335 use gax::paginator::Paginator;
6336 self.by_page().items()
6337 }
6338
6339 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6341 self.0.request.name = v.into();
6342 self
6343 }
6344
6345 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6347 self.0.request.filter = v.into();
6348 self
6349 }
6350
6351 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6353 self.0.request.page_size = v.into();
6354 self
6355 }
6356
6357 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6359 self.0.request.page_token = v.into();
6360 self
6361 }
6362
6363 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6365 self.0.request.return_partial_success = v.into();
6366 self
6367 }
6368 }
6369
6370 #[doc(hidden)]
6371 impl gax::options::internal::RequestBuilder for ListOperations {
6372 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6373 &mut self.0.options
6374 }
6375 }
6376
6377 #[derive(Clone, Debug)]
6395 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6396
6397 impl GetOperation {
6398 pub(crate) fn new(
6399 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6400 ) -> Self {
6401 Self(RequestBuilder::new(stub))
6402 }
6403
6404 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6406 mut self,
6407 v: V,
6408 ) -> Self {
6409 self.0.request = v.into();
6410 self
6411 }
6412
6413 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6415 self.0.options = v.into();
6416 self
6417 }
6418
6419 pub async fn send(self) -> Result<longrunning::model::Operation> {
6421 (*self.0.stub)
6422 .get_operation(self.0.request, self.0.options)
6423 .await
6424 .map(gax::response::Response::into_body)
6425 }
6426
6427 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6429 self.0.request.name = v.into();
6430 self
6431 }
6432 }
6433
6434 #[doc(hidden)]
6435 impl gax::options::internal::RequestBuilder for GetOperation {
6436 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6437 &mut self.0.options
6438 }
6439 }
6440
6441 #[derive(Clone, Debug)]
6459 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
6460
6461 impl CancelOperation {
6462 pub(crate) fn new(
6463 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6464 ) -> Self {
6465 Self(RequestBuilder::new(stub))
6466 }
6467
6468 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
6470 mut self,
6471 v: V,
6472 ) -> Self {
6473 self.0.request = v.into();
6474 self
6475 }
6476
6477 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6479 self.0.options = v.into();
6480 self
6481 }
6482
6483 pub async fn send(self) -> Result<()> {
6485 (*self.0.stub)
6486 .cancel_operation(self.0.request, self.0.options)
6487 .await
6488 .map(gax::response::Response::into_body)
6489 }
6490
6491 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6493 self.0.request.name = v.into();
6494 self
6495 }
6496 }
6497
6498 #[doc(hidden)]
6499 impl gax::options::internal::RequestBuilder for CancelOperation {
6500 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6501 &mut self.0.options
6502 }
6503 }
6504}
6505
6506#[cfg(feature = "engine-service")]
6507#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
6508pub mod engine_service {
6509 use crate::Result;
6510
6511 pub type ClientBuilder =
6525 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6526
6527 pub(crate) mod client {
6528 use super::super::super::client::EngineService;
6529 pub struct Factory;
6530 impl gax::client_builder::internal::ClientFactory for Factory {
6531 type Client = EngineService;
6532 type Credentials = gaxi::options::Credentials;
6533 async fn build(
6534 self,
6535 config: gaxi::options::ClientConfig,
6536 ) -> gax::client_builder::Result<Self::Client> {
6537 Self::Client::new(config).await
6538 }
6539 }
6540 }
6541
6542 #[derive(Clone, Debug)]
6544 pub(crate) struct RequestBuilder<R: std::default::Default> {
6545 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6546 request: R,
6547 options: gax::options::RequestOptions,
6548 }
6549
6550 impl<R> RequestBuilder<R>
6551 where
6552 R: std::default::Default,
6553 {
6554 pub(crate) fn new(
6555 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6556 ) -> Self {
6557 Self {
6558 stub,
6559 request: R::default(),
6560 options: gax::options::RequestOptions::default(),
6561 }
6562 }
6563 }
6564
6565 #[derive(Clone, Debug)]
6584 pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
6585
6586 impl CreateEngine {
6587 pub(crate) fn new(
6588 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6589 ) -> Self {
6590 Self(RequestBuilder::new(stub))
6591 }
6592
6593 pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
6595 self.0.request = v.into();
6596 self
6597 }
6598
6599 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6601 self.0.options = v.into();
6602 self
6603 }
6604
6605 pub async fn send(self) -> Result<longrunning::model::Operation> {
6612 (*self.0.stub)
6613 .create_engine(self.0.request, self.0.options)
6614 .await
6615 .map(gax::response::Response::into_body)
6616 }
6617
6618 pub fn poller(
6620 self,
6621 ) -> impl lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata> {
6622 type Operation =
6623 lro::internal::Operation<crate::model::Engine, crate::model::CreateEngineMetadata>;
6624 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6625 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6626
6627 let stub = self.0.stub.clone();
6628 let mut options = self.0.options.clone();
6629 options.set_retry_policy(gax::retry_policy::NeverRetry);
6630 let query = move |name| {
6631 let stub = stub.clone();
6632 let options = options.clone();
6633 async {
6634 let op = GetOperation::new(stub)
6635 .set_name(name)
6636 .with_options(options)
6637 .send()
6638 .await?;
6639 Ok(Operation::new(op))
6640 }
6641 };
6642
6643 let start = move || async {
6644 let op = self.send().await?;
6645 Ok(Operation::new(op))
6646 };
6647
6648 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6649 }
6650
6651 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6655 self.0.request.parent = v.into();
6656 self
6657 }
6658
6659 pub fn set_engine<T>(mut self, v: T) -> Self
6663 where
6664 T: std::convert::Into<crate::model::Engine>,
6665 {
6666 self.0.request.engine = std::option::Option::Some(v.into());
6667 self
6668 }
6669
6670 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6674 where
6675 T: std::convert::Into<crate::model::Engine>,
6676 {
6677 self.0.request.engine = v.map(|x| x.into());
6678 self
6679 }
6680
6681 pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6685 self.0.request.engine_id = v.into();
6686 self
6687 }
6688 }
6689
6690 #[doc(hidden)]
6691 impl gax::options::internal::RequestBuilder for CreateEngine {
6692 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6693 &mut self.0.options
6694 }
6695 }
6696
6697 #[derive(Clone, Debug)]
6716 pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
6717
6718 impl DeleteEngine {
6719 pub(crate) fn new(
6720 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6721 ) -> Self {
6722 Self(RequestBuilder::new(stub))
6723 }
6724
6725 pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
6727 self.0.request = v.into();
6728 self
6729 }
6730
6731 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6733 self.0.options = v.into();
6734 self
6735 }
6736
6737 pub async fn send(self) -> Result<longrunning::model::Operation> {
6744 (*self.0.stub)
6745 .delete_engine(self.0.request, self.0.options)
6746 .await
6747 .map(gax::response::Response::into_body)
6748 }
6749
6750 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteEngineMetadata> {
6752 type Operation =
6753 lro::internal::Operation<wkt::Empty, crate::model::DeleteEngineMetadata>;
6754 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6755 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6756
6757 let stub = self.0.stub.clone();
6758 let mut options = self.0.options.clone();
6759 options.set_retry_policy(gax::retry_policy::NeverRetry);
6760 let query = move |name| {
6761 let stub = stub.clone();
6762 let options = options.clone();
6763 async {
6764 let op = GetOperation::new(stub)
6765 .set_name(name)
6766 .with_options(options)
6767 .send()
6768 .await?;
6769 Ok(Operation::new(op))
6770 }
6771 };
6772
6773 let start = move || async {
6774 let op = self.send().await?;
6775 Ok(Operation::new(op))
6776 };
6777
6778 lro::internal::new_unit_response_poller(
6779 polling_error_policy,
6780 polling_backoff_policy,
6781 start,
6782 query,
6783 )
6784 }
6785
6786 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6790 self.0.request.name = v.into();
6791 self
6792 }
6793 }
6794
6795 #[doc(hidden)]
6796 impl gax::options::internal::RequestBuilder for DeleteEngine {
6797 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6798 &mut self.0.options
6799 }
6800 }
6801
6802 #[derive(Clone, Debug)]
6820 pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
6821
6822 impl UpdateEngine {
6823 pub(crate) fn new(
6824 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6825 ) -> Self {
6826 Self(RequestBuilder::new(stub))
6827 }
6828
6829 pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
6831 self.0.request = v.into();
6832 self
6833 }
6834
6835 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6837 self.0.options = v.into();
6838 self
6839 }
6840
6841 pub async fn send(self) -> Result<crate::model::Engine> {
6843 (*self.0.stub)
6844 .update_engine(self.0.request, self.0.options)
6845 .await
6846 .map(gax::response::Response::into_body)
6847 }
6848
6849 pub fn set_engine<T>(mut self, v: T) -> Self
6853 where
6854 T: std::convert::Into<crate::model::Engine>,
6855 {
6856 self.0.request.engine = std::option::Option::Some(v.into());
6857 self
6858 }
6859
6860 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6864 where
6865 T: std::convert::Into<crate::model::Engine>,
6866 {
6867 self.0.request.engine = v.map(|x| x.into());
6868 self
6869 }
6870
6871 pub fn set_update_mask<T>(mut self, v: T) -> Self
6873 where
6874 T: std::convert::Into<wkt::FieldMask>,
6875 {
6876 self.0.request.update_mask = std::option::Option::Some(v.into());
6877 self
6878 }
6879
6880 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6882 where
6883 T: std::convert::Into<wkt::FieldMask>,
6884 {
6885 self.0.request.update_mask = v.map(|x| x.into());
6886 self
6887 }
6888 }
6889
6890 #[doc(hidden)]
6891 impl gax::options::internal::RequestBuilder for UpdateEngine {
6892 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6893 &mut self.0.options
6894 }
6895 }
6896
6897 #[derive(Clone, Debug)]
6915 pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
6916
6917 impl GetEngine {
6918 pub(crate) fn new(
6919 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6920 ) -> Self {
6921 Self(RequestBuilder::new(stub))
6922 }
6923
6924 pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
6926 self.0.request = v.into();
6927 self
6928 }
6929
6930 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6932 self.0.options = v.into();
6933 self
6934 }
6935
6936 pub async fn send(self) -> Result<crate::model::Engine> {
6938 (*self.0.stub)
6939 .get_engine(self.0.request, self.0.options)
6940 .await
6941 .map(gax::response::Response::into_body)
6942 }
6943
6944 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6948 self.0.request.name = v.into();
6949 self
6950 }
6951 }
6952
6953 #[doc(hidden)]
6954 impl gax::options::internal::RequestBuilder for GetEngine {
6955 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6956 &mut self.0.options
6957 }
6958 }
6959
6960 #[derive(Clone, Debug)]
6982 pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
6983
6984 impl ListEngines {
6985 pub(crate) fn new(
6986 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6987 ) -> Self {
6988 Self(RequestBuilder::new(stub))
6989 }
6990
6991 pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
6993 self.0.request = v.into();
6994 self
6995 }
6996
6997 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6999 self.0.options = v.into();
7000 self
7001 }
7002
7003 pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
7005 (*self.0.stub)
7006 .list_engines(self.0.request, self.0.options)
7007 .await
7008 .map(gax::response::Response::into_body)
7009 }
7010
7011 pub fn by_page(
7013 self,
7014 ) -> impl gax::paginator::Paginator<crate::model::ListEnginesResponse, gax::error::Error>
7015 {
7016 use std::clone::Clone;
7017 let token = self.0.request.page_token.clone();
7018 let execute = move |token: String| {
7019 let mut builder = self.clone();
7020 builder.0.request = builder.0.request.set_page_token(token);
7021 builder.send()
7022 };
7023 gax::paginator::internal::new_paginator(token, execute)
7024 }
7025
7026 pub fn by_item(
7028 self,
7029 ) -> impl gax::paginator::ItemPaginator<crate::model::ListEnginesResponse, gax::error::Error>
7030 {
7031 use gax::paginator::Paginator;
7032 self.by_page().items()
7033 }
7034
7035 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7039 self.0.request.parent = v.into();
7040 self
7041 }
7042
7043 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7045 self.0.request.page_size = v.into();
7046 self
7047 }
7048
7049 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7051 self.0.request.page_token = v.into();
7052 self
7053 }
7054
7055 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7057 self.0.request.filter = v.into();
7058 self
7059 }
7060 }
7061
7062 #[doc(hidden)]
7063 impl gax::options::internal::RequestBuilder for ListEngines {
7064 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7065 &mut self.0.options
7066 }
7067 }
7068
7069 #[derive(Clone, Debug)]
7091 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7092
7093 impl ListOperations {
7094 pub(crate) fn new(
7095 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7096 ) -> Self {
7097 Self(RequestBuilder::new(stub))
7098 }
7099
7100 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7102 mut self,
7103 v: V,
7104 ) -> Self {
7105 self.0.request = v.into();
7106 self
7107 }
7108
7109 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7111 self.0.options = v.into();
7112 self
7113 }
7114
7115 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7117 (*self.0.stub)
7118 .list_operations(self.0.request, self.0.options)
7119 .await
7120 .map(gax::response::Response::into_body)
7121 }
7122
7123 pub fn by_page(
7125 self,
7126 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7127 {
7128 use std::clone::Clone;
7129 let token = self.0.request.page_token.clone();
7130 let execute = move |token: String| {
7131 let mut builder = self.clone();
7132 builder.0.request = builder.0.request.set_page_token(token);
7133 builder.send()
7134 };
7135 gax::paginator::internal::new_paginator(token, execute)
7136 }
7137
7138 pub fn by_item(
7140 self,
7141 ) -> impl gax::paginator::ItemPaginator<
7142 longrunning::model::ListOperationsResponse,
7143 gax::error::Error,
7144 > {
7145 use gax::paginator::Paginator;
7146 self.by_page().items()
7147 }
7148
7149 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7151 self.0.request.name = v.into();
7152 self
7153 }
7154
7155 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7157 self.0.request.filter = v.into();
7158 self
7159 }
7160
7161 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7163 self.0.request.page_size = v.into();
7164 self
7165 }
7166
7167 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7169 self.0.request.page_token = v.into();
7170 self
7171 }
7172
7173 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7175 self.0.request.return_partial_success = v.into();
7176 self
7177 }
7178 }
7179
7180 #[doc(hidden)]
7181 impl gax::options::internal::RequestBuilder for ListOperations {
7182 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7183 &mut self.0.options
7184 }
7185 }
7186
7187 #[derive(Clone, Debug)]
7205 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7206
7207 impl GetOperation {
7208 pub(crate) fn new(
7209 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7210 ) -> Self {
7211 Self(RequestBuilder::new(stub))
7212 }
7213
7214 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7216 mut self,
7217 v: V,
7218 ) -> Self {
7219 self.0.request = v.into();
7220 self
7221 }
7222
7223 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7225 self.0.options = v.into();
7226 self
7227 }
7228
7229 pub async fn send(self) -> Result<longrunning::model::Operation> {
7231 (*self.0.stub)
7232 .get_operation(self.0.request, self.0.options)
7233 .await
7234 .map(gax::response::Response::into_body)
7235 }
7236
7237 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7239 self.0.request.name = v.into();
7240 self
7241 }
7242 }
7243
7244 #[doc(hidden)]
7245 impl gax::options::internal::RequestBuilder for GetOperation {
7246 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7247 &mut self.0.options
7248 }
7249 }
7250
7251 #[derive(Clone, Debug)]
7269 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7270
7271 impl CancelOperation {
7272 pub(crate) fn new(
7273 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7274 ) -> Self {
7275 Self(RequestBuilder::new(stub))
7276 }
7277
7278 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7280 mut self,
7281 v: V,
7282 ) -> Self {
7283 self.0.request = v.into();
7284 self
7285 }
7286
7287 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7289 self.0.options = v.into();
7290 self
7291 }
7292
7293 pub async fn send(self) -> Result<()> {
7295 (*self.0.stub)
7296 .cancel_operation(self.0.request, self.0.options)
7297 .await
7298 .map(gax::response::Response::into_body)
7299 }
7300
7301 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7303 self.0.request.name = v.into();
7304 self
7305 }
7306 }
7307
7308 #[doc(hidden)]
7309 impl gax::options::internal::RequestBuilder for CancelOperation {
7310 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7311 &mut self.0.options
7312 }
7313 }
7314}
7315
7316#[cfg(feature = "grounded-generation-service")]
7317#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7318pub mod grounded_generation_service {
7319 use crate::Result;
7320
7321 pub type ClientBuilder =
7335 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7336
7337 pub(crate) mod client {
7338 use super::super::super::client::GroundedGenerationService;
7339 pub struct Factory;
7340 impl gax::client_builder::internal::ClientFactory for Factory {
7341 type Client = GroundedGenerationService;
7342 type Credentials = gaxi::options::Credentials;
7343 async fn build(
7344 self,
7345 config: gaxi::options::ClientConfig,
7346 ) -> gax::client_builder::Result<Self::Client> {
7347 Self::Client::new(config).await
7348 }
7349 }
7350 }
7351
7352 #[derive(Clone, Debug)]
7354 pub(crate) struct RequestBuilder<R: std::default::Default> {
7355 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7356 request: R,
7357 options: gax::options::RequestOptions,
7358 }
7359
7360 impl<R> RequestBuilder<R>
7361 where
7362 R: std::default::Default,
7363 {
7364 pub(crate) fn new(
7365 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7366 ) -> Self {
7367 Self {
7368 stub,
7369 request: R::default(),
7370 options: gax::options::RequestOptions::default(),
7371 }
7372 }
7373 }
7374
7375 #[derive(Clone, Debug)]
7393 pub struct GenerateGroundedContent(
7394 RequestBuilder<crate::model::GenerateGroundedContentRequest>,
7395 );
7396
7397 impl GenerateGroundedContent {
7398 pub(crate) fn new(
7399 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7400 ) -> Self {
7401 Self(RequestBuilder::new(stub))
7402 }
7403
7404 pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
7406 mut self,
7407 v: V,
7408 ) -> Self {
7409 self.0.request = v.into();
7410 self
7411 }
7412
7413 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7415 self.0.options = v.into();
7416 self
7417 }
7418
7419 pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
7421 (*self.0.stub)
7422 .generate_grounded_content(self.0.request, self.0.options)
7423 .await
7424 .map(gax::response::Response::into_body)
7425 }
7426
7427 pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7431 self.0.request.location = v.into();
7432 self
7433 }
7434
7435 pub fn set_system_instruction<T>(mut self, v: T) -> Self
7437 where
7438 T: std::convert::Into<crate::model::GroundedGenerationContent>,
7439 {
7440 self.0.request.system_instruction = std::option::Option::Some(v.into());
7441 self
7442 }
7443
7444 pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
7446 where
7447 T: std::convert::Into<crate::model::GroundedGenerationContent>,
7448 {
7449 self.0.request.system_instruction = v.map(|x| x.into());
7450 self
7451 }
7452
7453 pub fn set_contents<T, V>(mut self, v: T) -> Self
7455 where
7456 T: std::iter::IntoIterator<Item = V>,
7457 V: std::convert::Into<crate::model::GroundedGenerationContent>,
7458 {
7459 use std::iter::Iterator;
7460 self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
7461 self
7462 }
7463
7464 pub fn set_generation_spec<T>(mut self, v: T) -> Self
7466 where
7467 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7468 {
7469 self.0.request.generation_spec = std::option::Option::Some(v.into());
7470 self
7471 }
7472
7473 pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7475 where
7476 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7477 {
7478 self.0.request.generation_spec = v.map(|x| x.into());
7479 self
7480 }
7481
7482 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7484 where
7485 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7486 {
7487 self.0.request.grounding_spec = std::option::Option::Some(v.into());
7488 self
7489 }
7490
7491 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7493 where
7494 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7495 {
7496 self.0.request.grounding_spec = v.map(|x| x.into());
7497 self
7498 }
7499
7500 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7502 where
7503 T: std::iter::IntoIterator<Item = (K, V)>,
7504 K: std::convert::Into<std::string::String>,
7505 V: std::convert::Into<std::string::String>,
7506 {
7507 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7508 self
7509 }
7510 }
7511
7512 #[doc(hidden)]
7513 impl gax::options::internal::RequestBuilder for GenerateGroundedContent {
7514 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7515 &mut self.0.options
7516 }
7517 }
7518
7519 #[derive(Clone, Debug)]
7537 pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
7538
7539 impl CheckGrounding {
7540 pub(crate) fn new(
7541 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7542 ) -> Self {
7543 Self(RequestBuilder::new(stub))
7544 }
7545
7546 pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
7548 self.0.request = v.into();
7549 self
7550 }
7551
7552 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7554 self.0.options = v.into();
7555 self
7556 }
7557
7558 pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
7560 (*self.0.stub)
7561 .check_grounding(self.0.request, self.0.options)
7562 .await
7563 .map(gax::response::Response::into_body)
7564 }
7565
7566 pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7570 self.0.request.grounding_config = v.into();
7571 self
7572 }
7573
7574 pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
7576 self.0.request.answer_candidate = v.into();
7577 self
7578 }
7579
7580 pub fn set_facts<T, V>(mut self, v: T) -> Self
7582 where
7583 T: std::iter::IntoIterator<Item = V>,
7584 V: std::convert::Into<crate::model::GroundingFact>,
7585 {
7586 use std::iter::Iterator;
7587 self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
7588 self
7589 }
7590
7591 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7593 where
7594 T: std::convert::Into<crate::model::CheckGroundingSpec>,
7595 {
7596 self.0.request.grounding_spec = std::option::Option::Some(v.into());
7597 self
7598 }
7599
7600 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7602 where
7603 T: std::convert::Into<crate::model::CheckGroundingSpec>,
7604 {
7605 self.0.request.grounding_spec = v.map(|x| x.into());
7606 self
7607 }
7608
7609 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7611 where
7612 T: std::iter::IntoIterator<Item = (K, V)>,
7613 K: std::convert::Into<std::string::String>,
7614 V: std::convert::Into<std::string::String>,
7615 {
7616 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7617 self
7618 }
7619 }
7620
7621 #[doc(hidden)]
7622 impl gax::options::internal::RequestBuilder for CheckGrounding {
7623 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7624 &mut self.0.options
7625 }
7626 }
7627
7628 #[derive(Clone, Debug)]
7650 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7651
7652 impl ListOperations {
7653 pub(crate) fn new(
7654 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7655 ) -> Self {
7656 Self(RequestBuilder::new(stub))
7657 }
7658
7659 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7661 mut self,
7662 v: V,
7663 ) -> Self {
7664 self.0.request = v.into();
7665 self
7666 }
7667
7668 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7670 self.0.options = v.into();
7671 self
7672 }
7673
7674 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7676 (*self.0.stub)
7677 .list_operations(self.0.request, self.0.options)
7678 .await
7679 .map(gax::response::Response::into_body)
7680 }
7681
7682 pub fn by_page(
7684 self,
7685 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7686 {
7687 use std::clone::Clone;
7688 let token = self.0.request.page_token.clone();
7689 let execute = move |token: String| {
7690 let mut builder = self.clone();
7691 builder.0.request = builder.0.request.set_page_token(token);
7692 builder.send()
7693 };
7694 gax::paginator::internal::new_paginator(token, execute)
7695 }
7696
7697 pub fn by_item(
7699 self,
7700 ) -> impl gax::paginator::ItemPaginator<
7701 longrunning::model::ListOperationsResponse,
7702 gax::error::Error,
7703 > {
7704 use gax::paginator::Paginator;
7705 self.by_page().items()
7706 }
7707
7708 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7710 self.0.request.name = v.into();
7711 self
7712 }
7713
7714 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7716 self.0.request.filter = v.into();
7717 self
7718 }
7719
7720 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7722 self.0.request.page_size = v.into();
7723 self
7724 }
7725
7726 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7728 self.0.request.page_token = v.into();
7729 self
7730 }
7731
7732 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7734 self.0.request.return_partial_success = v.into();
7735 self
7736 }
7737 }
7738
7739 #[doc(hidden)]
7740 impl gax::options::internal::RequestBuilder for ListOperations {
7741 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7742 &mut self.0.options
7743 }
7744 }
7745
7746 #[derive(Clone, Debug)]
7764 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7765
7766 impl GetOperation {
7767 pub(crate) fn new(
7768 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7769 ) -> Self {
7770 Self(RequestBuilder::new(stub))
7771 }
7772
7773 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7775 mut self,
7776 v: V,
7777 ) -> Self {
7778 self.0.request = v.into();
7779 self
7780 }
7781
7782 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7784 self.0.options = v.into();
7785 self
7786 }
7787
7788 pub async fn send(self) -> Result<longrunning::model::Operation> {
7790 (*self.0.stub)
7791 .get_operation(self.0.request, self.0.options)
7792 .await
7793 .map(gax::response::Response::into_body)
7794 }
7795
7796 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7798 self.0.request.name = v.into();
7799 self
7800 }
7801 }
7802
7803 #[doc(hidden)]
7804 impl gax::options::internal::RequestBuilder for GetOperation {
7805 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7806 &mut self.0.options
7807 }
7808 }
7809
7810 #[derive(Clone, Debug)]
7828 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7829
7830 impl CancelOperation {
7831 pub(crate) fn new(
7832 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7833 ) -> Self {
7834 Self(RequestBuilder::new(stub))
7835 }
7836
7837 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7839 mut self,
7840 v: V,
7841 ) -> Self {
7842 self.0.request = v.into();
7843 self
7844 }
7845
7846 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7848 self.0.options = v.into();
7849 self
7850 }
7851
7852 pub async fn send(self) -> Result<()> {
7854 (*self.0.stub)
7855 .cancel_operation(self.0.request, self.0.options)
7856 .await
7857 .map(gax::response::Response::into_body)
7858 }
7859
7860 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7862 self.0.request.name = v.into();
7863 self
7864 }
7865 }
7866
7867 #[doc(hidden)]
7868 impl gax::options::internal::RequestBuilder for CancelOperation {
7869 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7870 &mut self.0.options
7871 }
7872 }
7873}
7874
7875#[cfg(feature = "identity-mapping-store-service")]
7876#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
7877pub mod identity_mapping_store_service {
7878 use crate::Result;
7879
7880 pub type ClientBuilder =
7894 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7895
7896 pub(crate) mod client {
7897 use super::super::super::client::IdentityMappingStoreService;
7898 pub struct Factory;
7899 impl gax::client_builder::internal::ClientFactory for Factory {
7900 type Client = IdentityMappingStoreService;
7901 type Credentials = gaxi::options::Credentials;
7902 async fn build(
7903 self,
7904 config: gaxi::options::ClientConfig,
7905 ) -> gax::client_builder::Result<Self::Client> {
7906 Self::Client::new(config).await
7907 }
7908 }
7909 }
7910
7911 #[derive(Clone, Debug)]
7913 pub(crate) struct RequestBuilder<R: std::default::Default> {
7914 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7915 request: R,
7916 options: gax::options::RequestOptions,
7917 }
7918
7919 impl<R> RequestBuilder<R>
7920 where
7921 R: std::default::Default,
7922 {
7923 pub(crate) fn new(
7924 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7925 ) -> Self {
7926 Self {
7927 stub,
7928 request: R::default(),
7929 options: gax::options::RequestOptions::default(),
7930 }
7931 }
7932 }
7933
7934 #[derive(Clone, Debug)]
7952 pub struct CreateIdentityMappingStore(
7953 RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
7954 );
7955
7956 impl CreateIdentityMappingStore {
7957 pub(crate) fn new(
7958 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7959 ) -> Self {
7960 Self(RequestBuilder::new(stub))
7961 }
7962
7963 pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
7965 mut self,
7966 v: V,
7967 ) -> Self {
7968 self.0.request = v.into();
7969 self
7970 }
7971
7972 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7974 self.0.options = v.into();
7975 self
7976 }
7977
7978 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
7980 (*self.0.stub)
7981 .create_identity_mapping_store(self.0.request, self.0.options)
7982 .await
7983 .map(gax::response::Response::into_body)
7984 }
7985
7986 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7990 self.0.request.parent = v.into();
7991 self
7992 }
7993
7994 pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7998 self.0.request.identity_mapping_store_id = v.into();
7999 self
8000 }
8001
8002 pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
8006 where
8007 T: std::convert::Into<crate::model::IdentityMappingStore>,
8008 {
8009 self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
8010 self
8011 }
8012
8013 pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
8017 where
8018 T: std::convert::Into<crate::model::IdentityMappingStore>,
8019 {
8020 self.0.request.identity_mapping_store = v.map(|x| x.into());
8021 self
8022 }
8023
8024 pub fn set_cmek_options<
8029 T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
8030 >(
8031 mut self,
8032 v: T,
8033 ) -> Self {
8034 self.0.request.cmek_options = v.into();
8035 self
8036 }
8037
8038 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
8044 mut self,
8045 v: T,
8046 ) -> Self {
8047 self.0.request = self.0.request.set_cmek_config_name(v);
8048 self
8049 }
8050
8051 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8057 self.0.request = self.0.request.set_disable_cmek(v);
8058 self
8059 }
8060 }
8061
8062 #[doc(hidden)]
8063 impl gax::options::internal::RequestBuilder for CreateIdentityMappingStore {
8064 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8065 &mut self.0.options
8066 }
8067 }
8068
8069 #[derive(Clone, Debug)]
8087 pub struct GetIdentityMappingStore(
8088 RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8089 );
8090
8091 impl GetIdentityMappingStore {
8092 pub(crate) fn new(
8093 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8094 ) -> Self {
8095 Self(RequestBuilder::new(stub))
8096 }
8097
8098 pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8100 mut self,
8101 v: V,
8102 ) -> Self {
8103 self.0.request = v.into();
8104 self
8105 }
8106
8107 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8109 self.0.options = v.into();
8110 self
8111 }
8112
8113 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8115 (*self.0.stub)
8116 .get_identity_mapping_store(self.0.request, self.0.options)
8117 .await
8118 .map(gax::response::Response::into_body)
8119 }
8120
8121 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8125 self.0.request.name = v.into();
8126 self
8127 }
8128 }
8129
8130 #[doc(hidden)]
8131 impl gax::options::internal::RequestBuilder for GetIdentityMappingStore {
8132 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8133 &mut self.0.options
8134 }
8135 }
8136
8137 #[derive(Clone, Debug)]
8156 pub struct DeleteIdentityMappingStore(
8157 RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8158 );
8159
8160 impl DeleteIdentityMappingStore {
8161 pub(crate) fn new(
8162 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8163 ) -> Self {
8164 Self(RequestBuilder::new(stub))
8165 }
8166
8167 pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8169 mut self,
8170 v: V,
8171 ) -> Self {
8172 self.0.request = v.into();
8173 self
8174 }
8175
8176 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8178 self.0.options = v.into();
8179 self
8180 }
8181
8182 pub async fn send(self) -> Result<longrunning::model::Operation> {
8189 (*self.0.stub)
8190 .delete_identity_mapping_store(self.0.request, self.0.options)
8191 .await
8192 .map(gax::response::Response::into_body)
8193 }
8194
8195 pub fn poller(
8197 self,
8198 ) -> impl lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata> {
8199 type Operation = lro::internal::Operation<
8200 wkt::Empty,
8201 crate::model::DeleteIdentityMappingStoreMetadata,
8202 >;
8203 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8204 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8205
8206 let stub = self.0.stub.clone();
8207 let mut options = self.0.options.clone();
8208 options.set_retry_policy(gax::retry_policy::NeverRetry);
8209 let query = move |name| {
8210 let stub = stub.clone();
8211 let options = options.clone();
8212 async {
8213 let op = GetOperation::new(stub)
8214 .set_name(name)
8215 .with_options(options)
8216 .send()
8217 .await?;
8218 Ok(Operation::new(op))
8219 }
8220 };
8221
8222 let start = move || async {
8223 let op = self.send().await?;
8224 Ok(Operation::new(op))
8225 };
8226
8227 lro::internal::new_unit_response_poller(
8228 polling_error_policy,
8229 polling_backoff_policy,
8230 start,
8231 query,
8232 )
8233 }
8234
8235 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8239 self.0.request.name = v.into();
8240 self
8241 }
8242 }
8243
8244 #[doc(hidden)]
8245 impl gax::options::internal::RequestBuilder for DeleteIdentityMappingStore {
8246 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8247 &mut self.0.options
8248 }
8249 }
8250
8251 #[derive(Clone, Debug)]
8270 pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8271
8272 impl ImportIdentityMappings {
8273 pub(crate) fn new(
8274 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8275 ) -> Self {
8276 Self(RequestBuilder::new(stub))
8277 }
8278
8279 pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8281 mut self,
8282 v: V,
8283 ) -> Self {
8284 self.0.request = v.into();
8285 self
8286 }
8287
8288 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8290 self.0.options = v.into();
8291 self
8292 }
8293
8294 pub async fn send(self) -> Result<longrunning::model::Operation> {
8301 (*self.0.stub)
8302 .import_identity_mappings(self.0.request, self.0.options)
8303 .await
8304 .map(gax::response::Response::into_body)
8305 }
8306
8307 pub fn poller(
8309 self,
8310 ) -> impl lro::Poller<
8311 crate::model::ImportIdentityMappingsResponse,
8312 crate::model::IdentityMappingEntryOperationMetadata,
8313 > {
8314 type Operation = lro::internal::Operation<
8315 crate::model::ImportIdentityMappingsResponse,
8316 crate::model::IdentityMappingEntryOperationMetadata,
8317 >;
8318 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8319 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8320
8321 let stub = self.0.stub.clone();
8322 let mut options = self.0.options.clone();
8323 options.set_retry_policy(gax::retry_policy::NeverRetry);
8324 let query = move |name| {
8325 let stub = stub.clone();
8326 let options = options.clone();
8327 async {
8328 let op = GetOperation::new(stub)
8329 .set_name(name)
8330 .with_options(options)
8331 .send()
8332 .await?;
8333 Ok(Operation::new(op))
8334 }
8335 };
8336
8337 let start = move || async {
8338 let op = self.send().await?;
8339 Ok(Operation::new(op))
8340 };
8341
8342 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8343 }
8344
8345 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8349 self.0.request.identity_mapping_store = v.into();
8350 self
8351 }
8352
8353 pub fn set_source<
8358 T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
8359 >(
8360 mut self,
8361 v: T,
8362 ) -> Self {
8363 self.0.request.source = v.into();
8364 self
8365 }
8366
8367 pub fn set_inline_source<
8373 T: std::convert::Into<
8374 std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
8375 >,
8376 >(
8377 mut self,
8378 v: T,
8379 ) -> Self {
8380 self.0.request = self.0.request.set_inline_source(v);
8381 self
8382 }
8383 }
8384
8385 #[doc(hidden)]
8386 impl gax::options::internal::RequestBuilder for ImportIdentityMappings {
8387 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8388 &mut self.0.options
8389 }
8390 }
8391
8392 #[derive(Clone, Debug)]
8411 pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
8412
8413 impl PurgeIdentityMappings {
8414 pub(crate) fn new(
8415 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8416 ) -> Self {
8417 Self(RequestBuilder::new(stub))
8418 }
8419
8420 pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
8422 mut self,
8423 v: V,
8424 ) -> Self {
8425 self.0.request = v.into();
8426 self
8427 }
8428
8429 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8431 self.0.options = v.into();
8432 self
8433 }
8434
8435 pub async fn send(self) -> Result<longrunning::model::Operation> {
8442 (*self.0.stub)
8443 .purge_identity_mappings(self.0.request, self.0.options)
8444 .await
8445 .map(gax::response::Response::into_body)
8446 }
8447
8448 pub fn poller(
8450 self,
8451 ) -> impl lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata> {
8452 type Operation = lro::internal::Operation<
8453 wkt::Empty,
8454 crate::model::IdentityMappingEntryOperationMetadata,
8455 >;
8456 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8457 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8458
8459 let stub = self.0.stub.clone();
8460 let mut options = self.0.options.clone();
8461 options.set_retry_policy(gax::retry_policy::NeverRetry);
8462 let query = move |name| {
8463 let stub = stub.clone();
8464 let options = options.clone();
8465 async {
8466 let op = GetOperation::new(stub)
8467 .set_name(name)
8468 .with_options(options)
8469 .send()
8470 .await?;
8471 Ok(Operation::new(op))
8472 }
8473 };
8474
8475 let start = move || async {
8476 let op = self.send().await?;
8477 Ok(Operation::new(op))
8478 };
8479
8480 lro::internal::new_unit_response_poller(
8481 polling_error_policy,
8482 polling_backoff_policy,
8483 start,
8484 query,
8485 )
8486 }
8487
8488 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8492 self.0.request.identity_mapping_store = v.into();
8493 self
8494 }
8495
8496 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8498 self.0.request.filter = v.into();
8499 self
8500 }
8501
8502 pub fn set_force<T>(mut self, v: T) -> Self
8504 where
8505 T: std::convert::Into<bool>,
8506 {
8507 self.0.request.force = std::option::Option::Some(v.into());
8508 self
8509 }
8510
8511 pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
8513 where
8514 T: std::convert::Into<bool>,
8515 {
8516 self.0.request.force = v.map(|x| x.into());
8517 self
8518 }
8519
8520 pub fn set_source<
8525 T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
8526 >(
8527 mut self,
8528 v: T,
8529 ) -> Self {
8530 self.0.request.source = v.into();
8531 self
8532 }
8533
8534 pub fn set_inline_source<
8540 T: std::convert::Into<
8541 std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
8542 >,
8543 >(
8544 mut self,
8545 v: T,
8546 ) -> Self {
8547 self.0.request = self.0.request.set_inline_source(v);
8548 self
8549 }
8550 }
8551
8552 #[doc(hidden)]
8553 impl gax::options::internal::RequestBuilder for PurgeIdentityMappings {
8554 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8555 &mut self.0.options
8556 }
8557 }
8558
8559 #[derive(Clone, Debug)]
8581 pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
8582
8583 impl ListIdentityMappings {
8584 pub(crate) fn new(
8585 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8586 ) -> Self {
8587 Self(RequestBuilder::new(stub))
8588 }
8589
8590 pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
8592 mut self,
8593 v: V,
8594 ) -> Self {
8595 self.0.request = v.into();
8596 self
8597 }
8598
8599 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8601 self.0.options = v.into();
8602 self
8603 }
8604
8605 pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
8607 (*self.0.stub)
8608 .list_identity_mappings(self.0.request, self.0.options)
8609 .await
8610 .map(gax::response::Response::into_body)
8611 }
8612
8613 pub fn by_page(
8615 self,
8616 ) -> impl gax::paginator::Paginator<crate::model::ListIdentityMappingsResponse, gax::error::Error>
8617 {
8618 use std::clone::Clone;
8619 let token = self.0.request.page_token.clone();
8620 let execute = move |token: String| {
8621 let mut builder = self.clone();
8622 builder.0.request = builder.0.request.set_page_token(token);
8623 builder.send()
8624 };
8625 gax::paginator::internal::new_paginator(token, execute)
8626 }
8627
8628 pub fn by_item(
8630 self,
8631 ) -> impl gax::paginator::ItemPaginator<
8632 crate::model::ListIdentityMappingsResponse,
8633 gax::error::Error,
8634 > {
8635 use gax::paginator::Paginator;
8636 self.by_page().items()
8637 }
8638
8639 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8643 self.0.request.identity_mapping_store = v.into();
8644 self
8645 }
8646
8647 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8649 self.0.request.page_size = v.into();
8650 self
8651 }
8652
8653 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8655 self.0.request.page_token = v.into();
8656 self
8657 }
8658 }
8659
8660 #[doc(hidden)]
8661 impl gax::options::internal::RequestBuilder for ListIdentityMappings {
8662 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8663 &mut self.0.options
8664 }
8665 }
8666
8667 #[derive(Clone, Debug)]
8689 pub struct ListIdentityMappingStores(
8690 RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
8691 );
8692
8693 impl ListIdentityMappingStores {
8694 pub(crate) fn new(
8695 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8696 ) -> Self {
8697 Self(RequestBuilder::new(stub))
8698 }
8699
8700 pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
8702 mut self,
8703 v: V,
8704 ) -> Self {
8705 self.0.request = v.into();
8706 self
8707 }
8708
8709 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8711 self.0.options = v.into();
8712 self
8713 }
8714
8715 pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
8717 (*self.0.stub)
8718 .list_identity_mapping_stores(self.0.request, self.0.options)
8719 .await
8720 .map(gax::response::Response::into_body)
8721 }
8722
8723 pub fn by_page(
8725 self,
8726 ) -> impl gax::paginator::Paginator<
8727 crate::model::ListIdentityMappingStoresResponse,
8728 gax::error::Error,
8729 > {
8730 use std::clone::Clone;
8731 let token = self.0.request.page_token.clone();
8732 let execute = move |token: String| {
8733 let mut builder = self.clone();
8734 builder.0.request = builder.0.request.set_page_token(token);
8735 builder.send()
8736 };
8737 gax::paginator::internal::new_paginator(token, execute)
8738 }
8739
8740 pub fn by_item(
8742 self,
8743 ) -> impl gax::paginator::ItemPaginator<
8744 crate::model::ListIdentityMappingStoresResponse,
8745 gax::error::Error,
8746 > {
8747 use gax::paginator::Paginator;
8748 self.by_page().items()
8749 }
8750
8751 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8755 self.0.request.parent = v.into();
8756 self
8757 }
8758
8759 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8761 self.0.request.page_size = v.into();
8762 self
8763 }
8764
8765 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8767 self.0.request.page_token = v.into();
8768 self
8769 }
8770 }
8771
8772 #[doc(hidden)]
8773 impl gax::options::internal::RequestBuilder for ListIdentityMappingStores {
8774 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8775 &mut self.0.options
8776 }
8777 }
8778
8779 #[derive(Clone, Debug)]
8801 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
8802
8803 impl ListOperations {
8804 pub(crate) fn new(
8805 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8806 ) -> Self {
8807 Self(RequestBuilder::new(stub))
8808 }
8809
8810 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
8812 mut self,
8813 v: V,
8814 ) -> Self {
8815 self.0.request = v.into();
8816 self
8817 }
8818
8819 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8821 self.0.options = v.into();
8822 self
8823 }
8824
8825 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
8827 (*self.0.stub)
8828 .list_operations(self.0.request, self.0.options)
8829 .await
8830 .map(gax::response::Response::into_body)
8831 }
8832
8833 pub fn by_page(
8835 self,
8836 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8837 {
8838 use std::clone::Clone;
8839 let token = self.0.request.page_token.clone();
8840 let execute = move |token: String| {
8841 let mut builder = self.clone();
8842 builder.0.request = builder.0.request.set_page_token(token);
8843 builder.send()
8844 };
8845 gax::paginator::internal::new_paginator(token, execute)
8846 }
8847
8848 pub fn by_item(
8850 self,
8851 ) -> impl gax::paginator::ItemPaginator<
8852 longrunning::model::ListOperationsResponse,
8853 gax::error::Error,
8854 > {
8855 use gax::paginator::Paginator;
8856 self.by_page().items()
8857 }
8858
8859 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8861 self.0.request.name = v.into();
8862 self
8863 }
8864
8865 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8867 self.0.request.filter = v.into();
8868 self
8869 }
8870
8871 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8873 self.0.request.page_size = v.into();
8874 self
8875 }
8876
8877 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8879 self.0.request.page_token = v.into();
8880 self
8881 }
8882
8883 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8885 self.0.request.return_partial_success = v.into();
8886 self
8887 }
8888 }
8889
8890 #[doc(hidden)]
8891 impl gax::options::internal::RequestBuilder for ListOperations {
8892 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8893 &mut self.0.options
8894 }
8895 }
8896
8897 #[derive(Clone, Debug)]
8915 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8916
8917 impl GetOperation {
8918 pub(crate) fn new(
8919 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8920 ) -> Self {
8921 Self(RequestBuilder::new(stub))
8922 }
8923
8924 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8926 mut self,
8927 v: V,
8928 ) -> Self {
8929 self.0.request = v.into();
8930 self
8931 }
8932
8933 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8935 self.0.options = v.into();
8936 self
8937 }
8938
8939 pub async fn send(self) -> Result<longrunning::model::Operation> {
8941 (*self.0.stub)
8942 .get_operation(self.0.request, self.0.options)
8943 .await
8944 .map(gax::response::Response::into_body)
8945 }
8946
8947 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8949 self.0.request.name = v.into();
8950 self
8951 }
8952 }
8953
8954 #[doc(hidden)]
8955 impl gax::options::internal::RequestBuilder for GetOperation {
8956 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8957 &mut self.0.options
8958 }
8959 }
8960
8961 #[derive(Clone, Debug)]
8979 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
8980
8981 impl CancelOperation {
8982 pub(crate) fn new(
8983 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8984 ) -> Self {
8985 Self(RequestBuilder::new(stub))
8986 }
8987
8988 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
8990 mut self,
8991 v: V,
8992 ) -> Self {
8993 self.0.request = v.into();
8994 self
8995 }
8996
8997 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8999 self.0.options = v.into();
9000 self
9001 }
9002
9003 pub async fn send(self) -> Result<()> {
9005 (*self.0.stub)
9006 .cancel_operation(self.0.request, self.0.options)
9007 .await
9008 .map(gax::response::Response::into_body)
9009 }
9010
9011 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9013 self.0.request.name = v.into();
9014 self
9015 }
9016 }
9017
9018 #[doc(hidden)]
9019 impl gax::options::internal::RequestBuilder for CancelOperation {
9020 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9021 &mut self.0.options
9022 }
9023 }
9024}
9025
9026#[cfg(feature = "project-service")]
9027#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
9028pub mod project_service {
9029 use crate::Result;
9030
9031 pub type ClientBuilder =
9045 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9046
9047 pub(crate) mod client {
9048 use super::super::super::client::ProjectService;
9049 pub struct Factory;
9050 impl gax::client_builder::internal::ClientFactory for Factory {
9051 type Client = ProjectService;
9052 type Credentials = gaxi::options::Credentials;
9053 async fn build(
9054 self,
9055 config: gaxi::options::ClientConfig,
9056 ) -> gax::client_builder::Result<Self::Client> {
9057 Self::Client::new(config).await
9058 }
9059 }
9060 }
9061
9062 #[derive(Clone, Debug)]
9064 pub(crate) struct RequestBuilder<R: std::default::Default> {
9065 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9066 request: R,
9067 options: gax::options::RequestOptions,
9068 }
9069
9070 impl<R> RequestBuilder<R>
9071 where
9072 R: std::default::Default,
9073 {
9074 pub(crate) fn new(
9075 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9076 ) -> Self {
9077 Self {
9078 stub,
9079 request: R::default(),
9080 options: gax::options::RequestOptions::default(),
9081 }
9082 }
9083 }
9084
9085 #[derive(Clone, Debug)]
9104 pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9105
9106 impl ProvisionProject {
9107 pub(crate) fn new(
9108 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9109 ) -> Self {
9110 Self(RequestBuilder::new(stub))
9111 }
9112
9113 pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9115 mut self,
9116 v: V,
9117 ) -> Self {
9118 self.0.request = v.into();
9119 self
9120 }
9121
9122 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9124 self.0.options = v.into();
9125 self
9126 }
9127
9128 pub async fn send(self) -> Result<longrunning::model::Operation> {
9135 (*self.0.stub)
9136 .provision_project(self.0.request, self.0.options)
9137 .await
9138 .map(gax::response::Response::into_body)
9139 }
9140
9141 pub fn poller(
9143 self,
9144 ) -> impl lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9145 {
9146 type Operation = lro::internal::Operation<
9147 crate::model::Project,
9148 crate::model::ProvisionProjectMetadata,
9149 >;
9150 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9151 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9152
9153 let stub = self.0.stub.clone();
9154 let mut options = self.0.options.clone();
9155 options.set_retry_policy(gax::retry_policy::NeverRetry);
9156 let query = move |name| {
9157 let stub = stub.clone();
9158 let options = options.clone();
9159 async {
9160 let op = GetOperation::new(stub)
9161 .set_name(name)
9162 .with_options(options)
9163 .send()
9164 .await?;
9165 Ok(Operation::new(op))
9166 }
9167 };
9168
9169 let start = move || async {
9170 let op = self.send().await?;
9171 Ok(Operation::new(op))
9172 };
9173
9174 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
9175 }
9176
9177 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9181 self.0.request.name = v.into();
9182 self
9183 }
9184
9185 pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9189 self.0.request.accept_data_use_terms = v.into();
9190 self
9191 }
9192
9193 pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9197 self.0.request.data_use_terms_version = v.into();
9198 self
9199 }
9200 }
9201
9202 #[doc(hidden)]
9203 impl gax::options::internal::RequestBuilder for ProvisionProject {
9204 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9205 &mut self.0.options
9206 }
9207 }
9208
9209 #[derive(Clone, Debug)]
9231 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9232
9233 impl ListOperations {
9234 pub(crate) fn new(
9235 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9236 ) -> Self {
9237 Self(RequestBuilder::new(stub))
9238 }
9239
9240 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9242 mut self,
9243 v: V,
9244 ) -> Self {
9245 self.0.request = v.into();
9246 self
9247 }
9248
9249 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9251 self.0.options = v.into();
9252 self
9253 }
9254
9255 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9257 (*self.0.stub)
9258 .list_operations(self.0.request, self.0.options)
9259 .await
9260 .map(gax::response::Response::into_body)
9261 }
9262
9263 pub fn by_page(
9265 self,
9266 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9267 {
9268 use std::clone::Clone;
9269 let token = self.0.request.page_token.clone();
9270 let execute = move |token: String| {
9271 let mut builder = self.clone();
9272 builder.0.request = builder.0.request.set_page_token(token);
9273 builder.send()
9274 };
9275 gax::paginator::internal::new_paginator(token, execute)
9276 }
9277
9278 pub fn by_item(
9280 self,
9281 ) -> impl gax::paginator::ItemPaginator<
9282 longrunning::model::ListOperationsResponse,
9283 gax::error::Error,
9284 > {
9285 use gax::paginator::Paginator;
9286 self.by_page().items()
9287 }
9288
9289 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9291 self.0.request.name = v.into();
9292 self
9293 }
9294
9295 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9297 self.0.request.filter = v.into();
9298 self
9299 }
9300
9301 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9303 self.0.request.page_size = v.into();
9304 self
9305 }
9306
9307 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9309 self.0.request.page_token = v.into();
9310 self
9311 }
9312
9313 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9315 self.0.request.return_partial_success = v.into();
9316 self
9317 }
9318 }
9319
9320 #[doc(hidden)]
9321 impl gax::options::internal::RequestBuilder for ListOperations {
9322 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9323 &mut self.0.options
9324 }
9325 }
9326
9327 #[derive(Clone, Debug)]
9345 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9346
9347 impl GetOperation {
9348 pub(crate) fn new(
9349 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9350 ) -> Self {
9351 Self(RequestBuilder::new(stub))
9352 }
9353
9354 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9356 mut self,
9357 v: V,
9358 ) -> Self {
9359 self.0.request = v.into();
9360 self
9361 }
9362
9363 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9365 self.0.options = v.into();
9366 self
9367 }
9368
9369 pub async fn send(self) -> Result<longrunning::model::Operation> {
9371 (*self.0.stub)
9372 .get_operation(self.0.request, self.0.options)
9373 .await
9374 .map(gax::response::Response::into_body)
9375 }
9376
9377 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9379 self.0.request.name = v.into();
9380 self
9381 }
9382 }
9383
9384 #[doc(hidden)]
9385 impl gax::options::internal::RequestBuilder for GetOperation {
9386 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9387 &mut self.0.options
9388 }
9389 }
9390
9391 #[derive(Clone, Debug)]
9409 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9410
9411 impl CancelOperation {
9412 pub(crate) fn new(
9413 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9414 ) -> Self {
9415 Self(RequestBuilder::new(stub))
9416 }
9417
9418 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9420 mut self,
9421 v: V,
9422 ) -> Self {
9423 self.0.request = v.into();
9424 self
9425 }
9426
9427 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9429 self.0.options = v.into();
9430 self
9431 }
9432
9433 pub async fn send(self) -> Result<()> {
9435 (*self.0.stub)
9436 .cancel_operation(self.0.request, self.0.options)
9437 .await
9438 .map(gax::response::Response::into_body)
9439 }
9440
9441 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9443 self.0.request.name = v.into();
9444 self
9445 }
9446 }
9447
9448 #[doc(hidden)]
9449 impl gax::options::internal::RequestBuilder for CancelOperation {
9450 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9451 &mut self.0.options
9452 }
9453 }
9454}
9455
9456#[cfg(feature = "rank-service")]
9457#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
9458pub mod rank_service {
9459 use crate::Result;
9460
9461 pub type ClientBuilder =
9475 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9476
9477 pub(crate) mod client {
9478 use super::super::super::client::RankService;
9479 pub struct Factory;
9480 impl gax::client_builder::internal::ClientFactory for Factory {
9481 type Client = RankService;
9482 type Credentials = gaxi::options::Credentials;
9483 async fn build(
9484 self,
9485 config: gaxi::options::ClientConfig,
9486 ) -> gax::client_builder::Result<Self::Client> {
9487 Self::Client::new(config).await
9488 }
9489 }
9490 }
9491
9492 #[derive(Clone, Debug)]
9494 pub(crate) struct RequestBuilder<R: std::default::Default> {
9495 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9496 request: R,
9497 options: gax::options::RequestOptions,
9498 }
9499
9500 impl<R> RequestBuilder<R>
9501 where
9502 R: std::default::Default,
9503 {
9504 pub(crate) fn new(
9505 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9506 ) -> Self {
9507 Self {
9508 stub,
9509 request: R::default(),
9510 options: gax::options::RequestOptions::default(),
9511 }
9512 }
9513 }
9514
9515 #[derive(Clone, Debug)]
9533 pub struct Rank(RequestBuilder<crate::model::RankRequest>);
9534
9535 impl Rank {
9536 pub(crate) fn new(
9537 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9538 ) -> Self {
9539 Self(RequestBuilder::new(stub))
9540 }
9541
9542 pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
9544 self.0.request = v.into();
9545 self
9546 }
9547
9548 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9550 self.0.options = v.into();
9551 self
9552 }
9553
9554 pub async fn send(self) -> Result<crate::model::RankResponse> {
9556 (*self.0.stub)
9557 .rank(self.0.request, self.0.options)
9558 .await
9559 .map(gax::response::Response::into_body)
9560 }
9561
9562 pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9566 self.0.request.ranking_config = v.into();
9567 self
9568 }
9569
9570 pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
9572 self.0.request.model = v.into();
9573 self
9574 }
9575
9576 pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
9578 self.0.request.top_n = v.into();
9579 self
9580 }
9581
9582 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
9584 self.0.request.query = v.into();
9585 self
9586 }
9587
9588 pub fn set_records<T, V>(mut self, v: T) -> Self
9592 where
9593 T: std::iter::IntoIterator<Item = V>,
9594 V: std::convert::Into<crate::model::RankingRecord>,
9595 {
9596 use std::iter::Iterator;
9597 self.0.request.records = v.into_iter().map(|i| i.into()).collect();
9598 self
9599 }
9600
9601 pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
9603 self.0.request.ignore_record_details_in_response = v.into();
9604 self
9605 }
9606
9607 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9609 where
9610 T: std::iter::IntoIterator<Item = (K, V)>,
9611 K: std::convert::Into<std::string::String>,
9612 V: std::convert::Into<std::string::String>,
9613 {
9614 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9615 self
9616 }
9617 }
9618
9619 #[doc(hidden)]
9620 impl gax::options::internal::RequestBuilder for Rank {
9621 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9622 &mut self.0.options
9623 }
9624 }
9625
9626 #[derive(Clone, Debug)]
9648 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9649
9650 impl ListOperations {
9651 pub(crate) fn new(
9652 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9653 ) -> Self {
9654 Self(RequestBuilder::new(stub))
9655 }
9656
9657 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9659 mut self,
9660 v: V,
9661 ) -> Self {
9662 self.0.request = v.into();
9663 self
9664 }
9665
9666 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9668 self.0.options = v.into();
9669 self
9670 }
9671
9672 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9674 (*self.0.stub)
9675 .list_operations(self.0.request, self.0.options)
9676 .await
9677 .map(gax::response::Response::into_body)
9678 }
9679
9680 pub fn by_page(
9682 self,
9683 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9684 {
9685 use std::clone::Clone;
9686 let token = self.0.request.page_token.clone();
9687 let execute = move |token: String| {
9688 let mut builder = self.clone();
9689 builder.0.request = builder.0.request.set_page_token(token);
9690 builder.send()
9691 };
9692 gax::paginator::internal::new_paginator(token, execute)
9693 }
9694
9695 pub fn by_item(
9697 self,
9698 ) -> impl gax::paginator::ItemPaginator<
9699 longrunning::model::ListOperationsResponse,
9700 gax::error::Error,
9701 > {
9702 use gax::paginator::Paginator;
9703 self.by_page().items()
9704 }
9705
9706 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9708 self.0.request.name = v.into();
9709 self
9710 }
9711
9712 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9714 self.0.request.filter = v.into();
9715 self
9716 }
9717
9718 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9720 self.0.request.page_size = v.into();
9721 self
9722 }
9723
9724 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9726 self.0.request.page_token = v.into();
9727 self
9728 }
9729
9730 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9732 self.0.request.return_partial_success = v.into();
9733 self
9734 }
9735 }
9736
9737 #[doc(hidden)]
9738 impl gax::options::internal::RequestBuilder for ListOperations {
9739 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9740 &mut self.0.options
9741 }
9742 }
9743
9744 #[derive(Clone, Debug)]
9762 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9763
9764 impl GetOperation {
9765 pub(crate) fn new(
9766 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9767 ) -> Self {
9768 Self(RequestBuilder::new(stub))
9769 }
9770
9771 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9773 mut self,
9774 v: V,
9775 ) -> Self {
9776 self.0.request = v.into();
9777 self
9778 }
9779
9780 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9782 self.0.options = v.into();
9783 self
9784 }
9785
9786 pub async fn send(self) -> Result<longrunning::model::Operation> {
9788 (*self.0.stub)
9789 .get_operation(self.0.request, self.0.options)
9790 .await
9791 .map(gax::response::Response::into_body)
9792 }
9793
9794 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9796 self.0.request.name = v.into();
9797 self
9798 }
9799 }
9800
9801 #[doc(hidden)]
9802 impl gax::options::internal::RequestBuilder for GetOperation {
9803 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9804 &mut self.0.options
9805 }
9806 }
9807
9808 #[derive(Clone, Debug)]
9826 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9827
9828 impl CancelOperation {
9829 pub(crate) fn new(
9830 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9831 ) -> Self {
9832 Self(RequestBuilder::new(stub))
9833 }
9834
9835 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9837 mut self,
9838 v: V,
9839 ) -> Self {
9840 self.0.request = v.into();
9841 self
9842 }
9843
9844 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9846 self.0.options = v.into();
9847 self
9848 }
9849
9850 pub async fn send(self) -> Result<()> {
9852 (*self.0.stub)
9853 .cancel_operation(self.0.request, self.0.options)
9854 .await
9855 .map(gax::response::Response::into_body)
9856 }
9857
9858 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9860 self.0.request.name = v.into();
9861 self
9862 }
9863 }
9864
9865 #[doc(hidden)]
9866 impl gax::options::internal::RequestBuilder for CancelOperation {
9867 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9868 &mut self.0.options
9869 }
9870 }
9871}
9872
9873#[cfg(feature = "recommendation-service")]
9874#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
9875pub mod recommendation_service {
9876 use crate::Result;
9877
9878 pub type ClientBuilder =
9892 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9893
9894 pub(crate) mod client {
9895 use super::super::super::client::RecommendationService;
9896 pub struct Factory;
9897 impl gax::client_builder::internal::ClientFactory for Factory {
9898 type Client = RecommendationService;
9899 type Credentials = gaxi::options::Credentials;
9900 async fn build(
9901 self,
9902 config: gaxi::options::ClientConfig,
9903 ) -> gax::client_builder::Result<Self::Client> {
9904 Self::Client::new(config).await
9905 }
9906 }
9907 }
9908
9909 #[derive(Clone, Debug)]
9911 pub(crate) struct RequestBuilder<R: std::default::Default> {
9912 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9913 request: R,
9914 options: gax::options::RequestOptions,
9915 }
9916
9917 impl<R> RequestBuilder<R>
9918 where
9919 R: std::default::Default,
9920 {
9921 pub(crate) fn new(
9922 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9923 ) -> Self {
9924 Self {
9925 stub,
9926 request: R::default(),
9927 options: gax::options::RequestOptions::default(),
9928 }
9929 }
9930 }
9931
9932 #[derive(Clone, Debug)]
9950 pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
9951
9952 impl Recommend {
9953 pub(crate) fn new(
9954 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9955 ) -> Self {
9956 Self(RequestBuilder::new(stub))
9957 }
9958
9959 pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
9961 self.0.request = v.into();
9962 self
9963 }
9964
9965 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9967 self.0.options = v.into();
9968 self
9969 }
9970
9971 pub async fn send(self) -> Result<crate::model::RecommendResponse> {
9973 (*self.0.stub)
9974 .recommend(self.0.request, self.0.options)
9975 .await
9976 .map(gax::response::Response::into_body)
9977 }
9978
9979 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9983 self.0.request.serving_config = v.into();
9984 self
9985 }
9986
9987 pub fn set_user_event<T>(mut self, v: T) -> Self
9991 where
9992 T: std::convert::Into<crate::model::UserEvent>,
9993 {
9994 self.0.request.user_event = std::option::Option::Some(v.into());
9995 self
9996 }
9997
9998 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
10002 where
10003 T: std::convert::Into<crate::model::UserEvent>,
10004 {
10005 self.0.request.user_event = v.map(|x| x.into());
10006 self
10007 }
10008
10009 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10011 self.0.request.page_size = v.into();
10012 self
10013 }
10014
10015 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10017 self.0.request.filter = v.into();
10018 self
10019 }
10020
10021 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
10023 self.0.request.validate_only = v.into();
10024 self
10025 }
10026
10027 pub fn set_params<T, K, V>(mut self, v: T) -> Self
10029 where
10030 T: std::iter::IntoIterator<Item = (K, V)>,
10031 K: std::convert::Into<std::string::String>,
10032 V: std::convert::Into<wkt::Value>,
10033 {
10034 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10035 self
10036 }
10037
10038 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
10040 where
10041 T: std::iter::IntoIterator<Item = (K, V)>,
10042 K: std::convert::Into<std::string::String>,
10043 V: std::convert::Into<std::string::String>,
10044 {
10045 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10046 self
10047 }
10048 }
10049
10050 #[doc(hidden)]
10051 impl gax::options::internal::RequestBuilder for Recommend {
10052 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10053 &mut self.0.options
10054 }
10055 }
10056
10057 #[derive(Clone, Debug)]
10079 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
10080
10081 impl ListOperations {
10082 pub(crate) fn new(
10083 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10084 ) -> Self {
10085 Self(RequestBuilder::new(stub))
10086 }
10087
10088 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
10090 mut self,
10091 v: V,
10092 ) -> Self {
10093 self.0.request = v.into();
10094 self
10095 }
10096
10097 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10099 self.0.options = v.into();
10100 self
10101 }
10102
10103 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10105 (*self.0.stub)
10106 .list_operations(self.0.request, self.0.options)
10107 .await
10108 .map(gax::response::Response::into_body)
10109 }
10110
10111 pub fn by_page(
10113 self,
10114 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10115 {
10116 use std::clone::Clone;
10117 let token = self.0.request.page_token.clone();
10118 let execute = move |token: String| {
10119 let mut builder = self.clone();
10120 builder.0.request = builder.0.request.set_page_token(token);
10121 builder.send()
10122 };
10123 gax::paginator::internal::new_paginator(token, execute)
10124 }
10125
10126 pub fn by_item(
10128 self,
10129 ) -> impl gax::paginator::ItemPaginator<
10130 longrunning::model::ListOperationsResponse,
10131 gax::error::Error,
10132 > {
10133 use gax::paginator::Paginator;
10134 self.by_page().items()
10135 }
10136
10137 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10139 self.0.request.name = v.into();
10140 self
10141 }
10142
10143 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10145 self.0.request.filter = v.into();
10146 self
10147 }
10148
10149 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10151 self.0.request.page_size = v.into();
10152 self
10153 }
10154
10155 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10157 self.0.request.page_token = v.into();
10158 self
10159 }
10160
10161 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10163 self.0.request.return_partial_success = v.into();
10164 self
10165 }
10166 }
10167
10168 #[doc(hidden)]
10169 impl gax::options::internal::RequestBuilder for ListOperations {
10170 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10171 &mut self.0.options
10172 }
10173 }
10174
10175 #[derive(Clone, Debug)]
10193 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
10194
10195 impl GetOperation {
10196 pub(crate) fn new(
10197 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10198 ) -> Self {
10199 Self(RequestBuilder::new(stub))
10200 }
10201
10202 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
10204 mut self,
10205 v: V,
10206 ) -> Self {
10207 self.0.request = v.into();
10208 self
10209 }
10210
10211 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10213 self.0.options = v.into();
10214 self
10215 }
10216
10217 pub async fn send(self) -> Result<longrunning::model::Operation> {
10219 (*self.0.stub)
10220 .get_operation(self.0.request, self.0.options)
10221 .await
10222 .map(gax::response::Response::into_body)
10223 }
10224
10225 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10227 self.0.request.name = v.into();
10228 self
10229 }
10230 }
10231
10232 #[doc(hidden)]
10233 impl gax::options::internal::RequestBuilder for GetOperation {
10234 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10235 &mut self.0.options
10236 }
10237 }
10238
10239 #[derive(Clone, Debug)]
10257 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
10258
10259 impl CancelOperation {
10260 pub(crate) fn new(
10261 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10262 ) -> Self {
10263 Self(RequestBuilder::new(stub))
10264 }
10265
10266 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
10268 mut self,
10269 v: V,
10270 ) -> Self {
10271 self.0.request = v.into();
10272 self
10273 }
10274
10275 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10277 self.0.options = v.into();
10278 self
10279 }
10280
10281 pub async fn send(self) -> Result<()> {
10283 (*self.0.stub)
10284 .cancel_operation(self.0.request, self.0.options)
10285 .await
10286 .map(gax::response::Response::into_body)
10287 }
10288
10289 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10291 self.0.request.name = v.into();
10292 self
10293 }
10294 }
10295
10296 #[doc(hidden)]
10297 impl gax::options::internal::RequestBuilder for CancelOperation {
10298 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10299 &mut self.0.options
10300 }
10301 }
10302}
10303
10304#[cfg(feature = "schema-service")]
10305#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
10306pub mod schema_service {
10307 use crate::Result;
10308
10309 pub type ClientBuilder =
10323 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10324
10325 pub(crate) mod client {
10326 use super::super::super::client::SchemaService;
10327 pub struct Factory;
10328 impl gax::client_builder::internal::ClientFactory for Factory {
10329 type Client = SchemaService;
10330 type Credentials = gaxi::options::Credentials;
10331 async fn build(
10332 self,
10333 config: gaxi::options::ClientConfig,
10334 ) -> gax::client_builder::Result<Self::Client> {
10335 Self::Client::new(config).await
10336 }
10337 }
10338 }
10339
10340 #[derive(Clone, Debug)]
10342 pub(crate) struct RequestBuilder<R: std::default::Default> {
10343 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10344 request: R,
10345 options: gax::options::RequestOptions,
10346 }
10347
10348 impl<R> RequestBuilder<R>
10349 where
10350 R: std::default::Default,
10351 {
10352 pub(crate) fn new(
10353 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10354 ) -> Self {
10355 Self {
10356 stub,
10357 request: R::default(),
10358 options: gax::options::RequestOptions::default(),
10359 }
10360 }
10361 }
10362
10363 #[derive(Clone, Debug)]
10381 pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
10382
10383 impl GetSchema {
10384 pub(crate) fn new(
10385 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10386 ) -> Self {
10387 Self(RequestBuilder::new(stub))
10388 }
10389
10390 pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
10392 self.0.request = v.into();
10393 self
10394 }
10395
10396 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10398 self.0.options = v.into();
10399 self
10400 }
10401
10402 pub async fn send(self) -> Result<crate::model::Schema> {
10404 (*self.0.stub)
10405 .get_schema(self.0.request, self.0.options)
10406 .await
10407 .map(gax::response::Response::into_body)
10408 }
10409
10410 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10414 self.0.request.name = v.into();
10415 self
10416 }
10417 }
10418
10419 #[doc(hidden)]
10420 impl gax::options::internal::RequestBuilder for GetSchema {
10421 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10422 &mut self.0.options
10423 }
10424 }
10425
10426 #[derive(Clone, Debug)]
10448 pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
10449
10450 impl ListSchemas {
10451 pub(crate) fn new(
10452 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10453 ) -> Self {
10454 Self(RequestBuilder::new(stub))
10455 }
10456
10457 pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
10459 self.0.request = v.into();
10460 self
10461 }
10462
10463 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10465 self.0.options = v.into();
10466 self
10467 }
10468
10469 pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
10471 (*self.0.stub)
10472 .list_schemas(self.0.request, self.0.options)
10473 .await
10474 .map(gax::response::Response::into_body)
10475 }
10476
10477 pub fn by_page(
10479 self,
10480 ) -> impl gax::paginator::Paginator<crate::model::ListSchemasResponse, gax::error::Error>
10481 {
10482 use std::clone::Clone;
10483 let token = self.0.request.page_token.clone();
10484 let execute = move |token: String| {
10485 let mut builder = self.clone();
10486 builder.0.request = builder.0.request.set_page_token(token);
10487 builder.send()
10488 };
10489 gax::paginator::internal::new_paginator(token, execute)
10490 }
10491
10492 pub fn by_item(
10494 self,
10495 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSchemasResponse, gax::error::Error>
10496 {
10497 use gax::paginator::Paginator;
10498 self.by_page().items()
10499 }
10500
10501 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10505 self.0.request.parent = v.into();
10506 self
10507 }
10508
10509 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10511 self.0.request.page_size = v.into();
10512 self
10513 }
10514
10515 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10517 self.0.request.page_token = v.into();
10518 self
10519 }
10520 }
10521
10522 #[doc(hidden)]
10523 impl gax::options::internal::RequestBuilder for ListSchemas {
10524 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10525 &mut self.0.options
10526 }
10527 }
10528
10529 #[derive(Clone, Debug)]
10548 pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
10549
10550 impl CreateSchema {
10551 pub(crate) fn new(
10552 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10553 ) -> Self {
10554 Self(RequestBuilder::new(stub))
10555 }
10556
10557 pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
10559 self.0.request = v.into();
10560 self
10561 }
10562
10563 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10565 self.0.options = v.into();
10566 self
10567 }
10568
10569 pub async fn send(self) -> Result<longrunning::model::Operation> {
10576 (*self.0.stub)
10577 .create_schema(self.0.request, self.0.options)
10578 .await
10579 .map(gax::response::Response::into_body)
10580 }
10581
10582 pub fn poller(
10584 self,
10585 ) -> impl lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata> {
10586 type Operation =
10587 lro::internal::Operation<crate::model::Schema, crate::model::CreateSchemaMetadata>;
10588 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10589 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10590
10591 let stub = self.0.stub.clone();
10592 let mut options = self.0.options.clone();
10593 options.set_retry_policy(gax::retry_policy::NeverRetry);
10594 let query = move |name| {
10595 let stub = stub.clone();
10596 let options = options.clone();
10597 async {
10598 let op = GetOperation::new(stub)
10599 .set_name(name)
10600 .with_options(options)
10601 .send()
10602 .await?;
10603 Ok(Operation::new(op))
10604 }
10605 };
10606
10607 let start = move || async {
10608 let op = self.send().await?;
10609 Ok(Operation::new(op))
10610 };
10611
10612 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10613 }
10614
10615 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10619 self.0.request.parent = v.into();
10620 self
10621 }
10622
10623 pub fn set_schema<T>(mut self, v: T) -> Self
10627 where
10628 T: std::convert::Into<crate::model::Schema>,
10629 {
10630 self.0.request.schema = std::option::Option::Some(v.into());
10631 self
10632 }
10633
10634 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10638 where
10639 T: std::convert::Into<crate::model::Schema>,
10640 {
10641 self.0.request.schema = v.map(|x| x.into());
10642 self
10643 }
10644
10645 pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
10649 self.0.request.schema_id = v.into();
10650 self
10651 }
10652 }
10653
10654 #[doc(hidden)]
10655 impl gax::options::internal::RequestBuilder for CreateSchema {
10656 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10657 &mut self.0.options
10658 }
10659 }
10660
10661 #[derive(Clone, Debug)]
10680 pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
10681
10682 impl UpdateSchema {
10683 pub(crate) fn new(
10684 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10685 ) -> Self {
10686 Self(RequestBuilder::new(stub))
10687 }
10688
10689 pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
10691 self.0.request = v.into();
10692 self
10693 }
10694
10695 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10697 self.0.options = v.into();
10698 self
10699 }
10700
10701 pub async fn send(self) -> Result<longrunning::model::Operation> {
10708 (*self.0.stub)
10709 .update_schema(self.0.request, self.0.options)
10710 .await
10711 .map(gax::response::Response::into_body)
10712 }
10713
10714 pub fn poller(
10716 self,
10717 ) -> impl lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata> {
10718 type Operation =
10719 lro::internal::Operation<crate::model::Schema, crate::model::UpdateSchemaMetadata>;
10720 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10721 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10722
10723 let stub = self.0.stub.clone();
10724 let mut options = self.0.options.clone();
10725 options.set_retry_policy(gax::retry_policy::NeverRetry);
10726 let query = move |name| {
10727 let stub = stub.clone();
10728 let options = options.clone();
10729 async {
10730 let op = GetOperation::new(stub)
10731 .set_name(name)
10732 .with_options(options)
10733 .send()
10734 .await?;
10735 Ok(Operation::new(op))
10736 }
10737 };
10738
10739 let start = move || async {
10740 let op = self.send().await?;
10741 Ok(Operation::new(op))
10742 };
10743
10744 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10745 }
10746
10747 pub fn set_schema<T>(mut self, v: T) -> Self
10751 where
10752 T: std::convert::Into<crate::model::Schema>,
10753 {
10754 self.0.request.schema = std::option::Option::Some(v.into());
10755 self
10756 }
10757
10758 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10762 where
10763 T: std::convert::Into<crate::model::Schema>,
10764 {
10765 self.0.request.schema = v.map(|x| x.into());
10766 self
10767 }
10768
10769 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
10771 self.0.request.allow_missing = v.into();
10772 self
10773 }
10774 }
10775
10776 #[doc(hidden)]
10777 impl gax::options::internal::RequestBuilder for UpdateSchema {
10778 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10779 &mut self.0.options
10780 }
10781 }
10782
10783 #[derive(Clone, Debug)]
10802 pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
10803
10804 impl DeleteSchema {
10805 pub(crate) fn new(
10806 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10807 ) -> Self {
10808 Self(RequestBuilder::new(stub))
10809 }
10810
10811 pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
10813 self.0.request = v.into();
10814 self
10815 }
10816
10817 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10819 self.0.options = v.into();
10820 self
10821 }
10822
10823 pub async fn send(self) -> Result<longrunning::model::Operation> {
10830 (*self.0.stub)
10831 .delete_schema(self.0.request, self.0.options)
10832 .await
10833 .map(gax::response::Response::into_body)
10834 }
10835
10836 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteSchemaMetadata> {
10838 type Operation =
10839 lro::internal::Operation<wkt::Empty, crate::model::DeleteSchemaMetadata>;
10840 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10841 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10842
10843 let stub = self.0.stub.clone();
10844 let mut options = self.0.options.clone();
10845 options.set_retry_policy(gax::retry_policy::NeverRetry);
10846 let query = move |name| {
10847 let stub = stub.clone();
10848 let options = options.clone();
10849 async {
10850 let op = GetOperation::new(stub)
10851 .set_name(name)
10852 .with_options(options)
10853 .send()
10854 .await?;
10855 Ok(Operation::new(op))
10856 }
10857 };
10858
10859 let start = move || async {
10860 let op = self.send().await?;
10861 Ok(Operation::new(op))
10862 };
10863
10864 lro::internal::new_unit_response_poller(
10865 polling_error_policy,
10866 polling_backoff_policy,
10867 start,
10868 query,
10869 )
10870 }
10871
10872 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10876 self.0.request.name = v.into();
10877 self
10878 }
10879 }
10880
10881 #[doc(hidden)]
10882 impl gax::options::internal::RequestBuilder for DeleteSchema {
10883 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10884 &mut self.0.options
10885 }
10886 }
10887
10888 #[derive(Clone, Debug)]
10910 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
10911
10912 impl ListOperations {
10913 pub(crate) fn new(
10914 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10915 ) -> Self {
10916 Self(RequestBuilder::new(stub))
10917 }
10918
10919 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
10921 mut self,
10922 v: V,
10923 ) -> Self {
10924 self.0.request = v.into();
10925 self
10926 }
10927
10928 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10930 self.0.options = v.into();
10931 self
10932 }
10933
10934 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10936 (*self.0.stub)
10937 .list_operations(self.0.request, self.0.options)
10938 .await
10939 .map(gax::response::Response::into_body)
10940 }
10941
10942 pub fn by_page(
10944 self,
10945 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10946 {
10947 use std::clone::Clone;
10948 let token = self.0.request.page_token.clone();
10949 let execute = move |token: String| {
10950 let mut builder = self.clone();
10951 builder.0.request = builder.0.request.set_page_token(token);
10952 builder.send()
10953 };
10954 gax::paginator::internal::new_paginator(token, execute)
10955 }
10956
10957 pub fn by_item(
10959 self,
10960 ) -> impl gax::paginator::ItemPaginator<
10961 longrunning::model::ListOperationsResponse,
10962 gax::error::Error,
10963 > {
10964 use gax::paginator::Paginator;
10965 self.by_page().items()
10966 }
10967
10968 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10970 self.0.request.name = v.into();
10971 self
10972 }
10973
10974 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10976 self.0.request.filter = v.into();
10977 self
10978 }
10979
10980 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10982 self.0.request.page_size = v.into();
10983 self
10984 }
10985
10986 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10988 self.0.request.page_token = v.into();
10989 self
10990 }
10991
10992 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10994 self.0.request.return_partial_success = v.into();
10995 self
10996 }
10997 }
10998
10999 #[doc(hidden)]
11000 impl gax::options::internal::RequestBuilder for ListOperations {
11001 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11002 &mut self.0.options
11003 }
11004 }
11005
11006 #[derive(Clone, Debug)]
11024 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
11025
11026 impl GetOperation {
11027 pub(crate) fn new(
11028 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11029 ) -> Self {
11030 Self(RequestBuilder::new(stub))
11031 }
11032
11033 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
11035 mut self,
11036 v: V,
11037 ) -> Self {
11038 self.0.request = v.into();
11039 self
11040 }
11041
11042 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11044 self.0.options = v.into();
11045 self
11046 }
11047
11048 pub async fn send(self) -> Result<longrunning::model::Operation> {
11050 (*self.0.stub)
11051 .get_operation(self.0.request, self.0.options)
11052 .await
11053 .map(gax::response::Response::into_body)
11054 }
11055
11056 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11058 self.0.request.name = v.into();
11059 self
11060 }
11061 }
11062
11063 #[doc(hidden)]
11064 impl gax::options::internal::RequestBuilder for GetOperation {
11065 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11066 &mut self.0.options
11067 }
11068 }
11069
11070 #[derive(Clone, Debug)]
11088 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
11089
11090 impl CancelOperation {
11091 pub(crate) fn new(
11092 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11093 ) -> Self {
11094 Self(RequestBuilder::new(stub))
11095 }
11096
11097 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
11099 mut self,
11100 v: V,
11101 ) -> Self {
11102 self.0.request = v.into();
11103 self
11104 }
11105
11106 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11108 self.0.options = v.into();
11109 self
11110 }
11111
11112 pub async fn send(self) -> Result<()> {
11114 (*self.0.stub)
11115 .cancel_operation(self.0.request, self.0.options)
11116 .await
11117 .map(gax::response::Response::into_body)
11118 }
11119
11120 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11122 self.0.request.name = v.into();
11123 self
11124 }
11125 }
11126
11127 #[doc(hidden)]
11128 impl gax::options::internal::RequestBuilder for CancelOperation {
11129 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11130 &mut self.0.options
11131 }
11132 }
11133}
11134
11135#[cfg(feature = "search-service")]
11136#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11137pub mod search_service {
11138 use crate::Result;
11139
11140 pub type ClientBuilder =
11154 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11155
11156 pub(crate) mod client {
11157 use super::super::super::client::SearchService;
11158 pub struct Factory;
11159 impl gax::client_builder::internal::ClientFactory for Factory {
11160 type Client = SearchService;
11161 type Credentials = gaxi::options::Credentials;
11162 async fn build(
11163 self,
11164 config: gaxi::options::ClientConfig,
11165 ) -> gax::client_builder::Result<Self::Client> {
11166 Self::Client::new(config).await
11167 }
11168 }
11169 }
11170
11171 #[derive(Clone, Debug)]
11173 pub(crate) struct RequestBuilder<R: std::default::Default> {
11174 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11175 request: R,
11176 options: gax::options::RequestOptions,
11177 }
11178
11179 impl<R> RequestBuilder<R>
11180 where
11181 R: std::default::Default,
11182 {
11183 pub(crate) fn new(
11184 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11185 ) -> Self {
11186 Self {
11187 stub,
11188 request: R::default(),
11189 options: gax::options::RequestOptions::default(),
11190 }
11191 }
11192 }
11193
11194 #[derive(Clone, Debug)]
11216 pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11217
11218 impl Search {
11219 pub(crate) fn new(
11220 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11221 ) -> Self {
11222 Self(RequestBuilder::new(stub))
11223 }
11224
11225 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11227 self.0.request = v.into();
11228 self
11229 }
11230
11231 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11233 self.0.options = v.into();
11234 self
11235 }
11236
11237 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11239 (*self.0.stub)
11240 .search(self.0.request, self.0.options)
11241 .await
11242 .map(gax::response::Response::into_body)
11243 }
11244
11245 pub fn by_page(
11247 self,
11248 ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
11249 {
11250 use std::clone::Clone;
11251 let token = self.0.request.page_token.clone();
11252 let execute = move |token: String| {
11253 let mut builder = self.clone();
11254 builder.0.request = builder.0.request.set_page_token(token);
11255 builder.send()
11256 };
11257 gax::paginator::internal::new_paginator(token, execute)
11258 }
11259
11260 pub fn by_item(
11262 self,
11263 ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
11264 {
11265 use gax::paginator::Paginator;
11266 self.by_page().items()
11267 }
11268
11269 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11273 self.0.request.serving_config = v.into();
11274 self
11275 }
11276
11277 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11279 self.0.request.branch = v.into();
11280 self
11281 }
11282
11283 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11285 self.0.request.query = v.into();
11286 self
11287 }
11288
11289 pub fn set_image_query<T>(mut self, v: T) -> Self
11291 where
11292 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11293 {
11294 self.0.request.image_query = std::option::Option::Some(v.into());
11295 self
11296 }
11297
11298 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11300 where
11301 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11302 {
11303 self.0.request.image_query = v.map(|x| x.into());
11304 self
11305 }
11306
11307 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11309 self.0.request.page_size = v.into();
11310 self
11311 }
11312
11313 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11315 self.0.request.page_token = v.into();
11316 self
11317 }
11318
11319 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11321 self.0.request.offset = v.into();
11322 self
11323 }
11324
11325 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11327 self.0.request.one_box_page_size = v.into();
11328 self
11329 }
11330
11331 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11333 where
11334 T: std::iter::IntoIterator<Item = V>,
11335 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11336 {
11337 use std::iter::Iterator;
11338 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11339 self
11340 }
11341
11342 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11344 self.0.request.filter = v.into();
11345 self
11346 }
11347
11348 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11350 self.0.request.canonical_filter = v.into();
11351 self
11352 }
11353
11354 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11356 self.0.request.order_by = v.into();
11357 self
11358 }
11359
11360 pub fn set_user_info<T>(mut self, v: T) -> Self
11362 where
11363 T: std::convert::Into<crate::model::UserInfo>,
11364 {
11365 self.0.request.user_info = std::option::Option::Some(v.into());
11366 self
11367 }
11368
11369 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11371 where
11372 T: std::convert::Into<crate::model::UserInfo>,
11373 {
11374 self.0.request.user_info = v.map(|x| x.into());
11375 self
11376 }
11377
11378 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11380 self.0.request.language_code = v.into();
11381 self
11382 }
11383
11384 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11386 where
11387 T: std::iter::IntoIterator<Item = V>,
11388 V: std::convert::Into<crate::model::search_request::FacetSpec>,
11389 {
11390 use std::iter::Iterator;
11391 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11392 self
11393 }
11394
11395 pub fn set_boost_spec<T>(mut self, v: T) -> Self
11397 where
11398 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11399 {
11400 self.0.request.boost_spec = std::option::Option::Some(v.into());
11401 self
11402 }
11403
11404 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11406 where
11407 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11408 {
11409 self.0.request.boost_spec = v.map(|x| x.into());
11410 self
11411 }
11412
11413 pub fn set_params<T, K, V>(mut self, v: T) -> Self
11415 where
11416 T: std::iter::IntoIterator<Item = (K, V)>,
11417 K: std::convert::Into<std::string::String>,
11418 V: std::convert::Into<wkt::Value>,
11419 {
11420 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11421 self
11422 }
11423
11424 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11426 where
11427 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11428 {
11429 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11430 self
11431 }
11432
11433 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11435 where
11436 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11437 {
11438 self.0.request.query_expansion_spec = v.map(|x| x.into());
11439 self
11440 }
11441
11442 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11444 where
11445 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11446 {
11447 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11448 self
11449 }
11450
11451 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11453 where
11454 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11455 {
11456 self.0.request.spell_correction_spec = v.map(|x| x.into());
11457 self
11458 }
11459
11460 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11462 self.0.request.user_pseudo_id = v.into();
11463 self
11464 }
11465
11466 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11468 where
11469 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11470 {
11471 self.0.request.content_search_spec = std::option::Option::Some(v.into());
11472 self
11473 }
11474
11475 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11477 where
11478 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11479 {
11480 self.0.request.content_search_spec = v.map(|x| x.into());
11481 self
11482 }
11483
11484 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11486 self.0.request.safe_search = v.into();
11487 self
11488 }
11489
11490 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11492 where
11493 T: std::iter::IntoIterator<Item = (K, V)>,
11494 K: std::convert::Into<std::string::String>,
11495 V: std::convert::Into<std::string::String>,
11496 {
11497 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11498 self
11499 }
11500
11501 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11503 where
11504 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11505 {
11506 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11507 self
11508 }
11509
11510 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11512 where
11513 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11514 {
11515 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11516 self
11517 }
11518
11519 pub fn set_display_spec<T>(mut self, v: T) -> Self
11521 where
11522 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11523 {
11524 self.0.request.display_spec = std::option::Option::Some(v.into());
11525 self
11526 }
11527
11528 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11530 where
11531 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11532 {
11533 self.0.request.display_spec = v.map(|x| x.into());
11534 self
11535 }
11536
11537 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11539 self.0.request.session = v.into();
11540 self
11541 }
11542
11543 pub fn set_session_spec<T>(mut self, v: T) -> Self
11545 where
11546 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11547 {
11548 self.0.request.session_spec = std::option::Option::Some(v.into());
11549 self
11550 }
11551
11552 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11554 where
11555 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11556 {
11557 self.0.request.session_spec = v.map(|x| x.into());
11558 self
11559 }
11560
11561 pub fn set_relevance_threshold<
11563 T: Into<crate::model::search_request::RelevanceThreshold>,
11564 >(
11565 mut self,
11566 v: T,
11567 ) -> Self {
11568 self.0.request.relevance_threshold = v.into();
11569 self
11570 }
11571
11572 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11574 where
11575 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11576 {
11577 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11578 self
11579 }
11580
11581 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11583 where
11584 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11585 {
11586 self.0.request.relevance_score_spec = v.map(|x| x.into());
11587 self
11588 }
11589
11590 pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
11592 self.0.request.ranking_expression = v.into();
11593 self
11594 }
11595
11596 pub fn set_ranking_expression_backend<
11598 T: Into<crate::model::search_request::RankingExpressionBackend>,
11599 >(
11600 mut self,
11601 v: T,
11602 ) -> Self {
11603 self.0.request.ranking_expression_backend = v.into();
11604 self
11605 }
11606 }
11607
11608 #[doc(hidden)]
11609 impl gax::options::internal::RequestBuilder for Search {
11610 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11611 &mut self.0.options
11612 }
11613 }
11614
11615 #[derive(Clone, Debug)]
11637 pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11638
11639 impl SearchLite {
11640 pub(crate) fn new(
11641 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11642 ) -> Self {
11643 Self(RequestBuilder::new(stub))
11644 }
11645
11646 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11648 self.0.request = v.into();
11649 self
11650 }
11651
11652 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11654 self.0.options = v.into();
11655 self
11656 }
11657
11658 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11660 (*self.0.stub)
11661 .search_lite(self.0.request, self.0.options)
11662 .await
11663 .map(gax::response::Response::into_body)
11664 }
11665
11666 pub fn by_page(
11668 self,
11669 ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
11670 {
11671 use std::clone::Clone;
11672 let token = self.0.request.page_token.clone();
11673 let execute = move |token: String| {
11674 let mut builder = self.clone();
11675 builder.0.request = builder.0.request.set_page_token(token);
11676 builder.send()
11677 };
11678 gax::paginator::internal::new_paginator(token, execute)
11679 }
11680
11681 pub fn by_item(
11683 self,
11684 ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
11685 {
11686 use gax::paginator::Paginator;
11687 self.by_page().items()
11688 }
11689
11690 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11694 self.0.request.serving_config = v.into();
11695 self
11696 }
11697
11698 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11700 self.0.request.branch = v.into();
11701 self
11702 }
11703
11704 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11706 self.0.request.query = v.into();
11707 self
11708 }
11709
11710 pub fn set_image_query<T>(mut self, v: T) -> Self
11712 where
11713 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11714 {
11715 self.0.request.image_query = std::option::Option::Some(v.into());
11716 self
11717 }
11718
11719 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11721 where
11722 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11723 {
11724 self.0.request.image_query = v.map(|x| x.into());
11725 self
11726 }
11727
11728 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11730 self.0.request.page_size = v.into();
11731 self
11732 }
11733
11734 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11736 self.0.request.page_token = v.into();
11737 self
11738 }
11739
11740 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11742 self.0.request.offset = v.into();
11743 self
11744 }
11745
11746 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11748 self.0.request.one_box_page_size = v.into();
11749 self
11750 }
11751
11752 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11754 where
11755 T: std::iter::IntoIterator<Item = V>,
11756 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11757 {
11758 use std::iter::Iterator;
11759 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11760 self
11761 }
11762
11763 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11765 self.0.request.filter = v.into();
11766 self
11767 }
11768
11769 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11771 self.0.request.canonical_filter = v.into();
11772 self
11773 }
11774
11775 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11777 self.0.request.order_by = v.into();
11778 self
11779 }
11780
11781 pub fn set_user_info<T>(mut self, v: T) -> Self
11783 where
11784 T: std::convert::Into<crate::model::UserInfo>,
11785 {
11786 self.0.request.user_info = std::option::Option::Some(v.into());
11787 self
11788 }
11789
11790 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11792 where
11793 T: std::convert::Into<crate::model::UserInfo>,
11794 {
11795 self.0.request.user_info = v.map(|x| x.into());
11796 self
11797 }
11798
11799 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11801 self.0.request.language_code = v.into();
11802 self
11803 }
11804
11805 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11807 where
11808 T: std::iter::IntoIterator<Item = V>,
11809 V: std::convert::Into<crate::model::search_request::FacetSpec>,
11810 {
11811 use std::iter::Iterator;
11812 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11813 self
11814 }
11815
11816 pub fn set_boost_spec<T>(mut self, v: T) -> Self
11818 where
11819 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11820 {
11821 self.0.request.boost_spec = std::option::Option::Some(v.into());
11822 self
11823 }
11824
11825 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11827 where
11828 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11829 {
11830 self.0.request.boost_spec = v.map(|x| x.into());
11831 self
11832 }
11833
11834 pub fn set_params<T, K, V>(mut self, v: T) -> Self
11836 where
11837 T: std::iter::IntoIterator<Item = (K, V)>,
11838 K: std::convert::Into<std::string::String>,
11839 V: std::convert::Into<wkt::Value>,
11840 {
11841 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11842 self
11843 }
11844
11845 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11847 where
11848 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11849 {
11850 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11851 self
11852 }
11853
11854 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11856 where
11857 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11858 {
11859 self.0.request.query_expansion_spec = v.map(|x| x.into());
11860 self
11861 }
11862
11863 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11865 where
11866 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11867 {
11868 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11869 self
11870 }
11871
11872 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11874 where
11875 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11876 {
11877 self.0.request.spell_correction_spec = v.map(|x| x.into());
11878 self
11879 }
11880
11881 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11883 self.0.request.user_pseudo_id = v.into();
11884 self
11885 }
11886
11887 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11889 where
11890 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11891 {
11892 self.0.request.content_search_spec = std::option::Option::Some(v.into());
11893 self
11894 }
11895
11896 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11898 where
11899 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11900 {
11901 self.0.request.content_search_spec = v.map(|x| x.into());
11902 self
11903 }
11904
11905 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11907 self.0.request.safe_search = v.into();
11908 self
11909 }
11910
11911 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11913 where
11914 T: std::iter::IntoIterator<Item = (K, V)>,
11915 K: std::convert::Into<std::string::String>,
11916 V: std::convert::Into<std::string::String>,
11917 {
11918 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11919 self
11920 }
11921
11922 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11924 where
11925 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11926 {
11927 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11928 self
11929 }
11930
11931 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11933 where
11934 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11935 {
11936 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11937 self
11938 }
11939
11940 pub fn set_display_spec<T>(mut self, v: T) -> Self
11942 where
11943 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11944 {
11945 self.0.request.display_spec = std::option::Option::Some(v.into());
11946 self
11947 }
11948
11949 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11951 where
11952 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11953 {
11954 self.0.request.display_spec = v.map(|x| x.into());
11955 self
11956 }
11957
11958 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11960 self.0.request.session = v.into();
11961 self
11962 }
11963
11964 pub fn set_session_spec<T>(mut self, v: T) -> Self
11966 where
11967 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11968 {
11969 self.0.request.session_spec = std::option::Option::Some(v.into());
11970 self
11971 }
11972
11973 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11975 where
11976 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11977 {
11978 self.0.request.session_spec = v.map(|x| x.into());
11979 self
11980 }
11981
11982 pub fn set_relevance_threshold<
11984 T: Into<crate::model::search_request::RelevanceThreshold>,
11985 >(
11986 mut self,
11987 v: T,
11988 ) -> Self {
11989 self.0.request.relevance_threshold = v.into();
11990 self
11991 }
11992
11993 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11995 where
11996 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11997 {
11998 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11999 self
12000 }
12001
12002 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
12004 where
12005 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
12006 {
12007 self.0.request.relevance_score_spec = v.map(|x| x.into());
12008 self
12009 }
12010
12011 pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
12013 self.0.request.ranking_expression = v.into();
12014 self
12015 }
12016
12017 pub fn set_ranking_expression_backend<
12019 T: Into<crate::model::search_request::RankingExpressionBackend>,
12020 >(
12021 mut self,
12022 v: T,
12023 ) -> Self {
12024 self.0.request.ranking_expression_backend = v.into();
12025 self
12026 }
12027 }
12028
12029 #[doc(hidden)]
12030 impl gax::options::internal::RequestBuilder for SearchLite {
12031 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12032 &mut self.0.options
12033 }
12034 }
12035
12036 #[derive(Clone, Debug)]
12058 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12059
12060 impl ListOperations {
12061 pub(crate) fn new(
12062 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12063 ) -> Self {
12064 Self(RequestBuilder::new(stub))
12065 }
12066
12067 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12069 mut self,
12070 v: V,
12071 ) -> Self {
12072 self.0.request = v.into();
12073 self
12074 }
12075
12076 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12078 self.0.options = v.into();
12079 self
12080 }
12081
12082 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12084 (*self.0.stub)
12085 .list_operations(self.0.request, self.0.options)
12086 .await
12087 .map(gax::response::Response::into_body)
12088 }
12089
12090 pub fn by_page(
12092 self,
12093 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12094 {
12095 use std::clone::Clone;
12096 let token = self.0.request.page_token.clone();
12097 let execute = move |token: String| {
12098 let mut builder = self.clone();
12099 builder.0.request = builder.0.request.set_page_token(token);
12100 builder.send()
12101 };
12102 gax::paginator::internal::new_paginator(token, execute)
12103 }
12104
12105 pub fn by_item(
12107 self,
12108 ) -> impl gax::paginator::ItemPaginator<
12109 longrunning::model::ListOperationsResponse,
12110 gax::error::Error,
12111 > {
12112 use gax::paginator::Paginator;
12113 self.by_page().items()
12114 }
12115
12116 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12118 self.0.request.name = v.into();
12119 self
12120 }
12121
12122 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12124 self.0.request.filter = v.into();
12125 self
12126 }
12127
12128 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12130 self.0.request.page_size = v.into();
12131 self
12132 }
12133
12134 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12136 self.0.request.page_token = v.into();
12137 self
12138 }
12139
12140 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12142 self.0.request.return_partial_success = v.into();
12143 self
12144 }
12145 }
12146
12147 #[doc(hidden)]
12148 impl gax::options::internal::RequestBuilder for ListOperations {
12149 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12150 &mut self.0.options
12151 }
12152 }
12153
12154 #[derive(Clone, Debug)]
12172 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12173
12174 impl GetOperation {
12175 pub(crate) fn new(
12176 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12177 ) -> Self {
12178 Self(RequestBuilder::new(stub))
12179 }
12180
12181 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12183 mut self,
12184 v: V,
12185 ) -> Self {
12186 self.0.request = v.into();
12187 self
12188 }
12189
12190 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12192 self.0.options = v.into();
12193 self
12194 }
12195
12196 pub async fn send(self) -> Result<longrunning::model::Operation> {
12198 (*self.0.stub)
12199 .get_operation(self.0.request, self.0.options)
12200 .await
12201 .map(gax::response::Response::into_body)
12202 }
12203
12204 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12206 self.0.request.name = v.into();
12207 self
12208 }
12209 }
12210
12211 #[doc(hidden)]
12212 impl gax::options::internal::RequestBuilder for GetOperation {
12213 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12214 &mut self.0.options
12215 }
12216 }
12217
12218 #[derive(Clone, Debug)]
12236 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12237
12238 impl CancelOperation {
12239 pub(crate) fn new(
12240 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12241 ) -> Self {
12242 Self(RequestBuilder::new(stub))
12243 }
12244
12245 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12247 mut self,
12248 v: V,
12249 ) -> Self {
12250 self.0.request = v.into();
12251 self
12252 }
12253
12254 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12256 self.0.options = v.into();
12257 self
12258 }
12259
12260 pub async fn send(self) -> Result<()> {
12262 (*self.0.stub)
12263 .cancel_operation(self.0.request, self.0.options)
12264 .await
12265 .map(gax::response::Response::into_body)
12266 }
12267
12268 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12270 self.0.request.name = v.into();
12271 self
12272 }
12273 }
12274
12275 #[doc(hidden)]
12276 impl gax::options::internal::RequestBuilder for CancelOperation {
12277 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12278 &mut self.0.options
12279 }
12280 }
12281}
12282
12283#[cfg(feature = "search-tuning-service")]
12284#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12285pub mod search_tuning_service {
12286 use crate::Result;
12287
12288 pub type ClientBuilder =
12302 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12303
12304 pub(crate) mod client {
12305 use super::super::super::client::SearchTuningService;
12306 pub struct Factory;
12307 impl gax::client_builder::internal::ClientFactory for Factory {
12308 type Client = SearchTuningService;
12309 type Credentials = gaxi::options::Credentials;
12310 async fn build(
12311 self,
12312 config: gaxi::options::ClientConfig,
12313 ) -> gax::client_builder::Result<Self::Client> {
12314 Self::Client::new(config).await
12315 }
12316 }
12317 }
12318
12319 #[derive(Clone, Debug)]
12321 pub(crate) struct RequestBuilder<R: std::default::Default> {
12322 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12323 request: R,
12324 options: gax::options::RequestOptions,
12325 }
12326
12327 impl<R> RequestBuilder<R>
12328 where
12329 R: std::default::Default,
12330 {
12331 pub(crate) fn new(
12332 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12333 ) -> Self {
12334 Self {
12335 stub,
12336 request: R::default(),
12337 options: gax::options::RequestOptions::default(),
12338 }
12339 }
12340 }
12341
12342 #[derive(Clone, Debug)]
12361 pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12362
12363 impl TrainCustomModel {
12364 pub(crate) fn new(
12365 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12366 ) -> Self {
12367 Self(RequestBuilder::new(stub))
12368 }
12369
12370 pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12372 mut self,
12373 v: V,
12374 ) -> Self {
12375 self.0.request = v.into();
12376 self
12377 }
12378
12379 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12381 self.0.options = v.into();
12382 self
12383 }
12384
12385 pub async fn send(self) -> Result<longrunning::model::Operation> {
12392 (*self.0.stub)
12393 .train_custom_model(self.0.request, self.0.options)
12394 .await
12395 .map(gax::response::Response::into_body)
12396 }
12397
12398 pub fn poller(
12400 self,
12401 ) -> impl lro::Poller<
12402 crate::model::TrainCustomModelResponse,
12403 crate::model::TrainCustomModelMetadata,
12404 > {
12405 type Operation = lro::internal::Operation<
12406 crate::model::TrainCustomModelResponse,
12407 crate::model::TrainCustomModelMetadata,
12408 >;
12409 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12410 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12411
12412 let stub = self.0.stub.clone();
12413 let mut options = self.0.options.clone();
12414 options.set_retry_policy(gax::retry_policy::NeverRetry);
12415 let query = move |name| {
12416 let stub = stub.clone();
12417 let options = options.clone();
12418 async {
12419 let op = GetOperation::new(stub)
12420 .set_name(name)
12421 .with_options(options)
12422 .send()
12423 .await?;
12424 Ok(Operation::new(op))
12425 }
12426 };
12427
12428 let start = move || async {
12429 let op = self.send().await?;
12430 Ok(Operation::new(op))
12431 };
12432
12433 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
12434 }
12435
12436 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12440 self.0.request.data_store = v.into();
12441 self
12442 }
12443
12444 pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12446 self.0.request.model_type = v.into();
12447 self
12448 }
12449
12450 pub fn set_error_config<T>(mut self, v: T) -> Self
12452 where
12453 T: std::convert::Into<crate::model::ImportErrorConfig>,
12454 {
12455 self.0.request.error_config = std::option::Option::Some(v.into());
12456 self
12457 }
12458
12459 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12461 where
12462 T: std::convert::Into<crate::model::ImportErrorConfig>,
12463 {
12464 self.0.request.error_config = v.map(|x| x.into());
12465 self
12466 }
12467
12468 pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12470 self.0.request.model_id = v.into();
12471 self
12472 }
12473
12474 pub fn set_training_input<
12479 T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12480 >(
12481 mut self,
12482 v: T,
12483 ) -> Self {
12484 self.0.request.training_input = v.into();
12485 self
12486 }
12487
12488 pub fn set_gcs_training_input<
12494 T: std::convert::Into<
12495 std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12496 >,
12497 >(
12498 mut self,
12499 v: T,
12500 ) -> Self {
12501 self.0.request = self.0.request.set_gcs_training_input(v);
12502 self
12503 }
12504 }
12505
12506 #[doc(hidden)]
12507 impl gax::options::internal::RequestBuilder for TrainCustomModel {
12508 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12509 &mut self.0.options
12510 }
12511 }
12512
12513 #[derive(Clone, Debug)]
12531 pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12532
12533 impl ListCustomModels {
12534 pub(crate) fn new(
12535 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12536 ) -> Self {
12537 Self(RequestBuilder::new(stub))
12538 }
12539
12540 pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12542 mut self,
12543 v: V,
12544 ) -> Self {
12545 self.0.request = v.into();
12546 self
12547 }
12548
12549 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12551 self.0.options = v.into();
12552 self
12553 }
12554
12555 pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12557 (*self.0.stub)
12558 .list_custom_models(self.0.request, self.0.options)
12559 .await
12560 .map(gax::response::Response::into_body)
12561 }
12562
12563 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12567 self.0.request.data_store = v.into();
12568 self
12569 }
12570 }
12571
12572 #[doc(hidden)]
12573 impl gax::options::internal::RequestBuilder for ListCustomModels {
12574 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12575 &mut self.0.options
12576 }
12577 }
12578
12579 #[derive(Clone, Debug)]
12601 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12602
12603 impl ListOperations {
12604 pub(crate) fn new(
12605 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12606 ) -> Self {
12607 Self(RequestBuilder::new(stub))
12608 }
12609
12610 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12612 mut self,
12613 v: V,
12614 ) -> Self {
12615 self.0.request = v.into();
12616 self
12617 }
12618
12619 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12621 self.0.options = v.into();
12622 self
12623 }
12624
12625 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12627 (*self.0.stub)
12628 .list_operations(self.0.request, self.0.options)
12629 .await
12630 .map(gax::response::Response::into_body)
12631 }
12632
12633 pub fn by_page(
12635 self,
12636 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12637 {
12638 use std::clone::Clone;
12639 let token = self.0.request.page_token.clone();
12640 let execute = move |token: String| {
12641 let mut builder = self.clone();
12642 builder.0.request = builder.0.request.set_page_token(token);
12643 builder.send()
12644 };
12645 gax::paginator::internal::new_paginator(token, execute)
12646 }
12647
12648 pub fn by_item(
12650 self,
12651 ) -> impl gax::paginator::ItemPaginator<
12652 longrunning::model::ListOperationsResponse,
12653 gax::error::Error,
12654 > {
12655 use gax::paginator::Paginator;
12656 self.by_page().items()
12657 }
12658
12659 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12661 self.0.request.name = v.into();
12662 self
12663 }
12664
12665 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12667 self.0.request.filter = v.into();
12668 self
12669 }
12670
12671 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12673 self.0.request.page_size = v.into();
12674 self
12675 }
12676
12677 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12679 self.0.request.page_token = v.into();
12680 self
12681 }
12682
12683 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12685 self.0.request.return_partial_success = v.into();
12686 self
12687 }
12688 }
12689
12690 #[doc(hidden)]
12691 impl gax::options::internal::RequestBuilder for ListOperations {
12692 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12693 &mut self.0.options
12694 }
12695 }
12696
12697 #[derive(Clone, Debug)]
12715 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12716
12717 impl GetOperation {
12718 pub(crate) fn new(
12719 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12720 ) -> Self {
12721 Self(RequestBuilder::new(stub))
12722 }
12723
12724 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12726 mut self,
12727 v: V,
12728 ) -> Self {
12729 self.0.request = v.into();
12730 self
12731 }
12732
12733 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12735 self.0.options = v.into();
12736 self
12737 }
12738
12739 pub async fn send(self) -> Result<longrunning::model::Operation> {
12741 (*self.0.stub)
12742 .get_operation(self.0.request, self.0.options)
12743 .await
12744 .map(gax::response::Response::into_body)
12745 }
12746
12747 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12749 self.0.request.name = v.into();
12750 self
12751 }
12752 }
12753
12754 #[doc(hidden)]
12755 impl gax::options::internal::RequestBuilder for GetOperation {
12756 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12757 &mut self.0.options
12758 }
12759 }
12760
12761 #[derive(Clone, Debug)]
12779 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12780
12781 impl CancelOperation {
12782 pub(crate) fn new(
12783 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12784 ) -> Self {
12785 Self(RequestBuilder::new(stub))
12786 }
12787
12788 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12790 mut self,
12791 v: V,
12792 ) -> Self {
12793 self.0.request = v.into();
12794 self
12795 }
12796
12797 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12799 self.0.options = v.into();
12800 self
12801 }
12802
12803 pub async fn send(self) -> Result<()> {
12805 (*self.0.stub)
12806 .cancel_operation(self.0.request, self.0.options)
12807 .await
12808 .map(gax::response::Response::into_body)
12809 }
12810
12811 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12813 self.0.request.name = v.into();
12814 self
12815 }
12816 }
12817
12818 #[doc(hidden)]
12819 impl gax::options::internal::RequestBuilder for CancelOperation {
12820 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12821 &mut self.0.options
12822 }
12823 }
12824}
12825
12826#[cfg(feature = "serving-config-service")]
12827#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
12828pub mod serving_config_service {
12829 use crate::Result;
12830
12831 pub type ClientBuilder =
12845 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12846
12847 pub(crate) mod client {
12848 use super::super::super::client::ServingConfigService;
12849 pub struct Factory;
12850 impl gax::client_builder::internal::ClientFactory for Factory {
12851 type Client = ServingConfigService;
12852 type Credentials = gaxi::options::Credentials;
12853 async fn build(
12854 self,
12855 config: gaxi::options::ClientConfig,
12856 ) -> gax::client_builder::Result<Self::Client> {
12857 Self::Client::new(config).await
12858 }
12859 }
12860 }
12861
12862 #[derive(Clone, Debug)]
12864 pub(crate) struct RequestBuilder<R: std::default::Default> {
12865 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12866 request: R,
12867 options: gax::options::RequestOptions,
12868 }
12869
12870 impl<R> RequestBuilder<R>
12871 where
12872 R: std::default::Default,
12873 {
12874 pub(crate) fn new(
12875 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12876 ) -> Self {
12877 Self {
12878 stub,
12879 request: R::default(),
12880 options: gax::options::RequestOptions::default(),
12881 }
12882 }
12883 }
12884
12885 #[derive(Clone, Debug)]
12903 pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
12904
12905 impl UpdateServingConfig {
12906 pub(crate) fn new(
12907 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12908 ) -> Self {
12909 Self(RequestBuilder::new(stub))
12910 }
12911
12912 pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
12914 mut self,
12915 v: V,
12916 ) -> Self {
12917 self.0.request = v.into();
12918 self
12919 }
12920
12921 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12923 self.0.options = v.into();
12924 self
12925 }
12926
12927 pub async fn send(self) -> Result<crate::model::ServingConfig> {
12929 (*self.0.stub)
12930 .update_serving_config(self.0.request, self.0.options)
12931 .await
12932 .map(gax::response::Response::into_body)
12933 }
12934
12935 pub fn set_serving_config<T>(mut self, v: T) -> Self
12939 where
12940 T: std::convert::Into<crate::model::ServingConfig>,
12941 {
12942 self.0.request.serving_config = std::option::Option::Some(v.into());
12943 self
12944 }
12945
12946 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
12950 where
12951 T: std::convert::Into<crate::model::ServingConfig>,
12952 {
12953 self.0.request.serving_config = v.map(|x| x.into());
12954 self
12955 }
12956
12957 pub fn set_update_mask<T>(mut self, v: T) -> Self
12959 where
12960 T: std::convert::Into<wkt::FieldMask>,
12961 {
12962 self.0.request.update_mask = std::option::Option::Some(v.into());
12963 self
12964 }
12965
12966 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12968 where
12969 T: std::convert::Into<wkt::FieldMask>,
12970 {
12971 self.0.request.update_mask = v.map(|x| x.into());
12972 self
12973 }
12974 }
12975
12976 #[doc(hidden)]
12977 impl gax::options::internal::RequestBuilder for UpdateServingConfig {
12978 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12979 &mut self.0.options
12980 }
12981 }
12982
12983 #[derive(Clone, Debug)]
13005 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
13006
13007 impl ListOperations {
13008 pub(crate) fn new(
13009 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13010 ) -> Self {
13011 Self(RequestBuilder::new(stub))
13012 }
13013
13014 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
13016 mut self,
13017 v: V,
13018 ) -> Self {
13019 self.0.request = v.into();
13020 self
13021 }
13022
13023 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13025 self.0.options = v.into();
13026 self
13027 }
13028
13029 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
13031 (*self.0.stub)
13032 .list_operations(self.0.request, self.0.options)
13033 .await
13034 .map(gax::response::Response::into_body)
13035 }
13036
13037 pub fn by_page(
13039 self,
13040 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
13041 {
13042 use std::clone::Clone;
13043 let token = self.0.request.page_token.clone();
13044 let execute = move |token: String| {
13045 let mut builder = self.clone();
13046 builder.0.request = builder.0.request.set_page_token(token);
13047 builder.send()
13048 };
13049 gax::paginator::internal::new_paginator(token, execute)
13050 }
13051
13052 pub fn by_item(
13054 self,
13055 ) -> impl gax::paginator::ItemPaginator<
13056 longrunning::model::ListOperationsResponse,
13057 gax::error::Error,
13058 > {
13059 use gax::paginator::Paginator;
13060 self.by_page().items()
13061 }
13062
13063 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13065 self.0.request.name = v.into();
13066 self
13067 }
13068
13069 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13071 self.0.request.filter = v.into();
13072 self
13073 }
13074
13075 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13077 self.0.request.page_size = v.into();
13078 self
13079 }
13080
13081 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13083 self.0.request.page_token = v.into();
13084 self
13085 }
13086
13087 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13089 self.0.request.return_partial_success = v.into();
13090 self
13091 }
13092 }
13093
13094 #[doc(hidden)]
13095 impl gax::options::internal::RequestBuilder for ListOperations {
13096 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13097 &mut self.0.options
13098 }
13099 }
13100
13101 #[derive(Clone, Debug)]
13119 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
13120
13121 impl GetOperation {
13122 pub(crate) fn new(
13123 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13124 ) -> Self {
13125 Self(RequestBuilder::new(stub))
13126 }
13127
13128 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
13130 mut self,
13131 v: V,
13132 ) -> Self {
13133 self.0.request = v.into();
13134 self
13135 }
13136
13137 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13139 self.0.options = v.into();
13140 self
13141 }
13142
13143 pub async fn send(self) -> Result<longrunning::model::Operation> {
13145 (*self.0.stub)
13146 .get_operation(self.0.request, self.0.options)
13147 .await
13148 .map(gax::response::Response::into_body)
13149 }
13150
13151 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13153 self.0.request.name = v.into();
13154 self
13155 }
13156 }
13157
13158 #[doc(hidden)]
13159 impl gax::options::internal::RequestBuilder for GetOperation {
13160 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13161 &mut self.0.options
13162 }
13163 }
13164
13165 #[derive(Clone, Debug)]
13183 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13184
13185 impl CancelOperation {
13186 pub(crate) fn new(
13187 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13188 ) -> Self {
13189 Self(RequestBuilder::new(stub))
13190 }
13191
13192 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13194 mut self,
13195 v: V,
13196 ) -> Self {
13197 self.0.request = v.into();
13198 self
13199 }
13200
13201 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13203 self.0.options = v.into();
13204 self
13205 }
13206
13207 pub async fn send(self) -> Result<()> {
13209 (*self.0.stub)
13210 .cancel_operation(self.0.request, self.0.options)
13211 .await
13212 .map(gax::response::Response::into_body)
13213 }
13214
13215 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13217 self.0.request.name = v.into();
13218 self
13219 }
13220 }
13221
13222 #[doc(hidden)]
13223 impl gax::options::internal::RequestBuilder for CancelOperation {
13224 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13225 &mut self.0.options
13226 }
13227 }
13228}
13229
13230#[cfg(feature = "session-service")]
13231#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13232pub mod session_service {
13233 use crate::Result;
13234
13235 pub type ClientBuilder =
13249 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13250
13251 pub(crate) mod client {
13252 use super::super::super::client::SessionService;
13253 pub struct Factory;
13254 impl gax::client_builder::internal::ClientFactory for Factory {
13255 type Client = SessionService;
13256 type Credentials = gaxi::options::Credentials;
13257 async fn build(
13258 self,
13259 config: gaxi::options::ClientConfig,
13260 ) -> gax::client_builder::Result<Self::Client> {
13261 Self::Client::new(config).await
13262 }
13263 }
13264 }
13265
13266 #[derive(Clone, Debug)]
13268 pub(crate) struct RequestBuilder<R: std::default::Default> {
13269 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13270 request: R,
13271 options: gax::options::RequestOptions,
13272 }
13273
13274 impl<R> RequestBuilder<R>
13275 where
13276 R: std::default::Default,
13277 {
13278 pub(crate) fn new(
13279 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13280 ) -> Self {
13281 Self {
13282 stub,
13283 request: R::default(),
13284 options: gax::options::RequestOptions::default(),
13285 }
13286 }
13287 }
13288
13289 #[derive(Clone, Debug)]
13307 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13308
13309 impl CreateSession {
13310 pub(crate) fn new(
13311 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13312 ) -> Self {
13313 Self(RequestBuilder::new(stub))
13314 }
13315
13316 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13318 self.0.request = v.into();
13319 self
13320 }
13321
13322 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13324 self.0.options = v.into();
13325 self
13326 }
13327
13328 pub async fn send(self) -> Result<crate::model::Session> {
13330 (*self.0.stub)
13331 .create_session(self.0.request, self.0.options)
13332 .await
13333 .map(gax::response::Response::into_body)
13334 }
13335
13336 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13340 self.0.request.parent = v.into();
13341 self
13342 }
13343
13344 pub fn set_session<T>(mut self, v: T) -> Self
13348 where
13349 T: std::convert::Into<crate::model::Session>,
13350 {
13351 self.0.request.session = std::option::Option::Some(v.into());
13352 self
13353 }
13354
13355 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13359 where
13360 T: std::convert::Into<crate::model::Session>,
13361 {
13362 self.0.request.session = v.map(|x| x.into());
13363 self
13364 }
13365 }
13366
13367 #[doc(hidden)]
13368 impl gax::options::internal::RequestBuilder for CreateSession {
13369 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13370 &mut self.0.options
13371 }
13372 }
13373
13374 #[derive(Clone, Debug)]
13392 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13393
13394 impl DeleteSession {
13395 pub(crate) fn new(
13396 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13397 ) -> Self {
13398 Self(RequestBuilder::new(stub))
13399 }
13400
13401 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13403 self.0.request = v.into();
13404 self
13405 }
13406
13407 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13409 self.0.options = v.into();
13410 self
13411 }
13412
13413 pub async fn send(self) -> Result<()> {
13415 (*self.0.stub)
13416 .delete_session(self.0.request, self.0.options)
13417 .await
13418 .map(gax::response::Response::into_body)
13419 }
13420
13421 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13425 self.0.request.name = v.into();
13426 self
13427 }
13428 }
13429
13430 #[doc(hidden)]
13431 impl gax::options::internal::RequestBuilder for DeleteSession {
13432 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13433 &mut self.0.options
13434 }
13435 }
13436
13437 #[derive(Clone, Debug)]
13455 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13456
13457 impl UpdateSession {
13458 pub(crate) fn new(
13459 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13460 ) -> Self {
13461 Self(RequestBuilder::new(stub))
13462 }
13463
13464 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13466 self.0.request = v.into();
13467 self
13468 }
13469
13470 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13472 self.0.options = v.into();
13473 self
13474 }
13475
13476 pub async fn send(self) -> Result<crate::model::Session> {
13478 (*self.0.stub)
13479 .update_session(self.0.request, self.0.options)
13480 .await
13481 .map(gax::response::Response::into_body)
13482 }
13483
13484 pub fn set_session<T>(mut self, v: T) -> Self
13488 where
13489 T: std::convert::Into<crate::model::Session>,
13490 {
13491 self.0.request.session = std::option::Option::Some(v.into());
13492 self
13493 }
13494
13495 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13499 where
13500 T: std::convert::Into<crate::model::Session>,
13501 {
13502 self.0.request.session = v.map(|x| x.into());
13503 self
13504 }
13505
13506 pub fn set_update_mask<T>(mut self, v: T) -> Self
13508 where
13509 T: std::convert::Into<wkt::FieldMask>,
13510 {
13511 self.0.request.update_mask = std::option::Option::Some(v.into());
13512 self
13513 }
13514
13515 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13517 where
13518 T: std::convert::Into<wkt::FieldMask>,
13519 {
13520 self.0.request.update_mask = v.map(|x| x.into());
13521 self
13522 }
13523 }
13524
13525 #[doc(hidden)]
13526 impl gax::options::internal::RequestBuilder for UpdateSession {
13527 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13528 &mut self.0.options
13529 }
13530 }
13531
13532 #[derive(Clone, Debug)]
13550 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13551
13552 impl GetSession {
13553 pub(crate) fn new(
13554 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13555 ) -> Self {
13556 Self(RequestBuilder::new(stub))
13557 }
13558
13559 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13561 self.0.request = v.into();
13562 self
13563 }
13564
13565 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13567 self.0.options = v.into();
13568 self
13569 }
13570
13571 pub async fn send(self) -> Result<crate::model::Session> {
13573 (*self.0.stub)
13574 .get_session(self.0.request, self.0.options)
13575 .await
13576 .map(gax::response::Response::into_body)
13577 }
13578
13579 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13583 self.0.request.name = v.into();
13584 self
13585 }
13586
13587 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13589 self.0.request.include_answer_details = v.into();
13590 self
13591 }
13592 }
13593
13594 #[doc(hidden)]
13595 impl gax::options::internal::RequestBuilder for GetSession {
13596 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13597 &mut self.0.options
13598 }
13599 }
13600
13601 #[derive(Clone, Debug)]
13623 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
13624
13625 impl ListSessions {
13626 pub(crate) fn new(
13627 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13628 ) -> Self {
13629 Self(RequestBuilder::new(stub))
13630 }
13631
13632 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
13634 self.0.request = v.into();
13635 self
13636 }
13637
13638 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13640 self.0.options = v.into();
13641 self
13642 }
13643
13644 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
13646 (*self.0.stub)
13647 .list_sessions(self.0.request, self.0.options)
13648 .await
13649 .map(gax::response::Response::into_body)
13650 }
13651
13652 pub fn by_page(
13654 self,
13655 ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
13656 {
13657 use std::clone::Clone;
13658 let token = self.0.request.page_token.clone();
13659 let execute = move |token: String| {
13660 let mut builder = self.clone();
13661 builder.0.request = builder.0.request.set_page_token(token);
13662 builder.send()
13663 };
13664 gax::paginator::internal::new_paginator(token, execute)
13665 }
13666
13667 pub fn by_item(
13669 self,
13670 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
13671 {
13672 use gax::paginator::Paginator;
13673 self.by_page().items()
13674 }
13675
13676 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13680 self.0.request.parent = v.into();
13681 self
13682 }
13683
13684 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13686 self.0.request.page_size = v.into();
13687 self
13688 }
13689
13690 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13692 self.0.request.page_token = v.into();
13693 self
13694 }
13695
13696 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13698 self.0.request.filter = v.into();
13699 self
13700 }
13701
13702 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
13704 self.0.request.order_by = v.into();
13705 self
13706 }
13707 }
13708
13709 #[doc(hidden)]
13710 impl gax::options::internal::RequestBuilder for ListSessions {
13711 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13712 &mut self.0.options
13713 }
13714 }
13715
13716 #[derive(Clone, Debug)]
13738 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
13739
13740 impl ListOperations {
13741 pub(crate) fn new(
13742 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13743 ) -> Self {
13744 Self(RequestBuilder::new(stub))
13745 }
13746
13747 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
13749 mut self,
13750 v: V,
13751 ) -> Self {
13752 self.0.request = v.into();
13753 self
13754 }
13755
13756 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13758 self.0.options = v.into();
13759 self
13760 }
13761
13762 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
13764 (*self.0.stub)
13765 .list_operations(self.0.request, self.0.options)
13766 .await
13767 .map(gax::response::Response::into_body)
13768 }
13769
13770 pub fn by_page(
13772 self,
13773 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
13774 {
13775 use std::clone::Clone;
13776 let token = self.0.request.page_token.clone();
13777 let execute = move |token: String| {
13778 let mut builder = self.clone();
13779 builder.0.request = builder.0.request.set_page_token(token);
13780 builder.send()
13781 };
13782 gax::paginator::internal::new_paginator(token, execute)
13783 }
13784
13785 pub fn by_item(
13787 self,
13788 ) -> impl gax::paginator::ItemPaginator<
13789 longrunning::model::ListOperationsResponse,
13790 gax::error::Error,
13791 > {
13792 use gax::paginator::Paginator;
13793 self.by_page().items()
13794 }
13795
13796 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13798 self.0.request.name = v.into();
13799 self
13800 }
13801
13802 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13804 self.0.request.filter = v.into();
13805 self
13806 }
13807
13808 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13810 self.0.request.page_size = v.into();
13811 self
13812 }
13813
13814 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13816 self.0.request.page_token = v.into();
13817 self
13818 }
13819
13820 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13822 self.0.request.return_partial_success = v.into();
13823 self
13824 }
13825 }
13826
13827 #[doc(hidden)]
13828 impl gax::options::internal::RequestBuilder for ListOperations {
13829 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13830 &mut self.0.options
13831 }
13832 }
13833
13834 #[derive(Clone, Debug)]
13852 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
13853
13854 impl GetOperation {
13855 pub(crate) fn new(
13856 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13857 ) -> Self {
13858 Self(RequestBuilder::new(stub))
13859 }
13860
13861 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
13863 mut self,
13864 v: V,
13865 ) -> Self {
13866 self.0.request = v.into();
13867 self
13868 }
13869
13870 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13872 self.0.options = v.into();
13873 self
13874 }
13875
13876 pub async fn send(self) -> Result<longrunning::model::Operation> {
13878 (*self.0.stub)
13879 .get_operation(self.0.request, self.0.options)
13880 .await
13881 .map(gax::response::Response::into_body)
13882 }
13883
13884 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13886 self.0.request.name = v.into();
13887 self
13888 }
13889 }
13890
13891 #[doc(hidden)]
13892 impl gax::options::internal::RequestBuilder for GetOperation {
13893 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13894 &mut self.0.options
13895 }
13896 }
13897
13898 #[derive(Clone, Debug)]
13916 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13917
13918 impl CancelOperation {
13919 pub(crate) fn new(
13920 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13921 ) -> Self {
13922 Self(RequestBuilder::new(stub))
13923 }
13924
13925 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13927 mut self,
13928 v: V,
13929 ) -> Self {
13930 self.0.request = v.into();
13931 self
13932 }
13933
13934 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13936 self.0.options = v.into();
13937 self
13938 }
13939
13940 pub async fn send(self) -> Result<()> {
13942 (*self.0.stub)
13943 .cancel_operation(self.0.request, self.0.options)
13944 .await
13945 .map(gax::response::Response::into_body)
13946 }
13947
13948 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13950 self.0.request.name = v.into();
13951 self
13952 }
13953 }
13954
13955 #[doc(hidden)]
13956 impl gax::options::internal::RequestBuilder for CancelOperation {
13957 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13958 &mut self.0.options
13959 }
13960 }
13961}
13962
13963#[cfg(feature = "site-search-engine-service")]
13964#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
13965pub mod site_search_engine_service {
13966 use crate::Result;
13967
13968 pub type ClientBuilder =
13982 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13983
13984 pub(crate) mod client {
13985 use super::super::super::client::SiteSearchEngineService;
13986 pub struct Factory;
13987 impl gax::client_builder::internal::ClientFactory for Factory {
13988 type Client = SiteSearchEngineService;
13989 type Credentials = gaxi::options::Credentials;
13990 async fn build(
13991 self,
13992 config: gaxi::options::ClientConfig,
13993 ) -> gax::client_builder::Result<Self::Client> {
13994 Self::Client::new(config).await
13995 }
13996 }
13997 }
13998
13999 #[derive(Clone, Debug)]
14001 pub(crate) struct RequestBuilder<R: std::default::Default> {
14002 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14003 request: R,
14004 options: gax::options::RequestOptions,
14005 }
14006
14007 impl<R> RequestBuilder<R>
14008 where
14009 R: std::default::Default,
14010 {
14011 pub(crate) fn new(
14012 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14013 ) -> Self {
14014 Self {
14015 stub,
14016 request: R::default(),
14017 options: gax::options::RequestOptions::default(),
14018 }
14019 }
14020 }
14021
14022 #[derive(Clone, Debug)]
14040 pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
14041
14042 impl GetSiteSearchEngine {
14043 pub(crate) fn new(
14044 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14045 ) -> Self {
14046 Self(RequestBuilder::new(stub))
14047 }
14048
14049 pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
14051 mut self,
14052 v: V,
14053 ) -> Self {
14054 self.0.request = v.into();
14055 self
14056 }
14057
14058 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14060 self.0.options = v.into();
14061 self
14062 }
14063
14064 pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
14066 (*self.0.stub)
14067 .get_site_search_engine(self.0.request, self.0.options)
14068 .await
14069 .map(gax::response::Response::into_body)
14070 }
14071
14072 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14076 self.0.request.name = v.into();
14077 self
14078 }
14079 }
14080
14081 #[doc(hidden)]
14082 impl gax::options::internal::RequestBuilder for GetSiteSearchEngine {
14083 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14084 &mut self.0.options
14085 }
14086 }
14087
14088 #[derive(Clone, Debug)]
14107 pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
14108
14109 impl CreateTargetSite {
14110 pub(crate) fn new(
14111 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14112 ) -> Self {
14113 Self(RequestBuilder::new(stub))
14114 }
14115
14116 pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
14118 mut self,
14119 v: V,
14120 ) -> Self {
14121 self.0.request = v.into();
14122 self
14123 }
14124
14125 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14127 self.0.options = v.into();
14128 self
14129 }
14130
14131 pub async fn send(self) -> Result<longrunning::model::Operation> {
14138 (*self.0.stub)
14139 .create_target_site(self.0.request, self.0.options)
14140 .await
14141 .map(gax::response::Response::into_body)
14142 }
14143
14144 pub fn poller(
14146 self,
14147 ) -> impl lro::Poller<crate::model::TargetSite, crate::model::CreateTargetSiteMetadata>
14148 {
14149 type Operation = lro::internal::Operation<
14150 crate::model::TargetSite,
14151 crate::model::CreateTargetSiteMetadata,
14152 >;
14153 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14154 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14155
14156 let stub = self.0.stub.clone();
14157 let mut options = self.0.options.clone();
14158 options.set_retry_policy(gax::retry_policy::NeverRetry);
14159 let query = move |name| {
14160 let stub = stub.clone();
14161 let options = options.clone();
14162 async {
14163 let op = GetOperation::new(stub)
14164 .set_name(name)
14165 .with_options(options)
14166 .send()
14167 .await?;
14168 Ok(Operation::new(op))
14169 }
14170 };
14171
14172 let start = move || async {
14173 let op = self.send().await?;
14174 Ok(Operation::new(op))
14175 };
14176
14177 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14178 }
14179
14180 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14184 self.0.request.parent = v.into();
14185 self
14186 }
14187
14188 pub fn set_target_site<T>(mut self, v: T) -> Self
14192 where
14193 T: std::convert::Into<crate::model::TargetSite>,
14194 {
14195 self.0.request.target_site = std::option::Option::Some(v.into());
14196 self
14197 }
14198
14199 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14203 where
14204 T: std::convert::Into<crate::model::TargetSite>,
14205 {
14206 self.0.request.target_site = v.map(|x| x.into());
14207 self
14208 }
14209 }
14210
14211 #[doc(hidden)]
14212 impl gax::options::internal::RequestBuilder for CreateTargetSite {
14213 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14214 &mut self.0.options
14215 }
14216 }
14217
14218 #[derive(Clone, Debug)]
14237 pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14238
14239 impl BatchCreateTargetSites {
14240 pub(crate) fn new(
14241 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14242 ) -> Self {
14243 Self(RequestBuilder::new(stub))
14244 }
14245
14246 pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14248 mut self,
14249 v: V,
14250 ) -> Self {
14251 self.0.request = v.into();
14252 self
14253 }
14254
14255 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14257 self.0.options = v.into();
14258 self
14259 }
14260
14261 pub async fn send(self) -> Result<longrunning::model::Operation> {
14268 (*self.0.stub)
14269 .batch_create_target_sites(self.0.request, self.0.options)
14270 .await
14271 .map(gax::response::Response::into_body)
14272 }
14273
14274 pub fn poller(
14276 self,
14277 ) -> impl lro::Poller<
14278 crate::model::BatchCreateTargetSitesResponse,
14279 crate::model::BatchCreateTargetSiteMetadata,
14280 > {
14281 type Operation = lro::internal::Operation<
14282 crate::model::BatchCreateTargetSitesResponse,
14283 crate::model::BatchCreateTargetSiteMetadata,
14284 >;
14285 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14286 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14287
14288 let stub = self.0.stub.clone();
14289 let mut options = self.0.options.clone();
14290 options.set_retry_policy(gax::retry_policy::NeverRetry);
14291 let query = move |name| {
14292 let stub = stub.clone();
14293 let options = options.clone();
14294 async {
14295 let op = GetOperation::new(stub)
14296 .set_name(name)
14297 .with_options(options)
14298 .send()
14299 .await?;
14300 Ok(Operation::new(op))
14301 }
14302 };
14303
14304 let start = move || async {
14305 let op = self.send().await?;
14306 Ok(Operation::new(op))
14307 };
14308
14309 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14310 }
14311
14312 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14316 self.0.request.parent = v.into();
14317 self
14318 }
14319
14320 pub fn set_requests<T, V>(mut self, v: T) -> Self
14324 where
14325 T: std::iter::IntoIterator<Item = V>,
14326 V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14327 {
14328 use std::iter::Iterator;
14329 self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14330 self
14331 }
14332 }
14333
14334 #[doc(hidden)]
14335 impl gax::options::internal::RequestBuilder for BatchCreateTargetSites {
14336 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14337 &mut self.0.options
14338 }
14339 }
14340
14341 #[derive(Clone, Debug)]
14359 pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14360
14361 impl GetTargetSite {
14362 pub(crate) fn new(
14363 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14364 ) -> Self {
14365 Self(RequestBuilder::new(stub))
14366 }
14367
14368 pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14370 self.0.request = v.into();
14371 self
14372 }
14373
14374 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14376 self.0.options = v.into();
14377 self
14378 }
14379
14380 pub async fn send(self) -> Result<crate::model::TargetSite> {
14382 (*self.0.stub)
14383 .get_target_site(self.0.request, self.0.options)
14384 .await
14385 .map(gax::response::Response::into_body)
14386 }
14387
14388 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14392 self.0.request.name = v.into();
14393 self
14394 }
14395 }
14396
14397 #[doc(hidden)]
14398 impl gax::options::internal::RequestBuilder for GetTargetSite {
14399 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14400 &mut self.0.options
14401 }
14402 }
14403
14404 #[derive(Clone, Debug)]
14423 pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14424
14425 impl UpdateTargetSite {
14426 pub(crate) fn new(
14427 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14428 ) -> Self {
14429 Self(RequestBuilder::new(stub))
14430 }
14431
14432 pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14434 mut self,
14435 v: V,
14436 ) -> Self {
14437 self.0.request = v.into();
14438 self
14439 }
14440
14441 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14443 self.0.options = v.into();
14444 self
14445 }
14446
14447 pub async fn send(self) -> Result<longrunning::model::Operation> {
14454 (*self.0.stub)
14455 .update_target_site(self.0.request, self.0.options)
14456 .await
14457 .map(gax::response::Response::into_body)
14458 }
14459
14460 pub fn poller(
14462 self,
14463 ) -> impl lro::Poller<crate::model::TargetSite, crate::model::UpdateTargetSiteMetadata>
14464 {
14465 type Operation = lro::internal::Operation<
14466 crate::model::TargetSite,
14467 crate::model::UpdateTargetSiteMetadata,
14468 >;
14469 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14470 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14471
14472 let stub = self.0.stub.clone();
14473 let mut options = self.0.options.clone();
14474 options.set_retry_policy(gax::retry_policy::NeverRetry);
14475 let query = move |name| {
14476 let stub = stub.clone();
14477 let options = options.clone();
14478 async {
14479 let op = GetOperation::new(stub)
14480 .set_name(name)
14481 .with_options(options)
14482 .send()
14483 .await?;
14484 Ok(Operation::new(op))
14485 }
14486 };
14487
14488 let start = move || async {
14489 let op = self.send().await?;
14490 Ok(Operation::new(op))
14491 };
14492
14493 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14494 }
14495
14496 pub fn set_target_site<T>(mut self, v: T) -> Self
14500 where
14501 T: std::convert::Into<crate::model::TargetSite>,
14502 {
14503 self.0.request.target_site = std::option::Option::Some(v.into());
14504 self
14505 }
14506
14507 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14511 where
14512 T: std::convert::Into<crate::model::TargetSite>,
14513 {
14514 self.0.request.target_site = v.map(|x| x.into());
14515 self
14516 }
14517 }
14518
14519 #[doc(hidden)]
14520 impl gax::options::internal::RequestBuilder for UpdateTargetSite {
14521 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14522 &mut self.0.options
14523 }
14524 }
14525
14526 #[derive(Clone, Debug)]
14545 pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14546
14547 impl DeleteTargetSite {
14548 pub(crate) fn new(
14549 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14550 ) -> Self {
14551 Self(RequestBuilder::new(stub))
14552 }
14553
14554 pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14556 mut self,
14557 v: V,
14558 ) -> Self {
14559 self.0.request = v.into();
14560 self
14561 }
14562
14563 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14565 self.0.options = v.into();
14566 self
14567 }
14568
14569 pub async fn send(self) -> Result<longrunning::model::Operation> {
14576 (*self.0.stub)
14577 .delete_target_site(self.0.request, self.0.options)
14578 .await
14579 .map(gax::response::Response::into_body)
14580 }
14581
14582 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
14584 type Operation =
14585 lro::internal::Operation<wkt::Empty, crate::model::DeleteTargetSiteMetadata>;
14586 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14587 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14588
14589 let stub = self.0.stub.clone();
14590 let mut options = self.0.options.clone();
14591 options.set_retry_policy(gax::retry_policy::NeverRetry);
14592 let query = move |name| {
14593 let stub = stub.clone();
14594 let options = options.clone();
14595 async {
14596 let op = GetOperation::new(stub)
14597 .set_name(name)
14598 .with_options(options)
14599 .send()
14600 .await?;
14601 Ok(Operation::new(op))
14602 }
14603 };
14604
14605 let start = move || async {
14606 let op = self.send().await?;
14607 Ok(Operation::new(op))
14608 };
14609
14610 lro::internal::new_unit_response_poller(
14611 polling_error_policy,
14612 polling_backoff_policy,
14613 start,
14614 query,
14615 )
14616 }
14617
14618 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14622 self.0.request.name = v.into();
14623 self
14624 }
14625 }
14626
14627 #[doc(hidden)]
14628 impl gax::options::internal::RequestBuilder for DeleteTargetSite {
14629 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14630 &mut self.0.options
14631 }
14632 }
14633
14634 #[derive(Clone, Debug)]
14656 pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
14657
14658 impl ListTargetSites {
14659 pub(crate) fn new(
14660 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14661 ) -> Self {
14662 Self(RequestBuilder::new(stub))
14663 }
14664
14665 pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
14667 self.0.request = v.into();
14668 self
14669 }
14670
14671 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14673 self.0.options = v.into();
14674 self
14675 }
14676
14677 pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
14679 (*self.0.stub)
14680 .list_target_sites(self.0.request, self.0.options)
14681 .await
14682 .map(gax::response::Response::into_body)
14683 }
14684
14685 pub fn by_page(
14687 self,
14688 ) -> impl gax::paginator::Paginator<crate::model::ListTargetSitesResponse, gax::error::Error>
14689 {
14690 use std::clone::Clone;
14691 let token = self.0.request.page_token.clone();
14692 let execute = move |token: String| {
14693 let mut builder = self.clone();
14694 builder.0.request = builder.0.request.set_page_token(token);
14695 builder.send()
14696 };
14697 gax::paginator::internal::new_paginator(token, execute)
14698 }
14699
14700 pub fn by_item(
14702 self,
14703 ) -> impl gax::paginator::ItemPaginator<crate::model::ListTargetSitesResponse, gax::error::Error>
14704 {
14705 use gax::paginator::Paginator;
14706 self.by_page().items()
14707 }
14708
14709 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14713 self.0.request.parent = v.into();
14714 self
14715 }
14716
14717 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14719 self.0.request.page_size = v.into();
14720 self
14721 }
14722
14723 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14725 self.0.request.page_token = v.into();
14726 self
14727 }
14728 }
14729
14730 #[doc(hidden)]
14731 impl gax::options::internal::RequestBuilder for ListTargetSites {
14732 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14733 &mut self.0.options
14734 }
14735 }
14736
14737 #[derive(Clone, Debug)]
14756 pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
14757
14758 impl CreateSitemap {
14759 pub(crate) fn new(
14760 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14761 ) -> Self {
14762 Self(RequestBuilder::new(stub))
14763 }
14764
14765 pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
14767 self.0.request = v.into();
14768 self
14769 }
14770
14771 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14773 self.0.options = v.into();
14774 self
14775 }
14776
14777 pub async fn send(self) -> Result<longrunning::model::Operation> {
14784 (*self.0.stub)
14785 .create_sitemap(self.0.request, self.0.options)
14786 .await
14787 .map(gax::response::Response::into_body)
14788 }
14789
14790 pub fn poller(
14792 self,
14793 ) -> impl lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata> {
14794 type Operation = lro::internal::Operation<
14795 crate::model::Sitemap,
14796 crate::model::CreateSitemapMetadata,
14797 >;
14798 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14799 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14800
14801 let stub = self.0.stub.clone();
14802 let mut options = self.0.options.clone();
14803 options.set_retry_policy(gax::retry_policy::NeverRetry);
14804 let query = move |name| {
14805 let stub = stub.clone();
14806 let options = options.clone();
14807 async {
14808 let op = GetOperation::new(stub)
14809 .set_name(name)
14810 .with_options(options)
14811 .send()
14812 .await?;
14813 Ok(Operation::new(op))
14814 }
14815 };
14816
14817 let start = move || async {
14818 let op = self.send().await?;
14819 Ok(Operation::new(op))
14820 };
14821
14822 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14823 }
14824
14825 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14829 self.0.request.parent = v.into();
14830 self
14831 }
14832
14833 pub fn set_sitemap<T>(mut self, v: T) -> Self
14837 where
14838 T: std::convert::Into<crate::model::Sitemap>,
14839 {
14840 self.0.request.sitemap = std::option::Option::Some(v.into());
14841 self
14842 }
14843
14844 pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
14848 where
14849 T: std::convert::Into<crate::model::Sitemap>,
14850 {
14851 self.0.request.sitemap = v.map(|x| x.into());
14852 self
14853 }
14854 }
14855
14856 #[doc(hidden)]
14857 impl gax::options::internal::RequestBuilder for CreateSitemap {
14858 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14859 &mut self.0.options
14860 }
14861 }
14862
14863 #[derive(Clone, Debug)]
14882 pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
14883
14884 impl DeleteSitemap {
14885 pub(crate) fn new(
14886 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14887 ) -> Self {
14888 Self(RequestBuilder::new(stub))
14889 }
14890
14891 pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
14893 self.0.request = v.into();
14894 self
14895 }
14896
14897 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14899 self.0.options = v.into();
14900 self
14901 }
14902
14903 pub async fn send(self) -> Result<longrunning::model::Operation> {
14910 (*self.0.stub)
14911 .delete_sitemap(self.0.request, self.0.options)
14912 .await
14913 .map(gax::response::Response::into_body)
14914 }
14915
14916 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteSitemapMetadata> {
14918 type Operation =
14919 lro::internal::Operation<wkt::Empty, crate::model::DeleteSitemapMetadata>;
14920 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14921 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14922
14923 let stub = self.0.stub.clone();
14924 let mut options = self.0.options.clone();
14925 options.set_retry_policy(gax::retry_policy::NeverRetry);
14926 let query = move |name| {
14927 let stub = stub.clone();
14928 let options = options.clone();
14929 async {
14930 let op = GetOperation::new(stub)
14931 .set_name(name)
14932 .with_options(options)
14933 .send()
14934 .await?;
14935 Ok(Operation::new(op))
14936 }
14937 };
14938
14939 let start = move || async {
14940 let op = self.send().await?;
14941 Ok(Operation::new(op))
14942 };
14943
14944 lro::internal::new_unit_response_poller(
14945 polling_error_policy,
14946 polling_backoff_policy,
14947 start,
14948 query,
14949 )
14950 }
14951
14952 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14956 self.0.request.name = v.into();
14957 self
14958 }
14959 }
14960
14961 #[doc(hidden)]
14962 impl gax::options::internal::RequestBuilder for DeleteSitemap {
14963 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14964 &mut self.0.options
14965 }
14966 }
14967
14968 #[derive(Clone, Debug)]
14986 pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
14987
14988 impl FetchSitemaps {
14989 pub(crate) fn new(
14990 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14991 ) -> Self {
14992 Self(RequestBuilder::new(stub))
14993 }
14994
14995 pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
14997 self.0.request = v.into();
14998 self
14999 }
15000
15001 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15003 self.0.options = v.into();
15004 self
15005 }
15006
15007 pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
15009 (*self.0.stub)
15010 .fetch_sitemaps(self.0.request, self.0.options)
15011 .await
15012 .map(gax::response::Response::into_body)
15013 }
15014
15015 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15019 self.0.request.parent = v.into();
15020 self
15021 }
15022
15023 pub fn set_matcher<T>(mut self, v: T) -> Self
15025 where
15026 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15027 {
15028 self.0.request.matcher = std::option::Option::Some(v.into());
15029 self
15030 }
15031
15032 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
15034 where
15035 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
15036 {
15037 self.0.request.matcher = v.map(|x| x.into());
15038 self
15039 }
15040 }
15041
15042 #[doc(hidden)]
15043 impl gax::options::internal::RequestBuilder for FetchSitemaps {
15044 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15045 &mut self.0.options
15046 }
15047 }
15048
15049 #[derive(Clone, Debug)]
15068 pub struct EnableAdvancedSiteSearch(
15069 RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
15070 );
15071
15072 impl EnableAdvancedSiteSearch {
15073 pub(crate) fn new(
15074 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15075 ) -> Self {
15076 Self(RequestBuilder::new(stub))
15077 }
15078
15079 pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
15081 mut self,
15082 v: V,
15083 ) -> Self {
15084 self.0.request = v.into();
15085 self
15086 }
15087
15088 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15090 self.0.options = v.into();
15091 self
15092 }
15093
15094 pub async fn send(self) -> Result<longrunning::model::Operation> {
15101 (*self.0.stub)
15102 .enable_advanced_site_search(self.0.request, self.0.options)
15103 .await
15104 .map(gax::response::Response::into_body)
15105 }
15106
15107 pub fn poller(
15109 self,
15110 ) -> impl lro::Poller<
15111 crate::model::EnableAdvancedSiteSearchResponse,
15112 crate::model::EnableAdvancedSiteSearchMetadata,
15113 > {
15114 type Operation = lro::internal::Operation<
15115 crate::model::EnableAdvancedSiteSearchResponse,
15116 crate::model::EnableAdvancedSiteSearchMetadata,
15117 >;
15118 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15119 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15120
15121 let stub = self.0.stub.clone();
15122 let mut options = self.0.options.clone();
15123 options.set_retry_policy(gax::retry_policy::NeverRetry);
15124 let query = move |name| {
15125 let stub = stub.clone();
15126 let options = options.clone();
15127 async {
15128 let op = GetOperation::new(stub)
15129 .set_name(name)
15130 .with_options(options)
15131 .send()
15132 .await?;
15133 Ok(Operation::new(op))
15134 }
15135 };
15136
15137 let start = move || async {
15138 let op = self.send().await?;
15139 Ok(Operation::new(op))
15140 };
15141
15142 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15143 }
15144
15145 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15149 self.0.request.site_search_engine = v.into();
15150 self
15151 }
15152 }
15153
15154 #[doc(hidden)]
15155 impl gax::options::internal::RequestBuilder for EnableAdvancedSiteSearch {
15156 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15157 &mut self.0.options
15158 }
15159 }
15160
15161 #[derive(Clone, Debug)]
15180 pub struct DisableAdvancedSiteSearch(
15181 RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15182 );
15183
15184 impl DisableAdvancedSiteSearch {
15185 pub(crate) fn new(
15186 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15187 ) -> Self {
15188 Self(RequestBuilder::new(stub))
15189 }
15190
15191 pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15193 mut self,
15194 v: V,
15195 ) -> Self {
15196 self.0.request = v.into();
15197 self
15198 }
15199
15200 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15202 self.0.options = v.into();
15203 self
15204 }
15205
15206 pub async fn send(self) -> Result<longrunning::model::Operation> {
15213 (*self.0.stub)
15214 .disable_advanced_site_search(self.0.request, self.0.options)
15215 .await
15216 .map(gax::response::Response::into_body)
15217 }
15218
15219 pub fn poller(
15221 self,
15222 ) -> impl lro::Poller<
15223 crate::model::DisableAdvancedSiteSearchResponse,
15224 crate::model::DisableAdvancedSiteSearchMetadata,
15225 > {
15226 type Operation = lro::internal::Operation<
15227 crate::model::DisableAdvancedSiteSearchResponse,
15228 crate::model::DisableAdvancedSiteSearchMetadata,
15229 >;
15230 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15231 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15232
15233 let stub = self.0.stub.clone();
15234 let mut options = self.0.options.clone();
15235 options.set_retry_policy(gax::retry_policy::NeverRetry);
15236 let query = move |name| {
15237 let stub = stub.clone();
15238 let options = options.clone();
15239 async {
15240 let op = GetOperation::new(stub)
15241 .set_name(name)
15242 .with_options(options)
15243 .send()
15244 .await?;
15245 Ok(Operation::new(op))
15246 }
15247 };
15248
15249 let start = move || async {
15250 let op = self.send().await?;
15251 Ok(Operation::new(op))
15252 };
15253
15254 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15255 }
15256
15257 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15261 self.0.request.site_search_engine = v.into();
15262 self
15263 }
15264 }
15265
15266 #[doc(hidden)]
15267 impl gax::options::internal::RequestBuilder for DisableAdvancedSiteSearch {
15268 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15269 &mut self.0.options
15270 }
15271 }
15272
15273 #[derive(Clone, Debug)]
15292 pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15293
15294 impl RecrawlUris {
15295 pub(crate) fn new(
15296 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15297 ) -> Self {
15298 Self(RequestBuilder::new(stub))
15299 }
15300
15301 pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15303 self.0.request = v.into();
15304 self
15305 }
15306
15307 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15309 self.0.options = v.into();
15310 self
15311 }
15312
15313 pub async fn send(self) -> Result<longrunning::model::Operation> {
15320 (*self.0.stub)
15321 .recrawl_uris(self.0.request, self.0.options)
15322 .await
15323 .map(gax::response::Response::into_body)
15324 }
15325
15326 pub fn poller(
15328 self,
15329 ) -> impl lro::Poller<crate::model::RecrawlUrisResponse, crate::model::RecrawlUrisMetadata>
15330 {
15331 type Operation = lro::internal::Operation<
15332 crate::model::RecrawlUrisResponse,
15333 crate::model::RecrawlUrisMetadata,
15334 >;
15335 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15336 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15337
15338 let stub = self.0.stub.clone();
15339 let mut options = self.0.options.clone();
15340 options.set_retry_policy(gax::retry_policy::NeverRetry);
15341 let query = move |name| {
15342 let stub = stub.clone();
15343 let options = options.clone();
15344 async {
15345 let op = GetOperation::new(stub)
15346 .set_name(name)
15347 .with_options(options)
15348 .send()
15349 .await?;
15350 Ok(Operation::new(op))
15351 }
15352 };
15353
15354 let start = move || async {
15355 let op = self.send().await?;
15356 Ok(Operation::new(op))
15357 };
15358
15359 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15360 }
15361
15362 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15366 self.0.request.site_search_engine = v.into();
15367 self
15368 }
15369
15370 pub fn set_uris<T, V>(mut self, v: T) -> Self
15374 where
15375 T: std::iter::IntoIterator<Item = V>,
15376 V: std::convert::Into<std::string::String>,
15377 {
15378 use std::iter::Iterator;
15379 self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15380 self
15381 }
15382
15383 pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15385 self.0.request.site_credential = v.into();
15386 self
15387 }
15388 }
15389
15390 #[doc(hidden)]
15391 impl gax::options::internal::RequestBuilder for RecrawlUris {
15392 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15393 &mut self.0.options
15394 }
15395 }
15396
15397 #[derive(Clone, Debug)]
15416 pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15417
15418 impl BatchVerifyTargetSites {
15419 pub(crate) fn new(
15420 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15421 ) -> Self {
15422 Self(RequestBuilder::new(stub))
15423 }
15424
15425 pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15427 mut self,
15428 v: V,
15429 ) -> Self {
15430 self.0.request = v.into();
15431 self
15432 }
15433
15434 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15436 self.0.options = v.into();
15437 self
15438 }
15439
15440 pub async fn send(self) -> Result<longrunning::model::Operation> {
15447 (*self.0.stub)
15448 .batch_verify_target_sites(self.0.request, self.0.options)
15449 .await
15450 .map(gax::response::Response::into_body)
15451 }
15452
15453 pub fn poller(
15455 self,
15456 ) -> impl lro::Poller<
15457 crate::model::BatchVerifyTargetSitesResponse,
15458 crate::model::BatchVerifyTargetSitesMetadata,
15459 > {
15460 type Operation = lro::internal::Operation<
15461 crate::model::BatchVerifyTargetSitesResponse,
15462 crate::model::BatchVerifyTargetSitesMetadata,
15463 >;
15464 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15465 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15466
15467 let stub = self.0.stub.clone();
15468 let mut options = self.0.options.clone();
15469 options.set_retry_policy(gax::retry_policy::NeverRetry);
15470 let query = move |name| {
15471 let stub = stub.clone();
15472 let options = options.clone();
15473 async {
15474 let op = GetOperation::new(stub)
15475 .set_name(name)
15476 .with_options(options)
15477 .send()
15478 .await?;
15479 Ok(Operation::new(op))
15480 }
15481 };
15482
15483 let start = move || async {
15484 let op = self.send().await?;
15485 Ok(Operation::new(op))
15486 };
15487
15488 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15489 }
15490
15491 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15495 self.0.request.parent = v.into();
15496 self
15497 }
15498 }
15499
15500 #[doc(hidden)]
15501 impl gax::options::internal::RequestBuilder for BatchVerifyTargetSites {
15502 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15503 &mut self.0.options
15504 }
15505 }
15506
15507 #[derive(Clone, Debug)]
15529 pub struct FetchDomainVerificationStatus(
15530 RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
15531 );
15532
15533 impl FetchDomainVerificationStatus {
15534 pub(crate) fn new(
15535 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15536 ) -> Self {
15537 Self(RequestBuilder::new(stub))
15538 }
15539
15540 pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
15542 mut self,
15543 v: V,
15544 ) -> Self {
15545 self.0.request = v.into();
15546 self
15547 }
15548
15549 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15551 self.0.options = v.into();
15552 self
15553 }
15554
15555 pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
15557 (*self.0.stub)
15558 .fetch_domain_verification_status(self.0.request, self.0.options)
15559 .await
15560 .map(gax::response::Response::into_body)
15561 }
15562
15563 pub fn by_page(
15565 self,
15566 ) -> impl gax::paginator::Paginator<
15567 crate::model::FetchDomainVerificationStatusResponse,
15568 gax::error::Error,
15569 > {
15570 use std::clone::Clone;
15571 let token = self.0.request.page_token.clone();
15572 let execute = move |token: String| {
15573 let mut builder = self.clone();
15574 builder.0.request = builder.0.request.set_page_token(token);
15575 builder.send()
15576 };
15577 gax::paginator::internal::new_paginator(token, execute)
15578 }
15579
15580 pub fn by_item(
15582 self,
15583 ) -> impl gax::paginator::ItemPaginator<
15584 crate::model::FetchDomainVerificationStatusResponse,
15585 gax::error::Error,
15586 > {
15587 use gax::paginator::Paginator;
15588 self.by_page().items()
15589 }
15590
15591 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15595 self.0.request.site_search_engine = v.into();
15596 self
15597 }
15598
15599 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15601 self.0.request.page_size = v.into();
15602 self
15603 }
15604
15605 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15607 self.0.request.page_token = v.into();
15608 self
15609 }
15610 }
15611
15612 #[doc(hidden)]
15613 impl gax::options::internal::RequestBuilder for FetchDomainVerificationStatus {
15614 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15615 &mut self.0.options
15616 }
15617 }
15618
15619 #[derive(Clone, Debug)]
15641 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
15642
15643 impl ListOperations {
15644 pub(crate) fn new(
15645 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15646 ) -> Self {
15647 Self(RequestBuilder::new(stub))
15648 }
15649
15650 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
15652 mut self,
15653 v: V,
15654 ) -> Self {
15655 self.0.request = v.into();
15656 self
15657 }
15658
15659 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15661 self.0.options = v.into();
15662 self
15663 }
15664
15665 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
15667 (*self.0.stub)
15668 .list_operations(self.0.request, self.0.options)
15669 .await
15670 .map(gax::response::Response::into_body)
15671 }
15672
15673 pub fn by_page(
15675 self,
15676 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
15677 {
15678 use std::clone::Clone;
15679 let token = self.0.request.page_token.clone();
15680 let execute = move |token: String| {
15681 let mut builder = self.clone();
15682 builder.0.request = builder.0.request.set_page_token(token);
15683 builder.send()
15684 };
15685 gax::paginator::internal::new_paginator(token, execute)
15686 }
15687
15688 pub fn by_item(
15690 self,
15691 ) -> impl gax::paginator::ItemPaginator<
15692 longrunning::model::ListOperationsResponse,
15693 gax::error::Error,
15694 > {
15695 use gax::paginator::Paginator;
15696 self.by_page().items()
15697 }
15698
15699 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15701 self.0.request.name = v.into();
15702 self
15703 }
15704
15705 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15707 self.0.request.filter = v.into();
15708 self
15709 }
15710
15711 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15713 self.0.request.page_size = v.into();
15714 self
15715 }
15716
15717 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15719 self.0.request.page_token = v.into();
15720 self
15721 }
15722
15723 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
15725 self.0.request.return_partial_success = v.into();
15726 self
15727 }
15728 }
15729
15730 #[doc(hidden)]
15731 impl gax::options::internal::RequestBuilder for ListOperations {
15732 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15733 &mut self.0.options
15734 }
15735 }
15736
15737 #[derive(Clone, Debug)]
15755 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
15756
15757 impl GetOperation {
15758 pub(crate) fn new(
15759 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15760 ) -> Self {
15761 Self(RequestBuilder::new(stub))
15762 }
15763
15764 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
15766 mut self,
15767 v: V,
15768 ) -> Self {
15769 self.0.request = v.into();
15770 self
15771 }
15772
15773 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15775 self.0.options = v.into();
15776 self
15777 }
15778
15779 pub async fn send(self) -> Result<longrunning::model::Operation> {
15781 (*self.0.stub)
15782 .get_operation(self.0.request, self.0.options)
15783 .await
15784 .map(gax::response::Response::into_body)
15785 }
15786
15787 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15789 self.0.request.name = v.into();
15790 self
15791 }
15792 }
15793
15794 #[doc(hidden)]
15795 impl gax::options::internal::RequestBuilder for GetOperation {
15796 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15797 &mut self.0.options
15798 }
15799 }
15800
15801 #[derive(Clone, Debug)]
15819 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
15820
15821 impl CancelOperation {
15822 pub(crate) fn new(
15823 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15824 ) -> Self {
15825 Self(RequestBuilder::new(stub))
15826 }
15827
15828 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
15830 mut self,
15831 v: V,
15832 ) -> Self {
15833 self.0.request = v.into();
15834 self
15835 }
15836
15837 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15839 self.0.options = v.into();
15840 self
15841 }
15842
15843 pub async fn send(self) -> Result<()> {
15845 (*self.0.stub)
15846 .cancel_operation(self.0.request, self.0.options)
15847 .await
15848 .map(gax::response::Response::into_body)
15849 }
15850
15851 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15853 self.0.request.name = v.into();
15854 self
15855 }
15856 }
15857
15858 #[doc(hidden)]
15859 impl gax::options::internal::RequestBuilder for CancelOperation {
15860 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15861 &mut self.0.options
15862 }
15863 }
15864}
15865
15866#[cfg(feature = "user-event-service")]
15867#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
15868pub mod user_event_service {
15869 use crate::Result;
15870
15871 pub type ClientBuilder =
15885 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
15886
15887 pub(crate) mod client {
15888 use super::super::super::client::UserEventService;
15889 pub struct Factory;
15890 impl gax::client_builder::internal::ClientFactory for Factory {
15891 type Client = UserEventService;
15892 type Credentials = gaxi::options::Credentials;
15893 async fn build(
15894 self,
15895 config: gaxi::options::ClientConfig,
15896 ) -> gax::client_builder::Result<Self::Client> {
15897 Self::Client::new(config).await
15898 }
15899 }
15900 }
15901
15902 #[derive(Clone, Debug)]
15904 pub(crate) struct RequestBuilder<R: std::default::Default> {
15905 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15906 request: R,
15907 options: gax::options::RequestOptions,
15908 }
15909
15910 impl<R> RequestBuilder<R>
15911 where
15912 R: std::default::Default,
15913 {
15914 pub(crate) fn new(
15915 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15916 ) -> Self {
15917 Self {
15918 stub,
15919 request: R::default(),
15920 options: gax::options::RequestOptions::default(),
15921 }
15922 }
15923 }
15924
15925 #[derive(Clone, Debug)]
15943 pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
15944
15945 impl WriteUserEvent {
15946 pub(crate) fn new(
15947 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15948 ) -> Self {
15949 Self(RequestBuilder::new(stub))
15950 }
15951
15952 pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
15954 self.0.request = v.into();
15955 self
15956 }
15957
15958 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15960 self.0.options = v.into();
15961 self
15962 }
15963
15964 pub async fn send(self) -> Result<crate::model::UserEvent> {
15966 (*self.0.stub)
15967 .write_user_event(self.0.request, self.0.options)
15968 .await
15969 .map(gax::response::Response::into_body)
15970 }
15971
15972 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15976 self.0.request.parent = v.into();
15977 self
15978 }
15979
15980 pub fn set_user_event<T>(mut self, v: T) -> Self
15984 where
15985 T: std::convert::Into<crate::model::UserEvent>,
15986 {
15987 self.0.request.user_event = std::option::Option::Some(v.into());
15988 self
15989 }
15990
15991 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
15995 where
15996 T: std::convert::Into<crate::model::UserEvent>,
15997 {
15998 self.0.request.user_event = v.map(|x| x.into());
15999 self
16000 }
16001
16002 pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
16004 self.0.request.write_async = v.into();
16005 self
16006 }
16007 }
16008
16009 #[doc(hidden)]
16010 impl gax::options::internal::RequestBuilder for WriteUserEvent {
16011 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16012 &mut self.0.options
16013 }
16014 }
16015
16016 #[derive(Clone, Debug)]
16034 pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
16035
16036 impl CollectUserEvent {
16037 pub(crate) fn new(
16038 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16039 ) -> Self {
16040 Self(RequestBuilder::new(stub))
16041 }
16042
16043 pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
16045 mut self,
16046 v: V,
16047 ) -> Self {
16048 self.0.request = v.into();
16049 self
16050 }
16051
16052 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16054 self.0.options = v.into();
16055 self
16056 }
16057
16058 pub async fn send(self) -> Result<api::model::HttpBody> {
16060 (*self.0.stub)
16061 .collect_user_event(self.0.request, self.0.options)
16062 .await
16063 .map(gax::response::Response::into_body)
16064 }
16065
16066 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16070 self.0.request.parent = v.into();
16071 self
16072 }
16073
16074 pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
16078 self.0.request.user_event = v.into();
16079 self
16080 }
16081
16082 pub fn set_uri<T>(mut self, v: T) -> Self
16084 where
16085 T: std::convert::Into<std::string::String>,
16086 {
16087 self.0.request.uri = std::option::Option::Some(v.into());
16088 self
16089 }
16090
16091 pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
16093 where
16094 T: std::convert::Into<std::string::String>,
16095 {
16096 self.0.request.uri = v.map(|x| x.into());
16097 self
16098 }
16099
16100 pub fn set_ets<T>(mut self, v: T) -> Self
16102 where
16103 T: std::convert::Into<i64>,
16104 {
16105 self.0.request.ets = std::option::Option::Some(v.into());
16106 self
16107 }
16108
16109 pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
16111 where
16112 T: std::convert::Into<i64>,
16113 {
16114 self.0.request.ets = v.map(|x| x.into());
16115 self
16116 }
16117 }
16118
16119 #[doc(hidden)]
16120 impl gax::options::internal::RequestBuilder for CollectUserEvent {
16121 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16122 &mut self.0.options
16123 }
16124 }
16125
16126 #[derive(Clone, Debug)]
16145 pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
16146
16147 impl PurgeUserEvents {
16148 pub(crate) fn new(
16149 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16150 ) -> Self {
16151 Self(RequestBuilder::new(stub))
16152 }
16153
16154 pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16156 self.0.request = v.into();
16157 self
16158 }
16159
16160 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16162 self.0.options = v.into();
16163 self
16164 }
16165
16166 pub async fn send(self) -> Result<longrunning::model::Operation> {
16173 (*self.0.stub)
16174 .purge_user_events(self.0.request, self.0.options)
16175 .await
16176 .map(gax::response::Response::into_body)
16177 }
16178
16179 pub fn poller(
16181 self,
16182 ) -> impl lro::Poller<crate::model::PurgeUserEventsResponse, crate::model::PurgeUserEventsMetadata>
16183 {
16184 type Operation = lro::internal::Operation<
16185 crate::model::PurgeUserEventsResponse,
16186 crate::model::PurgeUserEventsMetadata,
16187 >;
16188 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16189 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16190
16191 let stub = self.0.stub.clone();
16192 let mut options = self.0.options.clone();
16193 options.set_retry_policy(gax::retry_policy::NeverRetry);
16194 let query = move |name| {
16195 let stub = stub.clone();
16196 let options = options.clone();
16197 async {
16198 let op = GetOperation::new(stub)
16199 .set_name(name)
16200 .with_options(options)
16201 .send()
16202 .await?;
16203 Ok(Operation::new(op))
16204 }
16205 };
16206
16207 let start = move || async {
16208 let op = self.send().await?;
16209 Ok(Operation::new(op))
16210 };
16211
16212 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16213 }
16214
16215 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16219 self.0.request.parent = v.into();
16220 self
16221 }
16222
16223 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16227 self.0.request.filter = v.into();
16228 self
16229 }
16230
16231 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16233 self.0.request.force = v.into();
16234 self
16235 }
16236 }
16237
16238 #[doc(hidden)]
16239 impl gax::options::internal::RequestBuilder for PurgeUserEvents {
16240 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16241 &mut self.0.options
16242 }
16243 }
16244
16245 #[derive(Clone, Debug)]
16264 pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
16265
16266 impl ImportUserEvents {
16267 pub(crate) fn new(
16268 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16269 ) -> Self {
16270 Self(RequestBuilder::new(stub))
16271 }
16272
16273 pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
16275 mut self,
16276 v: V,
16277 ) -> Self {
16278 self.0.request = v.into();
16279 self
16280 }
16281
16282 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16284 self.0.options = v.into();
16285 self
16286 }
16287
16288 pub async fn send(self) -> Result<longrunning::model::Operation> {
16295 (*self.0.stub)
16296 .import_user_events(self.0.request, self.0.options)
16297 .await
16298 .map(gax::response::Response::into_body)
16299 }
16300
16301 pub fn poller(
16303 self,
16304 ) -> impl lro::Poller<
16305 crate::model::ImportUserEventsResponse,
16306 crate::model::ImportUserEventsMetadata,
16307 > {
16308 type Operation = lro::internal::Operation<
16309 crate::model::ImportUserEventsResponse,
16310 crate::model::ImportUserEventsMetadata,
16311 >;
16312 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16313 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16314
16315 let stub = self.0.stub.clone();
16316 let mut options = self.0.options.clone();
16317 options.set_retry_policy(gax::retry_policy::NeverRetry);
16318 let query = move |name| {
16319 let stub = stub.clone();
16320 let options = options.clone();
16321 async {
16322 let op = GetOperation::new(stub)
16323 .set_name(name)
16324 .with_options(options)
16325 .send()
16326 .await?;
16327 Ok(Operation::new(op))
16328 }
16329 };
16330
16331 let start = move || async {
16332 let op = self.send().await?;
16333 Ok(Operation::new(op))
16334 };
16335
16336 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16337 }
16338
16339 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16343 self.0.request.parent = v.into();
16344 self
16345 }
16346
16347 pub fn set_error_config<T>(mut self, v: T) -> Self
16349 where
16350 T: std::convert::Into<crate::model::ImportErrorConfig>,
16351 {
16352 self.0.request.error_config = std::option::Option::Some(v.into());
16353 self
16354 }
16355
16356 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
16358 where
16359 T: std::convert::Into<crate::model::ImportErrorConfig>,
16360 {
16361 self.0.request.error_config = v.map(|x| x.into());
16362 self
16363 }
16364
16365 pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
16370 mut self,
16371 v: T,
16372 ) -> Self {
16373 self.0.request.source = v.into();
16374 self
16375 }
16376
16377 pub fn set_inline_source<
16383 T: std::convert::Into<
16384 std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
16385 >,
16386 >(
16387 mut self,
16388 v: T,
16389 ) -> Self {
16390 self.0.request = self.0.request.set_inline_source(v);
16391 self
16392 }
16393
16394 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
16400 mut self,
16401 v: T,
16402 ) -> Self {
16403 self.0.request = self.0.request.set_gcs_source(v);
16404 self
16405 }
16406
16407 pub fn set_bigquery_source<
16413 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
16414 >(
16415 mut self,
16416 v: T,
16417 ) -> Self {
16418 self.0.request = self.0.request.set_bigquery_source(v);
16419 self
16420 }
16421 }
16422
16423 #[doc(hidden)]
16424 impl gax::options::internal::RequestBuilder for ImportUserEvents {
16425 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16426 &mut self.0.options
16427 }
16428 }
16429
16430 #[derive(Clone, Debug)]
16452 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
16453
16454 impl ListOperations {
16455 pub(crate) fn new(
16456 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16457 ) -> Self {
16458 Self(RequestBuilder::new(stub))
16459 }
16460
16461 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
16463 mut self,
16464 v: V,
16465 ) -> Self {
16466 self.0.request = v.into();
16467 self
16468 }
16469
16470 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16472 self.0.options = v.into();
16473 self
16474 }
16475
16476 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
16478 (*self.0.stub)
16479 .list_operations(self.0.request, self.0.options)
16480 .await
16481 .map(gax::response::Response::into_body)
16482 }
16483
16484 pub fn by_page(
16486 self,
16487 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
16488 {
16489 use std::clone::Clone;
16490 let token = self.0.request.page_token.clone();
16491 let execute = move |token: String| {
16492 let mut builder = self.clone();
16493 builder.0.request = builder.0.request.set_page_token(token);
16494 builder.send()
16495 };
16496 gax::paginator::internal::new_paginator(token, execute)
16497 }
16498
16499 pub fn by_item(
16501 self,
16502 ) -> impl gax::paginator::ItemPaginator<
16503 longrunning::model::ListOperationsResponse,
16504 gax::error::Error,
16505 > {
16506 use gax::paginator::Paginator;
16507 self.by_page().items()
16508 }
16509
16510 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16512 self.0.request.name = v.into();
16513 self
16514 }
16515
16516 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16518 self.0.request.filter = v.into();
16519 self
16520 }
16521
16522 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16524 self.0.request.page_size = v.into();
16525 self
16526 }
16527
16528 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16530 self.0.request.page_token = v.into();
16531 self
16532 }
16533
16534 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16536 self.0.request.return_partial_success = v.into();
16537 self
16538 }
16539 }
16540
16541 #[doc(hidden)]
16542 impl gax::options::internal::RequestBuilder for ListOperations {
16543 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16544 &mut self.0.options
16545 }
16546 }
16547
16548 #[derive(Clone, Debug)]
16566 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
16567
16568 impl GetOperation {
16569 pub(crate) fn new(
16570 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16571 ) -> Self {
16572 Self(RequestBuilder::new(stub))
16573 }
16574
16575 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
16577 mut self,
16578 v: V,
16579 ) -> Self {
16580 self.0.request = v.into();
16581 self
16582 }
16583
16584 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16586 self.0.options = v.into();
16587 self
16588 }
16589
16590 pub async fn send(self) -> Result<longrunning::model::Operation> {
16592 (*self.0.stub)
16593 .get_operation(self.0.request, self.0.options)
16594 .await
16595 .map(gax::response::Response::into_body)
16596 }
16597
16598 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16600 self.0.request.name = v.into();
16601 self
16602 }
16603 }
16604
16605 #[doc(hidden)]
16606 impl gax::options::internal::RequestBuilder for GetOperation {
16607 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16608 &mut self.0.options
16609 }
16610 }
16611
16612 #[derive(Clone, Debug)]
16630 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
16631
16632 impl CancelOperation {
16633 pub(crate) fn new(
16634 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16635 ) -> Self {
16636 Self(RequestBuilder::new(stub))
16637 }
16638
16639 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
16641 mut self,
16642 v: V,
16643 ) -> Self {
16644 self.0.request = v.into();
16645 self
16646 }
16647
16648 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16650 self.0.options = v.into();
16651 self
16652 }
16653
16654 pub async fn send(self) -> Result<()> {
16656 (*self.0.stub)
16657 .cancel_operation(self.0.request, self.0.options)
16658 .await
16659 .map(gax::response::Response::into_body)
16660 }
16661
16662 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16664 self.0.request.name = v.into();
16665 self
16666 }
16667 }
16668
16669 #[doc(hidden)]
16670 impl gax::options::internal::RequestBuilder for CancelOperation {
16671 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16672 &mut self.0.options
16673 }
16674 }
16675}
16676
16677#[cfg(feature = "user-license-service")]
16678#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
16679pub mod user_license_service {
16680 use crate::Result;
16681
16682 pub type ClientBuilder =
16696 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16697
16698 pub(crate) mod client {
16699 use super::super::super::client::UserLicenseService;
16700 pub struct Factory;
16701 impl gax::client_builder::internal::ClientFactory for Factory {
16702 type Client = UserLicenseService;
16703 type Credentials = gaxi::options::Credentials;
16704 async fn build(
16705 self,
16706 config: gaxi::options::ClientConfig,
16707 ) -> gax::client_builder::Result<Self::Client> {
16708 Self::Client::new(config).await
16709 }
16710 }
16711 }
16712
16713 #[derive(Clone, Debug)]
16715 pub(crate) struct RequestBuilder<R: std::default::Default> {
16716 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16717 request: R,
16718 options: gax::options::RequestOptions,
16719 }
16720
16721 impl<R> RequestBuilder<R>
16722 where
16723 R: std::default::Default,
16724 {
16725 pub(crate) fn new(
16726 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16727 ) -> Self {
16728 Self {
16729 stub,
16730 request: R::default(),
16731 options: gax::options::RequestOptions::default(),
16732 }
16733 }
16734 }
16735
16736 #[derive(Clone, Debug)]
16758 pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
16759
16760 impl ListUserLicenses {
16761 pub(crate) fn new(
16762 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16763 ) -> Self {
16764 Self(RequestBuilder::new(stub))
16765 }
16766
16767 pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
16769 mut self,
16770 v: V,
16771 ) -> Self {
16772 self.0.request = v.into();
16773 self
16774 }
16775
16776 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16778 self.0.options = v.into();
16779 self
16780 }
16781
16782 pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
16784 (*self.0.stub)
16785 .list_user_licenses(self.0.request, self.0.options)
16786 .await
16787 .map(gax::response::Response::into_body)
16788 }
16789
16790 pub fn by_page(
16792 self,
16793 ) -> impl gax::paginator::Paginator<crate::model::ListUserLicensesResponse, gax::error::Error>
16794 {
16795 use std::clone::Clone;
16796 let token = self.0.request.page_token.clone();
16797 let execute = move |token: String| {
16798 let mut builder = self.clone();
16799 builder.0.request = builder.0.request.set_page_token(token);
16800 builder.send()
16801 };
16802 gax::paginator::internal::new_paginator(token, execute)
16803 }
16804
16805 pub fn by_item(
16807 self,
16808 ) -> impl gax::paginator::ItemPaginator<crate::model::ListUserLicensesResponse, gax::error::Error>
16809 {
16810 use gax::paginator::Paginator;
16811 self.by_page().items()
16812 }
16813
16814 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16818 self.0.request.parent = v.into();
16819 self
16820 }
16821
16822 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16824 self.0.request.page_size = v.into();
16825 self
16826 }
16827
16828 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16830 self.0.request.page_token = v.into();
16831 self
16832 }
16833
16834 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16836 self.0.request.filter = v.into();
16837 self
16838 }
16839 }
16840
16841 #[doc(hidden)]
16842 impl gax::options::internal::RequestBuilder for ListUserLicenses {
16843 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16844 &mut self.0.options
16845 }
16846 }
16847
16848 #[derive(Clone, Debug)]
16867 pub struct BatchUpdateUserLicenses(
16868 RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
16869 );
16870
16871 impl BatchUpdateUserLicenses {
16872 pub(crate) fn new(
16873 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16874 ) -> Self {
16875 Self(RequestBuilder::new(stub))
16876 }
16877
16878 pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
16880 mut self,
16881 v: V,
16882 ) -> Self {
16883 self.0.request = v.into();
16884 self
16885 }
16886
16887 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16889 self.0.options = v.into();
16890 self
16891 }
16892
16893 pub async fn send(self) -> Result<longrunning::model::Operation> {
16900 (*self.0.stub)
16901 .batch_update_user_licenses(self.0.request, self.0.options)
16902 .await
16903 .map(gax::response::Response::into_body)
16904 }
16905
16906 pub fn poller(
16908 self,
16909 ) -> impl lro::Poller<
16910 crate::model::BatchUpdateUserLicensesResponse,
16911 crate::model::BatchUpdateUserLicensesMetadata,
16912 > {
16913 type Operation = lro::internal::Operation<
16914 crate::model::BatchUpdateUserLicensesResponse,
16915 crate::model::BatchUpdateUserLicensesMetadata,
16916 >;
16917 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16918 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16919
16920 let stub = self.0.stub.clone();
16921 let mut options = self.0.options.clone();
16922 options.set_retry_policy(gax::retry_policy::NeverRetry);
16923 let query = move |name| {
16924 let stub = stub.clone();
16925 let options = options.clone();
16926 async {
16927 let op = GetOperation::new(stub)
16928 .set_name(name)
16929 .with_options(options)
16930 .send()
16931 .await?;
16932 Ok(Operation::new(op))
16933 }
16934 };
16935
16936 let start = move || async {
16937 let op = self.send().await?;
16938 Ok(Operation::new(op))
16939 };
16940
16941 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16942 }
16943
16944 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16948 self.0.request.parent = v.into();
16949 self
16950 }
16951
16952 pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
16954 self.0.request.delete_unassigned_user_licenses = v.into();
16955 self
16956 }
16957
16958 pub fn set_source<
16963 T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
16964 >(
16965 mut self,
16966 v: T,
16967 ) -> Self {
16968 self.0.request.source = v.into();
16969 self
16970 }
16971
16972 pub fn set_inline_source<
16978 T: std::convert::Into<
16979 std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
16980 >,
16981 >(
16982 mut self,
16983 v: T,
16984 ) -> Self {
16985 self.0.request = self.0.request.set_inline_source(v);
16986 self
16987 }
16988 }
16989
16990 #[doc(hidden)]
16991 impl gax::options::internal::RequestBuilder for BatchUpdateUserLicenses {
16992 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16993 &mut self.0.options
16994 }
16995 }
16996
16997 #[derive(Clone, Debug)]
17019 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
17020
17021 impl ListOperations {
17022 pub(crate) fn new(
17023 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17024 ) -> Self {
17025 Self(RequestBuilder::new(stub))
17026 }
17027
17028 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
17030 mut self,
17031 v: V,
17032 ) -> Self {
17033 self.0.request = v.into();
17034 self
17035 }
17036
17037 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17039 self.0.options = v.into();
17040 self
17041 }
17042
17043 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
17045 (*self.0.stub)
17046 .list_operations(self.0.request, self.0.options)
17047 .await
17048 .map(gax::response::Response::into_body)
17049 }
17050
17051 pub fn by_page(
17053 self,
17054 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
17055 {
17056 use std::clone::Clone;
17057 let token = self.0.request.page_token.clone();
17058 let execute = move |token: String| {
17059 let mut builder = self.clone();
17060 builder.0.request = builder.0.request.set_page_token(token);
17061 builder.send()
17062 };
17063 gax::paginator::internal::new_paginator(token, execute)
17064 }
17065
17066 pub fn by_item(
17068 self,
17069 ) -> impl gax::paginator::ItemPaginator<
17070 longrunning::model::ListOperationsResponse,
17071 gax::error::Error,
17072 > {
17073 use gax::paginator::Paginator;
17074 self.by_page().items()
17075 }
17076
17077 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17079 self.0.request.name = v.into();
17080 self
17081 }
17082
17083 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17085 self.0.request.filter = v.into();
17086 self
17087 }
17088
17089 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17091 self.0.request.page_size = v.into();
17092 self
17093 }
17094
17095 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17097 self.0.request.page_token = v.into();
17098 self
17099 }
17100
17101 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17103 self.0.request.return_partial_success = v.into();
17104 self
17105 }
17106 }
17107
17108 #[doc(hidden)]
17109 impl gax::options::internal::RequestBuilder for ListOperations {
17110 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17111 &mut self.0.options
17112 }
17113 }
17114
17115 #[derive(Clone, Debug)]
17133 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
17134
17135 impl GetOperation {
17136 pub(crate) fn new(
17137 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17138 ) -> Self {
17139 Self(RequestBuilder::new(stub))
17140 }
17141
17142 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
17144 mut self,
17145 v: V,
17146 ) -> Self {
17147 self.0.request = v.into();
17148 self
17149 }
17150
17151 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17153 self.0.options = v.into();
17154 self
17155 }
17156
17157 pub async fn send(self) -> Result<longrunning::model::Operation> {
17159 (*self.0.stub)
17160 .get_operation(self.0.request, self.0.options)
17161 .await
17162 .map(gax::response::Response::into_body)
17163 }
17164
17165 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17167 self.0.request.name = v.into();
17168 self
17169 }
17170 }
17171
17172 #[doc(hidden)]
17173 impl gax::options::internal::RequestBuilder for GetOperation {
17174 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17175 &mut self.0.options
17176 }
17177 }
17178
17179 #[derive(Clone, Debug)]
17197 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
17198
17199 impl CancelOperation {
17200 pub(crate) fn new(
17201 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17202 ) -> Self {
17203 Self(RequestBuilder::new(stub))
17204 }
17205
17206 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
17208 mut self,
17209 v: V,
17210 ) -> Self {
17211 self.0.request = v.into();
17212 self
17213 }
17214
17215 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17217 self.0.options = v.into();
17218 self
17219 }
17220
17221 pub async fn send(self) -> Result<()> {
17223 (*self.0.stub)
17224 .cancel_operation(self.0.request, self.0.options)
17225 .await
17226 .map(gax::response::Response::into_body)
17227 }
17228
17229 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17231 self.0.request.name = v.into();
17232 self
17233 }
17234 }
17235
17236 #[doc(hidden)]
17237 impl gax::options::internal::RequestBuilder for CancelOperation {
17238 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17239 &mut self.0.options
17240 }
17241 }
17242}