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)]
97 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
98
99 impl ListOperations {
100 pub(crate) fn new(
101 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
102 ) -> Self {
103 Self(RequestBuilder::new(stub))
104 }
105
106 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
108 mut self,
109 v: V,
110 ) -> Self {
111 self.0.request = v.into();
112 self
113 }
114
115 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
117 self.0.options = v.into();
118 self
119 }
120
121 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
123 (*self.0.stub)
124 .list_operations(self.0.request, self.0.options)
125 .await
126 .map(gax::response::Response::into_body)
127 }
128
129 pub fn by_page(
131 self,
132 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
133 {
134 use std::clone::Clone;
135 let token = self.0.request.page_token.clone();
136 let execute = move |token: String| {
137 let mut builder = self.clone();
138 builder.0.request = builder.0.request.set_page_token(token);
139 builder.send()
140 };
141 gax::paginator::internal::new_paginator(token, execute)
142 }
143
144 pub fn by_item(
146 self,
147 ) -> impl gax::paginator::ItemPaginator<
148 longrunning::model::ListOperationsResponse,
149 gax::error::Error,
150 > {
151 use gax::paginator::Paginator;
152 self.by_page().items()
153 }
154
155 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
157 self.0.request.name = v.into();
158 self
159 }
160
161 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
163 self.0.request.filter = v.into();
164 self
165 }
166
167 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
169 self.0.request.page_size = v.into();
170 self
171 }
172
173 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
175 self.0.request.page_token = v.into();
176 self
177 }
178
179 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
181 self.0.request.return_partial_success = v.into();
182 self
183 }
184 }
185
186 #[doc(hidden)]
187 impl gax::options::internal::RequestBuilder for ListOperations {
188 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
189 &mut self.0.options
190 }
191 }
192
193 #[derive(Clone, Debug)]
210 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
211
212 impl GetOperation {
213 pub(crate) fn new(
214 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
215 ) -> Self {
216 Self(RequestBuilder::new(stub))
217 }
218
219 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
221 mut self,
222 v: V,
223 ) -> Self {
224 self.0.request = v.into();
225 self
226 }
227
228 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
230 self.0.options = v.into();
231 self
232 }
233
234 pub async fn send(self) -> Result<longrunning::model::Operation> {
236 (*self.0.stub)
237 .get_operation(self.0.request, self.0.options)
238 .await
239 .map(gax::response::Response::into_body)
240 }
241
242 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
244 self.0.request.name = v.into();
245 self
246 }
247 }
248
249 #[doc(hidden)]
250 impl gax::options::internal::RequestBuilder for GetOperation {
251 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
252 &mut self.0.options
253 }
254 }
255
256 #[derive(Clone, Debug)]
273 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
274
275 impl CancelOperation {
276 pub(crate) fn new(
277 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
278 ) -> Self {
279 Self(RequestBuilder::new(stub))
280 }
281
282 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
284 mut self,
285 v: V,
286 ) -> Self {
287 self.0.request = v.into();
288 self
289 }
290
291 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
293 self.0.options = v.into();
294 self
295 }
296
297 pub async fn send(self) -> Result<()> {
299 (*self.0.stub)
300 .cancel_operation(self.0.request, self.0.options)
301 .await
302 .map(gax::response::Response::into_body)
303 }
304
305 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
307 self.0.request.name = v.into();
308 self
309 }
310 }
311
312 #[doc(hidden)]
313 impl gax::options::internal::RequestBuilder for CancelOperation {
314 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
315 &mut self.0.options
316 }
317 }
318}
319
320#[cfg(feature = "cmek-config-service")]
321#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
322pub mod cmek_config_service {
323 use crate::Result;
324
325 pub type ClientBuilder =
339 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
340
341 pub(crate) mod client {
342 use super::super::super::client::CmekConfigService;
343 pub struct Factory;
344 impl gax::client_builder::internal::ClientFactory for Factory {
345 type Client = CmekConfigService;
346 type Credentials = gaxi::options::Credentials;
347 async fn build(
348 self,
349 config: gaxi::options::ClientConfig,
350 ) -> gax::client_builder::Result<Self::Client> {
351 Self::Client::new(config).await
352 }
353 }
354 }
355
356 #[derive(Clone, Debug)]
358 pub(crate) struct RequestBuilder<R: std::default::Default> {
359 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
360 request: R,
361 options: gax::options::RequestOptions,
362 }
363
364 impl<R> RequestBuilder<R>
365 where
366 R: std::default::Default,
367 {
368 pub(crate) fn new(
369 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
370 ) -> Self {
371 Self {
372 stub,
373 request: R::default(),
374 options: gax::options::RequestOptions::default(),
375 }
376 }
377 }
378
379 #[derive(Clone, Debug)]
397 pub struct UpdateCmekConfig(RequestBuilder<crate::model::UpdateCmekConfigRequest>);
398
399 impl UpdateCmekConfig {
400 pub(crate) fn new(
401 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
402 ) -> Self {
403 Self(RequestBuilder::new(stub))
404 }
405
406 pub fn with_request<V: Into<crate::model::UpdateCmekConfigRequest>>(
408 mut self,
409 v: V,
410 ) -> Self {
411 self.0.request = v.into();
412 self
413 }
414
415 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
417 self.0.options = v.into();
418 self
419 }
420
421 pub async fn send(self) -> Result<longrunning::model::Operation> {
428 (*self.0.stub)
429 .update_cmek_config(self.0.request, self.0.options)
430 .await
431 .map(gax::response::Response::into_body)
432 }
433
434 pub fn poller(
436 self,
437 ) -> impl lro::Poller<crate::model::CmekConfig, crate::model::UpdateCmekConfigMetadata>
438 {
439 type Operation = lro::internal::Operation<
440 crate::model::CmekConfig,
441 crate::model::UpdateCmekConfigMetadata,
442 >;
443 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
444 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
445
446 let stub = self.0.stub.clone();
447 let mut options = self.0.options.clone();
448 options.set_retry_policy(gax::retry_policy::NeverRetry);
449 let query = move |name| {
450 let stub = stub.clone();
451 let options = options.clone();
452 async {
453 let op = GetOperation::new(stub)
454 .set_name(name)
455 .with_options(options)
456 .send()
457 .await?;
458 Ok(Operation::new(op))
459 }
460 };
461
462 let start = move || async {
463 let op = self.send().await?;
464 Ok(Operation::new(op))
465 };
466
467 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
468 }
469
470 pub fn set_config<T>(mut self, v: T) -> Self
474 where
475 T: std::convert::Into<crate::model::CmekConfig>,
476 {
477 self.0.request.config = std::option::Option::Some(v.into());
478 self
479 }
480
481 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
485 where
486 T: std::convert::Into<crate::model::CmekConfig>,
487 {
488 self.0.request.config = v.map(|x| x.into());
489 self
490 }
491
492 pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
494 self.0.request.set_default = v.into();
495 self
496 }
497 }
498
499 #[doc(hidden)]
500 impl gax::options::internal::RequestBuilder for UpdateCmekConfig {
501 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
502 &mut self.0.options
503 }
504 }
505
506 #[derive(Clone, Debug)]
523 pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
524
525 impl GetCmekConfig {
526 pub(crate) fn new(
527 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
528 ) -> Self {
529 Self(RequestBuilder::new(stub))
530 }
531
532 pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
534 self.0.request = v.into();
535 self
536 }
537
538 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
540 self.0.options = v.into();
541 self
542 }
543
544 pub async fn send(self) -> Result<crate::model::CmekConfig> {
546 (*self.0.stub)
547 .get_cmek_config(self.0.request, self.0.options)
548 .await
549 .map(gax::response::Response::into_body)
550 }
551
552 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
556 self.0.request.name = v.into();
557 self
558 }
559 }
560
561 #[doc(hidden)]
562 impl gax::options::internal::RequestBuilder for GetCmekConfig {
563 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
564 &mut self.0.options
565 }
566 }
567
568 #[derive(Clone, Debug)]
585 pub struct ListCmekConfigs(RequestBuilder<crate::model::ListCmekConfigsRequest>);
586
587 impl ListCmekConfigs {
588 pub(crate) fn new(
589 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
590 ) -> Self {
591 Self(RequestBuilder::new(stub))
592 }
593
594 pub fn with_request<V: Into<crate::model::ListCmekConfigsRequest>>(mut self, v: V) -> Self {
596 self.0.request = v.into();
597 self
598 }
599
600 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
602 self.0.options = v.into();
603 self
604 }
605
606 pub async fn send(self) -> Result<crate::model::ListCmekConfigsResponse> {
608 (*self.0.stub)
609 .list_cmek_configs(self.0.request, self.0.options)
610 .await
611 .map(gax::response::Response::into_body)
612 }
613
614 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
618 self.0.request.parent = v.into();
619 self
620 }
621 }
622
623 #[doc(hidden)]
624 impl gax::options::internal::RequestBuilder for ListCmekConfigs {
625 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
626 &mut self.0.options
627 }
628 }
629
630 #[derive(Clone, Debug)]
648 pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
649
650 impl DeleteCmekConfig {
651 pub(crate) fn new(
652 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
653 ) -> Self {
654 Self(RequestBuilder::new(stub))
655 }
656
657 pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
659 mut self,
660 v: V,
661 ) -> Self {
662 self.0.request = v.into();
663 self
664 }
665
666 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
668 self.0.options = v.into();
669 self
670 }
671
672 pub async fn send(self) -> Result<longrunning::model::Operation> {
679 (*self.0.stub)
680 .delete_cmek_config(self.0.request, self.0.options)
681 .await
682 .map(gax::response::Response::into_body)
683 }
684
685 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
687 type Operation =
688 lro::internal::Operation<wkt::Empty, crate::model::DeleteCmekConfigMetadata>;
689 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
690 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
691
692 let stub = self.0.stub.clone();
693 let mut options = self.0.options.clone();
694 options.set_retry_policy(gax::retry_policy::NeverRetry);
695 let query = move |name| {
696 let stub = stub.clone();
697 let options = options.clone();
698 async {
699 let op = GetOperation::new(stub)
700 .set_name(name)
701 .with_options(options)
702 .send()
703 .await?;
704 Ok(Operation::new(op))
705 }
706 };
707
708 let start = move || async {
709 let op = self.send().await?;
710 Ok(Operation::new(op))
711 };
712
713 lro::internal::new_unit_response_poller(
714 polling_error_policy,
715 polling_backoff_policy,
716 start,
717 query,
718 )
719 }
720
721 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
725 self.0.request.name = v.into();
726 self
727 }
728 }
729
730 #[doc(hidden)]
731 impl gax::options::internal::RequestBuilder for DeleteCmekConfig {
732 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
733 &mut self.0.options
734 }
735 }
736
737 #[derive(Clone, Debug)]
758 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
759
760 impl ListOperations {
761 pub(crate) fn new(
762 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
763 ) -> Self {
764 Self(RequestBuilder::new(stub))
765 }
766
767 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
769 mut self,
770 v: V,
771 ) -> Self {
772 self.0.request = v.into();
773 self
774 }
775
776 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
778 self.0.options = v.into();
779 self
780 }
781
782 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
784 (*self.0.stub)
785 .list_operations(self.0.request, self.0.options)
786 .await
787 .map(gax::response::Response::into_body)
788 }
789
790 pub fn by_page(
792 self,
793 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
794 {
795 use std::clone::Clone;
796 let token = self.0.request.page_token.clone();
797 let execute = move |token: String| {
798 let mut builder = self.clone();
799 builder.0.request = builder.0.request.set_page_token(token);
800 builder.send()
801 };
802 gax::paginator::internal::new_paginator(token, execute)
803 }
804
805 pub fn by_item(
807 self,
808 ) -> impl gax::paginator::ItemPaginator<
809 longrunning::model::ListOperationsResponse,
810 gax::error::Error,
811 > {
812 use gax::paginator::Paginator;
813 self.by_page().items()
814 }
815
816 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
818 self.0.request.name = v.into();
819 self
820 }
821
822 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
824 self.0.request.filter = v.into();
825 self
826 }
827
828 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
830 self.0.request.page_size = v.into();
831 self
832 }
833
834 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
836 self.0.request.page_token = v.into();
837 self
838 }
839
840 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
842 self.0.request.return_partial_success = v.into();
843 self
844 }
845 }
846
847 #[doc(hidden)]
848 impl gax::options::internal::RequestBuilder for ListOperations {
849 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
850 &mut self.0.options
851 }
852 }
853
854 #[derive(Clone, Debug)]
871 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
872
873 impl GetOperation {
874 pub(crate) fn new(
875 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
876 ) -> Self {
877 Self(RequestBuilder::new(stub))
878 }
879
880 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
882 mut self,
883 v: V,
884 ) -> Self {
885 self.0.request = v.into();
886 self
887 }
888
889 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
891 self.0.options = v.into();
892 self
893 }
894
895 pub async fn send(self) -> Result<longrunning::model::Operation> {
897 (*self.0.stub)
898 .get_operation(self.0.request, self.0.options)
899 .await
900 .map(gax::response::Response::into_body)
901 }
902
903 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
905 self.0.request.name = v.into();
906 self
907 }
908 }
909
910 #[doc(hidden)]
911 impl gax::options::internal::RequestBuilder for GetOperation {
912 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
913 &mut self.0.options
914 }
915 }
916
917 #[derive(Clone, Debug)]
934 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
935
936 impl CancelOperation {
937 pub(crate) fn new(
938 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
939 ) -> Self {
940 Self(RequestBuilder::new(stub))
941 }
942
943 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
945 mut self,
946 v: V,
947 ) -> Self {
948 self.0.request = v.into();
949 self
950 }
951
952 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
954 self.0.options = v.into();
955 self
956 }
957
958 pub async fn send(self) -> Result<()> {
960 (*self.0.stub)
961 .cancel_operation(self.0.request, self.0.options)
962 .await
963 .map(gax::response::Response::into_body)
964 }
965
966 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
968 self.0.request.name = v.into();
969 self
970 }
971 }
972
973 #[doc(hidden)]
974 impl gax::options::internal::RequestBuilder for CancelOperation {
975 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
976 &mut self.0.options
977 }
978 }
979}
980
981#[cfg(feature = "completion-service")]
982#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
983pub mod completion_service {
984 use crate::Result;
985
986 pub type ClientBuilder =
1000 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1001
1002 pub(crate) mod client {
1003 use super::super::super::client::CompletionService;
1004 pub struct Factory;
1005 impl gax::client_builder::internal::ClientFactory for Factory {
1006 type Client = CompletionService;
1007 type Credentials = gaxi::options::Credentials;
1008 async fn build(
1009 self,
1010 config: gaxi::options::ClientConfig,
1011 ) -> gax::client_builder::Result<Self::Client> {
1012 Self::Client::new(config).await
1013 }
1014 }
1015 }
1016
1017 #[derive(Clone, Debug)]
1019 pub(crate) struct RequestBuilder<R: std::default::Default> {
1020 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1021 request: R,
1022 options: gax::options::RequestOptions,
1023 }
1024
1025 impl<R> RequestBuilder<R>
1026 where
1027 R: std::default::Default,
1028 {
1029 pub(crate) fn new(
1030 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1031 ) -> Self {
1032 Self {
1033 stub,
1034 request: R::default(),
1035 options: gax::options::RequestOptions::default(),
1036 }
1037 }
1038 }
1039
1040 #[derive(Clone, Debug)]
1057 pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1058
1059 impl CompleteQuery {
1060 pub(crate) fn new(
1061 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1062 ) -> Self {
1063 Self(RequestBuilder::new(stub))
1064 }
1065
1066 pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1068 self.0.request = v.into();
1069 self
1070 }
1071
1072 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1074 self.0.options = v.into();
1075 self
1076 }
1077
1078 pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1080 (*self.0.stub)
1081 .complete_query(self.0.request, self.0.options)
1082 .await
1083 .map(gax::response::Response::into_body)
1084 }
1085
1086 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1090 self.0.request.data_store = v.into();
1091 self
1092 }
1093
1094 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1098 self.0.request.query = v.into();
1099 self
1100 }
1101
1102 pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1104 self.0.request.query_model = v.into();
1105 self
1106 }
1107
1108 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1110 self.0.request.user_pseudo_id = v.into();
1111 self
1112 }
1113
1114 pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1116 self.0.request.include_tail_suggestions = v.into();
1117 self
1118 }
1119 }
1120
1121 #[doc(hidden)]
1122 impl gax::options::internal::RequestBuilder for CompleteQuery {
1123 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1124 &mut self.0.options
1125 }
1126 }
1127
1128 #[derive(Clone, Debug)]
1146 pub struct ImportSuggestionDenyListEntries(
1147 RequestBuilder<crate::model::ImportSuggestionDenyListEntriesRequest>,
1148 );
1149
1150 impl ImportSuggestionDenyListEntries {
1151 pub(crate) fn new(
1152 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1153 ) -> Self {
1154 Self(RequestBuilder::new(stub))
1155 }
1156
1157 pub fn with_request<V: Into<crate::model::ImportSuggestionDenyListEntriesRequest>>(
1159 mut self,
1160 v: V,
1161 ) -> Self {
1162 self.0.request = v.into();
1163 self
1164 }
1165
1166 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1168 self.0.options = v.into();
1169 self
1170 }
1171
1172 pub async fn send(self) -> Result<longrunning::model::Operation> {
1179 (*self.0.stub)
1180 .import_suggestion_deny_list_entries(self.0.request, self.0.options)
1181 .await
1182 .map(gax::response::Response::into_body)
1183 }
1184
1185 pub fn poller(
1187 self,
1188 ) -> impl lro::Poller<
1189 crate::model::ImportSuggestionDenyListEntriesResponse,
1190 crate::model::ImportSuggestionDenyListEntriesMetadata,
1191 > {
1192 type Operation = lro::internal::Operation<
1193 crate::model::ImportSuggestionDenyListEntriesResponse,
1194 crate::model::ImportSuggestionDenyListEntriesMetadata,
1195 >;
1196 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1197 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1198
1199 let stub = self.0.stub.clone();
1200 let mut options = self.0.options.clone();
1201 options.set_retry_policy(gax::retry_policy::NeverRetry);
1202 let query = move |name| {
1203 let stub = stub.clone();
1204 let options = options.clone();
1205 async {
1206 let op = GetOperation::new(stub)
1207 .set_name(name)
1208 .with_options(options)
1209 .send()
1210 .await?;
1211 Ok(Operation::new(op))
1212 }
1213 };
1214
1215 let start = move || async {
1216 let op = self.send().await?;
1217 Ok(Operation::new(op))
1218 };
1219
1220 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1221 }
1222
1223 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1227 self.0.request.parent = v.into();
1228 self
1229 }
1230
1231 pub fn set_source<
1236 T: Into<Option<crate::model::import_suggestion_deny_list_entries_request::Source>>,
1237 >(
1238 mut self,
1239 v: T,
1240 ) -> Self {
1241 self.0.request.source = v.into();
1242 self
1243 }
1244
1245 pub fn set_inline_source<
1251 T: std::convert::Into<
1252 std::boxed::Box<
1253 crate::model::import_suggestion_deny_list_entries_request::InlineSource,
1254 >,
1255 >,
1256 >(
1257 mut self,
1258 v: T,
1259 ) -> Self {
1260 self.0.request = self.0.request.set_inline_source(v);
1261 self
1262 }
1263
1264 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1270 mut self,
1271 v: T,
1272 ) -> Self {
1273 self.0.request = self.0.request.set_gcs_source(v);
1274 self
1275 }
1276 }
1277
1278 #[doc(hidden)]
1279 impl gax::options::internal::RequestBuilder for ImportSuggestionDenyListEntries {
1280 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1281 &mut self.0.options
1282 }
1283 }
1284
1285 #[derive(Clone, Debug)]
1303 pub struct PurgeSuggestionDenyListEntries(
1304 RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1305 );
1306
1307 impl PurgeSuggestionDenyListEntries {
1308 pub(crate) fn new(
1309 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1310 ) -> Self {
1311 Self(RequestBuilder::new(stub))
1312 }
1313
1314 pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1316 mut self,
1317 v: V,
1318 ) -> Self {
1319 self.0.request = v.into();
1320 self
1321 }
1322
1323 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1325 self.0.options = v.into();
1326 self
1327 }
1328
1329 pub async fn send(self) -> Result<longrunning::model::Operation> {
1336 (*self.0.stub)
1337 .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1338 .await
1339 .map(gax::response::Response::into_body)
1340 }
1341
1342 pub fn poller(
1344 self,
1345 ) -> impl lro::Poller<
1346 crate::model::PurgeSuggestionDenyListEntriesResponse,
1347 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1348 > {
1349 type Operation = lro::internal::Operation<
1350 crate::model::PurgeSuggestionDenyListEntriesResponse,
1351 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1352 >;
1353 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1354 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1355
1356 let stub = self.0.stub.clone();
1357 let mut options = self.0.options.clone();
1358 options.set_retry_policy(gax::retry_policy::NeverRetry);
1359 let query = move |name| {
1360 let stub = stub.clone();
1361 let options = options.clone();
1362 async {
1363 let op = GetOperation::new(stub)
1364 .set_name(name)
1365 .with_options(options)
1366 .send()
1367 .await?;
1368 Ok(Operation::new(op))
1369 }
1370 };
1371
1372 let start = move || async {
1373 let op = self.send().await?;
1374 Ok(Operation::new(op))
1375 };
1376
1377 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1378 }
1379
1380 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1384 self.0.request.parent = v.into();
1385 self
1386 }
1387 }
1388
1389 #[doc(hidden)]
1390 impl gax::options::internal::RequestBuilder for PurgeSuggestionDenyListEntries {
1391 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1392 &mut self.0.options
1393 }
1394 }
1395
1396 #[derive(Clone, Debug)]
1414 pub struct ImportCompletionSuggestions(
1415 RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1416 );
1417
1418 impl ImportCompletionSuggestions {
1419 pub(crate) fn new(
1420 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1421 ) -> Self {
1422 Self(RequestBuilder::new(stub))
1423 }
1424
1425 pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1427 mut self,
1428 v: V,
1429 ) -> Self {
1430 self.0.request = v.into();
1431 self
1432 }
1433
1434 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1436 self.0.options = v.into();
1437 self
1438 }
1439
1440 pub async fn send(self) -> Result<longrunning::model::Operation> {
1447 (*self.0.stub)
1448 .import_completion_suggestions(self.0.request, self.0.options)
1449 .await
1450 .map(gax::response::Response::into_body)
1451 }
1452
1453 pub fn poller(
1455 self,
1456 ) -> impl lro::Poller<
1457 crate::model::ImportCompletionSuggestionsResponse,
1458 crate::model::ImportCompletionSuggestionsMetadata,
1459 > {
1460 type Operation = lro::internal::Operation<
1461 crate::model::ImportCompletionSuggestionsResponse,
1462 crate::model::ImportCompletionSuggestionsMetadata,
1463 >;
1464 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1465 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1466
1467 let stub = self.0.stub.clone();
1468 let mut options = self.0.options.clone();
1469 options.set_retry_policy(gax::retry_policy::NeverRetry);
1470 let query = move |name| {
1471 let stub = stub.clone();
1472 let options = options.clone();
1473 async {
1474 let op = GetOperation::new(stub)
1475 .set_name(name)
1476 .with_options(options)
1477 .send()
1478 .await?;
1479 Ok(Operation::new(op))
1480 }
1481 };
1482
1483 let start = move || async {
1484 let op = self.send().await?;
1485 Ok(Operation::new(op))
1486 };
1487
1488 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1489 }
1490
1491 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1495 self.0.request.parent = v.into();
1496 self
1497 }
1498
1499 pub fn set_error_config<T>(mut self, v: T) -> Self
1501 where
1502 T: std::convert::Into<crate::model::ImportErrorConfig>,
1503 {
1504 self.0.request.error_config = std::option::Option::Some(v.into());
1505 self
1506 }
1507
1508 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1510 where
1511 T: std::convert::Into<crate::model::ImportErrorConfig>,
1512 {
1513 self.0.request.error_config = v.map(|x| x.into());
1514 self
1515 }
1516
1517 pub fn set_source<
1522 T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1523 >(
1524 mut self,
1525 v: T,
1526 ) -> Self {
1527 self.0.request.source = v.into();
1528 self
1529 }
1530
1531 pub fn set_inline_source<
1537 T: std::convert::Into<
1538 std::boxed::Box<
1539 crate::model::import_completion_suggestions_request::InlineSource,
1540 >,
1541 >,
1542 >(
1543 mut self,
1544 v: T,
1545 ) -> Self {
1546 self.0.request = self.0.request.set_inline_source(v);
1547 self
1548 }
1549
1550 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1556 mut self,
1557 v: T,
1558 ) -> Self {
1559 self.0.request = self.0.request.set_gcs_source(v);
1560 self
1561 }
1562
1563 pub fn set_bigquery_source<
1569 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1570 >(
1571 mut self,
1572 v: T,
1573 ) -> Self {
1574 self.0.request = self.0.request.set_bigquery_source(v);
1575 self
1576 }
1577 }
1578
1579 #[doc(hidden)]
1580 impl gax::options::internal::RequestBuilder for ImportCompletionSuggestions {
1581 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1582 &mut self.0.options
1583 }
1584 }
1585
1586 #[derive(Clone, Debug)]
1604 pub struct PurgeCompletionSuggestions(
1605 RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1606 );
1607
1608 impl PurgeCompletionSuggestions {
1609 pub(crate) fn new(
1610 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1611 ) -> Self {
1612 Self(RequestBuilder::new(stub))
1613 }
1614
1615 pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1617 mut self,
1618 v: V,
1619 ) -> Self {
1620 self.0.request = v.into();
1621 self
1622 }
1623
1624 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1626 self.0.options = v.into();
1627 self
1628 }
1629
1630 pub async fn send(self) -> Result<longrunning::model::Operation> {
1637 (*self.0.stub)
1638 .purge_completion_suggestions(self.0.request, self.0.options)
1639 .await
1640 .map(gax::response::Response::into_body)
1641 }
1642
1643 pub fn poller(
1645 self,
1646 ) -> impl lro::Poller<
1647 crate::model::PurgeCompletionSuggestionsResponse,
1648 crate::model::PurgeCompletionSuggestionsMetadata,
1649 > {
1650 type Operation = lro::internal::Operation<
1651 crate::model::PurgeCompletionSuggestionsResponse,
1652 crate::model::PurgeCompletionSuggestionsMetadata,
1653 >;
1654 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1655 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1656
1657 let stub = self.0.stub.clone();
1658 let mut options = self.0.options.clone();
1659 options.set_retry_policy(gax::retry_policy::NeverRetry);
1660 let query = move |name| {
1661 let stub = stub.clone();
1662 let options = options.clone();
1663 async {
1664 let op = GetOperation::new(stub)
1665 .set_name(name)
1666 .with_options(options)
1667 .send()
1668 .await?;
1669 Ok(Operation::new(op))
1670 }
1671 };
1672
1673 let start = move || async {
1674 let op = self.send().await?;
1675 Ok(Operation::new(op))
1676 };
1677
1678 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1679 }
1680
1681 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1685 self.0.request.parent = v.into();
1686 self
1687 }
1688 }
1689
1690 #[doc(hidden)]
1691 impl gax::options::internal::RequestBuilder for PurgeCompletionSuggestions {
1692 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1693 &mut self.0.options
1694 }
1695 }
1696
1697 #[derive(Clone, Debug)]
1718 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1719
1720 impl ListOperations {
1721 pub(crate) fn new(
1722 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1723 ) -> Self {
1724 Self(RequestBuilder::new(stub))
1725 }
1726
1727 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1729 mut self,
1730 v: V,
1731 ) -> Self {
1732 self.0.request = v.into();
1733 self
1734 }
1735
1736 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1738 self.0.options = v.into();
1739 self
1740 }
1741
1742 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1744 (*self.0.stub)
1745 .list_operations(self.0.request, self.0.options)
1746 .await
1747 .map(gax::response::Response::into_body)
1748 }
1749
1750 pub fn by_page(
1752 self,
1753 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1754 {
1755 use std::clone::Clone;
1756 let token = self.0.request.page_token.clone();
1757 let execute = move |token: String| {
1758 let mut builder = self.clone();
1759 builder.0.request = builder.0.request.set_page_token(token);
1760 builder.send()
1761 };
1762 gax::paginator::internal::new_paginator(token, execute)
1763 }
1764
1765 pub fn by_item(
1767 self,
1768 ) -> impl gax::paginator::ItemPaginator<
1769 longrunning::model::ListOperationsResponse,
1770 gax::error::Error,
1771 > {
1772 use gax::paginator::Paginator;
1773 self.by_page().items()
1774 }
1775
1776 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1778 self.0.request.name = v.into();
1779 self
1780 }
1781
1782 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1784 self.0.request.filter = v.into();
1785 self
1786 }
1787
1788 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1790 self.0.request.page_size = v.into();
1791 self
1792 }
1793
1794 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1796 self.0.request.page_token = v.into();
1797 self
1798 }
1799
1800 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1802 self.0.request.return_partial_success = v.into();
1803 self
1804 }
1805 }
1806
1807 #[doc(hidden)]
1808 impl gax::options::internal::RequestBuilder for ListOperations {
1809 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1810 &mut self.0.options
1811 }
1812 }
1813
1814 #[derive(Clone, Debug)]
1831 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1832
1833 impl GetOperation {
1834 pub(crate) fn new(
1835 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1836 ) -> Self {
1837 Self(RequestBuilder::new(stub))
1838 }
1839
1840 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1842 mut self,
1843 v: V,
1844 ) -> Self {
1845 self.0.request = v.into();
1846 self
1847 }
1848
1849 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1851 self.0.options = v.into();
1852 self
1853 }
1854
1855 pub async fn send(self) -> Result<longrunning::model::Operation> {
1857 (*self.0.stub)
1858 .get_operation(self.0.request, self.0.options)
1859 .await
1860 .map(gax::response::Response::into_body)
1861 }
1862
1863 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1865 self.0.request.name = v.into();
1866 self
1867 }
1868 }
1869
1870 #[doc(hidden)]
1871 impl gax::options::internal::RequestBuilder for GetOperation {
1872 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1873 &mut self.0.options
1874 }
1875 }
1876
1877 #[derive(Clone, Debug)]
1894 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1895
1896 impl CancelOperation {
1897 pub(crate) fn new(
1898 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1899 ) -> Self {
1900 Self(RequestBuilder::new(stub))
1901 }
1902
1903 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1905 mut self,
1906 v: V,
1907 ) -> Self {
1908 self.0.request = v.into();
1909 self
1910 }
1911
1912 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1914 self.0.options = v.into();
1915 self
1916 }
1917
1918 pub async fn send(self) -> Result<()> {
1920 (*self.0.stub)
1921 .cancel_operation(self.0.request, self.0.options)
1922 .await
1923 .map(gax::response::Response::into_body)
1924 }
1925
1926 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1928 self.0.request.name = v.into();
1929 self
1930 }
1931 }
1932
1933 #[doc(hidden)]
1934 impl gax::options::internal::RequestBuilder for CancelOperation {
1935 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1936 &mut self.0.options
1937 }
1938 }
1939}
1940
1941#[cfg(feature = "control-service")]
1942#[cfg_attr(docsrs, doc(cfg(feature = "control-service")))]
1943pub mod control_service {
1944 use crate::Result;
1945
1946 pub type ClientBuilder =
1960 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1961
1962 pub(crate) mod client {
1963 use super::super::super::client::ControlService;
1964 pub struct Factory;
1965 impl gax::client_builder::internal::ClientFactory for Factory {
1966 type Client = ControlService;
1967 type Credentials = gaxi::options::Credentials;
1968 async fn build(
1969 self,
1970 config: gaxi::options::ClientConfig,
1971 ) -> gax::client_builder::Result<Self::Client> {
1972 Self::Client::new(config).await
1973 }
1974 }
1975 }
1976
1977 #[derive(Clone, Debug)]
1979 pub(crate) struct RequestBuilder<R: std::default::Default> {
1980 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
1981 request: R,
1982 options: gax::options::RequestOptions,
1983 }
1984
1985 impl<R> RequestBuilder<R>
1986 where
1987 R: std::default::Default,
1988 {
1989 pub(crate) fn new(
1990 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
1991 ) -> Self {
1992 Self {
1993 stub,
1994 request: R::default(),
1995 options: gax::options::RequestOptions::default(),
1996 }
1997 }
1998 }
1999
2000 #[derive(Clone, Debug)]
2017 pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2018
2019 impl CreateControl {
2020 pub(crate) fn new(
2021 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2022 ) -> Self {
2023 Self(RequestBuilder::new(stub))
2024 }
2025
2026 pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2028 self.0.request = v.into();
2029 self
2030 }
2031
2032 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2034 self.0.options = v.into();
2035 self
2036 }
2037
2038 pub async fn send(self) -> Result<crate::model::Control> {
2040 (*self.0.stub)
2041 .create_control(self.0.request, self.0.options)
2042 .await
2043 .map(gax::response::Response::into_body)
2044 }
2045
2046 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2050 self.0.request.parent = v.into();
2051 self
2052 }
2053
2054 pub fn set_control<T>(mut self, v: T) -> Self
2058 where
2059 T: std::convert::Into<crate::model::Control>,
2060 {
2061 self.0.request.control = std::option::Option::Some(v.into());
2062 self
2063 }
2064
2065 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2069 where
2070 T: std::convert::Into<crate::model::Control>,
2071 {
2072 self.0.request.control = v.map(|x| x.into());
2073 self
2074 }
2075
2076 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2080 self.0.request.control_id = v.into();
2081 self
2082 }
2083 }
2084
2085 #[doc(hidden)]
2086 impl gax::options::internal::RequestBuilder for CreateControl {
2087 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2088 &mut self.0.options
2089 }
2090 }
2091
2092 #[derive(Clone, Debug)]
2109 pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2110
2111 impl DeleteControl {
2112 pub(crate) fn new(
2113 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2114 ) -> Self {
2115 Self(RequestBuilder::new(stub))
2116 }
2117
2118 pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2120 self.0.request = v.into();
2121 self
2122 }
2123
2124 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2126 self.0.options = v.into();
2127 self
2128 }
2129
2130 pub async fn send(self) -> Result<()> {
2132 (*self.0.stub)
2133 .delete_control(self.0.request, self.0.options)
2134 .await
2135 .map(gax::response::Response::into_body)
2136 }
2137
2138 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2142 self.0.request.name = v.into();
2143 self
2144 }
2145 }
2146
2147 #[doc(hidden)]
2148 impl gax::options::internal::RequestBuilder for DeleteControl {
2149 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2150 &mut self.0.options
2151 }
2152 }
2153
2154 #[derive(Clone, Debug)]
2171 pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2172
2173 impl UpdateControl {
2174 pub(crate) fn new(
2175 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2176 ) -> Self {
2177 Self(RequestBuilder::new(stub))
2178 }
2179
2180 pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2182 self.0.request = v.into();
2183 self
2184 }
2185
2186 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2188 self.0.options = v.into();
2189 self
2190 }
2191
2192 pub async fn send(self) -> Result<crate::model::Control> {
2194 (*self.0.stub)
2195 .update_control(self.0.request, self.0.options)
2196 .await
2197 .map(gax::response::Response::into_body)
2198 }
2199
2200 pub fn set_control<T>(mut self, v: T) -> Self
2204 where
2205 T: std::convert::Into<crate::model::Control>,
2206 {
2207 self.0.request.control = std::option::Option::Some(v.into());
2208 self
2209 }
2210
2211 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2215 where
2216 T: std::convert::Into<crate::model::Control>,
2217 {
2218 self.0.request.control = v.map(|x| x.into());
2219 self
2220 }
2221
2222 pub fn set_update_mask<T>(mut self, v: T) -> Self
2224 where
2225 T: std::convert::Into<wkt::FieldMask>,
2226 {
2227 self.0.request.update_mask = std::option::Option::Some(v.into());
2228 self
2229 }
2230
2231 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2233 where
2234 T: std::convert::Into<wkt::FieldMask>,
2235 {
2236 self.0.request.update_mask = v.map(|x| x.into());
2237 self
2238 }
2239 }
2240
2241 #[doc(hidden)]
2242 impl gax::options::internal::RequestBuilder for UpdateControl {
2243 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2244 &mut self.0.options
2245 }
2246 }
2247
2248 #[derive(Clone, Debug)]
2265 pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2266
2267 impl GetControl {
2268 pub(crate) fn new(
2269 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2270 ) -> Self {
2271 Self(RequestBuilder::new(stub))
2272 }
2273
2274 pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2276 self.0.request = v.into();
2277 self
2278 }
2279
2280 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2282 self.0.options = v.into();
2283 self
2284 }
2285
2286 pub async fn send(self) -> Result<crate::model::Control> {
2288 (*self.0.stub)
2289 .get_control(self.0.request, self.0.options)
2290 .await
2291 .map(gax::response::Response::into_body)
2292 }
2293
2294 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2298 self.0.request.name = v.into();
2299 self
2300 }
2301 }
2302
2303 #[doc(hidden)]
2304 impl gax::options::internal::RequestBuilder for GetControl {
2305 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2306 &mut self.0.options
2307 }
2308 }
2309
2310 #[derive(Clone, Debug)]
2331 pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2332
2333 impl ListControls {
2334 pub(crate) fn new(
2335 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2336 ) -> Self {
2337 Self(RequestBuilder::new(stub))
2338 }
2339
2340 pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2342 self.0.request = v.into();
2343 self
2344 }
2345
2346 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2348 self.0.options = v.into();
2349 self
2350 }
2351
2352 pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2354 (*self.0.stub)
2355 .list_controls(self.0.request, self.0.options)
2356 .await
2357 .map(gax::response::Response::into_body)
2358 }
2359
2360 pub fn by_page(
2362 self,
2363 ) -> impl gax::paginator::Paginator<crate::model::ListControlsResponse, gax::error::Error>
2364 {
2365 use std::clone::Clone;
2366 let token = self.0.request.page_token.clone();
2367 let execute = move |token: String| {
2368 let mut builder = self.clone();
2369 builder.0.request = builder.0.request.set_page_token(token);
2370 builder.send()
2371 };
2372 gax::paginator::internal::new_paginator(token, execute)
2373 }
2374
2375 pub fn by_item(
2377 self,
2378 ) -> impl gax::paginator::ItemPaginator<crate::model::ListControlsResponse, gax::error::Error>
2379 {
2380 use gax::paginator::Paginator;
2381 self.by_page().items()
2382 }
2383
2384 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2388 self.0.request.parent = v.into();
2389 self
2390 }
2391
2392 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2394 self.0.request.page_size = v.into();
2395 self
2396 }
2397
2398 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2400 self.0.request.page_token = v.into();
2401 self
2402 }
2403
2404 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2406 self.0.request.filter = v.into();
2407 self
2408 }
2409 }
2410
2411 #[doc(hidden)]
2412 impl gax::options::internal::RequestBuilder for ListControls {
2413 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2414 &mut self.0.options
2415 }
2416 }
2417
2418 #[derive(Clone, Debug)]
2439 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2440
2441 impl ListOperations {
2442 pub(crate) fn new(
2443 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2444 ) -> Self {
2445 Self(RequestBuilder::new(stub))
2446 }
2447
2448 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2450 mut self,
2451 v: V,
2452 ) -> Self {
2453 self.0.request = v.into();
2454 self
2455 }
2456
2457 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2459 self.0.options = v.into();
2460 self
2461 }
2462
2463 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2465 (*self.0.stub)
2466 .list_operations(self.0.request, self.0.options)
2467 .await
2468 .map(gax::response::Response::into_body)
2469 }
2470
2471 pub fn by_page(
2473 self,
2474 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2475 {
2476 use std::clone::Clone;
2477 let token = self.0.request.page_token.clone();
2478 let execute = move |token: String| {
2479 let mut builder = self.clone();
2480 builder.0.request = builder.0.request.set_page_token(token);
2481 builder.send()
2482 };
2483 gax::paginator::internal::new_paginator(token, execute)
2484 }
2485
2486 pub fn by_item(
2488 self,
2489 ) -> impl gax::paginator::ItemPaginator<
2490 longrunning::model::ListOperationsResponse,
2491 gax::error::Error,
2492 > {
2493 use gax::paginator::Paginator;
2494 self.by_page().items()
2495 }
2496
2497 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2499 self.0.request.name = v.into();
2500 self
2501 }
2502
2503 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2505 self.0.request.filter = v.into();
2506 self
2507 }
2508
2509 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2511 self.0.request.page_size = v.into();
2512 self
2513 }
2514
2515 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2517 self.0.request.page_token = v.into();
2518 self
2519 }
2520
2521 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2523 self.0.request.return_partial_success = v.into();
2524 self
2525 }
2526 }
2527
2528 #[doc(hidden)]
2529 impl gax::options::internal::RequestBuilder for ListOperations {
2530 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2531 &mut self.0.options
2532 }
2533 }
2534
2535 #[derive(Clone, Debug)]
2552 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2553
2554 impl GetOperation {
2555 pub(crate) fn new(
2556 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2557 ) -> Self {
2558 Self(RequestBuilder::new(stub))
2559 }
2560
2561 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2563 mut self,
2564 v: V,
2565 ) -> Self {
2566 self.0.request = v.into();
2567 self
2568 }
2569
2570 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2572 self.0.options = v.into();
2573 self
2574 }
2575
2576 pub async fn send(self) -> Result<longrunning::model::Operation> {
2578 (*self.0.stub)
2579 .get_operation(self.0.request, self.0.options)
2580 .await
2581 .map(gax::response::Response::into_body)
2582 }
2583
2584 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2586 self.0.request.name = v.into();
2587 self
2588 }
2589 }
2590
2591 #[doc(hidden)]
2592 impl gax::options::internal::RequestBuilder for GetOperation {
2593 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2594 &mut self.0.options
2595 }
2596 }
2597
2598 #[derive(Clone, Debug)]
2615 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2616
2617 impl CancelOperation {
2618 pub(crate) fn new(
2619 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2620 ) -> Self {
2621 Self(RequestBuilder::new(stub))
2622 }
2623
2624 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2626 mut self,
2627 v: V,
2628 ) -> Self {
2629 self.0.request = v.into();
2630 self
2631 }
2632
2633 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2635 self.0.options = v.into();
2636 self
2637 }
2638
2639 pub async fn send(self) -> Result<()> {
2641 (*self.0.stub)
2642 .cancel_operation(self.0.request, self.0.options)
2643 .await
2644 .map(gax::response::Response::into_body)
2645 }
2646
2647 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2649 self.0.request.name = v.into();
2650 self
2651 }
2652 }
2653
2654 #[doc(hidden)]
2655 impl gax::options::internal::RequestBuilder for CancelOperation {
2656 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2657 &mut self.0.options
2658 }
2659 }
2660}
2661
2662#[cfg(feature = "conversational-search-service")]
2663#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2664pub mod conversational_search_service {
2665 use crate::Result;
2666
2667 pub type ClientBuilder =
2681 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2682
2683 pub(crate) mod client {
2684 use super::super::super::client::ConversationalSearchService;
2685 pub struct Factory;
2686 impl gax::client_builder::internal::ClientFactory for Factory {
2687 type Client = ConversationalSearchService;
2688 type Credentials = gaxi::options::Credentials;
2689 async fn build(
2690 self,
2691 config: gaxi::options::ClientConfig,
2692 ) -> gax::client_builder::Result<Self::Client> {
2693 Self::Client::new(config).await
2694 }
2695 }
2696 }
2697
2698 #[derive(Clone, Debug)]
2700 pub(crate) struct RequestBuilder<R: std::default::Default> {
2701 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2702 request: R,
2703 options: gax::options::RequestOptions,
2704 }
2705
2706 impl<R> RequestBuilder<R>
2707 where
2708 R: std::default::Default,
2709 {
2710 pub(crate) fn new(
2711 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2712 ) -> Self {
2713 Self {
2714 stub,
2715 request: R::default(),
2716 options: gax::options::RequestOptions::default(),
2717 }
2718 }
2719 }
2720
2721 #[derive(Clone, Debug)]
2738 pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
2739
2740 impl ConverseConversation {
2741 pub(crate) fn new(
2742 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2743 ) -> Self {
2744 Self(RequestBuilder::new(stub))
2745 }
2746
2747 pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
2749 mut self,
2750 v: V,
2751 ) -> Self {
2752 self.0.request = v.into();
2753 self
2754 }
2755
2756 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2758 self.0.options = v.into();
2759 self
2760 }
2761
2762 pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
2764 (*self.0.stub)
2765 .converse_conversation(self.0.request, self.0.options)
2766 .await
2767 .map(gax::response::Response::into_body)
2768 }
2769
2770 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2774 self.0.request.name = v.into();
2775 self
2776 }
2777
2778 pub fn set_query<T>(mut self, v: T) -> Self
2782 where
2783 T: std::convert::Into<crate::model::TextInput>,
2784 {
2785 self.0.request.query = std::option::Option::Some(v.into());
2786 self
2787 }
2788
2789 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
2793 where
2794 T: std::convert::Into<crate::model::TextInput>,
2795 {
2796 self.0.request.query = v.map(|x| x.into());
2797 self
2798 }
2799
2800 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2802 self.0.request.serving_config = v.into();
2803 self
2804 }
2805
2806 pub fn set_conversation<T>(mut self, v: T) -> Self
2808 where
2809 T: std::convert::Into<crate::model::Conversation>,
2810 {
2811 self.0.request.conversation = std::option::Option::Some(v.into());
2812 self
2813 }
2814
2815 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2817 where
2818 T: std::convert::Into<crate::model::Conversation>,
2819 {
2820 self.0.request.conversation = v.map(|x| x.into());
2821 self
2822 }
2823
2824 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
2826 self.0.request.safe_search = v.into();
2827 self
2828 }
2829
2830 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
2832 where
2833 T: std::iter::IntoIterator<Item = (K, V)>,
2834 K: std::convert::Into<std::string::String>,
2835 V: std::convert::Into<std::string::String>,
2836 {
2837 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2838 self
2839 }
2840
2841 pub fn set_summary_spec<T>(mut self, v: T) -> Self
2843 where
2844 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2845 {
2846 self.0.request.summary_spec = std::option::Option::Some(v.into());
2847 self
2848 }
2849
2850 pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
2852 where
2853 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2854 {
2855 self.0.request.summary_spec = v.map(|x| x.into());
2856 self
2857 }
2858
2859 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2861 self.0.request.filter = v.into();
2862 self
2863 }
2864
2865 pub fn set_boost_spec<T>(mut self, v: T) -> Self
2867 where
2868 T: std::convert::Into<crate::model::search_request::BoostSpec>,
2869 {
2870 self.0.request.boost_spec = std::option::Option::Some(v.into());
2871 self
2872 }
2873
2874 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
2876 where
2877 T: std::convert::Into<crate::model::search_request::BoostSpec>,
2878 {
2879 self.0.request.boost_spec = v.map(|x| x.into());
2880 self
2881 }
2882 }
2883
2884 #[doc(hidden)]
2885 impl gax::options::internal::RequestBuilder for ConverseConversation {
2886 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2887 &mut self.0.options
2888 }
2889 }
2890
2891 #[derive(Clone, Debug)]
2908 pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
2909
2910 impl CreateConversation {
2911 pub(crate) fn new(
2912 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2913 ) -> Self {
2914 Self(RequestBuilder::new(stub))
2915 }
2916
2917 pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
2919 mut self,
2920 v: V,
2921 ) -> Self {
2922 self.0.request = v.into();
2923 self
2924 }
2925
2926 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2928 self.0.options = v.into();
2929 self
2930 }
2931
2932 pub async fn send(self) -> Result<crate::model::Conversation> {
2934 (*self.0.stub)
2935 .create_conversation(self.0.request, self.0.options)
2936 .await
2937 .map(gax::response::Response::into_body)
2938 }
2939
2940 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2944 self.0.request.parent = v.into();
2945 self
2946 }
2947
2948 pub fn set_conversation<T>(mut self, v: T) -> Self
2952 where
2953 T: std::convert::Into<crate::model::Conversation>,
2954 {
2955 self.0.request.conversation = std::option::Option::Some(v.into());
2956 self
2957 }
2958
2959 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2963 where
2964 T: std::convert::Into<crate::model::Conversation>,
2965 {
2966 self.0.request.conversation = v.map(|x| x.into());
2967 self
2968 }
2969 }
2970
2971 #[doc(hidden)]
2972 impl gax::options::internal::RequestBuilder for CreateConversation {
2973 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2974 &mut self.0.options
2975 }
2976 }
2977
2978 #[derive(Clone, Debug)]
2995 pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
2996
2997 impl DeleteConversation {
2998 pub(crate) fn new(
2999 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3000 ) -> Self {
3001 Self(RequestBuilder::new(stub))
3002 }
3003
3004 pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3006 mut self,
3007 v: V,
3008 ) -> Self {
3009 self.0.request = v.into();
3010 self
3011 }
3012
3013 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3015 self.0.options = v.into();
3016 self
3017 }
3018
3019 pub async fn send(self) -> Result<()> {
3021 (*self.0.stub)
3022 .delete_conversation(self.0.request, self.0.options)
3023 .await
3024 .map(gax::response::Response::into_body)
3025 }
3026
3027 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3031 self.0.request.name = v.into();
3032 self
3033 }
3034 }
3035
3036 #[doc(hidden)]
3037 impl gax::options::internal::RequestBuilder for DeleteConversation {
3038 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3039 &mut self.0.options
3040 }
3041 }
3042
3043 #[derive(Clone, Debug)]
3060 pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3061
3062 impl UpdateConversation {
3063 pub(crate) fn new(
3064 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3065 ) -> Self {
3066 Self(RequestBuilder::new(stub))
3067 }
3068
3069 pub fn with_request<V: Into<crate::model::UpdateConversationRequest>>(
3071 mut self,
3072 v: V,
3073 ) -> Self {
3074 self.0.request = v.into();
3075 self
3076 }
3077
3078 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3080 self.0.options = v.into();
3081 self
3082 }
3083
3084 pub async fn send(self) -> Result<crate::model::Conversation> {
3086 (*self.0.stub)
3087 .update_conversation(self.0.request, self.0.options)
3088 .await
3089 .map(gax::response::Response::into_body)
3090 }
3091
3092 pub fn set_conversation<T>(mut self, v: T) -> Self
3096 where
3097 T: std::convert::Into<crate::model::Conversation>,
3098 {
3099 self.0.request.conversation = std::option::Option::Some(v.into());
3100 self
3101 }
3102
3103 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3107 where
3108 T: std::convert::Into<crate::model::Conversation>,
3109 {
3110 self.0.request.conversation = v.map(|x| x.into());
3111 self
3112 }
3113
3114 pub fn set_update_mask<T>(mut self, v: T) -> Self
3116 where
3117 T: std::convert::Into<wkt::FieldMask>,
3118 {
3119 self.0.request.update_mask = std::option::Option::Some(v.into());
3120 self
3121 }
3122
3123 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3125 where
3126 T: std::convert::Into<wkt::FieldMask>,
3127 {
3128 self.0.request.update_mask = v.map(|x| x.into());
3129 self
3130 }
3131 }
3132
3133 #[doc(hidden)]
3134 impl gax::options::internal::RequestBuilder for UpdateConversation {
3135 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3136 &mut self.0.options
3137 }
3138 }
3139
3140 #[derive(Clone, Debug)]
3157 pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3158
3159 impl GetConversation {
3160 pub(crate) fn new(
3161 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3162 ) -> Self {
3163 Self(RequestBuilder::new(stub))
3164 }
3165
3166 pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3168 self.0.request = v.into();
3169 self
3170 }
3171
3172 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3174 self.0.options = v.into();
3175 self
3176 }
3177
3178 pub async fn send(self) -> Result<crate::model::Conversation> {
3180 (*self.0.stub)
3181 .get_conversation(self.0.request, self.0.options)
3182 .await
3183 .map(gax::response::Response::into_body)
3184 }
3185
3186 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3190 self.0.request.name = v.into();
3191 self
3192 }
3193 }
3194
3195 #[doc(hidden)]
3196 impl gax::options::internal::RequestBuilder for GetConversation {
3197 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3198 &mut self.0.options
3199 }
3200 }
3201
3202 #[derive(Clone, Debug)]
3223 pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3224
3225 impl ListConversations {
3226 pub(crate) fn new(
3227 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3228 ) -> Self {
3229 Self(RequestBuilder::new(stub))
3230 }
3231
3232 pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3234 mut self,
3235 v: V,
3236 ) -> Self {
3237 self.0.request = v.into();
3238 self
3239 }
3240
3241 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3243 self.0.options = v.into();
3244 self
3245 }
3246
3247 pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3249 (*self.0.stub)
3250 .list_conversations(self.0.request, self.0.options)
3251 .await
3252 .map(gax::response::Response::into_body)
3253 }
3254
3255 pub fn by_page(
3257 self,
3258 ) -> impl gax::paginator::Paginator<crate::model::ListConversationsResponse, gax::error::Error>
3259 {
3260 use std::clone::Clone;
3261 let token = self.0.request.page_token.clone();
3262 let execute = move |token: String| {
3263 let mut builder = self.clone();
3264 builder.0.request = builder.0.request.set_page_token(token);
3265 builder.send()
3266 };
3267 gax::paginator::internal::new_paginator(token, execute)
3268 }
3269
3270 pub fn by_item(
3272 self,
3273 ) -> impl gax::paginator::ItemPaginator<crate::model::ListConversationsResponse, gax::error::Error>
3274 {
3275 use gax::paginator::Paginator;
3276 self.by_page().items()
3277 }
3278
3279 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3283 self.0.request.parent = v.into();
3284 self
3285 }
3286
3287 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3289 self.0.request.page_size = v.into();
3290 self
3291 }
3292
3293 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3295 self.0.request.page_token = v.into();
3296 self
3297 }
3298
3299 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3301 self.0.request.filter = v.into();
3302 self
3303 }
3304
3305 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3307 self.0.request.order_by = v.into();
3308 self
3309 }
3310 }
3311
3312 #[doc(hidden)]
3313 impl gax::options::internal::RequestBuilder for ListConversations {
3314 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3315 &mut self.0.options
3316 }
3317 }
3318
3319 #[derive(Clone, Debug)]
3336 pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3337
3338 impl AnswerQuery {
3339 pub(crate) fn new(
3340 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3341 ) -> Self {
3342 Self(RequestBuilder::new(stub))
3343 }
3344
3345 pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3347 self.0.request = v.into();
3348 self
3349 }
3350
3351 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3353 self.0.options = v.into();
3354 self
3355 }
3356
3357 pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3359 (*self.0.stub)
3360 .answer_query(self.0.request, self.0.options)
3361 .await
3362 .map(gax::response::Response::into_body)
3363 }
3364
3365 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3369 self.0.request.serving_config = v.into();
3370 self
3371 }
3372
3373 pub fn set_query<T>(mut self, v: T) -> Self
3377 where
3378 T: std::convert::Into<crate::model::Query>,
3379 {
3380 self.0.request.query = std::option::Option::Some(v.into());
3381 self
3382 }
3383
3384 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3388 where
3389 T: std::convert::Into<crate::model::Query>,
3390 {
3391 self.0.request.query = v.map(|x| x.into());
3392 self
3393 }
3394
3395 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3397 self.0.request.session = v.into();
3398 self
3399 }
3400
3401 pub fn set_safety_spec<T>(mut self, v: T) -> Self
3403 where
3404 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3405 {
3406 self.0.request.safety_spec = std::option::Option::Some(v.into());
3407 self
3408 }
3409
3410 pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3412 where
3413 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3414 {
3415 self.0.request.safety_spec = v.map(|x| x.into());
3416 self
3417 }
3418
3419 pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3421 where
3422 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3423 {
3424 self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3425 self
3426 }
3427
3428 pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3430 where
3431 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3432 {
3433 self.0.request.related_questions_spec = v.map(|x| x.into());
3434 self
3435 }
3436
3437 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3439 where
3440 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3441 {
3442 self.0.request.grounding_spec = std::option::Option::Some(v.into());
3443 self
3444 }
3445
3446 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3448 where
3449 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3450 {
3451 self.0.request.grounding_spec = v.map(|x| x.into());
3452 self
3453 }
3454
3455 pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3457 where
3458 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3459 {
3460 self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3461 self
3462 }
3463
3464 pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3466 where
3467 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3468 {
3469 self.0.request.answer_generation_spec = v.map(|x| x.into());
3470 self
3471 }
3472
3473 pub fn set_search_spec<T>(mut self, v: T) -> Self
3475 where
3476 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3477 {
3478 self.0.request.search_spec = std::option::Option::Some(v.into());
3479 self
3480 }
3481
3482 pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3484 where
3485 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3486 {
3487 self.0.request.search_spec = v.map(|x| x.into());
3488 self
3489 }
3490
3491 pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3493 where
3494 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3495 {
3496 self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3497 self
3498 }
3499
3500 pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3502 where
3503 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3504 {
3505 self.0.request.query_understanding_spec = v.map(|x| x.into());
3506 self
3507 }
3508
3509 #[deprecated]
3511 pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3512 self.0.request.asynchronous_mode = v.into();
3513 self
3514 }
3515
3516 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3518 self.0.request.user_pseudo_id = v.into();
3519 self
3520 }
3521
3522 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3524 where
3525 T: std::iter::IntoIterator<Item = (K, V)>,
3526 K: std::convert::Into<std::string::String>,
3527 V: std::convert::Into<std::string::String>,
3528 {
3529 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3530 self
3531 }
3532
3533 pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3535 where
3536 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3537 {
3538 self.0.request.end_user_spec = std::option::Option::Some(v.into());
3539 self
3540 }
3541
3542 pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3544 where
3545 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3546 {
3547 self.0.request.end_user_spec = v.map(|x| x.into());
3548 self
3549 }
3550 }
3551
3552 #[doc(hidden)]
3553 impl gax::options::internal::RequestBuilder for AnswerQuery {
3554 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3555 &mut self.0.options
3556 }
3557 }
3558
3559 #[derive(Clone, Debug)]
3576 pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
3577
3578 impl GetAnswer {
3579 pub(crate) fn new(
3580 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3581 ) -> Self {
3582 Self(RequestBuilder::new(stub))
3583 }
3584
3585 pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
3587 self.0.request = v.into();
3588 self
3589 }
3590
3591 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3593 self.0.options = v.into();
3594 self
3595 }
3596
3597 pub async fn send(self) -> Result<crate::model::Answer> {
3599 (*self.0.stub)
3600 .get_answer(self.0.request, self.0.options)
3601 .await
3602 .map(gax::response::Response::into_body)
3603 }
3604
3605 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3609 self.0.request.name = v.into();
3610 self
3611 }
3612 }
3613
3614 #[doc(hidden)]
3615 impl gax::options::internal::RequestBuilder for GetAnswer {
3616 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3617 &mut self.0.options
3618 }
3619 }
3620
3621 #[derive(Clone, Debug)]
3638 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
3639
3640 impl CreateSession {
3641 pub(crate) fn new(
3642 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3643 ) -> Self {
3644 Self(RequestBuilder::new(stub))
3645 }
3646
3647 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
3649 self.0.request = v.into();
3650 self
3651 }
3652
3653 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3655 self.0.options = v.into();
3656 self
3657 }
3658
3659 pub async fn send(self) -> Result<crate::model::Session> {
3661 (*self.0.stub)
3662 .create_session(self.0.request, self.0.options)
3663 .await
3664 .map(gax::response::Response::into_body)
3665 }
3666
3667 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3671 self.0.request.parent = v.into();
3672 self
3673 }
3674
3675 pub fn set_session<T>(mut self, v: T) -> Self
3679 where
3680 T: std::convert::Into<crate::model::Session>,
3681 {
3682 self.0.request.session = std::option::Option::Some(v.into());
3683 self
3684 }
3685
3686 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3690 where
3691 T: std::convert::Into<crate::model::Session>,
3692 {
3693 self.0.request.session = v.map(|x| x.into());
3694 self
3695 }
3696 }
3697
3698 #[doc(hidden)]
3699 impl gax::options::internal::RequestBuilder for CreateSession {
3700 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3701 &mut self.0.options
3702 }
3703 }
3704
3705 #[derive(Clone, Debug)]
3722 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
3723
3724 impl DeleteSession {
3725 pub(crate) fn new(
3726 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3727 ) -> Self {
3728 Self(RequestBuilder::new(stub))
3729 }
3730
3731 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
3733 self.0.request = v.into();
3734 self
3735 }
3736
3737 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3739 self.0.options = v.into();
3740 self
3741 }
3742
3743 pub async fn send(self) -> Result<()> {
3745 (*self.0.stub)
3746 .delete_session(self.0.request, self.0.options)
3747 .await
3748 .map(gax::response::Response::into_body)
3749 }
3750
3751 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3755 self.0.request.name = v.into();
3756 self
3757 }
3758 }
3759
3760 #[doc(hidden)]
3761 impl gax::options::internal::RequestBuilder for DeleteSession {
3762 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3763 &mut self.0.options
3764 }
3765 }
3766
3767 #[derive(Clone, Debug)]
3784 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
3785
3786 impl UpdateSession {
3787 pub(crate) fn new(
3788 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3789 ) -> Self {
3790 Self(RequestBuilder::new(stub))
3791 }
3792
3793 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
3795 self.0.request = v.into();
3796 self
3797 }
3798
3799 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3801 self.0.options = v.into();
3802 self
3803 }
3804
3805 pub async fn send(self) -> Result<crate::model::Session> {
3807 (*self.0.stub)
3808 .update_session(self.0.request, self.0.options)
3809 .await
3810 .map(gax::response::Response::into_body)
3811 }
3812
3813 pub fn set_session<T>(mut self, v: T) -> Self
3817 where
3818 T: std::convert::Into<crate::model::Session>,
3819 {
3820 self.0.request.session = std::option::Option::Some(v.into());
3821 self
3822 }
3823
3824 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3828 where
3829 T: std::convert::Into<crate::model::Session>,
3830 {
3831 self.0.request.session = v.map(|x| x.into());
3832 self
3833 }
3834
3835 pub fn set_update_mask<T>(mut self, v: T) -> Self
3837 where
3838 T: std::convert::Into<wkt::FieldMask>,
3839 {
3840 self.0.request.update_mask = std::option::Option::Some(v.into());
3841 self
3842 }
3843
3844 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3846 where
3847 T: std::convert::Into<wkt::FieldMask>,
3848 {
3849 self.0.request.update_mask = v.map(|x| x.into());
3850 self
3851 }
3852 }
3853
3854 #[doc(hidden)]
3855 impl gax::options::internal::RequestBuilder for UpdateSession {
3856 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3857 &mut self.0.options
3858 }
3859 }
3860
3861 #[derive(Clone, Debug)]
3878 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
3879
3880 impl GetSession {
3881 pub(crate) fn new(
3882 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3883 ) -> Self {
3884 Self(RequestBuilder::new(stub))
3885 }
3886
3887 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
3889 self.0.request = v.into();
3890 self
3891 }
3892
3893 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3895 self.0.options = v.into();
3896 self
3897 }
3898
3899 pub async fn send(self) -> Result<crate::model::Session> {
3901 (*self.0.stub)
3902 .get_session(self.0.request, self.0.options)
3903 .await
3904 .map(gax::response::Response::into_body)
3905 }
3906
3907 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3911 self.0.request.name = v.into();
3912 self
3913 }
3914
3915 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
3917 self.0.request.include_answer_details = v.into();
3918 self
3919 }
3920 }
3921
3922 #[doc(hidden)]
3923 impl gax::options::internal::RequestBuilder for GetSession {
3924 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3925 &mut self.0.options
3926 }
3927 }
3928
3929 #[derive(Clone, Debug)]
3950 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
3951
3952 impl ListSessions {
3953 pub(crate) fn new(
3954 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3955 ) -> Self {
3956 Self(RequestBuilder::new(stub))
3957 }
3958
3959 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
3961 self.0.request = v.into();
3962 self
3963 }
3964
3965 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3967 self.0.options = v.into();
3968 self
3969 }
3970
3971 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
3973 (*self.0.stub)
3974 .list_sessions(self.0.request, self.0.options)
3975 .await
3976 .map(gax::response::Response::into_body)
3977 }
3978
3979 pub fn by_page(
3981 self,
3982 ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
3983 {
3984 use std::clone::Clone;
3985 let token = self.0.request.page_token.clone();
3986 let execute = move |token: String| {
3987 let mut builder = self.clone();
3988 builder.0.request = builder.0.request.set_page_token(token);
3989 builder.send()
3990 };
3991 gax::paginator::internal::new_paginator(token, execute)
3992 }
3993
3994 pub fn by_item(
3996 self,
3997 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
3998 {
3999 use gax::paginator::Paginator;
4000 self.by_page().items()
4001 }
4002
4003 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4007 self.0.request.parent = v.into();
4008 self
4009 }
4010
4011 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4013 self.0.request.page_size = v.into();
4014 self
4015 }
4016
4017 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4019 self.0.request.page_token = v.into();
4020 self
4021 }
4022
4023 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4025 self.0.request.filter = v.into();
4026 self
4027 }
4028
4029 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4031 self.0.request.order_by = v.into();
4032 self
4033 }
4034 }
4035
4036 #[doc(hidden)]
4037 impl gax::options::internal::RequestBuilder for ListSessions {
4038 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4039 &mut self.0.options
4040 }
4041 }
4042
4043 #[derive(Clone, Debug)]
4064 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4065
4066 impl ListOperations {
4067 pub(crate) fn new(
4068 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4069 ) -> Self {
4070 Self(RequestBuilder::new(stub))
4071 }
4072
4073 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4075 mut self,
4076 v: V,
4077 ) -> Self {
4078 self.0.request = v.into();
4079 self
4080 }
4081
4082 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4084 self.0.options = v.into();
4085 self
4086 }
4087
4088 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4090 (*self.0.stub)
4091 .list_operations(self.0.request, self.0.options)
4092 .await
4093 .map(gax::response::Response::into_body)
4094 }
4095
4096 pub fn by_page(
4098 self,
4099 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4100 {
4101 use std::clone::Clone;
4102 let token = self.0.request.page_token.clone();
4103 let execute = move |token: String| {
4104 let mut builder = self.clone();
4105 builder.0.request = builder.0.request.set_page_token(token);
4106 builder.send()
4107 };
4108 gax::paginator::internal::new_paginator(token, execute)
4109 }
4110
4111 pub fn by_item(
4113 self,
4114 ) -> impl gax::paginator::ItemPaginator<
4115 longrunning::model::ListOperationsResponse,
4116 gax::error::Error,
4117 > {
4118 use gax::paginator::Paginator;
4119 self.by_page().items()
4120 }
4121
4122 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4124 self.0.request.name = v.into();
4125 self
4126 }
4127
4128 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4130 self.0.request.filter = v.into();
4131 self
4132 }
4133
4134 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4136 self.0.request.page_size = v.into();
4137 self
4138 }
4139
4140 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4142 self.0.request.page_token = v.into();
4143 self
4144 }
4145
4146 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4148 self.0.request.return_partial_success = v.into();
4149 self
4150 }
4151 }
4152
4153 #[doc(hidden)]
4154 impl gax::options::internal::RequestBuilder for ListOperations {
4155 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4156 &mut self.0.options
4157 }
4158 }
4159
4160 #[derive(Clone, Debug)]
4177 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4178
4179 impl GetOperation {
4180 pub(crate) fn new(
4181 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4182 ) -> Self {
4183 Self(RequestBuilder::new(stub))
4184 }
4185
4186 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4188 mut self,
4189 v: V,
4190 ) -> Self {
4191 self.0.request = v.into();
4192 self
4193 }
4194
4195 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4197 self.0.options = v.into();
4198 self
4199 }
4200
4201 pub async fn send(self) -> Result<longrunning::model::Operation> {
4203 (*self.0.stub)
4204 .get_operation(self.0.request, self.0.options)
4205 .await
4206 .map(gax::response::Response::into_body)
4207 }
4208
4209 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4211 self.0.request.name = v.into();
4212 self
4213 }
4214 }
4215
4216 #[doc(hidden)]
4217 impl gax::options::internal::RequestBuilder for GetOperation {
4218 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4219 &mut self.0.options
4220 }
4221 }
4222
4223 #[derive(Clone, Debug)]
4240 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
4241
4242 impl CancelOperation {
4243 pub(crate) fn new(
4244 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4245 ) -> Self {
4246 Self(RequestBuilder::new(stub))
4247 }
4248
4249 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
4251 mut self,
4252 v: V,
4253 ) -> Self {
4254 self.0.request = v.into();
4255 self
4256 }
4257
4258 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4260 self.0.options = v.into();
4261 self
4262 }
4263
4264 pub async fn send(self) -> Result<()> {
4266 (*self.0.stub)
4267 .cancel_operation(self.0.request, self.0.options)
4268 .await
4269 .map(gax::response::Response::into_body)
4270 }
4271
4272 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4274 self.0.request.name = v.into();
4275 self
4276 }
4277 }
4278
4279 #[doc(hidden)]
4280 impl gax::options::internal::RequestBuilder for CancelOperation {
4281 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4282 &mut self.0.options
4283 }
4284 }
4285}
4286
4287#[cfg(feature = "data-store-service")]
4288#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4289pub mod data_store_service {
4290 use crate::Result;
4291
4292 pub type ClientBuilder =
4306 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4307
4308 pub(crate) mod client {
4309 use super::super::super::client::DataStoreService;
4310 pub struct Factory;
4311 impl gax::client_builder::internal::ClientFactory for Factory {
4312 type Client = DataStoreService;
4313 type Credentials = gaxi::options::Credentials;
4314 async fn build(
4315 self,
4316 config: gaxi::options::ClientConfig,
4317 ) -> gax::client_builder::Result<Self::Client> {
4318 Self::Client::new(config).await
4319 }
4320 }
4321 }
4322
4323 #[derive(Clone, Debug)]
4325 pub(crate) struct RequestBuilder<R: std::default::Default> {
4326 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4327 request: R,
4328 options: gax::options::RequestOptions,
4329 }
4330
4331 impl<R> RequestBuilder<R>
4332 where
4333 R: std::default::Default,
4334 {
4335 pub(crate) fn new(
4336 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4337 ) -> Self {
4338 Self {
4339 stub,
4340 request: R::default(),
4341 options: gax::options::RequestOptions::default(),
4342 }
4343 }
4344 }
4345
4346 #[derive(Clone, Debug)]
4364 pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4365
4366 impl CreateDataStore {
4367 pub(crate) fn new(
4368 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4369 ) -> Self {
4370 Self(RequestBuilder::new(stub))
4371 }
4372
4373 pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4375 self.0.request = v.into();
4376 self
4377 }
4378
4379 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4381 self.0.options = v.into();
4382 self
4383 }
4384
4385 pub async fn send(self) -> Result<longrunning::model::Operation> {
4392 (*self.0.stub)
4393 .create_data_store(self.0.request, self.0.options)
4394 .await
4395 .map(gax::response::Response::into_body)
4396 }
4397
4398 pub fn poller(
4400 self,
4401 ) -> impl lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4402 {
4403 type Operation = lro::internal::Operation<
4404 crate::model::DataStore,
4405 crate::model::CreateDataStoreMetadata,
4406 >;
4407 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4408 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4409
4410 let stub = self.0.stub.clone();
4411 let mut options = self.0.options.clone();
4412 options.set_retry_policy(gax::retry_policy::NeverRetry);
4413 let query = move |name| {
4414 let stub = stub.clone();
4415 let options = options.clone();
4416 async {
4417 let op = GetOperation::new(stub)
4418 .set_name(name)
4419 .with_options(options)
4420 .send()
4421 .await?;
4422 Ok(Operation::new(op))
4423 }
4424 };
4425
4426 let start = move || async {
4427 let op = self.send().await?;
4428 Ok(Operation::new(op))
4429 };
4430
4431 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4432 }
4433
4434 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4438 self.0.request.parent = v.into();
4439 self
4440 }
4441
4442 pub fn set_data_store<T>(mut self, v: T) -> Self
4446 where
4447 T: std::convert::Into<crate::model::DataStore>,
4448 {
4449 self.0.request.data_store = std::option::Option::Some(v.into());
4450 self
4451 }
4452
4453 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4457 where
4458 T: std::convert::Into<crate::model::DataStore>,
4459 {
4460 self.0.request.data_store = v.map(|x| x.into());
4461 self
4462 }
4463
4464 pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4468 self.0.request.data_store_id = v.into();
4469 self
4470 }
4471
4472 pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
4474 self.0.request.create_advanced_site_search = v.into();
4475 self
4476 }
4477
4478 pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
4480 self.0.request.skip_default_schema_creation = v.into();
4481 self
4482 }
4483
4484 pub fn set_cmek_options<
4489 T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
4490 >(
4491 mut self,
4492 v: T,
4493 ) -> Self {
4494 self.0.request.cmek_options = v.into();
4495 self
4496 }
4497
4498 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
4504 mut self,
4505 v: T,
4506 ) -> Self {
4507 self.0.request = self.0.request.set_cmek_config_name(v);
4508 self
4509 }
4510
4511 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4517 self.0.request = self.0.request.set_disable_cmek(v);
4518 self
4519 }
4520 }
4521
4522 #[doc(hidden)]
4523 impl gax::options::internal::RequestBuilder for CreateDataStore {
4524 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4525 &mut self.0.options
4526 }
4527 }
4528
4529 #[derive(Clone, Debug)]
4546 pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
4547
4548 impl GetDataStore {
4549 pub(crate) fn new(
4550 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4551 ) -> Self {
4552 Self(RequestBuilder::new(stub))
4553 }
4554
4555 pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
4557 self.0.request = v.into();
4558 self
4559 }
4560
4561 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4563 self.0.options = v.into();
4564 self
4565 }
4566
4567 pub async fn send(self) -> Result<crate::model::DataStore> {
4569 (*self.0.stub)
4570 .get_data_store(self.0.request, self.0.options)
4571 .await
4572 .map(gax::response::Response::into_body)
4573 }
4574
4575 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4579 self.0.request.name = v.into();
4580 self
4581 }
4582 }
4583
4584 #[doc(hidden)]
4585 impl gax::options::internal::RequestBuilder for GetDataStore {
4586 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4587 &mut self.0.options
4588 }
4589 }
4590
4591 #[derive(Clone, Debug)]
4612 pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
4613
4614 impl ListDataStores {
4615 pub(crate) fn new(
4616 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4617 ) -> Self {
4618 Self(RequestBuilder::new(stub))
4619 }
4620
4621 pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
4623 self.0.request = v.into();
4624 self
4625 }
4626
4627 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4629 self.0.options = v.into();
4630 self
4631 }
4632
4633 pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
4635 (*self.0.stub)
4636 .list_data_stores(self.0.request, self.0.options)
4637 .await
4638 .map(gax::response::Response::into_body)
4639 }
4640
4641 pub fn by_page(
4643 self,
4644 ) -> impl gax::paginator::Paginator<crate::model::ListDataStoresResponse, gax::error::Error>
4645 {
4646 use std::clone::Clone;
4647 let token = self.0.request.page_token.clone();
4648 let execute = move |token: String| {
4649 let mut builder = self.clone();
4650 builder.0.request = builder.0.request.set_page_token(token);
4651 builder.send()
4652 };
4653 gax::paginator::internal::new_paginator(token, execute)
4654 }
4655
4656 pub fn by_item(
4658 self,
4659 ) -> impl gax::paginator::ItemPaginator<crate::model::ListDataStoresResponse, gax::error::Error>
4660 {
4661 use gax::paginator::Paginator;
4662 self.by_page().items()
4663 }
4664
4665 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4669 self.0.request.parent = v.into();
4670 self
4671 }
4672
4673 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4675 self.0.request.page_size = v.into();
4676 self
4677 }
4678
4679 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4681 self.0.request.page_token = v.into();
4682 self
4683 }
4684
4685 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4687 self.0.request.filter = v.into();
4688 self
4689 }
4690 }
4691
4692 #[doc(hidden)]
4693 impl gax::options::internal::RequestBuilder for ListDataStores {
4694 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4695 &mut self.0.options
4696 }
4697 }
4698
4699 #[derive(Clone, Debug)]
4717 pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
4718
4719 impl DeleteDataStore {
4720 pub(crate) fn new(
4721 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4722 ) -> Self {
4723 Self(RequestBuilder::new(stub))
4724 }
4725
4726 pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
4728 self.0.request = v.into();
4729 self
4730 }
4731
4732 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4734 self.0.options = v.into();
4735 self
4736 }
4737
4738 pub async fn send(self) -> Result<longrunning::model::Operation> {
4745 (*self.0.stub)
4746 .delete_data_store(self.0.request, self.0.options)
4747 .await
4748 .map(gax::response::Response::into_body)
4749 }
4750
4751 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
4753 type Operation =
4754 lro::internal::Operation<wkt::Empty, crate::model::DeleteDataStoreMetadata>;
4755 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4756 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4757
4758 let stub = self.0.stub.clone();
4759 let mut options = self.0.options.clone();
4760 options.set_retry_policy(gax::retry_policy::NeverRetry);
4761 let query = move |name| {
4762 let stub = stub.clone();
4763 let options = options.clone();
4764 async {
4765 let op = GetOperation::new(stub)
4766 .set_name(name)
4767 .with_options(options)
4768 .send()
4769 .await?;
4770 Ok(Operation::new(op))
4771 }
4772 };
4773
4774 let start = move || async {
4775 let op = self.send().await?;
4776 Ok(Operation::new(op))
4777 };
4778
4779 lro::internal::new_unit_response_poller(
4780 polling_error_policy,
4781 polling_backoff_policy,
4782 start,
4783 query,
4784 )
4785 }
4786
4787 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4791 self.0.request.name = v.into();
4792 self
4793 }
4794 }
4795
4796 #[doc(hidden)]
4797 impl gax::options::internal::RequestBuilder for DeleteDataStore {
4798 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4799 &mut self.0.options
4800 }
4801 }
4802
4803 #[derive(Clone, Debug)]
4820 pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
4821
4822 impl UpdateDataStore {
4823 pub(crate) fn new(
4824 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4825 ) -> Self {
4826 Self(RequestBuilder::new(stub))
4827 }
4828
4829 pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
4831 self.0.request = v.into();
4832 self
4833 }
4834
4835 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4837 self.0.options = v.into();
4838 self
4839 }
4840
4841 pub async fn send(self) -> Result<crate::model::DataStore> {
4843 (*self.0.stub)
4844 .update_data_store(self.0.request, self.0.options)
4845 .await
4846 .map(gax::response::Response::into_body)
4847 }
4848
4849 pub fn set_data_store<T>(mut self, v: T) -> Self
4853 where
4854 T: std::convert::Into<crate::model::DataStore>,
4855 {
4856 self.0.request.data_store = std::option::Option::Some(v.into());
4857 self
4858 }
4859
4860 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4864 where
4865 T: std::convert::Into<crate::model::DataStore>,
4866 {
4867 self.0.request.data_store = v.map(|x| x.into());
4868 self
4869 }
4870
4871 pub fn set_update_mask<T>(mut self, v: T) -> Self
4873 where
4874 T: std::convert::Into<wkt::FieldMask>,
4875 {
4876 self.0.request.update_mask = std::option::Option::Some(v.into());
4877 self
4878 }
4879
4880 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4882 where
4883 T: std::convert::Into<wkt::FieldMask>,
4884 {
4885 self.0.request.update_mask = v.map(|x| x.into());
4886 self
4887 }
4888 }
4889
4890 #[doc(hidden)]
4891 impl gax::options::internal::RequestBuilder for UpdateDataStore {
4892 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4893 &mut self.0.options
4894 }
4895 }
4896
4897 #[derive(Clone, Debug)]
4918 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4919
4920 impl ListOperations {
4921 pub(crate) fn new(
4922 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4923 ) -> Self {
4924 Self(RequestBuilder::new(stub))
4925 }
4926
4927 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4929 mut self,
4930 v: V,
4931 ) -> Self {
4932 self.0.request = v.into();
4933 self
4934 }
4935
4936 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4938 self.0.options = v.into();
4939 self
4940 }
4941
4942 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4944 (*self.0.stub)
4945 .list_operations(self.0.request, self.0.options)
4946 .await
4947 .map(gax::response::Response::into_body)
4948 }
4949
4950 pub fn by_page(
4952 self,
4953 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4954 {
4955 use std::clone::Clone;
4956 let token = self.0.request.page_token.clone();
4957 let execute = move |token: String| {
4958 let mut builder = self.clone();
4959 builder.0.request = builder.0.request.set_page_token(token);
4960 builder.send()
4961 };
4962 gax::paginator::internal::new_paginator(token, execute)
4963 }
4964
4965 pub fn by_item(
4967 self,
4968 ) -> impl gax::paginator::ItemPaginator<
4969 longrunning::model::ListOperationsResponse,
4970 gax::error::Error,
4971 > {
4972 use gax::paginator::Paginator;
4973 self.by_page().items()
4974 }
4975
4976 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4978 self.0.request.name = v.into();
4979 self
4980 }
4981
4982 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4984 self.0.request.filter = v.into();
4985 self
4986 }
4987
4988 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4990 self.0.request.page_size = v.into();
4991 self
4992 }
4993
4994 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4996 self.0.request.page_token = v.into();
4997 self
4998 }
4999
5000 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5002 self.0.request.return_partial_success = v.into();
5003 self
5004 }
5005 }
5006
5007 #[doc(hidden)]
5008 impl gax::options::internal::RequestBuilder for ListOperations {
5009 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5010 &mut self.0.options
5011 }
5012 }
5013
5014 #[derive(Clone, Debug)]
5031 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5032
5033 impl GetOperation {
5034 pub(crate) fn new(
5035 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5036 ) -> Self {
5037 Self(RequestBuilder::new(stub))
5038 }
5039
5040 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5042 mut self,
5043 v: V,
5044 ) -> Self {
5045 self.0.request = v.into();
5046 self
5047 }
5048
5049 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5051 self.0.options = v.into();
5052 self
5053 }
5054
5055 pub async fn send(self) -> Result<longrunning::model::Operation> {
5057 (*self.0.stub)
5058 .get_operation(self.0.request, self.0.options)
5059 .await
5060 .map(gax::response::Response::into_body)
5061 }
5062
5063 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5065 self.0.request.name = v.into();
5066 self
5067 }
5068 }
5069
5070 #[doc(hidden)]
5071 impl gax::options::internal::RequestBuilder for GetOperation {
5072 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5073 &mut self.0.options
5074 }
5075 }
5076
5077 #[derive(Clone, Debug)]
5094 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5095
5096 impl CancelOperation {
5097 pub(crate) fn new(
5098 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5099 ) -> Self {
5100 Self(RequestBuilder::new(stub))
5101 }
5102
5103 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5105 mut self,
5106 v: V,
5107 ) -> Self {
5108 self.0.request = v.into();
5109 self
5110 }
5111
5112 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5114 self.0.options = v.into();
5115 self
5116 }
5117
5118 pub async fn send(self) -> Result<()> {
5120 (*self.0.stub)
5121 .cancel_operation(self.0.request, self.0.options)
5122 .await
5123 .map(gax::response::Response::into_body)
5124 }
5125
5126 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5128 self.0.request.name = v.into();
5129 self
5130 }
5131 }
5132
5133 #[doc(hidden)]
5134 impl gax::options::internal::RequestBuilder for CancelOperation {
5135 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5136 &mut self.0.options
5137 }
5138 }
5139}
5140
5141#[cfg(feature = "document-service")]
5142#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5143pub mod document_service {
5144 use crate::Result;
5145
5146 pub type ClientBuilder =
5160 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5161
5162 pub(crate) mod client {
5163 use super::super::super::client::DocumentService;
5164 pub struct Factory;
5165 impl gax::client_builder::internal::ClientFactory for Factory {
5166 type Client = DocumentService;
5167 type Credentials = gaxi::options::Credentials;
5168 async fn build(
5169 self,
5170 config: gaxi::options::ClientConfig,
5171 ) -> gax::client_builder::Result<Self::Client> {
5172 Self::Client::new(config).await
5173 }
5174 }
5175 }
5176
5177 #[derive(Clone, Debug)]
5179 pub(crate) struct RequestBuilder<R: std::default::Default> {
5180 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5181 request: R,
5182 options: gax::options::RequestOptions,
5183 }
5184
5185 impl<R> RequestBuilder<R>
5186 where
5187 R: std::default::Default,
5188 {
5189 pub(crate) fn new(
5190 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5191 ) -> Self {
5192 Self {
5193 stub,
5194 request: R::default(),
5195 options: gax::options::RequestOptions::default(),
5196 }
5197 }
5198 }
5199
5200 #[derive(Clone, Debug)]
5217 pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5218
5219 impl GetDocument {
5220 pub(crate) fn new(
5221 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5222 ) -> Self {
5223 Self(RequestBuilder::new(stub))
5224 }
5225
5226 pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5228 self.0.request = v.into();
5229 self
5230 }
5231
5232 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5234 self.0.options = v.into();
5235 self
5236 }
5237
5238 pub async fn send(self) -> Result<crate::model::Document> {
5240 (*self.0.stub)
5241 .get_document(self.0.request, self.0.options)
5242 .await
5243 .map(gax::response::Response::into_body)
5244 }
5245
5246 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5250 self.0.request.name = v.into();
5251 self
5252 }
5253 }
5254
5255 #[doc(hidden)]
5256 impl gax::options::internal::RequestBuilder for GetDocument {
5257 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5258 &mut self.0.options
5259 }
5260 }
5261
5262 #[derive(Clone, Debug)]
5283 pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5284
5285 impl ListDocuments {
5286 pub(crate) fn new(
5287 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5288 ) -> Self {
5289 Self(RequestBuilder::new(stub))
5290 }
5291
5292 pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5294 self.0.request = v.into();
5295 self
5296 }
5297
5298 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5300 self.0.options = v.into();
5301 self
5302 }
5303
5304 pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5306 (*self.0.stub)
5307 .list_documents(self.0.request, self.0.options)
5308 .await
5309 .map(gax::response::Response::into_body)
5310 }
5311
5312 pub fn by_page(
5314 self,
5315 ) -> impl gax::paginator::Paginator<crate::model::ListDocumentsResponse, gax::error::Error>
5316 {
5317 use std::clone::Clone;
5318 let token = self.0.request.page_token.clone();
5319 let execute = move |token: String| {
5320 let mut builder = self.clone();
5321 builder.0.request = builder.0.request.set_page_token(token);
5322 builder.send()
5323 };
5324 gax::paginator::internal::new_paginator(token, execute)
5325 }
5326
5327 pub fn by_item(
5329 self,
5330 ) -> impl gax::paginator::ItemPaginator<crate::model::ListDocumentsResponse, gax::error::Error>
5331 {
5332 use gax::paginator::Paginator;
5333 self.by_page().items()
5334 }
5335
5336 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5340 self.0.request.parent = v.into();
5341 self
5342 }
5343
5344 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5346 self.0.request.page_size = v.into();
5347 self
5348 }
5349
5350 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5352 self.0.request.page_token = v.into();
5353 self
5354 }
5355 }
5356
5357 #[doc(hidden)]
5358 impl gax::options::internal::RequestBuilder for ListDocuments {
5359 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5360 &mut self.0.options
5361 }
5362 }
5363
5364 #[derive(Clone, Debug)]
5381 pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5382
5383 impl CreateDocument {
5384 pub(crate) fn new(
5385 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5386 ) -> Self {
5387 Self(RequestBuilder::new(stub))
5388 }
5389
5390 pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5392 self.0.request = v.into();
5393 self
5394 }
5395
5396 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5398 self.0.options = v.into();
5399 self
5400 }
5401
5402 pub async fn send(self) -> Result<crate::model::Document> {
5404 (*self.0.stub)
5405 .create_document(self.0.request, self.0.options)
5406 .await
5407 .map(gax::response::Response::into_body)
5408 }
5409
5410 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5414 self.0.request.parent = v.into();
5415 self
5416 }
5417
5418 pub fn set_document<T>(mut self, v: T) -> Self
5422 where
5423 T: std::convert::Into<crate::model::Document>,
5424 {
5425 self.0.request.document = std::option::Option::Some(v.into());
5426 self
5427 }
5428
5429 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5433 where
5434 T: std::convert::Into<crate::model::Document>,
5435 {
5436 self.0.request.document = v.map(|x| x.into());
5437 self
5438 }
5439
5440 pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5444 self.0.request.document_id = v.into();
5445 self
5446 }
5447 }
5448
5449 #[doc(hidden)]
5450 impl gax::options::internal::RequestBuilder for CreateDocument {
5451 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5452 &mut self.0.options
5453 }
5454 }
5455
5456 #[derive(Clone, Debug)]
5473 pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
5474
5475 impl UpdateDocument {
5476 pub(crate) fn new(
5477 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5478 ) -> Self {
5479 Self(RequestBuilder::new(stub))
5480 }
5481
5482 pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
5484 self.0.request = v.into();
5485 self
5486 }
5487
5488 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5490 self.0.options = v.into();
5491 self
5492 }
5493
5494 pub async fn send(self) -> Result<crate::model::Document> {
5496 (*self.0.stub)
5497 .update_document(self.0.request, self.0.options)
5498 .await
5499 .map(gax::response::Response::into_body)
5500 }
5501
5502 pub fn set_document<T>(mut self, v: T) -> Self
5506 where
5507 T: std::convert::Into<crate::model::Document>,
5508 {
5509 self.0.request.document = std::option::Option::Some(v.into());
5510 self
5511 }
5512
5513 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5517 where
5518 T: std::convert::Into<crate::model::Document>,
5519 {
5520 self.0.request.document = v.map(|x| x.into());
5521 self
5522 }
5523
5524 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5526 self.0.request.allow_missing = v.into();
5527 self
5528 }
5529
5530 pub fn set_update_mask<T>(mut self, v: T) -> Self
5532 where
5533 T: std::convert::Into<wkt::FieldMask>,
5534 {
5535 self.0.request.update_mask = std::option::Option::Some(v.into());
5536 self
5537 }
5538
5539 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5541 where
5542 T: std::convert::Into<wkt::FieldMask>,
5543 {
5544 self.0.request.update_mask = v.map(|x| x.into());
5545 self
5546 }
5547 }
5548
5549 #[doc(hidden)]
5550 impl gax::options::internal::RequestBuilder for UpdateDocument {
5551 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5552 &mut self.0.options
5553 }
5554 }
5555
5556 #[derive(Clone, Debug)]
5573 pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
5574
5575 impl DeleteDocument {
5576 pub(crate) fn new(
5577 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5578 ) -> Self {
5579 Self(RequestBuilder::new(stub))
5580 }
5581
5582 pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
5584 self.0.request = v.into();
5585 self
5586 }
5587
5588 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5590 self.0.options = v.into();
5591 self
5592 }
5593
5594 pub async fn send(self) -> Result<()> {
5596 (*self.0.stub)
5597 .delete_document(self.0.request, self.0.options)
5598 .await
5599 .map(gax::response::Response::into_body)
5600 }
5601
5602 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5606 self.0.request.name = v.into();
5607 self
5608 }
5609 }
5610
5611 #[doc(hidden)]
5612 impl gax::options::internal::RequestBuilder for DeleteDocument {
5613 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5614 &mut self.0.options
5615 }
5616 }
5617
5618 #[derive(Clone, Debug)]
5636 pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
5637
5638 impl ImportDocuments {
5639 pub(crate) fn new(
5640 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5641 ) -> Self {
5642 Self(RequestBuilder::new(stub))
5643 }
5644
5645 pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
5647 self.0.request = v.into();
5648 self
5649 }
5650
5651 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5653 self.0.options = v.into();
5654 self
5655 }
5656
5657 pub async fn send(self) -> Result<longrunning::model::Operation> {
5664 (*self.0.stub)
5665 .import_documents(self.0.request, self.0.options)
5666 .await
5667 .map(gax::response::Response::into_body)
5668 }
5669
5670 pub fn poller(
5672 self,
5673 ) -> impl lro::Poller<crate::model::ImportDocumentsResponse, crate::model::ImportDocumentsMetadata>
5674 {
5675 type Operation = lro::internal::Operation<
5676 crate::model::ImportDocumentsResponse,
5677 crate::model::ImportDocumentsMetadata,
5678 >;
5679 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5680 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5681
5682 let stub = self.0.stub.clone();
5683 let mut options = self.0.options.clone();
5684 options.set_retry_policy(gax::retry_policy::NeverRetry);
5685 let query = move |name| {
5686 let stub = stub.clone();
5687 let options = options.clone();
5688 async {
5689 let op = GetOperation::new(stub)
5690 .set_name(name)
5691 .with_options(options)
5692 .send()
5693 .await?;
5694 Ok(Operation::new(op))
5695 }
5696 };
5697
5698 let start = move || async {
5699 let op = self.send().await?;
5700 Ok(Operation::new(op))
5701 };
5702
5703 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5704 }
5705
5706 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5710 self.0.request.parent = v.into();
5711 self
5712 }
5713
5714 pub fn set_error_config<T>(mut self, v: T) -> Self
5716 where
5717 T: std::convert::Into<crate::model::ImportErrorConfig>,
5718 {
5719 self.0.request.error_config = std::option::Option::Some(v.into());
5720 self
5721 }
5722
5723 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
5725 where
5726 T: std::convert::Into<crate::model::ImportErrorConfig>,
5727 {
5728 self.0.request.error_config = v.map(|x| x.into());
5729 self
5730 }
5731
5732 pub fn set_reconciliation_mode<
5734 T: Into<crate::model::import_documents_request::ReconciliationMode>,
5735 >(
5736 mut self,
5737 v: T,
5738 ) -> Self {
5739 self.0.request.reconciliation_mode = v.into();
5740 self
5741 }
5742
5743 pub fn set_update_mask<T>(mut self, v: T) -> Self
5745 where
5746 T: std::convert::Into<wkt::FieldMask>,
5747 {
5748 self.0.request.update_mask = std::option::Option::Some(v.into());
5749 self
5750 }
5751
5752 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5754 where
5755 T: std::convert::Into<wkt::FieldMask>,
5756 {
5757 self.0.request.update_mask = v.map(|x| x.into());
5758 self
5759 }
5760
5761 pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
5763 self.0.request.auto_generate_ids = v.into();
5764 self
5765 }
5766
5767 pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
5769 self.0.request.id_field = v.into();
5770 self
5771 }
5772
5773 pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
5775 self.0.request.force_refresh_content = v.into();
5776 self
5777 }
5778
5779 pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
5784 mut self,
5785 v: T,
5786 ) -> Self {
5787 self.0.request.source = v.into();
5788 self
5789 }
5790
5791 pub fn set_inline_source<
5797 T: std::convert::Into<
5798 std::boxed::Box<crate::model::import_documents_request::InlineSource>,
5799 >,
5800 >(
5801 mut self,
5802 v: T,
5803 ) -> Self {
5804 self.0.request = self.0.request.set_inline_source(v);
5805 self
5806 }
5807
5808 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
5814 mut self,
5815 v: T,
5816 ) -> Self {
5817 self.0.request = self.0.request.set_gcs_source(v);
5818 self
5819 }
5820
5821 pub fn set_bigquery_source<
5827 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
5828 >(
5829 mut self,
5830 v: T,
5831 ) -> Self {
5832 self.0.request = self.0.request.set_bigquery_source(v);
5833 self
5834 }
5835
5836 pub fn set_fhir_store_source<
5842 T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
5843 >(
5844 mut self,
5845 v: T,
5846 ) -> Self {
5847 self.0.request = self.0.request.set_fhir_store_source(v);
5848 self
5849 }
5850
5851 pub fn set_spanner_source<
5857 T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
5858 >(
5859 mut self,
5860 v: T,
5861 ) -> Self {
5862 self.0.request = self.0.request.set_spanner_source(v);
5863 self
5864 }
5865
5866 pub fn set_cloud_sql_source<
5872 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
5873 >(
5874 mut self,
5875 v: T,
5876 ) -> Self {
5877 self.0.request = self.0.request.set_cloud_sql_source(v);
5878 self
5879 }
5880
5881 pub fn set_firestore_source<
5887 T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
5888 >(
5889 mut self,
5890 v: T,
5891 ) -> Self {
5892 self.0.request = self.0.request.set_firestore_source(v);
5893 self
5894 }
5895
5896 pub fn set_alloy_db_source<
5902 T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
5903 >(
5904 mut self,
5905 v: T,
5906 ) -> Self {
5907 self.0.request = self.0.request.set_alloy_db_source(v);
5908 self
5909 }
5910
5911 pub fn set_bigtable_source<
5917 T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
5918 >(
5919 mut self,
5920 v: T,
5921 ) -> Self {
5922 self.0.request = self.0.request.set_bigtable_source(v);
5923 self
5924 }
5925 }
5926
5927 #[doc(hidden)]
5928 impl gax::options::internal::RequestBuilder for ImportDocuments {
5929 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5930 &mut self.0.options
5931 }
5932 }
5933
5934 #[derive(Clone, Debug)]
5952 pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
5953
5954 impl PurgeDocuments {
5955 pub(crate) fn new(
5956 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5957 ) -> Self {
5958 Self(RequestBuilder::new(stub))
5959 }
5960
5961 pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
5963 self.0.request = v.into();
5964 self
5965 }
5966
5967 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5969 self.0.options = v.into();
5970 self
5971 }
5972
5973 pub async fn send(self) -> Result<longrunning::model::Operation> {
5980 (*self.0.stub)
5981 .purge_documents(self.0.request, self.0.options)
5982 .await
5983 .map(gax::response::Response::into_body)
5984 }
5985
5986 pub fn poller(
5988 self,
5989 ) -> impl lro::Poller<crate::model::PurgeDocumentsResponse, crate::model::PurgeDocumentsMetadata>
5990 {
5991 type Operation = lro::internal::Operation<
5992 crate::model::PurgeDocumentsResponse,
5993 crate::model::PurgeDocumentsMetadata,
5994 >;
5995 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5996 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5997
5998 let stub = self.0.stub.clone();
5999 let mut options = self.0.options.clone();
6000 options.set_retry_policy(gax::retry_policy::NeverRetry);
6001 let query = move |name| {
6002 let stub = stub.clone();
6003 let options = options.clone();
6004 async {
6005 let op = GetOperation::new(stub)
6006 .set_name(name)
6007 .with_options(options)
6008 .send()
6009 .await?;
6010 Ok(Operation::new(op))
6011 }
6012 };
6013
6014 let start = move || async {
6015 let op = self.send().await?;
6016 Ok(Operation::new(op))
6017 };
6018
6019 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6020 }
6021
6022 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6026 self.0.request.parent = v.into();
6027 self
6028 }
6029
6030 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6034 self.0.request.filter = v.into();
6035 self
6036 }
6037
6038 pub fn set_error_config<T>(mut self, v: T) -> Self
6040 where
6041 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6042 {
6043 self.0.request.error_config = std::option::Option::Some(v.into());
6044 self
6045 }
6046
6047 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6049 where
6050 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6051 {
6052 self.0.request.error_config = v.map(|x| x.into());
6053 self
6054 }
6055
6056 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6058 self.0.request.force = v.into();
6059 self
6060 }
6061
6062 pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6067 mut self,
6068 v: T,
6069 ) -> Self {
6070 self.0.request.source = v.into();
6071 self
6072 }
6073
6074 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6080 mut self,
6081 v: T,
6082 ) -> Self {
6083 self.0.request = self.0.request.set_gcs_source(v);
6084 self
6085 }
6086
6087 pub fn set_inline_source<
6093 T: std::convert::Into<
6094 std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6095 >,
6096 >(
6097 mut self,
6098 v: T,
6099 ) -> Self {
6100 self.0.request = self.0.request.set_inline_source(v);
6101 self
6102 }
6103 }
6104
6105 #[doc(hidden)]
6106 impl gax::options::internal::RequestBuilder for PurgeDocuments {
6107 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6108 &mut self.0.options
6109 }
6110 }
6111
6112 #[derive(Clone, Debug)]
6129 pub struct BatchGetDocumentsMetadata(
6130 RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6131 );
6132
6133 impl BatchGetDocumentsMetadata {
6134 pub(crate) fn new(
6135 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6136 ) -> Self {
6137 Self(RequestBuilder::new(stub))
6138 }
6139
6140 pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6142 mut self,
6143 v: V,
6144 ) -> Self {
6145 self.0.request = v.into();
6146 self
6147 }
6148
6149 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6151 self.0.options = v.into();
6152 self
6153 }
6154
6155 pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6157 (*self.0.stub)
6158 .batch_get_documents_metadata(self.0.request, self.0.options)
6159 .await
6160 .map(gax::response::Response::into_body)
6161 }
6162
6163 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6167 self.0.request.parent = v.into();
6168 self
6169 }
6170
6171 pub fn set_matcher<T>(mut self, v: T) -> Self
6175 where
6176 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6177 {
6178 self.0.request.matcher = std::option::Option::Some(v.into());
6179 self
6180 }
6181
6182 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6186 where
6187 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6188 {
6189 self.0.request.matcher = v.map(|x| x.into());
6190 self
6191 }
6192 }
6193
6194 #[doc(hidden)]
6195 impl gax::options::internal::RequestBuilder for BatchGetDocumentsMetadata {
6196 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6197 &mut self.0.options
6198 }
6199 }
6200
6201 #[derive(Clone, Debug)]
6222 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6223
6224 impl ListOperations {
6225 pub(crate) fn new(
6226 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6227 ) -> Self {
6228 Self(RequestBuilder::new(stub))
6229 }
6230
6231 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6233 mut self,
6234 v: V,
6235 ) -> Self {
6236 self.0.request = v.into();
6237 self
6238 }
6239
6240 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6242 self.0.options = v.into();
6243 self
6244 }
6245
6246 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6248 (*self.0.stub)
6249 .list_operations(self.0.request, self.0.options)
6250 .await
6251 .map(gax::response::Response::into_body)
6252 }
6253
6254 pub fn by_page(
6256 self,
6257 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6258 {
6259 use std::clone::Clone;
6260 let token = self.0.request.page_token.clone();
6261 let execute = move |token: String| {
6262 let mut builder = self.clone();
6263 builder.0.request = builder.0.request.set_page_token(token);
6264 builder.send()
6265 };
6266 gax::paginator::internal::new_paginator(token, execute)
6267 }
6268
6269 pub fn by_item(
6271 self,
6272 ) -> impl gax::paginator::ItemPaginator<
6273 longrunning::model::ListOperationsResponse,
6274 gax::error::Error,
6275 > {
6276 use gax::paginator::Paginator;
6277 self.by_page().items()
6278 }
6279
6280 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6282 self.0.request.name = v.into();
6283 self
6284 }
6285
6286 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6288 self.0.request.filter = v.into();
6289 self
6290 }
6291
6292 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6294 self.0.request.page_size = v.into();
6295 self
6296 }
6297
6298 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6300 self.0.request.page_token = v.into();
6301 self
6302 }
6303
6304 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6306 self.0.request.return_partial_success = v.into();
6307 self
6308 }
6309 }
6310
6311 #[doc(hidden)]
6312 impl gax::options::internal::RequestBuilder for ListOperations {
6313 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6314 &mut self.0.options
6315 }
6316 }
6317
6318 #[derive(Clone, Debug)]
6335 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6336
6337 impl GetOperation {
6338 pub(crate) fn new(
6339 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6340 ) -> Self {
6341 Self(RequestBuilder::new(stub))
6342 }
6343
6344 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6346 mut self,
6347 v: V,
6348 ) -> Self {
6349 self.0.request = v.into();
6350 self
6351 }
6352
6353 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6355 self.0.options = v.into();
6356 self
6357 }
6358
6359 pub async fn send(self) -> Result<longrunning::model::Operation> {
6361 (*self.0.stub)
6362 .get_operation(self.0.request, self.0.options)
6363 .await
6364 .map(gax::response::Response::into_body)
6365 }
6366
6367 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6369 self.0.request.name = v.into();
6370 self
6371 }
6372 }
6373
6374 #[doc(hidden)]
6375 impl gax::options::internal::RequestBuilder for GetOperation {
6376 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6377 &mut self.0.options
6378 }
6379 }
6380
6381 #[derive(Clone, Debug)]
6398 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
6399
6400 impl CancelOperation {
6401 pub(crate) fn new(
6402 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6403 ) -> Self {
6404 Self(RequestBuilder::new(stub))
6405 }
6406
6407 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
6409 mut self,
6410 v: V,
6411 ) -> Self {
6412 self.0.request = v.into();
6413 self
6414 }
6415
6416 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6418 self.0.options = v.into();
6419 self
6420 }
6421
6422 pub async fn send(self) -> Result<()> {
6424 (*self.0.stub)
6425 .cancel_operation(self.0.request, self.0.options)
6426 .await
6427 .map(gax::response::Response::into_body)
6428 }
6429
6430 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6432 self.0.request.name = v.into();
6433 self
6434 }
6435 }
6436
6437 #[doc(hidden)]
6438 impl gax::options::internal::RequestBuilder for CancelOperation {
6439 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6440 &mut self.0.options
6441 }
6442 }
6443}
6444
6445#[cfg(feature = "engine-service")]
6446#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
6447pub mod engine_service {
6448 use crate::Result;
6449
6450 pub type ClientBuilder =
6464 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6465
6466 pub(crate) mod client {
6467 use super::super::super::client::EngineService;
6468 pub struct Factory;
6469 impl gax::client_builder::internal::ClientFactory for Factory {
6470 type Client = EngineService;
6471 type Credentials = gaxi::options::Credentials;
6472 async fn build(
6473 self,
6474 config: gaxi::options::ClientConfig,
6475 ) -> gax::client_builder::Result<Self::Client> {
6476 Self::Client::new(config).await
6477 }
6478 }
6479 }
6480
6481 #[derive(Clone, Debug)]
6483 pub(crate) struct RequestBuilder<R: std::default::Default> {
6484 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6485 request: R,
6486 options: gax::options::RequestOptions,
6487 }
6488
6489 impl<R> RequestBuilder<R>
6490 where
6491 R: std::default::Default,
6492 {
6493 pub(crate) fn new(
6494 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6495 ) -> Self {
6496 Self {
6497 stub,
6498 request: R::default(),
6499 options: gax::options::RequestOptions::default(),
6500 }
6501 }
6502 }
6503
6504 #[derive(Clone, Debug)]
6522 pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
6523
6524 impl CreateEngine {
6525 pub(crate) fn new(
6526 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6527 ) -> Self {
6528 Self(RequestBuilder::new(stub))
6529 }
6530
6531 pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
6533 self.0.request = v.into();
6534 self
6535 }
6536
6537 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6539 self.0.options = v.into();
6540 self
6541 }
6542
6543 pub async fn send(self) -> Result<longrunning::model::Operation> {
6550 (*self.0.stub)
6551 .create_engine(self.0.request, self.0.options)
6552 .await
6553 .map(gax::response::Response::into_body)
6554 }
6555
6556 pub fn poller(
6558 self,
6559 ) -> impl lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata> {
6560 type Operation =
6561 lro::internal::Operation<crate::model::Engine, crate::model::CreateEngineMetadata>;
6562 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6563 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6564
6565 let stub = self.0.stub.clone();
6566 let mut options = self.0.options.clone();
6567 options.set_retry_policy(gax::retry_policy::NeverRetry);
6568 let query = move |name| {
6569 let stub = stub.clone();
6570 let options = options.clone();
6571 async {
6572 let op = GetOperation::new(stub)
6573 .set_name(name)
6574 .with_options(options)
6575 .send()
6576 .await?;
6577 Ok(Operation::new(op))
6578 }
6579 };
6580
6581 let start = move || async {
6582 let op = self.send().await?;
6583 Ok(Operation::new(op))
6584 };
6585
6586 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6587 }
6588
6589 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6593 self.0.request.parent = v.into();
6594 self
6595 }
6596
6597 pub fn set_engine<T>(mut self, v: T) -> Self
6601 where
6602 T: std::convert::Into<crate::model::Engine>,
6603 {
6604 self.0.request.engine = std::option::Option::Some(v.into());
6605 self
6606 }
6607
6608 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6612 where
6613 T: std::convert::Into<crate::model::Engine>,
6614 {
6615 self.0.request.engine = v.map(|x| x.into());
6616 self
6617 }
6618
6619 pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6623 self.0.request.engine_id = v.into();
6624 self
6625 }
6626 }
6627
6628 #[doc(hidden)]
6629 impl gax::options::internal::RequestBuilder for CreateEngine {
6630 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6631 &mut self.0.options
6632 }
6633 }
6634
6635 #[derive(Clone, Debug)]
6653 pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
6654
6655 impl DeleteEngine {
6656 pub(crate) fn new(
6657 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6658 ) -> Self {
6659 Self(RequestBuilder::new(stub))
6660 }
6661
6662 pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
6664 self.0.request = v.into();
6665 self
6666 }
6667
6668 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6670 self.0.options = v.into();
6671 self
6672 }
6673
6674 pub async fn send(self) -> Result<longrunning::model::Operation> {
6681 (*self.0.stub)
6682 .delete_engine(self.0.request, self.0.options)
6683 .await
6684 .map(gax::response::Response::into_body)
6685 }
6686
6687 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteEngineMetadata> {
6689 type Operation =
6690 lro::internal::Operation<wkt::Empty, crate::model::DeleteEngineMetadata>;
6691 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6692 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6693
6694 let stub = self.0.stub.clone();
6695 let mut options = self.0.options.clone();
6696 options.set_retry_policy(gax::retry_policy::NeverRetry);
6697 let query = move |name| {
6698 let stub = stub.clone();
6699 let options = options.clone();
6700 async {
6701 let op = GetOperation::new(stub)
6702 .set_name(name)
6703 .with_options(options)
6704 .send()
6705 .await?;
6706 Ok(Operation::new(op))
6707 }
6708 };
6709
6710 let start = move || async {
6711 let op = self.send().await?;
6712 Ok(Operation::new(op))
6713 };
6714
6715 lro::internal::new_unit_response_poller(
6716 polling_error_policy,
6717 polling_backoff_policy,
6718 start,
6719 query,
6720 )
6721 }
6722
6723 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6727 self.0.request.name = v.into();
6728 self
6729 }
6730 }
6731
6732 #[doc(hidden)]
6733 impl gax::options::internal::RequestBuilder for DeleteEngine {
6734 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6735 &mut self.0.options
6736 }
6737 }
6738
6739 #[derive(Clone, Debug)]
6756 pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
6757
6758 impl UpdateEngine {
6759 pub(crate) fn new(
6760 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6761 ) -> Self {
6762 Self(RequestBuilder::new(stub))
6763 }
6764
6765 pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
6767 self.0.request = v.into();
6768 self
6769 }
6770
6771 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6773 self.0.options = v.into();
6774 self
6775 }
6776
6777 pub async fn send(self) -> Result<crate::model::Engine> {
6779 (*self.0.stub)
6780 .update_engine(self.0.request, self.0.options)
6781 .await
6782 .map(gax::response::Response::into_body)
6783 }
6784
6785 pub fn set_engine<T>(mut self, v: T) -> Self
6789 where
6790 T: std::convert::Into<crate::model::Engine>,
6791 {
6792 self.0.request.engine = std::option::Option::Some(v.into());
6793 self
6794 }
6795
6796 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6800 where
6801 T: std::convert::Into<crate::model::Engine>,
6802 {
6803 self.0.request.engine = v.map(|x| x.into());
6804 self
6805 }
6806
6807 pub fn set_update_mask<T>(mut self, v: T) -> Self
6809 where
6810 T: std::convert::Into<wkt::FieldMask>,
6811 {
6812 self.0.request.update_mask = std::option::Option::Some(v.into());
6813 self
6814 }
6815
6816 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6818 where
6819 T: std::convert::Into<wkt::FieldMask>,
6820 {
6821 self.0.request.update_mask = v.map(|x| x.into());
6822 self
6823 }
6824 }
6825
6826 #[doc(hidden)]
6827 impl gax::options::internal::RequestBuilder for UpdateEngine {
6828 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6829 &mut self.0.options
6830 }
6831 }
6832
6833 #[derive(Clone, Debug)]
6850 pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
6851
6852 impl GetEngine {
6853 pub(crate) fn new(
6854 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6855 ) -> Self {
6856 Self(RequestBuilder::new(stub))
6857 }
6858
6859 pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
6861 self.0.request = v.into();
6862 self
6863 }
6864
6865 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6867 self.0.options = v.into();
6868 self
6869 }
6870
6871 pub async fn send(self) -> Result<crate::model::Engine> {
6873 (*self.0.stub)
6874 .get_engine(self.0.request, self.0.options)
6875 .await
6876 .map(gax::response::Response::into_body)
6877 }
6878
6879 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6883 self.0.request.name = v.into();
6884 self
6885 }
6886 }
6887
6888 #[doc(hidden)]
6889 impl gax::options::internal::RequestBuilder for GetEngine {
6890 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6891 &mut self.0.options
6892 }
6893 }
6894
6895 #[derive(Clone, Debug)]
6916 pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
6917
6918 impl ListEngines {
6919 pub(crate) fn new(
6920 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6921 ) -> Self {
6922 Self(RequestBuilder::new(stub))
6923 }
6924
6925 pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
6927 self.0.request = v.into();
6928 self
6929 }
6930
6931 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6933 self.0.options = v.into();
6934 self
6935 }
6936
6937 pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
6939 (*self.0.stub)
6940 .list_engines(self.0.request, self.0.options)
6941 .await
6942 .map(gax::response::Response::into_body)
6943 }
6944
6945 pub fn by_page(
6947 self,
6948 ) -> impl gax::paginator::Paginator<crate::model::ListEnginesResponse, gax::error::Error>
6949 {
6950 use std::clone::Clone;
6951 let token = self.0.request.page_token.clone();
6952 let execute = move |token: String| {
6953 let mut builder = self.clone();
6954 builder.0.request = builder.0.request.set_page_token(token);
6955 builder.send()
6956 };
6957 gax::paginator::internal::new_paginator(token, execute)
6958 }
6959
6960 pub fn by_item(
6962 self,
6963 ) -> impl gax::paginator::ItemPaginator<crate::model::ListEnginesResponse, gax::error::Error>
6964 {
6965 use gax::paginator::Paginator;
6966 self.by_page().items()
6967 }
6968
6969 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6973 self.0.request.parent = v.into();
6974 self
6975 }
6976
6977 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6979 self.0.request.page_size = v.into();
6980 self
6981 }
6982
6983 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6985 self.0.request.page_token = v.into();
6986 self
6987 }
6988
6989 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6991 self.0.request.filter = v.into();
6992 self
6993 }
6994 }
6995
6996 #[doc(hidden)]
6997 impl gax::options::internal::RequestBuilder for ListEngines {
6998 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6999 &mut self.0.options
7000 }
7001 }
7002
7003 #[derive(Clone, Debug)]
7024 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7025
7026 impl ListOperations {
7027 pub(crate) fn new(
7028 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7029 ) -> Self {
7030 Self(RequestBuilder::new(stub))
7031 }
7032
7033 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7035 mut self,
7036 v: V,
7037 ) -> Self {
7038 self.0.request = v.into();
7039 self
7040 }
7041
7042 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7044 self.0.options = v.into();
7045 self
7046 }
7047
7048 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7050 (*self.0.stub)
7051 .list_operations(self.0.request, self.0.options)
7052 .await
7053 .map(gax::response::Response::into_body)
7054 }
7055
7056 pub fn by_page(
7058 self,
7059 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7060 {
7061 use std::clone::Clone;
7062 let token = self.0.request.page_token.clone();
7063 let execute = move |token: String| {
7064 let mut builder = self.clone();
7065 builder.0.request = builder.0.request.set_page_token(token);
7066 builder.send()
7067 };
7068 gax::paginator::internal::new_paginator(token, execute)
7069 }
7070
7071 pub fn by_item(
7073 self,
7074 ) -> impl gax::paginator::ItemPaginator<
7075 longrunning::model::ListOperationsResponse,
7076 gax::error::Error,
7077 > {
7078 use gax::paginator::Paginator;
7079 self.by_page().items()
7080 }
7081
7082 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7084 self.0.request.name = v.into();
7085 self
7086 }
7087
7088 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7090 self.0.request.filter = v.into();
7091 self
7092 }
7093
7094 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7096 self.0.request.page_size = v.into();
7097 self
7098 }
7099
7100 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7102 self.0.request.page_token = v.into();
7103 self
7104 }
7105
7106 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7108 self.0.request.return_partial_success = v.into();
7109 self
7110 }
7111 }
7112
7113 #[doc(hidden)]
7114 impl gax::options::internal::RequestBuilder for ListOperations {
7115 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7116 &mut self.0.options
7117 }
7118 }
7119
7120 #[derive(Clone, Debug)]
7137 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7138
7139 impl GetOperation {
7140 pub(crate) fn new(
7141 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7142 ) -> Self {
7143 Self(RequestBuilder::new(stub))
7144 }
7145
7146 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7148 mut self,
7149 v: V,
7150 ) -> Self {
7151 self.0.request = v.into();
7152 self
7153 }
7154
7155 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7157 self.0.options = v.into();
7158 self
7159 }
7160
7161 pub async fn send(self) -> Result<longrunning::model::Operation> {
7163 (*self.0.stub)
7164 .get_operation(self.0.request, self.0.options)
7165 .await
7166 .map(gax::response::Response::into_body)
7167 }
7168
7169 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7171 self.0.request.name = v.into();
7172 self
7173 }
7174 }
7175
7176 #[doc(hidden)]
7177 impl gax::options::internal::RequestBuilder for GetOperation {
7178 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7179 &mut self.0.options
7180 }
7181 }
7182
7183 #[derive(Clone, Debug)]
7200 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7201
7202 impl CancelOperation {
7203 pub(crate) fn new(
7204 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7205 ) -> Self {
7206 Self(RequestBuilder::new(stub))
7207 }
7208
7209 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7211 mut self,
7212 v: V,
7213 ) -> Self {
7214 self.0.request = v.into();
7215 self
7216 }
7217
7218 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7220 self.0.options = v.into();
7221 self
7222 }
7223
7224 pub async fn send(self) -> Result<()> {
7226 (*self.0.stub)
7227 .cancel_operation(self.0.request, self.0.options)
7228 .await
7229 .map(gax::response::Response::into_body)
7230 }
7231
7232 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7234 self.0.request.name = v.into();
7235 self
7236 }
7237 }
7238
7239 #[doc(hidden)]
7240 impl gax::options::internal::RequestBuilder for CancelOperation {
7241 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7242 &mut self.0.options
7243 }
7244 }
7245}
7246
7247#[cfg(feature = "grounded-generation-service")]
7248#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7249pub mod grounded_generation_service {
7250 use crate::Result;
7251
7252 pub type ClientBuilder =
7266 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7267
7268 pub(crate) mod client {
7269 use super::super::super::client::GroundedGenerationService;
7270 pub struct Factory;
7271 impl gax::client_builder::internal::ClientFactory for Factory {
7272 type Client = GroundedGenerationService;
7273 type Credentials = gaxi::options::Credentials;
7274 async fn build(
7275 self,
7276 config: gaxi::options::ClientConfig,
7277 ) -> gax::client_builder::Result<Self::Client> {
7278 Self::Client::new(config).await
7279 }
7280 }
7281 }
7282
7283 #[derive(Clone, Debug)]
7285 pub(crate) struct RequestBuilder<R: std::default::Default> {
7286 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7287 request: R,
7288 options: gax::options::RequestOptions,
7289 }
7290
7291 impl<R> RequestBuilder<R>
7292 where
7293 R: std::default::Default,
7294 {
7295 pub(crate) fn new(
7296 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7297 ) -> Self {
7298 Self {
7299 stub,
7300 request: R::default(),
7301 options: gax::options::RequestOptions::default(),
7302 }
7303 }
7304 }
7305
7306 #[derive(Clone, Debug)]
7323 pub struct GenerateGroundedContent(
7324 RequestBuilder<crate::model::GenerateGroundedContentRequest>,
7325 );
7326
7327 impl GenerateGroundedContent {
7328 pub(crate) fn new(
7329 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7330 ) -> Self {
7331 Self(RequestBuilder::new(stub))
7332 }
7333
7334 pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
7336 mut self,
7337 v: V,
7338 ) -> Self {
7339 self.0.request = v.into();
7340 self
7341 }
7342
7343 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7345 self.0.options = v.into();
7346 self
7347 }
7348
7349 pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
7351 (*self.0.stub)
7352 .generate_grounded_content(self.0.request, self.0.options)
7353 .await
7354 .map(gax::response::Response::into_body)
7355 }
7356
7357 pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7361 self.0.request.location = v.into();
7362 self
7363 }
7364
7365 pub fn set_system_instruction<T>(mut self, v: T) -> Self
7367 where
7368 T: std::convert::Into<crate::model::GroundedGenerationContent>,
7369 {
7370 self.0.request.system_instruction = std::option::Option::Some(v.into());
7371 self
7372 }
7373
7374 pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
7376 where
7377 T: std::convert::Into<crate::model::GroundedGenerationContent>,
7378 {
7379 self.0.request.system_instruction = v.map(|x| x.into());
7380 self
7381 }
7382
7383 pub fn set_contents<T, V>(mut self, v: T) -> Self
7385 where
7386 T: std::iter::IntoIterator<Item = V>,
7387 V: std::convert::Into<crate::model::GroundedGenerationContent>,
7388 {
7389 use std::iter::Iterator;
7390 self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
7391 self
7392 }
7393
7394 pub fn set_generation_spec<T>(mut self, v: T) -> Self
7396 where
7397 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7398 {
7399 self.0.request.generation_spec = std::option::Option::Some(v.into());
7400 self
7401 }
7402
7403 pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7405 where
7406 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7407 {
7408 self.0.request.generation_spec = v.map(|x| x.into());
7409 self
7410 }
7411
7412 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7414 where
7415 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7416 {
7417 self.0.request.grounding_spec = std::option::Option::Some(v.into());
7418 self
7419 }
7420
7421 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7423 where
7424 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7425 {
7426 self.0.request.grounding_spec = v.map(|x| x.into());
7427 self
7428 }
7429
7430 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7432 where
7433 T: std::iter::IntoIterator<Item = (K, V)>,
7434 K: std::convert::Into<std::string::String>,
7435 V: std::convert::Into<std::string::String>,
7436 {
7437 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7438 self
7439 }
7440 }
7441
7442 #[doc(hidden)]
7443 impl gax::options::internal::RequestBuilder for GenerateGroundedContent {
7444 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7445 &mut self.0.options
7446 }
7447 }
7448
7449 #[derive(Clone, Debug)]
7466 pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
7467
7468 impl CheckGrounding {
7469 pub(crate) fn new(
7470 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7471 ) -> Self {
7472 Self(RequestBuilder::new(stub))
7473 }
7474
7475 pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
7477 self.0.request = v.into();
7478 self
7479 }
7480
7481 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7483 self.0.options = v.into();
7484 self
7485 }
7486
7487 pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
7489 (*self.0.stub)
7490 .check_grounding(self.0.request, self.0.options)
7491 .await
7492 .map(gax::response::Response::into_body)
7493 }
7494
7495 pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7499 self.0.request.grounding_config = v.into();
7500 self
7501 }
7502
7503 pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
7505 self.0.request.answer_candidate = v.into();
7506 self
7507 }
7508
7509 pub fn set_facts<T, V>(mut self, v: T) -> Self
7511 where
7512 T: std::iter::IntoIterator<Item = V>,
7513 V: std::convert::Into<crate::model::GroundingFact>,
7514 {
7515 use std::iter::Iterator;
7516 self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
7517 self
7518 }
7519
7520 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7522 where
7523 T: std::convert::Into<crate::model::CheckGroundingSpec>,
7524 {
7525 self.0.request.grounding_spec = std::option::Option::Some(v.into());
7526 self
7527 }
7528
7529 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7531 where
7532 T: std::convert::Into<crate::model::CheckGroundingSpec>,
7533 {
7534 self.0.request.grounding_spec = v.map(|x| x.into());
7535 self
7536 }
7537
7538 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7540 where
7541 T: std::iter::IntoIterator<Item = (K, V)>,
7542 K: std::convert::Into<std::string::String>,
7543 V: std::convert::Into<std::string::String>,
7544 {
7545 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7546 self
7547 }
7548 }
7549
7550 #[doc(hidden)]
7551 impl gax::options::internal::RequestBuilder for CheckGrounding {
7552 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7553 &mut self.0.options
7554 }
7555 }
7556
7557 #[derive(Clone, Debug)]
7578 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7579
7580 impl ListOperations {
7581 pub(crate) fn new(
7582 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7583 ) -> Self {
7584 Self(RequestBuilder::new(stub))
7585 }
7586
7587 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7589 mut self,
7590 v: V,
7591 ) -> Self {
7592 self.0.request = v.into();
7593 self
7594 }
7595
7596 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7598 self.0.options = v.into();
7599 self
7600 }
7601
7602 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7604 (*self.0.stub)
7605 .list_operations(self.0.request, self.0.options)
7606 .await
7607 .map(gax::response::Response::into_body)
7608 }
7609
7610 pub fn by_page(
7612 self,
7613 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7614 {
7615 use std::clone::Clone;
7616 let token = self.0.request.page_token.clone();
7617 let execute = move |token: String| {
7618 let mut builder = self.clone();
7619 builder.0.request = builder.0.request.set_page_token(token);
7620 builder.send()
7621 };
7622 gax::paginator::internal::new_paginator(token, execute)
7623 }
7624
7625 pub fn by_item(
7627 self,
7628 ) -> impl gax::paginator::ItemPaginator<
7629 longrunning::model::ListOperationsResponse,
7630 gax::error::Error,
7631 > {
7632 use gax::paginator::Paginator;
7633 self.by_page().items()
7634 }
7635
7636 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7638 self.0.request.name = v.into();
7639 self
7640 }
7641
7642 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7644 self.0.request.filter = v.into();
7645 self
7646 }
7647
7648 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7650 self.0.request.page_size = v.into();
7651 self
7652 }
7653
7654 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7656 self.0.request.page_token = v.into();
7657 self
7658 }
7659
7660 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
7662 self.0.request.return_partial_success = v.into();
7663 self
7664 }
7665 }
7666
7667 #[doc(hidden)]
7668 impl gax::options::internal::RequestBuilder for ListOperations {
7669 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7670 &mut self.0.options
7671 }
7672 }
7673
7674 #[derive(Clone, Debug)]
7691 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7692
7693 impl GetOperation {
7694 pub(crate) fn new(
7695 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7696 ) -> Self {
7697 Self(RequestBuilder::new(stub))
7698 }
7699
7700 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7702 mut self,
7703 v: V,
7704 ) -> Self {
7705 self.0.request = v.into();
7706 self
7707 }
7708
7709 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7711 self.0.options = v.into();
7712 self
7713 }
7714
7715 pub async fn send(self) -> Result<longrunning::model::Operation> {
7717 (*self.0.stub)
7718 .get_operation(self.0.request, self.0.options)
7719 .await
7720 .map(gax::response::Response::into_body)
7721 }
7722
7723 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7725 self.0.request.name = v.into();
7726 self
7727 }
7728 }
7729
7730 #[doc(hidden)]
7731 impl gax::options::internal::RequestBuilder for GetOperation {
7732 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7733 &mut self.0.options
7734 }
7735 }
7736
7737 #[derive(Clone, Debug)]
7754 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7755
7756 impl CancelOperation {
7757 pub(crate) fn new(
7758 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7759 ) -> Self {
7760 Self(RequestBuilder::new(stub))
7761 }
7762
7763 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7765 mut self,
7766 v: V,
7767 ) -> Self {
7768 self.0.request = v.into();
7769 self
7770 }
7771
7772 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7774 self.0.options = v.into();
7775 self
7776 }
7777
7778 pub async fn send(self) -> Result<()> {
7780 (*self.0.stub)
7781 .cancel_operation(self.0.request, self.0.options)
7782 .await
7783 .map(gax::response::Response::into_body)
7784 }
7785
7786 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7788 self.0.request.name = v.into();
7789 self
7790 }
7791 }
7792
7793 #[doc(hidden)]
7794 impl gax::options::internal::RequestBuilder for CancelOperation {
7795 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7796 &mut self.0.options
7797 }
7798 }
7799}
7800
7801#[cfg(feature = "identity-mapping-store-service")]
7802#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
7803pub mod identity_mapping_store_service {
7804 use crate::Result;
7805
7806 pub type ClientBuilder =
7820 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7821
7822 pub(crate) mod client {
7823 use super::super::super::client::IdentityMappingStoreService;
7824 pub struct Factory;
7825 impl gax::client_builder::internal::ClientFactory for Factory {
7826 type Client = IdentityMappingStoreService;
7827 type Credentials = gaxi::options::Credentials;
7828 async fn build(
7829 self,
7830 config: gaxi::options::ClientConfig,
7831 ) -> gax::client_builder::Result<Self::Client> {
7832 Self::Client::new(config).await
7833 }
7834 }
7835 }
7836
7837 #[derive(Clone, Debug)]
7839 pub(crate) struct RequestBuilder<R: std::default::Default> {
7840 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7841 request: R,
7842 options: gax::options::RequestOptions,
7843 }
7844
7845 impl<R> RequestBuilder<R>
7846 where
7847 R: std::default::Default,
7848 {
7849 pub(crate) fn new(
7850 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7851 ) -> Self {
7852 Self {
7853 stub,
7854 request: R::default(),
7855 options: gax::options::RequestOptions::default(),
7856 }
7857 }
7858 }
7859
7860 #[derive(Clone, Debug)]
7877 pub struct CreateIdentityMappingStore(
7878 RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
7879 );
7880
7881 impl CreateIdentityMappingStore {
7882 pub(crate) fn new(
7883 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7884 ) -> Self {
7885 Self(RequestBuilder::new(stub))
7886 }
7887
7888 pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
7890 mut self,
7891 v: V,
7892 ) -> Self {
7893 self.0.request = v.into();
7894 self
7895 }
7896
7897 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7899 self.0.options = v.into();
7900 self
7901 }
7902
7903 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
7905 (*self.0.stub)
7906 .create_identity_mapping_store(self.0.request, self.0.options)
7907 .await
7908 .map(gax::response::Response::into_body)
7909 }
7910
7911 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7915 self.0.request.parent = v.into();
7916 self
7917 }
7918
7919 pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7923 self.0.request.identity_mapping_store_id = v.into();
7924 self
7925 }
7926
7927 pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
7931 where
7932 T: std::convert::Into<crate::model::IdentityMappingStore>,
7933 {
7934 self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
7935 self
7936 }
7937
7938 pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
7942 where
7943 T: std::convert::Into<crate::model::IdentityMappingStore>,
7944 {
7945 self.0.request.identity_mapping_store = v.map(|x| x.into());
7946 self
7947 }
7948
7949 pub fn set_cmek_options<
7954 T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
7955 >(
7956 mut self,
7957 v: T,
7958 ) -> Self {
7959 self.0.request.cmek_options = v.into();
7960 self
7961 }
7962
7963 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
7969 mut self,
7970 v: T,
7971 ) -> Self {
7972 self.0.request = self.0.request.set_cmek_config_name(v);
7973 self
7974 }
7975
7976 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7982 self.0.request = self.0.request.set_disable_cmek(v);
7983 self
7984 }
7985 }
7986
7987 #[doc(hidden)]
7988 impl gax::options::internal::RequestBuilder for CreateIdentityMappingStore {
7989 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7990 &mut self.0.options
7991 }
7992 }
7993
7994 #[derive(Clone, Debug)]
8011 pub struct GetIdentityMappingStore(
8012 RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8013 );
8014
8015 impl GetIdentityMappingStore {
8016 pub(crate) fn new(
8017 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8018 ) -> Self {
8019 Self(RequestBuilder::new(stub))
8020 }
8021
8022 pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8024 mut self,
8025 v: V,
8026 ) -> Self {
8027 self.0.request = v.into();
8028 self
8029 }
8030
8031 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8033 self.0.options = v.into();
8034 self
8035 }
8036
8037 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8039 (*self.0.stub)
8040 .get_identity_mapping_store(self.0.request, self.0.options)
8041 .await
8042 .map(gax::response::Response::into_body)
8043 }
8044
8045 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8049 self.0.request.name = v.into();
8050 self
8051 }
8052 }
8053
8054 #[doc(hidden)]
8055 impl gax::options::internal::RequestBuilder for GetIdentityMappingStore {
8056 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8057 &mut self.0.options
8058 }
8059 }
8060
8061 #[derive(Clone, Debug)]
8079 pub struct DeleteIdentityMappingStore(
8080 RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8081 );
8082
8083 impl DeleteIdentityMappingStore {
8084 pub(crate) fn new(
8085 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8086 ) -> Self {
8087 Self(RequestBuilder::new(stub))
8088 }
8089
8090 pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8092 mut self,
8093 v: V,
8094 ) -> Self {
8095 self.0.request = v.into();
8096 self
8097 }
8098
8099 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8101 self.0.options = v.into();
8102 self
8103 }
8104
8105 pub async fn send(self) -> Result<longrunning::model::Operation> {
8112 (*self.0.stub)
8113 .delete_identity_mapping_store(self.0.request, self.0.options)
8114 .await
8115 .map(gax::response::Response::into_body)
8116 }
8117
8118 pub fn poller(
8120 self,
8121 ) -> impl lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata> {
8122 type Operation = lro::internal::Operation<
8123 wkt::Empty,
8124 crate::model::DeleteIdentityMappingStoreMetadata,
8125 >;
8126 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8127 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8128
8129 let stub = self.0.stub.clone();
8130 let mut options = self.0.options.clone();
8131 options.set_retry_policy(gax::retry_policy::NeverRetry);
8132 let query = move |name| {
8133 let stub = stub.clone();
8134 let options = options.clone();
8135 async {
8136 let op = GetOperation::new(stub)
8137 .set_name(name)
8138 .with_options(options)
8139 .send()
8140 .await?;
8141 Ok(Operation::new(op))
8142 }
8143 };
8144
8145 let start = move || async {
8146 let op = self.send().await?;
8147 Ok(Operation::new(op))
8148 };
8149
8150 lro::internal::new_unit_response_poller(
8151 polling_error_policy,
8152 polling_backoff_policy,
8153 start,
8154 query,
8155 )
8156 }
8157
8158 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8162 self.0.request.name = v.into();
8163 self
8164 }
8165 }
8166
8167 #[doc(hidden)]
8168 impl gax::options::internal::RequestBuilder for DeleteIdentityMappingStore {
8169 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8170 &mut self.0.options
8171 }
8172 }
8173
8174 #[derive(Clone, Debug)]
8192 pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8193
8194 impl ImportIdentityMappings {
8195 pub(crate) fn new(
8196 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8197 ) -> Self {
8198 Self(RequestBuilder::new(stub))
8199 }
8200
8201 pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8203 mut self,
8204 v: V,
8205 ) -> Self {
8206 self.0.request = v.into();
8207 self
8208 }
8209
8210 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8212 self.0.options = v.into();
8213 self
8214 }
8215
8216 pub async fn send(self) -> Result<longrunning::model::Operation> {
8223 (*self.0.stub)
8224 .import_identity_mappings(self.0.request, self.0.options)
8225 .await
8226 .map(gax::response::Response::into_body)
8227 }
8228
8229 pub fn poller(
8231 self,
8232 ) -> impl lro::Poller<
8233 crate::model::ImportIdentityMappingsResponse,
8234 crate::model::IdentityMappingEntryOperationMetadata,
8235 > {
8236 type Operation = lro::internal::Operation<
8237 crate::model::ImportIdentityMappingsResponse,
8238 crate::model::IdentityMappingEntryOperationMetadata,
8239 >;
8240 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8241 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8242
8243 let stub = self.0.stub.clone();
8244 let mut options = self.0.options.clone();
8245 options.set_retry_policy(gax::retry_policy::NeverRetry);
8246 let query = move |name| {
8247 let stub = stub.clone();
8248 let options = options.clone();
8249 async {
8250 let op = GetOperation::new(stub)
8251 .set_name(name)
8252 .with_options(options)
8253 .send()
8254 .await?;
8255 Ok(Operation::new(op))
8256 }
8257 };
8258
8259 let start = move || async {
8260 let op = self.send().await?;
8261 Ok(Operation::new(op))
8262 };
8263
8264 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8265 }
8266
8267 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8271 self.0.request.identity_mapping_store = v.into();
8272 self
8273 }
8274
8275 pub fn set_source<
8280 T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
8281 >(
8282 mut self,
8283 v: T,
8284 ) -> Self {
8285 self.0.request.source = v.into();
8286 self
8287 }
8288
8289 pub fn set_inline_source<
8295 T: std::convert::Into<
8296 std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
8297 >,
8298 >(
8299 mut self,
8300 v: T,
8301 ) -> Self {
8302 self.0.request = self.0.request.set_inline_source(v);
8303 self
8304 }
8305 }
8306
8307 #[doc(hidden)]
8308 impl gax::options::internal::RequestBuilder for ImportIdentityMappings {
8309 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8310 &mut self.0.options
8311 }
8312 }
8313
8314 #[derive(Clone, Debug)]
8332 pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
8333
8334 impl PurgeIdentityMappings {
8335 pub(crate) fn new(
8336 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8337 ) -> Self {
8338 Self(RequestBuilder::new(stub))
8339 }
8340
8341 pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
8343 mut self,
8344 v: V,
8345 ) -> Self {
8346 self.0.request = v.into();
8347 self
8348 }
8349
8350 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8352 self.0.options = v.into();
8353 self
8354 }
8355
8356 pub async fn send(self) -> Result<longrunning::model::Operation> {
8363 (*self.0.stub)
8364 .purge_identity_mappings(self.0.request, self.0.options)
8365 .await
8366 .map(gax::response::Response::into_body)
8367 }
8368
8369 pub fn poller(
8371 self,
8372 ) -> impl lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata> {
8373 type Operation = lro::internal::Operation<
8374 wkt::Empty,
8375 crate::model::IdentityMappingEntryOperationMetadata,
8376 >;
8377 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8378 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8379
8380 let stub = self.0.stub.clone();
8381 let mut options = self.0.options.clone();
8382 options.set_retry_policy(gax::retry_policy::NeverRetry);
8383 let query = move |name| {
8384 let stub = stub.clone();
8385 let options = options.clone();
8386 async {
8387 let op = GetOperation::new(stub)
8388 .set_name(name)
8389 .with_options(options)
8390 .send()
8391 .await?;
8392 Ok(Operation::new(op))
8393 }
8394 };
8395
8396 let start = move || async {
8397 let op = self.send().await?;
8398 Ok(Operation::new(op))
8399 };
8400
8401 lro::internal::new_unit_response_poller(
8402 polling_error_policy,
8403 polling_backoff_policy,
8404 start,
8405 query,
8406 )
8407 }
8408
8409 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8413 self.0.request.identity_mapping_store = v.into();
8414 self
8415 }
8416
8417 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8419 self.0.request.filter = v.into();
8420 self
8421 }
8422
8423 pub fn set_force<T>(mut self, v: T) -> Self
8425 where
8426 T: std::convert::Into<bool>,
8427 {
8428 self.0.request.force = std::option::Option::Some(v.into());
8429 self
8430 }
8431
8432 pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
8434 where
8435 T: std::convert::Into<bool>,
8436 {
8437 self.0.request.force = v.map(|x| x.into());
8438 self
8439 }
8440
8441 pub fn set_source<
8446 T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
8447 >(
8448 mut self,
8449 v: T,
8450 ) -> Self {
8451 self.0.request.source = v.into();
8452 self
8453 }
8454
8455 pub fn set_inline_source<
8461 T: std::convert::Into<
8462 std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
8463 >,
8464 >(
8465 mut self,
8466 v: T,
8467 ) -> Self {
8468 self.0.request = self.0.request.set_inline_source(v);
8469 self
8470 }
8471 }
8472
8473 #[doc(hidden)]
8474 impl gax::options::internal::RequestBuilder for PurgeIdentityMappings {
8475 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8476 &mut self.0.options
8477 }
8478 }
8479
8480 #[derive(Clone, Debug)]
8501 pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
8502
8503 impl ListIdentityMappings {
8504 pub(crate) fn new(
8505 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8506 ) -> Self {
8507 Self(RequestBuilder::new(stub))
8508 }
8509
8510 pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
8512 mut self,
8513 v: V,
8514 ) -> Self {
8515 self.0.request = v.into();
8516 self
8517 }
8518
8519 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8521 self.0.options = v.into();
8522 self
8523 }
8524
8525 pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
8527 (*self.0.stub)
8528 .list_identity_mappings(self.0.request, self.0.options)
8529 .await
8530 .map(gax::response::Response::into_body)
8531 }
8532
8533 pub fn by_page(
8535 self,
8536 ) -> impl gax::paginator::Paginator<crate::model::ListIdentityMappingsResponse, gax::error::Error>
8537 {
8538 use std::clone::Clone;
8539 let token = self.0.request.page_token.clone();
8540 let execute = move |token: String| {
8541 let mut builder = self.clone();
8542 builder.0.request = builder.0.request.set_page_token(token);
8543 builder.send()
8544 };
8545 gax::paginator::internal::new_paginator(token, execute)
8546 }
8547
8548 pub fn by_item(
8550 self,
8551 ) -> impl gax::paginator::ItemPaginator<
8552 crate::model::ListIdentityMappingsResponse,
8553 gax::error::Error,
8554 > {
8555 use gax::paginator::Paginator;
8556 self.by_page().items()
8557 }
8558
8559 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8563 self.0.request.identity_mapping_store = v.into();
8564 self
8565 }
8566
8567 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8569 self.0.request.page_size = v.into();
8570 self
8571 }
8572
8573 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8575 self.0.request.page_token = v.into();
8576 self
8577 }
8578 }
8579
8580 #[doc(hidden)]
8581 impl gax::options::internal::RequestBuilder for ListIdentityMappings {
8582 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8583 &mut self.0.options
8584 }
8585 }
8586
8587 #[derive(Clone, Debug)]
8608 pub struct ListIdentityMappingStores(
8609 RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
8610 );
8611
8612 impl ListIdentityMappingStores {
8613 pub(crate) fn new(
8614 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8615 ) -> Self {
8616 Self(RequestBuilder::new(stub))
8617 }
8618
8619 pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
8621 mut self,
8622 v: V,
8623 ) -> Self {
8624 self.0.request = v.into();
8625 self
8626 }
8627
8628 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8630 self.0.options = v.into();
8631 self
8632 }
8633
8634 pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
8636 (*self.0.stub)
8637 .list_identity_mapping_stores(self.0.request, self.0.options)
8638 .await
8639 .map(gax::response::Response::into_body)
8640 }
8641
8642 pub fn by_page(
8644 self,
8645 ) -> impl gax::paginator::Paginator<
8646 crate::model::ListIdentityMappingStoresResponse,
8647 gax::error::Error,
8648 > {
8649 use std::clone::Clone;
8650 let token = self.0.request.page_token.clone();
8651 let execute = move |token: String| {
8652 let mut builder = self.clone();
8653 builder.0.request = builder.0.request.set_page_token(token);
8654 builder.send()
8655 };
8656 gax::paginator::internal::new_paginator(token, execute)
8657 }
8658
8659 pub fn by_item(
8661 self,
8662 ) -> impl gax::paginator::ItemPaginator<
8663 crate::model::ListIdentityMappingStoresResponse,
8664 gax::error::Error,
8665 > {
8666 use gax::paginator::Paginator;
8667 self.by_page().items()
8668 }
8669
8670 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8674 self.0.request.parent = v.into();
8675 self
8676 }
8677
8678 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8680 self.0.request.page_size = v.into();
8681 self
8682 }
8683
8684 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8686 self.0.request.page_token = v.into();
8687 self
8688 }
8689 }
8690
8691 #[doc(hidden)]
8692 impl gax::options::internal::RequestBuilder for ListIdentityMappingStores {
8693 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8694 &mut self.0.options
8695 }
8696 }
8697
8698 #[derive(Clone, Debug)]
8719 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
8720
8721 impl ListOperations {
8722 pub(crate) fn new(
8723 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8724 ) -> Self {
8725 Self(RequestBuilder::new(stub))
8726 }
8727
8728 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
8730 mut self,
8731 v: V,
8732 ) -> Self {
8733 self.0.request = v.into();
8734 self
8735 }
8736
8737 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8739 self.0.options = v.into();
8740 self
8741 }
8742
8743 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
8745 (*self.0.stub)
8746 .list_operations(self.0.request, self.0.options)
8747 .await
8748 .map(gax::response::Response::into_body)
8749 }
8750
8751 pub fn by_page(
8753 self,
8754 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8755 {
8756 use std::clone::Clone;
8757 let token = self.0.request.page_token.clone();
8758 let execute = move |token: String| {
8759 let mut builder = self.clone();
8760 builder.0.request = builder.0.request.set_page_token(token);
8761 builder.send()
8762 };
8763 gax::paginator::internal::new_paginator(token, execute)
8764 }
8765
8766 pub fn by_item(
8768 self,
8769 ) -> impl gax::paginator::ItemPaginator<
8770 longrunning::model::ListOperationsResponse,
8771 gax::error::Error,
8772 > {
8773 use gax::paginator::Paginator;
8774 self.by_page().items()
8775 }
8776
8777 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8779 self.0.request.name = v.into();
8780 self
8781 }
8782
8783 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8785 self.0.request.filter = v.into();
8786 self
8787 }
8788
8789 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8791 self.0.request.page_size = v.into();
8792 self
8793 }
8794
8795 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8797 self.0.request.page_token = v.into();
8798 self
8799 }
8800
8801 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8803 self.0.request.return_partial_success = v.into();
8804 self
8805 }
8806 }
8807
8808 #[doc(hidden)]
8809 impl gax::options::internal::RequestBuilder for ListOperations {
8810 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8811 &mut self.0.options
8812 }
8813 }
8814
8815 #[derive(Clone, Debug)]
8832 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8833
8834 impl GetOperation {
8835 pub(crate) fn new(
8836 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8837 ) -> Self {
8838 Self(RequestBuilder::new(stub))
8839 }
8840
8841 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8843 mut self,
8844 v: V,
8845 ) -> Self {
8846 self.0.request = v.into();
8847 self
8848 }
8849
8850 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8852 self.0.options = v.into();
8853 self
8854 }
8855
8856 pub async fn send(self) -> Result<longrunning::model::Operation> {
8858 (*self.0.stub)
8859 .get_operation(self.0.request, self.0.options)
8860 .await
8861 .map(gax::response::Response::into_body)
8862 }
8863
8864 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8866 self.0.request.name = v.into();
8867 self
8868 }
8869 }
8870
8871 #[doc(hidden)]
8872 impl gax::options::internal::RequestBuilder for GetOperation {
8873 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8874 &mut self.0.options
8875 }
8876 }
8877
8878 #[derive(Clone, Debug)]
8895 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
8896
8897 impl CancelOperation {
8898 pub(crate) fn new(
8899 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8900 ) -> Self {
8901 Self(RequestBuilder::new(stub))
8902 }
8903
8904 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
8906 mut self,
8907 v: V,
8908 ) -> Self {
8909 self.0.request = v.into();
8910 self
8911 }
8912
8913 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8915 self.0.options = v.into();
8916 self
8917 }
8918
8919 pub async fn send(self) -> Result<()> {
8921 (*self.0.stub)
8922 .cancel_operation(self.0.request, self.0.options)
8923 .await
8924 .map(gax::response::Response::into_body)
8925 }
8926
8927 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8929 self.0.request.name = v.into();
8930 self
8931 }
8932 }
8933
8934 #[doc(hidden)]
8935 impl gax::options::internal::RequestBuilder for CancelOperation {
8936 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8937 &mut self.0.options
8938 }
8939 }
8940}
8941
8942#[cfg(feature = "project-service")]
8943#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
8944pub mod project_service {
8945 use crate::Result;
8946
8947 pub type ClientBuilder =
8961 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8962
8963 pub(crate) mod client {
8964 use super::super::super::client::ProjectService;
8965 pub struct Factory;
8966 impl gax::client_builder::internal::ClientFactory for Factory {
8967 type Client = ProjectService;
8968 type Credentials = gaxi::options::Credentials;
8969 async fn build(
8970 self,
8971 config: gaxi::options::ClientConfig,
8972 ) -> gax::client_builder::Result<Self::Client> {
8973 Self::Client::new(config).await
8974 }
8975 }
8976 }
8977
8978 #[derive(Clone, Debug)]
8980 pub(crate) struct RequestBuilder<R: std::default::Default> {
8981 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
8982 request: R,
8983 options: gax::options::RequestOptions,
8984 }
8985
8986 impl<R> RequestBuilder<R>
8987 where
8988 R: std::default::Default,
8989 {
8990 pub(crate) fn new(
8991 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
8992 ) -> Self {
8993 Self {
8994 stub,
8995 request: R::default(),
8996 options: gax::options::RequestOptions::default(),
8997 }
8998 }
8999 }
9000
9001 #[derive(Clone, Debug)]
9019 pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9020
9021 impl ProvisionProject {
9022 pub(crate) fn new(
9023 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9024 ) -> Self {
9025 Self(RequestBuilder::new(stub))
9026 }
9027
9028 pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9030 mut self,
9031 v: V,
9032 ) -> Self {
9033 self.0.request = v.into();
9034 self
9035 }
9036
9037 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9039 self.0.options = v.into();
9040 self
9041 }
9042
9043 pub async fn send(self) -> Result<longrunning::model::Operation> {
9050 (*self.0.stub)
9051 .provision_project(self.0.request, self.0.options)
9052 .await
9053 .map(gax::response::Response::into_body)
9054 }
9055
9056 pub fn poller(
9058 self,
9059 ) -> impl lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9060 {
9061 type Operation = lro::internal::Operation<
9062 crate::model::Project,
9063 crate::model::ProvisionProjectMetadata,
9064 >;
9065 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9066 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9067
9068 let stub = self.0.stub.clone();
9069 let mut options = self.0.options.clone();
9070 options.set_retry_policy(gax::retry_policy::NeverRetry);
9071 let query = move |name| {
9072 let stub = stub.clone();
9073 let options = options.clone();
9074 async {
9075 let op = GetOperation::new(stub)
9076 .set_name(name)
9077 .with_options(options)
9078 .send()
9079 .await?;
9080 Ok(Operation::new(op))
9081 }
9082 };
9083
9084 let start = move || async {
9085 let op = self.send().await?;
9086 Ok(Operation::new(op))
9087 };
9088
9089 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
9090 }
9091
9092 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9096 self.0.request.name = v.into();
9097 self
9098 }
9099
9100 pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9104 self.0.request.accept_data_use_terms = v.into();
9105 self
9106 }
9107
9108 pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9112 self.0.request.data_use_terms_version = v.into();
9113 self
9114 }
9115 }
9116
9117 #[doc(hidden)]
9118 impl gax::options::internal::RequestBuilder for ProvisionProject {
9119 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9120 &mut self.0.options
9121 }
9122 }
9123
9124 #[derive(Clone, Debug)]
9145 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9146
9147 impl ListOperations {
9148 pub(crate) fn new(
9149 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9150 ) -> Self {
9151 Self(RequestBuilder::new(stub))
9152 }
9153
9154 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9156 mut self,
9157 v: V,
9158 ) -> Self {
9159 self.0.request = v.into();
9160 self
9161 }
9162
9163 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9165 self.0.options = v.into();
9166 self
9167 }
9168
9169 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9171 (*self.0.stub)
9172 .list_operations(self.0.request, self.0.options)
9173 .await
9174 .map(gax::response::Response::into_body)
9175 }
9176
9177 pub fn by_page(
9179 self,
9180 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9181 {
9182 use std::clone::Clone;
9183 let token = self.0.request.page_token.clone();
9184 let execute = move |token: String| {
9185 let mut builder = self.clone();
9186 builder.0.request = builder.0.request.set_page_token(token);
9187 builder.send()
9188 };
9189 gax::paginator::internal::new_paginator(token, execute)
9190 }
9191
9192 pub fn by_item(
9194 self,
9195 ) -> impl gax::paginator::ItemPaginator<
9196 longrunning::model::ListOperationsResponse,
9197 gax::error::Error,
9198 > {
9199 use gax::paginator::Paginator;
9200 self.by_page().items()
9201 }
9202
9203 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9205 self.0.request.name = v.into();
9206 self
9207 }
9208
9209 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9211 self.0.request.filter = v.into();
9212 self
9213 }
9214
9215 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9217 self.0.request.page_size = v.into();
9218 self
9219 }
9220
9221 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9223 self.0.request.page_token = v.into();
9224 self
9225 }
9226
9227 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9229 self.0.request.return_partial_success = v.into();
9230 self
9231 }
9232 }
9233
9234 #[doc(hidden)]
9235 impl gax::options::internal::RequestBuilder for ListOperations {
9236 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9237 &mut self.0.options
9238 }
9239 }
9240
9241 #[derive(Clone, Debug)]
9258 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9259
9260 impl GetOperation {
9261 pub(crate) fn new(
9262 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9263 ) -> Self {
9264 Self(RequestBuilder::new(stub))
9265 }
9266
9267 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9269 mut self,
9270 v: V,
9271 ) -> Self {
9272 self.0.request = v.into();
9273 self
9274 }
9275
9276 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9278 self.0.options = v.into();
9279 self
9280 }
9281
9282 pub async fn send(self) -> Result<longrunning::model::Operation> {
9284 (*self.0.stub)
9285 .get_operation(self.0.request, self.0.options)
9286 .await
9287 .map(gax::response::Response::into_body)
9288 }
9289
9290 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9292 self.0.request.name = v.into();
9293 self
9294 }
9295 }
9296
9297 #[doc(hidden)]
9298 impl gax::options::internal::RequestBuilder for GetOperation {
9299 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9300 &mut self.0.options
9301 }
9302 }
9303
9304 #[derive(Clone, Debug)]
9321 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9322
9323 impl CancelOperation {
9324 pub(crate) fn new(
9325 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9326 ) -> Self {
9327 Self(RequestBuilder::new(stub))
9328 }
9329
9330 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9332 mut self,
9333 v: V,
9334 ) -> Self {
9335 self.0.request = v.into();
9336 self
9337 }
9338
9339 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9341 self.0.options = v.into();
9342 self
9343 }
9344
9345 pub async fn send(self) -> Result<()> {
9347 (*self.0.stub)
9348 .cancel_operation(self.0.request, self.0.options)
9349 .await
9350 .map(gax::response::Response::into_body)
9351 }
9352
9353 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9355 self.0.request.name = v.into();
9356 self
9357 }
9358 }
9359
9360 #[doc(hidden)]
9361 impl gax::options::internal::RequestBuilder for CancelOperation {
9362 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9363 &mut self.0.options
9364 }
9365 }
9366}
9367
9368#[cfg(feature = "rank-service")]
9369#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
9370pub mod rank_service {
9371 use crate::Result;
9372
9373 pub type ClientBuilder =
9387 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9388
9389 pub(crate) mod client {
9390 use super::super::super::client::RankService;
9391 pub struct Factory;
9392 impl gax::client_builder::internal::ClientFactory for Factory {
9393 type Client = RankService;
9394 type Credentials = gaxi::options::Credentials;
9395 async fn build(
9396 self,
9397 config: gaxi::options::ClientConfig,
9398 ) -> gax::client_builder::Result<Self::Client> {
9399 Self::Client::new(config).await
9400 }
9401 }
9402 }
9403
9404 #[derive(Clone, Debug)]
9406 pub(crate) struct RequestBuilder<R: std::default::Default> {
9407 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9408 request: R,
9409 options: gax::options::RequestOptions,
9410 }
9411
9412 impl<R> RequestBuilder<R>
9413 where
9414 R: std::default::Default,
9415 {
9416 pub(crate) fn new(
9417 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9418 ) -> Self {
9419 Self {
9420 stub,
9421 request: R::default(),
9422 options: gax::options::RequestOptions::default(),
9423 }
9424 }
9425 }
9426
9427 #[derive(Clone, Debug)]
9444 pub struct Rank(RequestBuilder<crate::model::RankRequest>);
9445
9446 impl Rank {
9447 pub(crate) fn new(
9448 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9449 ) -> Self {
9450 Self(RequestBuilder::new(stub))
9451 }
9452
9453 pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
9455 self.0.request = v.into();
9456 self
9457 }
9458
9459 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9461 self.0.options = v.into();
9462 self
9463 }
9464
9465 pub async fn send(self) -> Result<crate::model::RankResponse> {
9467 (*self.0.stub)
9468 .rank(self.0.request, self.0.options)
9469 .await
9470 .map(gax::response::Response::into_body)
9471 }
9472
9473 pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9477 self.0.request.ranking_config = v.into();
9478 self
9479 }
9480
9481 pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
9483 self.0.request.model = v.into();
9484 self
9485 }
9486
9487 pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
9489 self.0.request.top_n = v.into();
9490 self
9491 }
9492
9493 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
9495 self.0.request.query = v.into();
9496 self
9497 }
9498
9499 pub fn set_records<T, V>(mut self, v: T) -> Self
9503 where
9504 T: std::iter::IntoIterator<Item = V>,
9505 V: std::convert::Into<crate::model::RankingRecord>,
9506 {
9507 use std::iter::Iterator;
9508 self.0.request.records = v.into_iter().map(|i| i.into()).collect();
9509 self
9510 }
9511
9512 pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
9514 self.0.request.ignore_record_details_in_response = v.into();
9515 self
9516 }
9517
9518 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9520 where
9521 T: std::iter::IntoIterator<Item = (K, V)>,
9522 K: std::convert::Into<std::string::String>,
9523 V: std::convert::Into<std::string::String>,
9524 {
9525 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9526 self
9527 }
9528 }
9529
9530 #[doc(hidden)]
9531 impl gax::options::internal::RequestBuilder for Rank {
9532 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9533 &mut self.0.options
9534 }
9535 }
9536
9537 #[derive(Clone, Debug)]
9558 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9559
9560 impl ListOperations {
9561 pub(crate) fn new(
9562 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9563 ) -> Self {
9564 Self(RequestBuilder::new(stub))
9565 }
9566
9567 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9569 mut self,
9570 v: V,
9571 ) -> Self {
9572 self.0.request = v.into();
9573 self
9574 }
9575
9576 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9578 self.0.options = v.into();
9579 self
9580 }
9581
9582 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9584 (*self.0.stub)
9585 .list_operations(self.0.request, self.0.options)
9586 .await
9587 .map(gax::response::Response::into_body)
9588 }
9589
9590 pub fn by_page(
9592 self,
9593 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9594 {
9595 use std::clone::Clone;
9596 let token = self.0.request.page_token.clone();
9597 let execute = move |token: String| {
9598 let mut builder = self.clone();
9599 builder.0.request = builder.0.request.set_page_token(token);
9600 builder.send()
9601 };
9602 gax::paginator::internal::new_paginator(token, execute)
9603 }
9604
9605 pub fn by_item(
9607 self,
9608 ) -> impl gax::paginator::ItemPaginator<
9609 longrunning::model::ListOperationsResponse,
9610 gax::error::Error,
9611 > {
9612 use gax::paginator::Paginator;
9613 self.by_page().items()
9614 }
9615
9616 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9618 self.0.request.name = v.into();
9619 self
9620 }
9621
9622 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9624 self.0.request.filter = v.into();
9625 self
9626 }
9627
9628 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9630 self.0.request.page_size = v.into();
9631 self
9632 }
9633
9634 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9636 self.0.request.page_token = v.into();
9637 self
9638 }
9639
9640 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9642 self.0.request.return_partial_success = v.into();
9643 self
9644 }
9645 }
9646
9647 #[doc(hidden)]
9648 impl gax::options::internal::RequestBuilder for ListOperations {
9649 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9650 &mut self.0.options
9651 }
9652 }
9653
9654 #[derive(Clone, Debug)]
9671 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9672
9673 impl GetOperation {
9674 pub(crate) fn new(
9675 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9676 ) -> Self {
9677 Self(RequestBuilder::new(stub))
9678 }
9679
9680 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9682 mut self,
9683 v: V,
9684 ) -> Self {
9685 self.0.request = v.into();
9686 self
9687 }
9688
9689 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9691 self.0.options = v.into();
9692 self
9693 }
9694
9695 pub async fn send(self) -> Result<longrunning::model::Operation> {
9697 (*self.0.stub)
9698 .get_operation(self.0.request, self.0.options)
9699 .await
9700 .map(gax::response::Response::into_body)
9701 }
9702
9703 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9705 self.0.request.name = v.into();
9706 self
9707 }
9708 }
9709
9710 #[doc(hidden)]
9711 impl gax::options::internal::RequestBuilder for GetOperation {
9712 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9713 &mut self.0.options
9714 }
9715 }
9716
9717 #[derive(Clone, Debug)]
9734 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9735
9736 impl CancelOperation {
9737 pub(crate) fn new(
9738 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9739 ) -> Self {
9740 Self(RequestBuilder::new(stub))
9741 }
9742
9743 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9745 mut self,
9746 v: V,
9747 ) -> Self {
9748 self.0.request = v.into();
9749 self
9750 }
9751
9752 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9754 self.0.options = v.into();
9755 self
9756 }
9757
9758 pub async fn send(self) -> Result<()> {
9760 (*self.0.stub)
9761 .cancel_operation(self.0.request, self.0.options)
9762 .await
9763 .map(gax::response::Response::into_body)
9764 }
9765
9766 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9768 self.0.request.name = v.into();
9769 self
9770 }
9771 }
9772
9773 #[doc(hidden)]
9774 impl gax::options::internal::RequestBuilder for CancelOperation {
9775 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9776 &mut self.0.options
9777 }
9778 }
9779}
9780
9781#[cfg(feature = "recommendation-service")]
9782#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
9783pub mod recommendation_service {
9784 use crate::Result;
9785
9786 pub type ClientBuilder =
9800 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9801
9802 pub(crate) mod client {
9803 use super::super::super::client::RecommendationService;
9804 pub struct Factory;
9805 impl gax::client_builder::internal::ClientFactory for Factory {
9806 type Client = RecommendationService;
9807 type Credentials = gaxi::options::Credentials;
9808 async fn build(
9809 self,
9810 config: gaxi::options::ClientConfig,
9811 ) -> gax::client_builder::Result<Self::Client> {
9812 Self::Client::new(config).await
9813 }
9814 }
9815 }
9816
9817 #[derive(Clone, Debug)]
9819 pub(crate) struct RequestBuilder<R: std::default::Default> {
9820 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9821 request: R,
9822 options: gax::options::RequestOptions,
9823 }
9824
9825 impl<R> RequestBuilder<R>
9826 where
9827 R: std::default::Default,
9828 {
9829 pub(crate) fn new(
9830 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9831 ) -> Self {
9832 Self {
9833 stub,
9834 request: R::default(),
9835 options: gax::options::RequestOptions::default(),
9836 }
9837 }
9838 }
9839
9840 #[derive(Clone, Debug)]
9857 pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
9858
9859 impl Recommend {
9860 pub(crate) fn new(
9861 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9862 ) -> Self {
9863 Self(RequestBuilder::new(stub))
9864 }
9865
9866 pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
9868 self.0.request = v.into();
9869 self
9870 }
9871
9872 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9874 self.0.options = v.into();
9875 self
9876 }
9877
9878 pub async fn send(self) -> Result<crate::model::RecommendResponse> {
9880 (*self.0.stub)
9881 .recommend(self.0.request, self.0.options)
9882 .await
9883 .map(gax::response::Response::into_body)
9884 }
9885
9886 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9890 self.0.request.serving_config = v.into();
9891 self
9892 }
9893
9894 pub fn set_user_event<T>(mut self, v: T) -> Self
9898 where
9899 T: std::convert::Into<crate::model::UserEvent>,
9900 {
9901 self.0.request.user_event = std::option::Option::Some(v.into());
9902 self
9903 }
9904
9905 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
9909 where
9910 T: std::convert::Into<crate::model::UserEvent>,
9911 {
9912 self.0.request.user_event = v.map(|x| x.into());
9913 self
9914 }
9915
9916 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9918 self.0.request.page_size = v.into();
9919 self
9920 }
9921
9922 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9924 self.0.request.filter = v.into();
9925 self
9926 }
9927
9928 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
9930 self.0.request.validate_only = v.into();
9931 self
9932 }
9933
9934 pub fn set_params<T, K, V>(mut self, v: T) -> Self
9936 where
9937 T: std::iter::IntoIterator<Item = (K, V)>,
9938 K: std::convert::Into<std::string::String>,
9939 V: std::convert::Into<wkt::Value>,
9940 {
9941 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9942 self
9943 }
9944
9945 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9947 where
9948 T: std::iter::IntoIterator<Item = (K, V)>,
9949 K: std::convert::Into<std::string::String>,
9950 V: std::convert::Into<std::string::String>,
9951 {
9952 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9953 self
9954 }
9955 }
9956
9957 #[doc(hidden)]
9958 impl gax::options::internal::RequestBuilder for Recommend {
9959 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9960 &mut self.0.options
9961 }
9962 }
9963
9964 #[derive(Clone, Debug)]
9985 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9986
9987 impl ListOperations {
9988 pub(crate) fn new(
9989 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9990 ) -> Self {
9991 Self(RequestBuilder::new(stub))
9992 }
9993
9994 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9996 mut self,
9997 v: V,
9998 ) -> Self {
9999 self.0.request = v.into();
10000 self
10001 }
10002
10003 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10005 self.0.options = v.into();
10006 self
10007 }
10008
10009 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10011 (*self.0.stub)
10012 .list_operations(self.0.request, self.0.options)
10013 .await
10014 .map(gax::response::Response::into_body)
10015 }
10016
10017 pub fn by_page(
10019 self,
10020 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10021 {
10022 use std::clone::Clone;
10023 let token = self.0.request.page_token.clone();
10024 let execute = move |token: String| {
10025 let mut builder = self.clone();
10026 builder.0.request = builder.0.request.set_page_token(token);
10027 builder.send()
10028 };
10029 gax::paginator::internal::new_paginator(token, execute)
10030 }
10031
10032 pub fn by_item(
10034 self,
10035 ) -> impl gax::paginator::ItemPaginator<
10036 longrunning::model::ListOperationsResponse,
10037 gax::error::Error,
10038 > {
10039 use gax::paginator::Paginator;
10040 self.by_page().items()
10041 }
10042
10043 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10045 self.0.request.name = v.into();
10046 self
10047 }
10048
10049 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10051 self.0.request.filter = v.into();
10052 self
10053 }
10054
10055 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10057 self.0.request.page_size = v.into();
10058 self
10059 }
10060
10061 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10063 self.0.request.page_token = v.into();
10064 self
10065 }
10066
10067 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10069 self.0.request.return_partial_success = v.into();
10070 self
10071 }
10072 }
10073
10074 #[doc(hidden)]
10075 impl gax::options::internal::RequestBuilder for ListOperations {
10076 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10077 &mut self.0.options
10078 }
10079 }
10080
10081 #[derive(Clone, Debug)]
10098 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
10099
10100 impl GetOperation {
10101 pub(crate) fn new(
10102 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10103 ) -> Self {
10104 Self(RequestBuilder::new(stub))
10105 }
10106
10107 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
10109 mut self,
10110 v: V,
10111 ) -> Self {
10112 self.0.request = v.into();
10113 self
10114 }
10115
10116 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10118 self.0.options = v.into();
10119 self
10120 }
10121
10122 pub async fn send(self) -> Result<longrunning::model::Operation> {
10124 (*self.0.stub)
10125 .get_operation(self.0.request, self.0.options)
10126 .await
10127 .map(gax::response::Response::into_body)
10128 }
10129
10130 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10132 self.0.request.name = v.into();
10133 self
10134 }
10135 }
10136
10137 #[doc(hidden)]
10138 impl gax::options::internal::RequestBuilder for GetOperation {
10139 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10140 &mut self.0.options
10141 }
10142 }
10143
10144 #[derive(Clone, Debug)]
10161 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
10162
10163 impl CancelOperation {
10164 pub(crate) fn new(
10165 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10166 ) -> Self {
10167 Self(RequestBuilder::new(stub))
10168 }
10169
10170 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
10172 mut self,
10173 v: V,
10174 ) -> Self {
10175 self.0.request = v.into();
10176 self
10177 }
10178
10179 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10181 self.0.options = v.into();
10182 self
10183 }
10184
10185 pub async fn send(self) -> Result<()> {
10187 (*self.0.stub)
10188 .cancel_operation(self.0.request, self.0.options)
10189 .await
10190 .map(gax::response::Response::into_body)
10191 }
10192
10193 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10195 self.0.request.name = v.into();
10196 self
10197 }
10198 }
10199
10200 #[doc(hidden)]
10201 impl gax::options::internal::RequestBuilder for CancelOperation {
10202 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10203 &mut self.0.options
10204 }
10205 }
10206}
10207
10208#[cfg(feature = "schema-service")]
10209#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
10210pub mod schema_service {
10211 use crate::Result;
10212
10213 pub type ClientBuilder =
10227 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10228
10229 pub(crate) mod client {
10230 use super::super::super::client::SchemaService;
10231 pub struct Factory;
10232 impl gax::client_builder::internal::ClientFactory for Factory {
10233 type Client = SchemaService;
10234 type Credentials = gaxi::options::Credentials;
10235 async fn build(
10236 self,
10237 config: gaxi::options::ClientConfig,
10238 ) -> gax::client_builder::Result<Self::Client> {
10239 Self::Client::new(config).await
10240 }
10241 }
10242 }
10243
10244 #[derive(Clone, Debug)]
10246 pub(crate) struct RequestBuilder<R: std::default::Default> {
10247 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10248 request: R,
10249 options: gax::options::RequestOptions,
10250 }
10251
10252 impl<R> RequestBuilder<R>
10253 where
10254 R: std::default::Default,
10255 {
10256 pub(crate) fn new(
10257 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10258 ) -> Self {
10259 Self {
10260 stub,
10261 request: R::default(),
10262 options: gax::options::RequestOptions::default(),
10263 }
10264 }
10265 }
10266
10267 #[derive(Clone, Debug)]
10284 pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
10285
10286 impl GetSchema {
10287 pub(crate) fn new(
10288 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10289 ) -> Self {
10290 Self(RequestBuilder::new(stub))
10291 }
10292
10293 pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
10295 self.0.request = v.into();
10296 self
10297 }
10298
10299 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10301 self.0.options = v.into();
10302 self
10303 }
10304
10305 pub async fn send(self) -> Result<crate::model::Schema> {
10307 (*self.0.stub)
10308 .get_schema(self.0.request, self.0.options)
10309 .await
10310 .map(gax::response::Response::into_body)
10311 }
10312
10313 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10317 self.0.request.name = v.into();
10318 self
10319 }
10320 }
10321
10322 #[doc(hidden)]
10323 impl gax::options::internal::RequestBuilder for GetSchema {
10324 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10325 &mut self.0.options
10326 }
10327 }
10328
10329 #[derive(Clone, Debug)]
10350 pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
10351
10352 impl ListSchemas {
10353 pub(crate) fn new(
10354 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10355 ) -> Self {
10356 Self(RequestBuilder::new(stub))
10357 }
10358
10359 pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
10361 self.0.request = v.into();
10362 self
10363 }
10364
10365 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10367 self.0.options = v.into();
10368 self
10369 }
10370
10371 pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
10373 (*self.0.stub)
10374 .list_schemas(self.0.request, self.0.options)
10375 .await
10376 .map(gax::response::Response::into_body)
10377 }
10378
10379 pub fn by_page(
10381 self,
10382 ) -> impl gax::paginator::Paginator<crate::model::ListSchemasResponse, gax::error::Error>
10383 {
10384 use std::clone::Clone;
10385 let token = self.0.request.page_token.clone();
10386 let execute = move |token: String| {
10387 let mut builder = self.clone();
10388 builder.0.request = builder.0.request.set_page_token(token);
10389 builder.send()
10390 };
10391 gax::paginator::internal::new_paginator(token, execute)
10392 }
10393
10394 pub fn by_item(
10396 self,
10397 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSchemasResponse, gax::error::Error>
10398 {
10399 use gax::paginator::Paginator;
10400 self.by_page().items()
10401 }
10402
10403 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10407 self.0.request.parent = v.into();
10408 self
10409 }
10410
10411 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10413 self.0.request.page_size = v.into();
10414 self
10415 }
10416
10417 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10419 self.0.request.page_token = v.into();
10420 self
10421 }
10422 }
10423
10424 #[doc(hidden)]
10425 impl gax::options::internal::RequestBuilder for ListSchemas {
10426 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10427 &mut self.0.options
10428 }
10429 }
10430
10431 #[derive(Clone, Debug)]
10449 pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
10450
10451 impl CreateSchema {
10452 pub(crate) fn new(
10453 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10454 ) -> Self {
10455 Self(RequestBuilder::new(stub))
10456 }
10457
10458 pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
10460 self.0.request = v.into();
10461 self
10462 }
10463
10464 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10466 self.0.options = v.into();
10467 self
10468 }
10469
10470 pub async fn send(self) -> Result<longrunning::model::Operation> {
10477 (*self.0.stub)
10478 .create_schema(self.0.request, self.0.options)
10479 .await
10480 .map(gax::response::Response::into_body)
10481 }
10482
10483 pub fn poller(
10485 self,
10486 ) -> impl lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata> {
10487 type Operation =
10488 lro::internal::Operation<crate::model::Schema, crate::model::CreateSchemaMetadata>;
10489 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10490 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10491
10492 let stub = self.0.stub.clone();
10493 let mut options = self.0.options.clone();
10494 options.set_retry_policy(gax::retry_policy::NeverRetry);
10495 let query = move |name| {
10496 let stub = stub.clone();
10497 let options = options.clone();
10498 async {
10499 let op = GetOperation::new(stub)
10500 .set_name(name)
10501 .with_options(options)
10502 .send()
10503 .await?;
10504 Ok(Operation::new(op))
10505 }
10506 };
10507
10508 let start = move || async {
10509 let op = self.send().await?;
10510 Ok(Operation::new(op))
10511 };
10512
10513 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10514 }
10515
10516 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10520 self.0.request.parent = v.into();
10521 self
10522 }
10523
10524 pub fn set_schema<T>(mut self, v: T) -> Self
10528 where
10529 T: std::convert::Into<crate::model::Schema>,
10530 {
10531 self.0.request.schema = std::option::Option::Some(v.into());
10532 self
10533 }
10534
10535 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10539 where
10540 T: std::convert::Into<crate::model::Schema>,
10541 {
10542 self.0.request.schema = v.map(|x| x.into());
10543 self
10544 }
10545
10546 pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
10550 self.0.request.schema_id = v.into();
10551 self
10552 }
10553 }
10554
10555 #[doc(hidden)]
10556 impl gax::options::internal::RequestBuilder for CreateSchema {
10557 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10558 &mut self.0.options
10559 }
10560 }
10561
10562 #[derive(Clone, Debug)]
10580 pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
10581
10582 impl UpdateSchema {
10583 pub(crate) fn new(
10584 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10585 ) -> Self {
10586 Self(RequestBuilder::new(stub))
10587 }
10588
10589 pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
10591 self.0.request = v.into();
10592 self
10593 }
10594
10595 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10597 self.0.options = v.into();
10598 self
10599 }
10600
10601 pub async fn send(self) -> Result<longrunning::model::Operation> {
10608 (*self.0.stub)
10609 .update_schema(self.0.request, self.0.options)
10610 .await
10611 .map(gax::response::Response::into_body)
10612 }
10613
10614 pub fn poller(
10616 self,
10617 ) -> impl lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata> {
10618 type Operation =
10619 lro::internal::Operation<crate::model::Schema, crate::model::UpdateSchemaMetadata>;
10620 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10621 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10622
10623 let stub = self.0.stub.clone();
10624 let mut options = self.0.options.clone();
10625 options.set_retry_policy(gax::retry_policy::NeverRetry);
10626 let query = move |name| {
10627 let stub = stub.clone();
10628 let options = options.clone();
10629 async {
10630 let op = GetOperation::new(stub)
10631 .set_name(name)
10632 .with_options(options)
10633 .send()
10634 .await?;
10635 Ok(Operation::new(op))
10636 }
10637 };
10638
10639 let start = move || async {
10640 let op = self.send().await?;
10641 Ok(Operation::new(op))
10642 };
10643
10644 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10645 }
10646
10647 pub fn set_schema<T>(mut self, v: T) -> Self
10651 where
10652 T: std::convert::Into<crate::model::Schema>,
10653 {
10654 self.0.request.schema = std::option::Option::Some(v.into());
10655 self
10656 }
10657
10658 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10662 where
10663 T: std::convert::Into<crate::model::Schema>,
10664 {
10665 self.0.request.schema = v.map(|x| x.into());
10666 self
10667 }
10668
10669 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
10671 self.0.request.allow_missing = v.into();
10672 self
10673 }
10674 }
10675
10676 #[doc(hidden)]
10677 impl gax::options::internal::RequestBuilder for UpdateSchema {
10678 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10679 &mut self.0.options
10680 }
10681 }
10682
10683 #[derive(Clone, Debug)]
10701 pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
10702
10703 impl DeleteSchema {
10704 pub(crate) fn new(
10705 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10706 ) -> Self {
10707 Self(RequestBuilder::new(stub))
10708 }
10709
10710 pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
10712 self.0.request = v.into();
10713 self
10714 }
10715
10716 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10718 self.0.options = v.into();
10719 self
10720 }
10721
10722 pub async fn send(self) -> Result<longrunning::model::Operation> {
10729 (*self.0.stub)
10730 .delete_schema(self.0.request, self.0.options)
10731 .await
10732 .map(gax::response::Response::into_body)
10733 }
10734
10735 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteSchemaMetadata> {
10737 type Operation =
10738 lro::internal::Operation<wkt::Empty, crate::model::DeleteSchemaMetadata>;
10739 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10740 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10741
10742 let stub = self.0.stub.clone();
10743 let mut options = self.0.options.clone();
10744 options.set_retry_policy(gax::retry_policy::NeverRetry);
10745 let query = move |name| {
10746 let stub = stub.clone();
10747 let options = options.clone();
10748 async {
10749 let op = GetOperation::new(stub)
10750 .set_name(name)
10751 .with_options(options)
10752 .send()
10753 .await?;
10754 Ok(Operation::new(op))
10755 }
10756 };
10757
10758 let start = move || async {
10759 let op = self.send().await?;
10760 Ok(Operation::new(op))
10761 };
10762
10763 lro::internal::new_unit_response_poller(
10764 polling_error_policy,
10765 polling_backoff_policy,
10766 start,
10767 query,
10768 )
10769 }
10770
10771 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10775 self.0.request.name = v.into();
10776 self
10777 }
10778 }
10779
10780 #[doc(hidden)]
10781 impl gax::options::internal::RequestBuilder for DeleteSchema {
10782 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10783 &mut self.0.options
10784 }
10785 }
10786
10787 #[derive(Clone, Debug)]
10808 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
10809
10810 impl ListOperations {
10811 pub(crate) fn new(
10812 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10813 ) -> Self {
10814 Self(RequestBuilder::new(stub))
10815 }
10816
10817 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
10819 mut self,
10820 v: V,
10821 ) -> Self {
10822 self.0.request = v.into();
10823 self
10824 }
10825
10826 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10828 self.0.options = v.into();
10829 self
10830 }
10831
10832 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10834 (*self.0.stub)
10835 .list_operations(self.0.request, self.0.options)
10836 .await
10837 .map(gax::response::Response::into_body)
10838 }
10839
10840 pub fn by_page(
10842 self,
10843 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10844 {
10845 use std::clone::Clone;
10846 let token = self.0.request.page_token.clone();
10847 let execute = move |token: String| {
10848 let mut builder = self.clone();
10849 builder.0.request = builder.0.request.set_page_token(token);
10850 builder.send()
10851 };
10852 gax::paginator::internal::new_paginator(token, execute)
10853 }
10854
10855 pub fn by_item(
10857 self,
10858 ) -> impl gax::paginator::ItemPaginator<
10859 longrunning::model::ListOperationsResponse,
10860 gax::error::Error,
10861 > {
10862 use gax::paginator::Paginator;
10863 self.by_page().items()
10864 }
10865
10866 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10868 self.0.request.name = v.into();
10869 self
10870 }
10871
10872 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10874 self.0.request.filter = v.into();
10875 self
10876 }
10877
10878 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10880 self.0.request.page_size = v.into();
10881 self
10882 }
10883
10884 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10886 self.0.request.page_token = v.into();
10887 self
10888 }
10889
10890 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10892 self.0.request.return_partial_success = v.into();
10893 self
10894 }
10895 }
10896
10897 #[doc(hidden)]
10898 impl gax::options::internal::RequestBuilder for ListOperations {
10899 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10900 &mut self.0.options
10901 }
10902 }
10903
10904 #[derive(Clone, Debug)]
10921 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
10922
10923 impl GetOperation {
10924 pub(crate) fn new(
10925 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10926 ) -> Self {
10927 Self(RequestBuilder::new(stub))
10928 }
10929
10930 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
10932 mut self,
10933 v: V,
10934 ) -> Self {
10935 self.0.request = v.into();
10936 self
10937 }
10938
10939 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10941 self.0.options = v.into();
10942 self
10943 }
10944
10945 pub async fn send(self) -> Result<longrunning::model::Operation> {
10947 (*self.0.stub)
10948 .get_operation(self.0.request, self.0.options)
10949 .await
10950 .map(gax::response::Response::into_body)
10951 }
10952
10953 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10955 self.0.request.name = v.into();
10956 self
10957 }
10958 }
10959
10960 #[doc(hidden)]
10961 impl gax::options::internal::RequestBuilder for GetOperation {
10962 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10963 &mut self.0.options
10964 }
10965 }
10966
10967 #[derive(Clone, Debug)]
10984 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
10985
10986 impl CancelOperation {
10987 pub(crate) fn new(
10988 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10989 ) -> Self {
10990 Self(RequestBuilder::new(stub))
10991 }
10992
10993 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
10995 mut self,
10996 v: V,
10997 ) -> Self {
10998 self.0.request = v.into();
10999 self
11000 }
11001
11002 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11004 self.0.options = v.into();
11005 self
11006 }
11007
11008 pub async fn send(self) -> Result<()> {
11010 (*self.0.stub)
11011 .cancel_operation(self.0.request, self.0.options)
11012 .await
11013 .map(gax::response::Response::into_body)
11014 }
11015
11016 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11018 self.0.request.name = v.into();
11019 self
11020 }
11021 }
11022
11023 #[doc(hidden)]
11024 impl gax::options::internal::RequestBuilder for CancelOperation {
11025 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11026 &mut self.0.options
11027 }
11028 }
11029}
11030
11031#[cfg(feature = "search-service")]
11032#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11033pub mod search_service {
11034 use crate::Result;
11035
11036 pub type ClientBuilder =
11050 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11051
11052 pub(crate) mod client {
11053 use super::super::super::client::SearchService;
11054 pub struct Factory;
11055 impl gax::client_builder::internal::ClientFactory for Factory {
11056 type Client = SearchService;
11057 type Credentials = gaxi::options::Credentials;
11058 async fn build(
11059 self,
11060 config: gaxi::options::ClientConfig,
11061 ) -> gax::client_builder::Result<Self::Client> {
11062 Self::Client::new(config).await
11063 }
11064 }
11065 }
11066
11067 #[derive(Clone, Debug)]
11069 pub(crate) struct RequestBuilder<R: std::default::Default> {
11070 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11071 request: R,
11072 options: gax::options::RequestOptions,
11073 }
11074
11075 impl<R> RequestBuilder<R>
11076 where
11077 R: std::default::Default,
11078 {
11079 pub(crate) fn new(
11080 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11081 ) -> Self {
11082 Self {
11083 stub,
11084 request: R::default(),
11085 options: gax::options::RequestOptions::default(),
11086 }
11087 }
11088 }
11089
11090 #[derive(Clone, Debug)]
11111 pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11112
11113 impl Search {
11114 pub(crate) fn new(
11115 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11116 ) -> Self {
11117 Self(RequestBuilder::new(stub))
11118 }
11119
11120 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11122 self.0.request = v.into();
11123 self
11124 }
11125
11126 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11128 self.0.options = v.into();
11129 self
11130 }
11131
11132 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11134 (*self.0.stub)
11135 .search(self.0.request, self.0.options)
11136 .await
11137 .map(gax::response::Response::into_body)
11138 }
11139
11140 pub fn by_page(
11142 self,
11143 ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
11144 {
11145 use std::clone::Clone;
11146 let token = self.0.request.page_token.clone();
11147 let execute = move |token: String| {
11148 let mut builder = self.clone();
11149 builder.0.request = builder.0.request.set_page_token(token);
11150 builder.send()
11151 };
11152 gax::paginator::internal::new_paginator(token, execute)
11153 }
11154
11155 pub fn by_item(
11157 self,
11158 ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
11159 {
11160 use gax::paginator::Paginator;
11161 self.by_page().items()
11162 }
11163
11164 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11168 self.0.request.serving_config = v.into();
11169 self
11170 }
11171
11172 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11174 self.0.request.branch = v.into();
11175 self
11176 }
11177
11178 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11180 self.0.request.query = v.into();
11181 self
11182 }
11183
11184 pub fn set_image_query<T>(mut self, v: T) -> Self
11186 where
11187 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11188 {
11189 self.0.request.image_query = std::option::Option::Some(v.into());
11190 self
11191 }
11192
11193 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11195 where
11196 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11197 {
11198 self.0.request.image_query = v.map(|x| x.into());
11199 self
11200 }
11201
11202 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11204 self.0.request.page_size = v.into();
11205 self
11206 }
11207
11208 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11210 self.0.request.page_token = v.into();
11211 self
11212 }
11213
11214 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11216 self.0.request.offset = v.into();
11217 self
11218 }
11219
11220 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11222 self.0.request.one_box_page_size = v.into();
11223 self
11224 }
11225
11226 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11228 where
11229 T: std::iter::IntoIterator<Item = V>,
11230 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11231 {
11232 use std::iter::Iterator;
11233 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11234 self
11235 }
11236
11237 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11239 self.0.request.filter = v.into();
11240 self
11241 }
11242
11243 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11245 self.0.request.canonical_filter = v.into();
11246 self
11247 }
11248
11249 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11251 self.0.request.order_by = v.into();
11252 self
11253 }
11254
11255 pub fn set_user_info<T>(mut self, v: T) -> Self
11257 where
11258 T: std::convert::Into<crate::model::UserInfo>,
11259 {
11260 self.0.request.user_info = std::option::Option::Some(v.into());
11261 self
11262 }
11263
11264 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11266 where
11267 T: std::convert::Into<crate::model::UserInfo>,
11268 {
11269 self.0.request.user_info = v.map(|x| x.into());
11270 self
11271 }
11272
11273 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11275 self.0.request.language_code = v.into();
11276 self
11277 }
11278
11279 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11281 where
11282 T: std::iter::IntoIterator<Item = V>,
11283 V: std::convert::Into<crate::model::search_request::FacetSpec>,
11284 {
11285 use std::iter::Iterator;
11286 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11287 self
11288 }
11289
11290 pub fn set_boost_spec<T>(mut self, v: T) -> Self
11292 where
11293 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11294 {
11295 self.0.request.boost_spec = std::option::Option::Some(v.into());
11296 self
11297 }
11298
11299 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11301 where
11302 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11303 {
11304 self.0.request.boost_spec = v.map(|x| x.into());
11305 self
11306 }
11307
11308 pub fn set_params<T, K, V>(mut self, v: T) -> Self
11310 where
11311 T: std::iter::IntoIterator<Item = (K, V)>,
11312 K: std::convert::Into<std::string::String>,
11313 V: std::convert::Into<wkt::Value>,
11314 {
11315 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11316 self
11317 }
11318
11319 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11321 where
11322 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11323 {
11324 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11325 self
11326 }
11327
11328 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11330 where
11331 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11332 {
11333 self.0.request.query_expansion_spec = v.map(|x| x.into());
11334 self
11335 }
11336
11337 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11339 where
11340 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11341 {
11342 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11343 self
11344 }
11345
11346 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11348 where
11349 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11350 {
11351 self.0.request.spell_correction_spec = v.map(|x| x.into());
11352 self
11353 }
11354
11355 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11357 self.0.request.user_pseudo_id = v.into();
11358 self
11359 }
11360
11361 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11363 where
11364 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11365 {
11366 self.0.request.content_search_spec = std::option::Option::Some(v.into());
11367 self
11368 }
11369
11370 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11372 where
11373 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11374 {
11375 self.0.request.content_search_spec = v.map(|x| x.into());
11376 self
11377 }
11378
11379 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11381 self.0.request.safe_search = v.into();
11382 self
11383 }
11384
11385 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11387 where
11388 T: std::iter::IntoIterator<Item = (K, V)>,
11389 K: std::convert::Into<std::string::String>,
11390 V: std::convert::Into<std::string::String>,
11391 {
11392 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11393 self
11394 }
11395
11396 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11398 where
11399 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11400 {
11401 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11402 self
11403 }
11404
11405 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11407 where
11408 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11409 {
11410 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11411 self
11412 }
11413
11414 pub fn set_display_spec<T>(mut self, v: T) -> Self
11416 where
11417 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11418 {
11419 self.0.request.display_spec = std::option::Option::Some(v.into());
11420 self
11421 }
11422
11423 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11425 where
11426 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11427 {
11428 self.0.request.display_spec = v.map(|x| x.into());
11429 self
11430 }
11431
11432 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11434 self.0.request.session = v.into();
11435 self
11436 }
11437
11438 pub fn set_session_spec<T>(mut self, v: T) -> Self
11440 where
11441 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11442 {
11443 self.0.request.session_spec = std::option::Option::Some(v.into());
11444 self
11445 }
11446
11447 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11449 where
11450 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11451 {
11452 self.0.request.session_spec = v.map(|x| x.into());
11453 self
11454 }
11455
11456 pub fn set_relevance_threshold<
11458 T: Into<crate::model::search_request::RelevanceThreshold>,
11459 >(
11460 mut self,
11461 v: T,
11462 ) -> Self {
11463 self.0.request.relevance_threshold = v.into();
11464 self
11465 }
11466
11467 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11469 where
11470 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11471 {
11472 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11473 self
11474 }
11475
11476 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11478 where
11479 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11480 {
11481 self.0.request.relevance_score_spec = v.map(|x| x.into());
11482 self
11483 }
11484
11485 pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
11487 self.0.request.ranking_expression = v.into();
11488 self
11489 }
11490
11491 pub fn set_ranking_expression_backend<
11493 T: Into<crate::model::search_request::RankingExpressionBackend>,
11494 >(
11495 mut self,
11496 v: T,
11497 ) -> Self {
11498 self.0.request.ranking_expression_backend = v.into();
11499 self
11500 }
11501 }
11502
11503 #[doc(hidden)]
11504 impl gax::options::internal::RequestBuilder for Search {
11505 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11506 &mut self.0.options
11507 }
11508 }
11509
11510 #[derive(Clone, Debug)]
11531 pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11532
11533 impl SearchLite {
11534 pub(crate) fn new(
11535 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11536 ) -> Self {
11537 Self(RequestBuilder::new(stub))
11538 }
11539
11540 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11542 self.0.request = v.into();
11543 self
11544 }
11545
11546 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11548 self.0.options = v.into();
11549 self
11550 }
11551
11552 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11554 (*self.0.stub)
11555 .search_lite(self.0.request, self.0.options)
11556 .await
11557 .map(gax::response::Response::into_body)
11558 }
11559
11560 pub fn by_page(
11562 self,
11563 ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
11564 {
11565 use std::clone::Clone;
11566 let token = self.0.request.page_token.clone();
11567 let execute = move |token: String| {
11568 let mut builder = self.clone();
11569 builder.0.request = builder.0.request.set_page_token(token);
11570 builder.send()
11571 };
11572 gax::paginator::internal::new_paginator(token, execute)
11573 }
11574
11575 pub fn by_item(
11577 self,
11578 ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
11579 {
11580 use gax::paginator::Paginator;
11581 self.by_page().items()
11582 }
11583
11584 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11588 self.0.request.serving_config = v.into();
11589 self
11590 }
11591
11592 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11594 self.0.request.branch = v.into();
11595 self
11596 }
11597
11598 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11600 self.0.request.query = v.into();
11601 self
11602 }
11603
11604 pub fn set_image_query<T>(mut self, v: T) -> Self
11606 where
11607 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11608 {
11609 self.0.request.image_query = std::option::Option::Some(v.into());
11610 self
11611 }
11612
11613 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11615 where
11616 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11617 {
11618 self.0.request.image_query = v.map(|x| x.into());
11619 self
11620 }
11621
11622 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11624 self.0.request.page_size = v.into();
11625 self
11626 }
11627
11628 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11630 self.0.request.page_token = v.into();
11631 self
11632 }
11633
11634 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11636 self.0.request.offset = v.into();
11637 self
11638 }
11639
11640 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11642 self.0.request.one_box_page_size = v.into();
11643 self
11644 }
11645
11646 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11648 where
11649 T: std::iter::IntoIterator<Item = V>,
11650 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11651 {
11652 use std::iter::Iterator;
11653 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11654 self
11655 }
11656
11657 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11659 self.0.request.filter = v.into();
11660 self
11661 }
11662
11663 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11665 self.0.request.canonical_filter = v.into();
11666 self
11667 }
11668
11669 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11671 self.0.request.order_by = v.into();
11672 self
11673 }
11674
11675 pub fn set_user_info<T>(mut self, v: T) -> Self
11677 where
11678 T: std::convert::Into<crate::model::UserInfo>,
11679 {
11680 self.0.request.user_info = std::option::Option::Some(v.into());
11681 self
11682 }
11683
11684 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11686 where
11687 T: std::convert::Into<crate::model::UserInfo>,
11688 {
11689 self.0.request.user_info = v.map(|x| x.into());
11690 self
11691 }
11692
11693 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11695 self.0.request.language_code = v.into();
11696 self
11697 }
11698
11699 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11701 where
11702 T: std::iter::IntoIterator<Item = V>,
11703 V: std::convert::Into<crate::model::search_request::FacetSpec>,
11704 {
11705 use std::iter::Iterator;
11706 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11707 self
11708 }
11709
11710 pub fn set_boost_spec<T>(mut self, v: T) -> Self
11712 where
11713 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11714 {
11715 self.0.request.boost_spec = std::option::Option::Some(v.into());
11716 self
11717 }
11718
11719 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11721 where
11722 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11723 {
11724 self.0.request.boost_spec = v.map(|x| x.into());
11725 self
11726 }
11727
11728 pub fn set_params<T, K, V>(mut self, v: T) -> Self
11730 where
11731 T: std::iter::IntoIterator<Item = (K, V)>,
11732 K: std::convert::Into<std::string::String>,
11733 V: std::convert::Into<wkt::Value>,
11734 {
11735 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11736 self
11737 }
11738
11739 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11741 where
11742 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11743 {
11744 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11745 self
11746 }
11747
11748 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11750 where
11751 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11752 {
11753 self.0.request.query_expansion_spec = v.map(|x| x.into());
11754 self
11755 }
11756
11757 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11759 where
11760 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11761 {
11762 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11763 self
11764 }
11765
11766 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11768 where
11769 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11770 {
11771 self.0.request.spell_correction_spec = v.map(|x| x.into());
11772 self
11773 }
11774
11775 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11777 self.0.request.user_pseudo_id = v.into();
11778 self
11779 }
11780
11781 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11783 where
11784 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11785 {
11786 self.0.request.content_search_spec = std::option::Option::Some(v.into());
11787 self
11788 }
11789
11790 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11792 where
11793 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11794 {
11795 self.0.request.content_search_spec = v.map(|x| x.into());
11796 self
11797 }
11798
11799 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11801 self.0.request.safe_search = v.into();
11802 self
11803 }
11804
11805 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11807 where
11808 T: std::iter::IntoIterator<Item = (K, V)>,
11809 K: std::convert::Into<std::string::String>,
11810 V: std::convert::Into<std::string::String>,
11811 {
11812 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11813 self
11814 }
11815
11816 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11818 where
11819 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11820 {
11821 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11822 self
11823 }
11824
11825 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11827 where
11828 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11829 {
11830 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11831 self
11832 }
11833
11834 pub fn set_display_spec<T>(mut self, v: T) -> Self
11836 where
11837 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11838 {
11839 self.0.request.display_spec = std::option::Option::Some(v.into());
11840 self
11841 }
11842
11843 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11845 where
11846 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11847 {
11848 self.0.request.display_spec = v.map(|x| x.into());
11849 self
11850 }
11851
11852 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11854 self.0.request.session = v.into();
11855 self
11856 }
11857
11858 pub fn set_session_spec<T>(mut self, v: T) -> Self
11860 where
11861 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11862 {
11863 self.0.request.session_spec = std::option::Option::Some(v.into());
11864 self
11865 }
11866
11867 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11869 where
11870 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11871 {
11872 self.0.request.session_spec = v.map(|x| x.into());
11873 self
11874 }
11875
11876 pub fn set_relevance_threshold<
11878 T: Into<crate::model::search_request::RelevanceThreshold>,
11879 >(
11880 mut self,
11881 v: T,
11882 ) -> Self {
11883 self.0.request.relevance_threshold = v.into();
11884 self
11885 }
11886
11887 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11889 where
11890 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11891 {
11892 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11893 self
11894 }
11895
11896 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11898 where
11899 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11900 {
11901 self.0.request.relevance_score_spec = v.map(|x| x.into());
11902 self
11903 }
11904
11905 pub fn set_ranking_expression<T: Into<std::string::String>>(mut self, v: T) -> Self {
11907 self.0.request.ranking_expression = v.into();
11908 self
11909 }
11910
11911 pub fn set_ranking_expression_backend<
11913 T: Into<crate::model::search_request::RankingExpressionBackend>,
11914 >(
11915 mut self,
11916 v: T,
11917 ) -> Self {
11918 self.0.request.ranking_expression_backend = v.into();
11919 self
11920 }
11921 }
11922
11923 #[doc(hidden)]
11924 impl gax::options::internal::RequestBuilder for SearchLite {
11925 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11926 &mut self.0.options
11927 }
11928 }
11929
11930 #[derive(Clone, Debug)]
11951 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
11952
11953 impl ListOperations {
11954 pub(crate) fn new(
11955 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11956 ) -> Self {
11957 Self(RequestBuilder::new(stub))
11958 }
11959
11960 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
11962 mut self,
11963 v: V,
11964 ) -> Self {
11965 self.0.request = v.into();
11966 self
11967 }
11968
11969 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11971 self.0.options = v.into();
11972 self
11973 }
11974
11975 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
11977 (*self.0.stub)
11978 .list_operations(self.0.request, self.0.options)
11979 .await
11980 .map(gax::response::Response::into_body)
11981 }
11982
11983 pub fn by_page(
11985 self,
11986 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
11987 {
11988 use std::clone::Clone;
11989 let token = self.0.request.page_token.clone();
11990 let execute = move |token: String| {
11991 let mut builder = self.clone();
11992 builder.0.request = builder.0.request.set_page_token(token);
11993 builder.send()
11994 };
11995 gax::paginator::internal::new_paginator(token, execute)
11996 }
11997
11998 pub fn by_item(
12000 self,
12001 ) -> impl gax::paginator::ItemPaginator<
12002 longrunning::model::ListOperationsResponse,
12003 gax::error::Error,
12004 > {
12005 use gax::paginator::Paginator;
12006 self.by_page().items()
12007 }
12008
12009 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12011 self.0.request.name = v.into();
12012 self
12013 }
12014
12015 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12017 self.0.request.filter = v.into();
12018 self
12019 }
12020
12021 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12023 self.0.request.page_size = v.into();
12024 self
12025 }
12026
12027 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12029 self.0.request.page_token = v.into();
12030 self
12031 }
12032
12033 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12035 self.0.request.return_partial_success = v.into();
12036 self
12037 }
12038 }
12039
12040 #[doc(hidden)]
12041 impl gax::options::internal::RequestBuilder for ListOperations {
12042 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12043 &mut self.0.options
12044 }
12045 }
12046
12047 #[derive(Clone, Debug)]
12064 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12065
12066 impl GetOperation {
12067 pub(crate) fn new(
12068 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12069 ) -> Self {
12070 Self(RequestBuilder::new(stub))
12071 }
12072
12073 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12075 mut self,
12076 v: V,
12077 ) -> Self {
12078 self.0.request = v.into();
12079 self
12080 }
12081
12082 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12084 self.0.options = v.into();
12085 self
12086 }
12087
12088 pub async fn send(self) -> Result<longrunning::model::Operation> {
12090 (*self.0.stub)
12091 .get_operation(self.0.request, self.0.options)
12092 .await
12093 .map(gax::response::Response::into_body)
12094 }
12095
12096 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12098 self.0.request.name = v.into();
12099 self
12100 }
12101 }
12102
12103 #[doc(hidden)]
12104 impl gax::options::internal::RequestBuilder for GetOperation {
12105 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12106 &mut self.0.options
12107 }
12108 }
12109
12110 #[derive(Clone, Debug)]
12127 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12128
12129 impl CancelOperation {
12130 pub(crate) fn new(
12131 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12132 ) -> Self {
12133 Self(RequestBuilder::new(stub))
12134 }
12135
12136 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12138 mut self,
12139 v: V,
12140 ) -> Self {
12141 self.0.request = v.into();
12142 self
12143 }
12144
12145 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12147 self.0.options = v.into();
12148 self
12149 }
12150
12151 pub async fn send(self) -> Result<()> {
12153 (*self.0.stub)
12154 .cancel_operation(self.0.request, self.0.options)
12155 .await
12156 .map(gax::response::Response::into_body)
12157 }
12158
12159 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12161 self.0.request.name = v.into();
12162 self
12163 }
12164 }
12165
12166 #[doc(hidden)]
12167 impl gax::options::internal::RequestBuilder for CancelOperation {
12168 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12169 &mut self.0.options
12170 }
12171 }
12172}
12173
12174#[cfg(feature = "search-tuning-service")]
12175#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12176pub mod search_tuning_service {
12177 use crate::Result;
12178
12179 pub type ClientBuilder =
12193 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12194
12195 pub(crate) mod client {
12196 use super::super::super::client::SearchTuningService;
12197 pub struct Factory;
12198 impl gax::client_builder::internal::ClientFactory for Factory {
12199 type Client = SearchTuningService;
12200 type Credentials = gaxi::options::Credentials;
12201 async fn build(
12202 self,
12203 config: gaxi::options::ClientConfig,
12204 ) -> gax::client_builder::Result<Self::Client> {
12205 Self::Client::new(config).await
12206 }
12207 }
12208 }
12209
12210 #[derive(Clone, Debug)]
12212 pub(crate) struct RequestBuilder<R: std::default::Default> {
12213 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12214 request: R,
12215 options: gax::options::RequestOptions,
12216 }
12217
12218 impl<R> RequestBuilder<R>
12219 where
12220 R: std::default::Default,
12221 {
12222 pub(crate) fn new(
12223 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12224 ) -> Self {
12225 Self {
12226 stub,
12227 request: R::default(),
12228 options: gax::options::RequestOptions::default(),
12229 }
12230 }
12231 }
12232
12233 #[derive(Clone, Debug)]
12251 pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12252
12253 impl TrainCustomModel {
12254 pub(crate) fn new(
12255 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12256 ) -> Self {
12257 Self(RequestBuilder::new(stub))
12258 }
12259
12260 pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12262 mut self,
12263 v: V,
12264 ) -> Self {
12265 self.0.request = v.into();
12266 self
12267 }
12268
12269 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12271 self.0.options = v.into();
12272 self
12273 }
12274
12275 pub async fn send(self) -> Result<longrunning::model::Operation> {
12282 (*self.0.stub)
12283 .train_custom_model(self.0.request, self.0.options)
12284 .await
12285 .map(gax::response::Response::into_body)
12286 }
12287
12288 pub fn poller(
12290 self,
12291 ) -> impl lro::Poller<
12292 crate::model::TrainCustomModelResponse,
12293 crate::model::TrainCustomModelMetadata,
12294 > {
12295 type Operation = lro::internal::Operation<
12296 crate::model::TrainCustomModelResponse,
12297 crate::model::TrainCustomModelMetadata,
12298 >;
12299 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12300 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12301
12302 let stub = self.0.stub.clone();
12303 let mut options = self.0.options.clone();
12304 options.set_retry_policy(gax::retry_policy::NeverRetry);
12305 let query = move |name| {
12306 let stub = stub.clone();
12307 let options = options.clone();
12308 async {
12309 let op = GetOperation::new(stub)
12310 .set_name(name)
12311 .with_options(options)
12312 .send()
12313 .await?;
12314 Ok(Operation::new(op))
12315 }
12316 };
12317
12318 let start = move || async {
12319 let op = self.send().await?;
12320 Ok(Operation::new(op))
12321 };
12322
12323 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
12324 }
12325
12326 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12330 self.0.request.data_store = v.into();
12331 self
12332 }
12333
12334 pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12336 self.0.request.model_type = v.into();
12337 self
12338 }
12339
12340 pub fn set_error_config<T>(mut self, v: T) -> Self
12342 where
12343 T: std::convert::Into<crate::model::ImportErrorConfig>,
12344 {
12345 self.0.request.error_config = std::option::Option::Some(v.into());
12346 self
12347 }
12348
12349 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12351 where
12352 T: std::convert::Into<crate::model::ImportErrorConfig>,
12353 {
12354 self.0.request.error_config = v.map(|x| x.into());
12355 self
12356 }
12357
12358 pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12360 self.0.request.model_id = v.into();
12361 self
12362 }
12363
12364 pub fn set_training_input<
12369 T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12370 >(
12371 mut self,
12372 v: T,
12373 ) -> Self {
12374 self.0.request.training_input = v.into();
12375 self
12376 }
12377
12378 pub fn set_gcs_training_input<
12384 T: std::convert::Into<
12385 std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12386 >,
12387 >(
12388 mut self,
12389 v: T,
12390 ) -> Self {
12391 self.0.request = self.0.request.set_gcs_training_input(v);
12392 self
12393 }
12394 }
12395
12396 #[doc(hidden)]
12397 impl gax::options::internal::RequestBuilder for TrainCustomModel {
12398 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12399 &mut self.0.options
12400 }
12401 }
12402
12403 #[derive(Clone, Debug)]
12420 pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12421
12422 impl ListCustomModels {
12423 pub(crate) fn new(
12424 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12425 ) -> Self {
12426 Self(RequestBuilder::new(stub))
12427 }
12428
12429 pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12431 mut self,
12432 v: V,
12433 ) -> Self {
12434 self.0.request = v.into();
12435 self
12436 }
12437
12438 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12440 self.0.options = v.into();
12441 self
12442 }
12443
12444 pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12446 (*self.0.stub)
12447 .list_custom_models(self.0.request, self.0.options)
12448 .await
12449 .map(gax::response::Response::into_body)
12450 }
12451
12452 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12456 self.0.request.data_store = v.into();
12457 self
12458 }
12459 }
12460
12461 #[doc(hidden)]
12462 impl gax::options::internal::RequestBuilder for ListCustomModels {
12463 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12464 &mut self.0.options
12465 }
12466 }
12467
12468 #[derive(Clone, Debug)]
12489 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12490
12491 impl ListOperations {
12492 pub(crate) fn new(
12493 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12494 ) -> Self {
12495 Self(RequestBuilder::new(stub))
12496 }
12497
12498 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12500 mut self,
12501 v: V,
12502 ) -> Self {
12503 self.0.request = v.into();
12504 self
12505 }
12506
12507 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12509 self.0.options = v.into();
12510 self
12511 }
12512
12513 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12515 (*self.0.stub)
12516 .list_operations(self.0.request, self.0.options)
12517 .await
12518 .map(gax::response::Response::into_body)
12519 }
12520
12521 pub fn by_page(
12523 self,
12524 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12525 {
12526 use std::clone::Clone;
12527 let token = self.0.request.page_token.clone();
12528 let execute = move |token: String| {
12529 let mut builder = self.clone();
12530 builder.0.request = builder.0.request.set_page_token(token);
12531 builder.send()
12532 };
12533 gax::paginator::internal::new_paginator(token, execute)
12534 }
12535
12536 pub fn by_item(
12538 self,
12539 ) -> impl gax::paginator::ItemPaginator<
12540 longrunning::model::ListOperationsResponse,
12541 gax::error::Error,
12542 > {
12543 use gax::paginator::Paginator;
12544 self.by_page().items()
12545 }
12546
12547 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12549 self.0.request.name = v.into();
12550 self
12551 }
12552
12553 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12555 self.0.request.filter = v.into();
12556 self
12557 }
12558
12559 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12561 self.0.request.page_size = v.into();
12562 self
12563 }
12564
12565 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12567 self.0.request.page_token = v.into();
12568 self
12569 }
12570
12571 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12573 self.0.request.return_partial_success = v.into();
12574 self
12575 }
12576 }
12577
12578 #[doc(hidden)]
12579 impl gax::options::internal::RequestBuilder for ListOperations {
12580 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12581 &mut self.0.options
12582 }
12583 }
12584
12585 #[derive(Clone, Debug)]
12602 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12603
12604 impl GetOperation {
12605 pub(crate) fn new(
12606 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12607 ) -> Self {
12608 Self(RequestBuilder::new(stub))
12609 }
12610
12611 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12613 mut self,
12614 v: V,
12615 ) -> Self {
12616 self.0.request = v.into();
12617 self
12618 }
12619
12620 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12622 self.0.options = v.into();
12623 self
12624 }
12625
12626 pub async fn send(self) -> Result<longrunning::model::Operation> {
12628 (*self.0.stub)
12629 .get_operation(self.0.request, self.0.options)
12630 .await
12631 .map(gax::response::Response::into_body)
12632 }
12633
12634 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12636 self.0.request.name = v.into();
12637 self
12638 }
12639 }
12640
12641 #[doc(hidden)]
12642 impl gax::options::internal::RequestBuilder for GetOperation {
12643 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12644 &mut self.0.options
12645 }
12646 }
12647
12648 #[derive(Clone, Debug)]
12665 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12666
12667 impl CancelOperation {
12668 pub(crate) fn new(
12669 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12670 ) -> Self {
12671 Self(RequestBuilder::new(stub))
12672 }
12673
12674 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12676 mut self,
12677 v: V,
12678 ) -> Self {
12679 self.0.request = v.into();
12680 self
12681 }
12682
12683 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12685 self.0.options = v.into();
12686 self
12687 }
12688
12689 pub async fn send(self) -> Result<()> {
12691 (*self.0.stub)
12692 .cancel_operation(self.0.request, self.0.options)
12693 .await
12694 .map(gax::response::Response::into_body)
12695 }
12696
12697 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12699 self.0.request.name = v.into();
12700 self
12701 }
12702 }
12703
12704 #[doc(hidden)]
12705 impl gax::options::internal::RequestBuilder for CancelOperation {
12706 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12707 &mut self.0.options
12708 }
12709 }
12710}
12711
12712#[cfg(feature = "serving-config-service")]
12713#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
12714pub mod serving_config_service {
12715 use crate::Result;
12716
12717 pub type ClientBuilder =
12731 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12732
12733 pub(crate) mod client {
12734 use super::super::super::client::ServingConfigService;
12735 pub struct Factory;
12736 impl gax::client_builder::internal::ClientFactory for Factory {
12737 type Client = ServingConfigService;
12738 type Credentials = gaxi::options::Credentials;
12739 async fn build(
12740 self,
12741 config: gaxi::options::ClientConfig,
12742 ) -> gax::client_builder::Result<Self::Client> {
12743 Self::Client::new(config).await
12744 }
12745 }
12746 }
12747
12748 #[derive(Clone, Debug)]
12750 pub(crate) struct RequestBuilder<R: std::default::Default> {
12751 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12752 request: R,
12753 options: gax::options::RequestOptions,
12754 }
12755
12756 impl<R> RequestBuilder<R>
12757 where
12758 R: std::default::Default,
12759 {
12760 pub(crate) fn new(
12761 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12762 ) -> Self {
12763 Self {
12764 stub,
12765 request: R::default(),
12766 options: gax::options::RequestOptions::default(),
12767 }
12768 }
12769 }
12770
12771 #[derive(Clone, Debug)]
12788 pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
12789
12790 impl UpdateServingConfig {
12791 pub(crate) fn new(
12792 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12793 ) -> Self {
12794 Self(RequestBuilder::new(stub))
12795 }
12796
12797 pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
12799 mut self,
12800 v: V,
12801 ) -> Self {
12802 self.0.request = v.into();
12803 self
12804 }
12805
12806 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12808 self.0.options = v.into();
12809 self
12810 }
12811
12812 pub async fn send(self) -> Result<crate::model::ServingConfig> {
12814 (*self.0.stub)
12815 .update_serving_config(self.0.request, self.0.options)
12816 .await
12817 .map(gax::response::Response::into_body)
12818 }
12819
12820 pub fn set_serving_config<T>(mut self, v: T) -> Self
12824 where
12825 T: std::convert::Into<crate::model::ServingConfig>,
12826 {
12827 self.0.request.serving_config = std::option::Option::Some(v.into());
12828 self
12829 }
12830
12831 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
12835 where
12836 T: std::convert::Into<crate::model::ServingConfig>,
12837 {
12838 self.0.request.serving_config = v.map(|x| x.into());
12839 self
12840 }
12841
12842 pub fn set_update_mask<T>(mut self, v: T) -> Self
12844 where
12845 T: std::convert::Into<wkt::FieldMask>,
12846 {
12847 self.0.request.update_mask = std::option::Option::Some(v.into());
12848 self
12849 }
12850
12851 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12853 where
12854 T: std::convert::Into<wkt::FieldMask>,
12855 {
12856 self.0.request.update_mask = v.map(|x| x.into());
12857 self
12858 }
12859 }
12860
12861 #[doc(hidden)]
12862 impl gax::options::internal::RequestBuilder for UpdateServingConfig {
12863 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12864 &mut self.0.options
12865 }
12866 }
12867
12868 #[derive(Clone, Debug)]
12889 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12890
12891 impl ListOperations {
12892 pub(crate) fn new(
12893 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12894 ) -> Self {
12895 Self(RequestBuilder::new(stub))
12896 }
12897
12898 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12900 mut self,
12901 v: V,
12902 ) -> Self {
12903 self.0.request = v.into();
12904 self
12905 }
12906
12907 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12909 self.0.options = v.into();
12910 self
12911 }
12912
12913 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12915 (*self.0.stub)
12916 .list_operations(self.0.request, self.0.options)
12917 .await
12918 .map(gax::response::Response::into_body)
12919 }
12920
12921 pub fn by_page(
12923 self,
12924 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12925 {
12926 use std::clone::Clone;
12927 let token = self.0.request.page_token.clone();
12928 let execute = move |token: String| {
12929 let mut builder = self.clone();
12930 builder.0.request = builder.0.request.set_page_token(token);
12931 builder.send()
12932 };
12933 gax::paginator::internal::new_paginator(token, execute)
12934 }
12935
12936 pub fn by_item(
12938 self,
12939 ) -> impl gax::paginator::ItemPaginator<
12940 longrunning::model::ListOperationsResponse,
12941 gax::error::Error,
12942 > {
12943 use gax::paginator::Paginator;
12944 self.by_page().items()
12945 }
12946
12947 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12949 self.0.request.name = v.into();
12950 self
12951 }
12952
12953 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12955 self.0.request.filter = v.into();
12956 self
12957 }
12958
12959 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12961 self.0.request.page_size = v.into();
12962 self
12963 }
12964
12965 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12967 self.0.request.page_token = v.into();
12968 self
12969 }
12970
12971 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12973 self.0.request.return_partial_success = v.into();
12974 self
12975 }
12976 }
12977
12978 #[doc(hidden)]
12979 impl gax::options::internal::RequestBuilder for ListOperations {
12980 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12981 &mut self.0.options
12982 }
12983 }
12984
12985 #[derive(Clone, Debug)]
13002 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
13003
13004 impl GetOperation {
13005 pub(crate) fn new(
13006 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13007 ) -> Self {
13008 Self(RequestBuilder::new(stub))
13009 }
13010
13011 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
13013 mut self,
13014 v: V,
13015 ) -> Self {
13016 self.0.request = v.into();
13017 self
13018 }
13019
13020 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13022 self.0.options = v.into();
13023 self
13024 }
13025
13026 pub async fn send(self) -> Result<longrunning::model::Operation> {
13028 (*self.0.stub)
13029 .get_operation(self.0.request, self.0.options)
13030 .await
13031 .map(gax::response::Response::into_body)
13032 }
13033
13034 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13036 self.0.request.name = v.into();
13037 self
13038 }
13039 }
13040
13041 #[doc(hidden)]
13042 impl gax::options::internal::RequestBuilder for GetOperation {
13043 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13044 &mut self.0.options
13045 }
13046 }
13047
13048 #[derive(Clone, Debug)]
13065 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13066
13067 impl CancelOperation {
13068 pub(crate) fn new(
13069 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13070 ) -> Self {
13071 Self(RequestBuilder::new(stub))
13072 }
13073
13074 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13076 mut self,
13077 v: V,
13078 ) -> Self {
13079 self.0.request = v.into();
13080 self
13081 }
13082
13083 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13085 self.0.options = v.into();
13086 self
13087 }
13088
13089 pub async fn send(self) -> Result<()> {
13091 (*self.0.stub)
13092 .cancel_operation(self.0.request, self.0.options)
13093 .await
13094 .map(gax::response::Response::into_body)
13095 }
13096
13097 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13099 self.0.request.name = v.into();
13100 self
13101 }
13102 }
13103
13104 #[doc(hidden)]
13105 impl gax::options::internal::RequestBuilder for CancelOperation {
13106 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13107 &mut self.0.options
13108 }
13109 }
13110}
13111
13112#[cfg(feature = "session-service")]
13113#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13114pub mod session_service {
13115 use crate::Result;
13116
13117 pub type ClientBuilder =
13131 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13132
13133 pub(crate) mod client {
13134 use super::super::super::client::SessionService;
13135 pub struct Factory;
13136 impl gax::client_builder::internal::ClientFactory for Factory {
13137 type Client = SessionService;
13138 type Credentials = gaxi::options::Credentials;
13139 async fn build(
13140 self,
13141 config: gaxi::options::ClientConfig,
13142 ) -> gax::client_builder::Result<Self::Client> {
13143 Self::Client::new(config).await
13144 }
13145 }
13146 }
13147
13148 #[derive(Clone, Debug)]
13150 pub(crate) struct RequestBuilder<R: std::default::Default> {
13151 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13152 request: R,
13153 options: gax::options::RequestOptions,
13154 }
13155
13156 impl<R> RequestBuilder<R>
13157 where
13158 R: std::default::Default,
13159 {
13160 pub(crate) fn new(
13161 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13162 ) -> Self {
13163 Self {
13164 stub,
13165 request: R::default(),
13166 options: gax::options::RequestOptions::default(),
13167 }
13168 }
13169 }
13170
13171 #[derive(Clone, Debug)]
13188 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13189
13190 impl CreateSession {
13191 pub(crate) fn new(
13192 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13193 ) -> Self {
13194 Self(RequestBuilder::new(stub))
13195 }
13196
13197 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13199 self.0.request = v.into();
13200 self
13201 }
13202
13203 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13205 self.0.options = v.into();
13206 self
13207 }
13208
13209 pub async fn send(self) -> Result<crate::model::Session> {
13211 (*self.0.stub)
13212 .create_session(self.0.request, self.0.options)
13213 .await
13214 .map(gax::response::Response::into_body)
13215 }
13216
13217 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13221 self.0.request.parent = v.into();
13222 self
13223 }
13224
13225 pub fn set_session<T>(mut self, v: T) -> Self
13229 where
13230 T: std::convert::Into<crate::model::Session>,
13231 {
13232 self.0.request.session = std::option::Option::Some(v.into());
13233 self
13234 }
13235
13236 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13240 where
13241 T: std::convert::Into<crate::model::Session>,
13242 {
13243 self.0.request.session = v.map(|x| x.into());
13244 self
13245 }
13246 }
13247
13248 #[doc(hidden)]
13249 impl gax::options::internal::RequestBuilder for CreateSession {
13250 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13251 &mut self.0.options
13252 }
13253 }
13254
13255 #[derive(Clone, Debug)]
13272 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13273
13274 impl DeleteSession {
13275 pub(crate) fn new(
13276 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13277 ) -> Self {
13278 Self(RequestBuilder::new(stub))
13279 }
13280
13281 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13283 self.0.request = v.into();
13284 self
13285 }
13286
13287 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13289 self.0.options = v.into();
13290 self
13291 }
13292
13293 pub async fn send(self) -> Result<()> {
13295 (*self.0.stub)
13296 .delete_session(self.0.request, self.0.options)
13297 .await
13298 .map(gax::response::Response::into_body)
13299 }
13300
13301 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13305 self.0.request.name = v.into();
13306 self
13307 }
13308 }
13309
13310 #[doc(hidden)]
13311 impl gax::options::internal::RequestBuilder for DeleteSession {
13312 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13313 &mut self.0.options
13314 }
13315 }
13316
13317 #[derive(Clone, Debug)]
13334 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13335
13336 impl UpdateSession {
13337 pub(crate) fn new(
13338 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13339 ) -> Self {
13340 Self(RequestBuilder::new(stub))
13341 }
13342
13343 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13345 self.0.request = v.into();
13346 self
13347 }
13348
13349 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13351 self.0.options = v.into();
13352 self
13353 }
13354
13355 pub async fn send(self) -> Result<crate::model::Session> {
13357 (*self.0.stub)
13358 .update_session(self.0.request, self.0.options)
13359 .await
13360 .map(gax::response::Response::into_body)
13361 }
13362
13363 pub fn set_session<T>(mut self, v: T) -> Self
13367 where
13368 T: std::convert::Into<crate::model::Session>,
13369 {
13370 self.0.request.session = std::option::Option::Some(v.into());
13371 self
13372 }
13373
13374 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13378 where
13379 T: std::convert::Into<crate::model::Session>,
13380 {
13381 self.0.request.session = v.map(|x| x.into());
13382 self
13383 }
13384
13385 pub fn set_update_mask<T>(mut self, v: T) -> Self
13387 where
13388 T: std::convert::Into<wkt::FieldMask>,
13389 {
13390 self.0.request.update_mask = std::option::Option::Some(v.into());
13391 self
13392 }
13393
13394 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13396 where
13397 T: std::convert::Into<wkt::FieldMask>,
13398 {
13399 self.0.request.update_mask = v.map(|x| x.into());
13400 self
13401 }
13402 }
13403
13404 #[doc(hidden)]
13405 impl gax::options::internal::RequestBuilder for UpdateSession {
13406 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13407 &mut self.0.options
13408 }
13409 }
13410
13411 #[derive(Clone, Debug)]
13428 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13429
13430 impl GetSession {
13431 pub(crate) fn new(
13432 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13433 ) -> Self {
13434 Self(RequestBuilder::new(stub))
13435 }
13436
13437 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13439 self.0.request = v.into();
13440 self
13441 }
13442
13443 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13445 self.0.options = v.into();
13446 self
13447 }
13448
13449 pub async fn send(self) -> Result<crate::model::Session> {
13451 (*self.0.stub)
13452 .get_session(self.0.request, self.0.options)
13453 .await
13454 .map(gax::response::Response::into_body)
13455 }
13456
13457 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13461 self.0.request.name = v.into();
13462 self
13463 }
13464
13465 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13467 self.0.request.include_answer_details = v.into();
13468 self
13469 }
13470 }
13471
13472 #[doc(hidden)]
13473 impl gax::options::internal::RequestBuilder for GetSession {
13474 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13475 &mut self.0.options
13476 }
13477 }
13478
13479 #[derive(Clone, Debug)]
13500 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
13501
13502 impl ListSessions {
13503 pub(crate) fn new(
13504 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13505 ) -> Self {
13506 Self(RequestBuilder::new(stub))
13507 }
13508
13509 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
13511 self.0.request = v.into();
13512 self
13513 }
13514
13515 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13517 self.0.options = v.into();
13518 self
13519 }
13520
13521 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
13523 (*self.0.stub)
13524 .list_sessions(self.0.request, self.0.options)
13525 .await
13526 .map(gax::response::Response::into_body)
13527 }
13528
13529 pub fn by_page(
13531 self,
13532 ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
13533 {
13534 use std::clone::Clone;
13535 let token = self.0.request.page_token.clone();
13536 let execute = move |token: String| {
13537 let mut builder = self.clone();
13538 builder.0.request = builder.0.request.set_page_token(token);
13539 builder.send()
13540 };
13541 gax::paginator::internal::new_paginator(token, execute)
13542 }
13543
13544 pub fn by_item(
13546 self,
13547 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
13548 {
13549 use gax::paginator::Paginator;
13550 self.by_page().items()
13551 }
13552
13553 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13557 self.0.request.parent = v.into();
13558 self
13559 }
13560
13561 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13563 self.0.request.page_size = v.into();
13564 self
13565 }
13566
13567 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13569 self.0.request.page_token = v.into();
13570 self
13571 }
13572
13573 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13575 self.0.request.filter = v.into();
13576 self
13577 }
13578
13579 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
13581 self.0.request.order_by = v.into();
13582 self
13583 }
13584 }
13585
13586 #[doc(hidden)]
13587 impl gax::options::internal::RequestBuilder for ListSessions {
13588 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13589 &mut self.0.options
13590 }
13591 }
13592
13593 #[derive(Clone, Debug)]
13614 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
13615
13616 impl ListOperations {
13617 pub(crate) fn new(
13618 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13619 ) -> Self {
13620 Self(RequestBuilder::new(stub))
13621 }
13622
13623 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
13625 mut self,
13626 v: V,
13627 ) -> Self {
13628 self.0.request = v.into();
13629 self
13630 }
13631
13632 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13634 self.0.options = v.into();
13635 self
13636 }
13637
13638 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
13640 (*self.0.stub)
13641 .list_operations(self.0.request, self.0.options)
13642 .await
13643 .map(gax::response::Response::into_body)
13644 }
13645
13646 pub fn by_page(
13648 self,
13649 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
13650 {
13651 use std::clone::Clone;
13652 let token = self.0.request.page_token.clone();
13653 let execute = move |token: String| {
13654 let mut builder = self.clone();
13655 builder.0.request = builder.0.request.set_page_token(token);
13656 builder.send()
13657 };
13658 gax::paginator::internal::new_paginator(token, execute)
13659 }
13660
13661 pub fn by_item(
13663 self,
13664 ) -> impl gax::paginator::ItemPaginator<
13665 longrunning::model::ListOperationsResponse,
13666 gax::error::Error,
13667 > {
13668 use gax::paginator::Paginator;
13669 self.by_page().items()
13670 }
13671
13672 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13674 self.0.request.name = v.into();
13675 self
13676 }
13677
13678 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13680 self.0.request.filter = 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_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13698 self.0.request.return_partial_success = v.into();
13699 self
13700 }
13701 }
13702
13703 #[doc(hidden)]
13704 impl gax::options::internal::RequestBuilder for ListOperations {
13705 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13706 &mut self.0.options
13707 }
13708 }
13709
13710 #[derive(Clone, Debug)]
13727 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
13728
13729 impl GetOperation {
13730 pub(crate) fn new(
13731 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13732 ) -> Self {
13733 Self(RequestBuilder::new(stub))
13734 }
13735
13736 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
13738 mut self,
13739 v: V,
13740 ) -> Self {
13741 self.0.request = v.into();
13742 self
13743 }
13744
13745 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13747 self.0.options = v.into();
13748 self
13749 }
13750
13751 pub async fn send(self) -> Result<longrunning::model::Operation> {
13753 (*self.0.stub)
13754 .get_operation(self.0.request, self.0.options)
13755 .await
13756 .map(gax::response::Response::into_body)
13757 }
13758
13759 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13761 self.0.request.name = v.into();
13762 self
13763 }
13764 }
13765
13766 #[doc(hidden)]
13767 impl gax::options::internal::RequestBuilder for GetOperation {
13768 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13769 &mut self.0.options
13770 }
13771 }
13772
13773 #[derive(Clone, Debug)]
13790 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13791
13792 impl CancelOperation {
13793 pub(crate) fn new(
13794 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13795 ) -> Self {
13796 Self(RequestBuilder::new(stub))
13797 }
13798
13799 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13801 mut self,
13802 v: V,
13803 ) -> Self {
13804 self.0.request = v.into();
13805 self
13806 }
13807
13808 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13810 self.0.options = v.into();
13811 self
13812 }
13813
13814 pub async fn send(self) -> Result<()> {
13816 (*self.0.stub)
13817 .cancel_operation(self.0.request, self.0.options)
13818 .await
13819 .map(gax::response::Response::into_body)
13820 }
13821
13822 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13824 self.0.request.name = v.into();
13825 self
13826 }
13827 }
13828
13829 #[doc(hidden)]
13830 impl gax::options::internal::RequestBuilder for CancelOperation {
13831 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13832 &mut self.0.options
13833 }
13834 }
13835}
13836
13837#[cfg(feature = "site-search-engine-service")]
13838#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
13839pub mod site_search_engine_service {
13840 use crate::Result;
13841
13842 pub type ClientBuilder =
13856 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13857
13858 pub(crate) mod client {
13859 use super::super::super::client::SiteSearchEngineService;
13860 pub struct Factory;
13861 impl gax::client_builder::internal::ClientFactory for Factory {
13862 type Client = SiteSearchEngineService;
13863 type Credentials = gaxi::options::Credentials;
13864 async fn build(
13865 self,
13866 config: gaxi::options::ClientConfig,
13867 ) -> gax::client_builder::Result<Self::Client> {
13868 Self::Client::new(config).await
13869 }
13870 }
13871 }
13872
13873 #[derive(Clone, Debug)]
13875 pub(crate) struct RequestBuilder<R: std::default::Default> {
13876 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13877 request: R,
13878 options: gax::options::RequestOptions,
13879 }
13880
13881 impl<R> RequestBuilder<R>
13882 where
13883 R: std::default::Default,
13884 {
13885 pub(crate) fn new(
13886 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13887 ) -> Self {
13888 Self {
13889 stub,
13890 request: R::default(),
13891 options: gax::options::RequestOptions::default(),
13892 }
13893 }
13894 }
13895
13896 #[derive(Clone, Debug)]
13913 pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
13914
13915 impl GetSiteSearchEngine {
13916 pub(crate) fn new(
13917 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13918 ) -> Self {
13919 Self(RequestBuilder::new(stub))
13920 }
13921
13922 pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
13924 mut self,
13925 v: V,
13926 ) -> Self {
13927 self.0.request = v.into();
13928 self
13929 }
13930
13931 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13933 self.0.options = v.into();
13934 self
13935 }
13936
13937 pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
13939 (*self.0.stub)
13940 .get_site_search_engine(self.0.request, self.0.options)
13941 .await
13942 .map(gax::response::Response::into_body)
13943 }
13944
13945 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13949 self.0.request.name = v.into();
13950 self
13951 }
13952 }
13953
13954 #[doc(hidden)]
13955 impl gax::options::internal::RequestBuilder for GetSiteSearchEngine {
13956 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13957 &mut self.0.options
13958 }
13959 }
13960
13961 #[derive(Clone, Debug)]
13979 pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
13980
13981 impl CreateTargetSite {
13982 pub(crate) fn new(
13983 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13984 ) -> Self {
13985 Self(RequestBuilder::new(stub))
13986 }
13987
13988 pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
13990 mut self,
13991 v: V,
13992 ) -> Self {
13993 self.0.request = v.into();
13994 self
13995 }
13996
13997 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13999 self.0.options = v.into();
14000 self
14001 }
14002
14003 pub async fn send(self) -> Result<longrunning::model::Operation> {
14010 (*self.0.stub)
14011 .create_target_site(self.0.request, self.0.options)
14012 .await
14013 .map(gax::response::Response::into_body)
14014 }
14015
14016 pub fn poller(
14018 self,
14019 ) -> impl lro::Poller<crate::model::TargetSite, crate::model::CreateTargetSiteMetadata>
14020 {
14021 type Operation = lro::internal::Operation<
14022 crate::model::TargetSite,
14023 crate::model::CreateTargetSiteMetadata,
14024 >;
14025 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14026 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14027
14028 let stub = self.0.stub.clone();
14029 let mut options = self.0.options.clone();
14030 options.set_retry_policy(gax::retry_policy::NeverRetry);
14031 let query = move |name| {
14032 let stub = stub.clone();
14033 let options = options.clone();
14034 async {
14035 let op = GetOperation::new(stub)
14036 .set_name(name)
14037 .with_options(options)
14038 .send()
14039 .await?;
14040 Ok(Operation::new(op))
14041 }
14042 };
14043
14044 let start = move || async {
14045 let op = self.send().await?;
14046 Ok(Operation::new(op))
14047 };
14048
14049 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14050 }
14051
14052 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14056 self.0.request.parent = v.into();
14057 self
14058 }
14059
14060 pub fn set_target_site<T>(mut self, v: T) -> Self
14064 where
14065 T: std::convert::Into<crate::model::TargetSite>,
14066 {
14067 self.0.request.target_site = std::option::Option::Some(v.into());
14068 self
14069 }
14070
14071 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14075 where
14076 T: std::convert::Into<crate::model::TargetSite>,
14077 {
14078 self.0.request.target_site = v.map(|x| x.into());
14079 self
14080 }
14081 }
14082
14083 #[doc(hidden)]
14084 impl gax::options::internal::RequestBuilder for CreateTargetSite {
14085 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14086 &mut self.0.options
14087 }
14088 }
14089
14090 #[derive(Clone, Debug)]
14108 pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14109
14110 impl BatchCreateTargetSites {
14111 pub(crate) fn new(
14112 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14113 ) -> Self {
14114 Self(RequestBuilder::new(stub))
14115 }
14116
14117 pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14119 mut self,
14120 v: V,
14121 ) -> Self {
14122 self.0.request = v.into();
14123 self
14124 }
14125
14126 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14128 self.0.options = v.into();
14129 self
14130 }
14131
14132 pub async fn send(self) -> Result<longrunning::model::Operation> {
14139 (*self.0.stub)
14140 .batch_create_target_sites(self.0.request, self.0.options)
14141 .await
14142 .map(gax::response::Response::into_body)
14143 }
14144
14145 pub fn poller(
14147 self,
14148 ) -> impl lro::Poller<
14149 crate::model::BatchCreateTargetSitesResponse,
14150 crate::model::BatchCreateTargetSiteMetadata,
14151 > {
14152 type Operation = lro::internal::Operation<
14153 crate::model::BatchCreateTargetSitesResponse,
14154 crate::model::BatchCreateTargetSiteMetadata,
14155 >;
14156 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14157 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14158
14159 let stub = self.0.stub.clone();
14160 let mut options = self.0.options.clone();
14161 options.set_retry_policy(gax::retry_policy::NeverRetry);
14162 let query = move |name| {
14163 let stub = stub.clone();
14164 let options = options.clone();
14165 async {
14166 let op = GetOperation::new(stub)
14167 .set_name(name)
14168 .with_options(options)
14169 .send()
14170 .await?;
14171 Ok(Operation::new(op))
14172 }
14173 };
14174
14175 let start = move || async {
14176 let op = self.send().await?;
14177 Ok(Operation::new(op))
14178 };
14179
14180 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14181 }
14182
14183 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14187 self.0.request.parent = v.into();
14188 self
14189 }
14190
14191 pub fn set_requests<T, V>(mut self, v: T) -> Self
14195 where
14196 T: std::iter::IntoIterator<Item = V>,
14197 V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14198 {
14199 use std::iter::Iterator;
14200 self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14201 self
14202 }
14203 }
14204
14205 #[doc(hidden)]
14206 impl gax::options::internal::RequestBuilder for BatchCreateTargetSites {
14207 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14208 &mut self.0.options
14209 }
14210 }
14211
14212 #[derive(Clone, Debug)]
14229 pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14230
14231 impl GetTargetSite {
14232 pub(crate) fn new(
14233 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14234 ) -> Self {
14235 Self(RequestBuilder::new(stub))
14236 }
14237
14238 pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14240 self.0.request = v.into();
14241 self
14242 }
14243
14244 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14246 self.0.options = v.into();
14247 self
14248 }
14249
14250 pub async fn send(self) -> Result<crate::model::TargetSite> {
14252 (*self.0.stub)
14253 .get_target_site(self.0.request, self.0.options)
14254 .await
14255 .map(gax::response::Response::into_body)
14256 }
14257
14258 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14262 self.0.request.name = v.into();
14263 self
14264 }
14265 }
14266
14267 #[doc(hidden)]
14268 impl gax::options::internal::RequestBuilder for GetTargetSite {
14269 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14270 &mut self.0.options
14271 }
14272 }
14273
14274 #[derive(Clone, Debug)]
14292 pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14293
14294 impl UpdateTargetSite {
14295 pub(crate) fn new(
14296 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14297 ) -> Self {
14298 Self(RequestBuilder::new(stub))
14299 }
14300
14301 pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14303 mut self,
14304 v: V,
14305 ) -> Self {
14306 self.0.request = v.into();
14307 self
14308 }
14309
14310 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14312 self.0.options = v.into();
14313 self
14314 }
14315
14316 pub async fn send(self) -> Result<longrunning::model::Operation> {
14323 (*self.0.stub)
14324 .update_target_site(self.0.request, self.0.options)
14325 .await
14326 .map(gax::response::Response::into_body)
14327 }
14328
14329 pub fn poller(
14331 self,
14332 ) -> impl lro::Poller<crate::model::TargetSite, crate::model::UpdateTargetSiteMetadata>
14333 {
14334 type Operation = lro::internal::Operation<
14335 crate::model::TargetSite,
14336 crate::model::UpdateTargetSiteMetadata,
14337 >;
14338 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14339 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14340
14341 let stub = self.0.stub.clone();
14342 let mut options = self.0.options.clone();
14343 options.set_retry_policy(gax::retry_policy::NeverRetry);
14344 let query = move |name| {
14345 let stub = stub.clone();
14346 let options = options.clone();
14347 async {
14348 let op = GetOperation::new(stub)
14349 .set_name(name)
14350 .with_options(options)
14351 .send()
14352 .await?;
14353 Ok(Operation::new(op))
14354 }
14355 };
14356
14357 let start = move || async {
14358 let op = self.send().await?;
14359 Ok(Operation::new(op))
14360 };
14361
14362 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14363 }
14364
14365 pub fn set_target_site<T>(mut self, v: T) -> Self
14369 where
14370 T: std::convert::Into<crate::model::TargetSite>,
14371 {
14372 self.0.request.target_site = std::option::Option::Some(v.into());
14373 self
14374 }
14375
14376 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14380 where
14381 T: std::convert::Into<crate::model::TargetSite>,
14382 {
14383 self.0.request.target_site = v.map(|x| x.into());
14384 self
14385 }
14386 }
14387
14388 #[doc(hidden)]
14389 impl gax::options::internal::RequestBuilder for UpdateTargetSite {
14390 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14391 &mut self.0.options
14392 }
14393 }
14394
14395 #[derive(Clone, Debug)]
14413 pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14414
14415 impl DeleteTargetSite {
14416 pub(crate) fn new(
14417 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14418 ) -> Self {
14419 Self(RequestBuilder::new(stub))
14420 }
14421
14422 pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14424 mut self,
14425 v: V,
14426 ) -> Self {
14427 self.0.request = v.into();
14428 self
14429 }
14430
14431 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14433 self.0.options = v.into();
14434 self
14435 }
14436
14437 pub async fn send(self) -> Result<longrunning::model::Operation> {
14444 (*self.0.stub)
14445 .delete_target_site(self.0.request, self.0.options)
14446 .await
14447 .map(gax::response::Response::into_body)
14448 }
14449
14450 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
14452 type Operation =
14453 lro::internal::Operation<wkt::Empty, crate::model::DeleteTargetSiteMetadata>;
14454 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14455 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14456
14457 let stub = self.0.stub.clone();
14458 let mut options = self.0.options.clone();
14459 options.set_retry_policy(gax::retry_policy::NeverRetry);
14460 let query = move |name| {
14461 let stub = stub.clone();
14462 let options = options.clone();
14463 async {
14464 let op = GetOperation::new(stub)
14465 .set_name(name)
14466 .with_options(options)
14467 .send()
14468 .await?;
14469 Ok(Operation::new(op))
14470 }
14471 };
14472
14473 let start = move || async {
14474 let op = self.send().await?;
14475 Ok(Operation::new(op))
14476 };
14477
14478 lro::internal::new_unit_response_poller(
14479 polling_error_policy,
14480 polling_backoff_policy,
14481 start,
14482 query,
14483 )
14484 }
14485
14486 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14490 self.0.request.name = v.into();
14491 self
14492 }
14493 }
14494
14495 #[doc(hidden)]
14496 impl gax::options::internal::RequestBuilder for DeleteTargetSite {
14497 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14498 &mut self.0.options
14499 }
14500 }
14501
14502 #[derive(Clone, Debug)]
14523 pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
14524
14525 impl ListTargetSites {
14526 pub(crate) fn new(
14527 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14528 ) -> Self {
14529 Self(RequestBuilder::new(stub))
14530 }
14531
14532 pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
14534 self.0.request = v.into();
14535 self
14536 }
14537
14538 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14540 self.0.options = v.into();
14541 self
14542 }
14543
14544 pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
14546 (*self.0.stub)
14547 .list_target_sites(self.0.request, self.0.options)
14548 .await
14549 .map(gax::response::Response::into_body)
14550 }
14551
14552 pub fn by_page(
14554 self,
14555 ) -> impl gax::paginator::Paginator<crate::model::ListTargetSitesResponse, gax::error::Error>
14556 {
14557 use std::clone::Clone;
14558 let token = self.0.request.page_token.clone();
14559 let execute = move |token: String| {
14560 let mut builder = self.clone();
14561 builder.0.request = builder.0.request.set_page_token(token);
14562 builder.send()
14563 };
14564 gax::paginator::internal::new_paginator(token, execute)
14565 }
14566
14567 pub fn by_item(
14569 self,
14570 ) -> impl gax::paginator::ItemPaginator<crate::model::ListTargetSitesResponse, gax::error::Error>
14571 {
14572 use gax::paginator::Paginator;
14573 self.by_page().items()
14574 }
14575
14576 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14580 self.0.request.parent = v.into();
14581 self
14582 }
14583
14584 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14586 self.0.request.page_size = v.into();
14587 self
14588 }
14589
14590 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14592 self.0.request.page_token = v.into();
14593 self
14594 }
14595 }
14596
14597 #[doc(hidden)]
14598 impl gax::options::internal::RequestBuilder for ListTargetSites {
14599 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14600 &mut self.0.options
14601 }
14602 }
14603
14604 #[derive(Clone, Debug)]
14622 pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
14623
14624 impl CreateSitemap {
14625 pub(crate) fn new(
14626 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14627 ) -> Self {
14628 Self(RequestBuilder::new(stub))
14629 }
14630
14631 pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
14633 self.0.request = v.into();
14634 self
14635 }
14636
14637 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14639 self.0.options = v.into();
14640 self
14641 }
14642
14643 pub async fn send(self) -> Result<longrunning::model::Operation> {
14650 (*self.0.stub)
14651 .create_sitemap(self.0.request, self.0.options)
14652 .await
14653 .map(gax::response::Response::into_body)
14654 }
14655
14656 pub fn poller(
14658 self,
14659 ) -> impl lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata> {
14660 type Operation = lro::internal::Operation<
14661 crate::model::Sitemap,
14662 crate::model::CreateSitemapMetadata,
14663 >;
14664 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14665 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14666
14667 let stub = self.0.stub.clone();
14668 let mut options = self.0.options.clone();
14669 options.set_retry_policy(gax::retry_policy::NeverRetry);
14670 let query = move |name| {
14671 let stub = stub.clone();
14672 let options = options.clone();
14673 async {
14674 let op = GetOperation::new(stub)
14675 .set_name(name)
14676 .with_options(options)
14677 .send()
14678 .await?;
14679 Ok(Operation::new(op))
14680 }
14681 };
14682
14683 let start = move || async {
14684 let op = self.send().await?;
14685 Ok(Operation::new(op))
14686 };
14687
14688 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14689 }
14690
14691 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14695 self.0.request.parent = v.into();
14696 self
14697 }
14698
14699 pub fn set_sitemap<T>(mut self, v: T) -> Self
14703 where
14704 T: std::convert::Into<crate::model::Sitemap>,
14705 {
14706 self.0.request.sitemap = std::option::Option::Some(v.into());
14707 self
14708 }
14709
14710 pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
14714 where
14715 T: std::convert::Into<crate::model::Sitemap>,
14716 {
14717 self.0.request.sitemap = v.map(|x| x.into());
14718 self
14719 }
14720 }
14721
14722 #[doc(hidden)]
14723 impl gax::options::internal::RequestBuilder for CreateSitemap {
14724 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14725 &mut self.0.options
14726 }
14727 }
14728
14729 #[derive(Clone, Debug)]
14747 pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
14748
14749 impl DeleteSitemap {
14750 pub(crate) fn new(
14751 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14752 ) -> Self {
14753 Self(RequestBuilder::new(stub))
14754 }
14755
14756 pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
14758 self.0.request = v.into();
14759 self
14760 }
14761
14762 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14764 self.0.options = v.into();
14765 self
14766 }
14767
14768 pub async fn send(self) -> Result<longrunning::model::Operation> {
14775 (*self.0.stub)
14776 .delete_sitemap(self.0.request, self.0.options)
14777 .await
14778 .map(gax::response::Response::into_body)
14779 }
14780
14781 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteSitemapMetadata> {
14783 type Operation =
14784 lro::internal::Operation<wkt::Empty, crate::model::DeleteSitemapMetadata>;
14785 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14786 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14787
14788 let stub = self.0.stub.clone();
14789 let mut options = self.0.options.clone();
14790 options.set_retry_policy(gax::retry_policy::NeverRetry);
14791 let query = move |name| {
14792 let stub = stub.clone();
14793 let options = options.clone();
14794 async {
14795 let op = GetOperation::new(stub)
14796 .set_name(name)
14797 .with_options(options)
14798 .send()
14799 .await?;
14800 Ok(Operation::new(op))
14801 }
14802 };
14803
14804 let start = move || async {
14805 let op = self.send().await?;
14806 Ok(Operation::new(op))
14807 };
14808
14809 lro::internal::new_unit_response_poller(
14810 polling_error_policy,
14811 polling_backoff_policy,
14812 start,
14813 query,
14814 )
14815 }
14816
14817 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14821 self.0.request.name = v.into();
14822 self
14823 }
14824 }
14825
14826 #[doc(hidden)]
14827 impl gax::options::internal::RequestBuilder for DeleteSitemap {
14828 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14829 &mut self.0.options
14830 }
14831 }
14832
14833 #[derive(Clone, Debug)]
14850 pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
14851
14852 impl FetchSitemaps {
14853 pub(crate) fn new(
14854 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14855 ) -> Self {
14856 Self(RequestBuilder::new(stub))
14857 }
14858
14859 pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
14861 self.0.request = v.into();
14862 self
14863 }
14864
14865 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14867 self.0.options = v.into();
14868 self
14869 }
14870
14871 pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
14873 (*self.0.stub)
14874 .fetch_sitemaps(self.0.request, self.0.options)
14875 .await
14876 .map(gax::response::Response::into_body)
14877 }
14878
14879 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14883 self.0.request.parent = v.into();
14884 self
14885 }
14886
14887 pub fn set_matcher<T>(mut self, v: T) -> Self
14889 where
14890 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
14891 {
14892 self.0.request.matcher = std::option::Option::Some(v.into());
14893 self
14894 }
14895
14896 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
14898 where
14899 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
14900 {
14901 self.0.request.matcher = v.map(|x| x.into());
14902 self
14903 }
14904 }
14905
14906 #[doc(hidden)]
14907 impl gax::options::internal::RequestBuilder for FetchSitemaps {
14908 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14909 &mut self.0.options
14910 }
14911 }
14912
14913 #[derive(Clone, Debug)]
14931 pub struct EnableAdvancedSiteSearch(
14932 RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
14933 );
14934
14935 impl EnableAdvancedSiteSearch {
14936 pub(crate) fn new(
14937 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14938 ) -> Self {
14939 Self(RequestBuilder::new(stub))
14940 }
14941
14942 pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
14944 mut self,
14945 v: V,
14946 ) -> Self {
14947 self.0.request = v.into();
14948 self
14949 }
14950
14951 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14953 self.0.options = v.into();
14954 self
14955 }
14956
14957 pub async fn send(self) -> Result<longrunning::model::Operation> {
14964 (*self.0.stub)
14965 .enable_advanced_site_search(self.0.request, self.0.options)
14966 .await
14967 .map(gax::response::Response::into_body)
14968 }
14969
14970 pub fn poller(
14972 self,
14973 ) -> impl lro::Poller<
14974 crate::model::EnableAdvancedSiteSearchResponse,
14975 crate::model::EnableAdvancedSiteSearchMetadata,
14976 > {
14977 type Operation = lro::internal::Operation<
14978 crate::model::EnableAdvancedSiteSearchResponse,
14979 crate::model::EnableAdvancedSiteSearchMetadata,
14980 >;
14981 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14982 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14983
14984 let stub = self.0.stub.clone();
14985 let mut options = self.0.options.clone();
14986 options.set_retry_policy(gax::retry_policy::NeverRetry);
14987 let query = move |name| {
14988 let stub = stub.clone();
14989 let options = options.clone();
14990 async {
14991 let op = GetOperation::new(stub)
14992 .set_name(name)
14993 .with_options(options)
14994 .send()
14995 .await?;
14996 Ok(Operation::new(op))
14997 }
14998 };
14999
15000 let start = move || async {
15001 let op = self.send().await?;
15002 Ok(Operation::new(op))
15003 };
15004
15005 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15006 }
15007
15008 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15012 self.0.request.site_search_engine = v.into();
15013 self
15014 }
15015 }
15016
15017 #[doc(hidden)]
15018 impl gax::options::internal::RequestBuilder for EnableAdvancedSiteSearch {
15019 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15020 &mut self.0.options
15021 }
15022 }
15023
15024 #[derive(Clone, Debug)]
15042 pub struct DisableAdvancedSiteSearch(
15043 RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15044 );
15045
15046 impl DisableAdvancedSiteSearch {
15047 pub(crate) fn new(
15048 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15049 ) -> Self {
15050 Self(RequestBuilder::new(stub))
15051 }
15052
15053 pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15055 mut self,
15056 v: V,
15057 ) -> Self {
15058 self.0.request = v.into();
15059 self
15060 }
15061
15062 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15064 self.0.options = v.into();
15065 self
15066 }
15067
15068 pub async fn send(self) -> Result<longrunning::model::Operation> {
15075 (*self.0.stub)
15076 .disable_advanced_site_search(self.0.request, self.0.options)
15077 .await
15078 .map(gax::response::Response::into_body)
15079 }
15080
15081 pub fn poller(
15083 self,
15084 ) -> impl lro::Poller<
15085 crate::model::DisableAdvancedSiteSearchResponse,
15086 crate::model::DisableAdvancedSiteSearchMetadata,
15087 > {
15088 type Operation = lro::internal::Operation<
15089 crate::model::DisableAdvancedSiteSearchResponse,
15090 crate::model::DisableAdvancedSiteSearchMetadata,
15091 >;
15092 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15093 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15094
15095 let stub = self.0.stub.clone();
15096 let mut options = self.0.options.clone();
15097 options.set_retry_policy(gax::retry_policy::NeverRetry);
15098 let query = move |name| {
15099 let stub = stub.clone();
15100 let options = options.clone();
15101 async {
15102 let op = GetOperation::new(stub)
15103 .set_name(name)
15104 .with_options(options)
15105 .send()
15106 .await?;
15107 Ok(Operation::new(op))
15108 }
15109 };
15110
15111 let start = move || async {
15112 let op = self.send().await?;
15113 Ok(Operation::new(op))
15114 };
15115
15116 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15117 }
15118
15119 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15123 self.0.request.site_search_engine = v.into();
15124 self
15125 }
15126 }
15127
15128 #[doc(hidden)]
15129 impl gax::options::internal::RequestBuilder for DisableAdvancedSiteSearch {
15130 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15131 &mut self.0.options
15132 }
15133 }
15134
15135 #[derive(Clone, Debug)]
15153 pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15154
15155 impl RecrawlUris {
15156 pub(crate) fn new(
15157 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15158 ) -> Self {
15159 Self(RequestBuilder::new(stub))
15160 }
15161
15162 pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15164 self.0.request = v.into();
15165 self
15166 }
15167
15168 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15170 self.0.options = v.into();
15171 self
15172 }
15173
15174 pub async fn send(self) -> Result<longrunning::model::Operation> {
15181 (*self.0.stub)
15182 .recrawl_uris(self.0.request, self.0.options)
15183 .await
15184 .map(gax::response::Response::into_body)
15185 }
15186
15187 pub fn poller(
15189 self,
15190 ) -> impl lro::Poller<crate::model::RecrawlUrisResponse, crate::model::RecrawlUrisMetadata>
15191 {
15192 type Operation = lro::internal::Operation<
15193 crate::model::RecrawlUrisResponse,
15194 crate::model::RecrawlUrisMetadata,
15195 >;
15196 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15197 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15198
15199 let stub = self.0.stub.clone();
15200 let mut options = self.0.options.clone();
15201 options.set_retry_policy(gax::retry_policy::NeverRetry);
15202 let query = move |name| {
15203 let stub = stub.clone();
15204 let options = options.clone();
15205 async {
15206 let op = GetOperation::new(stub)
15207 .set_name(name)
15208 .with_options(options)
15209 .send()
15210 .await?;
15211 Ok(Operation::new(op))
15212 }
15213 };
15214
15215 let start = move || async {
15216 let op = self.send().await?;
15217 Ok(Operation::new(op))
15218 };
15219
15220 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15221 }
15222
15223 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15227 self.0.request.site_search_engine = v.into();
15228 self
15229 }
15230
15231 pub fn set_uris<T, V>(mut self, v: T) -> Self
15235 where
15236 T: std::iter::IntoIterator<Item = V>,
15237 V: std::convert::Into<std::string::String>,
15238 {
15239 use std::iter::Iterator;
15240 self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15241 self
15242 }
15243
15244 pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15246 self.0.request.site_credential = v.into();
15247 self
15248 }
15249 }
15250
15251 #[doc(hidden)]
15252 impl gax::options::internal::RequestBuilder for RecrawlUris {
15253 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15254 &mut self.0.options
15255 }
15256 }
15257
15258 #[derive(Clone, Debug)]
15276 pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15277
15278 impl BatchVerifyTargetSites {
15279 pub(crate) fn new(
15280 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15281 ) -> Self {
15282 Self(RequestBuilder::new(stub))
15283 }
15284
15285 pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15287 mut self,
15288 v: V,
15289 ) -> Self {
15290 self.0.request = v.into();
15291 self
15292 }
15293
15294 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15296 self.0.options = v.into();
15297 self
15298 }
15299
15300 pub async fn send(self) -> Result<longrunning::model::Operation> {
15307 (*self.0.stub)
15308 .batch_verify_target_sites(self.0.request, self.0.options)
15309 .await
15310 .map(gax::response::Response::into_body)
15311 }
15312
15313 pub fn poller(
15315 self,
15316 ) -> impl lro::Poller<
15317 crate::model::BatchVerifyTargetSitesResponse,
15318 crate::model::BatchVerifyTargetSitesMetadata,
15319 > {
15320 type Operation = lro::internal::Operation<
15321 crate::model::BatchVerifyTargetSitesResponse,
15322 crate::model::BatchVerifyTargetSitesMetadata,
15323 >;
15324 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15325 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15326
15327 let stub = self.0.stub.clone();
15328 let mut options = self.0.options.clone();
15329 options.set_retry_policy(gax::retry_policy::NeverRetry);
15330 let query = move |name| {
15331 let stub = stub.clone();
15332 let options = options.clone();
15333 async {
15334 let op = GetOperation::new(stub)
15335 .set_name(name)
15336 .with_options(options)
15337 .send()
15338 .await?;
15339 Ok(Operation::new(op))
15340 }
15341 };
15342
15343 let start = move || async {
15344 let op = self.send().await?;
15345 Ok(Operation::new(op))
15346 };
15347
15348 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15349 }
15350
15351 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15355 self.0.request.parent = v.into();
15356 self
15357 }
15358 }
15359
15360 #[doc(hidden)]
15361 impl gax::options::internal::RequestBuilder for BatchVerifyTargetSites {
15362 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15363 &mut self.0.options
15364 }
15365 }
15366
15367 #[derive(Clone, Debug)]
15388 pub struct FetchDomainVerificationStatus(
15389 RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
15390 );
15391
15392 impl FetchDomainVerificationStatus {
15393 pub(crate) fn new(
15394 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15395 ) -> Self {
15396 Self(RequestBuilder::new(stub))
15397 }
15398
15399 pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
15401 mut self,
15402 v: V,
15403 ) -> Self {
15404 self.0.request = v.into();
15405 self
15406 }
15407
15408 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15410 self.0.options = v.into();
15411 self
15412 }
15413
15414 pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
15416 (*self.0.stub)
15417 .fetch_domain_verification_status(self.0.request, self.0.options)
15418 .await
15419 .map(gax::response::Response::into_body)
15420 }
15421
15422 pub fn by_page(
15424 self,
15425 ) -> impl gax::paginator::Paginator<
15426 crate::model::FetchDomainVerificationStatusResponse,
15427 gax::error::Error,
15428 > {
15429 use std::clone::Clone;
15430 let token = self.0.request.page_token.clone();
15431 let execute = move |token: String| {
15432 let mut builder = self.clone();
15433 builder.0.request = builder.0.request.set_page_token(token);
15434 builder.send()
15435 };
15436 gax::paginator::internal::new_paginator(token, execute)
15437 }
15438
15439 pub fn by_item(
15441 self,
15442 ) -> impl gax::paginator::ItemPaginator<
15443 crate::model::FetchDomainVerificationStatusResponse,
15444 gax::error::Error,
15445 > {
15446 use gax::paginator::Paginator;
15447 self.by_page().items()
15448 }
15449
15450 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15454 self.0.request.site_search_engine = v.into();
15455 self
15456 }
15457
15458 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15460 self.0.request.page_size = v.into();
15461 self
15462 }
15463
15464 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15466 self.0.request.page_token = v.into();
15467 self
15468 }
15469 }
15470
15471 #[doc(hidden)]
15472 impl gax::options::internal::RequestBuilder for FetchDomainVerificationStatus {
15473 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15474 &mut self.0.options
15475 }
15476 }
15477
15478 #[derive(Clone, Debug)]
15499 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
15500
15501 impl ListOperations {
15502 pub(crate) fn new(
15503 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15504 ) -> Self {
15505 Self(RequestBuilder::new(stub))
15506 }
15507
15508 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
15510 mut self,
15511 v: V,
15512 ) -> Self {
15513 self.0.request = v.into();
15514 self
15515 }
15516
15517 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15519 self.0.options = v.into();
15520 self
15521 }
15522
15523 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
15525 (*self.0.stub)
15526 .list_operations(self.0.request, self.0.options)
15527 .await
15528 .map(gax::response::Response::into_body)
15529 }
15530
15531 pub fn by_page(
15533 self,
15534 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
15535 {
15536 use std::clone::Clone;
15537 let token = self.0.request.page_token.clone();
15538 let execute = move |token: String| {
15539 let mut builder = self.clone();
15540 builder.0.request = builder.0.request.set_page_token(token);
15541 builder.send()
15542 };
15543 gax::paginator::internal::new_paginator(token, execute)
15544 }
15545
15546 pub fn by_item(
15548 self,
15549 ) -> impl gax::paginator::ItemPaginator<
15550 longrunning::model::ListOperationsResponse,
15551 gax::error::Error,
15552 > {
15553 use gax::paginator::Paginator;
15554 self.by_page().items()
15555 }
15556
15557 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15559 self.0.request.name = v.into();
15560 self
15561 }
15562
15563 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15565 self.0.request.filter = v.into();
15566 self
15567 }
15568
15569 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15571 self.0.request.page_size = v.into();
15572 self
15573 }
15574
15575 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15577 self.0.request.page_token = v.into();
15578 self
15579 }
15580
15581 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
15583 self.0.request.return_partial_success = v.into();
15584 self
15585 }
15586 }
15587
15588 #[doc(hidden)]
15589 impl gax::options::internal::RequestBuilder for ListOperations {
15590 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15591 &mut self.0.options
15592 }
15593 }
15594
15595 #[derive(Clone, Debug)]
15612 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
15613
15614 impl GetOperation {
15615 pub(crate) fn new(
15616 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15617 ) -> Self {
15618 Self(RequestBuilder::new(stub))
15619 }
15620
15621 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
15623 mut self,
15624 v: V,
15625 ) -> Self {
15626 self.0.request = v.into();
15627 self
15628 }
15629
15630 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15632 self.0.options = v.into();
15633 self
15634 }
15635
15636 pub async fn send(self) -> Result<longrunning::model::Operation> {
15638 (*self.0.stub)
15639 .get_operation(self.0.request, self.0.options)
15640 .await
15641 .map(gax::response::Response::into_body)
15642 }
15643
15644 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15646 self.0.request.name = v.into();
15647 self
15648 }
15649 }
15650
15651 #[doc(hidden)]
15652 impl gax::options::internal::RequestBuilder for GetOperation {
15653 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15654 &mut self.0.options
15655 }
15656 }
15657
15658 #[derive(Clone, Debug)]
15675 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
15676
15677 impl CancelOperation {
15678 pub(crate) fn new(
15679 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15680 ) -> Self {
15681 Self(RequestBuilder::new(stub))
15682 }
15683
15684 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
15686 mut self,
15687 v: V,
15688 ) -> Self {
15689 self.0.request = v.into();
15690 self
15691 }
15692
15693 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15695 self.0.options = v.into();
15696 self
15697 }
15698
15699 pub async fn send(self) -> Result<()> {
15701 (*self.0.stub)
15702 .cancel_operation(self.0.request, self.0.options)
15703 .await
15704 .map(gax::response::Response::into_body)
15705 }
15706
15707 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15709 self.0.request.name = v.into();
15710 self
15711 }
15712 }
15713
15714 #[doc(hidden)]
15715 impl gax::options::internal::RequestBuilder for CancelOperation {
15716 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15717 &mut self.0.options
15718 }
15719 }
15720}
15721
15722#[cfg(feature = "user-event-service")]
15723#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
15724pub mod user_event_service {
15725 use crate::Result;
15726
15727 pub type ClientBuilder =
15741 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
15742
15743 pub(crate) mod client {
15744 use super::super::super::client::UserEventService;
15745 pub struct Factory;
15746 impl gax::client_builder::internal::ClientFactory for Factory {
15747 type Client = UserEventService;
15748 type Credentials = gaxi::options::Credentials;
15749 async fn build(
15750 self,
15751 config: gaxi::options::ClientConfig,
15752 ) -> gax::client_builder::Result<Self::Client> {
15753 Self::Client::new(config).await
15754 }
15755 }
15756 }
15757
15758 #[derive(Clone, Debug)]
15760 pub(crate) struct RequestBuilder<R: std::default::Default> {
15761 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15762 request: R,
15763 options: gax::options::RequestOptions,
15764 }
15765
15766 impl<R> RequestBuilder<R>
15767 where
15768 R: std::default::Default,
15769 {
15770 pub(crate) fn new(
15771 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15772 ) -> Self {
15773 Self {
15774 stub,
15775 request: R::default(),
15776 options: gax::options::RequestOptions::default(),
15777 }
15778 }
15779 }
15780
15781 #[derive(Clone, Debug)]
15798 pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
15799
15800 impl WriteUserEvent {
15801 pub(crate) fn new(
15802 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15803 ) -> Self {
15804 Self(RequestBuilder::new(stub))
15805 }
15806
15807 pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
15809 self.0.request = v.into();
15810 self
15811 }
15812
15813 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15815 self.0.options = v.into();
15816 self
15817 }
15818
15819 pub async fn send(self) -> Result<crate::model::UserEvent> {
15821 (*self.0.stub)
15822 .write_user_event(self.0.request, self.0.options)
15823 .await
15824 .map(gax::response::Response::into_body)
15825 }
15826
15827 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15831 self.0.request.parent = v.into();
15832 self
15833 }
15834
15835 pub fn set_user_event<T>(mut self, v: T) -> Self
15839 where
15840 T: std::convert::Into<crate::model::UserEvent>,
15841 {
15842 self.0.request.user_event = std::option::Option::Some(v.into());
15843 self
15844 }
15845
15846 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
15850 where
15851 T: std::convert::Into<crate::model::UserEvent>,
15852 {
15853 self.0.request.user_event = v.map(|x| x.into());
15854 self
15855 }
15856
15857 pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
15859 self.0.request.write_async = v.into();
15860 self
15861 }
15862 }
15863
15864 #[doc(hidden)]
15865 impl gax::options::internal::RequestBuilder for WriteUserEvent {
15866 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15867 &mut self.0.options
15868 }
15869 }
15870
15871 #[derive(Clone, Debug)]
15888 pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
15889
15890 impl CollectUserEvent {
15891 pub(crate) fn new(
15892 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15893 ) -> Self {
15894 Self(RequestBuilder::new(stub))
15895 }
15896
15897 pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
15899 mut self,
15900 v: V,
15901 ) -> Self {
15902 self.0.request = v.into();
15903 self
15904 }
15905
15906 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15908 self.0.options = v.into();
15909 self
15910 }
15911
15912 pub async fn send(self) -> Result<api::model::HttpBody> {
15914 (*self.0.stub)
15915 .collect_user_event(self.0.request, self.0.options)
15916 .await
15917 .map(gax::response::Response::into_body)
15918 }
15919
15920 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15924 self.0.request.parent = v.into();
15925 self
15926 }
15927
15928 pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
15932 self.0.request.user_event = v.into();
15933 self
15934 }
15935
15936 pub fn set_uri<T>(mut self, v: T) -> Self
15938 where
15939 T: std::convert::Into<std::string::String>,
15940 {
15941 self.0.request.uri = std::option::Option::Some(v.into());
15942 self
15943 }
15944
15945 pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
15947 where
15948 T: std::convert::Into<std::string::String>,
15949 {
15950 self.0.request.uri = v.map(|x| x.into());
15951 self
15952 }
15953
15954 pub fn set_ets<T>(mut self, v: T) -> Self
15956 where
15957 T: std::convert::Into<i64>,
15958 {
15959 self.0.request.ets = std::option::Option::Some(v.into());
15960 self
15961 }
15962
15963 pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
15965 where
15966 T: std::convert::Into<i64>,
15967 {
15968 self.0.request.ets = v.map(|x| x.into());
15969 self
15970 }
15971 }
15972
15973 #[doc(hidden)]
15974 impl gax::options::internal::RequestBuilder for CollectUserEvent {
15975 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15976 &mut self.0.options
15977 }
15978 }
15979
15980 #[derive(Clone, Debug)]
15998 pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
15999
16000 impl PurgeUserEvents {
16001 pub(crate) fn new(
16002 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16003 ) -> Self {
16004 Self(RequestBuilder::new(stub))
16005 }
16006
16007 pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16009 self.0.request = v.into();
16010 self
16011 }
16012
16013 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16015 self.0.options = v.into();
16016 self
16017 }
16018
16019 pub async fn send(self) -> Result<longrunning::model::Operation> {
16026 (*self.0.stub)
16027 .purge_user_events(self.0.request, self.0.options)
16028 .await
16029 .map(gax::response::Response::into_body)
16030 }
16031
16032 pub fn poller(
16034 self,
16035 ) -> impl lro::Poller<crate::model::PurgeUserEventsResponse, crate::model::PurgeUserEventsMetadata>
16036 {
16037 type Operation = lro::internal::Operation<
16038 crate::model::PurgeUserEventsResponse,
16039 crate::model::PurgeUserEventsMetadata,
16040 >;
16041 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16042 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16043
16044 let stub = self.0.stub.clone();
16045 let mut options = self.0.options.clone();
16046 options.set_retry_policy(gax::retry_policy::NeverRetry);
16047 let query = move |name| {
16048 let stub = stub.clone();
16049 let options = options.clone();
16050 async {
16051 let op = GetOperation::new(stub)
16052 .set_name(name)
16053 .with_options(options)
16054 .send()
16055 .await?;
16056 Ok(Operation::new(op))
16057 }
16058 };
16059
16060 let start = move || async {
16061 let op = self.send().await?;
16062 Ok(Operation::new(op))
16063 };
16064
16065 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16066 }
16067
16068 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16072 self.0.request.parent = v.into();
16073 self
16074 }
16075
16076 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16080 self.0.request.filter = v.into();
16081 self
16082 }
16083
16084 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16086 self.0.request.force = v.into();
16087 self
16088 }
16089 }
16090
16091 #[doc(hidden)]
16092 impl gax::options::internal::RequestBuilder for PurgeUserEvents {
16093 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16094 &mut self.0.options
16095 }
16096 }
16097
16098 #[derive(Clone, Debug)]
16116 pub struct ImportUserEvents(RequestBuilder<crate::model::ImportUserEventsRequest>);
16117
16118 impl ImportUserEvents {
16119 pub(crate) fn new(
16120 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16121 ) -> Self {
16122 Self(RequestBuilder::new(stub))
16123 }
16124
16125 pub fn with_request<V: Into<crate::model::ImportUserEventsRequest>>(
16127 mut self,
16128 v: V,
16129 ) -> Self {
16130 self.0.request = v.into();
16131 self
16132 }
16133
16134 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16136 self.0.options = v.into();
16137 self
16138 }
16139
16140 pub async fn send(self) -> Result<longrunning::model::Operation> {
16147 (*self.0.stub)
16148 .import_user_events(self.0.request, self.0.options)
16149 .await
16150 .map(gax::response::Response::into_body)
16151 }
16152
16153 pub fn poller(
16155 self,
16156 ) -> impl lro::Poller<
16157 crate::model::ImportUserEventsResponse,
16158 crate::model::ImportUserEventsMetadata,
16159 > {
16160 type Operation = lro::internal::Operation<
16161 crate::model::ImportUserEventsResponse,
16162 crate::model::ImportUserEventsMetadata,
16163 >;
16164 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16165 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16166
16167 let stub = self.0.stub.clone();
16168 let mut options = self.0.options.clone();
16169 options.set_retry_policy(gax::retry_policy::NeverRetry);
16170 let query = move |name| {
16171 let stub = stub.clone();
16172 let options = options.clone();
16173 async {
16174 let op = GetOperation::new(stub)
16175 .set_name(name)
16176 .with_options(options)
16177 .send()
16178 .await?;
16179 Ok(Operation::new(op))
16180 }
16181 };
16182
16183 let start = move || async {
16184 let op = self.send().await?;
16185 Ok(Operation::new(op))
16186 };
16187
16188 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16189 }
16190
16191 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16195 self.0.request.parent = v.into();
16196 self
16197 }
16198
16199 pub fn set_error_config<T>(mut self, v: T) -> Self
16201 where
16202 T: std::convert::Into<crate::model::ImportErrorConfig>,
16203 {
16204 self.0.request.error_config = std::option::Option::Some(v.into());
16205 self
16206 }
16207
16208 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
16210 where
16211 T: std::convert::Into<crate::model::ImportErrorConfig>,
16212 {
16213 self.0.request.error_config = v.map(|x| x.into());
16214 self
16215 }
16216
16217 pub fn set_source<T: Into<Option<crate::model::import_user_events_request::Source>>>(
16222 mut self,
16223 v: T,
16224 ) -> Self {
16225 self.0.request.source = v.into();
16226 self
16227 }
16228
16229 pub fn set_inline_source<
16235 T: std::convert::Into<
16236 std::boxed::Box<crate::model::import_user_events_request::InlineSource>,
16237 >,
16238 >(
16239 mut self,
16240 v: T,
16241 ) -> Self {
16242 self.0.request = self.0.request.set_inline_source(v);
16243 self
16244 }
16245
16246 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
16252 mut self,
16253 v: T,
16254 ) -> Self {
16255 self.0.request = self.0.request.set_gcs_source(v);
16256 self
16257 }
16258
16259 pub fn set_bigquery_source<
16265 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
16266 >(
16267 mut self,
16268 v: T,
16269 ) -> Self {
16270 self.0.request = self.0.request.set_bigquery_source(v);
16271 self
16272 }
16273 }
16274
16275 #[doc(hidden)]
16276 impl gax::options::internal::RequestBuilder for ImportUserEvents {
16277 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16278 &mut self.0.options
16279 }
16280 }
16281
16282 #[derive(Clone, Debug)]
16303 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
16304
16305 impl ListOperations {
16306 pub(crate) fn new(
16307 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16308 ) -> Self {
16309 Self(RequestBuilder::new(stub))
16310 }
16311
16312 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
16314 mut self,
16315 v: V,
16316 ) -> Self {
16317 self.0.request = v.into();
16318 self
16319 }
16320
16321 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16323 self.0.options = v.into();
16324 self
16325 }
16326
16327 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
16329 (*self.0.stub)
16330 .list_operations(self.0.request, self.0.options)
16331 .await
16332 .map(gax::response::Response::into_body)
16333 }
16334
16335 pub fn by_page(
16337 self,
16338 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
16339 {
16340 use std::clone::Clone;
16341 let token = self.0.request.page_token.clone();
16342 let execute = move |token: String| {
16343 let mut builder = self.clone();
16344 builder.0.request = builder.0.request.set_page_token(token);
16345 builder.send()
16346 };
16347 gax::paginator::internal::new_paginator(token, execute)
16348 }
16349
16350 pub fn by_item(
16352 self,
16353 ) -> impl gax::paginator::ItemPaginator<
16354 longrunning::model::ListOperationsResponse,
16355 gax::error::Error,
16356 > {
16357 use gax::paginator::Paginator;
16358 self.by_page().items()
16359 }
16360
16361 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16363 self.0.request.name = v.into();
16364 self
16365 }
16366
16367 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16369 self.0.request.filter = v.into();
16370 self
16371 }
16372
16373 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16375 self.0.request.page_size = v.into();
16376 self
16377 }
16378
16379 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16381 self.0.request.page_token = v.into();
16382 self
16383 }
16384
16385 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16387 self.0.request.return_partial_success = v.into();
16388 self
16389 }
16390 }
16391
16392 #[doc(hidden)]
16393 impl gax::options::internal::RequestBuilder for ListOperations {
16394 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16395 &mut self.0.options
16396 }
16397 }
16398
16399 #[derive(Clone, Debug)]
16416 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
16417
16418 impl GetOperation {
16419 pub(crate) fn new(
16420 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16421 ) -> Self {
16422 Self(RequestBuilder::new(stub))
16423 }
16424
16425 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
16427 mut self,
16428 v: V,
16429 ) -> Self {
16430 self.0.request = v.into();
16431 self
16432 }
16433
16434 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16436 self.0.options = v.into();
16437 self
16438 }
16439
16440 pub async fn send(self) -> Result<longrunning::model::Operation> {
16442 (*self.0.stub)
16443 .get_operation(self.0.request, self.0.options)
16444 .await
16445 .map(gax::response::Response::into_body)
16446 }
16447
16448 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16450 self.0.request.name = v.into();
16451 self
16452 }
16453 }
16454
16455 #[doc(hidden)]
16456 impl gax::options::internal::RequestBuilder for GetOperation {
16457 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16458 &mut self.0.options
16459 }
16460 }
16461
16462 #[derive(Clone, Debug)]
16479 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
16480
16481 impl CancelOperation {
16482 pub(crate) fn new(
16483 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16484 ) -> Self {
16485 Self(RequestBuilder::new(stub))
16486 }
16487
16488 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
16490 mut self,
16491 v: V,
16492 ) -> Self {
16493 self.0.request = v.into();
16494 self
16495 }
16496
16497 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16499 self.0.options = v.into();
16500 self
16501 }
16502
16503 pub async fn send(self) -> Result<()> {
16505 (*self.0.stub)
16506 .cancel_operation(self.0.request, self.0.options)
16507 .await
16508 .map(gax::response::Response::into_body)
16509 }
16510
16511 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16513 self.0.request.name = v.into();
16514 self
16515 }
16516 }
16517
16518 #[doc(hidden)]
16519 impl gax::options::internal::RequestBuilder for CancelOperation {
16520 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16521 &mut self.0.options
16522 }
16523 }
16524}
16525
16526#[cfg(feature = "user-license-service")]
16527#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
16528pub mod user_license_service {
16529 use crate::Result;
16530
16531 pub type ClientBuilder =
16545 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16546
16547 pub(crate) mod client {
16548 use super::super::super::client::UserLicenseService;
16549 pub struct Factory;
16550 impl gax::client_builder::internal::ClientFactory for Factory {
16551 type Client = UserLicenseService;
16552 type Credentials = gaxi::options::Credentials;
16553 async fn build(
16554 self,
16555 config: gaxi::options::ClientConfig,
16556 ) -> gax::client_builder::Result<Self::Client> {
16557 Self::Client::new(config).await
16558 }
16559 }
16560 }
16561
16562 #[derive(Clone, Debug)]
16564 pub(crate) struct RequestBuilder<R: std::default::Default> {
16565 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16566 request: R,
16567 options: gax::options::RequestOptions,
16568 }
16569
16570 impl<R> RequestBuilder<R>
16571 where
16572 R: std::default::Default,
16573 {
16574 pub(crate) fn new(
16575 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16576 ) -> Self {
16577 Self {
16578 stub,
16579 request: R::default(),
16580 options: gax::options::RequestOptions::default(),
16581 }
16582 }
16583 }
16584
16585 #[derive(Clone, Debug)]
16606 pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
16607
16608 impl ListUserLicenses {
16609 pub(crate) fn new(
16610 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16611 ) -> Self {
16612 Self(RequestBuilder::new(stub))
16613 }
16614
16615 pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
16617 mut self,
16618 v: V,
16619 ) -> Self {
16620 self.0.request = v.into();
16621 self
16622 }
16623
16624 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16626 self.0.options = v.into();
16627 self
16628 }
16629
16630 pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
16632 (*self.0.stub)
16633 .list_user_licenses(self.0.request, self.0.options)
16634 .await
16635 .map(gax::response::Response::into_body)
16636 }
16637
16638 pub fn by_page(
16640 self,
16641 ) -> impl gax::paginator::Paginator<crate::model::ListUserLicensesResponse, gax::error::Error>
16642 {
16643 use std::clone::Clone;
16644 let token = self.0.request.page_token.clone();
16645 let execute = move |token: String| {
16646 let mut builder = self.clone();
16647 builder.0.request = builder.0.request.set_page_token(token);
16648 builder.send()
16649 };
16650 gax::paginator::internal::new_paginator(token, execute)
16651 }
16652
16653 pub fn by_item(
16655 self,
16656 ) -> impl gax::paginator::ItemPaginator<crate::model::ListUserLicensesResponse, gax::error::Error>
16657 {
16658 use gax::paginator::Paginator;
16659 self.by_page().items()
16660 }
16661
16662 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16666 self.0.request.parent = v.into();
16667 self
16668 }
16669
16670 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16672 self.0.request.page_size = v.into();
16673 self
16674 }
16675
16676 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16678 self.0.request.page_token = v.into();
16679 self
16680 }
16681
16682 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16684 self.0.request.filter = v.into();
16685 self
16686 }
16687 }
16688
16689 #[doc(hidden)]
16690 impl gax::options::internal::RequestBuilder for ListUserLicenses {
16691 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16692 &mut self.0.options
16693 }
16694 }
16695
16696 #[derive(Clone, Debug)]
16714 pub struct BatchUpdateUserLicenses(
16715 RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
16716 );
16717
16718 impl BatchUpdateUserLicenses {
16719 pub(crate) fn new(
16720 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16721 ) -> Self {
16722 Self(RequestBuilder::new(stub))
16723 }
16724
16725 pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
16727 mut self,
16728 v: V,
16729 ) -> Self {
16730 self.0.request = v.into();
16731 self
16732 }
16733
16734 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16736 self.0.options = v.into();
16737 self
16738 }
16739
16740 pub async fn send(self) -> Result<longrunning::model::Operation> {
16747 (*self.0.stub)
16748 .batch_update_user_licenses(self.0.request, self.0.options)
16749 .await
16750 .map(gax::response::Response::into_body)
16751 }
16752
16753 pub fn poller(
16755 self,
16756 ) -> impl lro::Poller<
16757 crate::model::BatchUpdateUserLicensesResponse,
16758 crate::model::BatchUpdateUserLicensesMetadata,
16759 > {
16760 type Operation = lro::internal::Operation<
16761 crate::model::BatchUpdateUserLicensesResponse,
16762 crate::model::BatchUpdateUserLicensesMetadata,
16763 >;
16764 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16765 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16766
16767 let stub = self.0.stub.clone();
16768 let mut options = self.0.options.clone();
16769 options.set_retry_policy(gax::retry_policy::NeverRetry);
16770 let query = move |name| {
16771 let stub = stub.clone();
16772 let options = options.clone();
16773 async {
16774 let op = GetOperation::new(stub)
16775 .set_name(name)
16776 .with_options(options)
16777 .send()
16778 .await?;
16779 Ok(Operation::new(op))
16780 }
16781 };
16782
16783 let start = move || async {
16784 let op = self.send().await?;
16785 Ok(Operation::new(op))
16786 };
16787
16788 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16789 }
16790
16791 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16795 self.0.request.parent = v.into();
16796 self
16797 }
16798
16799 pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
16801 self.0.request.delete_unassigned_user_licenses = v.into();
16802 self
16803 }
16804
16805 pub fn set_source<
16810 T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
16811 >(
16812 mut self,
16813 v: T,
16814 ) -> Self {
16815 self.0.request.source = v.into();
16816 self
16817 }
16818
16819 pub fn set_inline_source<
16825 T: std::convert::Into<
16826 std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
16827 >,
16828 >(
16829 mut self,
16830 v: T,
16831 ) -> Self {
16832 self.0.request = self.0.request.set_inline_source(v);
16833 self
16834 }
16835 }
16836
16837 #[doc(hidden)]
16838 impl gax::options::internal::RequestBuilder for BatchUpdateUserLicenses {
16839 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16840 &mut self.0.options
16841 }
16842 }
16843
16844 #[derive(Clone, Debug)]
16865 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
16866
16867 impl ListOperations {
16868 pub(crate) fn new(
16869 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16870 ) -> Self {
16871 Self(RequestBuilder::new(stub))
16872 }
16873
16874 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
16876 mut self,
16877 v: V,
16878 ) -> Self {
16879 self.0.request = v.into();
16880 self
16881 }
16882
16883 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16885 self.0.options = v.into();
16886 self
16887 }
16888
16889 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
16891 (*self.0.stub)
16892 .list_operations(self.0.request, self.0.options)
16893 .await
16894 .map(gax::response::Response::into_body)
16895 }
16896
16897 pub fn by_page(
16899 self,
16900 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
16901 {
16902 use std::clone::Clone;
16903 let token = self.0.request.page_token.clone();
16904 let execute = move |token: String| {
16905 let mut builder = self.clone();
16906 builder.0.request = builder.0.request.set_page_token(token);
16907 builder.send()
16908 };
16909 gax::paginator::internal::new_paginator(token, execute)
16910 }
16911
16912 pub fn by_item(
16914 self,
16915 ) -> impl gax::paginator::ItemPaginator<
16916 longrunning::model::ListOperationsResponse,
16917 gax::error::Error,
16918 > {
16919 use gax::paginator::Paginator;
16920 self.by_page().items()
16921 }
16922
16923 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16925 self.0.request.name = v.into();
16926 self
16927 }
16928
16929 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16931 self.0.request.filter = v.into();
16932 self
16933 }
16934
16935 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16937 self.0.request.page_size = v.into();
16938 self
16939 }
16940
16941 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16943 self.0.request.page_token = v.into();
16944 self
16945 }
16946
16947 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16949 self.0.request.return_partial_success = v.into();
16950 self
16951 }
16952 }
16953
16954 #[doc(hidden)]
16955 impl gax::options::internal::RequestBuilder for ListOperations {
16956 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16957 &mut self.0.options
16958 }
16959 }
16960
16961 #[derive(Clone, Debug)]
16978 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
16979
16980 impl GetOperation {
16981 pub(crate) fn new(
16982 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16983 ) -> Self {
16984 Self(RequestBuilder::new(stub))
16985 }
16986
16987 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
16989 mut self,
16990 v: V,
16991 ) -> Self {
16992 self.0.request = v.into();
16993 self
16994 }
16995
16996 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16998 self.0.options = v.into();
16999 self
17000 }
17001
17002 pub async fn send(self) -> Result<longrunning::model::Operation> {
17004 (*self.0.stub)
17005 .get_operation(self.0.request, self.0.options)
17006 .await
17007 .map(gax::response::Response::into_body)
17008 }
17009
17010 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17012 self.0.request.name = v.into();
17013 self
17014 }
17015 }
17016
17017 #[doc(hidden)]
17018 impl gax::options::internal::RequestBuilder for GetOperation {
17019 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17020 &mut self.0.options
17021 }
17022 }
17023
17024 #[derive(Clone, Debug)]
17041 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
17042
17043 impl CancelOperation {
17044 pub(crate) fn new(
17045 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17046 ) -> Self {
17047 Self(RequestBuilder::new(stub))
17048 }
17049
17050 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
17052 mut self,
17053 v: V,
17054 ) -> Self {
17055 self.0.request = v.into();
17056 self
17057 }
17058
17059 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17061 self.0.options = v.into();
17062 self
17063 }
17064
17065 pub async fn send(self) -> Result<()> {
17067 (*self.0.stub)
17068 .cancel_operation(self.0.request, self.0.options)
17069 .await
17070 .map(gax::response::Response::into_body)
17071 }
17072
17073 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17075 self.0.request.name = v.into();
17076 self
17077 }
17078 }
17079
17080 #[doc(hidden)]
17081 impl gax::options::internal::RequestBuilder for CancelOperation {
17082 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17083 &mut self.0.options
17084 }
17085 }
17086}