1#[cfg(feature = "assistant-service")]
18#[cfg_attr(docsrs, doc(cfg(feature = "assistant-service")))]
19pub mod assistant_service {
20 use crate::Result;
21
22 pub type ClientBuilder =
36 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
37
38 pub(crate) mod client {
39 use super::super::super::client::AssistantService;
40 pub struct Factory;
41 impl gax::client_builder::internal::ClientFactory for Factory {
42 type Client = AssistantService;
43 type Credentials = gaxi::options::Credentials;
44 async fn build(
45 self,
46 config: gaxi::options::ClientConfig,
47 ) -> gax::client_builder::Result<Self::Client> {
48 Self::Client::new(config).await
49 }
50 }
51 }
52
53 #[derive(Clone, Debug)]
55 pub(crate) struct RequestBuilder<R: std::default::Default> {
56 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
57 request: R,
58 options: gax::options::RequestOptions,
59 }
60
61 impl<R> RequestBuilder<R>
62 where
63 R: std::default::Default,
64 {
65 pub(crate) fn new(
66 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
67 ) -> Self {
68 Self {
69 stub,
70 request: R::default(),
71 options: gax::options::RequestOptions::default(),
72 }
73 }
74 }
75
76 #[derive(Clone, Debug)]
98 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
99
100 impl ListOperations {
101 pub(crate) fn new(
102 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
103 ) -> Self {
104 Self(RequestBuilder::new(stub))
105 }
106
107 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
109 mut self,
110 v: V,
111 ) -> Self {
112 self.0.request = v.into();
113 self
114 }
115
116 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
118 self.0.options = v.into();
119 self
120 }
121
122 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
124 (*self.0.stub)
125 .list_operations(self.0.request, self.0.options)
126 .await
127 .map(gax::response::Response::into_body)
128 }
129
130 pub fn by_page(
132 self,
133 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
134 {
135 use std::clone::Clone;
136 let token = self.0.request.page_token.clone();
137 let execute = move |token: String| {
138 let mut builder = self.clone();
139 builder.0.request = builder.0.request.set_page_token(token);
140 builder.send()
141 };
142 gax::paginator::internal::new_paginator(token, execute)
143 }
144
145 pub fn by_item(
147 self,
148 ) -> impl gax::paginator::ItemPaginator<
149 longrunning::model::ListOperationsResponse,
150 gax::error::Error,
151 > {
152 use gax::paginator::Paginator;
153 self.by_page().items()
154 }
155
156 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
158 self.0.request.name = v.into();
159 self
160 }
161
162 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
164 self.0.request.filter = v.into();
165 self
166 }
167
168 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
170 self.0.request.page_size = v.into();
171 self
172 }
173
174 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
176 self.0.request.page_token = v.into();
177 self
178 }
179 }
180
181 #[doc(hidden)]
182 impl gax::options::internal::RequestBuilder for ListOperations {
183 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
184 &mut self.0.options
185 }
186 }
187
188 #[derive(Clone, Debug)]
206 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
207
208 impl GetOperation {
209 pub(crate) fn new(
210 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
211 ) -> Self {
212 Self(RequestBuilder::new(stub))
213 }
214
215 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
217 mut self,
218 v: V,
219 ) -> Self {
220 self.0.request = v.into();
221 self
222 }
223
224 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
226 self.0.options = v.into();
227 self
228 }
229
230 pub async fn send(self) -> Result<longrunning::model::Operation> {
232 (*self.0.stub)
233 .get_operation(self.0.request, self.0.options)
234 .await
235 .map(gax::response::Response::into_body)
236 }
237
238 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
240 self.0.request.name = v.into();
241 self
242 }
243 }
244
245 #[doc(hidden)]
246 impl gax::options::internal::RequestBuilder for GetOperation {
247 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
248 &mut self.0.options
249 }
250 }
251
252 #[derive(Clone, Debug)]
270 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
271
272 impl CancelOperation {
273 pub(crate) fn new(
274 stub: std::sync::Arc<dyn super::super::stub::dynamic::AssistantService>,
275 ) -> Self {
276 Self(RequestBuilder::new(stub))
277 }
278
279 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
281 mut self,
282 v: V,
283 ) -> Self {
284 self.0.request = v.into();
285 self
286 }
287
288 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
290 self.0.options = v.into();
291 self
292 }
293
294 pub async fn send(self) -> Result<()> {
296 (*self.0.stub)
297 .cancel_operation(self.0.request, self.0.options)
298 .await
299 .map(gax::response::Response::into_body)
300 }
301
302 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
304 self.0.request.name = v.into();
305 self
306 }
307 }
308
309 #[doc(hidden)]
310 impl gax::options::internal::RequestBuilder for CancelOperation {
311 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
312 &mut self.0.options
313 }
314 }
315}
316
317#[cfg(feature = "cmek-config-service")]
318#[cfg_attr(docsrs, doc(cfg(feature = "cmek-config-service")))]
319pub mod cmek_config_service {
320 use crate::Result;
321
322 pub type ClientBuilder =
336 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
337
338 pub(crate) mod client {
339 use super::super::super::client::CmekConfigService;
340 pub struct Factory;
341 impl gax::client_builder::internal::ClientFactory for Factory {
342 type Client = CmekConfigService;
343 type Credentials = gaxi::options::Credentials;
344 async fn build(
345 self,
346 config: gaxi::options::ClientConfig,
347 ) -> gax::client_builder::Result<Self::Client> {
348 Self::Client::new(config).await
349 }
350 }
351 }
352
353 #[derive(Clone, Debug)]
355 pub(crate) struct RequestBuilder<R: std::default::Default> {
356 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
357 request: R,
358 options: gax::options::RequestOptions,
359 }
360
361 impl<R> RequestBuilder<R>
362 where
363 R: std::default::Default,
364 {
365 pub(crate) fn new(
366 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
367 ) -> Self {
368 Self {
369 stub,
370 request: R::default(),
371 options: gax::options::RequestOptions::default(),
372 }
373 }
374 }
375
376 #[derive(Clone, Debug)]
395 pub struct UpdateCmekConfig(RequestBuilder<crate::model::UpdateCmekConfigRequest>);
396
397 impl UpdateCmekConfig {
398 pub(crate) fn new(
399 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
400 ) -> Self {
401 Self(RequestBuilder::new(stub))
402 }
403
404 pub fn with_request<V: Into<crate::model::UpdateCmekConfigRequest>>(
406 mut self,
407 v: V,
408 ) -> Self {
409 self.0.request = v.into();
410 self
411 }
412
413 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
415 self.0.options = v.into();
416 self
417 }
418
419 pub async fn send(self) -> Result<longrunning::model::Operation> {
426 (*self.0.stub)
427 .update_cmek_config(self.0.request, self.0.options)
428 .await
429 .map(gax::response::Response::into_body)
430 }
431
432 pub fn poller(
434 self,
435 ) -> impl lro::Poller<crate::model::CmekConfig, crate::model::UpdateCmekConfigMetadata>
436 {
437 type Operation = lro::internal::Operation<
438 crate::model::CmekConfig,
439 crate::model::UpdateCmekConfigMetadata,
440 >;
441 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
442 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
443
444 let stub = self.0.stub.clone();
445 let mut options = self.0.options.clone();
446 options.set_retry_policy(gax::retry_policy::NeverRetry);
447 let query = move |name| {
448 let stub = stub.clone();
449 let options = options.clone();
450 async {
451 let op = GetOperation::new(stub)
452 .set_name(name)
453 .with_options(options)
454 .send()
455 .await?;
456 Ok(Operation::new(op))
457 }
458 };
459
460 let start = move || async {
461 let op = self.send().await?;
462 Ok(Operation::new(op))
463 };
464
465 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
466 }
467
468 pub fn set_config<T>(mut self, v: T) -> Self
472 where
473 T: std::convert::Into<crate::model::CmekConfig>,
474 {
475 self.0.request.config = std::option::Option::Some(v.into());
476 self
477 }
478
479 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
483 where
484 T: std::convert::Into<crate::model::CmekConfig>,
485 {
486 self.0.request.config = v.map(|x| x.into());
487 self
488 }
489
490 pub fn set_set_default<T: Into<bool>>(mut self, v: T) -> Self {
492 self.0.request.set_default = v.into();
493 self
494 }
495 }
496
497 #[doc(hidden)]
498 impl gax::options::internal::RequestBuilder for UpdateCmekConfig {
499 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
500 &mut self.0.options
501 }
502 }
503
504 #[derive(Clone, Debug)]
522 pub struct GetCmekConfig(RequestBuilder<crate::model::GetCmekConfigRequest>);
523
524 impl GetCmekConfig {
525 pub(crate) fn new(
526 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
527 ) -> Self {
528 Self(RequestBuilder::new(stub))
529 }
530
531 pub fn with_request<V: Into<crate::model::GetCmekConfigRequest>>(mut self, v: V) -> Self {
533 self.0.request = v.into();
534 self
535 }
536
537 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
539 self.0.options = v.into();
540 self
541 }
542
543 pub async fn send(self) -> Result<crate::model::CmekConfig> {
545 (*self.0.stub)
546 .get_cmek_config(self.0.request, self.0.options)
547 .await
548 .map(gax::response::Response::into_body)
549 }
550
551 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
555 self.0.request.name = v.into();
556 self
557 }
558 }
559
560 #[doc(hidden)]
561 impl gax::options::internal::RequestBuilder for GetCmekConfig {
562 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
563 &mut self.0.options
564 }
565 }
566
567 #[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)]
649 pub struct DeleteCmekConfig(RequestBuilder<crate::model::DeleteCmekConfigRequest>);
650
651 impl DeleteCmekConfig {
652 pub(crate) fn new(
653 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
654 ) -> Self {
655 Self(RequestBuilder::new(stub))
656 }
657
658 pub fn with_request<V: Into<crate::model::DeleteCmekConfigRequest>>(
660 mut self,
661 v: V,
662 ) -> Self {
663 self.0.request = v.into();
664 self
665 }
666
667 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
669 self.0.options = v.into();
670 self
671 }
672
673 pub async fn send(self) -> Result<longrunning::model::Operation> {
680 (*self.0.stub)
681 .delete_cmek_config(self.0.request, self.0.options)
682 .await
683 .map(gax::response::Response::into_body)
684 }
685
686 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteCmekConfigMetadata> {
688 type Operation =
689 lro::internal::Operation<wkt::Empty, crate::model::DeleteCmekConfigMetadata>;
690 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
691 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
692
693 let stub = self.0.stub.clone();
694 let mut options = self.0.options.clone();
695 options.set_retry_policy(gax::retry_policy::NeverRetry);
696 let query = move |name| {
697 let stub = stub.clone();
698 let options = options.clone();
699 async {
700 let op = GetOperation::new(stub)
701 .set_name(name)
702 .with_options(options)
703 .send()
704 .await?;
705 Ok(Operation::new(op))
706 }
707 };
708
709 let start = move || async {
710 let op = self.send().await?;
711 Ok(Operation::new(op))
712 };
713
714 lro::internal::new_unit_response_poller(
715 polling_error_policy,
716 polling_backoff_policy,
717 start,
718 query,
719 )
720 }
721
722 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
726 self.0.request.name = v.into();
727 self
728 }
729 }
730
731 #[doc(hidden)]
732 impl gax::options::internal::RequestBuilder for DeleteCmekConfig {
733 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
734 &mut self.0.options
735 }
736 }
737
738 #[derive(Clone, Debug)]
760 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
761
762 impl ListOperations {
763 pub(crate) fn new(
764 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
765 ) -> Self {
766 Self(RequestBuilder::new(stub))
767 }
768
769 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
771 mut self,
772 v: V,
773 ) -> Self {
774 self.0.request = v.into();
775 self
776 }
777
778 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
780 self.0.options = v.into();
781 self
782 }
783
784 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
786 (*self.0.stub)
787 .list_operations(self.0.request, self.0.options)
788 .await
789 .map(gax::response::Response::into_body)
790 }
791
792 pub fn by_page(
794 self,
795 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
796 {
797 use std::clone::Clone;
798 let token = self.0.request.page_token.clone();
799 let execute = move |token: String| {
800 let mut builder = self.clone();
801 builder.0.request = builder.0.request.set_page_token(token);
802 builder.send()
803 };
804 gax::paginator::internal::new_paginator(token, execute)
805 }
806
807 pub fn by_item(
809 self,
810 ) -> impl gax::paginator::ItemPaginator<
811 longrunning::model::ListOperationsResponse,
812 gax::error::Error,
813 > {
814 use gax::paginator::Paginator;
815 self.by_page().items()
816 }
817
818 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
820 self.0.request.name = v.into();
821 self
822 }
823
824 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
826 self.0.request.filter = v.into();
827 self
828 }
829
830 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
832 self.0.request.page_size = v.into();
833 self
834 }
835
836 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
838 self.0.request.page_token = v.into();
839 self
840 }
841 }
842
843 #[doc(hidden)]
844 impl gax::options::internal::RequestBuilder for ListOperations {
845 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
846 &mut self.0.options
847 }
848 }
849
850 #[derive(Clone, Debug)]
868 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
869
870 impl GetOperation {
871 pub(crate) fn new(
872 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
873 ) -> Self {
874 Self(RequestBuilder::new(stub))
875 }
876
877 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
879 mut self,
880 v: V,
881 ) -> Self {
882 self.0.request = v.into();
883 self
884 }
885
886 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
888 self.0.options = v.into();
889 self
890 }
891
892 pub async fn send(self) -> Result<longrunning::model::Operation> {
894 (*self.0.stub)
895 .get_operation(self.0.request, self.0.options)
896 .await
897 .map(gax::response::Response::into_body)
898 }
899
900 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
902 self.0.request.name = v.into();
903 self
904 }
905 }
906
907 #[doc(hidden)]
908 impl gax::options::internal::RequestBuilder for GetOperation {
909 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
910 &mut self.0.options
911 }
912 }
913
914 #[derive(Clone, Debug)]
932 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
933
934 impl CancelOperation {
935 pub(crate) fn new(
936 stub: std::sync::Arc<dyn super::super::stub::dynamic::CmekConfigService>,
937 ) -> Self {
938 Self(RequestBuilder::new(stub))
939 }
940
941 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
943 mut self,
944 v: V,
945 ) -> Self {
946 self.0.request = v.into();
947 self
948 }
949
950 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
952 self.0.options = v.into();
953 self
954 }
955
956 pub async fn send(self) -> Result<()> {
958 (*self.0.stub)
959 .cancel_operation(self.0.request, self.0.options)
960 .await
961 .map(gax::response::Response::into_body)
962 }
963
964 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
966 self.0.request.name = v.into();
967 self
968 }
969 }
970
971 #[doc(hidden)]
972 impl gax::options::internal::RequestBuilder for CancelOperation {
973 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
974 &mut self.0.options
975 }
976 }
977}
978
979#[cfg(feature = "completion-service")]
980#[cfg_attr(docsrs, doc(cfg(feature = "completion-service")))]
981pub mod completion_service {
982 use crate::Result;
983
984 pub type ClientBuilder =
998 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
999
1000 pub(crate) mod client {
1001 use super::super::super::client::CompletionService;
1002 pub struct Factory;
1003 impl gax::client_builder::internal::ClientFactory for Factory {
1004 type Client = CompletionService;
1005 type Credentials = gaxi::options::Credentials;
1006 async fn build(
1007 self,
1008 config: gaxi::options::ClientConfig,
1009 ) -> gax::client_builder::Result<Self::Client> {
1010 Self::Client::new(config).await
1011 }
1012 }
1013 }
1014
1015 #[derive(Clone, Debug)]
1017 pub(crate) struct RequestBuilder<R: std::default::Default> {
1018 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1019 request: R,
1020 options: gax::options::RequestOptions,
1021 }
1022
1023 impl<R> RequestBuilder<R>
1024 where
1025 R: std::default::Default,
1026 {
1027 pub(crate) fn new(
1028 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1029 ) -> Self {
1030 Self {
1031 stub,
1032 request: R::default(),
1033 options: gax::options::RequestOptions::default(),
1034 }
1035 }
1036 }
1037
1038 #[derive(Clone, Debug)]
1056 pub struct CompleteQuery(RequestBuilder<crate::model::CompleteQueryRequest>);
1057
1058 impl CompleteQuery {
1059 pub(crate) fn new(
1060 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1061 ) -> Self {
1062 Self(RequestBuilder::new(stub))
1063 }
1064
1065 pub fn with_request<V: Into<crate::model::CompleteQueryRequest>>(mut self, v: V) -> Self {
1067 self.0.request = v.into();
1068 self
1069 }
1070
1071 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1073 self.0.options = v.into();
1074 self
1075 }
1076
1077 pub async fn send(self) -> Result<crate::model::CompleteQueryResponse> {
1079 (*self.0.stub)
1080 .complete_query(self.0.request, self.0.options)
1081 .await
1082 .map(gax::response::Response::into_body)
1083 }
1084
1085 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
1089 self.0.request.data_store = v.into();
1090 self
1091 }
1092
1093 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
1097 self.0.request.query = v.into();
1098 self
1099 }
1100
1101 pub fn set_query_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
1103 self.0.request.query_model = v.into();
1104 self
1105 }
1106
1107 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1109 self.0.request.user_pseudo_id = v.into();
1110 self
1111 }
1112
1113 pub fn set_include_tail_suggestions<T: Into<bool>>(mut self, v: T) -> Self {
1115 self.0.request.include_tail_suggestions = v.into();
1116 self
1117 }
1118 }
1119
1120 #[doc(hidden)]
1121 impl gax::options::internal::RequestBuilder for CompleteQuery {
1122 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1123 &mut self.0.options
1124 }
1125 }
1126
1127 #[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)]
1304 pub struct PurgeSuggestionDenyListEntries(
1305 RequestBuilder<crate::model::PurgeSuggestionDenyListEntriesRequest>,
1306 );
1307
1308 impl PurgeSuggestionDenyListEntries {
1309 pub(crate) fn new(
1310 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1311 ) -> Self {
1312 Self(RequestBuilder::new(stub))
1313 }
1314
1315 pub fn with_request<V: Into<crate::model::PurgeSuggestionDenyListEntriesRequest>>(
1317 mut self,
1318 v: V,
1319 ) -> Self {
1320 self.0.request = v.into();
1321 self
1322 }
1323
1324 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1326 self.0.options = v.into();
1327 self
1328 }
1329
1330 pub async fn send(self) -> Result<longrunning::model::Operation> {
1337 (*self.0.stub)
1338 .purge_suggestion_deny_list_entries(self.0.request, self.0.options)
1339 .await
1340 .map(gax::response::Response::into_body)
1341 }
1342
1343 pub fn poller(
1345 self,
1346 ) -> impl lro::Poller<
1347 crate::model::PurgeSuggestionDenyListEntriesResponse,
1348 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1349 > {
1350 type Operation = lro::internal::Operation<
1351 crate::model::PurgeSuggestionDenyListEntriesResponse,
1352 crate::model::PurgeSuggestionDenyListEntriesMetadata,
1353 >;
1354 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1355 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1356
1357 let stub = self.0.stub.clone();
1358 let mut options = self.0.options.clone();
1359 options.set_retry_policy(gax::retry_policy::NeverRetry);
1360 let query = move |name| {
1361 let stub = stub.clone();
1362 let options = options.clone();
1363 async {
1364 let op = GetOperation::new(stub)
1365 .set_name(name)
1366 .with_options(options)
1367 .send()
1368 .await?;
1369 Ok(Operation::new(op))
1370 }
1371 };
1372
1373 let start = move || async {
1374 let op = self.send().await?;
1375 Ok(Operation::new(op))
1376 };
1377
1378 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1379 }
1380
1381 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1385 self.0.request.parent = v.into();
1386 self
1387 }
1388 }
1389
1390 #[doc(hidden)]
1391 impl gax::options::internal::RequestBuilder for PurgeSuggestionDenyListEntries {
1392 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1393 &mut self.0.options
1394 }
1395 }
1396
1397 #[derive(Clone, Debug)]
1416 pub struct ImportCompletionSuggestions(
1417 RequestBuilder<crate::model::ImportCompletionSuggestionsRequest>,
1418 );
1419
1420 impl ImportCompletionSuggestions {
1421 pub(crate) fn new(
1422 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1423 ) -> Self {
1424 Self(RequestBuilder::new(stub))
1425 }
1426
1427 pub fn with_request<V: Into<crate::model::ImportCompletionSuggestionsRequest>>(
1429 mut self,
1430 v: V,
1431 ) -> Self {
1432 self.0.request = v.into();
1433 self
1434 }
1435
1436 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1438 self.0.options = v.into();
1439 self
1440 }
1441
1442 pub async fn send(self) -> Result<longrunning::model::Operation> {
1449 (*self.0.stub)
1450 .import_completion_suggestions(self.0.request, self.0.options)
1451 .await
1452 .map(gax::response::Response::into_body)
1453 }
1454
1455 pub fn poller(
1457 self,
1458 ) -> impl lro::Poller<
1459 crate::model::ImportCompletionSuggestionsResponse,
1460 crate::model::ImportCompletionSuggestionsMetadata,
1461 > {
1462 type Operation = lro::internal::Operation<
1463 crate::model::ImportCompletionSuggestionsResponse,
1464 crate::model::ImportCompletionSuggestionsMetadata,
1465 >;
1466 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1467 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1468
1469 let stub = self.0.stub.clone();
1470 let mut options = self.0.options.clone();
1471 options.set_retry_policy(gax::retry_policy::NeverRetry);
1472 let query = move |name| {
1473 let stub = stub.clone();
1474 let options = options.clone();
1475 async {
1476 let op = GetOperation::new(stub)
1477 .set_name(name)
1478 .with_options(options)
1479 .send()
1480 .await?;
1481 Ok(Operation::new(op))
1482 }
1483 };
1484
1485 let start = move || async {
1486 let op = self.send().await?;
1487 Ok(Operation::new(op))
1488 };
1489
1490 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1491 }
1492
1493 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1497 self.0.request.parent = v.into();
1498 self
1499 }
1500
1501 pub fn set_error_config<T>(mut self, v: T) -> Self
1503 where
1504 T: std::convert::Into<crate::model::ImportErrorConfig>,
1505 {
1506 self.0.request.error_config = std::option::Option::Some(v.into());
1507 self
1508 }
1509
1510 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
1512 where
1513 T: std::convert::Into<crate::model::ImportErrorConfig>,
1514 {
1515 self.0.request.error_config = v.map(|x| x.into());
1516 self
1517 }
1518
1519 pub fn set_source<
1524 T: Into<Option<crate::model::import_completion_suggestions_request::Source>>,
1525 >(
1526 mut self,
1527 v: T,
1528 ) -> Self {
1529 self.0.request.source = v.into();
1530 self
1531 }
1532
1533 pub fn set_inline_source<
1539 T: std::convert::Into<
1540 std::boxed::Box<
1541 crate::model::import_completion_suggestions_request::InlineSource,
1542 >,
1543 >,
1544 >(
1545 mut self,
1546 v: T,
1547 ) -> Self {
1548 self.0.request = self.0.request.set_inline_source(v);
1549 self
1550 }
1551
1552 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
1558 mut self,
1559 v: T,
1560 ) -> Self {
1561 self.0.request = self.0.request.set_gcs_source(v);
1562 self
1563 }
1564
1565 pub fn set_bigquery_source<
1571 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
1572 >(
1573 mut self,
1574 v: T,
1575 ) -> Self {
1576 self.0.request = self.0.request.set_bigquery_source(v);
1577 self
1578 }
1579 }
1580
1581 #[doc(hidden)]
1582 impl gax::options::internal::RequestBuilder for ImportCompletionSuggestions {
1583 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1584 &mut self.0.options
1585 }
1586 }
1587
1588 #[derive(Clone, Debug)]
1607 pub struct PurgeCompletionSuggestions(
1608 RequestBuilder<crate::model::PurgeCompletionSuggestionsRequest>,
1609 );
1610
1611 impl PurgeCompletionSuggestions {
1612 pub(crate) fn new(
1613 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1614 ) -> Self {
1615 Self(RequestBuilder::new(stub))
1616 }
1617
1618 pub fn with_request<V: Into<crate::model::PurgeCompletionSuggestionsRequest>>(
1620 mut self,
1621 v: V,
1622 ) -> Self {
1623 self.0.request = v.into();
1624 self
1625 }
1626
1627 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1629 self.0.options = v.into();
1630 self
1631 }
1632
1633 pub async fn send(self) -> Result<longrunning::model::Operation> {
1640 (*self.0.stub)
1641 .purge_completion_suggestions(self.0.request, self.0.options)
1642 .await
1643 .map(gax::response::Response::into_body)
1644 }
1645
1646 pub fn poller(
1648 self,
1649 ) -> impl lro::Poller<
1650 crate::model::PurgeCompletionSuggestionsResponse,
1651 crate::model::PurgeCompletionSuggestionsMetadata,
1652 > {
1653 type Operation = lro::internal::Operation<
1654 crate::model::PurgeCompletionSuggestionsResponse,
1655 crate::model::PurgeCompletionSuggestionsMetadata,
1656 >;
1657 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1658 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1659
1660 let stub = self.0.stub.clone();
1661 let mut options = self.0.options.clone();
1662 options.set_retry_policy(gax::retry_policy::NeverRetry);
1663 let query = move |name| {
1664 let stub = stub.clone();
1665 let options = options.clone();
1666 async {
1667 let op = GetOperation::new(stub)
1668 .set_name(name)
1669 .with_options(options)
1670 .send()
1671 .await?;
1672 Ok(Operation::new(op))
1673 }
1674 };
1675
1676 let start = move || async {
1677 let op = self.send().await?;
1678 Ok(Operation::new(op))
1679 };
1680
1681 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1682 }
1683
1684 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1688 self.0.request.parent = v.into();
1689 self
1690 }
1691 }
1692
1693 #[doc(hidden)]
1694 impl gax::options::internal::RequestBuilder for PurgeCompletionSuggestions {
1695 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1696 &mut self.0.options
1697 }
1698 }
1699
1700 #[derive(Clone, Debug)]
1722 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1723
1724 impl ListOperations {
1725 pub(crate) fn new(
1726 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1727 ) -> Self {
1728 Self(RequestBuilder::new(stub))
1729 }
1730
1731 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1733 mut self,
1734 v: V,
1735 ) -> Self {
1736 self.0.request = v.into();
1737 self
1738 }
1739
1740 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1742 self.0.options = v.into();
1743 self
1744 }
1745
1746 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1748 (*self.0.stub)
1749 .list_operations(self.0.request, self.0.options)
1750 .await
1751 .map(gax::response::Response::into_body)
1752 }
1753
1754 pub fn by_page(
1756 self,
1757 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1758 {
1759 use std::clone::Clone;
1760 let token = self.0.request.page_token.clone();
1761 let execute = move |token: String| {
1762 let mut builder = self.clone();
1763 builder.0.request = builder.0.request.set_page_token(token);
1764 builder.send()
1765 };
1766 gax::paginator::internal::new_paginator(token, execute)
1767 }
1768
1769 pub fn by_item(
1771 self,
1772 ) -> impl gax::paginator::ItemPaginator<
1773 longrunning::model::ListOperationsResponse,
1774 gax::error::Error,
1775 > {
1776 use gax::paginator::Paginator;
1777 self.by_page().items()
1778 }
1779
1780 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1782 self.0.request.name = v.into();
1783 self
1784 }
1785
1786 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1788 self.0.request.filter = v.into();
1789 self
1790 }
1791
1792 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1794 self.0.request.page_size = v.into();
1795 self
1796 }
1797
1798 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1800 self.0.request.page_token = v.into();
1801 self
1802 }
1803 }
1804
1805 #[doc(hidden)]
1806 impl gax::options::internal::RequestBuilder for ListOperations {
1807 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1808 &mut self.0.options
1809 }
1810 }
1811
1812 #[derive(Clone, Debug)]
1830 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1831
1832 impl GetOperation {
1833 pub(crate) fn new(
1834 stub: std::sync::Arc<dyn super::super::stub::dynamic::CompletionService>,
1835 ) -> Self {
1836 Self(RequestBuilder::new(stub))
1837 }
1838
1839 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1841 mut self,
1842 v: V,
1843 ) -> Self {
1844 self.0.request = v.into();
1845 self
1846 }
1847
1848 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1850 self.0.options = v.into();
1851 self
1852 }
1853
1854 pub async fn send(self) -> Result<longrunning::model::Operation> {
1856 (*self.0.stub)
1857 .get_operation(self.0.request, self.0.options)
1858 .await
1859 .map(gax::response::Response::into_body)
1860 }
1861
1862 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1864 self.0.request.name = v.into();
1865 self
1866 }
1867 }
1868
1869 #[doc(hidden)]
1870 impl gax::options::internal::RequestBuilder for GetOperation {
1871 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1872 &mut self.0.options
1873 }
1874 }
1875
1876 #[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)]
2018 pub struct CreateControl(RequestBuilder<crate::model::CreateControlRequest>);
2019
2020 impl CreateControl {
2021 pub(crate) fn new(
2022 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2023 ) -> Self {
2024 Self(RequestBuilder::new(stub))
2025 }
2026
2027 pub fn with_request<V: Into<crate::model::CreateControlRequest>>(mut self, v: V) -> Self {
2029 self.0.request = v.into();
2030 self
2031 }
2032
2033 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2035 self.0.options = v.into();
2036 self
2037 }
2038
2039 pub async fn send(self) -> Result<crate::model::Control> {
2041 (*self.0.stub)
2042 .create_control(self.0.request, self.0.options)
2043 .await
2044 .map(gax::response::Response::into_body)
2045 }
2046
2047 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2051 self.0.request.parent = v.into();
2052 self
2053 }
2054
2055 pub fn set_control<T>(mut self, v: T) -> Self
2059 where
2060 T: std::convert::Into<crate::model::Control>,
2061 {
2062 self.0.request.control = std::option::Option::Some(v.into());
2063 self
2064 }
2065
2066 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2070 where
2071 T: std::convert::Into<crate::model::Control>,
2072 {
2073 self.0.request.control = v.map(|x| x.into());
2074 self
2075 }
2076
2077 pub fn set_control_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2081 self.0.request.control_id = v.into();
2082 self
2083 }
2084 }
2085
2086 #[doc(hidden)]
2087 impl gax::options::internal::RequestBuilder for CreateControl {
2088 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2089 &mut self.0.options
2090 }
2091 }
2092
2093 #[derive(Clone, Debug)]
2111 pub struct DeleteControl(RequestBuilder<crate::model::DeleteControlRequest>);
2112
2113 impl DeleteControl {
2114 pub(crate) fn new(
2115 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2116 ) -> Self {
2117 Self(RequestBuilder::new(stub))
2118 }
2119
2120 pub fn with_request<V: Into<crate::model::DeleteControlRequest>>(mut self, v: V) -> Self {
2122 self.0.request = v.into();
2123 self
2124 }
2125
2126 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2128 self.0.options = v.into();
2129 self
2130 }
2131
2132 pub async fn send(self) -> Result<()> {
2134 (*self.0.stub)
2135 .delete_control(self.0.request, self.0.options)
2136 .await
2137 .map(gax::response::Response::into_body)
2138 }
2139
2140 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2144 self.0.request.name = v.into();
2145 self
2146 }
2147 }
2148
2149 #[doc(hidden)]
2150 impl gax::options::internal::RequestBuilder for DeleteControl {
2151 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2152 &mut self.0.options
2153 }
2154 }
2155
2156 #[derive(Clone, Debug)]
2174 pub struct UpdateControl(RequestBuilder<crate::model::UpdateControlRequest>);
2175
2176 impl UpdateControl {
2177 pub(crate) fn new(
2178 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2179 ) -> Self {
2180 Self(RequestBuilder::new(stub))
2181 }
2182
2183 pub fn with_request<V: Into<crate::model::UpdateControlRequest>>(mut self, v: V) -> Self {
2185 self.0.request = v.into();
2186 self
2187 }
2188
2189 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2191 self.0.options = v.into();
2192 self
2193 }
2194
2195 pub async fn send(self) -> Result<crate::model::Control> {
2197 (*self.0.stub)
2198 .update_control(self.0.request, self.0.options)
2199 .await
2200 .map(gax::response::Response::into_body)
2201 }
2202
2203 pub fn set_control<T>(mut self, v: T) -> Self
2207 where
2208 T: std::convert::Into<crate::model::Control>,
2209 {
2210 self.0.request.control = std::option::Option::Some(v.into());
2211 self
2212 }
2213
2214 pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
2218 where
2219 T: std::convert::Into<crate::model::Control>,
2220 {
2221 self.0.request.control = v.map(|x| x.into());
2222 self
2223 }
2224
2225 pub fn set_update_mask<T>(mut self, v: T) -> Self
2227 where
2228 T: std::convert::Into<wkt::FieldMask>,
2229 {
2230 self.0.request.update_mask = std::option::Option::Some(v.into());
2231 self
2232 }
2233
2234 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2236 where
2237 T: std::convert::Into<wkt::FieldMask>,
2238 {
2239 self.0.request.update_mask = v.map(|x| x.into());
2240 self
2241 }
2242 }
2243
2244 #[doc(hidden)]
2245 impl gax::options::internal::RequestBuilder for UpdateControl {
2246 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2247 &mut self.0.options
2248 }
2249 }
2250
2251 #[derive(Clone, Debug)]
2269 pub struct GetControl(RequestBuilder<crate::model::GetControlRequest>);
2270
2271 impl GetControl {
2272 pub(crate) fn new(
2273 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2274 ) -> Self {
2275 Self(RequestBuilder::new(stub))
2276 }
2277
2278 pub fn with_request<V: Into<crate::model::GetControlRequest>>(mut self, v: V) -> Self {
2280 self.0.request = v.into();
2281 self
2282 }
2283
2284 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2286 self.0.options = v.into();
2287 self
2288 }
2289
2290 pub async fn send(self) -> Result<crate::model::Control> {
2292 (*self.0.stub)
2293 .get_control(self.0.request, self.0.options)
2294 .await
2295 .map(gax::response::Response::into_body)
2296 }
2297
2298 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2302 self.0.request.name = v.into();
2303 self
2304 }
2305 }
2306
2307 #[doc(hidden)]
2308 impl gax::options::internal::RequestBuilder for GetControl {
2309 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2310 &mut self.0.options
2311 }
2312 }
2313
2314 #[derive(Clone, Debug)]
2336 pub struct ListControls(RequestBuilder<crate::model::ListControlsRequest>);
2337
2338 impl ListControls {
2339 pub(crate) fn new(
2340 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2341 ) -> Self {
2342 Self(RequestBuilder::new(stub))
2343 }
2344
2345 pub fn with_request<V: Into<crate::model::ListControlsRequest>>(mut self, v: V) -> Self {
2347 self.0.request = v.into();
2348 self
2349 }
2350
2351 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2353 self.0.options = v.into();
2354 self
2355 }
2356
2357 pub async fn send(self) -> Result<crate::model::ListControlsResponse> {
2359 (*self.0.stub)
2360 .list_controls(self.0.request, self.0.options)
2361 .await
2362 .map(gax::response::Response::into_body)
2363 }
2364
2365 pub fn by_page(
2367 self,
2368 ) -> impl gax::paginator::Paginator<crate::model::ListControlsResponse, gax::error::Error>
2369 {
2370 use std::clone::Clone;
2371 let token = self.0.request.page_token.clone();
2372 let execute = move |token: String| {
2373 let mut builder = self.clone();
2374 builder.0.request = builder.0.request.set_page_token(token);
2375 builder.send()
2376 };
2377 gax::paginator::internal::new_paginator(token, execute)
2378 }
2379
2380 pub fn by_item(
2382 self,
2383 ) -> impl gax::paginator::ItemPaginator<crate::model::ListControlsResponse, gax::error::Error>
2384 {
2385 use gax::paginator::Paginator;
2386 self.by_page().items()
2387 }
2388
2389 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2393 self.0.request.parent = v.into();
2394 self
2395 }
2396
2397 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2399 self.0.request.page_size = v.into();
2400 self
2401 }
2402
2403 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2405 self.0.request.page_token = v.into();
2406 self
2407 }
2408
2409 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2411 self.0.request.filter = v.into();
2412 self
2413 }
2414 }
2415
2416 #[doc(hidden)]
2417 impl gax::options::internal::RequestBuilder for ListControls {
2418 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2419 &mut self.0.options
2420 }
2421 }
2422
2423 #[derive(Clone, Debug)]
2445 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2446
2447 impl ListOperations {
2448 pub(crate) fn new(
2449 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2450 ) -> Self {
2451 Self(RequestBuilder::new(stub))
2452 }
2453
2454 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2456 mut self,
2457 v: V,
2458 ) -> Self {
2459 self.0.request = v.into();
2460 self
2461 }
2462
2463 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2465 self.0.options = v.into();
2466 self
2467 }
2468
2469 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2471 (*self.0.stub)
2472 .list_operations(self.0.request, self.0.options)
2473 .await
2474 .map(gax::response::Response::into_body)
2475 }
2476
2477 pub fn by_page(
2479 self,
2480 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2481 {
2482 use std::clone::Clone;
2483 let token = self.0.request.page_token.clone();
2484 let execute = move |token: String| {
2485 let mut builder = self.clone();
2486 builder.0.request = builder.0.request.set_page_token(token);
2487 builder.send()
2488 };
2489 gax::paginator::internal::new_paginator(token, execute)
2490 }
2491
2492 pub fn by_item(
2494 self,
2495 ) -> impl gax::paginator::ItemPaginator<
2496 longrunning::model::ListOperationsResponse,
2497 gax::error::Error,
2498 > {
2499 use gax::paginator::Paginator;
2500 self.by_page().items()
2501 }
2502
2503 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2505 self.0.request.name = v.into();
2506 self
2507 }
2508
2509 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2511 self.0.request.filter = v.into();
2512 self
2513 }
2514
2515 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2517 self.0.request.page_size = v.into();
2518 self
2519 }
2520
2521 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2523 self.0.request.page_token = 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)]
2553 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2554
2555 impl GetOperation {
2556 pub(crate) fn new(
2557 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2558 ) -> Self {
2559 Self(RequestBuilder::new(stub))
2560 }
2561
2562 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2564 mut self,
2565 v: V,
2566 ) -> Self {
2567 self.0.request = v.into();
2568 self
2569 }
2570
2571 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2573 self.0.options = v.into();
2574 self
2575 }
2576
2577 pub async fn send(self) -> Result<longrunning::model::Operation> {
2579 (*self.0.stub)
2580 .get_operation(self.0.request, self.0.options)
2581 .await
2582 .map(gax::response::Response::into_body)
2583 }
2584
2585 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2587 self.0.request.name = v.into();
2588 self
2589 }
2590 }
2591
2592 #[doc(hidden)]
2593 impl gax::options::internal::RequestBuilder for GetOperation {
2594 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2595 &mut self.0.options
2596 }
2597 }
2598
2599 #[derive(Clone, Debug)]
2617 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2618
2619 impl CancelOperation {
2620 pub(crate) fn new(
2621 stub: std::sync::Arc<dyn super::super::stub::dynamic::ControlService>,
2622 ) -> Self {
2623 Self(RequestBuilder::new(stub))
2624 }
2625
2626 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2628 mut self,
2629 v: V,
2630 ) -> Self {
2631 self.0.request = v.into();
2632 self
2633 }
2634
2635 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2637 self.0.options = v.into();
2638 self
2639 }
2640
2641 pub async fn send(self) -> Result<()> {
2643 (*self.0.stub)
2644 .cancel_operation(self.0.request, self.0.options)
2645 .await
2646 .map(gax::response::Response::into_body)
2647 }
2648
2649 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2651 self.0.request.name = v.into();
2652 self
2653 }
2654 }
2655
2656 #[doc(hidden)]
2657 impl gax::options::internal::RequestBuilder for CancelOperation {
2658 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2659 &mut self.0.options
2660 }
2661 }
2662}
2663
2664#[cfg(feature = "conversational-search-service")]
2665#[cfg_attr(docsrs, doc(cfg(feature = "conversational-search-service")))]
2666pub mod conversational_search_service {
2667 use crate::Result;
2668
2669 pub type ClientBuilder =
2683 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2684
2685 pub(crate) mod client {
2686 use super::super::super::client::ConversationalSearchService;
2687 pub struct Factory;
2688 impl gax::client_builder::internal::ClientFactory for Factory {
2689 type Client = ConversationalSearchService;
2690 type Credentials = gaxi::options::Credentials;
2691 async fn build(
2692 self,
2693 config: gaxi::options::ClientConfig,
2694 ) -> gax::client_builder::Result<Self::Client> {
2695 Self::Client::new(config).await
2696 }
2697 }
2698 }
2699
2700 #[derive(Clone, Debug)]
2702 pub(crate) struct RequestBuilder<R: std::default::Default> {
2703 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2704 request: R,
2705 options: gax::options::RequestOptions,
2706 }
2707
2708 impl<R> RequestBuilder<R>
2709 where
2710 R: std::default::Default,
2711 {
2712 pub(crate) fn new(
2713 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2714 ) -> Self {
2715 Self {
2716 stub,
2717 request: R::default(),
2718 options: gax::options::RequestOptions::default(),
2719 }
2720 }
2721 }
2722
2723 #[derive(Clone, Debug)]
2741 pub struct ConverseConversation(RequestBuilder<crate::model::ConverseConversationRequest>);
2742
2743 impl ConverseConversation {
2744 pub(crate) fn new(
2745 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2746 ) -> Self {
2747 Self(RequestBuilder::new(stub))
2748 }
2749
2750 pub fn with_request<V: Into<crate::model::ConverseConversationRequest>>(
2752 mut self,
2753 v: V,
2754 ) -> Self {
2755 self.0.request = v.into();
2756 self
2757 }
2758
2759 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2761 self.0.options = v.into();
2762 self
2763 }
2764
2765 pub async fn send(self) -> Result<crate::model::ConverseConversationResponse> {
2767 (*self.0.stub)
2768 .converse_conversation(self.0.request, self.0.options)
2769 .await
2770 .map(gax::response::Response::into_body)
2771 }
2772
2773 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2777 self.0.request.name = v.into();
2778 self
2779 }
2780
2781 pub fn set_query<T>(mut self, v: T) -> Self
2785 where
2786 T: std::convert::Into<crate::model::TextInput>,
2787 {
2788 self.0.request.query = std::option::Option::Some(v.into());
2789 self
2790 }
2791
2792 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
2796 where
2797 T: std::convert::Into<crate::model::TextInput>,
2798 {
2799 self.0.request.query = v.map(|x| x.into());
2800 self
2801 }
2802
2803 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
2805 self.0.request.serving_config = v.into();
2806 self
2807 }
2808
2809 pub fn set_conversation<T>(mut self, v: T) -> Self
2811 where
2812 T: std::convert::Into<crate::model::Conversation>,
2813 {
2814 self.0.request.conversation = std::option::Option::Some(v.into());
2815 self
2816 }
2817
2818 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2820 where
2821 T: std::convert::Into<crate::model::Conversation>,
2822 {
2823 self.0.request.conversation = v.map(|x| x.into());
2824 self
2825 }
2826
2827 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
2829 self.0.request.safe_search = v.into();
2830 self
2831 }
2832
2833 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
2835 where
2836 T: std::iter::IntoIterator<Item = (K, V)>,
2837 K: std::convert::Into<std::string::String>,
2838 V: std::convert::Into<std::string::String>,
2839 {
2840 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2841 self
2842 }
2843
2844 pub fn set_summary_spec<T>(mut self, v: T) -> Self
2846 where
2847 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2848 {
2849 self.0.request.summary_spec = std::option::Option::Some(v.into());
2850 self
2851 }
2852
2853 pub fn set_or_clear_summary_spec<T>(mut self, v: std::option::Option<T>) -> Self
2855 where
2856 T: std::convert::Into<crate::model::search_request::content_search_spec::SummarySpec>,
2857 {
2858 self.0.request.summary_spec = v.map(|x| x.into());
2859 self
2860 }
2861
2862 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2864 self.0.request.filter = v.into();
2865 self
2866 }
2867
2868 pub fn set_boost_spec<T>(mut self, v: T) -> Self
2870 where
2871 T: std::convert::Into<crate::model::search_request::BoostSpec>,
2872 {
2873 self.0.request.boost_spec = std::option::Option::Some(v.into());
2874 self
2875 }
2876
2877 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
2879 where
2880 T: std::convert::Into<crate::model::search_request::BoostSpec>,
2881 {
2882 self.0.request.boost_spec = v.map(|x| x.into());
2883 self
2884 }
2885 }
2886
2887 #[doc(hidden)]
2888 impl gax::options::internal::RequestBuilder for ConverseConversation {
2889 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2890 &mut self.0.options
2891 }
2892 }
2893
2894 #[derive(Clone, Debug)]
2912 pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
2913
2914 impl CreateConversation {
2915 pub(crate) fn new(
2916 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
2917 ) -> Self {
2918 Self(RequestBuilder::new(stub))
2919 }
2920
2921 pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
2923 mut self,
2924 v: V,
2925 ) -> Self {
2926 self.0.request = v.into();
2927 self
2928 }
2929
2930 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2932 self.0.options = v.into();
2933 self
2934 }
2935
2936 pub async fn send(self) -> Result<crate::model::Conversation> {
2938 (*self.0.stub)
2939 .create_conversation(self.0.request, self.0.options)
2940 .await
2941 .map(gax::response::Response::into_body)
2942 }
2943
2944 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2948 self.0.request.parent = v.into();
2949 self
2950 }
2951
2952 pub fn set_conversation<T>(mut self, v: T) -> Self
2956 where
2957 T: std::convert::Into<crate::model::Conversation>,
2958 {
2959 self.0.request.conversation = std::option::Option::Some(v.into());
2960 self
2961 }
2962
2963 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
2967 where
2968 T: std::convert::Into<crate::model::Conversation>,
2969 {
2970 self.0.request.conversation = v.map(|x| x.into());
2971 self
2972 }
2973 }
2974
2975 #[doc(hidden)]
2976 impl gax::options::internal::RequestBuilder for CreateConversation {
2977 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2978 &mut self.0.options
2979 }
2980 }
2981
2982 #[derive(Clone, Debug)]
3000 pub struct DeleteConversation(RequestBuilder<crate::model::DeleteConversationRequest>);
3001
3002 impl DeleteConversation {
3003 pub(crate) fn new(
3004 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3005 ) -> Self {
3006 Self(RequestBuilder::new(stub))
3007 }
3008
3009 pub fn with_request<V: Into<crate::model::DeleteConversationRequest>>(
3011 mut self,
3012 v: V,
3013 ) -> Self {
3014 self.0.request = v.into();
3015 self
3016 }
3017
3018 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3020 self.0.options = v.into();
3021 self
3022 }
3023
3024 pub async fn send(self) -> Result<()> {
3026 (*self.0.stub)
3027 .delete_conversation(self.0.request, self.0.options)
3028 .await
3029 .map(gax::response::Response::into_body)
3030 }
3031
3032 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3036 self.0.request.name = v.into();
3037 self
3038 }
3039 }
3040
3041 #[doc(hidden)]
3042 impl gax::options::internal::RequestBuilder for DeleteConversation {
3043 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3044 &mut self.0.options
3045 }
3046 }
3047
3048 #[derive(Clone, Debug)]
3066 pub struct UpdateConversation(RequestBuilder<crate::model::UpdateConversationRequest>);
3067
3068 impl UpdateConversation {
3069 pub(crate) fn new(
3070 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3071 ) -> Self {
3072 Self(RequestBuilder::new(stub))
3073 }
3074
3075 pub fn with_request<V: Into<crate::model::UpdateConversationRequest>>(
3077 mut self,
3078 v: V,
3079 ) -> Self {
3080 self.0.request = v.into();
3081 self
3082 }
3083
3084 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3086 self.0.options = v.into();
3087 self
3088 }
3089
3090 pub async fn send(self) -> Result<crate::model::Conversation> {
3092 (*self.0.stub)
3093 .update_conversation(self.0.request, self.0.options)
3094 .await
3095 .map(gax::response::Response::into_body)
3096 }
3097
3098 pub fn set_conversation<T>(mut self, v: T) -> Self
3102 where
3103 T: std::convert::Into<crate::model::Conversation>,
3104 {
3105 self.0.request.conversation = std::option::Option::Some(v.into());
3106 self
3107 }
3108
3109 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3113 where
3114 T: std::convert::Into<crate::model::Conversation>,
3115 {
3116 self.0.request.conversation = v.map(|x| x.into());
3117 self
3118 }
3119
3120 pub fn set_update_mask<T>(mut self, v: T) -> Self
3122 where
3123 T: std::convert::Into<wkt::FieldMask>,
3124 {
3125 self.0.request.update_mask = std::option::Option::Some(v.into());
3126 self
3127 }
3128
3129 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3131 where
3132 T: std::convert::Into<wkt::FieldMask>,
3133 {
3134 self.0.request.update_mask = v.map(|x| x.into());
3135 self
3136 }
3137 }
3138
3139 #[doc(hidden)]
3140 impl gax::options::internal::RequestBuilder for UpdateConversation {
3141 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3142 &mut self.0.options
3143 }
3144 }
3145
3146 #[derive(Clone, Debug)]
3164 pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3165
3166 impl GetConversation {
3167 pub(crate) fn new(
3168 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3169 ) -> Self {
3170 Self(RequestBuilder::new(stub))
3171 }
3172
3173 pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3175 self.0.request = v.into();
3176 self
3177 }
3178
3179 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3181 self.0.options = v.into();
3182 self
3183 }
3184
3185 pub async fn send(self) -> Result<crate::model::Conversation> {
3187 (*self.0.stub)
3188 .get_conversation(self.0.request, self.0.options)
3189 .await
3190 .map(gax::response::Response::into_body)
3191 }
3192
3193 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3197 self.0.request.name = v.into();
3198 self
3199 }
3200 }
3201
3202 #[doc(hidden)]
3203 impl gax::options::internal::RequestBuilder for GetConversation {
3204 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3205 &mut self.0.options
3206 }
3207 }
3208
3209 #[derive(Clone, Debug)]
3231 pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3232
3233 impl ListConversations {
3234 pub(crate) fn new(
3235 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3236 ) -> Self {
3237 Self(RequestBuilder::new(stub))
3238 }
3239
3240 pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3242 mut self,
3243 v: V,
3244 ) -> Self {
3245 self.0.request = v.into();
3246 self
3247 }
3248
3249 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3251 self.0.options = v.into();
3252 self
3253 }
3254
3255 pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3257 (*self.0.stub)
3258 .list_conversations(self.0.request, self.0.options)
3259 .await
3260 .map(gax::response::Response::into_body)
3261 }
3262
3263 pub fn by_page(
3265 self,
3266 ) -> impl gax::paginator::Paginator<crate::model::ListConversationsResponse, gax::error::Error>
3267 {
3268 use std::clone::Clone;
3269 let token = self.0.request.page_token.clone();
3270 let execute = move |token: String| {
3271 let mut builder = self.clone();
3272 builder.0.request = builder.0.request.set_page_token(token);
3273 builder.send()
3274 };
3275 gax::paginator::internal::new_paginator(token, execute)
3276 }
3277
3278 pub fn by_item(
3280 self,
3281 ) -> impl gax::paginator::ItemPaginator<crate::model::ListConversationsResponse, gax::error::Error>
3282 {
3283 use gax::paginator::Paginator;
3284 self.by_page().items()
3285 }
3286
3287 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3291 self.0.request.parent = v.into();
3292 self
3293 }
3294
3295 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3297 self.0.request.page_size = v.into();
3298 self
3299 }
3300
3301 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3303 self.0.request.page_token = v.into();
3304 self
3305 }
3306
3307 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3309 self.0.request.filter = v.into();
3310 self
3311 }
3312
3313 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
3315 self.0.request.order_by = v.into();
3316 self
3317 }
3318 }
3319
3320 #[doc(hidden)]
3321 impl gax::options::internal::RequestBuilder for ListConversations {
3322 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3323 &mut self.0.options
3324 }
3325 }
3326
3327 #[derive(Clone, Debug)]
3345 pub struct AnswerQuery(RequestBuilder<crate::model::AnswerQueryRequest>);
3346
3347 impl AnswerQuery {
3348 pub(crate) fn new(
3349 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3350 ) -> Self {
3351 Self(RequestBuilder::new(stub))
3352 }
3353
3354 pub fn with_request<V: Into<crate::model::AnswerQueryRequest>>(mut self, v: V) -> Self {
3356 self.0.request = v.into();
3357 self
3358 }
3359
3360 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3362 self.0.options = v.into();
3363 self
3364 }
3365
3366 pub async fn send(self) -> Result<crate::model::AnswerQueryResponse> {
3368 (*self.0.stub)
3369 .answer_query(self.0.request, self.0.options)
3370 .await
3371 .map(gax::response::Response::into_body)
3372 }
3373
3374 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
3378 self.0.request.serving_config = v.into();
3379 self
3380 }
3381
3382 pub fn set_query<T>(mut self, v: T) -> Self
3386 where
3387 T: std::convert::Into<crate::model::Query>,
3388 {
3389 self.0.request.query = std::option::Option::Some(v.into());
3390 self
3391 }
3392
3393 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3397 where
3398 T: std::convert::Into<crate::model::Query>,
3399 {
3400 self.0.request.query = v.map(|x| x.into());
3401 self
3402 }
3403
3404 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
3406 self.0.request.session = v.into();
3407 self
3408 }
3409
3410 pub fn set_safety_spec<T>(mut self, v: T) -> Self
3412 where
3413 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3414 {
3415 self.0.request.safety_spec = std::option::Option::Some(v.into());
3416 self
3417 }
3418
3419 pub fn set_or_clear_safety_spec<T>(mut self, v: std::option::Option<T>) -> Self
3421 where
3422 T: std::convert::Into<crate::model::answer_query_request::SafetySpec>,
3423 {
3424 self.0.request.safety_spec = v.map(|x| x.into());
3425 self
3426 }
3427
3428 pub fn set_related_questions_spec<T>(mut self, v: T) -> Self
3430 where
3431 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3432 {
3433 self.0.request.related_questions_spec = std::option::Option::Some(v.into());
3434 self
3435 }
3436
3437 pub fn set_or_clear_related_questions_spec<T>(mut self, v: std::option::Option<T>) -> Self
3439 where
3440 T: std::convert::Into<crate::model::answer_query_request::RelatedQuestionsSpec>,
3441 {
3442 self.0.request.related_questions_spec = v.map(|x| x.into());
3443 self
3444 }
3445
3446 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
3448 where
3449 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3450 {
3451 self.0.request.grounding_spec = std::option::Option::Some(v.into());
3452 self
3453 }
3454
3455 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3457 where
3458 T: std::convert::Into<crate::model::answer_query_request::GroundingSpec>,
3459 {
3460 self.0.request.grounding_spec = v.map(|x| x.into());
3461 self
3462 }
3463
3464 pub fn set_answer_generation_spec<T>(mut self, v: T) -> Self
3466 where
3467 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3468 {
3469 self.0.request.answer_generation_spec = std::option::Option::Some(v.into());
3470 self
3471 }
3472
3473 pub fn set_or_clear_answer_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
3475 where
3476 T: std::convert::Into<crate::model::answer_query_request::AnswerGenerationSpec>,
3477 {
3478 self.0.request.answer_generation_spec = v.map(|x| x.into());
3479 self
3480 }
3481
3482 pub fn set_search_spec<T>(mut self, v: T) -> Self
3484 where
3485 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3486 {
3487 self.0.request.search_spec = std::option::Option::Some(v.into());
3488 self
3489 }
3490
3491 pub fn set_or_clear_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
3493 where
3494 T: std::convert::Into<crate::model::answer_query_request::SearchSpec>,
3495 {
3496 self.0.request.search_spec = v.map(|x| x.into());
3497 self
3498 }
3499
3500 pub fn set_query_understanding_spec<T>(mut self, v: T) -> Self
3502 where
3503 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3504 {
3505 self.0.request.query_understanding_spec = std::option::Option::Some(v.into());
3506 self
3507 }
3508
3509 pub fn set_or_clear_query_understanding_spec<T>(mut self, v: std::option::Option<T>) -> Self
3511 where
3512 T: std::convert::Into<crate::model::answer_query_request::QueryUnderstandingSpec>,
3513 {
3514 self.0.request.query_understanding_spec = v.map(|x| x.into());
3515 self
3516 }
3517
3518 #[deprecated]
3520 pub fn set_asynchronous_mode<T: Into<bool>>(mut self, v: T) -> Self {
3521 self.0.request.asynchronous_mode = v.into();
3522 self
3523 }
3524
3525 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3527 self.0.request.user_pseudo_id = v.into();
3528 self
3529 }
3530
3531 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
3533 where
3534 T: std::iter::IntoIterator<Item = (K, V)>,
3535 K: std::convert::Into<std::string::String>,
3536 V: std::convert::Into<std::string::String>,
3537 {
3538 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3539 self
3540 }
3541
3542 pub fn set_end_user_spec<T>(mut self, v: T) -> Self
3544 where
3545 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3546 {
3547 self.0.request.end_user_spec = std::option::Option::Some(v.into());
3548 self
3549 }
3550
3551 pub fn set_or_clear_end_user_spec<T>(mut self, v: std::option::Option<T>) -> Self
3553 where
3554 T: std::convert::Into<crate::model::answer_query_request::EndUserSpec>,
3555 {
3556 self.0.request.end_user_spec = v.map(|x| x.into());
3557 self
3558 }
3559 }
3560
3561 #[doc(hidden)]
3562 impl gax::options::internal::RequestBuilder for AnswerQuery {
3563 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3564 &mut self.0.options
3565 }
3566 }
3567
3568 #[derive(Clone, Debug)]
3586 pub struct GetAnswer(RequestBuilder<crate::model::GetAnswerRequest>);
3587
3588 impl GetAnswer {
3589 pub(crate) fn new(
3590 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3591 ) -> Self {
3592 Self(RequestBuilder::new(stub))
3593 }
3594
3595 pub fn with_request<V: Into<crate::model::GetAnswerRequest>>(mut self, v: V) -> Self {
3597 self.0.request = v.into();
3598 self
3599 }
3600
3601 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3603 self.0.options = v.into();
3604 self
3605 }
3606
3607 pub async fn send(self) -> Result<crate::model::Answer> {
3609 (*self.0.stub)
3610 .get_answer(self.0.request, self.0.options)
3611 .await
3612 .map(gax::response::Response::into_body)
3613 }
3614
3615 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3619 self.0.request.name = v.into();
3620 self
3621 }
3622 }
3623
3624 #[doc(hidden)]
3625 impl gax::options::internal::RequestBuilder for GetAnswer {
3626 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3627 &mut self.0.options
3628 }
3629 }
3630
3631 #[derive(Clone, Debug)]
3649 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
3650
3651 impl CreateSession {
3652 pub(crate) fn new(
3653 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3654 ) -> Self {
3655 Self(RequestBuilder::new(stub))
3656 }
3657
3658 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
3660 self.0.request = v.into();
3661 self
3662 }
3663
3664 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3666 self.0.options = v.into();
3667 self
3668 }
3669
3670 pub async fn send(self) -> Result<crate::model::Session> {
3672 (*self.0.stub)
3673 .create_session(self.0.request, self.0.options)
3674 .await
3675 .map(gax::response::Response::into_body)
3676 }
3677
3678 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3682 self.0.request.parent = v.into();
3683 self
3684 }
3685
3686 pub fn set_session<T>(mut self, v: T) -> Self
3690 where
3691 T: std::convert::Into<crate::model::Session>,
3692 {
3693 self.0.request.session = std::option::Option::Some(v.into());
3694 self
3695 }
3696
3697 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3701 where
3702 T: std::convert::Into<crate::model::Session>,
3703 {
3704 self.0.request.session = v.map(|x| x.into());
3705 self
3706 }
3707 }
3708
3709 #[doc(hidden)]
3710 impl gax::options::internal::RequestBuilder for CreateSession {
3711 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3712 &mut self.0.options
3713 }
3714 }
3715
3716 #[derive(Clone, Debug)]
3734 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
3735
3736 impl DeleteSession {
3737 pub(crate) fn new(
3738 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3739 ) -> Self {
3740 Self(RequestBuilder::new(stub))
3741 }
3742
3743 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
3745 self.0.request = v.into();
3746 self
3747 }
3748
3749 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3751 self.0.options = v.into();
3752 self
3753 }
3754
3755 pub async fn send(self) -> Result<()> {
3757 (*self.0.stub)
3758 .delete_session(self.0.request, self.0.options)
3759 .await
3760 .map(gax::response::Response::into_body)
3761 }
3762
3763 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3767 self.0.request.name = v.into();
3768 self
3769 }
3770 }
3771
3772 #[doc(hidden)]
3773 impl gax::options::internal::RequestBuilder for DeleteSession {
3774 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3775 &mut self.0.options
3776 }
3777 }
3778
3779 #[derive(Clone, Debug)]
3797 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
3798
3799 impl UpdateSession {
3800 pub(crate) fn new(
3801 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3802 ) -> Self {
3803 Self(RequestBuilder::new(stub))
3804 }
3805
3806 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
3808 self.0.request = v.into();
3809 self
3810 }
3811
3812 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3814 self.0.options = v.into();
3815 self
3816 }
3817
3818 pub async fn send(self) -> Result<crate::model::Session> {
3820 (*self.0.stub)
3821 .update_session(self.0.request, self.0.options)
3822 .await
3823 .map(gax::response::Response::into_body)
3824 }
3825
3826 pub fn set_session<T>(mut self, v: T) -> Self
3830 where
3831 T: std::convert::Into<crate::model::Session>,
3832 {
3833 self.0.request.session = std::option::Option::Some(v.into());
3834 self
3835 }
3836
3837 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
3841 where
3842 T: std::convert::Into<crate::model::Session>,
3843 {
3844 self.0.request.session = v.map(|x| x.into());
3845 self
3846 }
3847
3848 pub fn set_update_mask<T>(mut self, v: T) -> Self
3850 where
3851 T: std::convert::Into<wkt::FieldMask>,
3852 {
3853 self.0.request.update_mask = std::option::Option::Some(v.into());
3854 self
3855 }
3856
3857 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3859 where
3860 T: std::convert::Into<wkt::FieldMask>,
3861 {
3862 self.0.request.update_mask = v.map(|x| x.into());
3863 self
3864 }
3865 }
3866
3867 #[doc(hidden)]
3868 impl gax::options::internal::RequestBuilder for UpdateSession {
3869 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3870 &mut self.0.options
3871 }
3872 }
3873
3874 #[derive(Clone, Debug)]
3892 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
3893
3894 impl GetSession {
3895 pub(crate) fn new(
3896 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3897 ) -> Self {
3898 Self(RequestBuilder::new(stub))
3899 }
3900
3901 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
3903 self.0.request = v.into();
3904 self
3905 }
3906
3907 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3909 self.0.options = v.into();
3910 self
3911 }
3912
3913 pub async fn send(self) -> Result<crate::model::Session> {
3915 (*self.0.stub)
3916 .get_session(self.0.request, self.0.options)
3917 .await
3918 .map(gax::response::Response::into_body)
3919 }
3920
3921 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3925 self.0.request.name = v.into();
3926 self
3927 }
3928
3929 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
3931 self.0.request.include_answer_details = v.into();
3932 self
3933 }
3934 }
3935
3936 #[doc(hidden)]
3937 impl gax::options::internal::RequestBuilder for GetSession {
3938 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3939 &mut self.0.options
3940 }
3941 }
3942
3943 #[derive(Clone, Debug)]
3965 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
3966
3967 impl ListSessions {
3968 pub(crate) fn new(
3969 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
3970 ) -> Self {
3971 Self(RequestBuilder::new(stub))
3972 }
3973
3974 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
3976 self.0.request = v.into();
3977 self
3978 }
3979
3980 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3982 self.0.options = v.into();
3983 self
3984 }
3985
3986 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
3988 (*self.0.stub)
3989 .list_sessions(self.0.request, self.0.options)
3990 .await
3991 .map(gax::response::Response::into_body)
3992 }
3993
3994 pub fn by_page(
3996 self,
3997 ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
3998 {
3999 use std::clone::Clone;
4000 let token = self.0.request.page_token.clone();
4001 let execute = move |token: String| {
4002 let mut builder = self.clone();
4003 builder.0.request = builder.0.request.set_page_token(token);
4004 builder.send()
4005 };
4006 gax::paginator::internal::new_paginator(token, execute)
4007 }
4008
4009 pub fn by_item(
4011 self,
4012 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
4013 {
4014 use gax::paginator::Paginator;
4015 self.by_page().items()
4016 }
4017
4018 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4022 self.0.request.parent = v.into();
4023 self
4024 }
4025
4026 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4028 self.0.request.page_size = v.into();
4029 self
4030 }
4031
4032 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4034 self.0.request.page_token = v.into();
4035 self
4036 }
4037
4038 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4040 self.0.request.filter = v.into();
4041 self
4042 }
4043
4044 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
4046 self.0.request.order_by = v.into();
4047 self
4048 }
4049 }
4050
4051 #[doc(hidden)]
4052 impl gax::options::internal::RequestBuilder for ListSessions {
4053 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4054 &mut self.0.options
4055 }
4056 }
4057
4058 #[derive(Clone, Debug)]
4080 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4081
4082 impl ListOperations {
4083 pub(crate) fn new(
4084 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4085 ) -> Self {
4086 Self(RequestBuilder::new(stub))
4087 }
4088
4089 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4091 mut self,
4092 v: V,
4093 ) -> Self {
4094 self.0.request = v.into();
4095 self
4096 }
4097
4098 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4100 self.0.options = v.into();
4101 self
4102 }
4103
4104 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4106 (*self.0.stub)
4107 .list_operations(self.0.request, self.0.options)
4108 .await
4109 .map(gax::response::Response::into_body)
4110 }
4111
4112 pub fn by_page(
4114 self,
4115 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4116 {
4117 use std::clone::Clone;
4118 let token = self.0.request.page_token.clone();
4119 let execute = move |token: String| {
4120 let mut builder = self.clone();
4121 builder.0.request = builder.0.request.set_page_token(token);
4122 builder.send()
4123 };
4124 gax::paginator::internal::new_paginator(token, execute)
4125 }
4126
4127 pub fn by_item(
4129 self,
4130 ) -> impl gax::paginator::ItemPaginator<
4131 longrunning::model::ListOperationsResponse,
4132 gax::error::Error,
4133 > {
4134 use gax::paginator::Paginator;
4135 self.by_page().items()
4136 }
4137
4138 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4140 self.0.request.name = v.into();
4141 self
4142 }
4143
4144 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4146 self.0.request.filter = v.into();
4147 self
4148 }
4149
4150 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4152 self.0.request.page_size = v.into();
4153 self
4154 }
4155
4156 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4158 self.0.request.page_token = v.into();
4159 self
4160 }
4161 }
4162
4163 #[doc(hidden)]
4164 impl gax::options::internal::RequestBuilder for ListOperations {
4165 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4166 &mut self.0.options
4167 }
4168 }
4169
4170 #[derive(Clone, Debug)]
4188 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4189
4190 impl GetOperation {
4191 pub(crate) fn new(
4192 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4193 ) -> Self {
4194 Self(RequestBuilder::new(stub))
4195 }
4196
4197 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4199 mut self,
4200 v: V,
4201 ) -> Self {
4202 self.0.request = v.into();
4203 self
4204 }
4205
4206 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4208 self.0.options = v.into();
4209 self
4210 }
4211
4212 pub async fn send(self) -> Result<longrunning::model::Operation> {
4214 (*self.0.stub)
4215 .get_operation(self.0.request, self.0.options)
4216 .await
4217 .map(gax::response::Response::into_body)
4218 }
4219
4220 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4222 self.0.request.name = v.into();
4223 self
4224 }
4225 }
4226
4227 #[doc(hidden)]
4228 impl gax::options::internal::RequestBuilder for GetOperation {
4229 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4230 &mut self.0.options
4231 }
4232 }
4233
4234 #[derive(Clone, Debug)]
4252 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
4253
4254 impl CancelOperation {
4255 pub(crate) fn new(
4256 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationalSearchService>,
4257 ) -> Self {
4258 Self(RequestBuilder::new(stub))
4259 }
4260
4261 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
4263 mut self,
4264 v: V,
4265 ) -> Self {
4266 self.0.request = v.into();
4267 self
4268 }
4269
4270 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4272 self.0.options = v.into();
4273 self
4274 }
4275
4276 pub async fn send(self) -> Result<()> {
4278 (*self.0.stub)
4279 .cancel_operation(self.0.request, self.0.options)
4280 .await
4281 .map(gax::response::Response::into_body)
4282 }
4283
4284 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4286 self.0.request.name = v.into();
4287 self
4288 }
4289 }
4290
4291 #[doc(hidden)]
4292 impl gax::options::internal::RequestBuilder for CancelOperation {
4293 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4294 &mut self.0.options
4295 }
4296 }
4297}
4298
4299#[cfg(feature = "data-store-service")]
4300#[cfg_attr(docsrs, doc(cfg(feature = "data-store-service")))]
4301pub mod data_store_service {
4302 use crate::Result;
4303
4304 pub type ClientBuilder =
4318 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4319
4320 pub(crate) mod client {
4321 use super::super::super::client::DataStoreService;
4322 pub struct Factory;
4323 impl gax::client_builder::internal::ClientFactory for Factory {
4324 type Client = DataStoreService;
4325 type Credentials = gaxi::options::Credentials;
4326 async fn build(
4327 self,
4328 config: gaxi::options::ClientConfig,
4329 ) -> gax::client_builder::Result<Self::Client> {
4330 Self::Client::new(config).await
4331 }
4332 }
4333 }
4334
4335 #[derive(Clone, Debug)]
4337 pub(crate) struct RequestBuilder<R: std::default::Default> {
4338 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4339 request: R,
4340 options: gax::options::RequestOptions,
4341 }
4342
4343 impl<R> RequestBuilder<R>
4344 where
4345 R: std::default::Default,
4346 {
4347 pub(crate) fn new(
4348 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4349 ) -> Self {
4350 Self {
4351 stub,
4352 request: R::default(),
4353 options: gax::options::RequestOptions::default(),
4354 }
4355 }
4356 }
4357
4358 #[derive(Clone, Debug)]
4377 pub struct CreateDataStore(RequestBuilder<crate::model::CreateDataStoreRequest>);
4378
4379 impl CreateDataStore {
4380 pub(crate) fn new(
4381 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4382 ) -> Self {
4383 Self(RequestBuilder::new(stub))
4384 }
4385
4386 pub fn with_request<V: Into<crate::model::CreateDataStoreRequest>>(mut self, v: V) -> Self {
4388 self.0.request = v.into();
4389 self
4390 }
4391
4392 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4394 self.0.options = v.into();
4395 self
4396 }
4397
4398 pub async fn send(self) -> Result<longrunning::model::Operation> {
4405 (*self.0.stub)
4406 .create_data_store(self.0.request, self.0.options)
4407 .await
4408 .map(gax::response::Response::into_body)
4409 }
4410
4411 pub fn poller(
4413 self,
4414 ) -> impl lro::Poller<crate::model::DataStore, crate::model::CreateDataStoreMetadata>
4415 {
4416 type Operation = lro::internal::Operation<
4417 crate::model::DataStore,
4418 crate::model::CreateDataStoreMetadata,
4419 >;
4420 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4421 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4422
4423 let stub = self.0.stub.clone();
4424 let mut options = self.0.options.clone();
4425 options.set_retry_policy(gax::retry_policy::NeverRetry);
4426 let query = move |name| {
4427 let stub = stub.clone();
4428 let options = options.clone();
4429 async {
4430 let op = GetOperation::new(stub)
4431 .set_name(name)
4432 .with_options(options)
4433 .send()
4434 .await?;
4435 Ok(Operation::new(op))
4436 }
4437 };
4438
4439 let start = move || async {
4440 let op = self.send().await?;
4441 Ok(Operation::new(op))
4442 };
4443
4444 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4445 }
4446
4447 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4451 self.0.request.parent = v.into();
4452 self
4453 }
4454
4455 pub fn set_data_store<T>(mut self, v: T) -> Self
4459 where
4460 T: std::convert::Into<crate::model::DataStore>,
4461 {
4462 self.0.request.data_store = std::option::Option::Some(v.into());
4463 self
4464 }
4465
4466 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4470 where
4471 T: std::convert::Into<crate::model::DataStore>,
4472 {
4473 self.0.request.data_store = v.map(|x| x.into());
4474 self
4475 }
4476
4477 pub fn set_data_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4481 self.0.request.data_store_id = v.into();
4482 self
4483 }
4484
4485 pub fn set_create_advanced_site_search<T: Into<bool>>(mut self, v: T) -> Self {
4487 self.0.request.create_advanced_site_search = v.into();
4488 self
4489 }
4490
4491 pub fn set_skip_default_schema_creation<T: Into<bool>>(mut self, v: T) -> Self {
4493 self.0.request.skip_default_schema_creation = v.into();
4494 self
4495 }
4496
4497 pub fn set_cmek_options<
4502 T: Into<Option<crate::model::create_data_store_request::CmekOptions>>,
4503 >(
4504 mut self,
4505 v: T,
4506 ) -> Self {
4507 self.0.request.cmek_options = v.into();
4508 self
4509 }
4510
4511 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
4517 mut self,
4518 v: T,
4519 ) -> Self {
4520 self.0.request = self.0.request.set_cmek_config_name(v);
4521 self
4522 }
4523
4524 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4530 self.0.request = self.0.request.set_disable_cmek(v);
4531 self
4532 }
4533 }
4534
4535 #[doc(hidden)]
4536 impl gax::options::internal::RequestBuilder for CreateDataStore {
4537 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4538 &mut self.0.options
4539 }
4540 }
4541
4542 #[derive(Clone, Debug)]
4560 pub struct GetDataStore(RequestBuilder<crate::model::GetDataStoreRequest>);
4561
4562 impl GetDataStore {
4563 pub(crate) fn new(
4564 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4565 ) -> Self {
4566 Self(RequestBuilder::new(stub))
4567 }
4568
4569 pub fn with_request<V: Into<crate::model::GetDataStoreRequest>>(mut self, v: V) -> Self {
4571 self.0.request = v.into();
4572 self
4573 }
4574
4575 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4577 self.0.options = v.into();
4578 self
4579 }
4580
4581 pub async fn send(self) -> Result<crate::model::DataStore> {
4583 (*self.0.stub)
4584 .get_data_store(self.0.request, self.0.options)
4585 .await
4586 .map(gax::response::Response::into_body)
4587 }
4588
4589 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4593 self.0.request.name = v.into();
4594 self
4595 }
4596 }
4597
4598 #[doc(hidden)]
4599 impl gax::options::internal::RequestBuilder for GetDataStore {
4600 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4601 &mut self.0.options
4602 }
4603 }
4604
4605 #[derive(Clone, Debug)]
4627 pub struct ListDataStores(RequestBuilder<crate::model::ListDataStoresRequest>);
4628
4629 impl ListDataStores {
4630 pub(crate) fn new(
4631 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4632 ) -> Self {
4633 Self(RequestBuilder::new(stub))
4634 }
4635
4636 pub fn with_request<V: Into<crate::model::ListDataStoresRequest>>(mut self, v: V) -> Self {
4638 self.0.request = v.into();
4639 self
4640 }
4641
4642 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4644 self.0.options = v.into();
4645 self
4646 }
4647
4648 pub async fn send(self) -> Result<crate::model::ListDataStoresResponse> {
4650 (*self.0.stub)
4651 .list_data_stores(self.0.request, self.0.options)
4652 .await
4653 .map(gax::response::Response::into_body)
4654 }
4655
4656 pub fn by_page(
4658 self,
4659 ) -> impl gax::paginator::Paginator<crate::model::ListDataStoresResponse, gax::error::Error>
4660 {
4661 use std::clone::Clone;
4662 let token = self.0.request.page_token.clone();
4663 let execute = move |token: String| {
4664 let mut builder = self.clone();
4665 builder.0.request = builder.0.request.set_page_token(token);
4666 builder.send()
4667 };
4668 gax::paginator::internal::new_paginator(token, execute)
4669 }
4670
4671 pub fn by_item(
4673 self,
4674 ) -> impl gax::paginator::ItemPaginator<crate::model::ListDataStoresResponse, gax::error::Error>
4675 {
4676 use gax::paginator::Paginator;
4677 self.by_page().items()
4678 }
4679
4680 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4684 self.0.request.parent = v.into();
4685 self
4686 }
4687
4688 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4690 self.0.request.page_size = v.into();
4691 self
4692 }
4693
4694 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4696 self.0.request.page_token = v.into();
4697 self
4698 }
4699
4700 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4702 self.0.request.filter = v.into();
4703 self
4704 }
4705 }
4706
4707 #[doc(hidden)]
4708 impl gax::options::internal::RequestBuilder for ListDataStores {
4709 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4710 &mut self.0.options
4711 }
4712 }
4713
4714 #[derive(Clone, Debug)]
4733 pub struct DeleteDataStore(RequestBuilder<crate::model::DeleteDataStoreRequest>);
4734
4735 impl DeleteDataStore {
4736 pub(crate) fn new(
4737 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4738 ) -> Self {
4739 Self(RequestBuilder::new(stub))
4740 }
4741
4742 pub fn with_request<V: Into<crate::model::DeleteDataStoreRequest>>(mut self, v: V) -> Self {
4744 self.0.request = v.into();
4745 self
4746 }
4747
4748 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4750 self.0.options = v.into();
4751 self
4752 }
4753
4754 pub async fn send(self) -> Result<longrunning::model::Operation> {
4761 (*self.0.stub)
4762 .delete_data_store(self.0.request, self.0.options)
4763 .await
4764 .map(gax::response::Response::into_body)
4765 }
4766
4767 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteDataStoreMetadata> {
4769 type Operation =
4770 lro::internal::Operation<wkt::Empty, crate::model::DeleteDataStoreMetadata>;
4771 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4772 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4773
4774 let stub = self.0.stub.clone();
4775 let mut options = self.0.options.clone();
4776 options.set_retry_policy(gax::retry_policy::NeverRetry);
4777 let query = move |name| {
4778 let stub = stub.clone();
4779 let options = options.clone();
4780 async {
4781 let op = GetOperation::new(stub)
4782 .set_name(name)
4783 .with_options(options)
4784 .send()
4785 .await?;
4786 Ok(Operation::new(op))
4787 }
4788 };
4789
4790 let start = move || async {
4791 let op = self.send().await?;
4792 Ok(Operation::new(op))
4793 };
4794
4795 lro::internal::new_unit_response_poller(
4796 polling_error_policy,
4797 polling_backoff_policy,
4798 start,
4799 query,
4800 )
4801 }
4802
4803 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4807 self.0.request.name = v.into();
4808 self
4809 }
4810 }
4811
4812 #[doc(hidden)]
4813 impl gax::options::internal::RequestBuilder for DeleteDataStore {
4814 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4815 &mut self.0.options
4816 }
4817 }
4818
4819 #[derive(Clone, Debug)]
4837 pub struct UpdateDataStore(RequestBuilder<crate::model::UpdateDataStoreRequest>);
4838
4839 impl UpdateDataStore {
4840 pub(crate) fn new(
4841 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4842 ) -> Self {
4843 Self(RequestBuilder::new(stub))
4844 }
4845
4846 pub fn with_request<V: Into<crate::model::UpdateDataStoreRequest>>(mut self, v: V) -> Self {
4848 self.0.request = v.into();
4849 self
4850 }
4851
4852 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4854 self.0.options = v.into();
4855 self
4856 }
4857
4858 pub async fn send(self) -> Result<crate::model::DataStore> {
4860 (*self.0.stub)
4861 .update_data_store(self.0.request, self.0.options)
4862 .await
4863 .map(gax::response::Response::into_body)
4864 }
4865
4866 pub fn set_data_store<T>(mut self, v: T) -> Self
4870 where
4871 T: std::convert::Into<crate::model::DataStore>,
4872 {
4873 self.0.request.data_store = std::option::Option::Some(v.into());
4874 self
4875 }
4876
4877 pub fn set_or_clear_data_store<T>(mut self, v: std::option::Option<T>) -> Self
4881 where
4882 T: std::convert::Into<crate::model::DataStore>,
4883 {
4884 self.0.request.data_store = v.map(|x| x.into());
4885 self
4886 }
4887
4888 pub fn set_update_mask<T>(mut self, v: T) -> Self
4890 where
4891 T: std::convert::Into<wkt::FieldMask>,
4892 {
4893 self.0.request.update_mask = std::option::Option::Some(v.into());
4894 self
4895 }
4896
4897 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4899 where
4900 T: std::convert::Into<wkt::FieldMask>,
4901 {
4902 self.0.request.update_mask = v.map(|x| x.into());
4903 self
4904 }
4905 }
4906
4907 #[doc(hidden)]
4908 impl gax::options::internal::RequestBuilder for UpdateDataStore {
4909 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4910 &mut self.0.options
4911 }
4912 }
4913
4914 #[derive(Clone, Debug)]
4936 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4937
4938 impl ListOperations {
4939 pub(crate) fn new(
4940 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
4941 ) -> Self {
4942 Self(RequestBuilder::new(stub))
4943 }
4944
4945 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4947 mut self,
4948 v: V,
4949 ) -> Self {
4950 self.0.request = v.into();
4951 self
4952 }
4953
4954 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4956 self.0.options = v.into();
4957 self
4958 }
4959
4960 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4962 (*self.0.stub)
4963 .list_operations(self.0.request, self.0.options)
4964 .await
4965 .map(gax::response::Response::into_body)
4966 }
4967
4968 pub fn by_page(
4970 self,
4971 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4972 {
4973 use std::clone::Clone;
4974 let token = self.0.request.page_token.clone();
4975 let execute = move |token: String| {
4976 let mut builder = self.clone();
4977 builder.0.request = builder.0.request.set_page_token(token);
4978 builder.send()
4979 };
4980 gax::paginator::internal::new_paginator(token, execute)
4981 }
4982
4983 pub fn by_item(
4985 self,
4986 ) -> impl gax::paginator::ItemPaginator<
4987 longrunning::model::ListOperationsResponse,
4988 gax::error::Error,
4989 > {
4990 use gax::paginator::Paginator;
4991 self.by_page().items()
4992 }
4993
4994 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4996 self.0.request.name = v.into();
4997 self
4998 }
4999
5000 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5002 self.0.request.filter = v.into();
5003 self
5004 }
5005
5006 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5008 self.0.request.page_size = v.into();
5009 self
5010 }
5011
5012 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5014 self.0.request.page_token = v.into();
5015 self
5016 }
5017 }
5018
5019 #[doc(hidden)]
5020 impl gax::options::internal::RequestBuilder for ListOperations {
5021 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5022 &mut self.0.options
5023 }
5024 }
5025
5026 #[derive(Clone, Debug)]
5044 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5045
5046 impl GetOperation {
5047 pub(crate) fn new(
5048 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5049 ) -> Self {
5050 Self(RequestBuilder::new(stub))
5051 }
5052
5053 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5055 mut self,
5056 v: V,
5057 ) -> Self {
5058 self.0.request = v.into();
5059 self
5060 }
5061
5062 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5064 self.0.options = v.into();
5065 self
5066 }
5067
5068 pub async fn send(self) -> Result<longrunning::model::Operation> {
5070 (*self.0.stub)
5071 .get_operation(self.0.request, self.0.options)
5072 .await
5073 .map(gax::response::Response::into_body)
5074 }
5075
5076 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5078 self.0.request.name = v.into();
5079 self
5080 }
5081 }
5082
5083 #[doc(hidden)]
5084 impl gax::options::internal::RequestBuilder for GetOperation {
5085 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5086 &mut self.0.options
5087 }
5088 }
5089
5090 #[derive(Clone, Debug)]
5108 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5109
5110 impl CancelOperation {
5111 pub(crate) fn new(
5112 stub: std::sync::Arc<dyn super::super::stub::dynamic::DataStoreService>,
5113 ) -> Self {
5114 Self(RequestBuilder::new(stub))
5115 }
5116
5117 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5119 mut self,
5120 v: V,
5121 ) -> Self {
5122 self.0.request = v.into();
5123 self
5124 }
5125
5126 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5128 self.0.options = v.into();
5129 self
5130 }
5131
5132 pub async fn send(self) -> Result<()> {
5134 (*self.0.stub)
5135 .cancel_operation(self.0.request, self.0.options)
5136 .await
5137 .map(gax::response::Response::into_body)
5138 }
5139
5140 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5142 self.0.request.name = v.into();
5143 self
5144 }
5145 }
5146
5147 #[doc(hidden)]
5148 impl gax::options::internal::RequestBuilder for CancelOperation {
5149 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5150 &mut self.0.options
5151 }
5152 }
5153}
5154
5155#[cfg(feature = "document-service")]
5156#[cfg_attr(docsrs, doc(cfg(feature = "document-service")))]
5157pub mod document_service {
5158 use crate::Result;
5159
5160 pub type ClientBuilder =
5174 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5175
5176 pub(crate) mod client {
5177 use super::super::super::client::DocumentService;
5178 pub struct Factory;
5179 impl gax::client_builder::internal::ClientFactory for Factory {
5180 type Client = DocumentService;
5181 type Credentials = gaxi::options::Credentials;
5182 async fn build(
5183 self,
5184 config: gaxi::options::ClientConfig,
5185 ) -> gax::client_builder::Result<Self::Client> {
5186 Self::Client::new(config).await
5187 }
5188 }
5189 }
5190
5191 #[derive(Clone, Debug)]
5193 pub(crate) struct RequestBuilder<R: std::default::Default> {
5194 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5195 request: R,
5196 options: gax::options::RequestOptions,
5197 }
5198
5199 impl<R> RequestBuilder<R>
5200 where
5201 R: std::default::Default,
5202 {
5203 pub(crate) fn new(
5204 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5205 ) -> Self {
5206 Self {
5207 stub,
5208 request: R::default(),
5209 options: gax::options::RequestOptions::default(),
5210 }
5211 }
5212 }
5213
5214 #[derive(Clone, Debug)]
5232 pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
5233
5234 impl GetDocument {
5235 pub(crate) fn new(
5236 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5237 ) -> Self {
5238 Self(RequestBuilder::new(stub))
5239 }
5240
5241 pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
5243 self.0.request = v.into();
5244 self
5245 }
5246
5247 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5249 self.0.options = v.into();
5250 self
5251 }
5252
5253 pub async fn send(self) -> Result<crate::model::Document> {
5255 (*self.0.stub)
5256 .get_document(self.0.request, self.0.options)
5257 .await
5258 .map(gax::response::Response::into_body)
5259 }
5260
5261 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5265 self.0.request.name = v.into();
5266 self
5267 }
5268 }
5269
5270 #[doc(hidden)]
5271 impl gax::options::internal::RequestBuilder for GetDocument {
5272 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5273 &mut self.0.options
5274 }
5275 }
5276
5277 #[derive(Clone, Debug)]
5299 pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
5300
5301 impl ListDocuments {
5302 pub(crate) fn new(
5303 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5304 ) -> Self {
5305 Self(RequestBuilder::new(stub))
5306 }
5307
5308 pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
5310 self.0.request = v.into();
5311 self
5312 }
5313
5314 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5316 self.0.options = v.into();
5317 self
5318 }
5319
5320 pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
5322 (*self.0.stub)
5323 .list_documents(self.0.request, self.0.options)
5324 .await
5325 .map(gax::response::Response::into_body)
5326 }
5327
5328 pub fn by_page(
5330 self,
5331 ) -> impl gax::paginator::Paginator<crate::model::ListDocumentsResponse, gax::error::Error>
5332 {
5333 use std::clone::Clone;
5334 let token = self.0.request.page_token.clone();
5335 let execute = move |token: String| {
5336 let mut builder = self.clone();
5337 builder.0.request = builder.0.request.set_page_token(token);
5338 builder.send()
5339 };
5340 gax::paginator::internal::new_paginator(token, execute)
5341 }
5342
5343 pub fn by_item(
5345 self,
5346 ) -> impl gax::paginator::ItemPaginator<crate::model::ListDocumentsResponse, gax::error::Error>
5347 {
5348 use gax::paginator::Paginator;
5349 self.by_page().items()
5350 }
5351
5352 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5356 self.0.request.parent = v.into();
5357 self
5358 }
5359
5360 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5362 self.0.request.page_size = v.into();
5363 self
5364 }
5365
5366 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5368 self.0.request.page_token = v.into();
5369 self
5370 }
5371 }
5372
5373 #[doc(hidden)]
5374 impl gax::options::internal::RequestBuilder for ListDocuments {
5375 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5376 &mut self.0.options
5377 }
5378 }
5379
5380 #[derive(Clone, Debug)]
5398 pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
5399
5400 impl CreateDocument {
5401 pub(crate) fn new(
5402 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5403 ) -> Self {
5404 Self(RequestBuilder::new(stub))
5405 }
5406
5407 pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
5409 self.0.request = v.into();
5410 self
5411 }
5412
5413 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5415 self.0.options = v.into();
5416 self
5417 }
5418
5419 pub async fn send(self) -> Result<crate::model::Document> {
5421 (*self.0.stub)
5422 .create_document(self.0.request, self.0.options)
5423 .await
5424 .map(gax::response::Response::into_body)
5425 }
5426
5427 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5431 self.0.request.parent = v.into();
5432 self
5433 }
5434
5435 pub fn set_document<T>(mut self, v: T) -> Self
5439 where
5440 T: std::convert::Into<crate::model::Document>,
5441 {
5442 self.0.request.document = std::option::Option::Some(v.into());
5443 self
5444 }
5445
5446 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5450 where
5451 T: std::convert::Into<crate::model::Document>,
5452 {
5453 self.0.request.document = v.map(|x| x.into());
5454 self
5455 }
5456
5457 pub fn set_document_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
5461 self.0.request.document_id = v.into();
5462 self
5463 }
5464 }
5465
5466 #[doc(hidden)]
5467 impl gax::options::internal::RequestBuilder for CreateDocument {
5468 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5469 &mut self.0.options
5470 }
5471 }
5472
5473 #[derive(Clone, Debug)]
5491 pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
5492
5493 impl UpdateDocument {
5494 pub(crate) fn new(
5495 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5496 ) -> Self {
5497 Self(RequestBuilder::new(stub))
5498 }
5499
5500 pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
5502 self.0.request = v.into();
5503 self
5504 }
5505
5506 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5508 self.0.options = v.into();
5509 self
5510 }
5511
5512 pub async fn send(self) -> Result<crate::model::Document> {
5514 (*self.0.stub)
5515 .update_document(self.0.request, self.0.options)
5516 .await
5517 .map(gax::response::Response::into_body)
5518 }
5519
5520 pub fn set_document<T>(mut self, v: T) -> Self
5524 where
5525 T: std::convert::Into<crate::model::Document>,
5526 {
5527 self.0.request.document = std::option::Option::Some(v.into());
5528 self
5529 }
5530
5531 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
5535 where
5536 T: std::convert::Into<crate::model::Document>,
5537 {
5538 self.0.request.document = v.map(|x| x.into());
5539 self
5540 }
5541
5542 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
5544 self.0.request.allow_missing = v.into();
5545 self
5546 }
5547
5548 pub fn set_update_mask<T>(mut self, v: T) -> Self
5550 where
5551 T: std::convert::Into<wkt::FieldMask>,
5552 {
5553 self.0.request.update_mask = std::option::Option::Some(v.into());
5554 self
5555 }
5556
5557 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5559 where
5560 T: std::convert::Into<wkt::FieldMask>,
5561 {
5562 self.0.request.update_mask = v.map(|x| x.into());
5563 self
5564 }
5565 }
5566
5567 #[doc(hidden)]
5568 impl gax::options::internal::RequestBuilder for UpdateDocument {
5569 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5570 &mut self.0.options
5571 }
5572 }
5573
5574 #[derive(Clone, Debug)]
5592 pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
5593
5594 impl DeleteDocument {
5595 pub(crate) fn new(
5596 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5597 ) -> Self {
5598 Self(RequestBuilder::new(stub))
5599 }
5600
5601 pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
5603 self.0.request = v.into();
5604 self
5605 }
5606
5607 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5609 self.0.options = v.into();
5610 self
5611 }
5612
5613 pub async fn send(self) -> Result<()> {
5615 (*self.0.stub)
5616 .delete_document(self.0.request, self.0.options)
5617 .await
5618 .map(gax::response::Response::into_body)
5619 }
5620
5621 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5625 self.0.request.name = v.into();
5626 self
5627 }
5628 }
5629
5630 #[doc(hidden)]
5631 impl gax::options::internal::RequestBuilder for DeleteDocument {
5632 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5633 &mut self.0.options
5634 }
5635 }
5636
5637 #[derive(Clone, Debug)]
5656 pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
5657
5658 impl ImportDocuments {
5659 pub(crate) fn new(
5660 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5661 ) -> Self {
5662 Self(RequestBuilder::new(stub))
5663 }
5664
5665 pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
5667 self.0.request = v.into();
5668 self
5669 }
5670
5671 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5673 self.0.options = v.into();
5674 self
5675 }
5676
5677 pub async fn send(self) -> Result<longrunning::model::Operation> {
5684 (*self.0.stub)
5685 .import_documents(self.0.request, self.0.options)
5686 .await
5687 .map(gax::response::Response::into_body)
5688 }
5689
5690 pub fn poller(
5692 self,
5693 ) -> impl lro::Poller<crate::model::ImportDocumentsResponse, crate::model::ImportDocumentsMetadata>
5694 {
5695 type Operation = lro::internal::Operation<
5696 crate::model::ImportDocumentsResponse,
5697 crate::model::ImportDocumentsMetadata,
5698 >;
5699 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5700 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5701
5702 let stub = self.0.stub.clone();
5703 let mut options = self.0.options.clone();
5704 options.set_retry_policy(gax::retry_policy::NeverRetry);
5705 let query = move |name| {
5706 let stub = stub.clone();
5707 let options = options.clone();
5708 async {
5709 let op = GetOperation::new(stub)
5710 .set_name(name)
5711 .with_options(options)
5712 .send()
5713 .await?;
5714 Ok(Operation::new(op))
5715 }
5716 };
5717
5718 let start = move || async {
5719 let op = self.send().await?;
5720 Ok(Operation::new(op))
5721 };
5722
5723 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5724 }
5725
5726 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5730 self.0.request.parent = v.into();
5731 self
5732 }
5733
5734 pub fn set_error_config<T>(mut self, v: T) -> Self
5736 where
5737 T: std::convert::Into<crate::model::ImportErrorConfig>,
5738 {
5739 self.0.request.error_config = std::option::Option::Some(v.into());
5740 self
5741 }
5742
5743 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
5745 where
5746 T: std::convert::Into<crate::model::ImportErrorConfig>,
5747 {
5748 self.0.request.error_config = v.map(|x| x.into());
5749 self
5750 }
5751
5752 pub fn set_reconciliation_mode<
5754 T: Into<crate::model::import_documents_request::ReconciliationMode>,
5755 >(
5756 mut self,
5757 v: T,
5758 ) -> Self {
5759 self.0.request.reconciliation_mode = v.into();
5760 self
5761 }
5762
5763 pub fn set_update_mask<T>(mut self, v: T) -> Self
5765 where
5766 T: std::convert::Into<wkt::FieldMask>,
5767 {
5768 self.0.request.update_mask = std::option::Option::Some(v.into());
5769 self
5770 }
5771
5772 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5774 where
5775 T: std::convert::Into<wkt::FieldMask>,
5776 {
5777 self.0.request.update_mask = v.map(|x| x.into());
5778 self
5779 }
5780
5781 pub fn set_auto_generate_ids<T: Into<bool>>(mut self, v: T) -> Self {
5783 self.0.request.auto_generate_ids = v.into();
5784 self
5785 }
5786
5787 pub fn set_id_field<T: Into<std::string::String>>(mut self, v: T) -> Self {
5789 self.0.request.id_field = v.into();
5790 self
5791 }
5792
5793 pub fn set_force_refresh_content<T: Into<bool>>(mut self, v: T) -> Self {
5795 self.0.request.force_refresh_content = v.into();
5796 self
5797 }
5798
5799 pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
5804 mut self,
5805 v: T,
5806 ) -> Self {
5807 self.0.request.source = v.into();
5808 self
5809 }
5810
5811 pub fn set_inline_source<
5817 T: std::convert::Into<
5818 std::boxed::Box<crate::model::import_documents_request::InlineSource>,
5819 >,
5820 >(
5821 mut self,
5822 v: T,
5823 ) -> Self {
5824 self.0.request = self.0.request.set_inline_source(v);
5825 self
5826 }
5827
5828 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
5834 mut self,
5835 v: T,
5836 ) -> Self {
5837 self.0.request = self.0.request.set_gcs_source(v);
5838 self
5839 }
5840
5841 pub fn set_bigquery_source<
5847 T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
5848 >(
5849 mut self,
5850 v: T,
5851 ) -> Self {
5852 self.0.request = self.0.request.set_bigquery_source(v);
5853 self
5854 }
5855
5856 pub fn set_fhir_store_source<
5862 T: std::convert::Into<std::boxed::Box<crate::model::FhirStoreSource>>,
5863 >(
5864 mut self,
5865 v: T,
5866 ) -> Self {
5867 self.0.request = self.0.request.set_fhir_store_source(v);
5868 self
5869 }
5870
5871 pub fn set_spanner_source<
5877 T: std::convert::Into<std::boxed::Box<crate::model::SpannerSource>>,
5878 >(
5879 mut self,
5880 v: T,
5881 ) -> Self {
5882 self.0.request = self.0.request.set_spanner_source(v);
5883 self
5884 }
5885
5886 pub fn set_cloud_sql_source<
5892 T: std::convert::Into<std::boxed::Box<crate::model::CloudSqlSource>>,
5893 >(
5894 mut self,
5895 v: T,
5896 ) -> Self {
5897 self.0.request = self.0.request.set_cloud_sql_source(v);
5898 self
5899 }
5900
5901 pub fn set_firestore_source<
5907 T: std::convert::Into<std::boxed::Box<crate::model::FirestoreSource>>,
5908 >(
5909 mut self,
5910 v: T,
5911 ) -> Self {
5912 self.0.request = self.0.request.set_firestore_source(v);
5913 self
5914 }
5915
5916 pub fn set_alloy_db_source<
5922 T: std::convert::Into<std::boxed::Box<crate::model::AlloyDbSource>>,
5923 >(
5924 mut self,
5925 v: T,
5926 ) -> Self {
5927 self.0.request = self.0.request.set_alloy_db_source(v);
5928 self
5929 }
5930
5931 pub fn set_bigtable_source<
5937 T: std::convert::Into<std::boxed::Box<crate::model::BigtableSource>>,
5938 >(
5939 mut self,
5940 v: T,
5941 ) -> Self {
5942 self.0.request = self.0.request.set_bigtable_source(v);
5943 self
5944 }
5945 }
5946
5947 #[doc(hidden)]
5948 impl gax::options::internal::RequestBuilder for ImportDocuments {
5949 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5950 &mut self.0.options
5951 }
5952 }
5953
5954 #[derive(Clone, Debug)]
5973 pub struct PurgeDocuments(RequestBuilder<crate::model::PurgeDocumentsRequest>);
5974
5975 impl PurgeDocuments {
5976 pub(crate) fn new(
5977 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
5978 ) -> Self {
5979 Self(RequestBuilder::new(stub))
5980 }
5981
5982 pub fn with_request<V: Into<crate::model::PurgeDocumentsRequest>>(mut self, v: V) -> Self {
5984 self.0.request = v.into();
5985 self
5986 }
5987
5988 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5990 self.0.options = v.into();
5991 self
5992 }
5993
5994 pub async fn send(self) -> Result<longrunning::model::Operation> {
6001 (*self.0.stub)
6002 .purge_documents(self.0.request, self.0.options)
6003 .await
6004 .map(gax::response::Response::into_body)
6005 }
6006
6007 pub fn poller(
6009 self,
6010 ) -> impl lro::Poller<crate::model::PurgeDocumentsResponse, crate::model::PurgeDocumentsMetadata>
6011 {
6012 type Operation = lro::internal::Operation<
6013 crate::model::PurgeDocumentsResponse,
6014 crate::model::PurgeDocumentsMetadata,
6015 >;
6016 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6017 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6018
6019 let stub = self.0.stub.clone();
6020 let mut options = self.0.options.clone();
6021 options.set_retry_policy(gax::retry_policy::NeverRetry);
6022 let query = move |name| {
6023 let stub = stub.clone();
6024 let options = options.clone();
6025 async {
6026 let op = GetOperation::new(stub)
6027 .set_name(name)
6028 .with_options(options)
6029 .send()
6030 .await?;
6031 Ok(Operation::new(op))
6032 }
6033 };
6034
6035 let start = move || async {
6036 let op = self.send().await?;
6037 Ok(Operation::new(op))
6038 };
6039
6040 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6041 }
6042
6043 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6047 self.0.request.parent = v.into();
6048 self
6049 }
6050
6051 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6055 self.0.request.filter = v.into();
6056 self
6057 }
6058
6059 pub fn set_error_config<T>(mut self, v: T) -> Self
6061 where
6062 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6063 {
6064 self.0.request.error_config = std::option::Option::Some(v.into());
6065 self
6066 }
6067
6068 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
6070 where
6071 T: std::convert::Into<crate::model::PurgeErrorConfig>,
6072 {
6073 self.0.request.error_config = v.map(|x| x.into());
6074 self
6075 }
6076
6077 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
6079 self.0.request.force = v.into();
6080 self
6081 }
6082
6083 pub fn set_source<T: Into<Option<crate::model::purge_documents_request::Source>>>(
6088 mut self,
6089 v: T,
6090 ) -> Self {
6091 self.0.request.source = v.into();
6092 self
6093 }
6094
6095 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
6101 mut self,
6102 v: T,
6103 ) -> Self {
6104 self.0.request = self.0.request.set_gcs_source(v);
6105 self
6106 }
6107
6108 pub fn set_inline_source<
6114 T: std::convert::Into<
6115 std::boxed::Box<crate::model::purge_documents_request::InlineSource>,
6116 >,
6117 >(
6118 mut self,
6119 v: T,
6120 ) -> Self {
6121 self.0.request = self.0.request.set_inline_source(v);
6122 self
6123 }
6124 }
6125
6126 #[doc(hidden)]
6127 impl gax::options::internal::RequestBuilder for PurgeDocuments {
6128 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6129 &mut self.0.options
6130 }
6131 }
6132
6133 #[derive(Clone, Debug)]
6151 pub struct BatchGetDocumentsMetadata(
6152 RequestBuilder<crate::model::BatchGetDocumentsMetadataRequest>,
6153 );
6154
6155 impl BatchGetDocumentsMetadata {
6156 pub(crate) fn new(
6157 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6158 ) -> Self {
6159 Self(RequestBuilder::new(stub))
6160 }
6161
6162 pub fn with_request<V: Into<crate::model::BatchGetDocumentsMetadataRequest>>(
6164 mut self,
6165 v: V,
6166 ) -> Self {
6167 self.0.request = v.into();
6168 self
6169 }
6170
6171 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6173 self.0.options = v.into();
6174 self
6175 }
6176
6177 pub async fn send(self) -> Result<crate::model::BatchGetDocumentsMetadataResponse> {
6179 (*self.0.stub)
6180 .batch_get_documents_metadata(self.0.request, self.0.options)
6181 .await
6182 .map(gax::response::Response::into_body)
6183 }
6184
6185 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6189 self.0.request.parent = v.into();
6190 self
6191 }
6192
6193 pub fn set_matcher<T>(mut self, v: T) -> Self
6197 where
6198 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6199 {
6200 self.0.request.matcher = std::option::Option::Some(v.into());
6201 self
6202 }
6203
6204 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
6208 where
6209 T: std::convert::Into<crate::model::batch_get_documents_metadata_request::Matcher>,
6210 {
6211 self.0.request.matcher = v.map(|x| x.into());
6212 self
6213 }
6214 }
6215
6216 #[doc(hidden)]
6217 impl gax::options::internal::RequestBuilder for BatchGetDocumentsMetadata {
6218 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6219 &mut self.0.options
6220 }
6221 }
6222
6223 #[derive(Clone, Debug)]
6245 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6246
6247 impl ListOperations {
6248 pub(crate) fn new(
6249 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6250 ) -> Self {
6251 Self(RequestBuilder::new(stub))
6252 }
6253
6254 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6256 mut self,
6257 v: V,
6258 ) -> Self {
6259 self.0.request = v.into();
6260 self
6261 }
6262
6263 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6265 self.0.options = v.into();
6266 self
6267 }
6268
6269 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6271 (*self.0.stub)
6272 .list_operations(self.0.request, self.0.options)
6273 .await
6274 .map(gax::response::Response::into_body)
6275 }
6276
6277 pub fn by_page(
6279 self,
6280 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6281 {
6282 use std::clone::Clone;
6283 let token = self.0.request.page_token.clone();
6284 let execute = move |token: String| {
6285 let mut builder = self.clone();
6286 builder.0.request = builder.0.request.set_page_token(token);
6287 builder.send()
6288 };
6289 gax::paginator::internal::new_paginator(token, execute)
6290 }
6291
6292 pub fn by_item(
6294 self,
6295 ) -> impl gax::paginator::ItemPaginator<
6296 longrunning::model::ListOperationsResponse,
6297 gax::error::Error,
6298 > {
6299 use gax::paginator::Paginator;
6300 self.by_page().items()
6301 }
6302
6303 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6305 self.0.request.name = v.into();
6306 self
6307 }
6308
6309 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6311 self.0.request.filter = v.into();
6312 self
6313 }
6314
6315 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6317 self.0.request.page_size = v.into();
6318 self
6319 }
6320
6321 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6323 self.0.request.page_token = v.into();
6324 self
6325 }
6326 }
6327
6328 #[doc(hidden)]
6329 impl gax::options::internal::RequestBuilder for ListOperations {
6330 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6331 &mut self.0.options
6332 }
6333 }
6334
6335 #[derive(Clone, Debug)]
6353 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6354
6355 impl GetOperation {
6356 pub(crate) fn new(
6357 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6358 ) -> Self {
6359 Self(RequestBuilder::new(stub))
6360 }
6361
6362 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6364 mut self,
6365 v: V,
6366 ) -> Self {
6367 self.0.request = v.into();
6368 self
6369 }
6370
6371 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6373 self.0.options = v.into();
6374 self
6375 }
6376
6377 pub async fn send(self) -> Result<longrunning::model::Operation> {
6379 (*self.0.stub)
6380 .get_operation(self.0.request, self.0.options)
6381 .await
6382 .map(gax::response::Response::into_body)
6383 }
6384
6385 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6387 self.0.request.name = v.into();
6388 self
6389 }
6390 }
6391
6392 #[doc(hidden)]
6393 impl gax::options::internal::RequestBuilder for GetOperation {
6394 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6395 &mut self.0.options
6396 }
6397 }
6398
6399 #[derive(Clone, Debug)]
6417 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
6418
6419 impl CancelOperation {
6420 pub(crate) fn new(
6421 stub: std::sync::Arc<dyn super::super::stub::dynamic::DocumentService>,
6422 ) -> Self {
6423 Self(RequestBuilder::new(stub))
6424 }
6425
6426 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
6428 mut self,
6429 v: V,
6430 ) -> Self {
6431 self.0.request = v.into();
6432 self
6433 }
6434
6435 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6437 self.0.options = v.into();
6438 self
6439 }
6440
6441 pub async fn send(self) -> Result<()> {
6443 (*self.0.stub)
6444 .cancel_operation(self.0.request, self.0.options)
6445 .await
6446 .map(gax::response::Response::into_body)
6447 }
6448
6449 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6451 self.0.request.name = v.into();
6452 self
6453 }
6454 }
6455
6456 #[doc(hidden)]
6457 impl gax::options::internal::RequestBuilder for CancelOperation {
6458 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6459 &mut self.0.options
6460 }
6461 }
6462}
6463
6464#[cfg(feature = "engine-service")]
6465#[cfg_attr(docsrs, doc(cfg(feature = "engine-service")))]
6466pub mod engine_service {
6467 use crate::Result;
6468
6469 pub type ClientBuilder =
6483 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
6484
6485 pub(crate) mod client {
6486 use super::super::super::client::EngineService;
6487 pub struct Factory;
6488 impl gax::client_builder::internal::ClientFactory for Factory {
6489 type Client = EngineService;
6490 type Credentials = gaxi::options::Credentials;
6491 async fn build(
6492 self,
6493 config: gaxi::options::ClientConfig,
6494 ) -> gax::client_builder::Result<Self::Client> {
6495 Self::Client::new(config).await
6496 }
6497 }
6498 }
6499
6500 #[derive(Clone, Debug)]
6502 pub(crate) struct RequestBuilder<R: std::default::Default> {
6503 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6504 request: R,
6505 options: gax::options::RequestOptions,
6506 }
6507
6508 impl<R> RequestBuilder<R>
6509 where
6510 R: std::default::Default,
6511 {
6512 pub(crate) fn new(
6513 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6514 ) -> Self {
6515 Self {
6516 stub,
6517 request: R::default(),
6518 options: gax::options::RequestOptions::default(),
6519 }
6520 }
6521 }
6522
6523 #[derive(Clone, Debug)]
6542 pub struct CreateEngine(RequestBuilder<crate::model::CreateEngineRequest>);
6543
6544 impl CreateEngine {
6545 pub(crate) fn new(
6546 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6547 ) -> Self {
6548 Self(RequestBuilder::new(stub))
6549 }
6550
6551 pub fn with_request<V: Into<crate::model::CreateEngineRequest>>(mut self, v: V) -> Self {
6553 self.0.request = v.into();
6554 self
6555 }
6556
6557 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6559 self.0.options = v.into();
6560 self
6561 }
6562
6563 pub async fn send(self) -> Result<longrunning::model::Operation> {
6570 (*self.0.stub)
6571 .create_engine(self.0.request, self.0.options)
6572 .await
6573 .map(gax::response::Response::into_body)
6574 }
6575
6576 pub fn poller(
6578 self,
6579 ) -> impl lro::Poller<crate::model::Engine, crate::model::CreateEngineMetadata> {
6580 type Operation =
6581 lro::internal::Operation<crate::model::Engine, crate::model::CreateEngineMetadata>;
6582 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6583 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6584
6585 let stub = self.0.stub.clone();
6586 let mut options = self.0.options.clone();
6587 options.set_retry_policy(gax::retry_policy::NeverRetry);
6588 let query = move |name| {
6589 let stub = stub.clone();
6590 let options = options.clone();
6591 async {
6592 let op = GetOperation::new(stub)
6593 .set_name(name)
6594 .with_options(options)
6595 .send()
6596 .await?;
6597 Ok(Operation::new(op))
6598 }
6599 };
6600
6601 let start = move || async {
6602 let op = self.send().await?;
6603 Ok(Operation::new(op))
6604 };
6605
6606 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6607 }
6608
6609 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6613 self.0.request.parent = v.into();
6614 self
6615 }
6616
6617 pub fn set_engine<T>(mut self, v: T) -> Self
6621 where
6622 T: std::convert::Into<crate::model::Engine>,
6623 {
6624 self.0.request.engine = std::option::Option::Some(v.into());
6625 self
6626 }
6627
6628 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6632 where
6633 T: std::convert::Into<crate::model::Engine>,
6634 {
6635 self.0.request.engine = v.map(|x| x.into());
6636 self
6637 }
6638
6639 pub fn set_engine_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
6643 self.0.request.engine_id = v.into();
6644 self
6645 }
6646 }
6647
6648 #[doc(hidden)]
6649 impl gax::options::internal::RequestBuilder for CreateEngine {
6650 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6651 &mut self.0.options
6652 }
6653 }
6654
6655 #[derive(Clone, Debug)]
6674 pub struct DeleteEngine(RequestBuilder<crate::model::DeleteEngineRequest>);
6675
6676 impl DeleteEngine {
6677 pub(crate) fn new(
6678 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6679 ) -> Self {
6680 Self(RequestBuilder::new(stub))
6681 }
6682
6683 pub fn with_request<V: Into<crate::model::DeleteEngineRequest>>(mut self, v: V) -> Self {
6685 self.0.request = v.into();
6686 self
6687 }
6688
6689 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6691 self.0.options = v.into();
6692 self
6693 }
6694
6695 pub async fn send(self) -> Result<longrunning::model::Operation> {
6702 (*self.0.stub)
6703 .delete_engine(self.0.request, self.0.options)
6704 .await
6705 .map(gax::response::Response::into_body)
6706 }
6707
6708 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteEngineMetadata> {
6710 type Operation =
6711 lro::internal::Operation<wkt::Empty, crate::model::DeleteEngineMetadata>;
6712 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6713 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6714
6715 let stub = self.0.stub.clone();
6716 let mut options = self.0.options.clone();
6717 options.set_retry_policy(gax::retry_policy::NeverRetry);
6718 let query = move |name| {
6719 let stub = stub.clone();
6720 let options = options.clone();
6721 async {
6722 let op = GetOperation::new(stub)
6723 .set_name(name)
6724 .with_options(options)
6725 .send()
6726 .await?;
6727 Ok(Operation::new(op))
6728 }
6729 };
6730
6731 let start = move || async {
6732 let op = self.send().await?;
6733 Ok(Operation::new(op))
6734 };
6735
6736 lro::internal::new_unit_response_poller(
6737 polling_error_policy,
6738 polling_backoff_policy,
6739 start,
6740 query,
6741 )
6742 }
6743
6744 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6748 self.0.request.name = v.into();
6749 self
6750 }
6751 }
6752
6753 #[doc(hidden)]
6754 impl gax::options::internal::RequestBuilder for DeleteEngine {
6755 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6756 &mut self.0.options
6757 }
6758 }
6759
6760 #[derive(Clone, Debug)]
6778 pub struct UpdateEngine(RequestBuilder<crate::model::UpdateEngineRequest>);
6779
6780 impl UpdateEngine {
6781 pub(crate) fn new(
6782 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6783 ) -> Self {
6784 Self(RequestBuilder::new(stub))
6785 }
6786
6787 pub fn with_request<V: Into<crate::model::UpdateEngineRequest>>(mut self, v: V) -> Self {
6789 self.0.request = v.into();
6790 self
6791 }
6792
6793 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6795 self.0.options = v.into();
6796 self
6797 }
6798
6799 pub async fn send(self) -> Result<crate::model::Engine> {
6801 (*self.0.stub)
6802 .update_engine(self.0.request, self.0.options)
6803 .await
6804 .map(gax::response::Response::into_body)
6805 }
6806
6807 pub fn set_engine<T>(mut self, v: T) -> Self
6811 where
6812 T: std::convert::Into<crate::model::Engine>,
6813 {
6814 self.0.request.engine = std::option::Option::Some(v.into());
6815 self
6816 }
6817
6818 pub fn set_or_clear_engine<T>(mut self, v: std::option::Option<T>) -> Self
6822 where
6823 T: std::convert::Into<crate::model::Engine>,
6824 {
6825 self.0.request.engine = v.map(|x| x.into());
6826 self
6827 }
6828
6829 pub fn set_update_mask<T>(mut self, v: T) -> Self
6831 where
6832 T: std::convert::Into<wkt::FieldMask>,
6833 {
6834 self.0.request.update_mask = std::option::Option::Some(v.into());
6835 self
6836 }
6837
6838 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6840 where
6841 T: std::convert::Into<wkt::FieldMask>,
6842 {
6843 self.0.request.update_mask = v.map(|x| x.into());
6844 self
6845 }
6846 }
6847
6848 #[doc(hidden)]
6849 impl gax::options::internal::RequestBuilder for UpdateEngine {
6850 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6851 &mut self.0.options
6852 }
6853 }
6854
6855 #[derive(Clone, Debug)]
6873 pub struct GetEngine(RequestBuilder<crate::model::GetEngineRequest>);
6874
6875 impl GetEngine {
6876 pub(crate) fn new(
6877 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6878 ) -> Self {
6879 Self(RequestBuilder::new(stub))
6880 }
6881
6882 pub fn with_request<V: Into<crate::model::GetEngineRequest>>(mut self, v: V) -> Self {
6884 self.0.request = v.into();
6885 self
6886 }
6887
6888 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6890 self.0.options = v.into();
6891 self
6892 }
6893
6894 pub async fn send(self) -> Result<crate::model::Engine> {
6896 (*self.0.stub)
6897 .get_engine(self.0.request, self.0.options)
6898 .await
6899 .map(gax::response::Response::into_body)
6900 }
6901
6902 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6906 self.0.request.name = v.into();
6907 self
6908 }
6909 }
6910
6911 #[doc(hidden)]
6912 impl gax::options::internal::RequestBuilder for GetEngine {
6913 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6914 &mut self.0.options
6915 }
6916 }
6917
6918 #[derive(Clone, Debug)]
6940 pub struct ListEngines(RequestBuilder<crate::model::ListEnginesRequest>);
6941
6942 impl ListEngines {
6943 pub(crate) fn new(
6944 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
6945 ) -> Self {
6946 Self(RequestBuilder::new(stub))
6947 }
6948
6949 pub fn with_request<V: Into<crate::model::ListEnginesRequest>>(mut self, v: V) -> Self {
6951 self.0.request = v.into();
6952 self
6953 }
6954
6955 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6957 self.0.options = v.into();
6958 self
6959 }
6960
6961 pub async fn send(self) -> Result<crate::model::ListEnginesResponse> {
6963 (*self.0.stub)
6964 .list_engines(self.0.request, self.0.options)
6965 .await
6966 .map(gax::response::Response::into_body)
6967 }
6968
6969 pub fn by_page(
6971 self,
6972 ) -> impl gax::paginator::Paginator<crate::model::ListEnginesResponse, gax::error::Error>
6973 {
6974 use std::clone::Clone;
6975 let token = self.0.request.page_token.clone();
6976 let execute = move |token: String| {
6977 let mut builder = self.clone();
6978 builder.0.request = builder.0.request.set_page_token(token);
6979 builder.send()
6980 };
6981 gax::paginator::internal::new_paginator(token, execute)
6982 }
6983
6984 pub fn by_item(
6986 self,
6987 ) -> impl gax::paginator::ItemPaginator<crate::model::ListEnginesResponse, gax::error::Error>
6988 {
6989 use gax::paginator::Paginator;
6990 self.by_page().items()
6991 }
6992
6993 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6997 self.0.request.parent = v.into();
6998 self
6999 }
7000
7001 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7003 self.0.request.page_size = v.into();
7004 self
7005 }
7006
7007 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7009 self.0.request.page_token = v.into();
7010 self
7011 }
7012
7013 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7015 self.0.request.filter = v.into();
7016 self
7017 }
7018 }
7019
7020 #[doc(hidden)]
7021 impl gax::options::internal::RequestBuilder for ListEngines {
7022 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7023 &mut self.0.options
7024 }
7025 }
7026
7027 #[derive(Clone, Debug)]
7049 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7050
7051 impl ListOperations {
7052 pub(crate) fn new(
7053 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7054 ) -> Self {
7055 Self(RequestBuilder::new(stub))
7056 }
7057
7058 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7060 mut self,
7061 v: V,
7062 ) -> Self {
7063 self.0.request = v.into();
7064 self
7065 }
7066
7067 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7069 self.0.options = v.into();
7070 self
7071 }
7072
7073 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7075 (*self.0.stub)
7076 .list_operations(self.0.request, self.0.options)
7077 .await
7078 .map(gax::response::Response::into_body)
7079 }
7080
7081 pub fn by_page(
7083 self,
7084 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7085 {
7086 use std::clone::Clone;
7087 let token = self.0.request.page_token.clone();
7088 let execute = move |token: String| {
7089 let mut builder = self.clone();
7090 builder.0.request = builder.0.request.set_page_token(token);
7091 builder.send()
7092 };
7093 gax::paginator::internal::new_paginator(token, execute)
7094 }
7095
7096 pub fn by_item(
7098 self,
7099 ) -> impl gax::paginator::ItemPaginator<
7100 longrunning::model::ListOperationsResponse,
7101 gax::error::Error,
7102 > {
7103 use gax::paginator::Paginator;
7104 self.by_page().items()
7105 }
7106
7107 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7109 self.0.request.name = v.into();
7110 self
7111 }
7112
7113 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7115 self.0.request.filter = v.into();
7116 self
7117 }
7118
7119 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7121 self.0.request.page_size = v.into();
7122 self
7123 }
7124
7125 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7127 self.0.request.page_token = v.into();
7128 self
7129 }
7130 }
7131
7132 #[doc(hidden)]
7133 impl gax::options::internal::RequestBuilder for ListOperations {
7134 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7135 &mut self.0.options
7136 }
7137 }
7138
7139 #[derive(Clone, Debug)]
7157 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7158
7159 impl GetOperation {
7160 pub(crate) fn new(
7161 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7162 ) -> Self {
7163 Self(RequestBuilder::new(stub))
7164 }
7165
7166 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7168 mut self,
7169 v: V,
7170 ) -> Self {
7171 self.0.request = v.into();
7172 self
7173 }
7174
7175 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7177 self.0.options = v.into();
7178 self
7179 }
7180
7181 pub async fn send(self) -> Result<longrunning::model::Operation> {
7183 (*self.0.stub)
7184 .get_operation(self.0.request, self.0.options)
7185 .await
7186 .map(gax::response::Response::into_body)
7187 }
7188
7189 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7191 self.0.request.name = v.into();
7192 self
7193 }
7194 }
7195
7196 #[doc(hidden)]
7197 impl gax::options::internal::RequestBuilder for GetOperation {
7198 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7199 &mut self.0.options
7200 }
7201 }
7202
7203 #[derive(Clone, Debug)]
7221 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7222
7223 impl CancelOperation {
7224 pub(crate) fn new(
7225 stub: std::sync::Arc<dyn super::super::stub::dynamic::EngineService>,
7226 ) -> Self {
7227 Self(RequestBuilder::new(stub))
7228 }
7229
7230 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7232 mut self,
7233 v: V,
7234 ) -> Self {
7235 self.0.request = v.into();
7236 self
7237 }
7238
7239 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7241 self.0.options = v.into();
7242 self
7243 }
7244
7245 pub async fn send(self) -> Result<()> {
7247 (*self.0.stub)
7248 .cancel_operation(self.0.request, self.0.options)
7249 .await
7250 .map(gax::response::Response::into_body)
7251 }
7252
7253 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7255 self.0.request.name = v.into();
7256 self
7257 }
7258 }
7259
7260 #[doc(hidden)]
7261 impl gax::options::internal::RequestBuilder for CancelOperation {
7262 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7263 &mut self.0.options
7264 }
7265 }
7266}
7267
7268#[cfg(feature = "grounded-generation-service")]
7269#[cfg_attr(docsrs, doc(cfg(feature = "grounded-generation-service")))]
7270pub mod grounded_generation_service {
7271 use crate::Result;
7272
7273 pub type ClientBuilder =
7287 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7288
7289 pub(crate) mod client {
7290 use super::super::super::client::GroundedGenerationService;
7291 pub struct Factory;
7292 impl gax::client_builder::internal::ClientFactory for Factory {
7293 type Client = GroundedGenerationService;
7294 type Credentials = gaxi::options::Credentials;
7295 async fn build(
7296 self,
7297 config: gaxi::options::ClientConfig,
7298 ) -> gax::client_builder::Result<Self::Client> {
7299 Self::Client::new(config).await
7300 }
7301 }
7302 }
7303
7304 #[derive(Clone, Debug)]
7306 pub(crate) struct RequestBuilder<R: std::default::Default> {
7307 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7308 request: R,
7309 options: gax::options::RequestOptions,
7310 }
7311
7312 impl<R> RequestBuilder<R>
7313 where
7314 R: std::default::Default,
7315 {
7316 pub(crate) fn new(
7317 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7318 ) -> Self {
7319 Self {
7320 stub,
7321 request: R::default(),
7322 options: gax::options::RequestOptions::default(),
7323 }
7324 }
7325 }
7326
7327 #[derive(Clone, Debug)]
7345 pub struct GenerateGroundedContent(
7346 RequestBuilder<crate::model::GenerateGroundedContentRequest>,
7347 );
7348
7349 impl GenerateGroundedContent {
7350 pub(crate) fn new(
7351 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7352 ) -> Self {
7353 Self(RequestBuilder::new(stub))
7354 }
7355
7356 pub fn with_request<V: Into<crate::model::GenerateGroundedContentRequest>>(
7358 mut self,
7359 v: V,
7360 ) -> Self {
7361 self.0.request = v.into();
7362 self
7363 }
7364
7365 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7367 self.0.options = v.into();
7368 self
7369 }
7370
7371 pub async fn send(self) -> Result<crate::model::GenerateGroundedContentResponse> {
7373 (*self.0.stub)
7374 .generate_grounded_content(self.0.request, self.0.options)
7375 .await
7376 .map(gax::response::Response::into_body)
7377 }
7378
7379 pub fn set_location<T: Into<std::string::String>>(mut self, v: T) -> Self {
7383 self.0.request.location = v.into();
7384 self
7385 }
7386
7387 pub fn set_system_instruction<T>(mut self, v: T) -> Self
7389 where
7390 T: std::convert::Into<crate::model::GroundedGenerationContent>,
7391 {
7392 self.0.request.system_instruction = std::option::Option::Some(v.into());
7393 self
7394 }
7395
7396 pub fn set_or_clear_system_instruction<T>(mut self, v: std::option::Option<T>) -> Self
7398 where
7399 T: std::convert::Into<crate::model::GroundedGenerationContent>,
7400 {
7401 self.0.request.system_instruction = v.map(|x| x.into());
7402 self
7403 }
7404
7405 pub fn set_contents<T, V>(mut self, v: T) -> Self
7407 where
7408 T: std::iter::IntoIterator<Item = V>,
7409 V: std::convert::Into<crate::model::GroundedGenerationContent>,
7410 {
7411 use std::iter::Iterator;
7412 self.0.request.contents = v.into_iter().map(|i| i.into()).collect();
7413 self
7414 }
7415
7416 pub fn set_generation_spec<T>(mut self, v: T) -> Self
7418 where
7419 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7420 {
7421 self.0.request.generation_spec = std::option::Option::Some(v.into());
7422 self
7423 }
7424
7425 pub fn set_or_clear_generation_spec<T>(mut self, v: std::option::Option<T>) -> Self
7427 where
7428 T: std::convert::Into<crate::model::generate_grounded_content_request::GenerationSpec>,
7429 {
7430 self.0.request.generation_spec = v.map(|x| x.into());
7431 self
7432 }
7433
7434 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7436 where
7437 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7438 {
7439 self.0.request.grounding_spec = std::option::Option::Some(v.into());
7440 self
7441 }
7442
7443 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7445 where
7446 T: std::convert::Into<crate::model::generate_grounded_content_request::GroundingSpec>,
7447 {
7448 self.0.request.grounding_spec = v.map(|x| x.into());
7449 self
7450 }
7451
7452 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7454 where
7455 T: std::iter::IntoIterator<Item = (K, V)>,
7456 K: std::convert::Into<std::string::String>,
7457 V: std::convert::Into<std::string::String>,
7458 {
7459 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7460 self
7461 }
7462 }
7463
7464 #[doc(hidden)]
7465 impl gax::options::internal::RequestBuilder for GenerateGroundedContent {
7466 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7467 &mut self.0.options
7468 }
7469 }
7470
7471 #[derive(Clone, Debug)]
7489 pub struct CheckGrounding(RequestBuilder<crate::model::CheckGroundingRequest>);
7490
7491 impl CheckGrounding {
7492 pub(crate) fn new(
7493 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7494 ) -> Self {
7495 Self(RequestBuilder::new(stub))
7496 }
7497
7498 pub fn with_request<V: Into<crate::model::CheckGroundingRequest>>(mut self, v: V) -> Self {
7500 self.0.request = v.into();
7501 self
7502 }
7503
7504 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7506 self.0.options = v.into();
7507 self
7508 }
7509
7510 pub async fn send(self) -> Result<crate::model::CheckGroundingResponse> {
7512 (*self.0.stub)
7513 .check_grounding(self.0.request, self.0.options)
7514 .await
7515 .map(gax::response::Response::into_body)
7516 }
7517
7518 pub fn set_grounding_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
7522 self.0.request.grounding_config = v.into();
7523 self
7524 }
7525
7526 pub fn set_answer_candidate<T: Into<std::string::String>>(mut self, v: T) -> Self {
7528 self.0.request.answer_candidate = v.into();
7529 self
7530 }
7531
7532 pub fn set_facts<T, V>(mut self, v: T) -> Self
7534 where
7535 T: std::iter::IntoIterator<Item = V>,
7536 V: std::convert::Into<crate::model::GroundingFact>,
7537 {
7538 use std::iter::Iterator;
7539 self.0.request.facts = v.into_iter().map(|i| i.into()).collect();
7540 self
7541 }
7542
7543 pub fn set_grounding_spec<T>(mut self, v: T) -> Self
7545 where
7546 T: std::convert::Into<crate::model::CheckGroundingSpec>,
7547 {
7548 self.0.request.grounding_spec = std::option::Option::Some(v.into());
7549 self
7550 }
7551
7552 pub fn set_or_clear_grounding_spec<T>(mut self, v: std::option::Option<T>) -> Self
7554 where
7555 T: std::convert::Into<crate::model::CheckGroundingSpec>,
7556 {
7557 self.0.request.grounding_spec = v.map(|x| x.into());
7558 self
7559 }
7560
7561 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
7563 where
7564 T: std::iter::IntoIterator<Item = (K, V)>,
7565 K: std::convert::Into<std::string::String>,
7566 V: std::convert::Into<std::string::String>,
7567 {
7568 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7569 self
7570 }
7571 }
7572
7573 #[doc(hidden)]
7574 impl gax::options::internal::RequestBuilder for CheckGrounding {
7575 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7576 &mut self.0.options
7577 }
7578 }
7579
7580 #[derive(Clone, Debug)]
7602 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7603
7604 impl ListOperations {
7605 pub(crate) fn new(
7606 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7607 ) -> Self {
7608 Self(RequestBuilder::new(stub))
7609 }
7610
7611 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7613 mut self,
7614 v: V,
7615 ) -> Self {
7616 self.0.request = v.into();
7617 self
7618 }
7619
7620 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7622 self.0.options = v.into();
7623 self
7624 }
7625
7626 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7628 (*self.0.stub)
7629 .list_operations(self.0.request, self.0.options)
7630 .await
7631 .map(gax::response::Response::into_body)
7632 }
7633
7634 pub fn by_page(
7636 self,
7637 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7638 {
7639 use std::clone::Clone;
7640 let token = self.0.request.page_token.clone();
7641 let execute = move |token: String| {
7642 let mut builder = self.clone();
7643 builder.0.request = builder.0.request.set_page_token(token);
7644 builder.send()
7645 };
7646 gax::paginator::internal::new_paginator(token, execute)
7647 }
7648
7649 pub fn by_item(
7651 self,
7652 ) -> impl gax::paginator::ItemPaginator<
7653 longrunning::model::ListOperationsResponse,
7654 gax::error::Error,
7655 > {
7656 use gax::paginator::Paginator;
7657 self.by_page().items()
7658 }
7659
7660 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7662 self.0.request.name = v.into();
7663 self
7664 }
7665
7666 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7668 self.0.request.filter = v.into();
7669 self
7670 }
7671
7672 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7674 self.0.request.page_size = v.into();
7675 self
7676 }
7677
7678 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7680 self.0.request.page_token = v.into();
7681 self
7682 }
7683 }
7684
7685 #[doc(hidden)]
7686 impl gax::options::internal::RequestBuilder for ListOperations {
7687 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7688 &mut self.0.options
7689 }
7690 }
7691
7692 #[derive(Clone, Debug)]
7710 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
7711
7712 impl GetOperation {
7713 pub(crate) fn new(
7714 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7715 ) -> Self {
7716 Self(RequestBuilder::new(stub))
7717 }
7718
7719 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
7721 mut self,
7722 v: V,
7723 ) -> Self {
7724 self.0.request = v.into();
7725 self
7726 }
7727
7728 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7730 self.0.options = v.into();
7731 self
7732 }
7733
7734 pub async fn send(self) -> Result<longrunning::model::Operation> {
7736 (*self.0.stub)
7737 .get_operation(self.0.request, self.0.options)
7738 .await
7739 .map(gax::response::Response::into_body)
7740 }
7741
7742 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7744 self.0.request.name = v.into();
7745 self
7746 }
7747 }
7748
7749 #[doc(hidden)]
7750 impl gax::options::internal::RequestBuilder for GetOperation {
7751 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7752 &mut self.0.options
7753 }
7754 }
7755
7756 #[derive(Clone, Debug)]
7774 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7775
7776 impl CancelOperation {
7777 pub(crate) fn new(
7778 stub: std::sync::Arc<dyn super::super::stub::dynamic::GroundedGenerationService>,
7779 ) -> Self {
7780 Self(RequestBuilder::new(stub))
7781 }
7782
7783 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7785 mut self,
7786 v: V,
7787 ) -> Self {
7788 self.0.request = v.into();
7789 self
7790 }
7791
7792 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7794 self.0.options = v.into();
7795 self
7796 }
7797
7798 pub async fn send(self) -> Result<()> {
7800 (*self.0.stub)
7801 .cancel_operation(self.0.request, self.0.options)
7802 .await
7803 .map(gax::response::Response::into_body)
7804 }
7805
7806 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7808 self.0.request.name = v.into();
7809 self
7810 }
7811 }
7812
7813 #[doc(hidden)]
7814 impl gax::options::internal::RequestBuilder for CancelOperation {
7815 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7816 &mut self.0.options
7817 }
7818 }
7819}
7820
7821#[cfg(feature = "identity-mapping-store-service")]
7822#[cfg_attr(docsrs, doc(cfg(feature = "identity-mapping-store-service")))]
7823pub mod identity_mapping_store_service {
7824 use crate::Result;
7825
7826 pub type ClientBuilder =
7840 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7841
7842 pub(crate) mod client {
7843 use super::super::super::client::IdentityMappingStoreService;
7844 pub struct Factory;
7845 impl gax::client_builder::internal::ClientFactory for Factory {
7846 type Client = IdentityMappingStoreService;
7847 type Credentials = gaxi::options::Credentials;
7848 async fn build(
7849 self,
7850 config: gaxi::options::ClientConfig,
7851 ) -> gax::client_builder::Result<Self::Client> {
7852 Self::Client::new(config).await
7853 }
7854 }
7855 }
7856
7857 #[derive(Clone, Debug)]
7859 pub(crate) struct RequestBuilder<R: std::default::Default> {
7860 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7861 request: R,
7862 options: gax::options::RequestOptions,
7863 }
7864
7865 impl<R> RequestBuilder<R>
7866 where
7867 R: std::default::Default,
7868 {
7869 pub(crate) fn new(
7870 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7871 ) -> Self {
7872 Self {
7873 stub,
7874 request: R::default(),
7875 options: gax::options::RequestOptions::default(),
7876 }
7877 }
7878 }
7879
7880 #[derive(Clone, Debug)]
7898 pub struct CreateIdentityMappingStore(
7899 RequestBuilder<crate::model::CreateIdentityMappingStoreRequest>,
7900 );
7901
7902 impl CreateIdentityMappingStore {
7903 pub(crate) fn new(
7904 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
7905 ) -> Self {
7906 Self(RequestBuilder::new(stub))
7907 }
7908
7909 pub fn with_request<V: Into<crate::model::CreateIdentityMappingStoreRequest>>(
7911 mut self,
7912 v: V,
7913 ) -> Self {
7914 self.0.request = v.into();
7915 self
7916 }
7917
7918 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7920 self.0.options = v.into();
7921 self
7922 }
7923
7924 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
7926 (*self.0.stub)
7927 .create_identity_mapping_store(self.0.request, self.0.options)
7928 .await
7929 .map(gax::response::Response::into_body)
7930 }
7931
7932 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7936 self.0.request.parent = v.into();
7937 self
7938 }
7939
7940 pub fn set_identity_mapping_store_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
7944 self.0.request.identity_mapping_store_id = v.into();
7945 self
7946 }
7947
7948 pub fn set_identity_mapping_store<T>(mut self, v: T) -> Self
7952 where
7953 T: std::convert::Into<crate::model::IdentityMappingStore>,
7954 {
7955 self.0.request.identity_mapping_store = std::option::Option::Some(v.into());
7956 self
7957 }
7958
7959 pub fn set_or_clear_identity_mapping_store<T>(mut self, v: std::option::Option<T>) -> Self
7963 where
7964 T: std::convert::Into<crate::model::IdentityMappingStore>,
7965 {
7966 self.0.request.identity_mapping_store = v.map(|x| x.into());
7967 self
7968 }
7969
7970 pub fn set_cmek_options<
7975 T: Into<Option<crate::model::create_identity_mapping_store_request::CmekOptions>>,
7976 >(
7977 mut self,
7978 v: T,
7979 ) -> Self {
7980 self.0.request.cmek_options = v.into();
7981 self
7982 }
7983
7984 pub fn set_cmek_config_name<T: std::convert::Into<std::string::String>>(
7990 mut self,
7991 v: T,
7992 ) -> Self {
7993 self.0.request = self.0.request.set_cmek_config_name(v);
7994 self
7995 }
7996
7997 pub fn set_disable_cmek<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8003 self.0.request = self.0.request.set_disable_cmek(v);
8004 self
8005 }
8006 }
8007
8008 #[doc(hidden)]
8009 impl gax::options::internal::RequestBuilder for CreateIdentityMappingStore {
8010 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8011 &mut self.0.options
8012 }
8013 }
8014
8015 #[derive(Clone, Debug)]
8033 pub struct GetIdentityMappingStore(
8034 RequestBuilder<crate::model::GetIdentityMappingStoreRequest>,
8035 );
8036
8037 impl GetIdentityMappingStore {
8038 pub(crate) fn new(
8039 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8040 ) -> Self {
8041 Self(RequestBuilder::new(stub))
8042 }
8043
8044 pub fn with_request<V: Into<crate::model::GetIdentityMappingStoreRequest>>(
8046 mut self,
8047 v: V,
8048 ) -> Self {
8049 self.0.request = v.into();
8050 self
8051 }
8052
8053 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8055 self.0.options = v.into();
8056 self
8057 }
8058
8059 pub async fn send(self) -> Result<crate::model::IdentityMappingStore> {
8061 (*self.0.stub)
8062 .get_identity_mapping_store(self.0.request, self.0.options)
8063 .await
8064 .map(gax::response::Response::into_body)
8065 }
8066
8067 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8071 self.0.request.name = v.into();
8072 self
8073 }
8074 }
8075
8076 #[doc(hidden)]
8077 impl gax::options::internal::RequestBuilder for GetIdentityMappingStore {
8078 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8079 &mut self.0.options
8080 }
8081 }
8082
8083 #[derive(Clone, Debug)]
8102 pub struct DeleteIdentityMappingStore(
8103 RequestBuilder<crate::model::DeleteIdentityMappingStoreRequest>,
8104 );
8105
8106 impl DeleteIdentityMappingStore {
8107 pub(crate) fn new(
8108 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8109 ) -> Self {
8110 Self(RequestBuilder::new(stub))
8111 }
8112
8113 pub fn with_request<V: Into<crate::model::DeleteIdentityMappingStoreRequest>>(
8115 mut self,
8116 v: V,
8117 ) -> Self {
8118 self.0.request = v.into();
8119 self
8120 }
8121
8122 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8124 self.0.options = v.into();
8125 self
8126 }
8127
8128 pub async fn send(self) -> Result<longrunning::model::Operation> {
8135 (*self.0.stub)
8136 .delete_identity_mapping_store(self.0.request, self.0.options)
8137 .await
8138 .map(gax::response::Response::into_body)
8139 }
8140
8141 pub fn poller(
8143 self,
8144 ) -> impl lro::Poller<(), crate::model::DeleteIdentityMappingStoreMetadata> {
8145 type Operation = lro::internal::Operation<
8146 wkt::Empty,
8147 crate::model::DeleteIdentityMappingStoreMetadata,
8148 >;
8149 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8150 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8151
8152 let stub = self.0.stub.clone();
8153 let mut options = self.0.options.clone();
8154 options.set_retry_policy(gax::retry_policy::NeverRetry);
8155 let query = move |name| {
8156 let stub = stub.clone();
8157 let options = options.clone();
8158 async {
8159 let op = GetOperation::new(stub)
8160 .set_name(name)
8161 .with_options(options)
8162 .send()
8163 .await?;
8164 Ok(Operation::new(op))
8165 }
8166 };
8167
8168 let start = move || async {
8169 let op = self.send().await?;
8170 Ok(Operation::new(op))
8171 };
8172
8173 lro::internal::new_unit_response_poller(
8174 polling_error_policy,
8175 polling_backoff_policy,
8176 start,
8177 query,
8178 )
8179 }
8180
8181 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8185 self.0.request.name = v.into();
8186 self
8187 }
8188 }
8189
8190 #[doc(hidden)]
8191 impl gax::options::internal::RequestBuilder for DeleteIdentityMappingStore {
8192 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8193 &mut self.0.options
8194 }
8195 }
8196
8197 #[derive(Clone, Debug)]
8216 pub struct ImportIdentityMappings(RequestBuilder<crate::model::ImportIdentityMappingsRequest>);
8217
8218 impl ImportIdentityMappings {
8219 pub(crate) fn new(
8220 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8221 ) -> Self {
8222 Self(RequestBuilder::new(stub))
8223 }
8224
8225 pub fn with_request<V: Into<crate::model::ImportIdentityMappingsRequest>>(
8227 mut self,
8228 v: V,
8229 ) -> Self {
8230 self.0.request = v.into();
8231 self
8232 }
8233
8234 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8236 self.0.options = v.into();
8237 self
8238 }
8239
8240 pub async fn send(self) -> Result<longrunning::model::Operation> {
8247 (*self.0.stub)
8248 .import_identity_mappings(self.0.request, self.0.options)
8249 .await
8250 .map(gax::response::Response::into_body)
8251 }
8252
8253 pub fn poller(
8255 self,
8256 ) -> impl lro::Poller<
8257 crate::model::ImportIdentityMappingsResponse,
8258 crate::model::IdentityMappingEntryOperationMetadata,
8259 > {
8260 type Operation = lro::internal::Operation<
8261 crate::model::ImportIdentityMappingsResponse,
8262 crate::model::IdentityMappingEntryOperationMetadata,
8263 >;
8264 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8265 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8266
8267 let stub = self.0.stub.clone();
8268 let mut options = self.0.options.clone();
8269 options.set_retry_policy(gax::retry_policy::NeverRetry);
8270 let query = move |name| {
8271 let stub = stub.clone();
8272 let options = options.clone();
8273 async {
8274 let op = GetOperation::new(stub)
8275 .set_name(name)
8276 .with_options(options)
8277 .send()
8278 .await?;
8279 Ok(Operation::new(op))
8280 }
8281 };
8282
8283 let start = move || async {
8284 let op = self.send().await?;
8285 Ok(Operation::new(op))
8286 };
8287
8288 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8289 }
8290
8291 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8295 self.0.request.identity_mapping_store = v.into();
8296 self
8297 }
8298
8299 pub fn set_source<
8304 T: Into<Option<crate::model::import_identity_mappings_request::Source>>,
8305 >(
8306 mut self,
8307 v: T,
8308 ) -> Self {
8309 self.0.request.source = v.into();
8310 self
8311 }
8312
8313 pub fn set_inline_source<
8319 T: std::convert::Into<
8320 std::boxed::Box<crate::model::import_identity_mappings_request::InlineSource>,
8321 >,
8322 >(
8323 mut self,
8324 v: T,
8325 ) -> Self {
8326 self.0.request = self.0.request.set_inline_source(v);
8327 self
8328 }
8329 }
8330
8331 #[doc(hidden)]
8332 impl gax::options::internal::RequestBuilder for ImportIdentityMappings {
8333 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8334 &mut self.0.options
8335 }
8336 }
8337
8338 #[derive(Clone, Debug)]
8357 pub struct PurgeIdentityMappings(RequestBuilder<crate::model::PurgeIdentityMappingsRequest>);
8358
8359 impl PurgeIdentityMappings {
8360 pub(crate) fn new(
8361 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8362 ) -> Self {
8363 Self(RequestBuilder::new(stub))
8364 }
8365
8366 pub fn with_request<V: Into<crate::model::PurgeIdentityMappingsRequest>>(
8368 mut self,
8369 v: V,
8370 ) -> Self {
8371 self.0.request = v.into();
8372 self
8373 }
8374
8375 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8377 self.0.options = v.into();
8378 self
8379 }
8380
8381 pub async fn send(self) -> Result<longrunning::model::Operation> {
8388 (*self.0.stub)
8389 .purge_identity_mappings(self.0.request, self.0.options)
8390 .await
8391 .map(gax::response::Response::into_body)
8392 }
8393
8394 pub fn poller(
8396 self,
8397 ) -> impl lro::Poller<(), crate::model::IdentityMappingEntryOperationMetadata> {
8398 type Operation = lro::internal::Operation<
8399 wkt::Empty,
8400 crate::model::IdentityMappingEntryOperationMetadata,
8401 >;
8402 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8403 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8404
8405 let stub = self.0.stub.clone();
8406 let mut options = self.0.options.clone();
8407 options.set_retry_policy(gax::retry_policy::NeverRetry);
8408 let query = move |name| {
8409 let stub = stub.clone();
8410 let options = options.clone();
8411 async {
8412 let op = GetOperation::new(stub)
8413 .set_name(name)
8414 .with_options(options)
8415 .send()
8416 .await?;
8417 Ok(Operation::new(op))
8418 }
8419 };
8420
8421 let start = move || async {
8422 let op = self.send().await?;
8423 Ok(Operation::new(op))
8424 };
8425
8426 lro::internal::new_unit_response_poller(
8427 polling_error_policy,
8428 polling_backoff_policy,
8429 start,
8430 query,
8431 )
8432 }
8433
8434 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8438 self.0.request.identity_mapping_store = v.into();
8439 self
8440 }
8441
8442 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8444 self.0.request.filter = v.into();
8445 self
8446 }
8447
8448 pub fn set_force<T>(mut self, v: T) -> Self
8450 where
8451 T: std::convert::Into<bool>,
8452 {
8453 self.0.request.force = std::option::Option::Some(v.into());
8454 self
8455 }
8456
8457 pub fn set_or_clear_force<T>(mut self, v: std::option::Option<T>) -> Self
8459 where
8460 T: std::convert::Into<bool>,
8461 {
8462 self.0.request.force = v.map(|x| x.into());
8463 self
8464 }
8465
8466 pub fn set_source<
8471 T: Into<Option<crate::model::purge_identity_mappings_request::Source>>,
8472 >(
8473 mut self,
8474 v: T,
8475 ) -> Self {
8476 self.0.request.source = v.into();
8477 self
8478 }
8479
8480 pub fn set_inline_source<
8486 T: std::convert::Into<
8487 std::boxed::Box<crate::model::purge_identity_mappings_request::InlineSource>,
8488 >,
8489 >(
8490 mut self,
8491 v: T,
8492 ) -> Self {
8493 self.0.request = self.0.request.set_inline_source(v);
8494 self
8495 }
8496 }
8497
8498 #[doc(hidden)]
8499 impl gax::options::internal::RequestBuilder for PurgeIdentityMappings {
8500 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8501 &mut self.0.options
8502 }
8503 }
8504
8505 #[derive(Clone, Debug)]
8527 pub struct ListIdentityMappings(RequestBuilder<crate::model::ListIdentityMappingsRequest>);
8528
8529 impl ListIdentityMappings {
8530 pub(crate) fn new(
8531 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8532 ) -> Self {
8533 Self(RequestBuilder::new(stub))
8534 }
8535
8536 pub fn with_request<V: Into<crate::model::ListIdentityMappingsRequest>>(
8538 mut self,
8539 v: V,
8540 ) -> Self {
8541 self.0.request = v.into();
8542 self
8543 }
8544
8545 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8547 self.0.options = v.into();
8548 self
8549 }
8550
8551 pub async fn send(self) -> Result<crate::model::ListIdentityMappingsResponse> {
8553 (*self.0.stub)
8554 .list_identity_mappings(self.0.request, self.0.options)
8555 .await
8556 .map(gax::response::Response::into_body)
8557 }
8558
8559 pub fn by_page(
8561 self,
8562 ) -> impl gax::paginator::Paginator<crate::model::ListIdentityMappingsResponse, gax::error::Error>
8563 {
8564 use std::clone::Clone;
8565 let token = self.0.request.page_token.clone();
8566 let execute = move |token: String| {
8567 let mut builder = self.clone();
8568 builder.0.request = builder.0.request.set_page_token(token);
8569 builder.send()
8570 };
8571 gax::paginator::internal::new_paginator(token, execute)
8572 }
8573
8574 pub fn by_item(
8576 self,
8577 ) -> impl gax::paginator::ItemPaginator<
8578 crate::model::ListIdentityMappingsResponse,
8579 gax::error::Error,
8580 > {
8581 use gax::paginator::Paginator;
8582 self.by_page().items()
8583 }
8584
8585 pub fn set_identity_mapping_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
8589 self.0.request.identity_mapping_store = v.into();
8590 self
8591 }
8592
8593 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8595 self.0.request.page_size = v.into();
8596 self
8597 }
8598
8599 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8601 self.0.request.page_token = v.into();
8602 self
8603 }
8604 }
8605
8606 #[doc(hidden)]
8607 impl gax::options::internal::RequestBuilder for ListIdentityMappings {
8608 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8609 &mut self.0.options
8610 }
8611 }
8612
8613 #[derive(Clone, Debug)]
8635 pub struct ListIdentityMappingStores(
8636 RequestBuilder<crate::model::ListIdentityMappingStoresRequest>,
8637 );
8638
8639 impl ListIdentityMappingStores {
8640 pub(crate) fn new(
8641 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8642 ) -> Self {
8643 Self(RequestBuilder::new(stub))
8644 }
8645
8646 pub fn with_request<V: Into<crate::model::ListIdentityMappingStoresRequest>>(
8648 mut self,
8649 v: V,
8650 ) -> Self {
8651 self.0.request = v.into();
8652 self
8653 }
8654
8655 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8657 self.0.options = v.into();
8658 self
8659 }
8660
8661 pub async fn send(self) -> Result<crate::model::ListIdentityMappingStoresResponse> {
8663 (*self.0.stub)
8664 .list_identity_mapping_stores(self.0.request, self.0.options)
8665 .await
8666 .map(gax::response::Response::into_body)
8667 }
8668
8669 pub fn by_page(
8671 self,
8672 ) -> impl gax::paginator::Paginator<
8673 crate::model::ListIdentityMappingStoresResponse,
8674 gax::error::Error,
8675 > {
8676 use std::clone::Clone;
8677 let token = self.0.request.page_token.clone();
8678 let execute = move |token: String| {
8679 let mut builder = self.clone();
8680 builder.0.request = builder.0.request.set_page_token(token);
8681 builder.send()
8682 };
8683 gax::paginator::internal::new_paginator(token, execute)
8684 }
8685
8686 pub fn by_item(
8688 self,
8689 ) -> impl gax::paginator::ItemPaginator<
8690 crate::model::ListIdentityMappingStoresResponse,
8691 gax::error::Error,
8692 > {
8693 use gax::paginator::Paginator;
8694 self.by_page().items()
8695 }
8696
8697 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8701 self.0.request.parent = v.into();
8702 self
8703 }
8704
8705 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8707 self.0.request.page_size = v.into();
8708 self
8709 }
8710
8711 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8713 self.0.request.page_token = v.into();
8714 self
8715 }
8716 }
8717
8718 #[doc(hidden)]
8719 impl gax::options::internal::RequestBuilder for ListIdentityMappingStores {
8720 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8721 &mut self.0.options
8722 }
8723 }
8724
8725 #[derive(Clone, Debug)]
8747 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
8748
8749 impl ListOperations {
8750 pub(crate) fn new(
8751 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8752 ) -> Self {
8753 Self(RequestBuilder::new(stub))
8754 }
8755
8756 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
8758 mut self,
8759 v: V,
8760 ) -> Self {
8761 self.0.request = v.into();
8762 self
8763 }
8764
8765 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8767 self.0.options = v.into();
8768 self
8769 }
8770
8771 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
8773 (*self.0.stub)
8774 .list_operations(self.0.request, self.0.options)
8775 .await
8776 .map(gax::response::Response::into_body)
8777 }
8778
8779 pub fn by_page(
8781 self,
8782 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8783 {
8784 use std::clone::Clone;
8785 let token = self.0.request.page_token.clone();
8786 let execute = move |token: String| {
8787 let mut builder = self.clone();
8788 builder.0.request = builder.0.request.set_page_token(token);
8789 builder.send()
8790 };
8791 gax::paginator::internal::new_paginator(token, execute)
8792 }
8793
8794 pub fn by_item(
8796 self,
8797 ) -> impl gax::paginator::ItemPaginator<
8798 longrunning::model::ListOperationsResponse,
8799 gax::error::Error,
8800 > {
8801 use gax::paginator::Paginator;
8802 self.by_page().items()
8803 }
8804
8805 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8807 self.0.request.name = v.into();
8808 self
8809 }
8810
8811 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8813 self.0.request.filter = v.into();
8814 self
8815 }
8816
8817 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8819 self.0.request.page_size = v.into();
8820 self
8821 }
8822
8823 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8825 self.0.request.page_token = v.into();
8826 self
8827 }
8828 }
8829
8830 #[doc(hidden)]
8831 impl gax::options::internal::RequestBuilder for ListOperations {
8832 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8833 &mut self.0.options
8834 }
8835 }
8836
8837 #[derive(Clone, Debug)]
8855 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8856
8857 impl GetOperation {
8858 pub(crate) fn new(
8859 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8860 ) -> Self {
8861 Self(RequestBuilder::new(stub))
8862 }
8863
8864 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8866 mut self,
8867 v: V,
8868 ) -> Self {
8869 self.0.request = v.into();
8870 self
8871 }
8872
8873 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8875 self.0.options = v.into();
8876 self
8877 }
8878
8879 pub async fn send(self) -> Result<longrunning::model::Operation> {
8881 (*self.0.stub)
8882 .get_operation(self.0.request, self.0.options)
8883 .await
8884 .map(gax::response::Response::into_body)
8885 }
8886
8887 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8889 self.0.request.name = v.into();
8890 self
8891 }
8892 }
8893
8894 #[doc(hidden)]
8895 impl gax::options::internal::RequestBuilder for GetOperation {
8896 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8897 &mut self.0.options
8898 }
8899 }
8900
8901 #[derive(Clone, Debug)]
8919 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
8920
8921 impl CancelOperation {
8922 pub(crate) fn new(
8923 stub: std::sync::Arc<dyn super::super::stub::dynamic::IdentityMappingStoreService>,
8924 ) -> Self {
8925 Self(RequestBuilder::new(stub))
8926 }
8927
8928 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
8930 mut self,
8931 v: V,
8932 ) -> Self {
8933 self.0.request = v.into();
8934 self
8935 }
8936
8937 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8939 self.0.options = v.into();
8940 self
8941 }
8942
8943 pub async fn send(self) -> Result<()> {
8945 (*self.0.stub)
8946 .cancel_operation(self.0.request, self.0.options)
8947 .await
8948 .map(gax::response::Response::into_body)
8949 }
8950
8951 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8953 self.0.request.name = v.into();
8954 self
8955 }
8956 }
8957
8958 #[doc(hidden)]
8959 impl gax::options::internal::RequestBuilder for CancelOperation {
8960 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8961 &mut self.0.options
8962 }
8963 }
8964}
8965
8966#[cfg(feature = "project-service")]
8967#[cfg_attr(docsrs, doc(cfg(feature = "project-service")))]
8968pub mod project_service {
8969 use crate::Result;
8970
8971 pub type ClientBuilder =
8985 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8986
8987 pub(crate) mod client {
8988 use super::super::super::client::ProjectService;
8989 pub struct Factory;
8990 impl gax::client_builder::internal::ClientFactory for Factory {
8991 type Client = ProjectService;
8992 type Credentials = gaxi::options::Credentials;
8993 async fn build(
8994 self,
8995 config: gaxi::options::ClientConfig,
8996 ) -> gax::client_builder::Result<Self::Client> {
8997 Self::Client::new(config).await
8998 }
8999 }
9000 }
9001
9002 #[derive(Clone, Debug)]
9004 pub(crate) struct RequestBuilder<R: std::default::Default> {
9005 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9006 request: R,
9007 options: gax::options::RequestOptions,
9008 }
9009
9010 impl<R> RequestBuilder<R>
9011 where
9012 R: std::default::Default,
9013 {
9014 pub(crate) fn new(
9015 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9016 ) -> Self {
9017 Self {
9018 stub,
9019 request: R::default(),
9020 options: gax::options::RequestOptions::default(),
9021 }
9022 }
9023 }
9024
9025 #[derive(Clone, Debug)]
9044 pub struct ProvisionProject(RequestBuilder<crate::model::ProvisionProjectRequest>);
9045
9046 impl ProvisionProject {
9047 pub(crate) fn new(
9048 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9049 ) -> Self {
9050 Self(RequestBuilder::new(stub))
9051 }
9052
9053 pub fn with_request<V: Into<crate::model::ProvisionProjectRequest>>(
9055 mut self,
9056 v: V,
9057 ) -> Self {
9058 self.0.request = v.into();
9059 self
9060 }
9061
9062 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9064 self.0.options = v.into();
9065 self
9066 }
9067
9068 pub async fn send(self) -> Result<longrunning::model::Operation> {
9075 (*self.0.stub)
9076 .provision_project(self.0.request, self.0.options)
9077 .await
9078 .map(gax::response::Response::into_body)
9079 }
9080
9081 pub fn poller(
9083 self,
9084 ) -> impl lro::Poller<crate::model::Project, crate::model::ProvisionProjectMetadata>
9085 {
9086 type Operation = lro::internal::Operation<
9087 crate::model::Project,
9088 crate::model::ProvisionProjectMetadata,
9089 >;
9090 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9091 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9092
9093 let stub = self.0.stub.clone();
9094 let mut options = self.0.options.clone();
9095 options.set_retry_policy(gax::retry_policy::NeverRetry);
9096 let query = move |name| {
9097 let stub = stub.clone();
9098 let options = options.clone();
9099 async {
9100 let op = GetOperation::new(stub)
9101 .set_name(name)
9102 .with_options(options)
9103 .send()
9104 .await?;
9105 Ok(Operation::new(op))
9106 }
9107 };
9108
9109 let start = move || async {
9110 let op = self.send().await?;
9111 Ok(Operation::new(op))
9112 };
9113
9114 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
9115 }
9116
9117 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9121 self.0.request.name = v.into();
9122 self
9123 }
9124
9125 pub fn set_accept_data_use_terms<T: Into<bool>>(mut self, v: T) -> Self {
9129 self.0.request.accept_data_use_terms = v.into();
9130 self
9131 }
9132
9133 pub fn set_data_use_terms_version<T: Into<std::string::String>>(mut self, v: T) -> Self {
9137 self.0.request.data_use_terms_version = v.into();
9138 self
9139 }
9140 }
9141
9142 #[doc(hidden)]
9143 impl gax::options::internal::RequestBuilder for ProvisionProject {
9144 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9145 &mut self.0.options
9146 }
9147 }
9148
9149 #[derive(Clone, Debug)]
9171 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9172
9173 impl ListOperations {
9174 pub(crate) fn new(
9175 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9176 ) -> Self {
9177 Self(RequestBuilder::new(stub))
9178 }
9179
9180 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9182 mut self,
9183 v: V,
9184 ) -> Self {
9185 self.0.request = v.into();
9186 self
9187 }
9188
9189 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9191 self.0.options = v.into();
9192 self
9193 }
9194
9195 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9197 (*self.0.stub)
9198 .list_operations(self.0.request, self.0.options)
9199 .await
9200 .map(gax::response::Response::into_body)
9201 }
9202
9203 pub fn by_page(
9205 self,
9206 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9207 {
9208 use std::clone::Clone;
9209 let token = self.0.request.page_token.clone();
9210 let execute = move |token: String| {
9211 let mut builder = self.clone();
9212 builder.0.request = builder.0.request.set_page_token(token);
9213 builder.send()
9214 };
9215 gax::paginator::internal::new_paginator(token, execute)
9216 }
9217
9218 pub fn by_item(
9220 self,
9221 ) -> impl gax::paginator::ItemPaginator<
9222 longrunning::model::ListOperationsResponse,
9223 gax::error::Error,
9224 > {
9225 use gax::paginator::Paginator;
9226 self.by_page().items()
9227 }
9228
9229 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9231 self.0.request.name = v.into();
9232 self
9233 }
9234
9235 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9237 self.0.request.filter = v.into();
9238 self
9239 }
9240
9241 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9243 self.0.request.page_size = v.into();
9244 self
9245 }
9246
9247 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9249 self.0.request.page_token = v.into();
9250 self
9251 }
9252 }
9253
9254 #[doc(hidden)]
9255 impl gax::options::internal::RequestBuilder for ListOperations {
9256 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9257 &mut self.0.options
9258 }
9259 }
9260
9261 #[derive(Clone, Debug)]
9279 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9280
9281 impl GetOperation {
9282 pub(crate) fn new(
9283 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9284 ) -> Self {
9285 Self(RequestBuilder::new(stub))
9286 }
9287
9288 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9290 mut self,
9291 v: V,
9292 ) -> Self {
9293 self.0.request = v.into();
9294 self
9295 }
9296
9297 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9299 self.0.options = v.into();
9300 self
9301 }
9302
9303 pub async fn send(self) -> Result<longrunning::model::Operation> {
9305 (*self.0.stub)
9306 .get_operation(self.0.request, self.0.options)
9307 .await
9308 .map(gax::response::Response::into_body)
9309 }
9310
9311 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9313 self.0.request.name = v.into();
9314 self
9315 }
9316 }
9317
9318 #[doc(hidden)]
9319 impl gax::options::internal::RequestBuilder for GetOperation {
9320 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9321 &mut self.0.options
9322 }
9323 }
9324
9325 #[derive(Clone, Debug)]
9343 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9344
9345 impl CancelOperation {
9346 pub(crate) fn new(
9347 stub: std::sync::Arc<dyn super::super::stub::dynamic::ProjectService>,
9348 ) -> Self {
9349 Self(RequestBuilder::new(stub))
9350 }
9351
9352 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9354 mut self,
9355 v: V,
9356 ) -> Self {
9357 self.0.request = v.into();
9358 self
9359 }
9360
9361 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9363 self.0.options = v.into();
9364 self
9365 }
9366
9367 pub async fn send(self) -> Result<()> {
9369 (*self.0.stub)
9370 .cancel_operation(self.0.request, self.0.options)
9371 .await
9372 .map(gax::response::Response::into_body)
9373 }
9374
9375 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9377 self.0.request.name = v.into();
9378 self
9379 }
9380 }
9381
9382 #[doc(hidden)]
9383 impl gax::options::internal::RequestBuilder for CancelOperation {
9384 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9385 &mut self.0.options
9386 }
9387 }
9388}
9389
9390#[cfg(feature = "rank-service")]
9391#[cfg_attr(docsrs, doc(cfg(feature = "rank-service")))]
9392pub mod rank_service {
9393 use crate::Result;
9394
9395 pub type ClientBuilder =
9409 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9410
9411 pub(crate) mod client {
9412 use super::super::super::client::RankService;
9413 pub struct Factory;
9414 impl gax::client_builder::internal::ClientFactory for Factory {
9415 type Client = RankService;
9416 type Credentials = gaxi::options::Credentials;
9417 async fn build(
9418 self,
9419 config: gaxi::options::ClientConfig,
9420 ) -> gax::client_builder::Result<Self::Client> {
9421 Self::Client::new(config).await
9422 }
9423 }
9424 }
9425
9426 #[derive(Clone, Debug)]
9428 pub(crate) struct RequestBuilder<R: std::default::Default> {
9429 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9430 request: R,
9431 options: gax::options::RequestOptions,
9432 }
9433
9434 impl<R> RequestBuilder<R>
9435 where
9436 R: std::default::Default,
9437 {
9438 pub(crate) fn new(
9439 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9440 ) -> Self {
9441 Self {
9442 stub,
9443 request: R::default(),
9444 options: gax::options::RequestOptions::default(),
9445 }
9446 }
9447 }
9448
9449 #[derive(Clone, Debug)]
9467 pub struct Rank(RequestBuilder<crate::model::RankRequest>);
9468
9469 impl Rank {
9470 pub(crate) fn new(
9471 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9472 ) -> Self {
9473 Self(RequestBuilder::new(stub))
9474 }
9475
9476 pub fn with_request<V: Into<crate::model::RankRequest>>(mut self, v: V) -> Self {
9478 self.0.request = v.into();
9479 self
9480 }
9481
9482 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9484 self.0.options = v.into();
9485 self
9486 }
9487
9488 pub async fn send(self) -> Result<crate::model::RankResponse> {
9490 (*self.0.stub)
9491 .rank(self.0.request, self.0.options)
9492 .await
9493 .map(gax::response::Response::into_body)
9494 }
9495
9496 pub fn set_ranking_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9500 self.0.request.ranking_config = v.into();
9501 self
9502 }
9503
9504 pub fn set_model<T: Into<std::string::String>>(mut self, v: T) -> Self {
9506 self.0.request.model = v.into();
9507 self
9508 }
9509
9510 pub fn set_top_n<T: Into<i32>>(mut self, v: T) -> Self {
9512 self.0.request.top_n = v.into();
9513 self
9514 }
9515
9516 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
9518 self.0.request.query = v.into();
9519 self
9520 }
9521
9522 pub fn set_records<T, V>(mut self, v: T) -> Self
9526 where
9527 T: std::iter::IntoIterator<Item = V>,
9528 V: std::convert::Into<crate::model::RankingRecord>,
9529 {
9530 use std::iter::Iterator;
9531 self.0.request.records = v.into_iter().map(|i| i.into()).collect();
9532 self
9533 }
9534
9535 pub fn set_ignore_record_details_in_response<T: Into<bool>>(mut self, v: T) -> Self {
9537 self.0.request.ignore_record_details_in_response = v.into();
9538 self
9539 }
9540
9541 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9543 where
9544 T: std::iter::IntoIterator<Item = (K, V)>,
9545 K: std::convert::Into<std::string::String>,
9546 V: std::convert::Into<std::string::String>,
9547 {
9548 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9549 self
9550 }
9551 }
9552
9553 #[doc(hidden)]
9554 impl gax::options::internal::RequestBuilder for Rank {
9555 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9556 &mut self.0.options
9557 }
9558 }
9559
9560 #[derive(Clone, Debug)]
9582 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9583
9584 impl ListOperations {
9585 pub(crate) fn new(
9586 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9587 ) -> Self {
9588 Self(RequestBuilder::new(stub))
9589 }
9590
9591 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9593 mut self,
9594 v: V,
9595 ) -> Self {
9596 self.0.request = v.into();
9597 self
9598 }
9599
9600 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9602 self.0.options = v.into();
9603 self
9604 }
9605
9606 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9608 (*self.0.stub)
9609 .list_operations(self.0.request, self.0.options)
9610 .await
9611 .map(gax::response::Response::into_body)
9612 }
9613
9614 pub fn by_page(
9616 self,
9617 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9618 {
9619 use std::clone::Clone;
9620 let token = self.0.request.page_token.clone();
9621 let execute = move |token: String| {
9622 let mut builder = self.clone();
9623 builder.0.request = builder.0.request.set_page_token(token);
9624 builder.send()
9625 };
9626 gax::paginator::internal::new_paginator(token, execute)
9627 }
9628
9629 pub fn by_item(
9631 self,
9632 ) -> impl gax::paginator::ItemPaginator<
9633 longrunning::model::ListOperationsResponse,
9634 gax::error::Error,
9635 > {
9636 use gax::paginator::Paginator;
9637 self.by_page().items()
9638 }
9639
9640 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9642 self.0.request.name = v.into();
9643 self
9644 }
9645
9646 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9648 self.0.request.filter = v.into();
9649 self
9650 }
9651
9652 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9654 self.0.request.page_size = v.into();
9655 self
9656 }
9657
9658 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9660 self.0.request.page_token = v.into();
9661 self
9662 }
9663 }
9664
9665 #[doc(hidden)]
9666 impl gax::options::internal::RequestBuilder for ListOperations {
9667 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9668 &mut self.0.options
9669 }
9670 }
9671
9672 #[derive(Clone, Debug)]
9690 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9691
9692 impl GetOperation {
9693 pub(crate) fn new(
9694 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9695 ) -> Self {
9696 Self(RequestBuilder::new(stub))
9697 }
9698
9699 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9701 mut self,
9702 v: V,
9703 ) -> Self {
9704 self.0.request = v.into();
9705 self
9706 }
9707
9708 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9710 self.0.options = v.into();
9711 self
9712 }
9713
9714 pub async fn send(self) -> Result<longrunning::model::Operation> {
9716 (*self.0.stub)
9717 .get_operation(self.0.request, self.0.options)
9718 .await
9719 .map(gax::response::Response::into_body)
9720 }
9721
9722 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9724 self.0.request.name = v.into();
9725 self
9726 }
9727 }
9728
9729 #[doc(hidden)]
9730 impl gax::options::internal::RequestBuilder for GetOperation {
9731 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9732 &mut self.0.options
9733 }
9734 }
9735
9736 #[derive(Clone, Debug)]
9754 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9755
9756 impl CancelOperation {
9757 pub(crate) fn new(
9758 stub: std::sync::Arc<dyn super::super::stub::dynamic::RankService>,
9759 ) -> Self {
9760 Self(RequestBuilder::new(stub))
9761 }
9762
9763 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9765 mut self,
9766 v: V,
9767 ) -> Self {
9768 self.0.request = v.into();
9769 self
9770 }
9771
9772 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9774 self.0.options = v.into();
9775 self
9776 }
9777
9778 pub async fn send(self) -> Result<()> {
9780 (*self.0.stub)
9781 .cancel_operation(self.0.request, self.0.options)
9782 .await
9783 .map(gax::response::Response::into_body)
9784 }
9785
9786 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9788 self.0.request.name = v.into();
9789 self
9790 }
9791 }
9792
9793 #[doc(hidden)]
9794 impl gax::options::internal::RequestBuilder for CancelOperation {
9795 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9796 &mut self.0.options
9797 }
9798 }
9799}
9800
9801#[cfg(feature = "recommendation-service")]
9802#[cfg_attr(docsrs, doc(cfg(feature = "recommendation-service")))]
9803pub mod recommendation_service {
9804 use crate::Result;
9805
9806 pub type ClientBuilder =
9820 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9821
9822 pub(crate) mod client {
9823 use super::super::super::client::RecommendationService;
9824 pub struct Factory;
9825 impl gax::client_builder::internal::ClientFactory for Factory {
9826 type Client = RecommendationService;
9827 type Credentials = gaxi::options::Credentials;
9828 async fn build(
9829 self,
9830 config: gaxi::options::ClientConfig,
9831 ) -> gax::client_builder::Result<Self::Client> {
9832 Self::Client::new(config).await
9833 }
9834 }
9835 }
9836
9837 #[derive(Clone, Debug)]
9839 pub(crate) struct RequestBuilder<R: std::default::Default> {
9840 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9841 request: R,
9842 options: gax::options::RequestOptions,
9843 }
9844
9845 impl<R> RequestBuilder<R>
9846 where
9847 R: std::default::Default,
9848 {
9849 pub(crate) fn new(
9850 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9851 ) -> Self {
9852 Self {
9853 stub,
9854 request: R::default(),
9855 options: gax::options::RequestOptions::default(),
9856 }
9857 }
9858 }
9859
9860 #[derive(Clone, Debug)]
9878 pub struct Recommend(RequestBuilder<crate::model::RecommendRequest>);
9879
9880 impl Recommend {
9881 pub(crate) fn new(
9882 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
9883 ) -> Self {
9884 Self(RequestBuilder::new(stub))
9885 }
9886
9887 pub fn with_request<V: Into<crate::model::RecommendRequest>>(mut self, v: V) -> Self {
9889 self.0.request = v.into();
9890 self
9891 }
9892
9893 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9895 self.0.options = v.into();
9896 self
9897 }
9898
9899 pub async fn send(self) -> Result<crate::model::RecommendResponse> {
9901 (*self.0.stub)
9902 .recommend(self.0.request, self.0.options)
9903 .await
9904 .map(gax::response::Response::into_body)
9905 }
9906
9907 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
9911 self.0.request.serving_config = v.into();
9912 self
9913 }
9914
9915 pub fn set_user_event<T>(mut self, v: T) -> Self
9919 where
9920 T: std::convert::Into<crate::model::UserEvent>,
9921 {
9922 self.0.request.user_event = std::option::Option::Some(v.into());
9923 self
9924 }
9925
9926 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
9930 where
9931 T: std::convert::Into<crate::model::UserEvent>,
9932 {
9933 self.0.request.user_event = v.map(|x| x.into());
9934 self
9935 }
9936
9937 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9939 self.0.request.page_size = v.into();
9940 self
9941 }
9942
9943 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9945 self.0.request.filter = v.into();
9946 self
9947 }
9948
9949 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
9951 self.0.request.validate_only = v.into();
9952 self
9953 }
9954
9955 pub fn set_params<T, K, V>(mut self, v: T) -> Self
9957 where
9958 T: std::iter::IntoIterator<Item = (K, V)>,
9959 K: std::convert::Into<std::string::String>,
9960 V: std::convert::Into<wkt::Value>,
9961 {
9962 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9963 self
9964 }
9965
9966 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
9968 where
9969 T: std::iter::IntoIterator<Item = (K, V)>,
9970 K: std::convert::Into<std::string::String>,
9971 V: std::convert::Into<std::string::String>,
9972 {
9973 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9974 self
9975 }
9976 }
9977
9978 #[doc(hidden)]
9979 impl gax::options::internal::RequestBuilder for Recommend {
9980 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9981 &mut self.0.options
9982 }
9983 }
9984
9985 #[derive(Clone, Debug)]
10007 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
10008
10009 impl ListOperations {
10010 pub(crate) fn new(
10011 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10012 ) -> Self {
10013 Self(RequestBuilder::new(stub))
10014 }
10015
10016 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
10018 mut self,
10019 v: V,
10020 ) -> Self {
10021 self.0.request = v.into();
10022 self
10023 }
10024
10025 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10027 self.0.options = v.into();
10028 self
10029 }
10030
10031 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10033 (*self.0.stub)
10034 .list_operations(self.0.request, self.0.options)
10035 .await
10036 .map(gax::response::Response::into_body)
10037 }
10038
10039 pub fn by_page(
10041 self,
10042 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10043 {
10044 use std::clone::Clone;
10045 let token = self.0.request.page_token.clone();
10046 let execute = move |token: String| {
10047 let mut builder = self.clone();
10048 builder.0.request = builder.0.request.set_page_token(token);
10049 builder.send()
10050 };
10051 gax::paginator::internal::new_paginator(token, execute)
10052 }
10053
10054 pub fn by_item(
10056 self,
10057 ) -> impl gax::paginator::ItemPaginator<
10058 longrunning::model::ListOperationsResponse,
10059 gax::error::Error,
10060 > {
10061 use gax::paginator::Paginator;
10062 self.by_page().items()
10063 }
10064
10065 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10067 self.0.request.name = v.into();
10068 self
10069 }
10070
10071 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10073 self.0.request.filter = v.into();
10074 self
10075 }
10076
10077 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10079 self.0.request.page_size = v.into();
10080 self
10081 }
10082
10083 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10085 self.0.request.page_token = v.into();
10086 self
10087 }
10088 }
10089
10090 #[doc(hidden)]
10091 impl gax::options::internal::RequestBuilder for ListOperations {
10092 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10093 &mut self.0.options
10094 }
10095 }
10096
10097 #[derive(Clone, Debug)]
10115 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
10116
10117 impl GetOperation {
10118 pub(crate) fn new(
10119 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10120 ) -> Self {
10121 Self(RequestBuilder::new(stub))
10122 }
10123
10124 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
10126 mut self,
10127 v: V,
10128 ) -> Self {
10129 self.0.request = v.into();
10130 self
10131 }
10132
10133 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10135 self.0.options = v.into();
10136 self
10137 }
10138
10139 pub async fn send(self) -> Result<longrunning::model::Operation> {
10141 (*self.0.stub)
10142 .get_operation(self.0.request, self.0.options)
10143 .await
10144 .map(gax::response::Response::into_body)
10145 }
10146
10147 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10149 self.0.request.name = v.into();
10150 self
10151 }
10152 }
10153
10154 #[doc(hidden)]
10155 impl gax::options::internal::RequestBuilder for GetOperation {
10156 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10157 &mut self.0.options
10158 }
10159 }
10160
10161 #[derive(Clone, Debug)]
10179 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
10180
10181 impl CancelOperation {
10182 pub(crate) fn new(
10183 stub: std::sync::Arc<dyn super::super::stub::dynamic::RecommendationService>,
10184 ) -> Self {
10185 Self(RequestBuilder::new(stub))
10186 }
10187
10188 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
10190 mut self,
10191 v: V,
10192 ) -> Self {
10193 self.0.request = v.into();
10194 self
10195 }
10196
10197 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10199 self.0.options = v.into();
10200 self
10201 }
10202
10203 pub async fn send(self) -> Result<()> {
10205 (*self.0.stub)
10206 .cancel_operation(self.0.request, self.0.options)
10207 .await
10208 .map(gax::response::Response::into_body)
10209 }
10210
10211 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10213 self.0.request.name = v.into();
10214 self
10215 }
10216 }
10217
10218 #[doc(hidden)]
10219 impl gax::options::internal::RequestBuilder for CancelOperation {
10220 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10221 &mut self.0.options
10222 }
10223 }
10224}
10225
10226#[cfg(feature = "schema-service")]
10227#[cfg_attr(docsrs, doc(cfg(feature = "schema-service")))]
10228pub mod schema_service {
10229 use crate::Result;
10230
10231 pub type ClientBuilder =
10245 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10246
10247 pub(crate) mod client {
10248 use super::super::super::client::SchemaService;
10249 pub struct Factory;
10250 impl gax::client_builder::internal::ClientFactory for Factory {
10251 type Client = SchemaService;
10252 type Credentials = gaxi::options::Credentials;
10253 async fn build(
10254 self,
10255 config: gaxi::options::ClientConfig,
10256 ) -> gax::client_builder::Result<Self::Client> {
10257 Self::Client::new(config).await
10258 }
10259 }
10260 }
10261
10262 #[derive(Clone, Debug)]
10264 pub(crate) struct RequestBuilder<R: std::default::Default> {
10265 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10266 request: R,
10267 options: gax::options::RequestOptions,
10268 }
10269
10270 impl<R> RequestBuilder<R>
10271 where
10272 R: std::default::Default,
10273 {
10274 pub(crate) fn new(
10275 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10276 ) -> Self {
10277 Self {
10278 stub,
10279 request: R::default(),
10280 options: gax::options::RequestOptions::default(),
10281 }
10282 }
10283 }
10284
10285 #[derive(Clone, Debug)]
10303 pub struct GetSchema(RequestBuilder<crate::model::GetSchemaRequest>);
10304
10305 impl GetSchema {
10306 pub(crate) fn new(
10307 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10308 ) -> Self {
10309 Self(RequestBuilder::new(stub))
10310 }
10311
10312 pub fn with_request<V: Into<crate::model::GetSchemaRequest>>(mut self, v: V) -> Self {
10314 self.0.request = v.into();
10315 self
10316 }
10317
10318 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10320 self.0.options = v.into();
10321 self
10322 }
10323
10324 pub async fn send(self) -> Result<crate::model::Schema> {
10326 (*self.0.stub)
10327 .get_schema(self.0.request, self.0.options)
10328 .await
10329 .map(gax::response::Response::into_body)
10330 }
10331
10332 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10336 self.0.request.name = v.into();
10337 self
10338 }
10339 }
10340
10341 #[doc(hidden)]
10342 impl gax::options::internal::RequestBuilder for GetSchema {
10343 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10344 &mut self.0.options
10345 }
10346 }
10347
10348 #[derive(Clone, Debug)]
10370 pub struct ListSchemas(RequestBuilder<crate::model::ListSchemasRequest>);
10371
10372 impl ListSchemas {
10373 pub(crate) fn new(
10374 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10375 ) -> Self {
10376 Self(RequestBuilder::new(stub))
10377 }
10378
10379 pub fn with_request<V: Into<crate::model::ListSchemasRequest>>(mut self, v: V) -> Self {
10381 self.0.request = v.into();
10382 self
10383 }
10384
10385 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10387 self.0.options = v.into();
10388 self
10389 }
10390
10391 pub async fn send(self) -> Result<crate::model::ListSchemasResponse> {
10393 (*self.0.stub)
10394 .list_schemas(self.0.request, self.0.options)
10395 .await
10396 .map(gax::response::Response::into_body)
10397 }
10398
10399 pub fn by_page(
10401 self,
10402 ) -> impl gax::paginator::Paginator<crate::model::ListSchemasResponse, gax::error::Error>
10403 {
10404 use std::clone::Clone;
10405 let token = self.0.request.page_token.clone();
10406 let execute = move |token: String| {
10407 let mut builder = self.clone();
10408 builder.0.request = builder.0.request.set_page_token(token);
10409 builder.send()
10410 };
10411 gax::paginator::internal::new_paginator(token, execute)
10412 }
10413
10414 pub fn by_item(
10416 self,
10417 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSchemasResponse, gax::error::Error>
10418 {
10419 use gax::paginator::Paginator;
10420 self.by_page().items()
10421 }
10422
10423 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10427 self.0.request.parent = v.into();
10428 self
10429 }
10430
10431 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10433 self.0.request.page_size = v.into();
10434 self
10435 }
10436
10437 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10439 self.0.request.page_token = v.into();
10440 self
10441 }
10442 }
10443
10444 #[doc(hidden)]
10445 impl gax::options::internal::RequestBuilder for ListSchemas {
10446 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10447 &mut self.0.options
10448 }
10449 }
10450
10451 #[derive(Clone, Debug)]
10470 pub struct CreateSchema(RequestBuilder<crate::model::CreateSchemaRequest>);
10471
10472 impl CreateSchema {
10473 pub(crate) fn new(
10474 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10475 ) -> Self {
10476 Self(RequestBuilder::new(stub))
10477 }
10478
10479 pub fn with_request<V: Into<crate::model::CreateSchemaRequest>>(mut self, v: V) -> Self {
10481 self.0.request = v.into();
10482 self
10483 }
10484
10485 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10487 self.0.options = v.into();
10488 self
10489 }
10490
10491 pub async fn send(self) -> Result<longrunning::model::Operation> {
10498 (*self.0.stub)
10499 .create_schema(self.0.request, self.0.options)
10500 .await
10501 .map(gax::response::Response::into_body)
10502 }
10503
10504 pub fn poller(
10506 self,
10507 ) -> impl lro::Poller<crate::model::Schema, crate::model::CreateSchemaMetadata> {
10508 type Operation =
10509 lro::internal::Operation<crate::model::Schema, crate::model::CreateSchemaMetadata>;
10510 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10511 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10512
10513 let stub = self.0.stub.clone();
10514 let mut options = self.0.options.clone();
10515 options.set_retry_policy(gax::retry_policy::NeverRetry);
10516 let query = move |name| {
10517 let stub = stub.clone();
10518 let options = options.clone();
10519 async {
10520 let op = GetOperation::new(stub)
10521 .set_name(name)
10522 .with_options(options)
10523 .send()
10524 .await?;
10525 Ok(Operation::new(op))
10526 }
10527 };
10528
10529 let start = move || async {
10530 let op = self.send().await?;
10531 Ok(Operation::new(op))
10532 };
10533
10534 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10535 }
10536
10537 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10541 self.0.request.parent = v.into();
10542 self
10543 }
10544
10545 pub fn set_schema<T>(mut self, v: T) -> Self
10549 where
10550 T: std::convert::Into<crate::model::Schema>,
10551 {
10552 self.0.request.schema = std::option::Option::Some(v.into());
10553 self
10554 }
10555
10556 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10560 where
10561 T: std::convert::Into<crate::model::Schema>,
10562 {
10563 self.0.request.schema = v.map(|x| x.into());
10564 self
10565 }
10566
10567 pub fn set_schema_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
10571 self.0.request.schema_id = v.into();
10572 self
10573 }
10574 }
10575
10576 #[doc(hidden)]
10577 impl gax::options::internal::RequestBuilder for CreateSchema {
10578 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10579 &mut self.0.options
10580 }
10581 }
10582
10583 #[derive(Clone, Debug)]
10602 pub struct UpdateSchema(RequestBuilder<crate::model::UpdateSchemaRequest>);
10603
10604 impl UpdateSchema {
10605 pub(crate) fn new(
10606 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10607 ) -> Self {
10608 Self(RequestBuilder::new(stub))
10609 }
10610
10611 pub fn with_request<V: Into<crate::model::UpdateSchemaRequest>>(mut self, v: V) -> Self {
10613 self.0.request = v.into();
10614 self
10615 }
10616
10617 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10619 self.0.options = v.into();
10620 self
10621 }
10622
10623 pub async fn send(self) -> Result<longrunning::model::Operation> {
10630 (*self.0.stub)
10631 .update_schema(self.0.request, self.0.options)
10632 .await
10633 .map(gax::response::Response::into_body)
10634 }
10635
10636 pub fn poller(
10638 self,
10639 ) -> impl lro::Poller<crate::model::Schema, crate::model::UpdateSchemaMetadata> {
10640 type Operation =
10641 lro::internal::Operation<crate::model::Schema, crate::model::UpdateSchemaMetadata>;
10642 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10643 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10644
10645 let stub = self.0.stub.clone();
10646 let mut options = self.0.options.clone();
10647 options.set_retry_policy(gax::retry_policy::NeverRetry);
10648 let query = move |name| {
10649 let stub = stub.clone();
10650 let options = options.clone();
10651 async {
10652 let op = GetOperation::new(stub)
10653 .set_name(name)
10654 .with_options(options)
10655 .send()
10656 .await?;
10657 Ok(Operation::new(op))
10658 }
10659 };
10660
10661 let start = move || async {
10662 let op = self.send().await?;
10663 Ok(Operation::new(op))
10664 };
10665
10666 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10667 }
10668
10669 pub fn set_schema<T>(mut self, v: T) -> Self
10673 where
10674 T: std::convert::Into<crate::model::Schema>,
10675 {
10676 self.0.request.schema = std::option::Option::Some(v.into());
10677 self
10678 }
10679
10680 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
10684 where
10685 T: std::convert::Into<crate::model::Schema>,
10686 {
10687 self.0.request.schema = v.map(|x| x.into());
10688 self
10689 }
10690
10691 pub fn set_allow_missing<T: Into<bool>>(mut self, v: T) -> Self {
10693 self.0.request.allow_missing = v.into();
10694 self
10695 }
10696 }
10697
10698 #[doc(hidden)]
10699 impl gax::options::internal::RequestBuilder for UpdateSchema {
10700 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10701 &mut self.0.options
10702 }
10703 }
10704
10705 #[derive(Clone, Debug)]
10724 pub struct DeleteSchema(RequestBuilder<crate::model::DeleteSchemaRequest>);
10725
10726 impl DeleteSchema {
10727 pub(crate) fn new(
10728 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10729 ) -> Self {
10730 Self(RequestBuilder::new(stub))
10731 }
10732
10733 pub fn with_request<V: Into<crate::model::DeleteSchemaRequest>>(mut self, v: V) -> Self {
10735 self.0.request = v.into();
10736 self
10737 }
10738
10739 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10741 self.0.options = v.into();
10742 self
10743 }
10744
10745 pub async fn send(self) -> Result<longrunning::model::Operation> {
10752 (*self.0.stub)
10753 .delete_schema(self.0.request, self.0.options)
10754 .await
10755 .map(gax::response::Response::into_body)
10756 }
10757
10758 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteSchemaMetadata> {
10760 type Operation =
10761 lro::internal::Operation<wkt::Empty, crate::model::DeleteSchemaMetadata>;
10762 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10763 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10764
10765 let stub = self.0.stub.clone();
10766 let mut options = self.0.options.clone();
10767 options.set_retry_policy(gax::retry_policy::NeverRetry);
10768 let query = move |name| {
10769 let stub = stub.clone();
10770 let options = options.clone();
10771 async {
10772 let op = GetOperation::new(stub)
10773 .set_name(name)
10774 .with_options(options)
10775 .send()
10776 .await?;
10777 Ok(Operation::new(op))
10778 }
10779 };
10780
10781 let start = move || async {
10782 let op = self.send().await?;
10783 Ok(Operation::new(op))
10784 };
10785
10786 lro::internal::new_unit_response_poller(
10787 polling_error_policy,
10788 polling_backoff_policy,
10789 start,
10790 query,
10791 )
10792 }
10793
10794 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10798 self.0.request.name = v.into();
10799 self
10800 }
10801 }
10802
10803 #[doc(hidden)]
10804 impl gax::options::internal::RequestBuilder for DeleteSchema {
10805 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10806 &mut self.0.options
10807 }
10808 }
10809
10810 #[derive(Clone, Debug)]
10832 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
10833
10834 impl ListOperations {
10835 pub(crate) fn new(
10836 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10837 ) -> Self {
10838 Self(RequestBuilder::new(stub))
10839 }
10840
10841 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
10843 mut self,
10844 v: V,
10845 ) -> Self {
10846 self.0.request = v.into();
10847 self
10848 }
10849
10850 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10852 self.0.options = v.into();
10853 self
10854 }
10855
10856 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10858 (*self.0.stub)
10859 .list_operations(self.0.request, self.0.options)
10860 .await
10861 .map(gax::response::Response::into_body)
10862 }
10863
10864 pub fn by_page(
10866 self,
10867 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10868 {
10869 use std::clone::Clone;
10870 let token = self.0.request.page_token.clone();
10871 let execute = move |token: String| {
10872 let mut builder = self.clone();
10873 builder.0.request = builder.0.request.set_page_token(token);
10874 builder.send()
10875 };
10876 gax::paginator::internal::new_paginator(token, execute)
10877 }
10878
10879 pub fn by_item(
10881 self,
10882 ) -> impl gax::paginator::ItemPaginator<
10883 longrunning::model::ListOperationsResponse,
10884 gax::error::Error,
10885 > {
10886 use gax::paginator::Paginator;
10887 self.by_page().items()
10888 }
10889
10890 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10892 self.0.request.name = v.into();
10893 self
10894 }
10895
10896 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10898 self.0.request.filter = v.into();
10899 self
10900 }
10901
10902 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10904 self.0.request.page_size = v.into();
10905 self
10906 }
10907
10908 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10910 self.0.request.page_token = v.into();
10911 self
10912 }
10913 }
10914
10915 #[doc(hidden)]
10916 impl gax::options::internal::RequestBuilder for ListOperations {
10917 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10918 &mut self.0.options
10919 }
10920 }
10921
10922 #[derive(Clone, Debug)]
10940 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
10941
10942 impl GetOperation {
10943 pub(crate) fn new(
10944 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
10945 ) -> Self {
10946 Self(RequestBuilder::new(stub))
10947 }
10948
10949 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
10951 mut self,
10952 v: V,
10953 ) -> Self {
10954 self.0.request = v.into();
10955 self
10956 }
10957
10958 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10960 self.0.options = v.into();
10961 self
10962 }
10963
10964 pub async fn send(self) -> Result<longrunning::model::Operation> {
10966 (*self.0.stub)
10967 .get_operation(self.0.request, self.0.options)
10968 .await
10969 .map(gax::response::Response::into_body)
10970 }
10971
10972 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10974 self.0.request.name = v.into();
10975 self
10976 }
10977 }
10978
10979 #[doc(hidden)]
10980 impl gax::options::internal::RequestBuilder for GetOperation {
10981 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10982 &mut self.0.options
10983 }
10984 }
10985
10986 #[derive(Clone, Debug)]
11004 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
11005
11006 impl CancelOperation {
11007 pub(crate) fn new(
11008 stub: std::sync::Arc<dyn super::super::stub::dynamic::SchemaService>,
11009 ) -> Self {
11010 Self(RequestBuilder::new(stub))
11011 }
11012
11013 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
11015 mut self,
11016 v: V,
11017 ) -> Self {
11018 self.0.request = v.into();
11019 self
11020 }
11021
11022 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11024 self.0.options = v.into();
11025 self
11026 }
11027
11028 pub async fn send(self) -> Result<()> {
11030 (*self.0.stub)
11031 .cancel_operation(self.0.request, self.0.options)
11032 .await
11033 .map(gax::response::Response::into_body)
11034 }
11035
11036 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11038 self.0.request.name = v.into();
11039 self
11040 }
11041 }
11042
11043 #[doc(hidden)]
11044 impl gax::options::internal::RequestBuilder for CancelOperation {
11045 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11046 &mut self.0.options
11047 }
11048 }
11049}
11050
11051#[cfg(feature = "search-service")]
11052#[cfg_attr(docsrs, doc(cfg(feature = "search-service")))]
11053pub mod search_service {
11054 use crate::Result;
11055
11056 pub type ClientBuilder =
11070 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11071
11072 pub(crate) mod client {
11073 use super::super::super::client::SearchService;
11074 pub struct Factory;
11075 impl gax::client_builder::internal::ClientFactory for Factory {
11076 type Client = SearchService;
11077 type Credentials = gaxi::options::Credentials;
11078 async fn build(
11079 self,
11080 config: gaxi::options::ClientConfig,
11081 ) -> gax::client_builder::Result<Self::Client> {
11082 Self::Client::new(config).await
11083 }
11084 }
11085 }
11086
11087 #[derive(Clone, Debug)]
11089 pub(crate) struct RequestBuilder<R: std::default::Default> {
11090 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11091 request: R,
11092 options: gax::options::RequestOptions,
11093 }
11094
11095 impl<R> RequestBuilder<R>
11096 where
11097 R: std::default::Default,
11098 {
11099 pub(crate) fn new(
11100 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11101 ) -> Self {
11102 Self {
11103 stub,
11104 request: R::default(),
11105 options: gax::options::RequestOptions::default(),
11106 }
11107 }
11108 }
11109
11110 #[derive(Clone, Debug)]
11132 pub struct Search(RequestBuilder<crate::model::SearchRequest>);
11133
11134 impl Search {
11135 pub(crate) fn new(
11136 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11137 ) -> Self {
11138 Self(RequestBuilder::new(stub))
11139 }
11140
11141 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11143 self.0.request = v.into();
11144 self
11145 }
11146
11147 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11149 self.0.options = v.into();
11150 self
11151 }
11152
11153 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11155 (*self.0.stub)
11156 .search(self.0.request, self.0.options)
11157 .await
11158 .map(gax::response::Response::into_body)
11159 }
11160
11161 pub fn by_page(
11163 self,
11164 ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
11165 {
11166 use std::clone::Clone;
11167 let token = self.0.request.page_token.clone();
11168 let execute = move |token: String| {
11169 let mut builder = self.clone();
11170 builder.0.request = builder.0.request.set_page_token(token);
11171 builder.send()
11172 };
11173 gax::paginator::internal::new_paginator(token, execute)
11174 }
11175
11176 pub fn by_item(
11178 self,
11179 ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
11180 {
11181 use gax::paginator::Paginator;
11182 self.by_page().items()
11183 }
11184
11185 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11189 self.0.request.serving_config = v.into();
11190 self
11191 }
11192
11193 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11195 self.0.request.branch = v.into();
11196 self
11197 }
11198
11199 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11201 self.0.request.query = v.into();
11202 self
11203 }
11204
11205 pub fn set_image_query<T>(mut self, v: T) -> Self
11207 where
11208 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11209 {
11210 self.0.request.image_query = std::option::Option::Some(v.into());
11211 self
11212 }
11213
11214 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11216 where
11217 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11218 {
11219 self.0.request.image_query = v.map(|x| x.into());
11220 self
11221 }
11222
11223 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11225 self.0.request.page_size = v.into();
11226 self
11227 }
11228
11229 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11231 self.0.request.page_token = v.into();
11232 self
11233 }
11234
11235 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11237 self.0.request.offset = v.into();
11238 self
11239 }
11240
11241 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11243 self.0.request.one_box_page_size = v.into();
11244 self
11245 }
11246
11247 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11249 where
11250 T: std::iter::IntoIterator<Item = V>,
11251 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11252 {
11253 use std::iter::Iterator;
11254 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11255 self
11256 }
11257
11258 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11260 self.0.request.filter = v.into();
11261 self
11262 }
11263
11264 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11266 self.0.request.canonical_filter = v.into();
11267 self
11268 }
11269
11270 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11272 self.0.request.order_by = v.into();
11273 self
11274 }
11275
11276 pub fn set_user_info<T>(mut self, v: T) -> Self
11278 where
11279 T: std::convert::Into<crate::model::UserInfo>,
11280 {
11281 self.0.request.user_info = std::option::Option::Some(v.into());
11282 self
11283 }
11284
11285 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11287 where
11288 T: std::convert::Into<crate::model::UserInfo>,
11289 {
11290 self.0.request.user_info = v.map(|x| x.into());
11291 self
11292 }
11293
11294 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11296 self.0.request.language_code = v.into();
11297 self
11298 }
11299
11300 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11302 where
11303 T: std::iter::IntoIterator<Item = V>,
11304 V: std::convert::Into<crate::model::search_request::FacetSpec>,
11305 {
11306 use std::iter::Iterator;
11307 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11308 self
11309 }
11310
11311 pub fn set_boost_spec<T>(mut self, v: T) -> Self
11313 where
11314 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11315 {
11316 self.0.request.boost_spec = std::option::Option::Some(v.into());
11317 self
11318 }
11319
11320 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11322 where
11323 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11324 {
11325 self.0.request.boost_spec = v.map(|x| x.into());
11326 self
11327 }
11328
11329 pub fn set_params<T, K, V>(mut self, v: T) -> Self
11331 where
11332 T: std::iter::IntoIterator<Item = (K, V)>,
11333 K: std::convert::Into<std::string::String>,
11334 V: std::convert::Into<wkt::Value>,
11335 {
11336 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11337 self
11338 }
11339
11340 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11342 where
11343 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11344 {
11345 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11346 self
11347 }
11348
11349 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11351 where
11352 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11353 {
11354 self.0.request.query_expansion_spec = v.map(|x| x.into());
11355 self
11356 }
11357
11358 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11360 where
11361 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11362 {
11363 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11364 self
11365 }
11366
11367 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11369 where
11370 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11371 {
11372 self.0.request.spell_correction_spec = v.map(|x| x.into());
11373 self
11374 }
11375
11376 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11378 self.0.request.user_pseudo_id = v.into();
11379 self
11380 }
11381
11382 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11384 where
11385 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11386 {
11387 self.0.request.content_search_spec = std::option::Option::Some(v.into());
11388 self
11389 }
11390
11391 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11393 where
11394 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11395 {
11396 self.0.request.content_search_spec = v.map(|x| x.into());
11397 self
11398 }
11399
11400 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11402 self.0.request.safe_search = v.into();
11403 self
11404 }
11405
11406 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11408 where
11409 T: std::iter::IntoIterator<Item = (K, V)>,
11410 K: std::convert::Into<std::string::String>,
11411 V: std::convert::Into<std::string::String>,
11412 {
11413 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11414 self
11415 }
11416
11417 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11419 where
11420 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11421 {
11422 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11423 self
11424 }
11425
11426 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11428 where
11429 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11430 {
11431 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11432 self
11433 }
11434
11435 pub fn set_display_spec<T>(mut self, v: T) -> Self
11437 where
11438 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11439 {
11440 self.0.request.display_spec = std::option::Option::Some(v.into());
11441 self
11442 }
11443
11444 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11446 where
11447 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11448 {
11449 self.0.request.display_spec = v.map(|x| x.into());
11450 self
11451 }
11452
11453 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11455 self.0.request.session = v.into();
11456 self
11457 }
11458
11459 pub fn set_session_spec<T>(mut self, v: T) -> Self
11461 where
11462 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11463 {
11464 self.0.request.session_spec = std::option::Option::Some(v.into());
11465 self
11466 }
11467
11468 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11470 where
11471 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11472 {
11473 self.0.request.session_spec = v.map(|x| x.into());
11474 self
11475 }
11476
11477 pub fn set_relevance_threshold<
11479 T: Into<crate::model::search_request::RelevanceThreshold>,
11480 >(
11481 mut self,
11482 v: T,
11483 ) -> Self {
11484 self.0.request.relevance_threshold = v.into();
11485 self
11486 }
11487
11488 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11490 where
11491 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11492 {
11493 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11494 self
11495 }
11496
11497 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11499 where
11500 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11501 {
11502 self.0.request.relevance_score_spec = v.map(|x| x.into());
11503 self
11504 }
11505 }
11506
11507 #[doc(hidden)]
11508 impl gax::options::internal::RequestBuilder for Search {
11509 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11510 &mut self.0.options
11511 }
11512 }
11513
11514 #[derive(Clone, Debug)]
11536 pub struct SearchLite(RequestBuilder<crate::model::SearchRequest>);
11537
11538 impl SearchLite {
11539 pub(crate) fn new(
11540 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11541 ) -> Self {
11542 Self(RequestBuilder::new(stub))
11543 }
11544
11545 pub fn with_request<V: Into<crate::model::SearchRequest>>(mut self, v: V) -> Self {
11547 self.0.request = v.into();
11548 self
11549 }
11550
11551 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11553 self.0.options = v.into();
11554 self
11555 }
11556
11557 pub async fn send(self) -> Result<crate::model::SearchResponse> {
11559 (*self.0.stub)
11560 .search_lite(self.0.request, self.0.options)
11561 .await
11562 .map(gax::response::Response::into_body)
11563 }
11564
11565 pub fn by_page(
11567 self,
11568 ) -> impl gax::paginator::Paginator<crate::model::SearchResponse, gax::error::Error>
11569 {
11570 use std::clone::Clone;
11571 let token = self.0.request.page_token.clone();
11572 let execute = move |token: String| {
11573 let mut builder = self.clone();
11574 builder.0.request = builder.0.request.set_page_token(token);
11575 builder.send()
11576 };
11577 gax::paginator::internal::new_paginator(token, execute)
11578 }
11579
11580 pub fn by_item(
11582 self,
11583 ) -> impl gax::paginator::ItemPaginator<crate::model::SearchResponse, gax::error::Error>
11584 {
11585 use gax::paginator::Paginator;
11586 self.by_page().items()
11587 }
11588
11589 pub fn set_serving_config<T: Into<std::string::String>>(mut self, v: T) -> Self {
11593 self.0.request.serving_config = v.into();
11594 self
11595 }
11596
11597 pub fn set_branch<T: Into<std::string::String>>(mut self, v: T) -> Self {
11599 self.0.request.branch = v.into();
11600 self
11601 }
11602
11603 pub fn set_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
11605 self.0.request.query = v.into();
11606 self
11607 }
11608
11609 pub fn set_image_query<T>(mut self, v: T) -> Self
11611 where
11612 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11613 {
11614 self.0.request.image_query = std::option::Option::Some(v.into());
11615 self
11616 }
11617
11618 pub fn set_or_clear_image_query<T>(mut self, v: std::option::Option<T>) -> Self
11620 where
11621 T: std::convert::Into<crate::model::search_request::ImageQuery>,
11622 {
11623 self.0.request.image_query = v.map(|x| x.into());
11624 self
11625 }
11626
11627 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11629 self.0.request.page_size = v.into();
11630 self
11631 }
11632
11633 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11635 self.0.request.page_token = v.into();
11636 self
11637 }
11638
11639 pub fn set_offset<T: Into<i32>>(mut self, v: T) -> Self {
11641 self.0.request.offset = v.into();
11642 self
11643 }
11644
11645 pub fn set_one_box_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11647 self.0.request.one_box_page_size = v.into();
11648 self
11649 }
11650
11651 pub fn set_data_store_specs<T, V>(mut self, v: T) -> Self
11653 where
11654 T: std::iter::IntoIterator<Item = V>,
11655 V: std::convert::Into<crate::model::search_request::DataStoreSpec>,
11656 {
11657 use std::iter::Iterator;
11658 self.0.request.data_store_specs = v.into_iter().map(|i| i.into()).collect();
11659 self
11660 }
11661
11662 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11664 self.0.request.filter = v.into();
11665 self
11666 }
11667
11668 pub fn set_canonical_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11670 self.0.request.canonical_filter = v.into();
11671 self
11672 }
11673
11674 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
11676 self.0.request.order_by = v.into();
11677 self
11678 }
11679
11680 pub fn set_user_info<T>(mut self, v: T) -> Self
11682 where
11683 T: std::convert::Into<crate::model::UserInfo>,
11684 {
11685 self.0.request.user_info = std::option::Option::Some(v.into());
11686 self
11687 }
11688
11689 pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
11691 where
11692 T: std::convert::Into<crate::model::UserInfo>,
11693 {
11694 self.0.request.user_info = v.map(|x| x.into());
11695 self
11696 }
11697
11698 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11700 self.0.request.language_code = v.into();
11701 self
11702 }
11703
11704 pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
11706 where
11707 T: std::iter::IntoIterator<Item = V>,
11708 V: std::convert::Into<crate::model::search_request::FacetSpec>,
11709 {
11710 use std::iter::Iterator;
11711 self.0.request.facet_specs = v.into_iter().map(|i| i.into()).collect();
11712 self
11713 }
11714
11715 pub fn set_boost_spec<T>(mut self, v: T) -> Self
11717 where
11718 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11719 {
11720 self.0.request.boost_spec = std::option::Option::Some(v.into());
11721 self
11722 }
11723
11724 pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
11726 where
11727 T: std::convert::Into<crate::model::search_request::BoostSpec>,
11728 {
11729 self.0.request.boost_spec = v.map(|x| x.into());
11730 self
11731 }
11732
11733 pub fn set_params<T, K, V>(mut self, v: T) -> Self
11735 where
11736 T: std::iter::IntoIterator<Item = (K, V)>,
11737 K: std::convert::Into<std::string::String>,
11738 V: std::convert::Into<wkt::Value>,
11739 {
11740 self.0.request.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11741 self
11742 }
11743
11744 pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
11746 where
11747 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11748 {
11749 self.0.request.query_expansion_spec = std::option::Option::Some(v.into());
11750 self
11751 }
11752
11753 pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
11755 where
11756 T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
11757 {
11758 self.0.request.query_expansion_spec = v.map(|x| x.into());
11759 self
11760 }
11761
11762 pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
11764 where
11765 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11766 {
11767 self.0.request.spell_correction_spec = std::option::Option::Some(v.into());
11768 self
11769 }
11770
11771 pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
11773 where
11774 T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
11775 {
11776 self.0.request.spell_correction_spec = v.map(|x| x.into());
11777 self
11778 }
11779
11780 pub fn set_user_pseudo_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
11782 self.0.request.user_pseudo_id = v.into();
11783 self
11784 }
11785
11786 pub fn set_content_search_spec<T>(mut self, v: T) -> Self
11788 where
11789 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11790 {
11791 self.0.request.content_search_spec = std::option::Option::Some(v.into());
11792 self
11793 }
11794
11795 pub fn set_or_clear_content_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
11797 where
11798 T: std::convert::Into<crate::model::search_request::ContentSearchSpec>,
11799 {
11800 self.0.request.content_search_spec = v.map(|x| x.into());
11801 self
11802 }
11803
11804 pub fn set_safe_search<T: Into<bool>>(mut self, v: T) -> Self {
11806 self.0.request.safe_search = v.into();
11807 self
11808 }
11809
11810 pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
11812 where
11813 T: std::iter::IntoIterator<Item = (K, V)>,
11814 K: std::convert::Into<std::string::String>,
11815 V: std::convert::Into<std::string::String>,
11816 {
11817 self.0.request.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11818 self
11819 }
11820
11821 pub fn set_search_as_you_type_spec<T>(mut self, v: T) -> Self
11823 where
11824 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11825 {
11826 self.0.request.search_as_you_type_spec = std::option::Option::Some(v.into());
11827 self
11828 }
11829
11830 pub fn set_or_clear_search_as_you_type_spec<T>(mut self, v: std::option::Option<T>) -> Self
11832 where
11833 T: std::convert::Into<crate::model::search_request::SearchAsYouTypeSpec>,
11834 {
11835 self.0.request.search_as_you_type_spec = v.map(|x| x.into());
11836 self
11837 }
11838
11839 pub fn set_display_spec<T>(mut self, v: T) -> Self
11841 where
11842 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11843 {
11844 self.0.request.display_spec = std::option::Option::Some(v.into());
11845 self
11846 }
11847
11848 pub fn set_or_clear_display_spec<T>(mut self, v: std::option::Option<T>) -> Self
11850 where
11851 T: std::convert::Into<crate::model::search_request::DisplaySpec>,
11852 {
11853 self.0.request.display_spec = v.map(|x| x.into());
11854 self
11855 }
11856
11857 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
11859 self.0.request.session = v.into();
11860 self
11861 }
11862
11863 pub fn set_session_spec<T>(mut self, v: T) -> Self
11865 where
11866 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11867 {
11868 self.0.request.session_spec = std::option::Option::Some(v.into());
11869 self
11870 }
11871
11872 pub fn set_or_clear_session_spec<T>(mut self, v: std::option::Option<T>) -> Self
11874 where
11875 T: std::convert::Into<crate::model::search_request::SessionSpec>,
11876 {
11877 self.0.request.session_spec = v.map(|x| x.into());
11878 self
11879 }
11880
11881 pub fn set_relevance_threshold<
11883 T: Into<crate::model::search_request::RelevanceThreshold>,
11884 >(
11885 mut self,
11886 v: T,
11887 ) -> Self {
11888 self.0.request.relevance_threshold = v.into();
11889 self
11890 }
11891
11892 pub fn set_relevance_score_spec<T>(mut self, v: T) -> Self
11894 where
11895 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11896 {
11897 self.0.request.relevance_score_spec = std::option::Option::Some(v.into());
11898 self
11899 }
11900
11901 pub fn set_or_clear_relevance_score_spec<T>(mut self, v: std::option::Option<T>) -> Self
11903 where
11904 T: std::convert::Into<crate::model::search_request::RelevanceScoreSpec>,
11905 {
11906 self.0.request.relevance_score_spec = v.map(|x| x.into());
11907 self
11908 }
11909 }
11910
11911 #[doc(hidden)]
11912 impl gax::options::internal::RequestBuilder for SearchLite {
11913 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11914 &mut self.0.options
11915 }
11916 }
11917
11918 #[derive(Clone, Debug)]
11940 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
11941
11942 impl ListOperations {
11943 pub(crate) fn new(
11944 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
11945 ) -> Self {
11946 Self(RequestBuilder::new(stub))
11947 }
11948
11949 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
11951 mut self,
11952 v: V,
11953 ) -> Self {
11954 self.0.request = v.into();
11955 self
11956 }
11957
11958 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11960 self.0.options = v.into();
11961 self
11962 }
11963
11964 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
11966 (*self.0.stub)
11967 .list_operations(self.0.request, self.0.options)
11968 .await
11969 .map(gax::response::Response::into_body)
11970 }
11971
11972 pub fn by_page(
11974 self,
11975 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
11976 {
11977 use std::clone::Clone;
11978 let token = self.0.request.page_token.clone();
11979 let execute = move |token: String| {
11980 let mut builder = self.clone();
11981 builder.0.request = builder.0.request.set_page_token(token);
11982 builder.send()
11983 };
11984 gax::paginator::internal::new_paginator(token, execute)
11985 }
11986
11987 pub fn by_item(
11989 self,
11990 ) -> impl gax::paginator::ItemPaginator<
11991 longrunning::model::ListOperationsResponse,
11992 gax::error::Error,
11993 > {
11994 use gax::paginator::Paginator;
11995 self.by_page().items()
11996 }
11997
11998 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12000 self.0.request.name = v.into();
12001 self
12002 }
12003
12004 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12006 self.0.request.filter = v.into();
12007 self
12008 }
12009
12010 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12012 self.0.request.page_size = v.into();
12013 self
12014 }
12015
12016 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12018 self.0.request.page_token = v.into();
12019 self
12020 }
12021 }
12022
12023 #[doc(hidden)]
12024 impl gax::options::internal::RequestBuilder for ListOperations {
12025 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12026 &mut self.0.options
12027 }
12028 }
12029
12030 #[derive(Clone, Debug)]
12048 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12049
12050 impl GetOperation {
12051 pub(crate) fn new(
12052 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12053 ) -> Self {
12054 Self(RequestBuilder::new(stub))
12055 }
12056
12057 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12059 mut self,
12060 v: V,
12061 ) -> Self {
12062 self.0.request = v.into();
12063 self
12064 }
12065
12066 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12068 self.0.options = v.into();
12069 self
12070 }
12071
12072 pub async fn send(self) -> Result<longrunning::model::Operation> {
12074 (*self.0.stub)
12075 .get_operation(self.0.request, self.0.options)
12076 .await
12077 .map(gax::response::Response::into_body)
12078 }
12079
12080 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12082 self.0.request.name = v.into();
12083 self
12084 }
12085 }
12086
12087 #[doc(hidden)]
12088 impl gax::options::internal::RequestBuilder for GetOperation {
12089 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12090 &mut self.0.options
12091 }
12092 }
12093
12094 #[derive(Clone, Debug)]
12112 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12113
12114 impl CancelOperation {
12115 pub(crate) fn new(
12116 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchService>,
12117 ) -> Self {
12118 Self(RequestBuilder::new(stub))
12119 }
12120
12121 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12123 mut self,
12124 v: V,
12125 ) -> Self {
12126 self.0.request = v.into();
12127 self
12128 }
12129
12130 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12132 self.0.options = v.into();
12133 self
12134 }
12135
12136 pub async fn send(self) -> Result<()> {
12138 (*self.0.stub)
12139 .cancel_operation(self.0.request, self.0.options)
12140 .await
12141 .map(gax::response::Response::into_body)
12142 }
12143
12144 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12146 self.0.request.name = v.into();
12147 self
12148 }
12149 }
12150
12151 #[doc(hidden)]
12152 impl gax::options::internal::RequestBuilder for CancelOperation {
12153 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12154 &mut self.0.options
12155 }
12156 }
12157}
12158
12159#[cfg(feature = "search-tuning-service")]
12160#[cfg_attr(docsrs, doc(cfg(feature = "search-tuning-service")))]
12161pub mod search_tuning_service {
12162 use crate::Result;
12163
12164 pub type ClientBuilder =
12178 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12179
12180 pub(crate) mod client {
12181 use super::super::super::client::SearchTuningService;
12182 pub struct Factory;
12183 impl gax::client_builder::internal::ClientFactory for Factory {
12184 type Client = SearchTuningService;
12185 type Credentials = gaxi::options::Credentials;
12186 async fn build(
12187 self,
12188 config: gaxi::options::ClientConfig,
12189 ) -> gax::client_builder::Result<Self::Client> {
12190 Self::Client::new(config).await
12191 }
12192 }
12193 }
12194
12195 #[derive(Clone, Debug)]
12197 pub(crate) struct RequestBuilder<R: std::default::Default> {
12198 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12199 request: R,
12200 options: gax::options::RequestOptions,
12201 }
12202
12203 impl<R> RequestBuilder<R>
12204 where
12205 R: std::default::Default,
12206 {
12207 pub(crate) fn new(
12208 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12209 ) -> Self {
12210 Self {
12211 stub,
12212 request: R::default(),
12213 options: gax::options::RequestOptions::default(),
12214 }
12215 }
12216 }
12217
12218 #[derive(Clone, Debug)]
12237 pub struct TrainCustomModel(RequestBuilder<crate::model::TrainCustomModelRequest>);
12238
12239 impl TrainCustomModel {
12240 pub(crate) fn new(
12241 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12242 ) -> Self {
12243 Self(RequestBuilder::new(stub))
12244 }
12245
12246 pub fn with_request<V: Into<crate::model::TrainCustomModelRequest>>(
12248 mut self,
12249 v: V,
12250 ) -> Self {
12251 self.0.request = v.into();
12252 self
12253 }
12254
12255 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12257 self.0.options = v.into();
12258 self
12259 }
12260
12261 pub async fn send(self) -> Result<longrunning::model::Operation> {
12268 (*self.0.stub)
12269 .train_custom_model(self.0.request, self.0.options)
12270 .await
12271 .map(gax::response::Response::into_body)
12272 }
12273
12274 pub fn poller(
12276 self,
12277 ) -> impl lro::Poller<
12278 crate::model::TrainCustomModelResponse,
12279 crate::model::TrainCustomModelMetadata,
12280 > {
12281 type Operation = lro::internal::Operation<
12282 crate::model::TrainCustomModelResponse,
12283 crate::model::TrainCustomModelMetadata,
12284 >;
12285 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
12286 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
12287
12288 let stub = self.0.stub.clone();
12289 let mut options = self.0.options.clone();
12290 options.set_retry_policy(gax::retry_policy::NeverRetry);
12291 let query = move |name| {
12292 let stub = stub.clone();
12293 let options = options.clone();
12294 async {
12295 let op = GetOperation::new(stub)
12296 .set_name(name)
12297 .with_options(options)
12298 .send()
12299 .await?;
12300 Ok(Operation::new(op))
12301 }
12302 };
12303
12304 let start = move || async {
12305 let op = self.send().await?;
12306 Ok(Operation::new(op))
12307 };
12308
12309 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
12310 }
12311
12312 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12316 self.0.request.data_store = v.into();
12317 self
12318 }
12319
12320 pub fn set_model_type<T: Into<std::string::String>>(mut self, v: T) -> Self {
12322 self.0.request.model_type = v.into();
12323 self
12324 }
12325
12326 pub fn set_error_config<T>(mut self, v: T) -> Self
12328 where
12329 T: std::convert::Into<crate::model::ImportErrorConfig>,
12330 {
12331 self.0.request.error_config = std::option::Option::Some(v.into());
12332 self
12333 }
12334
12335 pub fn set_or_clear_error_config<T>(mut self, v: std::option::Option<T>) -> Self
12337 where
12338 T: std::convert::Into<crate::model::ImportErrorConfig>,
12339 {
12340 self.0.request.error_config = v.map(|x| x.into());
12341 self
12342 }
12343
12344 pub fn set_model_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12346 self.0.request.model_id = v.into();
12347 self
12348 }
12349
12350 pub fn set_training_input<
12355 T: Into<Option<crate::model::train_custom_model_request::TrainingInput>>,
12356 >(
12357 mut self,
12358 v: T,
12359 ) -> Self {
12360 self.0.request.training_input = v.into();
12361 self
12362 }
12363
12364 pub fn set_gcs_training_input<
12370 T: std::convert::Into<
12371 std::boxed::Box<crate::model::train_custom_model_request::GcsTrainingInput>,
12372 >,
12373 >(
12374 mut self,
12375 v: T,
12376 ) -> Self {
12377 self.0.request = self.0.request.set_gcs_training_input(v);
12378 self
12379 }
12380 }
12381
12382 #[doc(hidden)]
12383 impl gax::options::internal::RequestBuilder for TrainCustomModel {
12384 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12385 &mut self.0.options
12386 }
12387 }
12388
12389 #[derive(Clone, Debug)]
12407 pub struct ListCustomModels(RequestBuilder<crate::model::ListCustomModelsRequest>);
12408
12409 impl ListCustomModels {
12410 pub(crate) fn new(
12411 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12412 ) -> Self {
12413 Self(RequestBuilder::new(stub))
12414 }
12415
12416 pub fn with_request<V: Into<crate::model::ListCustomModelsRequest>>(
12418 mut self,
12419 v: V,
12420 ) -> Self {
12421 self.0.request = v.into();
12422 self
12423 }
12424
12425 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12427 self.0.options = v.into();
12428 self
12429 }
12430
12431 pub async fn send(self) -> Result<crate::model::ListCustomModelsResponse> {
12433 (*self.0.stub)
12434 .list_custom_models(self.0.request, self.0.options)
12435 .await
12436 .map(gax::response::Response::into_body)
12437 }
12438
12439 pub fn set_data_store<T: Into<std::string::String>>(mut self, v: T) -> Self {
12443 self.0.request.data_store = v.into();
12444 self
12445 }
12446 }
12447
12448 #[doc(hidden)]
12449 impl gax::options::internal::RequestBuilder for ListCustomModels {
12450 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12451 &mut self.0.options
12452 }
12453 }
12454
12455 #[derive(Clone, Debug)]
12477 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12478
12479 impl ListOperations {
12480 pub(crate) fn new(
12481 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12482 ) -> Self {
12483 Self(RequestBuilder::new(stub))
12484 }
12485
12486 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12488 mut self,
12489 v: V,
12490 ) -> Self {
12491 self.0.request = v.into();
12492 self
12493 }
12494
12495 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12497 self.0.options = v.into();
12498 self
12499 }
12500
12501 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12503 (*self.0.stub)
12504 .list_operations(self.0.request, self.0.options)
12505 .await
12506 .map(gax::response::Response::into_body)
12507 }
12508
12509 pub fn by_page(
12511 self,
12512 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12513 {
12514 use std::clone::Clone;
12515 let token = self.0.request.page_token.clone();
12516 let execute = move |token: String| {
12517 let mut builder = self.clone();
12518 builder.0.request = builder.0.request.set_page_token(token);
12519 builder.send()
12520 };
12521 gax::paginator::internal::new_paginator(token, execute)
12522 }
12523
12524 pub fn by_item(
12526 self,
12527 ) -> impl gax::paginator::ItemPaginator<
12528 longrunning::model::ListOperationsResponse,
12529 gax::error::Error,
12530 > {
12531 use gax::paginator::Paginator;
12532 self.by_page().items()
12533 }
12534
12535 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12537 self.0.request.name = v.into();
12538 self
12539 }
12540
12541 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12543 self.0.request.filter = v.into();
12544 self
12545 }
12546
12547 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12549 self.0.request.page_size = v.into();
12550 self
12551 }
12552
12553 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12555 self.0.request.page_token = v.into();
12556 self
12557 }
12558 }
12559
12560 #[doc(hidden)]
12561 impl gax::options::internal::RequestBuilder for ListOperations {
12562 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12563 &mut self.0.options
12564 }
12565 }
12566
12567 #[derive(Clone, Debug)]
12585 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12586
12587 impl GetOperation {
12588 pub(crate) fn new(
12589 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12590 ) -> Self {
12591 Self(RequestBuilder::new(stub))
12592 }
12593
12594 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12596 mut self,
12597 v: V,
12598 ) -> Self {
12599 self.0.request = v.into();
12600 self
12601 }
12602
12603 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12605 self.0.options = v.into();
12606 self
12607 }
12608
12609 pub async fn send(self) -> Result<longrunning::model::Operation> {
12611 (*self.0.stub)
12612 .get_operation(self.0.request, self.0.options)
12613 .await
12614 .map(gax::response::Response::into_body)
12615 }
12616
12617 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12619 self.0.request.name = v.into();
12620 self
12621 }
12622 }
12623
12624 #[doc(hidden)]
12625 impl gax::options::internal::RequestBuilder for GetOperation {
12626 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12627 &mut self.0.options
12628 }
12629 }
12630
12631 #[derive(Clone, Debug)]
12649 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12650
12651 impl CancelOperation {
12652 pub(crate) fn new(
12653 stub: std::sync::Arc<dyn super::super::stub::dynamic::SearchTuningService>,
12654 ) -> Self {
12655 Self(RequestBuilder::new(stub))
12656 }
12657
12658 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12660 mut self,
12661 v: V,
12662 ) -> Self {
12663 self.0.request = v.into();
12664 self
12665 }
12666
12667 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12669 self.0.options = v.into();
12670 self
12671 }
12672
12673 pub async fn send(self) -> Result<()> {
12675 (*self.0.stub)
12676 .cancel_operation(self.0.request, self.0.options)
12677 .await
12678 .map(gax::response::Response::into_body)
12679 }
12680
12681 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12683 self.0.request.name = v.into();
12684 self
12685 }
12686 }
12687
12688 #[doc(hidden)]
12689 impl gax::options::internal::RequestBuilder for CancelOperation {
12690 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12691 &mut self.0.options
12692 }
12693 }
12694}
12695
12696#[cfg(feature = "serving-config-service")]
12697#[cfg_attr(docsrs, doc(cfg(feature = "serving-config-service")))]
12698pub mod serving_config_service {
12699 use crate::Result;
12700
12701 pub type ClientBuilder =
12715 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12716
12717 pub(crate) mod client {
12718 use super::super::super::client::ServingConfigService;
12719 pub struct Factory;
12720 impl gax::client_builder::internal::ClientFactory for Factory {
12721 type Client = ServingConfigService;
12722 type Credentials = gaxi::options::Credentials;
12723 async fn build(
12724 self,
12725 config: gaxi::options::ClientConfig,
12726 ) -> gax::client_builder::Result<Self::Client> {
12727 Self::Client::new(config).await
12728 }
12729 }
12730 }
12731
12732 #[derive(Clone, Debug)]
12734 pub(crate) struct RequestBuilder<R: std::default::Default> {
12735 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12736 request: R,
12737 options: gax::options::RequestOptions,
12738 }
12739
12740 impl<R> RequestBuilder<R>
12741 where
12742 R: std::default::Default,
12743 {
12744 pub(crate) fn new(
12745 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12746 ) -> Self {
12747 Self {
12748 stub,
12749 request: R::default(),
12750 options: gax::options::RequestOptions::default(),
12751 }
12752 }
12753 }
12754
12755 #[derive(Clone, Debug)]
12773 pub struct UpdateServingConfig(RequestBuilder<crate::model::UpdateServingConfigRequest>);
12774
12775 impl UpdateServingConfig {
12776 pub(crate) fn new(
12777 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12778 ) -> Self {
12779 Self(RequestBuilder::new(stub))
12780 }
12781
12782 pub fn with_request<V: Into<crate::model::UpdateServingConfigRequest>>(
12784 mut self,
12785 v: V,
12786 ) -> Self {
12787 self.0.request = v.into();
12788 self
12789 }
12790
12791 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12793 self.0.options = v.into();
12794 self
12795 }
12796
12797 pub async fn send(self) -> Result<crate::model::ServingConfig> {
12799 (*self.0.stub)
12800 .update_serving_config(self.0.request, self.0.options)
12801 .await
12802 .map(gax::response::Response::into_body)
12803 }
12804
12805 pub fn set_serving_config<T>(mut self, v: T) -> Self
12809 where
12810 T: std::convert::Into<crate::model::ServingConfig>,
12811 {
12812 self.0.request.serving_config = std::option::Option::Some(v.into());
12813 self
12814 }
12815
12816 pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
12820 where
12821 T: std::convert::Into<crate::model::ServingConfig>,
12822 {
12823 self.0.request.serving_config = v.map(|x| x.into());
12824 self
12825 }
12826
12827 pub fn set_update_mask<T>(mut self, v: T) -> Self
12829 where
12830 T: std::convert::Into<wkt::FieldMask>,
12831 {
12832 self.0.request.update_mask = std::option::Option::Some(v.into());
12833 self
12834 }
12835
12836 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12838 where
12839 T: std::convert::Into<wkt::FieldMask>,
12840 {
12841 self.0.request.update_mask = v.map(|x| x.into());
12842 self
12843 }
12844 }
12845
12846 #[doc(hidden)]
12847 impl gax::options::internal::RequestBuilder for UpdateServingConfig {
12848 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12849 &mut self.0.options
12850 }
12851 }
12852
12853 #[derive(Clone, Debug)]
12875 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12876
12877 impl ListOperations {
12878 pub(crate) fn new(
12879 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12880 ) -> Self {
12881 Self(RequestBuilder::new(stub))
12882 }
12883
12884 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12886 mut self,
12887 v: V,
12888 ) -> Self {
12889 self.0.request = v.into();
12890 self
12891 }
12892
12893 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12895 self.0.options = v.into();
12896 self
12897 }
12898
12899 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12901 (*self.0.stub)
12902 .list_operations(self.0.request, self.0.options)
12903 .await
12904 .map(gax::response::Response::into_body)
12905 }
12906
12907 pub fn by_page(
12909 self,
12910 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12911 {
12912 use std::clone::Clone;
12913 let token = self.0.request.page_token.clone();
12914 let execute = move |token: String| {
12915 let mut builder = self.clone();
12916 builder.0.request = builder.0.request.set_page_token(token);
12917 builder.send()
12918 };
12919 gax::paginator::internal::new_paginator(token, execute)
12920 }
12921
12922 pub fn by_item(
12924 self,
12925 ) -> impl gax::paginator::ItemPaginator<
12926 longrunning::model::ListOperationsResponse,
12927 gax::error::Error,
12928 > {
12929 use gax::paginator::Paginator;
12930 self.by_page().items()
12931 }
12932
12933 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12935 self.0.request.name = v.into();
12936 self
12937 }
12938
12939 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12941 self.0.request.filter = v.into();
12942 self
12943 }
12944
12945 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12947 self.0.request.page_size = v.into();
12948 self
12949 }
12950
12951 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12953 self.0.request.page_token = v.into();
12954 self
12955 }
12956 }
12957
12958 #[doc(hidden)]
12959 impl gax::options::internal::RequestBuilder for ListOperations {
12960 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12961 &mut self.0.options
12962 }
12963 }
12964
12965 #[derive(Clone, Debug)]
12983 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12984
12985 impl GetOperation {
12986 pub(crate) fn new(
12987 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
12988 ) -> Self {
12989 Self(RequestBuilder::new(stub))
12990 }
12991
12992 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12994 mut self,
12995 v: V,
12996 ) -> Self {
12997 self.0.request = v.into();
12998 self
12999 }
13000
13001 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13003 self.0.options = v.into();
13004 self
13005 }
13006
13007 pub async fn send(self) -> Result<longrunning::model::Operation> {
13009 (*self.0.stub)
13010 .get_operation(self.0.request, self.0.options)
13011 .await
13012 .map(gax::response::Response::into_body)
13013 }
13014
13015 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13017 self.0.request.name = v.into();
13018 self
13019 }
13020 }
13021
13022 #[doc(hidden)]
13023 impl gax::options::internal::RequestBuilder for GetOperation {
13024 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13025 &mut self.0.options
13026 }
13027 }
13028
13029 #[derive(Clone, Debug)]
13047 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13048
13049 impl CancelOperation {
13050 pub(crate) fn new(
13051 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServingConfigService>,
13052 ) -> Self {
13053 Self(RequestBuilder::new(stub))
13054 }
13055
13056 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13058 mut self,
13059 v: V,
13060 ) -> Self {
13061 self.0.request = v.into();
13062 self
13063 }
13064
13065 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13067 self.0.options = v.into();
13068 self
13069 }
13070
13071 pub async fn send(self) -> Result<()> {
13073 (*self.0.stub)
13074 .cancel_operation(self.0.request, self.0.options)
13075 .await
13076 .map(gax::response::Response::into_body)
13077 }
13078
13079 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13081 self.0.request.name = v.into();
13082 self
13083 }
13084 }
13085
13086 #[doc(hidden)]
13087 impl gax::options::internal::RequestBuilder for CancelOperation {
13088 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13089 &mut self.0.options
13090 }
13091 }
13092}
13093
13094#[cfg(feature = "session-service")]
13095#[cfg_attr(docsrs, doc(cfg(feature = "session-service")))]
13096pub mod session_service {
13097 use crate::Result;
13098
13099 pub type ClientBuilder =
13113 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13114
13115 pub(crate) mod client {
13116 use super::super::super::client::SessionService;
13117 pub struct Factory;
13118 impl gax::client_builder::internal::ClientFactory for Factory {
13119 type Client = SessionService;
13120 type Credentials = gaxi::options::Credentials;
13121 async fn build(
13122 self,
13123 config: gaxi::options::ClientConfig,
13124 ) -> gax::client_builder::Result<Self::Client> {
13125 Self::Client::new(config).await
13126 }
13127 }
13128 }
13129
13130 #[derive(Clone, Debug)]
13132 pub(crate) struct RequestBuilder<R: std::default::Default> {
13133 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13134 request: R,
13135 options: gax::options::RequestOptions,
13136 }
13137
13138 impl<R> RequestBuilder<R>
13139 where
13140 R: std::default::Default,
13141 {
13142 pub(crate) fn new(
13143 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13144 ) -> Self {
13145 Self {
13146 stub,
13147 request: R::default(),
13148 options: gax::options::RequestOptions::default(),
13149 }
13150 }
13151 }
13152
13153 #[derive(Clone, Debug)]
13171 pub struct CreateSession(RequestBuilder<crate::model::CreateSessionRequest>);
13172
13173 impl CreateSession {
13174 pub(crate) fn new(
13175 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13176 ) -> Self {
13177 Self(RequestBuilder::new(stub))
13178 }
13179
13180 pub fn with_request<V: Into<crate::model::CreateSessionRequest>>(mut self, v: V) -> Self {
13182 self.0.request = v.into();
13183 self
13184 }
13185
13186 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13188 self.0.options = v.into();
13189 self
13190 }
13191
13192 pub async fn send(self) -> Result<crate::model::Session> {
13194 (*self.0.stub)
13195 .create_session(self.0.request, self.0.options)
13196 .await
13197 .map(gax::response::Response::into_body)
13198 }
13199
13200 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13204 self.0.request.parent = v.into();
13205 self
13206 }
13207
13208 pub fn set_session<T>(mut self, v: T) -> Self
13212 where
13213 T: std::convert::Into<crate::model::Session>,
13214 {
13215 self.0.request.session = std::option::Option::Some(v.into());
13216 self
13217 }
13218
13219 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13223 where
13224 T: std::convert::Into<crate::model::Session>,
13225 {
13226 self.0.request.session = v.map(|x| x.into());
13227 self
13228 }
13229 }
13230
13231 #[doc(hidden)]
13232 impl gax::options::internal::RequestBuilder for CreateSession {
13233 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13234 &mut self.0.options
13235 }
13236 }
13237
13238 #[derive(Clone, Debug)]
13256 pub struct DeleteSession(RequestBuilder<crate::model::DeleteSessionRequest>);
13257
13258 impl DeleteSession {
13259 pub(crate) fn new(
13260 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13261 ) -> Self {
13262 Self(RequestBuilder::new(stub))
13263 }
13264
13265 pub fn with_request<V: Into<crate::model::DeleteSessionRequest>>(mut self, v: V) -> Self {
13267 self.0.request = v.into();
13268 self
13269 }
13270
13271 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13273 self.0.options = v.into();
13274 self
13275 }
13276
13277 pub async fn send(self) -> Result<()> {
13279 (*self.0.stub)
13280 .delete_session(self.0.request, self.0.options)
13281 .await
13282 .map(gax::response::Response::into_body)
13283 }
13284
13285 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13289 self.0.request.name = v.into();
13290 self
13291 }
13292 }
13293
13294 #[doc(hidden)]
13295 impl gax::options::internal::RequestBuilder for DeleteSession {
13296 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13297 &mut self.0.options
13298 }
13299 }
13300
13301 #[derive(Clone, Debug)]
13319 pub struct UpdateSession(RequestBuilder<crate::model::UpdateSessionRequest>);
13320
13321 impl UpdateSession {
13322 pub(crate) fn new(
13323 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13324 ) -> Self {
13325 Self(RequestBuilder::new(stub))
13326 }
13327
13328 pub fn with_request<V: Into<crate::model::UpdateSessionRequest>>(mut self, v: V) -> Self {
13330 self.0.request = v.into();
13331 self
13332 }
13333
13334 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13336 self.0.options = v.into();
13337 self
13338 }
13339
13340 pub async fn send(self) -> Result<crate::model::Session> {
13342 (*self.0.stub)
13343 .update_session(self.0.request, self.0.options)
13344 .await
13345 .map(gax::response::Response::into_body)
13346 }
13347
13348 pub fn set_session<T>(mut self, v: T) -> Self
13352 where
13353 T: std::convert::Into<crate::model::Session>,
13354 {
13355 self.0.request.session = std::option::Option::Some(v.into());
13356 self
13357 }
13358
13359 pub fn set_or_clear_session<T>(mut self, v: std::option::Option<T>) -> Self
13363 where
13364 T: std::convert::Into<crate::model::Session>,
13365 {
13366 self.0.request.session = v.map(|x| x.into());
13367 self
13368 }
13369
13370 pub fn set_update_mask<T>(mut self, v: T) -> Self
13372 where
13373 T: std::convert::Into<wkt::FieldMask>,
13374 {
13375 self.0.request.update_mask = std::option::Option::Some(v.into());
13376 self
13377 }
13378
13379 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13381 where
13382 T: std::convert::Into<wkt::FieldMask>,
13383 {
13384 self.0.request.update_mask = v.map(|x| x.into());
13385 self
13386 }
13387 }
13388
13389 #[doc(hidden)]
13390 impl gax::options::internal::RequestBuilder for UpdateSession {
13391 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13392 &mut self.0.options
13393 }
13394 }
13395
13396 #[derive(Clone, Debug)]
13414 pub struct GetSession(RequestBuilder<crate::model::GetSessionRequest>);
13415
13416 impl GetSession {
13417 pub(crate) fn new(
13418 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13419 ) -> Self {
13420 Self(RequestBuilder::new(stub))
13421 }
13422
13423 pub fn with_request<V: Into<crate::model::GetSessionRequest>>(mut self, v: V) -> Self {
13425 self.0.request = v.into();
13426 self
13427 }
13428
13429 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13431 self.0.options = v.into();
13432 self
13433 }
13434
13435 pub async fn send(self) -> Result<crate::model::Session> {
13437 (*self.0.stub)
13438 .get_session(self.0.request, self.0.options)
13439 .await
13440 .map(gax::response::Response::into_body)
13441 }
13442
13443 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13447 self.0.request.name = v.into();
13448 self
13449 }
13450
13451 pub fn set_include_answer_details<T: Into<bool>>(mut self, v: T) -> Self {
13453 self.0.request.include_answer_details = v.into();
13454 self
13455 }
13456 }
13457
13458 #[doc(hidden)]
13459 impl gax::options::internal::RequestBuilder for GetSession {
13460 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13461 &mut self.0.options
13462 }
13463 }
13464
13465 #[derive(Clone, Debug)]
13487 pub struct ListSessions(RequestBuilder<crate::model::ListSessionsRequest>);
13488
13489 impl ListSessions {
13490 pub(crate) fn new(
13491 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13492 ) -> Self {
13493 Self(RequestBuilder::new(stub))
13494 }
13495
13496 pub fn with_request<V: Into<crate::model::ListSessionsRequest>>(mut self, v: V) -> Self {
13498 self.0.request = v.into();
13499 self
13500 }
13501
13502 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13504 self.0.options = v.into();
13505 self
13506 }
13507
13508 pub async fn send(self) -> Result<crate::model::ListSessionsResponse> {
13510 (*self.0.stub)
13511 .list_sessions(self.0.request, self.0.options)
13512 .await
13513 .map(gax::response::Response::into_body)
13514 }
13515
13516 pub fn by_page(
13518 self,
13519 ) -> impl gax::paginator::Paginator<crate::model::ListSessionsResponse, gax::error::Error>
13520 {
13521 use std::clone::Clone;
13522 let token = self.0.request.page_token.clone();
13523 let execute = move |token: String| {
13524 let mut builder = self.clone();
13525 builder.0.request = builder.0.request.set_page_token(token);
13526 builder.send()
13527 };
13528 gax::paginator::internal::new_paginator(token, execute)
13529 }
13530
13531 pub fn by_item(
13533 self,
13534 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSessionsResponse, gax::error::Error>
13535 {
13536 use gax::paginator::Paginator;
13537 self.by_page().items()
13538 }
13539
13540 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13544 self.0.request.parent = v.into();
13545 self
13546 }
13547
13548 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13550 self.0.request.page_size = v.into();
13551 self
13552 }
13553
13554 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13556 self.0.request.page_token = v.into();
13557 self
13558 }
13559
13560 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13562 self.0.request.filter = v.into();
13563 self
13564 }
13565
13566 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
13568 self.0.request.order_by = v.into();
13569 self
13570 }
13571 }
13572
13573 #[doc(hidden)]
13574 impl gax::options::internal::RequestBuilder for ListSessions {
13575 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13576 &mut self.0.options
13577 }
13578 }
13579
13580 #[derive(Clone, Debug)]
13602 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
13603
13604 impl ListOperations {
13605 pub(crate) fn new(
13606 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13607 ) -> Self {
13608 Self(RequestBuilder::new(stub))
13609 }
13610
13611 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
13613 mut self,
13614 v: V,
13615 ) -> Self {
13616 self.0.request = v.into();
13617 self
13618 }
13619
13620 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13622 self.0.options = v.into();
13623 self
13624 }
13625
13626 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
13628 (*self.0.stub)
13629 .list_operations(self.0.request, self.0.options)
13630 .await
13631 .map(gax::response::Response::into_body)
13632 }
13633
13634 pub fn by_page(
13636 self,
13637 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
13638 {
13639 use std::clone::Clone;
13640 let token = self.0.request.page_token.clone();
13641 let execute = move |token: String| {
13642 let mut builder = self.clone();
13643 builder.0.request = builder.0.request.set_page_token(token);
13644 builder.send()
13645 };
13646 gax::paginator::internal::new_paginator(token, execute)
13647 }
13648
13649 pub fn by_item(
13651 self,
13652 ) -> impl gax::paginator::ItemPaginator<
13653 longrunning::model::ListOperationsResponse,
13654 gax::error::Error,
13655 > {
13656 use gax::paginator::Paginator;
13657 self.by_page().items()
13658 }
13659
13660 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13662 self.0.request.name = v.into();
13663 self
13664 }
13665
13666 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13668 self.0.request.filter = v.into();
13669 self
13670 }
13671
13672 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13674 self.0.request.page_size = v.into();
13675 self
13676 }
13677
13678 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13680 self.0.request.page_token = v.into();
13681 self
13682 }
13683 }
13684
13685 #[doc(hidden)]
13686 impl gax::options::internal::RequestBuilder for ListOperations {
13687 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13688 &mut self.0.options
13689 }
13690 }
13691
13692 #[derive(Clone, Debug)]
13710 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
13711
13712 impl GetOperation {
13713 pub(crate) fn new(
13714 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13715 ) -> Self {
13716 Self(RequestBuilder::new(stub))
13717 }
13718
13719 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
13721 mut self,
13722 v: V,
13723 ) -> Self {
13724 self.0.request = v.into();
13725 self
13726 }
13727
13728 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13730 self.0.options = v.into();
13731 self
13732 }
13733
13734 pub async fn send(self) -> Result<longrunning::model::Operation> {
13736 (*self.0.stub)
13737 .get_operation(self.0.request, self.0.options)
13738 .await
13739 .map(gax::response::Response::into_body)
13740 }
13741
13742 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13744 self.0.request.name = v.into();
13745 self
13746 }
13747 }
13748
13749 #[doc(hidden)]
13750 impl gax::options::internal::RequestBuilder for GetOperation {
13751 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13752 &mut self.0.options
13753 }
13754 }
13755
13756 #[derive(Clone, Debug)]
13774 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13775
13776 impl CancelOperation {
13777 pub(crate) fn new(
13778 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionService>,
13779 ) -> Self {
13780 Self(RequestBuilder::new(stub))
13781 }
13782
13783 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13785 mut self,
13786 v: V,
13787 ) -> Self {
13788 self.0.request = v.into();
13789 self
13790 }
13791
13792 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13794 self.0.options = v.into();
13795 self
13796 }
13797
13798 pub async fn send(self) -> Result<()> {
13800 (*self.0.stub)
13801 .cancel_operation(self.0.request, self.0.options)
13802 .await
13803 .map(gax::response::Response::into_body)
13804 }
13805
13806 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13808 self.0.request.name = v.into();
13809 self
13810 }
13811 }
13812
13813 #[doc(hidden)]
13814 impl gax::options::internal::RequestBuilder for CancelOperation {
13815 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13816 &mut self.0.options
13817 }
13818 }
13819}
13820
13821#[cfg(feature = "site-search-engine-service")]
13822#[cfg_attr(docsrs, doc(cfg(feature = "site-search-engine-service")))]
13823pub mod site_search_engine_service {
13824 use crate::Result;
13825
13826 pub type ClientBuilder =
13840 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13841
13842 pub(crate) mod client {
13843 use super::super::super::client::SiteSearchEngineService;
13844 pub struct Factory;
13845 impl gax::client_builder::internal::ClientFactory for Factory {
13846 type Client = SiteSearchEngineService;
13847 type Credentials = gaxi::options::Credentials;
13848 async fn build(
13849 self,
13850 config: gaxi::options::ClientConfig,
13851 ) -> gax::client_builder::Result<Self::Client> {
13852 Self::Client::new(config).await
13853 }
13854 }
13855 }
13856
13857 #[derive(Clone, Debug)]
13859 pub(crate) struct RequestBuilder<R: std::default::Default> {
13860 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13861 request: R,
13862 options: gax::options::RequestOptions,
13863 }
13864
13865 impl<R> RequestBuilder<R>
13866 where
13867 R: std::default::Default,
13868 {
13869 pub(crate) fn new(
13870 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13871 ) -> Self {
13872 Self {
13873 stub,
13874 request: R::default(),
13875 options: gax::options::RequestOptions::default(),
13876 }
13877 }
13878 }
13879
13880 #[derive(Clone, Debug)]
13898 pub struct GetSiteSearchEngine(RequestBuilder<crate::model::GetSiteSearchEngineRequest>);
13899
13900 impl GetSiteSearchEngine {
13901 pub(crate) fn new(
13902 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13903 ) -> Self {
13904 Self(RequestBuilder::new(stub))
13905 }
13906
13907 pub fn with_request<V: Into<crate::model::GetSiteSearchEngineRequest>>(
13909 mut self,
13910 v: V,
13911 ) -> Self {
13912 self.0.request = v.into();
13913 self
13914 }
13915
13916 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13918 self.0.options = v.into();
13919 self
13920 }
13921
13922 pub async fn send(self) -> Result<crate::model::SiteSearchEngine> {
13924 (*self.0.stub)
13925 .get_site_search_engine(self.0.request, self.0.options)
13926 .await
13927 .map(gax::response::Response::into_body)
13928 }
13929
13930 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13934 self.0.request.name = v.into();
13935 self
13936 }
13937 }
13938
13939 #[doc(hidden)]
13940 impl gax::options::internal::RequestBuilder for GetSiteSearchEngine {
13941 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13942 &mut self.0.options
13943 }
13944 }
13945
13946 #[derive(Clone, Debug)]
13965 pub struct CreateTargetSite(RequestBuilder<crate::model::CreateTargetSiteRequest>);
13966
13967 impl CreateTargetSite {
13968 pub(crate) fn new(
13969 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
13970 ) -> Self {
13971 Self(RequestBuilder::new(stub))
13972 }
13973
13974 pub fn with_request<V: Into<crate::model::CreateTargetSiteRequest>>(
13976 mut self,
13977 v: V,
13978 ) -> Self {
13979 self.0.request = v.into();
13980 self
13981 }
13982
13983 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13985 self.0.options = v.into();
13986 self
13987 }
13988
13989 pub async fn send(self) -> Result<longrunning::model::Operation> {
13996 (*self.0.stub)
13997 .create_target_site(self.0.request, self.0.options)
13998 .await
13999 .map(gax::response::Response::into_body)
14000 }
14001
14002 pub fn poller(
14004 self,
14005 ) -> impl lro::Poller<crate::model::TargetSite, crate::model::CreateTargetSiteMetadata>
14006 {
14007 type Operation = lro::internal::Operation<
14008 crate::model::TargetSite,
14009 crate::model::CreateTargetSiteMetadata,
14010 >;
14011 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14012 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14013
14014 let stub = self.0.stub.clone();
14015 let mut options = self.0.options.clone();
14016 options.set_retry_policy(gax::retry_policy::NeverRetry);
14017 let query = move |name| {
14018 let stub = stub.clone();
14019 let options = options.clone();
14020 async {
14021 let op = GetOperation::new(stub)
14022 .set_name(name)
14023 .with_options(options)
14024 .send()
14025 .await?;
14026 Ok(Operation::new(op))
14027 }
14028 };
14029
14030 let start = move || async {
14031 let op = self.send().await?;
14032 Ok(Operation::new(op))
14033 };
14034
14035 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14036 }
14037
14038 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14042 self.0.request.parent = v.into();
14043 self
14044 }
14045
14046 pub fn set_target_site<T>(mut self, v: T) -> Self
14050 where
14051 T: std::convert::Into<crate::model::TargetSite>,
14052 {
14053 self.0.request.target_site = std::option::Option::Some(v.into());
14054 self
14055 }
14056
14057 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14061 where
14062 T: std::convert::Into<crate::model::TargetSite>,
14063 {
14064 self.0.request.target_site = v.map(|x| x.into());
14065 self
14066 }
14067 }
14068
14069 #[doc(hidden)]
14070 impl gax::options::internal::RequestBuilder for CreateTargetSite {
14071 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14072 &mut self.0.options
14073 }
14074 }
14075
14076 #[derive(Clone, Debug)]
14095 pub struct BatchCreateTargetSites(RequestBuilder<crate::model::BatchCreateTargetSitesRequest>);
14096
14097 impl BatchCreateTargetSites {
14098 pub(crate) fn new(
14099 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14100 ) -> Self {
14101 Self(RequestBuilder::new(stub))
14102 }
14103
14104 pub fn with_request<V: Into<crate::model::BatchCreateTargetSitesRequest>>(
14106 mut self,
14107 v: V,
14108 ) -> Self {
14109 self.0.request = v.into();
14110 self
14111 }
14112
14113 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14115 self.0.options = v.into();
14116 self
14117 }
14118
14119 pub async fn send(self) -> Result<longrunning::model::Operation> {
14126 (*self.0.stub)
14127 .batch_create_target_sites(self.0.request, self.0.options)
14128 .await
14129 .map(gax::response::Response::into_body)
14130 }
14131
14132 pub fn poller(
14134 self,
14135 ) -> impl lro::Poller<
14136 crate::model::BatchCreateTargetSitesResponse,
14137 crate::model::BatchCreateTargetSiteMetadata,
14138 > {
14139 type Operation = lro::internal::Operation<
14140 crate::model::BatchCreateTargetSitesResponse,
14141 crate::model::BatchCreateTargetSiteMetadata,
14142 >;
14143 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14144 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14145
14146 let stub = self.0.stub.clone();
14147 let mut options = self.0.options.clone();
14148 options.set_retry_policy(gax::retry_policy::NeverRetry);
14149 let query = move |name| {
14150 let stub = stub.clone();
14151 let options = options.clone();
14152 async {
14153 let op = GetOperation::new(stub)
14154 .set_name(name)
14155 .with_options(options)
14156 .send()
14157 .await?;
14158 Ok(Operation::new(op))
14159 }
14160 };
14161
14162 let start = move || async {
14163 let op = self.send().await?;
14164 Ok(Operation::new(op))
14165 };
14166
14167 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14168 }
14169
14170 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14174 self.0.request.parent = v.into();
14175 self
14176 }
14177
14178 pub fn set_requests<T, V>(mut self, v: T) -> Self
14182 where
14183 T: std::iter::IntoIterator<Item = V>,
14184 V: std::convert::Into<crate::model::CreateTargetSiteRequest>,
14185 {
14186 use std::iter::Iterator;
14187 self.0.request.requests = v.into_iter().map(|i| i.into()).collect();
14188 self
14189 }
14190 }
14191
14192 #[doc(hidden)]
14193 impl gax::options::internal::RequestBuilder for BatchCreateTargetSites {
14194 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14195 &mut self.0.options
14196 }
14197 }
14198
14199 #[derive(Clone, Debug)]
14217 pub struct GetTargetSite(RequestBuilder<crate::model::GetTargetSiteRequest>);
14218
14219 impl GetTargetSite {
14220 pub(crate) fn new(
14221 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14222 ) -> Self {
14223 Self(RequestBuilder::new(stub))
14224 }
14225
14226 pub fn with_request<V: Into<crate::model::GetTargetSiteRequest>>(mut self, v: V) -> Self {
14228 self.0.request = v.into();
14229 self
14230 }
14231
14232 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14234 self.0.options = v.into();
14235 self
14236 }
14237
14238 pub async fn send(self) -> Result<crate::model::TargetSite> {
14240 (*self.0.stub)
14241 .get_target_site(self.0.request, self.0.options)
14242 .await
14243 .map(gax::response::Response::into_body)
14244 }
14245
14246 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14250 self.0.request.name = v.into();
14251 self
14252 }
14253 }
14254
14255 #[doc(hidden)]
14256 impl gax::options::internal::RequestBuilder for GetTargetSite {
14257 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14258 &mut self.0.options
14259 }
14260 }
14261
14262 #[derive(Clone, Debug)]
14281 pub struct UpdateTargetSite(RequestBuilder<crate::model::UpdateTargetSiteRequest>);
14282
14283 impl UpdateTargetSite {
14284 pub(crate) fn new(
14285 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14286 ) -> Self {
14287 Self(RequestBuilder::new(stub))
14288 }
14289
14290 pub fn with_request<V: Into<crate::model::UpdateTargetSiteRequest>>(
14292 mut self,
14293 v: V,
14294 ) -> Self {
14295 self.0.request = v.into();
14296 self
14297 }
14298
14299 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14301 self.0.options = v.into();
14302 self
14303 }
14304
14305 pub async fn send(self) -> Result<longrunning::model::Operation> {
14312 (*self.0.stub)
14313 .update_target_site(self.0.request, self.0.options)
14314 .await
14315 .map(gax::response::Response::into_body)
14316 }
14317
14318 pub fn poller(
14320 self,
14321 ) -> impl lro::Poller<crate::model::TargetSite, crate::model::UpdateTargetSiteMetadata>
14322 {
14323 type Operation = lro::internal::Operation<
14324 crate::model::TargetSite,
14325 crate::model::UpdateTargetSiteMetadata,
14326 >;
14327 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14328 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14329
14330 let stub = self.0.stub.clone();
14331 let mut options = self.0.options.clone();
14332 options.set_retry_policy(gax::retry_policy::NeverRetry);
14333 let query = move |name| {
14334 let stub = stub.clone();
14335 let options = options.clone();
14336 async {
14337 let op = GetOperation::new(stub)
14338 .set_name(name)
14339 .with_options(options)
14340 .send()
14341 .await?;
14342 Ok(Operation::new(op))
14343 }
14344 };
14345
14346 let start = move || async {
14347 let op = self.send().await?;
14348 Ok(Operation::new(op))
14349 };
14350
14351 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14352 }
14353
14354 pub fn set_target_site<T>(mut self, v: T) -> Self
14358 where
14359 T: std::convert::Into<crate::model::TargetSite>,
14360 {
14361 self.0.request.target_site = std::option::Option::Some(v.into());
14362 self
14363 }
14364
14365 pub fn set_or_clear_target_site<T>(mut self, v: std::option::Option<T>) -> Self
14369 where
14370 T: std::convert::Into<crate::model::TargetSite>,
14371 {
14372 self.0.request.target_site = v.map(|x| x.into());
14373 self
14374 }
14375 }
14376
14377 #[doc(hidden)]
14378 impl gax::options::internal::RequestBuilder for UpdateTargetSite {
14379 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14380 &mut self.0.options
14381 }
14382 }
14383
14384 #[derive(Clone, Debug)]
14403 pub struct DeleteTargetSite(RequestBuilder<crate::model::DeleteTargetSiteRequest>);
14404
14405 impl DeleteTargetSite {
14406 pub(crate) fn new(
14407 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14408 ) -> Self {
14409 Self(RequestBuilder::new(stub))
14410 }
14411
14412 pub fn with_request<V: Into<crate::model::DeleteTargetSiteRequest>>(
14414 mut self,
14415 v: V,
14416 ) -> Self {
14417 self.0.request = v.into();
14418 self
14419 }
14420
14421 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14423 self.0.options = v.into();
14424 self
14425 }
14426
14427 pub async fn send(self) -> Result<longrunning::model::Operation> {
14434 (*self.0.stub)
14435 .delete_target_site(self.0.request, self.0.options)
14436 .await
14437 .map(gax::response::Response::into_body)
14438 }
14439
14440 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteTargetSiteMetadata> {
14442 type Operation =
14443 lro::internal::Operation<wkt::Empty, crate::model::DeleteTargetSiteMetadata>;
14444 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14445 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14446
14447 let stub = self.0.stub.clone();
14448 let mut options = self.0.options.clone();
14449 options.set_retry_policy(gax::retry_policy::NeverRetry);
14450 let query = move |name| {
14451 let stub = stub.clone();
14452 let options = options.clone();
14453 async {
14454 let op = GetOperation::new(stub)
14455 .set_name(name)
14456 .with_options(options)
14457 .send()
14458 .await?;
14459 Ok(Operation::new(op))
14460 }
14461 };
14462
14463 let start = move || async {
14464 let op = self.send().await?;
14465 Ok(Operation::new(op))
14466 };
14467
14468 lro::internal::new_unit_response_poller(
14469 polling_error_policy,
14470 polling_backoff_policy,
14471 start,
14472 query,
14473 )
14474 }
14475
14476 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14480 self.0.request.name = v.into();
14481 self
14482 }
14483 }
14484
14485 #[doc(hidden)]
14486 impl gax::options::internal::RequestBuilder for DeleteTargetSite {
14487 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14488 &mut self.0.options
14489 }
14490 }
14491
14492 #[derive(Clone, Debug)]
14514 pub struct ListTargetSites(RequestBuilder<crate::model::ListTargetSitesRequest>);
14515
14516 impl ListTargetSites {
14517 pub(crate) fn new(
14518 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14519 ) -> Self {
14520 Self(RequestBuilder::new(stub))
14521 }
14522
14523 pub fn with_request<V: Into<crate::model::ListTargetSitesRequest>>(mut self, v: V) -> Self {
14525 self.0.request = v.into();
14526 self
14527 }
14528
14529 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14531 self.0.options = v.into();
14532 self
14533 }
14534
14535 pub async fn send(self) -> Result<crate::model::ListTargetSitesResponse> {
14537 (*self.0.stub)
14538 .list_target_sites(self.0.request, self.0.options)
14539 .await
14540 .map(gax::response::Response::into_body)
14541 }
14542
14543 pub fn by_page(
14545 self,
14546 ) -> impl gax::paginator::Paginator<crate::model::ListTargetSitesResponse, gax::error::Error>
14547 {
14548 use std::clone::Clone;
14549 let token = self.0.request.page_token.clone();
14550 let execute = move |token: String| {
14551 let mut builder = self.clone();
14552 builder.0.request = builder.0.request.set_page_token(token);
14553 builder.send()
14554 };
14555 gax::paginator::internal::new_paginator(token, execute)
14556 }
14557
14558 pub fn by_item(
14560 self,
14561 ) -> impl gax::paginator::ItemPaginator<crate::model::ListTargetSitesResponse, gax::error::Error>
14562 {
14563 use gax::paginator::Paginator;
14564 self.by_page().items()
14565 }
14566
14567 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14571 self.0.request.parent = v.into();
14572 self
14573 }
14574
14575 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14577 self.0.request.page_size = v.into();
14578 self
14579 }
14580
14581 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14583 self.0.request.page_token = v.into();
14584 self
14585 }
14586 }
14587
14588 #[doc(hidden)]
14589 impl gax::options::internal::RequestBuilder for ListTargetSites {
14590 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14591 &mut self.0.options
14592 }
14593 }
14594
14595 #[derive(Clone, Debug)]
14614 pub struct CreateSitemap(RequestBuilder<crate::model::CreateSitemapRequest>);
14615
14616 impl CreateSitemap {
14617 pub(crate) fn new(
14618 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14619 ) -> Self {
14620 Self(RequestBuilder::new(stub))
14621 }
14622
14623 pub fn with_request<V: Into<crate::model::CreateSitemapRequest>>(mut self, v: V) -> Self {
14625 self.0.request = v.into();
14626 self
14627 }
14628
14629 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14631 self.0.options = v.into();
14632 self
14633 }
14634
14635 pub async fn send(self) -> Result<longrunning::model::Operation> {
14642 (*self.0.stub)
14643 .create_sitemap(self.0.request, self.0.options)
14644 .await
14645 .map(gax::response::Response::into_body)
14646 }
14647
14648 pub fn poller(
14650 self,
14651 ) -> impl lro::Poller<crate::model::Sitemap, crate::model::CreateSitemapMetadata> {
14652 type Operation = lro::internal::Operation<
14653 crate::model::Sitemap,
14654 crate::model::CreateSitemapMetadata,
14655 >;
14656 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14657 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14658
14659 let stub = self.0.stub.clone();
14660 let mut options = self.0.options.clone();
14661 options.set_retry_policy(gax::retry_policy::NeverRetry);
14662 let query = move |name| {
14663 let stub = stub.clone();
14664 let options = options.clone();
14665 async {
14666 let op = GetOperation::new(stub)
14667 .set_name(name)
14668 .with_options(options)
14669 .send()
14670 .await?;
14671 Ok(Operation::new(op))
14672 }
14673 };
14674
14675 let start = move || async {
14676 let op = self.send().await?;
14677 Ok(Operation::new(op))
14678 };
14679
14680 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14681 }
14682
14683 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14687 self.0.request.parent = v.into();
14688 self
14689 }
14690
14691 pub fn set_sitemap<T>(mut self, v: T) -> Self
14695 where
14696 T: std::convert::Into<crate::model::Sitemap>,
14697 {
14698 self.0.request.sitemap = std::option::Option::Some(v.into());
14699 self
14700 }
14701
14702 pub fn set_or_clear_sitemap<T>(mut self, v: std::option::Option<T>) -> Self
14706 where
14707 T: std::convert::Into<crate::model::Sitemap>,
14708 {
14709 self.0.request.sitemap = v.map(|x| x.into());
14710 self
14711 }
14712 }
14713
14714 #[doc(hidden)]
14715 impl gax::options::internal::RequestBuilder for CreateSitemap {
14716 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14717 &mut self.0.options
14718 }
14719 }
14720
14721 #[derive(Clone, Debug)]
14740 pub struct DeleteSitemap(RequestBuilder<crate::model::DeleteSitemapRequest>);
14741
14742 impl DeleteSitemap {
14743 pub(crate) fn new(
14744 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14745 ) -> Self {
14746 Self(RequestBuilder::new(stub))
14747 }
14748
14749 pub fn with_request<V: Into<crate::model::DeleteSitemapRequest>>(mut self, v: V) -> Self {
14751 self.0.request = v.into();
14752 self
14753 }
14754
14755 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14757 self.0.options = v.into();
14758 self
14759 }
14760
14761 pub async fn send(self) -> Result<longrunning::model::Operation> {
14768 (*self.0.stub)
14769 .delete_sitemap(self.0.request, self.0.options)
14770 .await
14771 .map(gax::response::Response::into_body)
14772 }
14773
14774 pub fn poller(self) -> impl lro::Poller<(), crate::model::DeleteSitemapMetadata> {
14776 type Operation =
14777 lro::internal::Operation<wkt::Empty, crate::model::DeleteSitemapMetadata>;
14778 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14779 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14780
14781 let stub = self.0.stub.clone();
14782 let mut options = self.0.options.clone();
14783 options.set_retry_policy(gax::retry_policy::NeverRetry);
14784 let query = move |name| {
14785 let stub = stub.clone();
14786 let options = options.clone();
14787 async {
14788 let op = GetOperation::new(stub)
14789 .set_name(name)
14790 .with_options(options)
14791 .send()
14792 .await?;
14793 Ok(Operation::new(op))
14794 }
14795 };
14796
14797 let start = move || async {
14798 let op = self.send().await?;
14799 Ok(Operation::new(op))
14800 };
14801
14802 lro::internal::new_unit_response_poller(
14803 polling_error_policy,
14804 polling_backoff_policy,
14805 start,
14806 query,
14807 )
14808 }
14809
14810 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14814 self.0.request.name = v.into();
14815 self
14816 }
14817 }
14818
14819 #[doc(hidden)]
14820 impl gax::options::internal::RequestBuilder for DeleteSitemap {
14821 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14822 &mut self.0.options
14823 }
14824 }
14825
14826 #[derive(Clone, Debug)]
14844 pub struct FetchSitemaps(RequestBuilder<crate::model::FetchSitemapsRequest>);
14845
14846 impl FetchSitemaps {
14847 pub(crate) fn new(
14848 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14849 ) -> Self {
14850 Self(RequestBuilder::new(stub))
14851 }
14852
14853 pub fn with_request<V: Into<crate::model::FetchSitemapsRequest>>(mut self, v: V) -> Self {
14855 self.0.request = v.into();
14856 self
14857 }
14858
14859 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14861 self.0.options = v.into();
14862 self
14863 }
14864
14865 pub async fn send(self) -> Result<crate::model::FetchSitemapsResponse> {
14867 (*self.0.stub)
14868 .fetch_sitemaps(self.0.request, self.0.options)
14869 .await
14870 .map(gax::response::Response::into_body)
14871 }
14872
14873 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14877 self.0.request.parent = v.into();
14878 self
14879 }
14880
14881 pub fn set_matcher<T>(mut self, v: T) -> Self
14883 where
14884 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
14885 {
14886 self.0.request.matcher = std::option::Option::Some(v.into());
14887 self
14888 }
14889
14890 pub fn set_or_clear_matcher<T>(mut self, v: std::option::Option<T>) -> Self
14892 where
14893 T: std::convert::Into<crate::model::fetch_sitemaps_request::Matcher>,
14894 {
14895 self.0.request.matcher = v.map(|x| x.into());
14896 self
14897 }
14898 }
14899
14900 #[doc(hidden)]
14901 impl gax::options::internal::RequestBuilder for FetchSitemaps {
14902 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14903 &mut self.0.options
14904 }
14905 }
14906
14907 #[derive(Clone, Debug)]
14926 pub struct EnableAdvancedSiteSearch(
14927 RequestBuilder<crate::model::EnableAdvancedSiteSearchRequest>,
14928 );
14929
14930 impl EnableAdvancedSiteSearch {
14931 pub(crate) fn new(
14932 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
14933 ) -> Self {
14934 Self(RequestBuilder::new(stub))
14935 }
14936
14937 pub fn with_request<V: Into<crate::model::EnableAdvancedSiteSearchRequest>>(
14939 mut self,
14940 v: V,
14941 ) -> Self {
14942 self.0.request = v.into();
14943 self
14944 }
14945
14946 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14948 self.0.options = v.into();
14949 self
14950 }
14951
14952 pub async fn send(self) -> Result<longrunning::model::Operation> {
14959 (*self.0.stub)
14960 .enable_advanced_site_search(self.0.request, self.0.options)
14961 .await
14962 .map(gax::response::Response::into_body)
14963 }
14964
14965 pub fn poller(
14967 self,
14968 ) -> impl lro::Poller<
14969 crate::model::EnableAdvancedSiteSearchResponse,
14970 crate::model::EnableAdvancedSiteSearchMetadata,
14971 > {
14972 type Operation = lro::internal::Operation<
14973 crate::model::EnableAdvancedSiteSearchResponse,
14974 crate::model::EnableAdvancedSiteSearchMetadata,
14975 >;
14976 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14977 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14978
14979 let stub = self.0.stub.clone();
14980 let mut options = self.0.options.clone();
14981 options.set_retry_policy(gax::retry_policy::NeverRetry);
14982 let query = move |name| {
14983 let stub = stub.clone();
14984 let options = options.clone();
14985 async {
14986 let op = GetOperation::new(stub)
14987 .set_name(name)
14988 .with_options(options)
14989 .send()
14990 .await?;
14991 Ok(Operation::new(op))
14992 }
14993 };
14994
14995 let start = move || async {
14996 let op = self.send().await?;
14997 Ok(Operation::new(op))
14998 };
14999
15000 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15001 }
15002
15003 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15007 self.0.request.site_search_engine = v.into();
15008 self
15009 }
15010 }
15011
15012 #[doc(hidden)]
15013 impl gax::options::internal::RequestBuilder for EnableAdvancedSiteSearch {
15014 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15015 &mut self.0.options
15016 }
15017 }
15018
15019 #[derive(Clone, Debug)]
15038 pub struct DisableAdvancedSiteSearch(
15039 RequestBuilder<crate::model::DisableAdvancedSiteSearchRequest>,
15040 );
15041
15042 impl DisableAdvancedSiteSearch {
15043 pub(crate) fn new(
15044 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15045 ) -> Self {
15046 Self(RequestBuilder::new(stub))
15047 }
15048
15049 pub fn with_request<V: Into<crate::model::DisableAdvancedSiteSearchRequest>>(
15051 mut self,
15052 v: V,
15053 ) -> Self {
15054 self.0.request = v.into();
15055 self
15056 }
15057
15058 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15060 self.0.options = v.into();
15061 self
15062 }
15063
15064 pub async fn send(self) -> Result<longrunning::model::Operation> {
15071 (*self.0.stub)
15072 .disable_advanced_site_search(self.0.request, self.0.options)
15073 .await
15074 .map(gax::response::Response::into_body)
15075 }
15076
15077 pub fn poller(
15079 self,
15080 ) -> impl lro::Poller<
15081 crate::model::DisableAdvancedSiteSearchResponse,
15082 crate::model::DisableAdvancedSiteSearchMetadata,
15083 > {
15084 type Operation = lro::internal::Operation<
15085 crate::model::DisableAdvancedSiteSearchResponse,
15086 crate::model::DisableAdvancedSiteSearchMetadata,
15087 >;
15088 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15089 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15090
15091 let stub = self.0.stub.clone();
15092 let mut options = self.0.options.clone();
15093 options.set_retry_policy(gax::retry_policy::NeverRetry);
15094 let query = move |name| {
15095 let stub = stub.clone();
15096 let options = options.clone();
15097 async {
15098 let op = GetOperation::new(stub)
15099 .set_name(name)
15100 .with_options(options)
15101 .send()
15102 .await?;
15103 Ok(Operation::new(op))
15104 }
15105 };
15106
15107 let start = move || async {
15108 let op = self.send().await?;
15109 Ok(Operation::new(op))
15110 };
15111
15112 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15113 }
15114
15115 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15119 self.0.request.site_search_engine = v.into();
15120 self
15121 }
15122 }
15123
15124 #[doc(hidden)]
15125 impl gax::options::internal::RequestBuilder for DisableAdvancedSiteSearch {
15126 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15127 &mut self.0.options
15128 }
15129 }
15130
15131 #[derive(Clone, Debug)]
15150 pub struct RecrawlUris(RequestBuilder<crate::model::RecrawlUrisRequest>);
15151
15152 impl RecrawlUris {
15153 pub(crate) fn new(
15154 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15155 ) -> Self {
15156 Self(RequestBuilder::new(stub))
15157 }
15158
15159 pub fn with_request<V: Into<crate::model::RecrawlUrisRequest>>(mut self, v: V) -> Self {
15161 self.0.request = v.into();
15162 self
15163 }
15164
15165 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15167 self.0.options = v.into();
15168 self
15169 }
15170
15171 pub async fn send(self) -> Result<longrunning::model::Operation> {
15178 (*self.0.stub)
15179 .recrawl_uris(self.0.request, self.0.options)
15180 .await
15181 .map(gax::response::Response::into_body)
15182 }
15183
15184 pub fn poller(
15186 self,
15187 ) -> impl lro::Poller<crate::model::RecrawlUrisResponse, crate::model::RecrawlUrisMetadata>
15188 {
15189 type Operation = lro::internal::Operation<
15190 crate::model::RecrawlUrisResponse,
15191 crate::model::RecrawlUrisMetadata,
15192 >;
15193 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15194 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15195
15196 let stub = self.0.stub.clone();
15197 let mut options = self.0.options.clone();
15198 options.set_retry_policy(gax::retry_policy::NeverRetry);
15199 let query = move |name| {
15200 let stub = stub.clone();
15201 let options = options.clone();
15202 async {
15203 let op = GetOperation::new(stub)
15204 .set_name(name)
15205 .with_options(options)
15206 .send()
15207 .await?;
15208 Ok(Operation::new(op))
15209 }
15210 };
15211
15212 let start = move || async {
15213 let op = self.send().await?;
15214 Ok(Operation::new(op))
15215 };
15216
15217 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15218 }
15219
15220 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15224 self.0.request.site_search_engine = v.into();
15225 self
15226 }
15227
15228 pub fn set_uris<T, V>(mut self, v: T) -> Self
15232 where
15233 T: std::iter::IntoIterator<Item = V>,
15234 V: std::convert::Into<std::string::String>,
15235 {
15236 use std::iter::Iterator;
15237 self.0.request.uris = v.into_iter().map(|i| i.into()).collect();
15238 self
15239 }
15240
15241 pub fn set_site_credential<T: Into<std::string::String>>(mut self, v: T) -> Self {
15243 self.0.request.site_credential = v.into();
15244 self
15245 }
15246 }
15247
15248 #[doc(hidden)]
15249 impl gax::options::internal::RequestBuilder for RecrawlUris {
15250 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15251 &mut self.0.options
15252 }
15253 }
15254
15255 #[derive(Clone, Debug)]
15274 pub struct BatchVerifyTargetSites(RequestBuilder<crate::model::BatchVerifyTargetSitesRequest>);
15275
15276 impl BatchVerifyTargetSites {
15277 pub(crate) fn new(
15278 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15279 ) -> Self {
15280 Self(RequestBuilder::new(stub))
15281 }
15282
15283 pub fn with_request<V: Into<crate::model::BatchVerifyTargetSitesRequest>>(
15285 mut self,
15286 v: V,
15287 ) -> Self {
15288 self.0.request = v.into();
15289 self
15290 }
15291
15292 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15294 self.0.options = v.into();
15295 self
15296 }
15297
15298 pub async fn send(self) -> Result<longrunning::model::Operation> {
15305 (*self.0.stub)
15306 .batch_verify_target_sites(self.0.request, self.0.options)
15307 .await
15308 .map(gax::response::Response::into_body)
15309 }
15310
15311 pub fn poller(
15313 self,
15314 ) -> impl lro::Poller<
15315 crate::model::BatchVerifyTargetSitesResponse,
15316 crate::model::BatchVerifyTargetSitesMetadata,
15317 > {
15318 type Operation = lro::internal::Operation<
15319 crate::model::BatchVerifyTargetSitesResponse,
15320 crate::model::BatchVerifyTargetSitesMetadata,
15321 >;
15322 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15323 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15324
15325 let stub = self.0.stub.clone();
15326 let mut options = self.0.options.clone();
15327 options.set_retry_policy(gax::retry_policy::NeverRetry);
15328 let query = move |name| {
15329 let stub = stub.clone();
15330 let options = options.clone();
15331 async {
15332 let op = GetOperation::new(stub)
15333 .set_name(name)
15334 .with_options(options)
15335 .send()
15336 .await?;
15337 Ok(Operation::new(op))
15338 }
15339 };
15340
15341 let start = move || async {
15342 let op = self.send().await?;
15343 Ok(Operation::new(op))
15344 };
15345
15346 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15347 }
15348
15349 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15353 self.0.request.parent = v.into();
15354 self
15355 }
15356 }
15357
15358 #[doc(hidden)]
15359 impl gax::options::internal::RequestBuilder for BatchVerifyTargetSites {
15360 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15361 &mut self.0.options
15362 }
15363 }
15364
15365 #[derive(Clone, Debug)]
15387 pub struct FetchDomainVerificationStatus(
15388 RequestBuilder<crate::model::FetchDomainVerificationStatusRequest>,
15389 );
15390
15391 impl FetchDomainVerificationStatus {
15392 pub(crate) fn new(
15393 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15394 ) -> Self {
15395 Self(RequestBuilder::new(stub))
15396 }
15397
15398 pub fn with_request<V: Into<crate::model::FetchDomainVerificationStatusRequest>>(
15400 mut self,
15401 v: V,
15402 ) -> Self {
15403 self.0.request = v.into();
15404 self
15405 }
15406
15407 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15409 self.0.options = v.into();
15410 self
15411 }
15412
15413 pub async fn send(self) -> Result<crate::model::FetchDomainVerificationStatusResponse> {
15415 (*self.0.stub)
15416 .fetch_domain_verification_status(self.0.request, self.0.options)
15417 .await
15418 .map(gax::response::Response::into_body)
15419 }
15420
15421 pub fn by_page(
15423 self,
15424 ) -> impl gax::paginator::Paginator<
15425 crate::model::FetchDomainVerificationStatusResponse,
15426 gax::error::Error,
15427 > {
15428 use std::clone::Clone;
15429 let token = self.0.request.page_token.clone();
15430 let execute = move |token: String| {
15431 let mut builder = self.clone();
15432 builder.0.request = builder.0.request.set_page_token(token);
15433 builder.send()
15434 };
15435 gax::paginator::internal::new_paginator(token, execute)
15436 }
15437
15438 pub fn by_item(
15440 self,
15441 ) -> impl gax::paginator::ItemPaginator<
15442 crate::model::FetchDomainVerificationStatusResponse,
15443 gax::error::Error,
15444 > {
15445 use gax::paginator::Paginator;
15446 self.by_page().items()
15447 }
15448
15449 pub fn set_site_search_engine<T: Into<std::string::String>>(mut self, v: T) -> Self {
15453 self.0.request.site_search_engine = v.into();
15454 self
15455 }
15456
15457 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15459 self.0.request.page_size = v.into();
15460 self
15461 }
15462
15463 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15465 self.0.request.page_token = v.into();
15466 self
15467 }
15468 }
15469
15470 #[doc(hidden)]
15471 impl gax::options::internal::RequestBuilder for FetchDomainVerificationStatus {
15472 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15473 &mut self.0.options
15474 }
15475 }
15476
15477 #[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
15582 #[doc(hidden)]
15583 impl gax::options::internal::RequestBuilder for ListOperations {
15584 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15585 &mut self.0.options
15586 }
15587 }
15588
15589 #[derive(Clone, Debug)]
15607 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
15608
15609 impl GetOperation {
15610 pub(crate) fn new(
15611 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15612 ) -> Self {
15613 Self(RequestBuilder::new(stub))
15614 }
15615
15616 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
15618 mut self,
15619 v: V,
15620 ) -> Self {
15621 self.0.request = v.into();
15622 self
15623 }
15624
15625 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15627 self.0.options = v.into();
15628 self
15629 }
15630
15631 pub async fn send(self) -> Result<longrunning::model::Operation> {
15633 (*self.0.stub)
15634 .get_operation(self.0.request, self.0.options)
15635 .await
15636 .map(gax::response::Response::into_body)
15637 }
15638
15639 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15641 self.0.request.name = v.into();
15642 self
15643 }
15644 }
15645
15646 #[doc(hidden)]
15647 impl gax::options::internal::RequestBuilder for GetOperation {
15648 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15649 &mut self.0.options
15650 }
15651 }
15652
15653 #[derive(Clone, Debug)]
15671 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
15672
15673 impl CancelOperation {
15674 pub(crate) fn new(
15675 stub: std::sync::Arc<dyn super::super::stub::dynamic::SiteSearchEngineService>,
15676 ) -> Self {
15677 Self(RequestBuilder::new(stub))
15678 }
15679
15680 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
15682 mut self,
15683 v: V,
15684 ) -> Self {
15685 self.0.request = v.into();
15686 self
15687 }
15688
15689 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15691 self.0.options = v.into();
15692 self
15693 }
15694
15695 pub async fn send(self) -> Result<()> {
15697 (*self.0.stub)
15698 .cancel_operation(self.0.request, self.0.options)
15699 .await
15700 .map(gax::response::Response::into_body)
15701 }
15702
15703 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15705 self.0.request.name = v.into();
15706 self
15707 }
15708 }
15709
15710 #[doc(hidden)]
15711 impl gax::options::internal::RequestBuilder for CancelOperation {
15712 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15713 &mut self.0.options
15714 }
15715 }
15716}
15717
15718#[cfg(feature = "user-event-service")]
15719#[cfg_attr(docsrs, doc(cfg(feature = "user-event-service")))]
15720pub mod user_event_service {
15721 use crate::Result;
15722
15723 pub type ClientBuilder =
15737 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
15738
15739 pub(crate) mod client {
15740 use super::super::super::client::UserEventService;
15741 pub struct Factory;
15742 impl gax::client_builder::internal::ClientFactory for Factory {
15743 type Client = UserEventService;
15744 type Credentials = gaxi::options::Credentials;
15745 async fn build(
15746 self,
15747 config: gaxi::options::ClientConfig,
15748 ) -> gax::client_builder::Result<Self::Client> {
15749 Self::Client::new(config).await
15750 }
15751 }
15752 }
15753
15754 #[derive(Clone, Debug)]
15756 pub(crate) struct RequestBuilder<R: std::default::Default> {
15757 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15758 request: R,
15759 options: gax::options::RequestOptions,
15760 }
15761
15762 impl<R> RequestBuilder<R>
15763 where
15764 R: std::default::Default,
15765 {
15766 pub(crate) fn new(
15767 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15768 ) -> Self {
15769 Self {
15770 stub,
15771 request: R::default(),
15772 options: gax::options::RequestOptions::default(),
15773 }
15774 }
15775 }
15776
15777 #[derive(Clone, Debug)]
15795 pub struct WriteUserEvent(RequestBuilder<crate::model::WriteUserEventRequest>);
15796
15797 impl WriteUserEvent {
15798 pub(crate) fn new(
15799 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15800 ) -> Self {
15801 Self(RequestBuilder::new(stub))
15802 }
15803
15804 pub fn with_request<V: Into<crate::model::WriteUserEventRequest>>(mut self, v: V) -> Self {
15806 self.0.request = v.into();
15807 self
15808 }
15809
15810 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15812 self.0.options = v.into();
15813 self
15814 }
15815
15816 pub async fn send(self) -> Result<crate::model::UserEvent> {
15818 (*self.0.stub)
15819 .write_user_event(self.0.request, self.0.options)
15820 .await
15821 .map(gax::response::Response::into_body)
15822 }
15823
15824 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15828 self.0.request.parent = v.into();
15829 self
15830 }
15831
15832 pub fn set_user_event<T>(mut self, v: T) -> Self
15836 where
15837 T: std::convert::Into<crate::model::UserEvent>,
15838 {
15839 self.0.request.user_event = std::option::Option::Some(v.into());
15840 self
15841 }
15842
15843 pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
15847 where
15848 T: std::convert::Into<crate::model::UserEvent>,
15849 {
15850 self.0.request.user_event = v.map(|x| x.into());
15851 self
15852 }
15853
15854 pub fn set_write_async<T: Into<bool>>(mut self, v: T) -> Self {
15856 self.0.request.write_async = v.into();
15857 self
15858 }
15859 }
15860
15861 #[doc(hidden)]
15862 impl gax::options::internal::RequestBuilder for WriteUserEvent {
15863 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15864 &mut self.0.options
15865 }
15866 }
15867
15868 #[derive(Clone, Debug)]
15886 pub struct CollectUserEvent(RequestBuilder<crate::model::CollectUserEventRequest>);
15887
15888 impl CollectUserEvent {
15889 pub(crate) fn new(
15890 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
15891 ) -> Self {
15892 Self(RequestBuilder::new(stub))
15893 }
15894
15895 pub fn with_request<V: Into<crate::model::CollectUserEventRequest>>(
15897 mut self,
15898 v: V,
15899 ) -> Self {
15900 self.0.request = v.into();
15901 self
15902 }
15903
15904 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15906 self.0.options = v.into();
15907 self
15908 }
15909
15910 pub async fn send(self) -> Result<api::model::HttpBody> {
15912 (*self.0.stub)
15913 .collect_user_event(self.0.request, self.0.options)
15914 .await
15915 .map(gax::response::Response::into_body)
15916 }
15917
15918 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15922 self.0.request.parent = v.into();
15923 self
15924 }
15925
15926 pub fn set_user_event<T: Into<std::string::String>>(mut self, v: T) -> Self {
15930 self.0.request.user_event = v.into();
15931 self
15932 }
15933
15934 pub fn set_uri<T>(mut self, v: T) -> Self
15936 where
15937 T: std::convert::Into<std::string::String>,
15938 {
15939 self.0.request.uri = std::option::Option::Some(v.into());
15940 self
15941 }
15942
15943 pub fn set_or_clear_uri<T>(mut self, v: std::option::Option<T>) -> Self
15945 where
15946 T: std::convert::Into<std::string::String>,
15947 {
15948 self.0.request.uri = v.map(|x| x.into());
15949 self
15950 }
15951
15952 pub fn set_ets<T>(mut self, v: T) -> Self
15954 where
15955 T: std::convert::Into<i64>,
15956 {
15957 self.0.request.ets = std::option::Option::Some(v.into());
15958 self
15959 }
15960
15961 pub fn set_or_clear_ets<T>(mut self, v: std::option::Option<T>) -> Self
15963 where
15964 T: std::convert::Into<i64>,
15965 {
15966 self.0.request.ets = v.map(|x| x.into());
15967 self
15968 }
15969 }
15970
15971 #[doc(hidden)]
15972 impl gax::options::internal::RequestBuilder for CollectUserEvent {
15973 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15974 &mut self.0.options
15975 }
15976 }
15977
15978 #[derive(Clone, Debug)]
15997 pub struct PurgeUserEvents(RequestBuilder<crate::model::PurgeUserEventsRequest>);
15998
15999 impl PurgeUserEvents {
16000 pub(crate) fn new(
16001 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16002 ) -> Self {
16003 Self(RequestBuilder::new(stub))
16004 }
16005
16006 pub fn with_request<V: Into<crate::model::PurgeUserEventsRequest>>(mut self, v: V) -> Self {
16008 self.0.request = v.into();
16009 self
16010 }
16011
16012 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16014 self.0.options = v.into();
16015 self
16016 }
16017
16018 pub async fn send(self) -> Result<longrunning::model::Operation> {
16025 (*self.0.stub)
16026 .purge_user_events(self.0.request, self.0.options)
16027 .await
16028 .map(gax::response::Response::into_body)
16029 }
16030
16031 pub fn poller(
16033 self,
16034 ) -> impl lro::Poller<crate::model::PurgeUserEventsResponse, crate::model::PurgeUserEventsMetadata>
16035 {
16036 type Operation = lro::internal::Operation<
16037 crate::model::PurgeUserEventsResponse,
16038 crate::model::PurgeUserEventsMetadata,
16039 >;
16040 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16041 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16042
16043 let stub = self.0.stub.clone();
16044 let mut options = self.0.options.clone();
16045 options.set_retry_policy(gax::retry_policy::NeverRetry);
16046 let query = move |name| {
16047 let stub = stub.clone();
16048 let options = options.clone();
16049 async {
16050 let op = GetOperation::new(stub)
16051 .set_name(name)
16052 .with_options(options)
16053 .send()
16054 .await?;
16055 Ok(Operation::new(op))
16056 }
16057 };
16058
16059 let start = move || async {
16060 let op = self.send().await?;
16061 Ok(Operation::new(op))
16062 };
16063
16064 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16065 }
16066
16067 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16071 self.0.request.parent = v.into();
16072 self
16073 }
16074
16075 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16079 self.0.request.filter = v.into();
16080 self
16081 }
16082
16083 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16085 self.0.request.force = v.into();
16086 self
16087 }
16088 }
16089
16090 #[doc(hidden)]
16091 impl gax::options::internal::RequestBuilder for PurgeUserEvents {
16092 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16093 &mut self.0.options
16094 }
16095 }
16096
16097 #[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)]
16304 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
16305
16306 impl ListOperations {
16307 pub(crate) fn new(
16308 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16309 ) -> Self {
16310 Self(RequestBuilder::new(stub))
16311 }
16312
16313 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
16315 mut self,
16316 v: V,
16317 ) -> Self {
16318 self.0.request = v.into();
16319 self
16320 }
16321
16322 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16324 self.0.options = v.into();
16325 self
16326 }
16327
16328 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
16330 (*self.0.stub)
16331 .list_operations(self.0.request, self.0.options)
16332 .await
16333 .map(gax::response::Response::into_body)
16334 }
16335
16336 pub fn by_page(
16338 self,
16339 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
16340 {
16341 use std::clone::Clone;
16342 let token = self.0.request.page_token.clone();
16343 let execute = move |token: String| {
16344 let mut builder = self.clone();
16345 builder.0.request = builder.0.request.set_page_token(token);
16346 builder.send()
16347 };
16348 gax::paginator::internal::new_paginator(token, execute)
16349 }
16350
16351 pub fn by_item(
16353 self,
16354 ) -> impl gax::paginator::ItemPaginator<
16355 longrunning::model::ListOperationsResponse,
16356 gax::error::Error,
16357 > {
16358 use gax::paginator::Paginator;
16359 self.by_page().items()
16360 }
16361
16362 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16364 self.0.request.name = v.into();
16365 self
16366 }
16367
16368 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16370 self.0.request.filter = v.into();
16371 self
16372 }
16373
16374 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16376 self.0.request.page_size = v.into();
16377 self
16378 }
16379
16380 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16382 self.0.request.page_token = v.into();
16383 self
16384 }
16385 }
16386
16387 #[doc(hidden)]
16388 impl gax::options::internal::RequestBuilder for ListOperations {
16389 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16390 &mut self.0.options
16391 }
16392 }
16393
16394 #[derive(Clone, Debug)]
16412 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
16413
16414 impl GetOperation {
16415 pub(crate) fn new(
16416 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16417 ) -> Self {
16418 Self(RequestBuilder::new(stub))
16419 }
16420
16421 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
16423 mut self,
16424 v: V,
16425 ) -> Self {
16426 self.0.request = v.into();
16427 self
16428 }
16429
16430 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16432 self.0.options = v.into();
16433 self
16434 }
16435
16436 pub async fn send(self) -> Result<longrunning::model::Operation> {
16438 (*self.0.stub)
16439 .get_operation(self.0.request, self.0.options)
16440 .await
16441 .map(gax::response::Response::into_body)
16442 }
16443
16444 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16446 self.0.request.name = v.into();
16447 self
16448 }
16449 }
16450
16451 #[doc(hidden)]
16452 impl gax::options::internal::RequestBuilder for GetOperation {
16453 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16454 &mut self.0.options
16455 }
16456 }
16457
16458 #[derive(Clone, Debug)]
16476 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
16477
16478 impl CancelOperation {
16479 pub(crate) fn new(
16480 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserEventService>,
16481 ) -> Self {
16482 Self(RequestBuilder::new(stub))
16483 }
16484
16485 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
16487 mut self,
16488 v: V,
16489 ) -> Self {
16490 self.0.request = v.into();
16491 self
16492 }
16493
16494 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16496 self.0.options = v.into();
16497 self
16498 }
16499
16500 pub async fn send(self) -> Result<()> {
16502 (*self.0.stub)
16503 .cancel_operation(self.0.request, self.0.options)
16504 .await
16505 .map(gax::response::Response::into_body)
16506 }
16507
16508 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16510 self.0.request.name = v.into();
16511 self
16512 }
16513 }
16514
16515 #[doc(hidden)]
16516 impl gax::options::internal::RequestBuilder for CancelOperation {
16517 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16518 &mut self.0.options
16519 }
16520 }
16521}
16522
16523#[cfg(feature = "user-license-service")]
16524#[cfg_attr(docsrs, doc(cfg(feature = "user-license-service")))]
16525pub mod user_license_service {
16526 use crate::Result;
16527
16528 pub type ClientBuilder =
16542 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16543
16544 pub(crate) mod client {
16545 use super::super::super::client::UserLicenseService;
16546 pub struct Factory;
16547 impl gax::client_builder::internal::ClientFactory for Factory {
16548 type Client = UserLicenseService;
16549 type Credentials = gaxi::options::Credentials;
16550 async fn build(
16551 self,
16552 config: gaxi::options::ClientConfig,
16553 ) -> gax::client_builder::Result<Self::Client> {
16554 Self::Client::new(config).await
16555 }
16556 }
16557 }
16558
16559 #[derive(Clone, Debug)]
16561 pub(crate) struct RequestBuilder<R: std::default::Default> {
16562 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16563 request: R,
16564 options: gax::options::RequestOptions,
16565 }
16566
16567 impl<R> RequestBuilder<R>
16568 where
16569 R: std::default::Default,
16570 {
16571 pub(crate) fn new(
16572 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16573 ) -> Self {
16574 Self {
16575 stub,
16576 request: R::default(),
16577 options: gax::options::RequestOptions::default(),
16578 }
16579 }
16580 }
16581
16582 #[derive(Clone, Debug)]
16604 pub struct ListUserLicenses(RequestBuilder<crate::model::ListUserLicensesRequest>);
16605
16606 impl ListUserLicenses {
16607 pub(crate) fn new(
16608 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16609 ) -> Self {
16610 Self(RequestBuilder::new(stub))
16611 }
16612
16613 pub fn with_request<V: Into<crate::model::ListUserLicensesRequest>>(
16615 mut self,
16616 v: V,
16617 ) -> Self {
16618 self.0.request = v.into();
16619 self
16620 }
16621
16622 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16624 self.0.options = v.into();
16625 self
16626 }
16627
16628 pub async fn send(self) -> Result<crate::model::ListUserLicensesResponse> {
16630 (*self.0.stub)
16631 .list_user_licenses(self.0.request, self.0.options)
16632 .await
16633 .map(gax::response::Response::into_body)
16634 }
16635
16636 pub fn by_page(
16638 self,
16639 ) -> impl gax::paginator::Paginator<crate::model::ListUserLicensesResponse, gax::error::Error>
16640 {
16641 use std::clone::Clone;
16642 let token = self.0.request.page_token.clone();
16643 let execute = move |token: String| {
16644 let mut builder = self.clone();
16645 builder.0.request = builder.0.request.set_page_token(token);
16646 builder.send()
16647 };
16648 gax::paginator::internal::new_paginator(token, execute)
16649 }
16650
16651 pub fn by_item(
16653 self,
16654 ) -> impl gax::paginator::ItemPaginator<crate::model::ListUserLicensesResponse, gax::error::Error>
16655 {
16656 use gax::paginator::Paginator;
16657 self.by_page().items()
16658 }
16659
16660 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16664 self.0.request.parent = v.into();
16665 self
16666 }
16667
16668 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16670 self.0.request.page_size = v.into();
16671 self
16672 }
16673
16674 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16676 self.0.request.page_token = v.into();
16677 self
16678 }
16679
16680 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16682 self.0.request.filter = v.into();
16683 self
16684 }
16685 }
16686
16687 #[doc(hidden)]
16688 impl gax::options::internal::RequestBuilder for ListUserLicenses {
16689 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16690 &mut self.0.options
16691 }
16692 }
16693
16694 #[derive(Clone, Debug)]
16713 pub struct BatchUpdateUserLicenses(
16714 RequestBuilder<crate::model::BatchUpdateUserLicensesRequest>,
16715 );
16716
16717 impl BatchUpdateUserLicenses {
16718 pub(crate) fn new(
16719 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16720 ) -> Self {
16721 Self(RequestBuilder::new(stub))
16722 }
16723
16724 pub fn with_request<V: Into<crate::model::BatchUpdateUserLicensesRequest>>(
16726 mut self,
16727 v: V,
16728 ) -> Self {
16729 self.0.request = v.into();
16730 self
16731 }
16732
16733 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16735 self.0.options = v.into();
16736 self
16737 }
16738
16739 pub async fn send(self) -> Result<longrunning::model::Operation> {
16746 (*self.0.stub)
16747 .batch_update_user_licenses(self.0.request, self.0.options)
16748 .await
16749 .map(gax::response::Response::into_body)
16750 }
16751
16752 pub fn poller(
16754 self,
16755 ) -> impl lro::Poller<
16756 crate::model::BatchUpdateUserLicensesResponse,
16757 crate::model::BatchUpdateUserLicensesMetadata,
16758 > {
16759 type Operation = lro::internal::Operation<
16760 crate::model::BatchUpdateUserLicensesResponse,
16761 crate::model::BatchUpdateUserLicensesMetadata,
16762 >;
16763 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16764 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16765
16766 let stub = self.0.stub.clone();
16767 let mut options = self.0.options.clone();
16768 options.set_retry_policy(gax::retry_policy::NeverRetry);
16769 let query = move |name| {
16770 let stub = stub.clone();
16771 let options = options.clone();
16772 async {
16773 let op = GetOperation::new(stub)
16774 .set_name(name)
16775 .with_options(options)
16776 .send()
16777 .await?;
16778 Ok(Operation::new(op))
16779 }
16780 };
16781
16782 let start = move || async {
16783 let op = self.send().await?;
16784 Ok(Operation::new(op))
16785 };
16786
16787 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
16788 }
16789
16790 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16794 self.0.request.parent = v.into();
16795 self
16796 }
16797
16798 pub fn set_delete_unassigned_user_licenses<T: Into<bool>>(mut self, v: T) -> Self {
16800 self.0.request.delete_unassigned_user_licenses = v.into();
16801 self
16802 }
16803
16804 pub fn set_source<
16809 T: Into<Option<crate::model::batch_update_user_licenses_request::Source>>,
16810 >(
16811 mut self,
16812 v: T,
16813 ) -> Self {
16814 self.0.request.source = v.into();
16815 self
16816 }
16817
16818 pub fn set_inline_source<
16824 T: std::convert::Into<
16825 std::boxed::Box<crate::model::batch_update_user_licenses_request::InlineSource>,
16826 >,
16827 >(
16828 mut self,
16829 v: T,
16830 ) -> Self {
16831 self.0.request = self.0.request.set_inline_source(v);
16832 self
16833 }
16834 }
16835
16836 #[doc(hidden)]
16837 impl gax::options::internal::RequestBuilder for BatchUpdateUserLicenses {
16838 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16839 &mut self.0.options
16840 }
16841 }
16842
16843 #[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
16948 #[doc(hidden)]
16949 impl gax::options::internal::RequestBuilder for ListOperations {
16950 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16951 &mut self.0.options
16952 }
16953 }
16954
16955 #[derive(Clone, Debug)]
16973 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
16974
16975 impl GetOperation {
16976 pub(crate) fn new(
16977 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
16978 ) -> Self {
16979 Self(RequestBuilder::new(stub))
16980 }
16981
16982 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
16984 mut self,
16985 v: V,
16986 ) -> Self {
16987 self.0.request = v.into();
16988 self
16989 }
16990
16991 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16993 self.0.options = v.into();
16994 self
16995 }
16996
16997 pub async fn send(self) -> Result<longrunning::model::Operation> {
16999 (*self.0.stub)
17000 .get_operation(self.0.request, self.0.options)
17001 .await
17002 .map(gax::response::Response::into_body)
17003 }
17004
17005 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17007 self.0.request.name = v.into();
17008 self
17009 }
17010 }
17011
17012 #[doc(hidden)]
17013 impl gax::options::internal::RequestBuilder for GetOperation {
17014 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17015 &mut self.0.options
17016 }
17017 }
17018
17019 #[derive(Clone, Debug)]
17037 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
17038
17039 impl CancelOperation {
17040 pub(crate) fn new(
17041 stub: std::sync::Arc<dyn super::super::stub::dynamic::UserLicenseService>,
17042 ) -> Self {
17043 Self(RequestBuilder::new(stub))
17044 }
17045
17046 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
17048 mut self,
17049 v: V,
17050 ) -> Self {
17051 self.0.request = v.into();
17052 self
17053 }
17054
17055 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17057 self.0.options = v.into();
17058 self
17059 }
17060
17061 pub async fn send(self) -> Result<()> {
17063 (*self.0.stub)
17064 .cancel_operation(self.0.request, self.0.options)
17065 .await
17066 .map(gax::response::Response::into_body)
17067 }
17068
17069 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17071 self.0.request.name = v.into();
17072 self
17073 }
17074 }
17075
17076 #[doc(hidden)]
17077 impl gax::options::internal::RequestBuilder for CancelOperation {
17078 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17079 &mut self.0.options
17080 }
17081 }
17082}