1#[cfg(feature = "agents")]
18#[cfg_attr(docsrs, doc(cfg(feature = "agents")))]
19pub mod agents {
20 use crate::Result;
21
22 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
36
37 pub(crate) mod client {
38 use super::super::super::client::Agents;
39 pub struct Factory;
40 impl crate::ClientFactory for Factory {
41 type Client = Agents;
42 type Credentials = gaxi::options::Credentials;
43 async fn build(
44 self,
45 config: gaxi::options::ClientConfig,
46 ) -> crate::ClientBuilderResult<Self::Client> {
47 Self::Client::new(config).await
48 }
49 }
50 }
51
52 #[derive(Clone, Debug)]
54 pub(crate) struct RequestBuilder<R: std::default::Default> {
55 stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>,
56 request: R,
57 options: crate::RequestOptions,
58 }
59
60 impl<R> RequestBuilder<R>
61 where
62 R: std::default::Default,
63 {
64 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
65 Self {
66 stub,
67 request: R::default(),
68 options: crate::RequestOptions::default(),
69 }
70 }
71 }
72
73 #[derive(Clone, Debug)]
90 pub struct GetAgent(RequestBuilder<crate::model::GetAgentRequest>);
91
92 impl GetAgent {
93 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
94 Self(RequestBuilder::new(stub))
95 }
96
97 pub fn with_request<V: Into<crate::model::GetAgentRequest>>(mut self, v: V) -> Self {
99 self.0.request = v.into();
100 self
101 }
102
103 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
105 self.0.options = v.into();
106 self
107 }
108
109 pub async fn send(self) -> Result<crate::model::Agent> {
111 (*self.0.stub)
112 .get_agent(self.0.request, self.0.options)
113 .await
114 .map(crate::Response::into_body)
115 }
116
117 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
121 self.0.request.parent = v.into();
122 self
123 }
124 }
125
126 #[doc(hidden)]
127 impl crate::RequestBuilder for GetAgent {
128 fn request_options(&mut self) -> &mut crate::RequestOptions {
129 &mut self.0.options
130 }
131 }
132
133 #[derive(Clone, Debug)]
150 pub struct SetAgent(RequestBuilder<crate::model::SetAgentRequest>);
151
152 impl SetAgent {
153 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
154 Self(RequestBuilder::new(stub))
155 }
156
157 pub fn with_request<V: Into<crate::model::SetAgentRequest>>(mut self, v: V) -> Self {
159 self.0.request = v.into();
160 self
161 }
162
163 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
165 self.0.options = v.into();
166 self
167 }
168
169 pub async fn send(self) -> Result<crate::model::Agent> {
171 (*self.0.stub)
172 .set_agent(self.0.request, self.0.options)
173 .await
174 .map(crate::Response::into_body)
175 }
176
177 pub fn set_agent<T>(mut self, v: T) -> Self
181 where
182 T: std::convert::Into<crate::model::Agent>,
183 {
184 self.0.request.agent = std::option::Option::Some(v.into());
185 self
186 }
187
188 pub fn set_or_clear_agent<T>(mut self, v: std::option::Option<T>) -> Self
192 where
193 T: std::convert::Into<crate::model::Agent>,
194 {
195 self.0.request.agent = v.map(|x| x.into());
196 self
197 }
198
199 pub fn set_update_mask<T>(mut self, v: T) -> Self
201 where
202 T: std::convert::Into<wkt::FieldMask>,
203 {
204 self.0.request.update_mask = std::option::Option::Some(v.into());
205 self
206 }
207
208 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
210 where
211 T: std::convert::Into<wkt::FieldMask>,
212 {
213 self.0.request.update_mask = v.map(|x| x.into());
214 self
215 }
216 }
217
218 #[doc(hidden)]
219 impl crate::RequestBuilder for SetAgent {
220 fn request_options(&mut self) -> &mut crate::RequestOptions {
221 &mut self.0.options
222 }
223 }
224
225 #[derive(Clone, Debug)]
242 pub struct DeleteAgent(RequestBuilder<crate::model::DeleteAgentRequest>);
243
244 impl DeleteAgent {
245 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
246 Self(RequestBuilder::new(stub))
247 }
248
249 pub fn with_request<V: Into<crate::model::DeleteAgentRequest>>(mut self, v: V) -> Self {
251 self.0.request = v.into();
252 self
253 }
254
255 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
257 self.0.options = v.into();
258 self
259 }
260
261 pub async fn send(self) -> Result<()> {
263 (*self.0.stub)
264 .delete_agent(self.0.request, self.0.options)
265 .await
266 .map(crate::Response::into_body)
267 }
268
269 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
273 self.0.request.parent = v.into();
274 self
275 }
276 }
277
278 #[doc(hidden)]
279 impl crate::RequestBuilder for DeleteAgent {
280 fn request_options(&mut self) -> &mut crate::RequestOptions {
281 &mut self.0.options
282 }
283 }
284
285 #[derive(Clone, Debug)]
306 pub struct SearchAgents(RequestBuilder<crate::model::SearchAgentsRequest>);
307
308 impl SearchAgents {
309 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
310 Self(RequestBuilder::new(stub))
311 }
312
313 pub fn with_request<V: Into<crate::model::SearchAgentsRequest>>(mut self, v: V) -> Self {
315 self.0.request = v.into();
316 self
317 }
318
319 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
321 self.0.options = v.into();
322 self
323 }
324
325 pub async fn send(self) -> Result<crate::model::SearchAgentsResponse> {
327 (*self.0.stub)
328 .search_agents(self.0.request, self.0.options)
329 .await
330 .map(crate::Response::into_body)
331 }
332
333 pub fn by_page(
335 self,
336 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchAgentsResponse, crate::Error>
337 {
338 use std::clone::Clone;
339 let token = self.0.request.page_token.clone();
340 let execute = move |token: String| {
341 let mut builder = self.clone();
342 builder.0.request = builder.0.request.set_page_token(token);
343 builder.send()
344 };
345 google_cloud_gax::paginator::internal::new_paginator(token, execute)
346 }
347
348 pub fn by_item(
350 self,
351 ) -> impl google_cloud_gax::paginator::ItemPaginator<
352 crate::model::SearchAgentsResponse,
353 crate::Error,
354 > {
355 use google_cloud_gax::paginator::Paginator;
356 self.by_page().items()
357 }
358
359 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
363 self.0.request.parent = v.into();
364 self
365 }
366
367 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
369 self.0.request.page_size = v.into();
370 self
371 }
372
373 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
375 self.0.request.page_token = v.into();
376 self
377 }
378 }
379
380 #[doc(hidden)]
381 impl crate::RequestBuilder for SearchAgents {
382 fn request_options(&mut self) -> &mut crate::RequestOptions {
383 &mut self.0.options
384 }
385 }
386
387 #[derive(Clone, Debug)]
405 pub struct TrainAgent(RequestBuilder<crate::model::TrainAgentRequest>);
406
407 impl TrainAgent {
408 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
409 Self(RequestBuilder::new(stub))
410 }
411
412 pub fn with_request<V: Into<crate::model::TrainAgentRequest>>(mut self, v: V) -> Self {
414 self.0.request = v.into();
415 self
416 }
417
418 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
420 self.0.options = v.into();
421 self
422 }
423
424 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
431 (*self.0.stub)
432 .train_agent(self.0.request, self.0.options)
433 .await
434 .map(crate::Response::into_body)
435 }
436
437 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
439 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
440 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
441 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
442
443 let stub = self.0.stub.clone();
444 let mut options = self.0.options.clone();
445 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
446 let query = move |name| {
447 let stub = stub.clone();
448 let options = options.clone();
449 async {
450 let op = GetOperation::new(stub)
451 .set_name(name)
452 .with_options(options)
453 .send()
454 .await?;
455 Ok(Operation::new(op))
456 }
457 };
458
459 let start = move || async {
460 let op = self.send().await?;
461 Ok(Operation::new(op))
462 };
463
464 google_cloud_lro::internal::new_unit_response_poller(
465 polling_error_policy,
466 polling_backoff_policy,
467 start,
468 query,
469 )
470 }
471
472 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
476 self.0.request.parent = v.into();
477 self
478 }
479 }
480
481 #[doc(hidden)]
482 impl crate::RequestBuilder for TrainAgent {
483 fn request_options(&mut self) -> &mut crate::RequestOptions {
484 &mut self.0.options
485 }
486 }
487
488 #[derive(Clone, Debug)]
506 pub struct ExportAgent(RequestBuilder<crate::model::ExportAgentRequest>);
507
508 impl ExportAgent {
509 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
510 Self(RequestBuilder::new(stub))
511 }
512
513 pub fn with_request<V: Into<crate::model::ExportAgentRequest>>(mut self, v: V) -> Self {
515 self.0.request = v.into();
516 self
517 }
518
519 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
521 self.0.options = v.into();
522 self
523 }
524
525 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
532 (*self.0.stub)
533 .export_agent(self.0.request, self.0.options)
534 .await
535 .map(crate::Response::into_body)
536 }
537
538 pub fn poller(
540 self,
541 ) -> impl google_cloud_lro::Poller<crate::model::ExportAgentResponse, wkt::Struct> {
542 type Operation = google_cloud_lro::internal::Operation<
543 crate::model::ExportAgentResponse,
544 wkt::Struct,
545 >;
546 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
547 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
548
549 let stub = self.0.stub.clone();
550 let mut options = self.0.options.clone();
551 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
552 let query = move |name| {
553 let stub = stub.clone();
554 let options = options.clone();
555 async {
556 let op = GetOperation::new(stub)
557 .set_name(name)
558 .with_options(options)
559 .send()
560 .await?;
561 Ok(Operation::new(op))
562 }
563 };
564
565 let start = move || async {
566 let op = self.send().await?;
567 Ok(Operation::new(op))
568 };
569
570 google_cloud_lro::internal::new_poller(
571 polling_error_policy,
572 polling_backoff_policy,
573 start,
574 query,
575 )
576 }
577
578 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
582 self.0.request.parent = v.into();
583 self
584 }
585
586 pub fn set_agent_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
590 self.0.request.agent_uri = v.into();
591 self
592 }
593 }
594
595 #[doc(hidden)]
596 impl crate::RequestBuilder for ExportAgent {
597 fn request_options(&mut self) -> &mut crate::RequestOptions {
598 &mut self.0.options
599 }
600 }
601
602 #[derive(Clone, Debug)]
620 pub struct ImportAgent(RequestBuilder<crate::model::ImportAgentRequest>);
621
622 impl ImportAgent {
623 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
624 Self(RequestBuilder::new(stub))
625 }
626
627 pub fn with_request<V: Into<crate::model::ImportAgentRequest>>(mut self, v: V) -> Self {
629 self.0.request = v.into();
630 self
631 }
632
633 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
635 self.0.options = v.into();
636 self
637 }
638
639 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
646 (*self.0.stub)
647 .import_agent(self.0.request, self.0.options)
648 .await
649 .map(crate::Response::into_body)
650 }
651
652 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
654 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
655 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
656 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
657
658 let stub = self.0.stub.clone();
659 let mut options = self.0.options.clone();
660 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
661 let query = move |name| {
662 let stub = stub.clone();
663 let options = options.clone();
664 async {
665 let op = GetOperation::new(stub)
666 .set_name(name)
667 .with_options(options)
668 .send()
669 .await?;
670 Ok(Operation::new(op))
671 }
672 };
673
674 let start = move || async {
675 let op = self.send().await?;
676 Ok(Operation::new(op))
677 };
678
679 google_cloud_lro::internal::new_unit_response_poller(
680 polling_error_policy,
681 polling_backoff_policy,
682 start,
683 query,
684 )
685 }
686
687 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
691 self.0.request.parent = v.into();
692 self
693 }
694
695 pub fn set_agent<T: Into<Option<crate::model::import_agent_request::Agent>>>(
700 mut self,
701 v: T,
702 ) -> Self {
703 self.0.request.agent = v.into();
704 self
705 }
706
707 pub fn set_agent_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
713 self.0.request = self.0.request.set_agent_uri(v);
714 self
715 }
716
717 pub fn set_agent_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
723 self.0.request = self.0.request.set_agent_content(v);
724 self
725 }
726 }
727
728 #[doc(hidden)]
729 impl crate::RequestBuilder for ImportAgent {
730 fn request_options(&mut self) -> &mut crate::RequestOptions {
731 &mut self.0.options
732 }
733 }
734
735 #[derive(Clone, Debug)]
753 pub struct RestoreAgent(RequestBuilder<crate::model::RestoreAgentRequest>);
754
755 impl RestoreAgent {
756 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
757 Self(RequestBuilder::new(stub))
758 }
759
760 pub fn with_request<V: Into<crate::model::RestoreAgentRequest>>(mut self, v: V) -> Self {
762 self.0.request = v.into();
763 self
764 }
765
766 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
768 self.0.options = v.into();
769 self
770 }
771
772 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
779 (*self.0.stub)
780 .restore_agent(self.0.request, self.0.options)
781 .await
782 .map(crate::Response::into_body)
783 }
784
785 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
787 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
788 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
789 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
790
791 let stub = self.0.stub.clone();
792 let mut options = self.0.options.clone();
793 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
794 let query = move |name| {
795 let stub = stub.clone();
796 let options = options.clone();
797 async {
798 let op = GetOperation::new(stub)
799 .set_name(name)
800 .with_options(options)
801 .send()
802 .await?;
803 Ok(Operation::new(op))
804 }
805 };
806
807 let start = move || async {
808 let op = self.send().await?;
809 Ok(Operation::new(op))
810 };
811
812 google_cloud_lro::internal::new_unit_response_poller(
813 polling_error_policy,
814 polling_backoff_policy,
815 start,
816 query,
817 )
818 }
819
820 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
824 self.0.request.parent = v.into();
825 self
826 }
827
828 pub fn set_agent<T: Into<Option<crate::model::restore_agent_request::Agent>>>(
833 mut self,
834 v: T,
835 ) -> Self {
836 self.0.request.agent = v.into();
837 self
838 }
839
840 pub fn set_agent_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
846 self.0.request = self.0.request.set_agent_uri(v);
847 self
848 }
849
850 pub fn set_agent_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
856 self.0.request = self.0.request.set_agent_content(v);
857 self
858 }
859 }
860
861 #[doc(hidden)]
862 impl crate::RequestBuilder for RestoreAgent {
863 fn request_options(&mut self) -> &mut crate::RequestOptions {
864 &mut self.0.options
865 }
866 }
867
868 #[derive(Clone, Debug)]
885 pub struct GetValidationResult(RequestBuilder<crate::model::GetValidationResultRequest>);
886
887 impl GetValidationResult {
888 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
889 Self(RequestBuilder::new(stub))
890 }
891
892 pub fn with_request<V: Into<crate::model::GetValidationResultRequest>>(
894 mut self,
895 v: V,
896 ) -> Self {
897 self.0.request = v.into();
898 self
899 }
900
901 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
903 self.0.options = v.into();
904 self
905 }
906
907 pub async fn send(self) -> Result<crate::model::ValidationResult> {
909 (*self.0.stub)
910 .get_validation_result(self.0.request, self.0.options)
911 .await
912 .map(crate::Response::into_body)
913 }
914
915 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
919 self.0.request.parent = v.into();
920 self
921 }
922
923 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
925 self.0.request.language_code = v.into();
926 self
927 }
928 }
929
930 #[doc(hidden)]
931 impl crate::RequestBuilder for GetValidationResult {
932 fn request_options(&mut self) -> &mut crate::RequestOptions {
933 &mut self.0.options
934 }
935 }
936
937 #[derive(Clone, Debug)]
958 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
959
960 impl ListLocations {
961 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
962 Self(RequestBuilder::new(stub))
963 }
964
965 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
967 mut self,
968 v: V,
969 ) -> Self {
970 self.0.request = v.into();
971 self
972 }
973
974 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
976 self.0.options = v.into();
977 self
978 }
979
980 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
982 (*self.0.stub)
983 .list_locations(self.0.request, self.0.options)
984 .await
985 .map(crate::Response::into_body)
986 }
987
988 pub fn by_page(
990 self,
991 ) -> impl google_cloud_gax::paginator::Paginator<
992 google_cloud_location::model::ListLocationsResponse,
993 crate::Error,
994 > {
995 use std::clone::Clone;
996 let token = self.0.request.page_token.clone();
997 let execute = move |token: String| {
998 let mut builder = self.clone();
999 builder.0.request = builder.0.request.set_page_token(token);
1000 builder.send()
1001 };
1002 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1003 }
1004
1005 pub fn by_item(
1007 self,
1008 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1009 google_cloud_location::model::ListLocationsResponse,
1010 crate::Error,
1011 > {
1012 use google_cloud_gax::paginator::Paginator;
1013 self.by_page().items()
1014 }
1015
1016 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1018 self.0.request.name = v.into();
1019 self
1020 }
1021
1022 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1024 self.0.request.filter = v.into();
1025 self
1026 }
1027
1028 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1030 self.0.request.page_size = v.into();
1031 self
1032 }
1033
1034 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1036 self.0.request.page_token = v.into();
1037 self
1038 }
1039 }
1040
1041 #[doc(hidden)]
1042 impl crate::RequestBuilder for ListLocations {
1043 fn request_options(&mut self) -> &mut crate::RequestOptions {
1044 &mut self.0.options
1045 }
1046 }
1047
1048 #[derive(Clone, Debug)]
1065 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1066
1067 impl GetLocation {
1068 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1069 Self(RequestBuilder::new(stub))
1070 }
1071
1072 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1074 mut self,
1075 v: V,
1076 ) -> Self {
1077 self.0.request = v.into();
1078 self
1079 }
1080
1081 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1083 self.0.options = v.into();
1084 self
1085 }
1086
1087 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1089 (*self.0.stub)
1090 .get_location(self.0.request, self.0.options)
1091 .await
1092 .map(crate::Response::into_body)
1093 }
1094
1095 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1097 self.0.request.name = v.into();
1098 self
1099 }
1100 }
1101
1102 #[doc(hidden)]
1103 impl crate::RequestBuilder for GetLocation {
1104 fn request_options(&mut self) -> &mut crate::RequestOptions {
1105 &mut self.0.options
1106 }
1107 }
1108
1109 #[derive(Clone, Debug)]
1130 pub struct ListOperations(
1131 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1132 );
1133
1134 impl ListOperations {
1135 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1136 Self(RequestBuilder::new(stub))
1137 }
1138
1139 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1141 mut self,
1142 v: V,
1143 ) -> Self {
1144 self.0.request = v.into();
1145 self
1146 }
1147
1148 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1150 self.0.options = v.into();
1151 self
1152 }
1153
1154 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1156 (*self.0.stub)
1157 .list_operations(self.0.request, self.0.options)
1158 .await
1159 .map(crate::Response::into_body)
1160 }
1161
1162 pub fn by_page(
1164 self,
1165 ) -> impl google_cloud_gax::paginator::Paginator<
1166 google_cloud_longrunning::model::ListOperationsResponse,
1167 crate::Error,
1168 > {
1169 use std::clone::Clone;
1170 let token = self.0.request.page_token.clone();
1171 let execute = move |token: String| {
1172 let mut builder = self.clone();
1173 builder.0.request = builder.0.request.set_page_token(token);
1174 builder.send()
1175 };
1176 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1177 }
1178
1179 pub fn by_item(
1181 self,
1182 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1183 google_cloud_longrunning::model::ListOperationsResponse,
1184 crate::Error,
1185 > {
1186 use google_cloud_gax::paginator::Paginator;
1187 self.by_page().items()
1188 }
1189
1190 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1192 self.0.request.name = v.into();
1193 self
1194 }
1195
1196 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1198 self.0.request.filter = v.into();
1199 self
1200 }
1201
1202 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1204 self.0.request.page_size = v.into();
1205 self
1206 }
1207
1208 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1210 self.0.request.page_token = v.into();
1211 self
1212 }
1213
1214 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1216 self.0.request.return_partial_success = v.into();
1217 self
1218 }
1219 }
1220
1221 #[doc(hidden)]
1222 impl crate::RequestBuilder for ListOperations {
1223 fn request_options(&mut self) -> &mut crate::RequestOptions {
1224 &mut self.0.options
1225 }
1226 }
1227
1228 #[derive(Clone, Debug)]
1245 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1246
1247 impl GetOperation {
1248 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1249 Self(RequestBuilder::new(stub))
1250 }
1251
1252 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1254 mut self,
1255 v: V,
1256 ) -> Self {
1257 self.0.request = v.into();
1258 self
1259 }
1260
1261 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1263 self.0.options = v.into();
1264 self
1265 }
1266
1267 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1269 (*self.0.stub)
1270 .get_operation(self.0.request, self.0.options)
1271 .await
1272 .map(crate::Response::into_body)
1273 }
1274
1275 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1277 self.0.request.name = v.into();
1278 self
1279 }
1280 }
1281
1282 #[doc(hidden)]
1283 impl crate::RequestBuilder for GetOperation {
1284 fn request_options(&mut self) -> &mut crate::RequestOptions {
1285 &mut self.0.options
1286 }
1287 }
1288
1289 #[derive(Clone, Debug)]
1306 pub struct CancelOperation(
1307 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1308 );
1309
1310 impl CancelOperation {
1311 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1312 Self(RequestBuilder::new(stub))
1313 }
1314
1315 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
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<crate::RequestOptions>>(mut self, v: V) -> Self {
1326 self.0.options = v.into();
1327 self
1328 }
1329
1330 pub async fn send(self) -> Result<()> {
1332 (*self.0.stub)
1333 .cancel_operation(self.0.request, self.0.options)
1334 .await
1335 .map(crate::Response::into_body)
1336 }
1337
1338 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1340 self.0.request.name = v.into();
1341 self
1342 }
1343 }
1344
1345 #[doc(hidden)]
1346 impl crate::RequestBuilder for CancelOperation {
1347 fn request_options(&mut self) -> &mut crate::RequestOptions {
1348 &mut self.0.options
1349 }
1350 }
1351}
1352
1353#[cfg(feature = "answer-records")]
1354#[cfg_attr(docsrs, doc(cfg(feature = "answer-records")))]
1355pub mod answer_records {
1356 use crate::Result;
1357
1358 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1372
1373 pub(crate) mod client {
1374 use super::super::super::client::AnswerRecords;
1375 pub struct Factory;
1376 impl crate::ClientFactory for Factory {
1377 type Client = AnswerRecords;
1378 type Credentials = gaxi::options::Credentials;
1379 async fn build(
1380 self,
1381 config: gaxi::options::ClientConfig,
1382 ) -> crate::ClientBuilderResult<Self::Client> {
1383 Self::Client::new(config).await
1384 }
1385 }
1386 }
1387
1388 #[derive(Clone, Debug)]
1390 pub(crate) struct RequestBuilder<R: std::default::Default> {
1391 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1392 request: R,
1393 options: crate::RequestOptions,
1394 }
1395
1396 impl<R> RequestBuilder<R>
1397 where
1398 R: std::default::Default,
1399 {
1400 pub(crate) fn new(
1401 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1402 ) -> Self {
1403 Self {
1404 stub,
1405 request: R::default(),
1406 options: crate::RequestOptions::default(),
1407 }
1408 }
1409 }
1410
1411 #[derive(Clone, Debug)]
1432 pub struct ListAnswerRecords(RequestBuilder<crate::model::ListAnswerRecordsRequest>);
1433
1434 impl ListAnswerRecords {
1435 pub(crate) fn new(
1436 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1437 ) -> Self {
1438 Self(RequestBuilder::new(stub))
1439 }
1440
1441 pub fn with_request<V: Into<crate::model::ListAnswerRecordsRequest>>(
1443 mut self,
1444 v: V,
1445 ) -> Self {
1446 self.0.request = v.into();
1447 self
1448 }
1449
1450 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1452 self.0.options = v.into();
1453 self
1454 }
1455
1456 pub async fn send(self) -> Result<crate::model::ListAnswerRecordsResponse> {
1458 (*self.0.stub)
1459 .list_answer_records(self.0.request, self.0.options)
1460 .await
1461 .map(crate::Response::into_body)
1462 }
1463
1464 pub fn by_page(
1466 self,
1467 ) -> impl google_cloud_gax::paginator::Paginator<
1468 crate::model::ListAnswerRecordsResponse,
1469 crate::Error,
1470 > {
1471 use std::clone::Clone;
1472 let token = self.0.request.page_token.clone();
1473 let execute = move |token: String| {
1474 let mut builder = self.clone();
1475 builder.0.request = builder.0.request.set_page_token(token);
1476 builder.send()
1477 };
1478 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1479 }
1480
1481 pub fn by_item(
1483 self,
1484 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1485 crate::model::ListAnswerRecordsResponse,
1486 crate::Error,
1487 > {
1488 use google_cloud_gax::paginator::Paginator;
1489 self.by_page().items()
1490 }
1491
1492 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1496 self.0.request.parent = v.into();
1497 self
1498 }
1499
1500 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1502 self.0.request.filter = v.into();
1503 self
1504 }
1505
1506 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1508 self.0.request.page_size = v.into();
1509 self
1510 }
1511
1512 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1514 self.0.request.page_token = v.into();
1515 self
1516 }
1517 }
1518
1519 #[doc(hidden)]
1520 impl crate::RequestBuilder for ListAnswerRecords {
1521 fn request_options(&mut self) -> &mut crate::RequestOptions {
1522 &mut self.0.options
1523 }
1524 }
1525
1526 #[derive(Clone, Debug)]
1543 pub struct UpdateAnswerRecord(RequestBuilder<crate::model::UpdateAnswerRecordRequest>);
1544
1545 impl UpdateAnswerRecord {
1546 pub(crate) fn new(
1547 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1548 ) -> Self {
1549 Self(RequestBuilder::new(stub))
1550 }
1551
1552 pub fn with_request<V: Into<crate::model::UpdateAnswerRecordRequest>>(
1554 mut self,
1555 v: V,
1556 ) -> Self {
1557 self.0.request = v.into();
1558 self
1559 }
1560
1561 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1563 self.0.options = v.into();
1564 self
1565 }
1566
1567 pub async fn send(self) -> Result<crate::model::AnswerRecord> {
1569 (*self.0.stub)
1570 .update_answer_record(self.0.request, self.0.options)
1571 .await
1572 .map(crate::Response::into_body)
1573 }
1574
1575 pub fn set_answer_record<T>(mut self, v: T) -> Self
1579 where
1580 T: std::convert::Into<crate::model::AnswerRecord>,
1581 {
1582 self.0.request.answer_record = std::option::Option::Some(v.into());
1583 self
1584 }
1585
1586 pub fn set_or_clear_answer_record<T>(mut self, v: std::option::Option<T>) -> Self
1590 where
1591 T: std::convert::Into<crate::model::AnswerRecord>,
1592 {
1593 self.0.request.answer_record = v.map(|x| x.into());
1594 self
1595 }
1596
1597 pub fn set_update_mask<T>(mut self, v: T) -> Self
1601 where
1602 T: std::convert::Into<wkt::FieldMask>,
1603 {
1604 self.0.request.update_mask = std::option::Option::Some(v.into());
1605 self
1606 }
1607
1608 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1612 where
1613 T: std::convert::Into<wkt::FieldMask>,
1614 {
1615 self.0.request.update_mask = v.map(|x| x.into());
1616 self
1617 }
1618 }
1619
1620 #[doc(hidden)]
1621 impl crate::RequestBuilder for UpdateAnswerRecord {
1622 fn request_options(&mut self) -> &mut crate::RequestOptions {
1623 &mut self.0.options
1624 }
1625 }
1626
1627 #[derive(Clone, Debug)]
1648 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
1649
1650 impl ListLocations {
1651 pub(crate) fn new(
1652 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1653 ) -> Self {
1654 Self(RequestBuilder::new(stub))
1655 }
1656
1657 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
1659 mut self,
1660 v: V,
1661 ) -> Self {
1662 self.0.request = v.into();
1663 self
1664 }
1665
1666 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1668 self.0.options = v.into();
1669 self
1670 }
1671
1672 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
1674 (*self.0.stub)
1675 .list_locations(self.0.request, self.0.options)
1676 .await
1677 .map(crate::Response::into_body)
1678 }
1679
1680 pub fn by_page(
1682 self,
1683 ) -> impl google_cloud_gax::paginator::Paginator<
1684 google_cloud_location::model::ListLocationsResponse,
1685 crate::Error,
1686 > {
1687 use std::clone::Clone;
1688 let token = self.0.request.page_token.clone();
1689 let execute = move |token: String| {
1690 let mut builder = self.clone();
1691 builder.0.request = builder.0.request.set_page_token(token);
1692 builder.send()
1693 };
1694 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1695 }
1696
1697 pub fn by_item(
1699 self,
1700 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1701 google_cloud_location::model::ListLocationsResponse,
1702 crate::Error,
1703 > {
1704 use google_cloud_gax::paginator::Paginator;
1705 self.by_page().items()
1706 }
1707
1708 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1710 self.0.request.name = v.into();
1711 self
1712 }
1713
1714 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1716 self.0.request.filter = v.into();
1717 self
1718 }
1719
1720 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1722 self.0.request.page_size = v.into();
1723 self
1724 }
1725
1726 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1728 self.0.request.page_token = v.into();
1729 self
1730 }
1731 }
1732
1733 #[doc(hidden)]
1734 impl crate::RequestBuilder for ListLocations {
1735 fn request_options(&mut self) -> &mut crate::RequestOptions {
1736 &mut self.0.options
1737 }
1738 }
1739
1740 #[derive(Clone, Debug)]
1757 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1758
1759 impl GetLocation {
1760 pub(crate) fn new(
1761 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1762 ) -> Self {
1763 Self(RequestBuilder::new(stub))
1764 }
1765
1766 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1768 mut self,
1769 v: V,
1770 ) -> Self {
1771 self.0.request = v.into();
1772 self
1773 }
1774
1775 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1777 self.0.options = v.into();
1778 self
1779 }
1780
1781 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1783 (*self.0.stub)
1784 .get_location(self.0.request, self.0.options)
1785 .await
1786 .map(crate::Response::into_body)
1787 }
1788
1789 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1791 self.0.request.name = v.into();
1792 self
1793 }
1794 }
1795
1796 #[doc(hidden)]
1797 impl crate::RequestBuilder for GetLocation {
1798 fn request_options(&mut self) -> &mut crate::RequestOptions {
1799 &mut self.0.options
1800 }
1801 }
1802
1803 #[derive(Clone, Debug)]
1824 pub struct ListOperations(
1825 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1826 );
1827
1828 impl ListOperations {
1829 pub(crate) fn new(
1830 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1831 ) -> Self {
1832 Self(RequestBuilder::new(stub))
1833 }
1834
1835 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1837 mut self,
1838 v: V,
1839 ) -> Self {
1840 self.0.request = v.into();
1841 self
1842 }
1843
1844 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1846 self.0.options = v.into();
1847 self
1848 }
1849
1850 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1852 (*self.0.stub)
1853 .list_operations(self.0.request, self.0.options)
1854 .await
1855 .map(crate::Response::into_body)
1856 }
1857
1858 pub fn by_page(
1860 self,
1861 ) -> impl google_cloud_gax::paginator::Paginator<
1862 google_cloud_longrunning::model::ListOperationsResponse,
1863 crate::Error,
1864 > {
1865 use std::clone::Clone;
1866 let token = self.0.request.page_token.clone();
1867 let execute = move |token: String| {
1868 let mut builder = self.clone();
1869 builder.0.request = builder.0.request.set_page_token(token);
1870 builder.send()
1871 };
1872 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1873 }
1874
1875 pub fn by_item(
1877 self,
1878 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1879 google_cloud_longrunning::model::ListOperationsResponse,
1880 crate::Error,
1881 > {
1882 use google_cloud_gax::paginator::Paginator;
1883 self.by_page().items()
1884 }
1885
1886 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1888 self.0.request.name = v.into();
1889 self
1890 }
1891
1892 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1894 self.0.request.filter = v.into();
1895 self
1896 }
1897
1898 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1900 self.0.request.page_size = v.into();
1901 self
1902 }
1903
1904 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1906 self.0.request.page_token = v.into();
1907 self
1908 }
1909
1910 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1912 self.0.request.return_partial_success = v.into();
1913 self
1914 }
1915 }
1916
1917 #[doc(hidden)]
1918 impl crate::RequestBuilder for ListOperations {
1919 fn request_options(&mut self) -> &mut crate::RequestOptions {
1920 &mut self.0.options
1921 }
1922 }
1923
1924 #[derive(Clone, Debug)]
1941 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1942
1943 impl GetOperation {
1944 pub(crate) fn new(
1945 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1946 ) -> Self {
1947 Self(RequestBuilder::new(stub))
1948 }
1949
1950 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1952 mut self,
1953 v: V,
1954 ) -> Self {
1955 self.0.request = v.into();
1956 self
1957 }
1958
1959 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1961 self.0.options = v.into();
1962 self
1963 }
1964
1965 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1967 (*self.0.stub)
1968 .get_operation(self.0.request, self.0.options)
1969 .await
1970 .map(crate::Response::into_body)
1971 }
1972
1973 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1975 self.0.request.name = v.into();
1976 self
1977 }
1978 }
1979
1980 #[doc(hidden)]
1981 impl crate::RequestBuilder for GetOperation {
1982 fn request_options(&mut self) -> &mut crate::RequestOptions {
1983 &mut self.0.options
1984 }
1985 }
1986
1987 #[derive(Clone, Debug)]
2004 pub struct CancelOperation(
2005 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2006 );
2007
2008 impl CancelOperation {
2009 pub(crate) fn new(
2010 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
2011 ) -> Self {
2012 Self(RequestBuilder::new(stub))
2013 }
2014
2015 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2017 mut self,
2018 v: V,
2019 ) -> Self {
2020 self.0.request = v.into();
2021 self
2022 }
2023
2024 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2026 self.0.options = v.into();
2027 self
2028 }
2029
2030 pub async fn send(self) -> Result<()> {
2032 (*self.0.stub)
2033 .cancel_operation(self.0.request, self.0.options)
2034 .await
2035 .map(crate::Response::into_body)
2036 }
2037
2038 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2040 self.0.request.name = v.into();
2041 self
2042 }
2043 }
2044
2045 #[doc(hidden)]
2046 impl crate::RequestBuilder for CancelOperation {
2047 fn request_options(&mut self) -> &mut crate::RequestOptions {
2048 &mut self.0.options
2049 }
2050 }
2051}
2052
2053#[cfg(feature = "contexts")]
2054#[cfg_attr(docsrs, doc(cfg(feature = "contexts")))]
2055pub mod contexts {
2056 use crate::Result;
2057
2058 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2072
2073 pub(crate) mod client {
2074 use super::super::super::client::Contexts;
2075 pub struct Factory;
2076 impl crate::ClientFactory for Factory {
2077 type Client = Contexts;
2078 type Credentials = gaxi::options::Credentials;
2079 async fn build(
2080 self,
2081 config: gaxi::options::ClientConfig,
2082 ) -> crate::ClientBuilderResult<Self::Client> {
2083 Self::Client::new(config).await
2084 }
2085 }
2086 }
2087
2088 #[derive(Clone, Debug)]
2090 pub(crate) struct RequestBuilder<R: std::default::Default> {
2091 stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>,
2092 request: R,
2093 options: crate::RequestOptions,
2094 }
2095
2096 impl<R> RequestBuilder<R>
2097 where
2098 R: std::default::Default,
2099 {
2100 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2101 Self {
2102 stub,
2103 request: R::default(),
2104 options: crate::RequestOptions::default(),
2105 }
2106 }
2107 }
2108
2109 #[derive(Clone, Debug)]
2130 pub struct ListContexts(RequestBuilder<crate::model::ListContextsRequest>);
2131
2132 impl ListContexts {
2133 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2134 Self(RequestBuilder::new(stub))
2135 }
2136
2137 pub fn with_request<V: Into<crate::model::ListContextsRequest>>(mut self, v: V) -> Self {
2139 self.0.request = v.into();
2140 self
2141 }
2142
2143 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2145 self.0.options = v.into();
2146 self
2147 }
2148
2149 pub async fn send(self) -> Result<crate::model::ListContextsResponse> {
2151 (*self.0.stub)
2152 .list_contexts(self.0.request, self.0.options)
2153 .await
2154 .map(crate::Response::into_body)
2155 }
2156
2157 pub fn by_page(
2159 self,
2160 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListContextsResponse, crate::Error>
2161 {
2162 use std::clone::Clone;
2163 let token = self.0.request.page_token.clone();
2164 let execute = move |token: String| {
2165 let mut builder = self.clone();
2166 builder.0.request = builder.0.request.set_page_token(token);
2167 builder.send()
2168 };
2169 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2170 }
2171
2172 pub fn by_item(
2174 self,
2175 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2176 crate::model::ListContextsResponse,
2177 crate::Error,
2178 > {
2179 use google_cloud_gax::paginator::Paginator;
2180 self.by_page().items()
2181 }
2182
2183 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2187 self.0.request.parent = v.into();
2188 self
2189 }
2190
2191 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2193 self.0.request.page_size = v.into();
2194 self
2195 }
2196
2197 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2199 self.0.request.page_token = v.into();
2200 self
2201 }
2202 }
2203
2204 #[doc(hidden)]
2205 impl crate::RequestBuilder for ListContexts {
2206 fn request_options(&mut self) -> &mut crate::RequestOptions {
2207 &mut self.0.options
2208 }
2209 }
2210
2211 #[derive(Clone, Debug)]
2228 pub struct GetContext(RequestBuilder<crate::model::GetContextRequest>);
2229
2230 impl GetContext {
2231 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2232 Self(RequestBuilder::new(stub))
2233 }
2234
2235 pub fn with_request<V: Into<crate::model::GetContextRequest>>(mut self, v: V) -> Self {
2237 self.0.request = v.into();
2238 self
2239 }
2240
2241 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2243 self.0.options = v.into();
2244 self
2245 }
2246
2247 pub async fn send(self) -> Result<crate::model::Context> {
2249 (*self.0.stub)
2250 .get_context(self.0.request, self.0.options)
2251 .await
2252 .map(crate::Response::into_body)
2253 }
2254
2255 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2259 self.0.request.name = v.into();
2260 self
2261 }
2262 }
2263
2264 #[doc(hidden)]
2265 impl crate::RequestBuilder for GetContext {
2266 fn request_options(&mut self) -> &mut crate::RequestOptions {
2267 &mut self.0.options
2268 }
2269 }
2270
2271 #[derive(Clone, Debug)]
2288 pub struct CreateContext(RequestBuilder<crate::model::CreateContextRequest>);
2289
2290 impl CreateContext {
2291 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2292 Self(RequestBuilder::new(stub))
2293 }
2294
2295 pub fn with_request<V: Into<crate::model::CreateContextRequest>>(mut self, v: V) -> Self {
2297 self.0.request = v.into();
2298 self
2299 }
2300
2301 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2303 self.0.options = v.into();
2304 self
2305 }
2306
2307 pub async fn send(self) -> Result<crate::model::Context> {
2309 (*self.0.stub)
2310 .create_context(self.0.request, self.0.options)
2311 .await
2312 .map(crate::Response::into_body)
2313 }
2314
2315 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2319 self.0.request.parent = v.into();
2320 self
2321 }
2322
2323 pub fn set_context<T>(mut self, v: T) -> Self
2327 where
2328 T: std::convert::Into<crate::model::Context>,
2329 {
2330 self.0.request.context = std::option::Option::Some(v.into());
2331 self
2332 }
2333
2334 pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
2338 where
2339 T: std::convert::Into<crate::model::Context>,
2340 {
2341 self.0.request.context = v.map(|x| x.into());
2342 self
2343 }
2344 }
2345
2346 #[doc(hidden)]
2347 impl crate::RequestBuilder for CreateContext {
2348 fn request_options(&mut self) -> &mut crate::RequestOptions {
2349 &mut self.0.options
2350 }
2351 }
2352
2353 #[derive(Clone, Debug)]
2370 pub struct UpdateContext(RequestBuilder<crate::model::UpdateContextRequest>);
2371
2372 impl UpdateContext {
2373 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2374 Self(RequestBuilder::new(stub))
2375 }
2376
2377 pub fn with_request<V: Into<crate::model::UpdateContextRequest>>(mut self, v: V) -> Self {
2379 self.0.request = v.into();
2380 self
2381 }
2382
2383 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2385 self.0.options = v.into();
2386 self
2387 }
2388
2389 pub async fn send(self) -> Result<crate::model::Context> {
2391 (*self.0.stub)
2392 .update_context(self.0.request, self.0.options)
2393 .await
2394 .map(crate::Response::into_body)
2395 }
2396
2397 pub fn set_context<T>(mut self, v: T) -> Self
2401 where
2402 T: std::convert::Into<crate::model::Context>,
2403 {
2404 self.0.request.context = std::option::Option::Some(v.into());
2405 self
2406 }
2407
2408 pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
2412 where
2413 T: std::convert::Into<crate::model::Context>,
2414 {
2415 self.0.request.context = v.map(|x| x.into());
2416 self
2417 }
2418
2419 pub fn set_update_mask<T>(mut self, v: T) -> Self
2421 where
2422 T: std::convert::Into<wkt::FieldMask>,
2423 {
2424 self.0.request.update_mask = std::option::Option::Some(v.into());
2425 self
2426 }
2427
2428 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2430 where
2431 T: std::convert::Into<wkt::FieldMask>,
2432 {
2433 self.0.request.update_mask = v.map(|x| x.into());
2434 self
2435 }
2436 }
2437
2438 #[doc(hidden)]
2439 impl crate::RequestBuilder for UpdateContext {
2440 fn request_options(&mut self) -> &mut crate::RequestOptions {
2441 &mut self.0.options
2442 }
2443 }
2444
2445 #[derive(Clone, Debug)]
2462 pub struct DeleteContext(RequestBuilder<crate::model::DeleteContextRequest>);
2463
2464 impl DeleteContext {
2465 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2466 Self(RequestBuilder::new(stub))
2467 }
2468
2469 pub fn with_request<V: Into<crate::model::DeleteContextRequest>>(mut self, v: V) -> Self {
2471 self.0.request = v.into();
2472 self
2473 }
2474
2475 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2477 self.0.options = v.into();
2478 self
2479 }
2480
2481 pub async fn send(self) -> Result<()> {
2483 (*self.0.stub)
2484 .delete_context(self.0.request, self.0.options)
2485 .await
2486 .map(crate::Response::into_body)
2487 }
2488
2489 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2493 self.0.request.name = v.into();
2494 self
2495 }
2496 }
2497
2498 #[doc(hidden)]
2499 impl crate::RequestBuilder for DeleteContext {
2500 fn request_options(&mut self) -> &mut crate::RequestOptions {
2501 &mut self.0.options
2502 }
2503 }
2504
2505 #[derive(Clone, Debug)]
2522 pub struct DeleteAllContexts(RequestBuilder<crate::model::DeleteAllContextsRequest>);
2523
2524 impl DeleteAllContexts {
2525 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2526 Self(RequestBuilder::new(stub))
2527 }
2528
2529 pub fn with_request<V: Into<crate::model::DeleteAllContextsRequest>>(
2531 mut self,
2532 v: V,
2533 ) -> Self {
2534 self.0.request = v.into();
2535 self
2536 }
2537
2538 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2540 self.0.options = v.into();
2541 self
2542 }
2543
2544 pub async fn send(self) -> Result<()> {
2546 (*self.0.stub)
2547 .delete_all_contexts(self.0.request, self.0.options)
2548 .await
2549 .map(crate::Response::into_body)
2550 }
2551
2552 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2556 self.0.request.parent = v.into();
2557 self
2558 }
2559 }
2560
2561 #[doc(hidden)]
2562 impl crate::RequestBuilder for DeleteAllContexts {
2563 fn request_options(&mut self) -> &mut crate::RequestOptions {
2564 &mut self.0.options
2565 }
2566 }
2567
2568 #[derive(Clone, Debug)]
2589 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
2590
2591 impl ListLocations {
2592 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2593 Self(RequestBuilder::new(stub))
2594 }
2595
2596 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
2598 mut self,
2599 v: V,
2600 ) -> Self {
2601 self.0.request = v.into();
2602 self
2603 }
2604
2605 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2607 self.0.options = v.into();
2608 self
2609 }
2610
2611 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
2613 (*self.0.stub)
2614 .list_locations(self.0.request, self.0.options)
2615 .await
2616 .map(crate::Response::into_body)
2617 }
2618
2619 pub fn by_page(
2621 self,
2622 ) -> impl google_cloud_gax::paginator::Paginator<
2623 google_cloud_location::model::ListLocationsResponse,
2624 crate::Error,
2625 > {
2626 use std::clone::Clone;
2627 let token = self.0.request.page_token.clone();
2628 let execute = move |token: String| {
2629 let mut builder = self.clone();
2630 builder.0.request = builder.0.request.set_page_token(token);
2631 builder.send()
2632 };
2633 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2634 }
2635
2636 pub fn by_item(
2638 self,
2639 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2640 google_cloud_location::model::ListLocationsResponse,
2641 crate::Error,
2642 > {
2643 use google_cloud_gax::paginator::Paginator;
2644 self.by_page().items()
2645 }
2646
2647 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2649 self.0.request.name = v.into();
2650 self
2651 }
2652
2653 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2655 self.0.request.filter = v.into();
2656 self
2657 }
2658
2659 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2661 self.0.request.page_size = v.into();
2662 self
2663 }
2664
2665 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2667 self.0.request.page_token = v.into();
2668 self
2669 }
2670 }
2671
2672 #[doc(hidden)]
2673 impl crate::RequestBuilder for ListLocations {
2674 fn request_options(&mut self) -> &mut crate::RequestOptions {
2675 &mut self.0.options
2676 }
2677 }
2678
2679 #[derive(Clone, Debug)]
2696 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
2697
2698 impl GetLocation {
2699 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2700 Self(RequestBuilder::new(stub))
2701 }
2702
2703 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
2705 mut self,
2706 v: V,
2707 ) -> Self {
2708 self.0.request = v.into();
2709 self
2710 }
2711
2712 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2714 self.0.options = v.into();
2715 self
2716 }
2717
2718 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
2720 (*self.0.stub)
2721 .get_location(self.0.request, self.0.options)
2722 .await
2723 .map(crate::Response::into_body)
2724 }
2725
2726 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2728 self.0.request.name = v.into();
2729 self
2730 }
2731 }
2732
2733 #[doc(hidden)]
2734 impl crate::RequestBuilder for GetLocation {
2735 fn request_options(&mut self) -> &mut crate::RequestOptions {
2736 &mut self.0.options
2737 }
2738 }
2739
2740 #[derive(Clone, Debug)]
2761 pub struct ListOperations(
2762 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2763 );
2764
2765 impl ListOperations {
2766 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2767 Self(RequestBuilder::new(stub))
2768 }
2769
2770 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2772 mut self,
2773 v: V,
2774 ) -> Self {
2775 self.0.request = v.into();
2776 self
2777 }
2778
2779 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2781 self.0.options = v.into();
2782 self
2783 }
2784
2785 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2787 (*self.0.stub)
2788 .list_operations(self.0.request, self.0.options)
2789 .await
2790 .map(crate::Response::into_body)
2791 }
2792
2793 pub fn by_page(
2795 self,
2796 ) -> impl google_cloud_gax::paginator::Paginator<
2797 google_cloud_longrunning::model::ListOperationsResponse,
2798 crate::Error,
2799 > {
2800 use std::clone::Clone;
2801 let token = self.0.request.page_token.clone();
2802 let execute = move |token: String| {
2803 let mut builder = self.clone();
2804 builder.0.request = builder.0.request.set_page_token(token);
2805 builder.send()
2806 };
2807 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2808 }
2809
2810 pub fn by_item(
2812 self,
2813 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2814 google_cloud_longrunning::model::ListOperationsResponse,
2815 crate::Error,
2816 > {
2817 use google_cloud_gax::paginator::Paginator;
2818 self.by_page().items()
2819 }
2820
2821 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2823 self.0.request.name = v.into();
2824 self
2825 }
2826
2827 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2829 self.0.request.filter = v.into();
2830 self
2831 }
2832
2833 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2835 self.0.request.page_size = v.into();
2836 self
2837 }
2838
2839 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2841 self.0.request.page_token = v.into();
2842 self
2843 }
2844
2845 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2847 self.0.request.return_partial_success = v.into();
2848 self
2849 }
2850 }
2851
2852 #[doc(hidden)]
2853 impl crate::RequestBuilder for ListOperations {
2854 fn request_options(&mut self) -> &mut crate::RequestOptions {
2855 &mut self.0.options
2856 }
2857 }
2858
2859 #[derive(Clone, Debug)]
2876 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2877
2878 impl GetOperation {
2879 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2880 Self(RequestBuilder::new(stub))
2881 }
2882
2883 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2885 mut self,
2886 v: V,
2887 ) -> Self {
2888 self.0.request = v.into();
2889 self
2890 }
2891
2892 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2894 self.0.options = v.into();
2895 self
2896 }
2897
2898 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2900 (*self.0.stub)
2901 .get_operation(self.0.request, self.0.options)
2902 .await
2903 .map(crate::Response::into_body)
2904 }
2905
2906 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2908 self.0.request.name = v.into();
2909 self
2910 }
2911 }
2912
2913 #[doc(hidden)]
2914 impl crate::RequestBuilder for GetOperation {
2915 fn request_options(&mut self) -> &mut crate::RequestOptions {
2916 &mut self.0.options
2917 }
2918 }
2919
2920 #[derive(Clone, Debug)]
2937 pub struct CancelOperation(
2938 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2939 );
2940
2941 impl CancelOperation {
2942 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2943 Self(RequestBuilder::new(stub))
2944 }
2945
2946 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2948 mut self,
2949 v: V,
2950 ) -> Self {
2951 self.0.request = v.into();
2952 self
2953 }
2954
2955 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2957 self.0.options = v.into();
2958 self
2959 }
2960
2961 pub async fn send(self) -> Result<()> {
2963 (*self.0.stub)
2964 .cancel_operation(self.0.request, self.0.options)
2965 .await
2966 .map(crate::Response::into_body)
2967 }
2968
2969 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2971 self.0.request.name = v.into();
2972 self
2973 }
2974 }
2975
2976 #[doc(hidden)]
2977 impl crate::RequestBuilder for CancelOperation {
2978 fn request_options(&mut self) -> &mut crate::RequestOptions {
2979 &mut self.0.options
2980 }
2981 }
2982}
2983
2984#[cfg(feature = "conversations")]
2985#[cfg_attr(docsrs, doc(cfg(feature = "conversations")))]
2986pub mod conversations {
2987 use crate::Result;
2988
2989 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3003
3004 pub(crate) mod client {
3005 use super::super::super::client::Conversations;
3006 pub struct Factory;
3007 impl crate::ClientFactory for Factory {
3008 type Client = Conversations;
3009 type Credentials = gaxi::options::Credentials;
3010 async fn build(
3011 self,
3012 config: gaxi::options::ClientConfig,
3013 ) -> crate::ClientBuilderResult<Self::Client> {
3014 Self::Client::new(config).await
3015 }
3016 }
3017 }
3018
3019 #[derive(Clone, Debug)]
3021 pub(crate) struct RequestBuilder<R: std::default::Default> {
3022 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3023 request: R,
3024 options: crate::RequestOptions,
3025 }
3026
3027 impl<R> RequestBuilder<R>
3028 where
3029 R: std::default::Default,
3030 {
3031 pub(crate) fn new(
3032 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3033 ) -> Self {
3034 Self {
3035 stub,
3036 request: R::default(),
3037 options: crate::RequestOptions::default(),
3038 }
3039 }
3040 }
3041
3042 #[derive(Clone, Debug)]
3059 pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
3060
3061 impl CreateConversation {
3062 pub(crate) fn new(
3063 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3064 ) -> Self {
3065 Self(RequestBuilder::new(stub))
3066 }
3067
3068 pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
3070 mut self,
3071 v: V,
3072 ) -> Self {
3073 self.0.request = v.into();
3074 self
3075 }
3076
3077 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3079 self.0.options = v.into();
3080 self
3081 }
3082
3083 pub async fn send(self) -> Result<crate::model::Conversation> {
3085 (*self.0.stub)
3086 .create_conversation(self.0.request, self.0.options)
3087 .await
3088 .map(crate::Response::into_body)
3089 }
3090
3091 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3095 self.0.request.parent = v.into();
3096 self
3097 }
3098
3099 pub fn set_conversation<T>(mut self, v: T) -> Self
3103 where
3104 T: std::convert::Into<crate::model::Conversation>,
3105 {
3106 self.0.request.conversation = std::option::Option::Some(v.into());
3107 self
3108 }
3109
3110 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3114 where
3115 T: std::convert::Into<crate::model::Conversation>,
3116 {
3117 self.0.request.conversation = v.map(|x| x.into());
3118 self
3119 }
3120
3121 pub fn set_conversation_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3123 self.0.request.conversation_id = v.into();
3124 self
3125 }
3126 }
3127
3128 #[doc(hidden)]
3129 impl crate::RequestBuilder for CreateConversation {
3130 fn request_options(&mut self) -> &mut crate::RequestOptions {
3131 &mut self.0.options
3132 }
3133 }
3134
3135 #[derive(Clone, Debug)]
3156 pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3157
3158 impl ListConversations {
3159 pub(crate) fn new(
3160 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3161 ) -> Self {
3162 Self(RequestBuilder::new(stub))
3163 }
3164
3165 pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3167 mut self,
3168 v: V,
3169 ) -> Self {
3170 self.0.request = v.into();
3171 self
3172 }
3173
3174 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3176 self.0.options = v.into();
3177 self
3178 }
3179
3180 pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3182 (*self.0.stub)
3183 .list_conversations(self.0.request, self.0.options)
3184 .await
3185 .map(crate::Response::into_body)
3186 }
3187
3188 pub fn by_page(
3190 self,
3191 ) -> impl google_cloud_gax::paginator::Paginator<
3192 crate::model::ListConversationsResponse,
3193 crate::Error,
3194 > {
3195 use std::clone::Clone;
3196 let token = self.0.request.page_token.clone();
3197 let execute = move |token: String| {
3198 let mut builder = self.clone();
3199 builder.0.request = builder.0.request.set_page_token(token);
3200 builder.send()
3201 };
3202 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3203 }
3204
3205 pub fn by_item(
3207 self,
3208 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3209 crate::model::ListConversationsResponse,
3210 crate::Error,
3211 > {
3212 use google_cloud_gax::paginator::Paginator;
3213 self.by_page().items()
3214 }
3215
3216 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3220 self.0.request.parent = v.into();
3221 self
3222 }
3223
3224 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3226 self.0.request.page_size = v.into();
3227 self
3228 }
3229
3230 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3232 self.0.request.page_token = v.into();
3233 self
3234 }
3235
3236 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3238 self.0.request.filter = v.into();
3239 self
3240 }
3241 }
3242
3243 #[doc(hidden)]
3244 impl crate::RequestBuilder for ListConversations {
3245 fn request_options(&mut self) -> &mut crate::RequestOptions {
3246 &mut self.0.options
3247 }
3248 }
3249
3250 #[derive(Clone, Debug)]
3267 pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3268
3269 impl GetConversation {
3270 pub(crate) fn new(
3271 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3272 ) -> Self {
3273 Self(RequestBuilder::new(stub))
3274 }
3275
3276 pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3278 self.0.request = v.into();
3279 self
3280 }
3281
3282 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3284 self.0.options = v.into();
3285 self
3286 }
3287
3288 pub async fn send(self) -> Result<crate::model::Conversation> {
3290 (*self.0.stub)
3291 .get_conversation(self.0.request, self.0.options)
3292 .await
3293 .map(crate::Response::into_body)
3294 }
3295
3296 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3300 self.0.request.name = v.into();
3301 self
3302 }
3303 }
3304
3305 #[doc(hidden)]
3306 impl crate::RequestBuilder for GetConversation {
3307 fn request_options(&mut self) -> &mut crate::RequestOptions {
3308 &mut self.0.options
3309 }
3310 }
3311
3312 #[derive(Clone, Debug)]
3329 pub struct CompleteConversation(RequestBuilder<crate::model::CompleteConversationRequest>);
3330
3331 impl CompleteConversation {
3332 pub(crate) fn new(
3333 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3334 ) -> Self {
3335 Self(RequestBuilder::new(stub))
3336 }
3337
3338 pub fn with_request<V: Into<crate::model::CompleteConversationRequest>>(
3340 mut self,
3341 v: V,
3342 ) -> Self {
3343 self.0.request = v.into();
3344 self
3345 }
3346
3347 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3349 self.0.options = v.into();
3350 self
3351 }
3352
3353 pub async fn send(self) -> Result<crate::model::Conversation> {
3355 (*self.0.stub)
3356 .complete_conversation(self.0.request, self.0.options)
3357 .await
3358 .map(crate::Response::into_body)
3359 }
3360
3361 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3365 self.0.request.name = v.into();
3366 self
3367 }
3368 }
3369
3370 #[doc(hidden)]
3371 impl crate::RequestBuilder for CompleteConversation {
3372 fn request_options(&mut self) -> &mut crate::RequestOptions {
3373 &mut self.0.options
3374 }
3375 }
3376
3377 #[derive(Clone, Debug)]
3394 pub struct IngestContextReferences(
3395 RequestBuilder<crate::model::IngestContextReferencesRequest>,
3396 );
3397
3398 impl IngestContextReferences {
3399 pub(crate) fn new(
3400 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3401 ) -> Self {
3402 Self(RequestBuilder::new(stub))
3403 }
3404
3405 pub fn with_request<V: Into<crate::model::IngestContextReferencesRequest>>(
3407 mut self,
3408 v: V,
3409 ) -> Self {
3410 self.0.request = v.into();
3411 self
3412 }
3413
3414 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3416 self.0.options = v.into();
3417 self
3418 }
3419
3420 pub async fn send(self) -> Result<crate::model::IngestContextReferencesResponse> {
3422 (*self.0.stub)
3423 .ingest_context_references(self.0.request, self.0.options)
3424 .await
3425 .map(crate::Response::into_body)
3426 }
3427
3428 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
3432 self.0.request.conversation = v.into();
3433 self
3434 }
3435
3436 pub fn set_context_references<T, K, V>(mut self, v: T) -> Self
3440 where
3441 T: std::iter::IntoIterator<Item = (K, V)>,
3442 K: std::convert::Into<std::string::String>,
3443 V: std::convert::Into<crate::model::conversation::ContextReference>,
3444 {
3445 self.0.request.context_references =
3446 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3447 self
3448 }
3449 }
3450
3451 #[doc(hidden)]
3452 impl crate::RequestBuilder for IngestContextReferences {
3453 fn request_options(&mut self) -> &mut crate::RequestOptions {
3454 &mut self.0.options
3455 }
3456 }
3457
3458 #[derive(Clone, Debug)]
3479 pub struct ListMessages(RequestBuilder<crate::model::ListMessagesRequest>);
3480
3481 impl ListMessages {
3482 pub(crate) fn new(
3483 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3484 ) -> Self {
3485 Self(RequestBuilder::new(stub))
3486 }
3487
3488 pub fn with_request<V: Into<crate::model::ListMessagesRequest>>(mut self, v: V) -> Self {
3490 self.0.request = v.into();
3491 self
3492 }
3493
3494 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3496 self.0.options = v.into();
3497 self
3498 }
3499
3500 pub async fn send(self) -> Result<crate::model::ListMessagesResponse> {
3502 (*self.0.stub)
3503 .list_messages(self.0.request, self.0.options)
3504 .await
3505 .map(crate::Response::into_body)
3506 }
3507
3508 pub fn by_page(
3510 self,
3511 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListMessagesResponse, crate::Error>
3512 {
3513 use std::clone::Clone;
3514 let token = self.0.request.page_token.clone();
3515 let execute = move |token: String| {
3516 let mut builder = self.clone();
3517 builder.0.request = builder.0.request.set_page_token(token);
3518 builder.send()
3519 };
3520 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3521 }
3522
3523 pub fn by_item(
3525 self,
3526 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3527 crate::model::ListMessagesResponse,
3528 crate::Error,
3529 > {
3530 use google_cloud_gax::paginator::Paginator;
3531 self.by_page().items()
3532 }
3533
3534 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3538 self.0.request.parent = v.into();
3539 self
3540 }
3541
3542 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3544 self.0.request.filter = v.into();
3545 self
3546 }
3547
3548 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3550 self.0.request.page_size = v.into();
3551 self
3552 }
3553
3554 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3556 self.0.request.page_token = v.into();
3557 self
3558 }
3559 }
3560
3561 #[doc(hidden)]
3562 impl crate::RequestBuilder for ListMessages {
3563 fn request_options(&mut self) -> &mut crate::RequestOptions {
3564 &mut self.0.options
3565 }
3566 }
3567
3568 #[derive(Clone, Debug)]
3585 pub struct SuggestConversationSummary(
3586 RequestBuilder<crate::model::SuggestConversationSummaryRequest>,
3587 );
3588
3589 impl SuggestConversationSummary {
3590 pub(crate) fn new(
3591 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3592 ) -> Self {
3593 Self(RequestBuilder::new(stub))
3594 }
3595
3596 pub fn with_request<V: Into<crate::model::SuggestConversationSummaryRequest>>(
3598 mut self,
3599 v: V,
3600 ) -> Self {
3601 self.0.request = v.into();
3602 self
3603 }
3604
3605 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3607 self.0.options = v.into();
3608 self
3609 }
3610
3611 pub async fn send(self) -> Result<crate::model::SuggestConversationSummaryResponse> {
3613 (*self.0.stub)
3614 .suggest_conversation_summary(self.0.request, self.0.options)
3615 .await
3616 .map(crate::Response::into_body)
3617 }
3618
3619 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
3623 self.0.request.conversation = v.into();
3624 self
3625 }
3626
3627 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
3629 self.0.request.latest_message = v.into();
3630 self
3631 }
3632
3633 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
3635 self.0.request.context_size = v.into();
3636 self
3637 }
3638
3639 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
3641 where
3642 T: std::convert::Into<crate::model::AssistQueryParameters>,
3643 {
3644 self.0.request.assist_query_params = std::option::Option::Some(v.into());
3645 self
3646 }
3647
3648 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
3650 where
3651 T: std::convert::Into<crate::model::AssistQueryParameters>,
3652 {
3653 self.0.request.assist_query_params = v.map(|x| x.into());
3654 self
3655 }
3656 }
3657
3658 #[doc(hidden)]
3659 impl crate::RequestBuilder for SuggestConversationSummary {
3660 fn request_options(&mut self) -> &mut crate::RequestOptions {
3661 &mut self.0.options
3662 }
3663 }
3664
3665 #[derive(Clone, Debug)]
3682 pub struct GenerateStatelessSummary(
3683 RequestBuilder<crate::model::GenerateStatelessSummaryRequest>,
3684 );
3685
3686 impl GenerateStatelessSummary {
3687 pub(crate) fn new(
3688 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3689 ) -> Self {
3690 Self(RequestBuilder::new(stub))
3691 }
3692
3693 pub fn with_request<V: Into<crate::model::GenerateStatelessSummaryRequest>>(
3695 mut self,
3696 v: V,
3697 ) -> Self {
3698 self.0.request = v.into();
3699 self
3700 }
3701
3702 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3704 self.0.options = v.into();
3705 self
3706 }
3707
3708 pub async fn send(self) -> Result<crate::model::GenerateStatelessSummaryResponse> {
3710 (*self.0.stub)
3711 .generate_stateless_summary(self.0.request, self.0.options)
3712 .await
3713 .map(crate::Response::into_body)
3714 }
3715
3716 pub fn set_stateless_conversation<T>(mut self, v: T) -> Self
3720 where
3721 T: std::convert::Into<
3722 crate::model::generate_stateless_summary_request::MinimalConversation,
3723 >,
3724 {
3725 self.0.request.stateless_conversation = std::option::Option::Some(v.into());
3726 self
3727 }
3728
3729 pub fn set_or_clear_stateless_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3733 where
3734 T: std::convert::Into<
3735 crate::model::generate_stateless_summary_request::MinimalConversation,
3736 >,
3737 {
3738 self.0.request.stateless_conversation = v.map(|x| x.into());
3739 self
3740 }
3741
3742 pub fn set_conversation_profile<T>(mut self, v: T) -> Self
3746 where
3747 T: std::convert::Into<crate::model::ConversationProfile>,
3748 {
3749 self.0.request.conversation_profile = std::option::Option::Some(v.into());
3750 self
3751 }
3752
3753 pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
3757 where
3758 T: std::convert::Into<crate::model::ConversationProfile>,
3759 {
3760 self.0.request.conversation_profile = v.map(|x| x.into());
3761 self
3762 }
3763
3764 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
3766 self.0.request.latest_message = v.into();
3767 self
3768 }
3769
3770 pub fn set_max_context_size<T: Into<i32>>(mut self, v: T) -> Self {
3772 self.0.request.max_context_size = v.into();
3773 self
3774 }
3775 }
3776
3777 #[doc(hidden)]
3778 impl crate::RequestBuilder for GenerateStatelessSummary {
3779 fn request_options(&mut self) -> &mut crate::RequestOptions {
3780 &mut self.0.options
3781 }
3782 }
3783
3784 #[derive(Clone, Debug)]
3801 pub struct GenerateStatelessSuggestion(
3802 RequestBuilder<crate::model::GenerateStatelessSuggestionRequest>,
3803 );
3804
3805 impl GenerateStatelessSuggestion {
3806 pub(crate) fn new(
3807 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3808 ) -> Self {
3809 Self(RequestBuilder::new(stub))
3810 }
3811
3812 pub fn with_request<V: Into<crate::model::GenerateStatelessSuggestionRequest>>(
3814 mut self,
3815 v: V,
3816 ) -> Self {
3817 self.0.request = v.into();
3818 self
3819 }
3820
3821 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3823 self.0.options = v.into();
3824 self
3825 }
3826
3827 pub async fn send(self) -> Result<crate::model::GenerateStatelessSuggestionResponse> {
3829 (*self.0.stub)
3830 .generate_stateless_suggestion(self.0.request, self.0.options)
3831 .await
3832 .map(crate::Response::into_body)
3833 }
3834
3835 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3839 self.0.request.parent = v.into();
3840 self
3841 }
3842
3843 pub fn set_context_references<T, K, V>(mut self, v: T) -> Self
3845 where
3846 T: std::iter::IntoIterator<Item = (K, V)>,
3847 K: std::convert::Into<std::string::String>,
3848 V: std::convert::Into<crate::model::conversation::ContextReference>,
3849 {
3850 self.0.request.context_references =
3851 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3852 self
3853 }
3854
3855 pub fn set_conversation_context<T>(mut self, v: T) -> Self
3857 where
3858 T: std::convert::Into<crate::model::ConversationContext>,
3859 {
3860 self.0.request.conversation_context = std::option::Option::Some(v.into());
3861 self
3862 }
3863
3864 pub fn set_or_clear_conversation_context<T>(mut self, v: std::option::Option<T>) -> Self
3866 where
3867 T: std::convert::Into<crate::model::ConversationContext>,
3868 {
3869 self.0.request.conversation_context = v.map(|x| x.into());
3870 self
3871 }
3872
3873 pub fn set_trigger_events<T, V>(mut self, v: T) -> Self
3875 where
3876 T: std::iter::IntoIterator<Item = V>,
3877 V: std::convert::Into<crate::model::TriggerEvent>,
3878 {
3879 use std::iter::Iterator;
3880 self.0.request.trigger_events = v.into_iter().map(|i| i.into()).collect();
3881 self
3882 }
3883
3884 pub fn set_security_settings<T: Into<std::string::String>>(mut self, v: T) -> Self {
3886 self.0.request.security_settings = v.into();
3887 self
3888 }
3889
3890 pub fn set_generator_resource<
3895 T: Into<Option<crate::model::generate_stateless_suggestion_request::GeneratorResource>>,
3896 >(
3897 mut self,
3898 v: T,
3899 ) -> Self {
3900 self.0.request.generator_resource = v.into();
3901 self
3902 }
3903
3904 pub fn set_generator<T: std::convert::Into<std::boxed::Box<crate::model::Generator>>>(
3910 mut self,
3911 v: T,
3912 ) -> Self {
3913 self.0.request = self.0.request.set_generator(v);
3914 self
3915 }
3916
3917 pub fn set_generator_name<T: std::convert::Into<std::string::String>>(
3923 mut self,
3924 v: T,
3925 ) -> Self {
3926 self.0.request = self.0.request.set_generator_name(v);
3927 self
3928 }
3929 }
3930
3931 #[doc(hidden)]
3932 impl crate::RequestBuilder for GenerateStatelessSuggestion {
3933 fn request_options(&mut self) -> &mut crate::RequestOptions {
3934 &mut self.0.options
3935 }
3936 }
3937
3938 #[derive(Clone, Debug)]
3955 pub struct SearchKnowledge(RequestBuilder<crate::model::SearchKnowledgeRequest>);
3956
3957 impl SearchKnowledge {
3958 pub(crate) fn new(
3959 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3960 ) -> Self {
3961 Self(RequestBuilder::new(stub))
3962 }
3963
3964 pub fn with_request<V: Into<crate::model::SearchKnowledgeRequest>>(mut self, v: V) -> Self {
3966 self.0.request = v.into();
3967 self
3968 }
3969
3970 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3972 self.0.options = v.into();
3973 self
3974 }
3975
3976 pub async fn send(self) -> Result<crate::model::SearchKnowledgeResponse> {
3978 (*self.0.stub)
3979 .search_knowledge(self.0.request, self.0.options)
3980 .await
3981 .map(crate::Response::into_body)
3982 }
3983
3984 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3988 self.0.request.parent = v.into();
3989 self
3990 }
3991
3992 pub fn set_query<T>(mut self, v: T) -> Self
3996 where
3997 T: std::convert::Into<crate::model::TextInput>,
3998 {
3999 self.0.request.query = std::option::Option::Some(v.into());
4000 self
4001 }
4002
4003 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
4007 where
4008 T: std::convert::Into<crate::model::TextInput>,
4009 {
4010 self.0.request.query = v.map(|x| x.into());
4011 self
4012 }
4013
4014 pub fn set_conversation_profile<T: Into<std::string::String>>(mut self, v: T) -> Self {
4018 self.0.request.conversation_profile = v.into();
4019 self
4020 }
4021
4022 pub fn set_session_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4026 self.0.request.session_id = v.into();
4027 self
4028 }
4029
4030 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
4032 self.0.request.conversation = v.into();
4033 self
4034 }
4035
4036 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
4038 self.0.request.latest_message = v.into();
4039 self
4040 }
4041
4042 pub fn set_query_source<T: Into<crate::model::search_knowledge_request::QuerySource>>(
4044 mut self,
4045 v: T,
4046 ) -> Self {
4047 self.0.request.query_source = v.into();
4048 self
4049 }
4050
4051 pub fn set_end_user_metadata<T>(mut self, v: T) -> Self
4053 where
4054 T: std::convert::Into<wkt::Struct>,
4055 {
4056 self.0.request.end_user_metadata = std::option::Option::Some(v.into());
4057 self
4058 }
4059
4060 pub fn set_or_clear_end_user_metadata<T>(mut self, v: std::option::Option<T>) -> Self
4062 where
4063 T: std::convert::Into<wkt::Struct>,
4064 {
4065 self.0.request.end_user_metadata = v.map(|x| x.into());
4066 self
4067 }
4068
4069 pub fn set_search_config<T>(mut self, v: T) -> Self
4071 where
4072 T: std::convert::Into<crate::model::search_knowledge_request::SearchConfig>,
4073 {
4074 self.0.request.search_config = std::option::Option::Some(v.into());
4075 self
4076 }
4077
4078 pub fn set_or_clear_search_config<T>(mut self, v: std::option::Option<T>) -> Self
4080 where
4081 T: std::convert::Into<crate::model::search_knowledge_request::SearchConfig>,
4082 {
4083 self.0.request.search_config = v.map(|x| x.into());
4084 self
4085 }
4086
4087 pub fn set_exact_search<T: Into<bool>>(mut self, v: T) -> Self {
4089 self.0.request.exact_search = v.into();
4090 self
4091 }
4092 }
4093
4094 #[doc(hidden)]
4095 impl crate::RequestBuilder for SearchKnowledge {
4096 fn request_options(&mut self) -> &mut crate::RequestOptions {
4097 &mut self.0.options
4098 }
4099 }
4100
4101 #[derive(Clone, Debug)]
4118 pub struct GenerateSuggestions(RequestBuilder<crate::model::GenerateSuggestionsRequest>);
4119
4120 impl GenerateSuggestions {
4121 pub(crate) fn new(
4122 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4123 ) -> Self {
4124 Self(RequestBuilder::new(stub))
4125 }
4126
4127 pub fn with_request<V: Into<crate::model::GenerateSuggestionsRequest>>(
4129 mut self,
4130 v: V,
4131 ) -> Self {
4132 self.0.request = v.into();
4133 self
4134 }
4135
4136 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4138 self.0.options = v.into();
4139 self
4140 }
4141
4142 pub async fn send(self) -> Result<crate::model::GenerateSuggestionsResponse> {
4144 (*self.0.stub)
4145 .generate_suggestions(self.0.request, self.0.options)
4146 .await
4147 .map(crate::Response::into_body)
4148 }
4149
4150 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
4154 self.0.request.conversation = v.into();
4155 self
4156 }
4157
4158 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
4160 self.0.request.latest_message = v.into();
4161 self
4162 }
4163
4164 pub fn set_trigger_events<T, V>(mut self, v: T) -> Self
4166 where
4167 T: std::iter::IntoIterator<Item = V>,
4168 V: std::convert::Into<crate::model::TriggerEvent>,
4169 {
4170 use std::iter::Iterator;
4171 self.0.request.trigger_events = v.into_iter().map(|i| i.into()).collect();
4172 self
4173 }
4174 }
4175
4176 #[doc(hidden)]
4177 impl crate::RequestBuilder for GenerateSuggestions {
4178 fn request_options(&mut self) -> &mut crate::RequestOptions {
4179 &mut self.0.options
4180 }
4181 }
4182
4183 #[derive(Clone, Debug)]
4204 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
4205
4206 impl ListLocations {
4207 pub(crate) fn new(
4208 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4209 ) -> Self {
4210 Self(RequestBuilder::new(stub))
4211 }
4212
4213 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
4215 mut self,
4216 v: V,
4217 ) -> Self {
4218 self.0.request = v.into();
4219 self
4220 }
4221
4222 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4224 self.0.options = v.into();
4225 self
4226 }
4227
4228 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
4230 (*self.0.stub)
4231 .list_locations(self.0.request, self.0.options)
4232 .await
4233 .map(crate::Response::into_body)
4234 }
4235
4236 pub fn by_page(
4238 self,
4239 ) -> impl google_cloud_gax::paginator::Paginator<
4240 google_cloud_location::model::ListLocationsResponse,
4241 crate::Error,
4242 > {
4243 use std::clone::Clone;
4244 let token = self.0.request.page_token.clone();
4245 let execute = move |token: String| {
4246 let mut builder = self.clone();
4247 builder.0.request = builder.0.request.set_page_token(token);
4248 builder.send()
4249 };
4250 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4251 }
4252
4253 pub fn by_item(
4255 self,
4256 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4257 google_cloud_location::model::ListLocationsResponse,
4258 crate::Error,
4259 > {
4260 use google_cloud_gax::paginator::Paginator;
4261 self.by_page().items()
4262 }
4263
4264 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4266 self.0.request.name = v.into();
4267 self
4268 }
4269
4270 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4272 self.0.request.filter = v.into();
4273 self
4274 }
4275
4276 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4278 self.0.request.page_size = v.into();
4279 self
4280 }
4281
4282 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4284 self.0.request.page_token = v.into();
4285 self
4286 }
4287 }
4288
4289 #[doc(hidden)]
4290 impl crate::RequestBuilder for ListLocations {
4291 fn request_options(&mut self) -> &mut crate::RequestOptions {
4292 &mut self.0.options
4293 }
4294 }
4295
4296 #[derive(Clone, Debug)]
4313 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
4314
4315 impl GetLocation {
4316 pub(crate) fn new(
4317 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4318 ) -> Self {
4319 Self(RequestBuilder::new(stub))
4320 }
4321
4322 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
4324 mut self,
4325 v: V,
4326 ) -> Self {
4327 self.0.request = v.into();
4328 self
4329 }
4330
4331 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4333 self.0.options = v.into();
4334 self
4335 }
4336
4337 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
4339 (*self.0.stub)
4340 .get_location(self.0.request, self.0.options)
4341 .await
4342 .map(crate::Response::into_body)
4343 }
4344
4345 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4347 self.0.request.name = v.into();
4348 self
4349 }
4350 }
4351
4352 #[doc(hidden)]
4353 impl crate::RequestBuilder for GetLocation {
4354 fn request_options(&mut self) -> &mut crate::RequestOptions {
4355 &mut self.0.options
4356 }
4357 }
4358
4359 #[derive(Clone, Debug)]
4380 pub struct ListOperations(
4381 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4382 );
4383
4384 impl ListOperations {
4385 pub(crate) fn new(
4386 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4387 ) -> Self {
4388 Self(RequestBuilder::new(stub))
4389 }
4390
4391 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4393 mut self,
4394 v: V,
4395 ) -> Self {
4396 self.0.request = v.into();
4397 self
4398 }
4399
4400 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4402 self.0.options = v.into();
4403 self
4404 }
4405
4406 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4408 (*self.0.stub)
4409 .list_operations(self.0.request, self.0.options)
4410 .await
4411 .map(crate::Response::into_body)
4412 }
4413
4414 pub fn by_page(
4416 self,
4417 ) -> impl google_cloud_gax::paginator::Paginator<
4418 google_cloud_longrunning::model::ListOperationsResponse,
4419 crate::Error,
4420 > {
4421 use std::clone::Clone;
4422 let token = self.0.request.page_token.clone();
4423 let execute = move |token: String| {
4424 let mut builder = self.clone();
4425 builder.0.request = builder.0.request.set_page_token(token);
4426 builder.send()
4427 };
4428 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4429 }
4430
4431 pub fn by_item(
4433 self,
4434 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4435 google_cloud_longrunning::model::ListOperationsResponse,
4436 crate::Error,
4437 > {
4438 use google_cloud_gax::paginator::Paginator;
4439 self.by_page().items()
4440 }
4441
4442 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4444 self.0.request.name = v.into();
4445 self
4446 }
4447
4448 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4450 self.0.request.filter = v.into();
4451 self
4452 }
4453
4454 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4456 self.0.request.page_size = v.into();
4457 self
4458 }
4459
4460 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4462 self.0.request.page_token = v.into();
4463 self
4464 }
4465
4466 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4468 self.0.request.return_partial_success = v.into();
4469 self
4470 }
4471 }
4472
4473 #[doc(hidden)]
4474 impl crate::RequestBuilder for ListOperations {
4475 fn request_options(&mut self) -> &mut crate::RequestOptions {
4476 &mut self.0.options
4477 }
4478 }
4479
4480 #[derive(Clone, Debug)]
4497 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4498
4499 impl GetOperation {
4500 pub(crate) fn new(
4501 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4502 ) -> Self {
4503 Self(RequestBuilder::new(stub))
4504 }
4505
4506 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4508 mut self,
4509 v: V,
4510 ) -> Self {
4511 self.0.request = v.into();
4512 self
4513 }
4514
4515 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4517 self.0.options = v.into();
4518 self
4519 }
4520
4521 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4523 (*self.0.stub)
4524 .get_operation(self.0.request, self.0.options)
4525 .await
4526 .map(crate::Response::into_body)
4527 }
4528
4529 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4531 self.0.request.name = v.into();
4532 self
4533 }
4534 }
4535
4536 #[doc(hidden)]
4537 impl crate::RequestBuilder for GetOperation {
4538 fn request_options(&mut self) -> &mut crate::RequestOptions {
4539 &mut self.0.options
4540 }
4541 }
4542
4543 #[derive(Clone, Debug)]
4560 pub struct CancelOperation(
4561 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
4562 );
4563
4564 impl CancelOperation {
4565 pub(crate) fn new(
4566 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4567 ) -> Self {
4568 Self(RequestBuilder::new(stub))
4569 }
4570
4571 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
4573 mut self,
4574 v: V,
4575 ) -> Self {
4576 self.0.request = v.into();
4577 self
4578 }
4579
4580 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4582 self.0.options = v.into();
4583 self
4584 }
4585
4586 pub async fn send(self) -> Result<()> {
4588 (*self.0.stub)
4589 .cancel_operation(self.0.request, self.0.options)
4590 .await
4591 .map(crate::Response::into_body)
4592 }
4593
4594 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4596 self.0.request.name = v.into();
4597 self
4598 }
4599 }
4600
4601 #[doc(hidden)]
4602 impl crate::RequestBuilder for CancelOperation {
4603 fn request_options(&mut self) -> &mut crate::RequestOptions {
4604 &mut self.0.options
4605 }
4606 }
4607}
4608
4609#[cfg(feature = "conversation-datasets")]
4610#[cfg_attr(docsrs, doc(cfg(feature = "conversation-datasets")))]
4611pub mod conversation_datasets {
4612 use crate::Result;
4613
4614 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4628
4629 pub(crate) mod client {
4630 use super::super::super::client::ConversationDatasets;
4631 pub struct Factory;
4632 impl crate::ClientFactory for Factory {
4633 type Client = ConversationDatasets;
4634 type Credentials = gaxi::options::Credentials;
4635 async fn build(
4636 self,
4637 config: gaxi::options::ClientConfig,
4638 ) -> crate::ClientBuilderResult<Self::Client> {
4639 Self::Client::new(config).await
4640 }
4641 }
4642 }
4643
4644 #[derive(Clone, Debug)]
4646 pub(crate) struct RequestBuilder<R: std::default::Default> {
4647 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4648 request: R,
4649 options: crate::RequestOptions,
4650 }
4651
4652 impl<R> RequestBuilder<R>
4653 where
4654 R: std::default::Default,
4655 {
4656 pub(crate) fn new(
4657 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4658 ) -> Self {
4659 Self {
4660 stub,
4661 request: R::default(),
4662 options: crate::RequestOptions::default(),
4663 }
4664 }
4665 }
4666
4667 #[derive(Clone, Debug)]
4685 pub struct CreateConversationDataset(
4686 RequestBuilder<crate::model::CreateConversationDatasetRequest>,
4687 );
4688
4689 impl CreateConversationDataset {
4690 pub(crate) fn new(
4691 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4692 ) -> Self {
4693 Self(RequestBuilder::new(stub))
4694 }
4695
4696 pub fn with_request<V: Into<crate::model::CreateConversationDatasetRequest>>(
4698 mut self,
4699 v: V,
4700 ) -> Self {
4701 self.0.request = v.into();
4702 self
4703 }
4704
4705 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4707 self.0.options = v.into();
4708 self
4709 }
4710
4711 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4718 (*self.0.stub)
4719 .create_conversation_dataset(self.0.request, self.0.options)
4720 .await
4721 .map(crate::Response::into_body)
4722 }
4723
4724 pub fn poller(
4726 self,
4727 ) -> impl google_cloud_lro::Poller<
4728 crate::model::ConversationDataset,
4729 crate::model::CreateConversationDatasetOperationMetadata,
4730 > {
4731 type Operation = google_cloud_lro::internal::Operation<
4732 crate::model::ConversationDataset,
4733 crate::model::CreateConversationDatasetOperationMetadata,
4734 >;
4735 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4736 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4737
4738 let stub = self.0.stub.clone();
4739 let mut options = self.0.options.clone();
4740 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4741 let query = move |name| {
4742 let stub = stub.clone();
4743 let options = options.clone();
4744 async {
4745 let op = GetOperation::new(stub)
4746 .set_name(name)
4747 .with_options(options)
4748 .send()
4749 .await?;
4750 Ok(Operation::new(op))
4751 }
4752 };
4753
4754 let start = move || async {
4755 let op = self.send().await?;
4756 Ok(Operation::new(op))
4757 };
4758
4759 google_cloud_lro::internal::new_poller(
4760 polling_error_policy,
4761 polling_backoff_policy,
4762 start,
4763 query,
4764 )
4765 }
4766
4767 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4771 self.0.request.parent = v.into();
4772 self
4773 }
4774
4775 pub fn set_conversation_dataset<T>(mut self, v: T) -> Self
4779 where
4780 T: std::convert::Into<crate::model::ConversationDataset>,
4781 {
4782 self.0.request.conversation_dataset = std::option::Option::Some(v.into());
4783 self
4784 }
4785
4786 pub fn set_or_clear_conversation_dataset<T>(mut self, v: std::option::Option<T>) -> Self
4790 where
4791 T: std::convert::Into<crate::model::ConversationDataset>,
4792 {
4793 self.0.request.conversation_dataset = v.map(|x| x.into());
4794 self
4795 }
4796 }
4797
4798 #[doc(hidden)]
4799 impl crate::RequestBuilder for CreateConversationDataset {
4800 fn request_options(&mut self) -> &mut crate::RequestOptions {
4801 &mut self.0.options
4802 }
4803 }
4804
4805 #[derive(Clone, Debug)]
4822 pub struct GetConversationDataset(RequestBuilder<crate::model::GetConversationDatasetRequest>);
4823
4824 impl GetConversationDataset {
4825 pub(crate) fn new(
4826 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4827 ) -> Self {
4828 Self(RequestBuilder::new(stub))
4829 }
4830
4831 pub fn with_request<V: Into<crate::model::GetConversationDatasetRequest>>(
4833 mut self,
4834 v: V,
4835 ) -> Self {
4836 self.0.request = v.into();
4837 self
4838 }
4839
4840 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4842 self.0.options = v.into();
4843 self
4844 }
4845
4846 pub async fn send(self) -> Result<crate::model::ConversationDataset> {
4848 (*self.0.stub)
4849 .get_conversation_dataset(self.0.request, self.0.options)
4850 .await
4851 .map(crate::Response::into_body)
4852 }
4853
4854 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4858 self.0.request.name = v.into();
4859 self
4860 }
4861 }
4862
4863 #[doc(hidden)]
4864 impl crate::RequestBuilder for GetConversationDataset {
4865 fn request_options(&mut self) -> &mut crate::RequestOptions {
4866 &mut self.0.options
4867 }
4868 }
4869
4870 #[derive(Clone, Debug)]
4891 pub struct ListConversationDatasets(
4892 RequestBuilder<crate::model::ListConversationDatasetsRequest>,
4893 );
4894
4895 impl ListConversationDatasets {
4896 pub(crate) fn new(
4897 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4898 ) -> Self {
4899 Self(RequestBuilder::new(stub))
4900 }
4901
4902 pub fn with_request<V: Into<crate::model::ListConversationDatasetsRequest>>(
4904 mut self,
4905 v: V,
4906 ) -> Self {
4907 self.0.request = v.into();
4908 self
4909 }
4910
4911 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4913 self.0.options = v.into();
4914 self
4915 }
4916
4917 pub async fn send(self) -> Result<crate::model::ListConversationDatasetsResponse> {
4919 (*self.0.stub)
4920 .list_conversation_datasets(self.0.request, self.0.options)
4921 .await
4922 .map(crate::Response::into_body)
4923 }
4924
4925 pub fn by_page(
4927 self,
4928 ) -> impl google_cloud_gax::paginator::Paginator<
4929 crate::model::ListConversationDatasetsResponse,
4930 crate::Error,
4931 > {
4932 use std::clone::Clone;
4933 let token = self.0.request.page_token.clone();
4934 let execute = move |token: String| {
4935 let mut builder = self.clone();
4936 builder.0.request = builder.0.request.set_page_token(token);
4937 builder.send()
4938 };
4939 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4940 }
4941
4942 pub fn by_item(
4944 self,
4945 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4946 crate::model::ListConversationDatasetsResponse,
4947 crate::Error,
4948 > {
4949 use google_cloud_gax::paginator::Paginator;
4950 self.by_page().items()
4951 }
4952
4953 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4957 self.0.request.parent = v.into();
4958 self
4959 }
4960
4961 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4963 self.0.request.page_size = v.into();
4964 self
4965 }
4966
4967 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4969 self.0.request.page_token = v.into();
4970 self
4971 }
4972 }
4973
4974 #[doc(hidden)]
4975 impl crate::RequestBuilder for ListConversationDatasets {
4976 fn request_options(&mut self) -> &mut crate::RequestOptions {
4977 &mut self.0.options
4978 }
4979 }
4980
4981 #[derive(Clone, Debug)]
4999 pub struct DeleteConversationDataset(
5000 RequestBuilder<crate::model::DeleteConversationDatasetRequest>,
5001 );
5002
5003 impl DeleteConversationDataset {
5004 pub(crate) fn new(
5005 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5006 ) -> Self {
5007 Self(RequestBuilder::new(stub))
5008 }
5009
5010 pub fn with_request<V: Into<crate::model::DeleteConversationDatasetRequest>>(
5012 mut self,
5013 v: V,
5014 ) -> Self {
5015 self.0.request = v.into();
5016 self
5017 }
5018
5019 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5021 self.0.options = v.into();
5022 self
5023 }
5024
5025 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5032 (*self.0.stub)
5033 .delete_conversation_dataset(self.0.request, self.0.options)
5034 .await
5035 .map(crate::Response::into_body)
5036 }
5037
5038 pub fn poller(
5040 self,
5041 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteConversationDatasetOperationMetadata>
5042 {
5043 type Operation = google_cloud_lro::internal::Operation<
5044 wkt::Empty,
5045 crate::model::DeleteConversationDatasetOperationMetadata,
5046 >;
5047 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5048 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5049
5050 let stub = self.0.stub.clone();
5051 let mut options = self.0.options.clone();
5052 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5053 let query = move |name| {
5054 let stub = stub.clone();
5055 let options = options.clone();
5056 async {
5057 let op = GetOperation::new(stub)
5058 .set_name(name)
5059 .with_options(options)
5060 .send()
5061 .await?;
5062 Ok(Operation::new(op))
5063 }
5064 };
5065
5066 let start = move || async {
5067 let op = self.send().await?;
5068 Ok(Operation::new(op))
5069 };
5070
5071 google_cloud_lro::internal::new_unit_response_poller(
5072 polling_error_policy,
5073 polling_backoff_policy,
5074 start,
5075 query,
5076 )
5077 }
5078
5079 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5083 self.0.request.name = v.into();
5084 self
5085 }
5086 }
5087
5088 #[doc(hidden)]
5089 impl crate::RequestBuilder for DeleteConversationDataset {
5090 fn request_options(&mut self) -> &mut crate::RequestOptions {
5091 &mut self.0.options
5092 }
5093 }
5094
5095 #[derive(Clone, Debug)]
5113 pub struct ImportConversationData(RequestBuilder<crate::model::ImportConversationDataRequest>);
5114
5115 impl ImportConversationData {
5116 pub(crate) fn new(
5117 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5118 ) -> Self {
5119 Self(RequestBuilder::new(stub))
5120 }
5121
5122 pub fn with_request<V: Into<crate::model::ImportConversationDataRequest>>(
5124 mut self,
5125 v: V,
5126 ) -> Self {
5127 self.0.request = v.into();
5128 self
5129 }
5130
5131 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5133 self.0.options = v.into();
5134 self
5135 }
5136
5137 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5144 (*self.0.stub)
5145 .import_conversation_data(self.0.request, self.0.options)
5146 .await
5147 .map(crate::Response::into_body)
5148 }
5149
5150 pub fn poller(
5152 self,
5153 ) -> impl google_cloud_lro::Poller<
5154 crate::model::ImportConversationDataOperationResponse,
5155 crate::model::ImportConversationDataOperationMetadata,
5156 > {
5157 type Operation = google_cloud_lro::internal::Operation<
5158 crate::model::ImportConversationDataOperationResponse,
5159 crate::model::ImportConversationDataOperationMetadata,
5160 >;
5161 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5162 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5163
5164 let stub = self.0.stub.clone();
5165 let mut options = self.0.options.clone();
5166 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5167 let query = move |name| {
5168 let stub = stub.clone();
5169 let options = options.clone();
5170 async {
5171 let op = GetOperation::new(stub)
5172 .set_name(name)
5173 .with_options(options)
5174 .send()
5175 .await?;
5176 Ok(Operation::new(op))
5177 }
5178 };
5179
5180 let start = move || async {
5181 let op = self.send().await?;
5182 Ok(Operation::new(op))
5183 };
5184
5185 google_cloud_lro::internal::new_poller(
5186 polling_error_policy,
5187 polling_backoff_policy,
5188 start,
5189 query,
5190 )
5191 }
5192
5193 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5197 self.0.request.name = v.into();
5198 self
5199 }
5200
5201 pub fn set_input_config<T>(mut self, v: T) -> Self
5205 where
5206 T: std::convert::Into<crate::model::InputConfig>,
5207 {
5208 self.0.request.input_config = std::option::Option::Some(v.into());
5209 self
5210 }
5211
5212 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
5216 where
5217 T: std::convert::Into<crate::model::InputConfig>,
5218 {
5219 self.0.request.input_config = v.map(|x| x.into());
5220 self
5221 }
5222 }
5223
5224 #[doc(hidden)]
5225 impl crate::RequestBuilder for ImportConversationData {
5226 fn request_options(&mut self) -> &mut crate::RequestOptions {
5227 &mut self.0.options
5228 }
5229 }
5230
5231 #[derive(Clone, Debug)]
5252 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
5253
5254 impl ListLocations {
5255 pub(crate) fn new(
5256 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5257 ) -> Self {
5258 Self(RequestBuilder::new(stub))
5259 }
5260
5261 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
5263 mut self,
5264 v: V,
5265 ) -> Self {
5266 self.0.request = v.into();
5267 self
5268 }
5269
5270 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5272 self.0.options = v.into();
5273 self
5274 }
5275
5276 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
5278 (*self.0.stub)
5279 .list_locations(self.0.request, self.0.options)
5280 .await
5281 .map(crate::Response::into_body)
5282 }
5283
5284 pub fn by_page(
5286 self,
5287 ) -> impl google_cloud_gax::paginator::Paginator<
5288 google_cloud_location::model::ListLocationsResponse,
5289 crate::Error,
5290 > {
5291 use std::clone::Clone;
5292 let token = self.0.request.page_token.clone();
5293 let execute = move |token: String| {
5294 let mut builder = self.clone();
5295 builder.0.request = builder.0.request.set_page_token(token);
5296 builder.send()
5297 };
5298 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5299 }
5300
5301 pub fn by_item(
5303 self,
5304 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5305 google_cloud_location::model::ListLocationsResponse,
5306 crate::Error,
5307 > {
5308 use google_cloud_gax::paginator::Paginator;
5309 self.by_page().items()
5310 }
5311
5312 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5314 self.0.request.name = v.into();
5315 self
5316 }
5317
5318 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5320 self.0.request.filter = v.into();
5321 self
5322 }
5323
5324 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5326 self.0.request.page_size = v.into();
5327 self
5328 }
5329
5330 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5332 self.0.request.page_token = v.into();
5333 self
5334 }
5335 }
5336
5337 #[doc(hidden)]
5338 impl crate::RequestBuilder for ListLocations {
5339 fn request_options(&mut self) -> &mut crate::RequestOptions {
5340 &mut self.0.options
5341 }
5342 }
5343
5344 #[derive(Clone, Debug)]
5361 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
5362
5363 impl GetLocation {
5364 pub(crate) fn new(
5365 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5366 ) -> Self {
5367 Self(RequestBuilder::new(stub))
5368 }
5369
5370 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
5372 mut self,
5373 v: V,
5374 ) -> Self {
5375 self.0.request = v.into();
5376 self
5377 }
5378
5379 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5381 self.0.options = v.into();
5382 self
5383 }
5384
5385 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
5387 (*self.0.stub)
5388 .get_location(self.0.request, self.0.options)
5389 .await
5390 .map(crate::Response::into_body)
5391 }
5392
5393 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5395 self.0.request.name = v.into();
5396 self
5397 }
5398 }
5399
5400 #[doc(hidden)]
5401 impl crate::RequestBuilder for GetLocation {
5402 fn request_options(&mut self) -> &mut crate::RequestOptions {
5403 &mut self.0.options
5404 }
5405 }
5406
5407 #[derive(Clone, Debug)]
5428 pub struct ListOperations(
5429 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5430 );
5431
5432 impl ListOperations {
5433 pub(crate) fn new(
5434 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5435 ) -> Self {
5436 Self(RequestBuilder::new(stub))
5437 }
5438
5439 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5441 mut self,
5442 v: V,
5443 ) -> Self {
5444 self.0.request = v.into();
5445 self
5446 }
5447
5448 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5450 self.0.options = v.into();
5451 self
5452 }
5453
5454 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5456 (*self.0.stub)
5457 .list_operations(self.0.request, self.0.options)
5458 .await
5459 .map(crate::Response::into_body)
5460 }
5461
5462 pub fn by_page(
5464 self,
5465 ) -> impl google_cloud_gax::paginator::Paginator<
5466 google_cloud_longrunning::model::ListOperationsResponse,
5467 crate::Error,
5468 > {
5469 use std::clone::Clone;
5470 let token = self.0.request.page_token.clone();
5471 let execute = move |token: String| {
5472 let mut builder = self.clone();
5473 builder.0.request = builder.0.request.set_page_token(token);
5474 builder.send()
5475 };
5476 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5477 }
5478
5479 pub fn by_item(
5481 self,
5482 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5483 google_cloud_longrunning::model::ListOperationsResponse,
5484 crate::Error,
5485 > {
5486 use google_cloud_gax::paginator::Paginator;
5487 self.by_page().items()
5488 }
5489
5490 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5492 self.0.request.name = v.into();
5493 self
5494 }
5495
5496 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5498 self.0.request.filter = v.into();
5499 self
5500 }
5501
5502 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5504 self.0.request.page_size = v.into();
5505 self
5506 }
5507
5508 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5510 self.0.request.page_token = v.into();
5511 self
5512 }
5513
5514 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5516 self.0.request.return_partial_success = v.into();
5517 self
5518 }
5519 }
5520
5521 #[doc(hidden)]
5522 impl crate::RequestBuilder for ListOperations {
5523 fn request_options(&mut self) -> &mut crate::RequestOptions {
5524 &mut self.0.options
5525 }
5526 }
5527
5528 #[derive(Clone, Debug)]
5545 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5546
5547 impl GetOperation {
5548 pub(crate) fn new(
5549 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5550 ) -> Self {
5551 Self(RequestBuilder::new(stub))
5552 }
5553
5554 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5556 mut self,
5557 v: V,
5558 ) -> Self {
5559 self.0.request = v.into();
5560 self
5561 }
5562
5563 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5565 self.0.options = v.into();
5566 self
5567 }
5568
5569 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5571 (*self.0.stub)
5572 .get_operation(self.0.request, self.0.options)
5573 .await
5574 .map(crate::Response::into_body)
5575 }
5576
5577 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5579 self.0.request.name = v.into();
5580 self
5581 }
5582 }
5583
5584 #[doc(hidden)]
5585 impl crate::RequestBuilder for GetOperation {
5586 fn request_options(&mut self) -> &mut crate::RequestOptions {
5587 &mut self.0.options
5588 }
5589 }
5590
5591 #[derive(Clone, Debug)]
5608 pub struct CancelOperation(
5609 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
5610 );
5611
5612 impl CancelOperation {
5613 pub(crate) fn new(
5614 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5615 ) -> Self {
5616 Self(RequestBuilder::new(stub))
5617 }
5618
5619 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
5621 mut self,
5622 v: V,
5623 ) -> Self {
5624 self.0.request = v.into();
5625 self
5626 }
5627
5628 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5630 self.0.options = v.into();
5631 self
5632 }
5633
5634 pub async fn send(self) -> Result<()> {
5636 (*self.0.stub)
5637 .cancel_operation(self.0.request, self.0.options)
5638 .await
5639 .map(crate::Response::into_body)
5640 }
5641
5642 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5644 self.0.request.name = v.into();
5645 self
5646 }
5647 }
5648
5649 #[doc(hidden)]
5650 impl crate::RequestBuilder for CancelOperation {
5651 fn request_options(&mut self) -> &mut crate::RequestOptions {
5652 &mut self.0.options
5653 }
5654 }
5655}
5656
5657#[cfg(feature = "conversation-models")]
5658#[cfg_attr(docsrs, doc(cfg(feature = "conversation-models")))]
5659pub mod conversation_models {
5660 use crate::Result;
5661
5662 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5676
5677 pub(crate) mod client {
5678 use super::super::super::client::ConversationModels;
5679 pub struct Factory;
5680 impl crate::ClientFactory for Factory {
5681 type Client = ConversationModels;
5682 type Credentials = gaxi::options::Credentials;
5683 async fn build(
5684 self,
5685 config: gaxi::options::ClientConfig,
5686 ) -> crate::ClientBuilderResult<Self::Client> {
5687 Self::Client::new(config).await
5688 }
5689 }
5690 }
5691
5692 #[derive(Clone, Debug)]
5694 pub(crate) struct RequestBuilder<R: std::default::Default> {
5695 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5696 request: R,
5697 options: crate::RequestOptions,
5698 }
5699
5700 impl<R> RequestBuilder<R>
5701 where
5702 R: std::default::Default,
5703 {
5704 pub(crate) fn new(
5705 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5706 ) -> Self {
5707 Self {
5708 stub,
5709 request: R::default(),
5710 options: crate::RequestOptions::default(),
5711 }
5712 }
5713 }
5714
5715 #[derive(Clone, Debug)]
5733 pub struct CreateConversationModel(
5734 RequestBuilder<crate::model::CreateConversationModelRequest>,
5735 );
5736
5737 impl CreateConversationModel {
5738 pub(crate) fn new(
5739 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5740 ) -> Self {
5741 Self(RequestBuilder::new(stub))
5742 }
5743
5744 pub fn with_request<V: Into<crate::model::CreateConversationModelRequest>>(
5746 mut self,
5747 v: V,
5748 ) -> Self {
5749 self.0.request = v.into();
5750 self
5751 }
5752
5753 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5755 self.0.options = v.into();
5756 self
5757 }
5758
5759 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5766 (*self.0.stub)
5767 .create_conversation_model(self.0.request, self.0.options)
5768 .await
5769 .map(crate::Response::into_body)
5770 }
5771
5772 pub fn poller(
5774 self,
5775 ) -> impl google_cloud_lro::Poller<
5776 crate::model::ConversationModel,
5777 crate::model::CreateConversationModelOperationMetadata,
5778 > {
5779 type Operation = google_cloud_lro::internal::Operation<
5780 crate::model::ConversationModel,
5781 crate::model::CreateConversationModelOperationMetadata,
5782 >;
5783 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5784 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5785
5786 let stub = self.0.stub.clone();
5787 let mut options = self.0.options.clone();
5788 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5789 let query = move |name| {
5790 let stub = stub.clone();
5791 let options = options.clone();
5792 async {
5793 let op = GetOperation::new(stub)
5794 .set_name(name)
5795 .with_options(options)
5796 .send()
5797 .await?;
5798 Ok(Operation::new(op))
5799 }
5800 };
5801
5802 let start = move || async {
5803 let op = self.send().await?;
5804 Ok(Operation::new(op))
5805 };
5806
5807 google_cloud_lro::internal::new_poller(
5808 polling_error_policy,
5809 polling_backoff_policy,
5810 start,
5811 query,
5812 )
5813 }
5814
5815 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5817 self.0.request.parent = v.into();
5818 self
5819 }
5820
5821 pub fn set_conversation_model<T>(mut self, v: T) -> Self
5825 where
5826 T: std::convert::Into<crate::model::ConversationModel>,
5827 {
5828 self.0.request.conversation_model = std::option::Option::Some(v.into());
5829 self
5830 }
5831
5832 pub fn set_or_clear_conversation_model<T>(mut self, v: std::option::Option<T>) -> Self
5836 where
5837 T: std::convert::Into<crate::model::ConversationModel>,
5838 {
5839 self.0.request.conversation_model = v.map(|x| x.into());
5840 self
5841 }
5842 }
5843
5844 #[doc(hidden)]
5845 impl crate::RequestBuilder for CreateConversationModel {
5846 fn request_options(&mut self) -> &mut crate::RequestOptions {
5847 &mut self.0.options
5848 }
5849 }
5850
5851 #[derive(Clone, Debug)]
5868 pub struct GetConversationModel(RequestBuilder<crate::model::GetConversationModelRequest>);
5869
5870 impl GetConversationModel {
5871 pub(crate) fn new(
5872 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5873 ) -> Self {
5874 Self(RequestBuilder::new(stub))
5875 }
5876
5877 pub fn with_request<V: Into<crate::model::GetConversationModelRequest>>(
5879 mut self,
5880 v: V,
5881 ) -> Self {
5882 self.0.request = v.into();
5883 self
5884 }
5885
5886 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5888 self.0.options = v.into();
5889 self
5890 }
5891
5892 pub async fn send(self) -> Result<crate::model::ConversationModel> {
5894 (*self.0.stub)
5895 .get_conversation_model(self.0.request, self.0.options)
5896 .await
5897 .map(crate::Response::into_body)
5898 }
5899
5900 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5904 self.0.request.name = v.into();
5905 self
5906 }
5907 }
5908
5909 #[doc(hidden)]
5910 impl crate::RequestBuilder for GetConversationModel {
5911 fn request_options(&mut self) -> &mut crate::RequestOptions {
5912 &mut self.0.options
5913 }
5914 }
5915
5916 #[derive(Clone, Debug)]
5937 pub struct ListConversationModels(RequestBuilder<crate::model::ListConversationModelsRequest>);
5938
5939 impl ListConversationModels {
5940 pub(crate) fn new(
5941 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5942 ) -> Self {
5943 Self(RequestBuilder::new(stub))
5944 }
5945
5946 pub fn with_request<V: Into<crate::model::ListConversationModelsRequest>>(
5948 mut self,
5949 v: V,
5950 ) -> Self {
5951 self.0.request = v.into();
5952 self
5953 }
5954
5955 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5957 self.0.options = v.into();
5958 self
5959 }
5960
5961 pub async fn send(self) -> Result<crate::model::ListConversationModelsResponse> {
5963 (*self.0.stub)
5964 .list_conversation_models(self.0.request, self.0.options)
5965 .await
5966 .map(crate::Response::into_body)
5967 }
5968
5969 pub fn by_page(
5971 self,
5972 ) -> impl google_cloud_gax::paginator::Paginator<
5973 crate::model::ListConversationModelsResponse,
5974 crate::Error,
5975 > {
5976 use std::clone::Clone;
5977 let token = self.0.request.page_token.clone();
5978 let execute = move |token: String| {
5979 let mut builder = self.clone();
5980 builder.0.request = builder.0.request.set_page_token(token);
5981 builder.send()
5982 };
5983 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5984 }
5985
5986 pub fn by_item(
5988 self,
5989 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5990 crate::model::ListConversationModelsResponse,
5991 crate::Error,
5992 > {
5993 use google_cloud_gax::paginator::Paginator;
5994 self.by_page().items()
5995 }
5996
5997 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6001 self.0.request.parent = v.into();
6002 self
6003 }
6004
6005 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6007 self.0.request.page_size = v.into();
6008 self
6009 }
6010
6011 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6013 self.0.request.page_token = v.into();
6014 self
6015 }
6016 }
6017
6018 #[doc(hidden)]
6019 impl crate::RequestBuilder for ListConversationModels {
6020 fn request_options(&mut self) -> &mut crate::RequestOptions {
6021 &mut self.0.options
6022 }
6023 }
6024
6025 #[derive(Clone, Debug)]
6043 pub struct DeleteConversationModel(
6044 RequestBuilder<crate::model::DeleteConversationModelRequest>,
6045 );
6046
6047 impl DeleteConversationModel {
6048 pub(crate) fn new(
6049 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6050 ) -> Self {
6051 Self(RequestBuilder::new(stub))
6052 }
6053
6054 pub fn with_request<V: Into<crate::model::DeleteConversationModelRequest>>(
6056 mut self,
6057 v: V,
6058 ) -> Self {
6059 self.0.request = v.into();
6060 self
6061 }
6062
6063 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6065 self.0.options = v.into();
6066 self
6067 }
6068
6069 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6076 (*self.0.stub)
6077 .delete_conversation_model(self.0.request, self.0.options)
6078 .await
6079 .map(crate::Response::into_body)
6080 }
6081
6082 pub fn poller(
6084 self,
6085 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteConversationModelOperationMetadata>
6086 {
6087 type Operation = google_cloud_lro::internal::Operation<
6088 wkt::Empty,
6089 crate::model::DeleteConversationModelOperationMetadata,
6090 >;
6091 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6092 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6093
6094 let stub = self.0.stub.clone();
6095 let mut options = self.0.options.clone();
6096 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6097 let query = move |name| {
6098 let stub = stub.clone();
6099 let options = options.clone();
6100 async {
6101 let op = GetOperation::new(stub)
6102 .set_name(name)
6103 .with_options(options)
6104 .send()
6105 .await?;
6106 Ok(Operation::new(op))
6107 }
6108 };
6109
6110 let start = move || async {
6111 let op = self.send().await?;
6112 Ok(Operation::new(op))
6113 };
6114
6115 google_cloud_lro::internal::new_unit_response_poller(
6116 polling_error_policy,
6117 polling_backoff_policy,
6118 start,
6119 query,
6120 )
6121 }
6122
6123 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6127 self.0.request.name = v.into();
6128 self
6129 }
6130 }
6131
6132 #[doc(hidden)]
6133 impl crate::RequestBuilder for DeleteConversationModel {
6134 fn request_options(&mut self) -> &mut crate::RequestOptions {
6135 &mut self.0.options
6136 }
6137 }
6138
6139 #[derive(Clone, Debug)]
6157 pub struct DeployConversationModel(
6158 RequestBuilder<crate::model::DeployConversationModelRequest>,
6159 );
6160
6161 impl DeployConversationModel {
6162 pub(crate) fn new(
6163 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6164 ) -> Self {
6165 Self(RequestBuilder::new(stub))
6166 }
6167
6168 pub fn with_request<V: Into<crate::model::DeployConversationModelRequest>>(
6170 mut self,
6171 v: V,
6172 ) -> Self {
6173 self.0.request = v.into();
6174 self
6175 }
6176
6177 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6179 self.0.options = v.into();
6180 self
6181 }
6182
6183 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6190 (*self.0.stub)
6191 .deploy_conversation_model(self.0.request, self.0.options)
6192 .await
6193 .map(crate::Response::into_body)
6194 }
6195
6196 pub fn poller(
6198 self,
6199 ) -> impl google_cloud_lro::Poller<(), crate::model::DeployConversationModelOperationMetadata>
6200 {
6201 type Operation = google_cloud_lro::internal::Operation<
6202 wkt::Empty,
6203 crate::model::DeployConversationModelOperationMetadata,
6204 >;
6205 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6206 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6207
6208 let stub = self.0.stub.clone();
6209 let mut options = self.0.options.clone();
6210 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6211 let query = move |name| {
6212 let stub = stub.clone();
6213 let options = options.clone();
6214 async {
6215 let op = GetOperation::new(stub)
6216 .set_name(name)
6217 .with_options(options)
6218 .send()
6219 .await?;
6220 Ok(Operation::new(op))
6221 }
6222 };
6223
6224 let start = move || async {
6225 let op = self.send().await?;
6226 Ok(Operation::new(op))
6227 };
6228
6229 google_cloud_lro::internal::new_unit_response_poller(
6230 polling_error_policy,
6231 polling_backoff_policy,
6232 start,
6233 query,
6234 )
6235 }
6236
6237 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6241 self.0.request.name = v.into();
6242 self
6243 }
6244 }
6245
6246 #[doc(hidden)]
6247 impl crate::RequestBuilder for DeployConversationModel {
6248 fn request_options(&mut self) -> &mut crate::RequestOptions {
6249 &mut self.0.options
6250 }
6251 }
6252
6253 #[derive(Clone, Debug)]
6271 pub struct UndeployConversationModel(
6272 RequestBuilder<crate::model::UndeployConversationModelRequest>,
6273 );
6274
6275 impl UndeployConversationModel {
6276 pub(crate) fn new(
6277 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6278 ) -> Self {
6279 Self(RequestBuilder::new(stub))
6280 }
6281
6282 pub fn with_request<V: Into<crate::model::UndeployConversationModelRequest>>(
6284 mut self,
6285 v: V,
6286 ) -> Self {
6287 self.0.request = v.into();
6288 self
6289 }
6290
6291 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6293 self.0.options = v.into();
6294 self
6295 }
6296
6297 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6304 (*self.0.stub)
6305 .undeploy_conversation_model(self.0.request, self.0.options)
6306 .await
6307 .map(crate::Response::into_body)
6308 }
6309
6310 pub fn poller(
6312 self,
6313 ) -> impl google_cloud_lro::Poller<(), crate::model::UndeployConversationModelOperationMetadata>
6314 {
6315 type Operation = google_cloud_lro::internal::Operation<
6316 wkt::Empty,
6317 crate::model::UndeployConversationModelOperationMetadata,
6318 >;
6319 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6320 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6321
6322 let stub = self.0.stub.clone();
6323 let mut options = self.0.options.clone();
6324 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6325 let query = move |name| {
6326 let stub = stub.clone();
6327 let options = options.clone();
6328 async {
6329 let op = GetOperation::new(stub)
6330 .set_name(name)
6331 .with_options(options)
6332 .send()
6333 .await?;
6334 Ok(Operation::new(op))
6335 }
6336 };
6337
6338 let start = move || async {
6339 let op = self.send().await?;
6340 Ok(Operation::new(op))
6341 };
6342
6343 google_cloud_lro::internal::new_unit_response_poller(
6344 polling_error_policy,
6345 polling_backoff_policy,
6346 start,
6347 query,
6348 )
6349 }
6350
6351 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6355 self.0.request.name = v.into();
6356 self
6357 }
6358 }
6359
6360 #[doc(hidden)]
6361 impl crate::RequestBuilder for UndeployConversationModel {
6362 fn request_options(&mut self) -> &mut crate::RequestOptions {
6363 &mut self.0.options
6364 }
6365 }
6366
6367 #[derive(Clone, Debug)]
6384 pub struct GetConversationModelEvaluation(
6385 RequestBuilder<crate::model::GetConversationModelEvaluationRequest>,
6386 );
6387
6388 impl GetConversationModelEvaluation {
6389 pub(crate) fn new(
6390 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6391 ) -> Self {
6392 Self(RequestBuilder::new(stub))
6393 }
6394
6395 pub fn with_request<V: Into<crate::model::GetConversationModelEvaluationRequest>>(
6397 mut self,
6398 v: V,
6399 ) -> Self {
6400 self.0.request = v.into();
6401 self
6402 }
6403
6404 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6406 self.0.options = v.into();
6407 self
6408 }
6409
6410 pub async fn send(self) -> Result<crate::model::ConversationModelEvaluation> {
6412 (*self.0.stub)
6413 .get_conversation_model_evaluation(self.0.request, self.0.options)
6414 .await
6415 .map(crate::Response::into_body)
6416 }
6417
6418 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6422 self.0.request.name = v.into();
6423 self
6424 }
6425 }
6426
6427 #[doc(hidden)]
6428 impl crate::RequestBuilder for GetConversationModelEvaluation {
6429 fn request_options(&mut self) -> &mut crate::RequestOptions {
6430 &mut self.0.options
6431 }
6432 }
6433
6434 #[derive(Clone, Debug)]
6455 pub struct ListConversationModelEvaluations(
6456 RequestBuilder<crate::model::ListConversationModelEvaluationsRequest>,
6457 );
6458
6459 impl ListConversationModelEvaluations {
6460 pub(crate) fn new(
6461 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6462 ) -> Self {
6463 Self(RequestBuilder::new(stub))
6464 }
6465
6466 pub fn with_request<V: Into<crate::model::ListConversationModelEvaluationsRequest>>(
6468 mut self,
6469 v: V,
6470 ) -> Self {
6471 self.0.request = v.into();
6472 self
6473 }
6474
6475 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6477 self.0.options = v.into();
6478 self
6479 }
6480
6481 pub async fn send(self) -> Result<crate::model::ListConversationModelEvaluationsResponse> {
6483 (*self.0.stub)
6484 .list_conversation_model_evaluations(self.0.request, self.0.options)
6485 .await
6486 .map(crate::Response::into_body)
6487 }
6488
6489 pub fn by_page(
6491 self,
6492 ) -> impl google_cloud_gax::paginator::Paginator<
6493 crate::model::ListConversationModelEvaluationsResponse,
6494 crate::Error,
6495 > {
6496 use std::clone::Clone;
6497 let token = self.0.request.page_token.clone();
6498 let execute = move |token: String| {
6499 let mut builder = self.clone();
6500 builder.0.request = builder.0.request.set_page_token(token);
6501 builder.send()
6502 };
6503 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6504 }
6505
6506 pub fn by_item(
6508 self,
6509 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6510 crate::model::ListConversationModelEvaluationsResponse,
6511 crate::Error,
6512 > {
6513 use google_cloud_gax::paginator::Paginator;
6514 self.by_page().items()
6515 }
6516
6517 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6521 self.0.request.parent = v.into();
6522 self
6523 }
6524
6525 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6527 self.0.request.page_size = v.into();
6528 self
6529 }
6530
6531 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6533 self.0.request.page_token = v.into();
6534 self
6535 }
6536 }
6537
6538 #[doc(hidden)]
6539 impl crate::RequestBuilder for ListConversationModelEvaluations {
6540 fn request_options(&mut self) -> &mut crate::RequestOptions {
6541 &mut self.0.options
6542 }
6543 }
6544
6545 #[derive(Clone, Debug)]
6563 pub struct CreateConversationModelEvaluation(
6564 RequestBuilder<crate::model::CreateConversationModelEvaluationRequest>,
6565 );
6566
6567 impl CreateConversationModelEvaluation {
6568 pub(crate) fn new(
6569 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6570 ) -> Self {
6571 Self(RequestBuilder::new(stub))
6572 }
6573
6574 pub fn with_request<V: Into<crate::model::CreateConversationModelEvaluationRequest>>(
6576 mut self,
6577 v: V,
6578 ) -> Self {
6579 self.0.request = v.into();
6580 self
6581 }
6582
6583 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6585 self.0.options = v.into();
6586 self
6587 }
6588
6589 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6596 (*self.0.stub)
6597 .create_conversation_model_evaluation(self.0.request, self.0.options)
6598 .await
6599 .map(crate::Response::into_body)
6600 }
6601
6602 pub fn poller(
6604 self,
6605 ) -> impl google_cloud_lro::Poller<
6606 crate::model::ConversationModelEvaluation,
6607 crate::model::CreateConversationModelEvaluationOperationMetadata,
6608 > {
6609 type Operation = google_cloud_lro::internal::Operation<
6610 crate::model::ConversationModelEvaluation,
6611 crate::model::CreateConversationModelEvaluationOperationMetadata,
6612 >;
6613 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6614 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6615
6616 let stub = self.0.stub.clone();
6617 let mut options = self.0.options.clone();
6618 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6619 let query = move |name| {
6620 let stub = stub.clone();
6621 let options = options.clone();
6622 async {
6623 let op = GetOperation::new(stub)
6624 .set_name(name)
6625 .with_options(options)
6626 .send()
6627 .await?;
6628 Ok(Operation::new(op))
6629 }
6630 };
6631
6632 let start = move || async {
6633 let op = self.send().await?;
6634 Ok(Operation::new(op))
6635 };
6636
6637 google_cloud_lro::internal::new_poller(
6638 polling_error_policy,
6639 polling_backoff_policy,
6640 start,
6641 query,
6642 )
6643 }
6644
6645 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6649 self.0.request.parent = v.into();
6650 self
6651 }
6652
6653 pub fn set_conversation_model_evaluation<T>(mut self, v: T) -> Self
6657 where
6658 T: std::convert::Into<crate::model::ConversationModelEvaluation>,
6659 {
6660 self.0.request.conversation_model_evaluation = std::option::Option::Some(v.into());
6661 self
6662 }
6663
6664 pub fn set_or_clear_conversation_model_evaluation<T>(
6668 mut self,
6669 v: std::option::Option<T>,
6670 ) -> Self
6671 where
6672 T: std::convert::Into<crate::model::ConversationModelEvaluation>,
6673 {
6674 self.0.request.conversation_model_evaluation = v.map(|x| x.into());
6675 self
6676 }
6677 }
6678
6679 #[doc(hidden)]
6680 impl crate::RequestBuilder for CreateConversationModelEvaluation {
6681 fn request_options(&mut self) -> &mut crate::RequestOptions {
6682 &mut self.0.options
6683 }
6684 }
6685
6686 #[derive(Clone, Debug)]
6707 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
6708
6709 impl ListLocations {
6710 pub(crate) fn new(
6711 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6712 ) -> Self {
6713 Self(RequestBuilder::new(stub))
6714 }
6715
6716 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
6718 mut self,
6719 v: V,
6720 ) -> Self {
6721 self.0.request = v.into();
6722 self
6723 }
6724
6725 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6727 self.0.options = v.into();
6728 self
6729 }
6730
6731 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
6733 (*self.0.stub)
6734 .list_locations(self.0.request, self.0.options)
6735 .await
6736 .map(crate::Response::into_body)
6737 }
6738
6739 pub fn by_page(
6741 self,
6742 ) -> impl google_cloud_gax::paginator::Paginator<
6743 google_cloud_location::model::ListLocationsResponse,
6744 crate::Error,
6745 > {
6746 use std::clone::Clone;
6747 let token = self.0.request.page_token.clone();
6748 let execute = move |token: String| {
6749 let mut builder = self.clone();
6750 builder.0.request = builder.0.request.set_page_token(token);
6751 builder.send()
6752 };
6753 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6754 }
6755
6756 pub fn by_item(
6758 self,
6759 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6760 google_cloud_location::model::ListLocationsResponse,
6761 crate::Error,
6762 > {
6763 use google_cloud_gax::paginator::Paginator;
6764 self.by_page().items()
6765 }
6766
6767 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6769 self.0.request.name = v.into();
6770 self
6771 }
6772
6773 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6775 self.0.request.filter = v.into();
6776 self
6777 }
6778
6779 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6781 self.0.request.page_size = v.into();
6782 self
6783 }
6784
6785 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6787 self.0.request.page_token = v.into();
6788 self
6789 }
6790 }
6791
6792 #[doc(hidden)]
6793 impl crate::RequestBuilder for ListLocations {
6794 fn request_options(&mut self) -> &mut crate::RequestOptions {
6795 &mut self.0.options
6796 }
6797 }
6798
6799 #[derive(Clone, Debug)]
6816 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
6817
6818 impl GetLocation {
6819 pub(crate) fn new(
6820 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6821 ) -> Self {
6822 Self(RequestBuilder::new(stub))
6823 }
6824
6825 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
6827 mut self,
6828 v: V,
6829 ) -> Self {
6830 self.0.request = v.into();
6831 self
6832 }
6833
6834 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6836 self.0.options = v.into();
6837 self
6838 }
6839
6840 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
6842 (*self.0.stub)
6843 .get_location(self.0.request, self.0.options)
6844 .await
6845 .map(crate::Response::into_body)
6846 }
6847
6848 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6850 self.0.request.name = v.into();
6851 self
6852 }
6853 }
6854
6855 #[doc(hidden)]
6856 impl crate::RequestBuilder for GetLocation {
6857 fn request_options(&mut self) -> &mut crate::RequestOptions {
6858 &mut self.0.options
6859 }
6860 }
6861
6862 #[derive(Clone, Debug)]
6883 pub struct ListOperations(
6884 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6885 );
6886
6887 impl ListOperations {
6888 pub(crate) fn new(
6889 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6890 ) -> Self {
6891 Self(RequestBuilder::new(stub))
6892 }
6893
6894 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6896 mut self,
6897 v: V,
6898 ) -> Self {
6899 self.0.request = v.into();
6900 self
6901 }
6902
6903 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6905 self.0.options = v.into();
6906 self
6907 }
6908
6909 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6911 (*self.0.stub)
6912 .list_operations(self.0.request, self.0.options)
6913 .await
6914 .map(crate::Response::into_body)
6915 }
6916
6917 pub fn by_page(
6919 self,
6920 ) -> impl google_cloud_gax::paginator::Paginator<
6921 google_cloud_longrunning::model::ListOperationsResponse,
6922 crate::Error,
6923 > {
6924 use std::clone::Clone;
6925 let token = self.0.request.page_token.clone();
6926 let execute = move |token: String| {
6927 let mut builder = self.clone();
6928 builder.0.request = builder.0.request.set_page_token(token);
6929 builder.send()
6930 };
6931 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6932 }
6933
6934 pub fn by_item(
6936 self,
6937 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6938 google_cloud_longrunning::model::ListOperationsResponse,
6939 crate::Error,
6940 > {
6941 use google_cloud_gax::paginator::Paginator;
6942 self.by_page().items()
6943 }
6944
6945 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6947 self.0.request.name = v.into();
6948 self
6949 }
6950
6951 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6953 self.0.request.filter = v.into();
6954 self
6955 }
6956
6957 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6959 self.0.request.page_size = v.into();
6960 self
6961 }
6962
6963 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6965 self.0.request.page_token = v.into();
6966 self
6967 }
6968
6969 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6971 self.0.request.return_partial_success = v.into();
6972 self
6973 }
6974 }
6975
6976 #[doc(hidden)]
6977 impl crate::RequestBuilder for ListOperations {
6978 fn request_options(&mut self) -> &mut crate::RequestOptions {
6979 &mut self.0.options
6980 }
6981 }
6982
6983 #[derive(Clone, Debug)]
7000 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7001
7002 impl GetOperation {
7003 pub(crate) fn new(
7004 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
7005 ) -> Self {
7006 Self(RequestBuilder::new(stub))
7007 }
7008
7009 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7011 mut self,
7012 v: V,
7013 ) -> Self {
7014 self.0.request = v.into();
7015 self
7016 }
7017
7018 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7020 self.0.options = v.into();
7021 self
7022 }
7023
7024 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7026 (*self.0.stub)
7027 .get_operation(self.0.request, self.0.options)
7028 .await
7029 .map(crate::Response::into_body)
7030 }
7031
7032 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7034 self.0.request.name = v.into();
7035 self
7036 }
7037 }
7038
7039 #[doc(hidden)]
7040 impl crate::RequestBuilder for GetOperation {
7041 fn request_options(&mut self) -> &mut crate::RequestOptions {
7042 &mut self.0.options
7043 }
7044 }
7045
7046 #[derive(Clone, Debug)]
7063 pub struct CancelOperation(
7064 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7065 );
7066
7067 impl CancelOperation {
7068 pub(crate) fn new(
7069 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
7070 ) -> Self {
7071 Self(RequestBuilder::new(stub))
7072 }
7073
7074 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7076 mut self,
7077 v: V,
7078 ) -> Self {
7079 self.0.request = v.into();
7080 self
7081 }
7082
7083 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7085 self.0.options = v.into();
7086 self
7087 }
7088
7089 pub async fn send(self) -> Result<()> {
7091 (*self.0.stub)
7092 .cancel_operation(self.0.request, self.0.options)
7093 .await
7094 .map(crate::Response::into_body)
7095 }
7096
7097 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7099 self.0.request.name = v.into();
7100 self
7101 }
7102 }
7103
7104 #[doc(hidden)]
7105 impl crate::RequestBuilder for CancelOperation {
7106 fn request_options(&mut self) -> &mut crate::RequestOptions {
7107 &mut self.0.options
7108 }
7109 }
7110}
7111
7112#[cfg(feature = "conversation-profiles")]
7113#[cfg_attr(docsrs, doc(cfg(feature = "conversation-profiles")))]
7114pub mod conversation_profiles {
7115 use crate::Result;
7116
7117 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7131
7132 pub(crate) mod client {
7133 use super::super::super::client::ConversationProfiles;
7134 pub struct Factory;
7135 impl crate::ClientFactory for Factory {
7136 type Client = ConversationProfiles;
7137 type Credentials = gaxi::options::Credentials;
7138 async fn build(
7139 self,
7140 config: gaxi::options::ClientConfig,
7141 ) -> crate::ClientBuilderResult<Self::Client> {
7142 Self::Client::new(config).await
7143 }
7144 }
7145 }
7146
7147 #[derive(Clone, Debug)]
7149 pub(crate) struct RequestBuilder<R: std::default::Default> {
7150 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7151 request: R,
7152 options: crate::RequestOptions,
7153 }
7154
7155 impl<R> RequestBuilder<R>
7156 where
7157 R: std::default::Default,
7158 {
7159 pub(crate) fn new(
7160 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7161 ) -> Self {
7162 Self {
7163 stub,
7164 request: R::default(),
7165 options: crate::RequestOptions::default(),
7166 }
7167 }
7168 }
7169
7170 #[derive(Clone, Debug)]
7191 pub struct ListConversationProfiles(
7192 RequestBuilder<crate::model::ListConversationProfilesRequest>,
7193 );
7194
7195 impl ListConversationProfiles {
7196 pub(crate) fn new(
7197 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7198 ) -> Self {
7199 Self(RequestBuilder::new(stub))
7200 }
7201
7202 pub fn with_request<V: Into<crate::model::ListConversationProfilesRequest>>(
7204 mut self,
7205 v: V,
7206 ) -> Self {
7207 self.0.request = v.into();
7208 self
7209 }
7210
7211 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7213 self.0.options = v.into();
7214 self
7215 }
7216
7217 pub async fn send(self) -> Result<crate::model::ListConversationProfilesResponse> {
7219 (*self.0.stub)
7220 .list_conversation_profiles(self.0.request, self.0.options)
7221 .await
7222 .map(crate::Response::into_body)
7223 }
7224
7225 pub fn by_page(
7227 self,
7228 ) -> impl google_cloud_gax::paginator::Paginator<
7229 crate::model::ListConversationProfilesResponse,
7230 crate::Error,
7231 > {
7232 use std::clone::Clone;
7233 let token = self.0.request.page_token.clone();
7234 let execute = move |token: String| {
7235 let mut builder = self.clone();
7236 builder.0.request = builder.0.request.set_page_token(token);
7237 builder.send()
7238 };
7239 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7240 }
7241
7242 pub fn by_item(
7244 self,
7245 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7246 crate::model::ListConversationProfilesResponse,
7247 crate::Error,
7248 > {
7249 use google_cloud_gax::paginator::Paginator;
7250 self.by_page().items()
7251 }
7252
7253 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7257 self.0.request.parent = v.into();
7258 self
7259 }
7260
7261 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7263 self.0.request.page_size = v.into();
7264 self
7265 }
7266
7267 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7269 self.0.request.page_token = v.into();
7270 self
7271 }
7272 }
7273
7274 #[doc(hidden)]
7275 impl crate::RequestBuilder for ListConversationProfiles {
7276 fn request_options(&mut self) -> &mut crate::RequestOptions {
7277 &mut self.0.options
7278 }
7279 }
7280
7281 #[derive(Clone, Debug)]
7298 pub struct GetConversationProfile(RequestBuilder<crate::model::GetConversationProfileRequest>);
7299
7300 impl GetConversationProfile {
7301 pub(crate) fn new(
7302 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7303 ) -> Self {
7304 Self(RequestBuilder::new(stub))
7305 }
7306
7307 pub fn with_request<V: Into<crate::model::GetConversationProfileRequest>>(
7309 mut self,
7310 v: V,
7311 ) -> Self {
7312 self.0.request = v.into();
7313 self
7314 }
7315
7316 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7318 self.0.options = v.into();
7319 self
7320 }
7321
7322 pub async fn send(self) -> Result<crate::model::ConversationProfile> {
7324 (*self.0.stub)
7325 .get_conversation_profile(self.0.request, self.0.options)
7326 .await
7327 .map(crate::Response::into_body)
7328 }
7329
7330 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7334 self.0.request.name = v.into();
7335 self
7336 }
7337 }
7338
7339 #[doc(hidden)]
7340 impl crate::RequestBuilder for GetConversationProfile {
7341 fn request_options(&mut self) -> &mut crate::RequestOptions {
7342 &mut self.0.options
7343 }
7344 }
7345
7346 #[derive(Clone, Debug)]
7363 pub struct CreateConversationProfile(
7364 RequestBuilder<crate::model::CreateConversationProfileRequest>,
7365 );
7366
7367 impl CreateConversationProfile {
7368 pub(crate) fn new(
7369 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7370 ) -> Self {
7371 Self(RequestBuilder::new(stub))
7372 }
7373
7374 pub fn with_request<V: Into<crate::model::CreateConversationProfileRequest>>(
7376 mut self,
7377 v: V,
7378 ) -> Self {
7379 self.0.request = v.into();
7380 self
7381 }
7382
7383 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7385 self.0.options = v.into();
7386 self
7387 }
7388
7389 pub async fn send(self) -> Result<crate::model::ConversationProfile> {
7391 (*self.0.stub)
7392 .create_conversation_profile(self.0.request, self.0.options)
7393 .await
7394 .map(crate::Response::into_body)
7395 }
7396
7397 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7401 self.0.request.parent = v.into();
7402 self
7403 }
7404
7405 pub fn set_conversation_profile<T>(mut self, v: T) -> Self
7409 where
7410 T: std::convert::Into<crate::model::ConversationProfile>,
7411 {
7412 self.0.request.conversation_profile = std::option::Option::Some(v.into());
7413 self
7414 }
7415
7416 pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
7420 where
7421 T: std::convert::Into<crate::model::ConversationProfile>,
7422 {
7423 self.0.request.conversation_profile = v.map(|x| x.into());
7424 self
7425 }
7426 }
7427
7428 #[doc(hidden)]
7429 impl crate::RequestBuilder for CreateConversationProfile {
7430 fn request_options(&mut self) -> &mut crate::RequestOptions {
7431 &mut self.0.options
7432 }
7433 }
7434
7435 #[derive(Clone, Debug)]
7452 pub struct UpdateConversationProfile(
7453 RequestBuilder<crate::model::UpdateConversationProfileRequest>,
7454 );
7455
7456 impl UpdateConversationProfile {
7457 pub(crate) fn new(
7458 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7459 ) -> Self {
7460 Self(RequestBuilder::new(stub))
7461 }
7462
7463 pub fn with_request<V: Into<crate::model::UpdateConversationProfileRequest>>(
7465 mut self,
7466 v: V,
7467 ) -> Self {
7468 self.0.request = v.into();
7469 self
7470 }
7471
7472 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7474 self.0.options = v.into();
7475 self
7476 }
7477
7478 pub async fn send(self) -> Result<crate::model::ConversationProfile> {
7480 (*self.0.stub)
7481 .update_conversation_profile(self.0.request, self.0.options)
7482 .await
7483 .map(crate::Response::into_body)
7484 }
7485
7486 pub fn set_conversation_profile<T>(mut self, v: T) -> Self
7490 where
7491 T: std::convert::Into<crate::model::ConversationProfile>,
7492 {
7493 self.0.request.conversation_profile = std::option::Option::Some(v.into());
7494 self
7495 }
7496
7497 pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
7501 where
7502 T: std::convert::Into<crate::model::ConversationProfile>,
7503 {
7504 self.0.request.conversation_profile = v.map(|x| x.into());
7505 self
7506 }
7507
7508 pub fn set_update_mask<T>(mut self, v: T) -> Self
7512 where
7513 T: std::convert::Into<wkt::FieldMask>,
7514 {
7515 self.0.request.update_mask = std::option::Option::Some(v.into());
7516 self
7517 }
7518
7519 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7523 where
7524 T: std::convert::Into<wkt::FieldMask>,
7525 {
7526 self.0.request.update_mask = v.map(|x| x.into());
7527 self
7528 }
7529 }
7530
7531 #[doc(hidden)]
7532 impl crate::RequestBuilder for UpdateConversationProfile {
7533 fn request_options(&mut self) -> &mut crate::RequestOptions {
7534 &mut self.0.options
7535 }
7536 }
7537
7538 #[derive(Clone, Debug)]
7555 pub struct DeleteConversationProfile(
7556 RequestBuilder<crate::model::DeleteConversationProfileRequest>,
7557 );
7558
7559 impl DeleteConversationProfile {
7560 pub(crate) fn new(
7561 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7562 ) -> Self {
7563 Self(RequestBuilder::new(stub))
7564 }
7565
7566 pub fn with_request<V: Into<crate::model::DeleteConversationProfileRequest>>(
7568 mut self,
7569 v: V,
7570 ) -> Self {
7571 self.0.request = v.into();
7572 self
7573 }
7574
7575 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7577 self.0.options = v.into();
7578 self
7579 }
7580
7581 pub async fn send(self) -> Result<()> {
7583 (*self.0.stub)
7584 .delete_conversation_profile(self.0.request, self.0.options)
7585 .await
7586 .map(crate::Response::into_body)
7587 }
7588
7589 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7593 self.0.request.name = v.into();
7594 self
7595 }
7596 }
7597
7598 #[doc(hidden)]
7599 impl crate::RequestBuilder for DeleteConversationProfile {
7600 fn request_options(&mut self) -> &mut crate::RequestOptions {
7601 &mut self.0.options
7602 }
7603 }
7604
7605 #[derive(Clone, Debug)]
7623 pub struct SetSuggestionFeatureConfig(
7624 RequestBuilder<crate::model::SetSuggestionFeatureConfigRequest>,
7625 );
7626
7627 impl SetSuggestionFeatureConfig {
7628 pub(crate) fn new(
7629 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7630 ) -> Self {
7631 Self(RequestBuilder::new(stub))
7632 }
7633
7634 pub fn with_request<V: Into<crate::model::SetSuggestionFeatureConfigRequest>>(
7636 mut self,
7637 v: V,
7638 ) -> Self {
7639 self.0.request = v.into();
7640 self
7641 }
7642
7643 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7645 self.0.options = v.into();
7646 self
7647 }
7648
7649 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7656 (*self.0.stub)
7657 .set_suggestion_feature_config(self.0.request, self.0.options)
7658 .await
7659 .map(crate::Response::into_body)
7660 }
7661
7662 pub fn poller(
7664 self,
7665 ) -> impl google_cloud_lro::Poller<
7666 crate::model::ConversationProfile,
7667 crate::model::SetSuggestionFeatureConfigOperationMetadata,
7668 > {
7669 type Operation = google_cloud_lro::internal::Operation<
7670 crate::model::ConversationProfile,
7671 crate::model::SetSuggestionFeatureConfigOperationMetadata,
7672 >;
7673 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7674 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7675
7676 let stub = self.0.stub.clone();
7677 let mut options = self.0.options.clone();
7678 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7679 let query = move |name| {
7680 let stub = stub.clone();
7681 let options = options.clone();
7682 async {
7683 let op = GetOperation::new(stub)
7684 .set_name(name)
7685 .with_options(options)
7686 .send()
7687 .await?;
7688 Ok(Operation::new(op))
7689 }
7690 };
7691
7692 let start = move || async {
7693 let op = self.send().await?;
7694 Ok(Operation::new(op))
7695 };
7696
7697 google_cloud_lro::internal::new_poller(
7698 polling_error_policy,
7699 polling_backoff_policy,
7700 start,
7701 query,
7702 )
7703 }
7704
7705 pub fn set_conversation_profile<T: Into<std::string::String>>(mut self, v: T) -> Self {
7709 self.0.request.conversation_profile = v.into();
7710 self
7711 }
7712
7713 pub fn set_participant_role<T: Into<crate::model::participant::Role>>(
7717 mut self,
7718 v: T,
7719 ) -> Self {
7720 self.0.request.participant_role = v.into();
7721 self
7722 }
7723
7724 pub fn set_suggestion_feature_config<T>(mut self, v: T) -> Self
7728 where
7729 T: std::convert::Into<
7730 crate::model::human_agent_assistant_config::SuggestionFeatureConfig,
7731 >,
7732 {
7733 self.0.request.suggestion_feature_config = std::option::Option::Some(v.into());
7734 self
7735 }
7736
7737 pub fn set_or_clear_suggestion_feature_config<T>(
7741 mut self,
7742 v: std::option::Option<T>,
7743 ) -> Self
7744 where
7745 T: std::convert::Into<
7746 crate::model::human_agent_assistant_config::SuggestionFeatureConfig,
7747 >,
7748 {
7749 self.0.request.suggestion_feature_config = v.map(|x| x.into());
7750 self
7751 }
7752 }
7753
7754 #[doc(hidden)]
7755 impl crate::RequestBuilder for SetSuggestionFeatureConfig {
7756 fn request_options(&mut self) -> &mut crate::RequestOptions {
7757 &mut self.0.options
7758 }
7759 }
7760
7761 #[derive(Clone, Debug)]
7779 pub struct ClearSuggestionFeatureConfig(
7780 RequestBuilder<crate::model::ClearSuggestionFeatureConfigRequest>,
7781 );
7782
7783 impl ClearSuggestionFeatureConfig {
7784 pub(crate) fn new(
7785 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7786 ) -> Self {
7787 Self(RequestBuilder::new(stub))
7788 }
7789
7790 pub fn with_request<V: Into<crate::model::ClearSuggestionFeatureConfigRequest>>(
7792 mut self,
7793 v: V,
7794 ) -> Self {
7795 self.0.request = v.into();
7796 self
7797 }
7798
7799 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7801 self.0.options = v.into();
7802 self
7803 }
7804
7805 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7812 (*self.0.stub)
7813 .clear_suggestion_feature_config(self.0.request, self.0.options)
7814 .await
7815 .map(crate::Response::into_body)
7816 }
7817
7818 pub fn poller(
7820 self,
7821 ) -> impl google_cloud_lro::Poller<
7822 crate::model::ConversationProfile,
7823 crate::model::ClearSuggestionFeatureConfigOperationMetadata,
7824 > {
7825 type Operation = google_cloud_lro::internal::Operation<
7826 crate::model::ConversationProfile,
7827 crate::model::ClearSuggestionFeatureConfigOperationMetadata,
7828 >;
7829 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7830 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7831
7832 let stub = self.0.stub.clone();
7833 let mut options = self.0.options.clone();
7834 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7835 let query = move |name| {
7836 let stub = stub.clone();
7837 let options = options.clone();
7838 async {
7839 let op = GetOperation::new(stub)
7840 .set_name(name)
7841 .with_options(options)
7842 .send()
7843 .await?;
7844 Ok(Operation::new(op))
7845 }
7846 };
7847
7848 let start = move || async {
7849 let op = self.send().await?;
7850 Ok(Operation::new(op))
7851 };
7852
7853 google_cloud_lro::internal::new_poller(
7854 polling_error_policy,
7855 polling_backoff_policy,
7856 start,
7857 query,
7858 )
7859 }
7860
7861 pub fn set_conversation_profile<T: Into<std::string::String>>(mut self, v: T) -> Self {
7865 self.0.request.conversation_profile = v.into();
7866 self
7867 }
7868
7869 pub fn set_participant_role<T: Into<crate::model::participant::Role>>(
7873 mut self,
7874 v: T,
7875 ) -> Self {
7876 self.0.request.participant_role = v.into();
7877 self
7878 }
7879
7880 pub fn set_suggestion_feature_type<T: Into<crate::model::suggestion_feature::Type>>(
7884 mut self,
7885 v: T,
7886 ) -> Self {
7887 self.0.request.suggestion_feature_type = v.into();
7888 self
7889 }
7890 }
7891
7892 #[doc(hidden)]
7893 impl crate::RequestBuilder for ClearSuggestionFeatureConfig {
7894 fn request_options(&mut self) -> &mut crate::RequestOptions {
7895 &mut self.0.options
7896 }
7897 }
7898
7899 #[derive(Clone, Debug)]
7920 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
7921
7922 impl ListLocations {
7923 pub(crate) fn new(
7924 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7925 ) -> Self {
7926 Self(RequestBuilder::new(stub))
7927 }
7928
7929 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
7931 mut self,
7932 v: V,
7933 ) -> Self {
7934 self.0.request = v.into();
7935 self
7936 }
7937
7938 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7940 self.0.options = v.into();
7941 self
7942 }
7943
7944 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
7946 (*self.0.stub)
7947 .list_locations(self.0.request, self.0.options)
7948 .await
7949 .map(crate::Response::into_body)
7950 }
7951
7952 pub fn by_page(
7954 self,
7955 ) -> impl google_cloud_gax::paginator::Paginator<
7956 google_cloud_location::model::ListLocationsResponse,
7957 crate::Error,
7958 > {
7959 use std::clone::Clone;
7960 let token = self.0.request.page_token.clone();
7961 let execute = move |token: String| {
7962 let mut builder = self.clone();
7963 builder.0.request = builder.0.request.set_page_token(token);
7964 builder.send()
7965 };
7966 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7967 }
7968
7969 pub fn by_item(
7971 self,
7972 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7973 google_cloud_location::model::ListLocationsResponse,
7974 crate::Error,
7975 > {
7976 use google_cloud_gax::paginator::Paginator;
7977 self.by_page().items()
7978 }
7979
7980 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7982 self.0.request.name = v.into();
7983 self
7984 }
7985
7986 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7988 self.0.request.filter = v.into();
7989 self
7990 }
7991
7992 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7994 self.0.request.page_size = v.into();
7995 self
7996 }
7997
7998 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8000 self.0.request.page_token = v.into();
8001 self
8002 }
8003 }
8004
8005 #[doc(hidden)]
8006 impl crate::RequestBuilder for ListLocations {
8007 fn request_options(&mut self) -> &mut crate::RequestOptions {
8008 &mut self.0.options
8009 }
8010 }
8011
8012 #[derive(Clone, Debug)]
8029 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
8030
8031 impl GetLocation {
8032 pub(crate) fn new(
8033 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
8034 ) -> Self {
8035 Self(RequestBuilder::new(stub))
8036 }
8037
8038 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
8040 mut self,
8041 v: V,
8042 ) -> Self {
8043 self.0.request = v.into();
8044 self
8045 }
8046
8047 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8049 self.0.options = v.into();
8050 self
8051 }
8052
8053 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
8055 (*self.0.stub)
8056 .get_location(self.0.request, self.0.options)
8057 .await
8058 .map(crate::Response::into_body)
8059 }
8060
8061 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8063 self.0.request.name = v.into();
8064 self
8065 }
8066 }
8067
8068 #[doc(hidden)]
8069 impl crate::RequestBuilder for GetLocation {
8070 fn request_options(&mut self) -> &mut crate::RequestOptions {
8071 &mut self.0.options
8072 }
8073 }
8074
8075 #[derive(Clone, Debug)]
8096 pub struct ListOperations(
8097 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8098 );
8099
8100 impl ListOperations {
8101 pub(crate) fn new(
8102 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
8103 ) -> Self {
8104 Self(RequestBuilder::new(stub))
8105 }
8106
8107 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8109 mut self,
8110 v: V,
8111 ) -> Self {
8112 self.0.request = v.into();
8113 self
8114 }
8115
8116 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8118 self.0.options = v.into();
8119 self
8120 }
8121
8122 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8124 (*self.0.stub)
8125 .list_operations(self.0.request, self.0.options)
8126 .await
8127 .map(crate::Response::into_body)
8128 }
8129
8130 pub fn by_page(
8132 self,
8133 ) -> impl google_cloud_gax::paginator::Paginator<
8134 google_cloud_longrunning::model::ListOperationsResponse,
8135 crate::Error,
8136 > {
8137 use std::clone::Clone;
8138 let token = self.0.request.page_token.clone();
8139 let execute = move |token: String| {
8140 let mut builder = self.clone();
8141 builder.0.request = builder.0.request.set_page_token(token);
8142 builder.send()
8143 };
8144 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8145 }
8146
8147 pub fn by_item(
8149 self,
8150 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8151 google_cloud_longrunning::model::ListOperationsResponse,
8152 crate::Error,
8153 > {
8154 use google_cloud_gax::paginator::Paginator;
8155 self.by_page().items()
8156 }
8157
8158 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8160 self.0.request.name = v.into();
8161 self
8162 }
8163
8164 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8166 self.0.request.filter = v.into();
8167 self
8168 }
8169
8170 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8172 self.0.request.page_size = v.into();
8173 self
8174 }
8175
8176 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8178 self.0.request.page_token = v.into();
8179 self
8180 }
8181
8182 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8184 self.0.request.return_partial_success = v.into();
8185 self
8186 }
8187 }
8188
8189 #[doc(hidden)]
8190 impl crate::RequestBuilder for ListOperations {
8191 fn request_options(&mut self) -> &mut crate::RequestOptions {
8192 &mut self.0.options
8193 }
8194 }
8195
8196 #[derive(Clone, Debug)]
8213 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8214
8215 impl GetOperation {
8216 pub(crate) fn new(
8217 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
8218 ) -> Self {
8219 Self(RequestBuilder::new(stub))
8220 }
8221
8222 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8224 mut self,
8225 v: V,
8226 ) -> Self {
8227 self.0.request = v.into();
8228 self
8229 }
8230
8231 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8233 self.0.options = v.into();
8234 self
8235 }
8236
8237 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8239 (*self.0.stub)
8240 .get_operation(self.0.request, self.0.options)
8241 .await
8242 .map(crate::Response::into_body)
8243 }
8244
8245 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8247 self.0.request.name = v.into();
8248 self
8249 }
8250 }
8251
8252 #[doc(hidden)]
8253 impl crate::RequestBuilder for GetOperation {
8254 fn request_options(&mut self) -> &mut crate::RequestOptions {
8255 &mut self.0.options
8256 }
8257 }
8258
8259 #[derive(Clone, Debug)]
8276 pub struct CancelOperation(
8277 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
8278 );
8279
8280 impl CancelOperation {
8281 pub(crate) fn new(
8282 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
8283 ) -> Self {
8284 Self(RequestBuilder::new(stub))
8285 }
8286
8287 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
8289 mut self,
8290 v: V,
8291 ) -> Self {
8292 self.0.request = v.into();
8293 self
8294 }
8295
8296 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8298 self.0.options = v.into();
8299 self
8300 }
8301
8302 pub async fn send(self) -> Result<()> {
8304 (*self.0.stub)
8305 .cancel_operation(self.0.request, self.0.options)
8306 .await
8307 .map(crate::Response::into_body)
8308 }
8309
8310 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8312 self.0.request.name = v.into();
8313 self
8314 }
8315 }
8316
8317 #[doc(hidden)]
8318 impl crate::RequestBuilder for CancelOperation {
8319 fn request_options(&mut self) -> &mut crate::RequestOptions {
8320 &mut self.0.options
8321 }
8322 }
8323}
8324
8325#[cfg(feature = "documents")]
8326#[cfg_attr(docsrs, doc(cfg(feature = "documents")))]
8327pub mod documents {
8328 use crate::Result;
8329
8330 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8344
8345 pub(crate) mod client {
8346 use super::super::super::client::Documents;
8347 pub struct Factory;
8348 impl crate::ClientFactory for Factory {
8349 type Client = Documents;
8350 type Credentials = gaxi::options::Credentials;
8351 async fn build(
8352 self,
8353 config: gaxi::options::ClientConfig,
8354 ) -> crate::ClientBuilderResult<Self::Client> {
8355 Self::Client::new(config).await
8356 }
8357 }
8358 }
8359
8360 #[derive(Clone, Debug)]
8362 pub(crate) struct RequestBuilder<R: std::default::Default> {
8363 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8364 request: R,
8365 options: crate::RequestOptions,
8366 }
8367
8368 impl<R> RequestBuilder<R>
8369 where
8370 R: std::default::Default,
8371 {
8372 pub(crate) fn new(
8373 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8374 ) -> Self {
8375 Self {
8376 stub,
8377 request: R::default(),
8378 options: crate::RequestOptions::default(),
8379 }
8380 }
8381 }
8382
8383 #[derive(Clone, Debug)]
8404 pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
8405
8406 impl ListDocuments {
8407 pub(crate) fn new(
8408 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8409 ) -> Self {
8410 Self(RequestBuilder::new(stub))
8411 }
8412
8413 pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
8415 self.0.request = v.into();
8416 self
8417 }
8418
8419 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8421 self.0.options = v.into();
8422 self
8423 }
8424
8425 pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
8427 (*self.0.stub)
8428 .list_documents(self.0.request, self.0.options)
8429 .await
8430 .map(crate::Response::into_body)
8431 }
8432
8433 pub fn by_page(
8435 self,
8436 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDocumentsResponse, crate::Error>
8437 {
8438 use std::clone::Clone;
8439 let token = self.0.request.page_token.clone();
8440 let execute = move |token: String| {
8441 let mut builder = self.clone();
8442 builder.0.request = builder.0.request.set_page_token(token);
8443 builder.send()
8444 };
8445 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8446 }
8447
8448 pub fn by_item(
8450 self,
8451 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8452 crate::model::ListDocumentsResponse,
8453 crate::Error,
8454 > {
8455 use google_cloud_gax::paginator::Paginator;
8456 self.by_page().items()
8457 }
8458
8459 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8463 self.0.request.parent = v.into();
8464 self
8465 }
8466
8467 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8469 self.0.request.page_size = v.into();
8470 self
8471 }
8472
8473 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8475 self.0.request.page_token = v.into();
8476 self
8477 }
8478
8479 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8481 self.0.request.filter = v.into();
8482 self
8483 }
8484 }
8485
8486 #[doc(hidden)]
8487 impl crate::RequestBuilder for ListDocuments {
8488 fn request_options(&mut self) -> &mut crate::RequestOptions {
8489 &mut self.0.options
8490 }
8491 }
8492
8493 #[derive(Clone, Debug)]
8510 pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
8511
8512 impl GetDocument {
8513 pub(crate) fn new(
8514 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8515 ) -> Self {
8516 Self(RequestBuilder::new(stub))
8517 }
8518
8519 pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
8521 self.0.request = v.into();
8522 self
8523 }
8524
8525 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8527 self.0.options = v.into();
8528 self
8529 }
8530
8531 pub async fn send(self) -> Result<crate::model::Document> {
8533 (*self.0.stub)
8534 .get_document(self.0.request, self.0.options)
8535 .await
8536 .map(crate::Response::into_body)
8537 }
8538
8539 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8543 self.0.request.name = v.into();
8544 self
8545 }
8546 }
8547
8548 #[doc(hidden)]
8549 impl crate::RequestBuilder for GetDocument {
8550 fn request_options(&mut self) -> &mut crate::RequestOptions {
8551 &mut self.0.options
8552 }
8553 }
8554
8555 #[derive(Clone, Debug)]
8573 pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
8574
8575 impl CreateDocument {
8576 pub(crate) fn new(
8577 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8578 ) -> Self {
8579 Self(RequestBuilder::new(stub))
8580 }
8581
8582 pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
8584 self.0.request = v.into();
8585 self
8586 }
8587
8588 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8590 self.0.options = v.into();
8591 self
8592 }
8593
8594 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8601 (*self.0.stub)
8602 .create_document(self.0.request, self.0.options)
8603 .await
8604 .map(crate::Response::into_body)
8605 }
8606
8607 pub fn poller(
8609 self,
8610 ) -> impl google_cloud_lro::Poller<
8611 crate::model::Document,
8612 crate::model::KnowledgeOperationMetadata,
8613 > {
8614 type Operation = google_cloud_lro::internal::Operation<
8615 crate::model::Document,
8616 crate::model::KnowledgeOperationMetadata,
8617 >;
8618 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8619 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8620
8621 let stub = self.0.stub.clone();
8622 let mut options = self.0.options.clone();
8623 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8624 let query = move |name| {
8625 let stub = stub.clone();
8626 let options = options.clone();
8627 async {
8628 let op = GetOperation::new(stub)
8629 .set_name(name)
8630 .with_options(options)
8631 .send()
8632 .await?;
8633 Ok(Operation::new(op))
8634 }
8635 };
8636
8637 let start = move || async {
8638 let op = self.send().await?;
8639 Ok(Operation::new(op))
8640 };
8641
8642 google_cloud_lro::internal::new_poller(
8643 polling_error_policy,
8644 polling_backoff_policy,
8645 start,
8646 query,
8647 )
8648 }
8649
8650 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8654 self.0.request.parent = v.into();
8655 self
8656 }
8657
8658 pub fn set_document<T>(mut self, v: T) -> Self
8662 where
8663 T: std::convert::Into<crate::model::Document>,
8664 {
8665 self.0.request.document = std::option::Option::Some(v.into());
8666 self
8667 }
8668
8669 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
8673 where
8674 T: std::convert::Into<crate::model::Document>,
8675 {
8676 self.0.request.document = v.map(|x| x.into());
8677 self
8678 }
8679 }
8680
8681 #[doc(hidden)]
8682 impl crate::RequestBuilder for CreateDocument {
8683 fn request_options(&mut self) -> &mut crate::RequestOptions {
8684 &mut self.0.options
8685 }
8686 }
8687
8688 #[derive(Clone, Debug)]
8706 pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
8707
8708 impl ImportDocuments {
8709 pub(crate) fn new(
8710 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8711 ) -> Self {
8712 Self(RequestBuilder::new(stub))
8713 }
8714
8715 pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
8717 self.0.request = v.into();
8718 self
8719 }
8720
8721 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8723 self.0.options = v.into();
8724 self
8725 }
8726
8727 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8734 (*self.0.stub)
8735 .import_documents(self.0.request, self.0.options)
8736 .await
8737 .map(crate::Response::into_body)
8738 }
8739
8740 pub fn poller(
8742 self,
8743 ) -> impl google_cloud_lro::Poller<
8744 crate::model::ImportDocumentsResponse,
8745 crate::model::KnowledgeOperationMetadata,
8746 > {
8747 type Operation = google_cloud_lro::internal::Operation<
8748 crate::model::ImportDocumentsResponse,
8749 crate::model::KnowledgeOperationMetadata,
8750 >;
8751 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8752 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8753
8754 let stub = self.0.stub.clone();
8755 let mut options = self.0.options.clone();
8756 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8757 let query = move |name| {
8758 let stub = stub.clone();
8759 let options = options.clone();
8760 async {
8761 let op = GetOperation::new(stub)
8762 .set_name(name)
8763 .with_options(options)
8764 .send()
8765 .await?;
8766 Ok(Operation::new(op))
8767 }
8768 };
8769
8770 let start = move || async {
8771 let op = self.send().await?;
8772 Ok(Operation::new(op))
8773 };
8774
8775 google_cloud_lro::internal::new_poller(
8776 polling_error_policy,
8777 polling_backoff_policy,
8778 start,
8779 query,
8780 )
8781 }
8782
8783 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8787 self.0.request.parent = v.into();
8788 self
8789 }
8790
8791 pub fn set_document_template<T>(mut self, v: T) -> Self
8795 where
8796 T: std::convert::Into<crate::model::ImportDocumentTemplate>,
8797 {
8798 self.0.request.document_template = std::option::Option::Some(v.into());
8799 self
8800 }
8801
8802 pub fn set_or_clear_document_template<T>(mut self, v: std::option::Option<T>) -> Self
8806 where
8807 T: std::convert::Into<crate::model::ImportDocumentTemplate>,
8808 {
8809 self.0.request.document_template = v.map(|x| x.into());
8810 self
8811 }
8812
8813 pub fn set_import_gcs_custom_metadata<T: Into<bool>>(mut self, v: T) -> Self {
8815 self.0.request.import_gcs_custom_metadata = v.into();
8816 self
8817 }
8818
8819 pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
8824 mut self,
8825 v: T,
8826 ) -> Self {
8827 self.0.request.source = v.into();
8828 self
8829 }
8830
8831 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSources>>>(
8837 mut self,
8838 v: T,
8839 ) -> Self {
8840 self.0.request = self.0.request.set_gcs_source(v);
8841 self
8842 }
8843 }
8844
8845 #[doc(hidden)]
8846 impl crate::RequestBuilder for ImportDocuments {
8847 fn request_options(&mut self) -> &mut crate::RequestOptions {
8848 &mut self.0.options
8849 }
8850 }
8851
8852 #[derive(Clone, Debug)]
8870 pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
8871
8872 impl DeleteDocument {
8873 pub(crate) fn new(
8874 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8875 ) -> Self {
8876 Self(RequestBuilder::new(stub))
8877 }
8878
8879 pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
8881 self.0.request = v.into();
8882 self
8883 }
8884
8885 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8887 self.0.options = v.into();
8888 self
8889 }
8890
8891 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8898 (*self.0.stub)
8899 .delete_document(self.0.request, self.0.options)
8900 .await
8901 .map(crate::Response::into_body)
8902 }
8903
8904 pub fn poller(
8906 self,
8907 ) -> impl google_cloud_lro::Poller<(), crate::model::KnowledgeOperationMetadata> {
8908 type Operation = google_cloud_lro::internal::Operation<
8909 wkt::Empty,
8910 crate::model::KnowledgeOperationMetadata,
8911 >;
8912 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8913 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8914
8915 let stub = self.0.stub.clone();
8916 let mut options = self.0.options.clone();
8917 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8918 let query = move |name| {
8919 let stub = stub.clone();
8920 let options = options.clone();
8921 async {
8922 let op = GetOperation::new(stub)
8923 .set_name(name)
8924 .with_options(options)
8925 .send()
8926 .await?;
8927 Ok(Operation::new(op))
8928 }
8929 };
8930
8931 let start = move || async {
8932 let op = self.send().await?;
8933 Ok(Operation::new(op))
8934 };
8935
8936 google_cloud_lro::internal::new_unit_response_poller(
8937 polling_error_policy,
8938 polling_backoff_policy,
8939 start,
8940 query,
8941 )
8942 }
8943
8944 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8948 self.0.request.name = v.into();
8949 self
8950 }
8951 }
8952
8953 #[doc(hidden)]
8954 impl crate::RequestBuilder for DeleteDocument {
8955 fn request_options(&mut self) -> &mut crate::RequestOptions {
8956 &mut self.0.options
8957 }
8958 }
8959
8960 #[derive(Clone, Debug)]
8978 pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
8979
8980 impl UpdateDocument {
8981 pub(crate) fn new(
8982 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8983 ) -> Self {
8984 Self(RequestBuilder::new(stub))
8985 }
8986
8987 pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
8989 self.0.request = v.into();
8990 self
8991 }
8992
8993 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8995 self.0.options = v.into();
8996 self
8997 }
8998
8999 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9006 (*self.0.stub)
9007 .update_document(self.0.request, self.0.options)
9008 .await
9009 .map(crate::Response::into_body)
9010 }
9011
9012 pub fn poller(
9014 self,
9015 ) -> impl google_cloud_lro::Poller<
9016 crate::model::Document,
9017 crate::model::KnowledgeOperationMetadata,
9018 > {
9019 type Operation = google_cloud_lro::internal::Operation<
9020 crate::model::Document,
9021 crate::model::KnowledgeOperationMetadata,
9022 >;
9023 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9024 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9025
9026 let stub = self.0.stub.clone();
9027 let mut options = self.0.options.clone();
9028 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9029 let query = move |name| {
9030 let stub = stub.clone();
9031 let options = options.clone();
9032 async {
9033 let op = GetOperation::new(stub)
9034 .set_name(name)
9035 .with_options(options)
9036 .send()
9037 .await?;
9038 Ok(Operation::new(op))
9039 }
9040 };
9041
9042 let start = move || async {
9043 let op = self.send().await?;
9044 Ok(Operation::new(op))
9045 };
9046
9047 google_cloud_lro::internal::new_poller(
9048 polling_error_policy,
9049 polling_backoff_policy,
9050 start,
9051 query,
9052 )
9053 }
9054
9055 pub fn set_document<T>(mut self, v: T) -> Self
9059 where
9060 T: std::convert::Into<crate::model::Document>,
9061 {
9062 self.0.request.document = std::option::Option::Some(v.into());
9063 self
9064 }
9065
9066 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
9070 where
9071 T: std::convert::Into<crate::model::Document>,
9072 {
9073 self.0.request.document = v.map(|x| x.into());
9074 self
9075 }
9076
9077 pub fn set_update_mask<T>(mut self, v: T) -> Self
9079 where
9080 T: std::convert::Into<wkt::FieldMask>,
9081 {
9082 self.0.request.update_mask = std::option::Option::Some(v.into());
9083 self
9084 }
9085
9086 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9088 where
9089 T: std::convert::Into<wkt::FieldMask>,
9090 {
9091 self.0.request.update_mask = v.map(|x| x.into());
9092 self
9093 }
9094 }
9095
9096 #[doc(hidden)]
9097 impl crate::RequestBuilder for UpdateDocument {
9098 fn request_options(&mut self) -> &mut crate::RequestOptions {
9099 &mut self.0.options
9100 }
9101 }
9102
9103 #[derive(Clone, Debug)]
9121 pub struct ReloadDocument(RequestBuilder<crate::model::ReloadDocumentRequest>);
9122
9123 impl ReloadDocument {
9124 pub(crate) fn new(
9125 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9126 ) -> Self {
9127 Self(RequestBuilder::new(stub))
9128 }
9129
9130 pub fn with_request<V: Into<crate::model::ReloadDocumentRequest>>(mut self, v: V) -> Self {
9132 self.0.request = v.into();
9133 self
9134 }
9135
9136 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9138 self.0.options = v.into();
9139 self
9140 }
9141
9142 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9149 (*self.0.stub)
9150 .reload_document(self.0.request, self.0.options)
9151 .await
9152 .map(crate::Response::into_body)
9153 }
9154
9155 pub fn poller(
9157 self,
9158 ) -> impl google_cloud_lro::Poller<
9159 crate::model::Document,
9160 crate::model::KnowledgeOperationMetadata,
9161 > {
9162 type Operation = google_cloud_lro::internal::Operation<
9163 crate::model::Document,
9164 crate::model::KnowledgeOperationMetadata,
9165 >;
9166 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9167 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9168
9169 let stub = self.0.stub.clone();
9170 let mut options = self.0.options.clone();
9171 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9172 let query = move |name| {
9173 let stub = stub.clone();
9174 let options = options.clone();
9175 async {
9176 let op = GetOperation::new(stub)
9177 .set_name(name)
9178 .with_options(options)
9179 .send()
9180 .await?;
9181 Ok(Operation::new(op))
9182 }
9183 };
9184
9185 let start = move || async {
9186 let op = self.send().await?;
9187 Ok(Operation::new(op))
9188 };
9189
9190 google_cloud_lro::internal::new_poller(
9191 polling_error_policy,
9192 polling_backoff_policy,
9193 start,
9194 query,
9195 )
9196 }
9197
9198 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9202 self.0.request.name = v.into();
9203 self
9204 }
9205
9206 pub fn set_import_gcs_custom_metadata<T: Into<bool>>(mut self, v: T) -> Self {
9208 self.0.request.import_gcs_custom_metadata = v.into();
9209 self
9210 }
9211
9212 pub fn set_smart_messaging_partial_update<T: Into<bool>>(mut self, v: T) -> Self {
9214 self.0.request.smart_messaging_partial_update = v.into();
9215 self
9216 }
9217
9218 pub fn set_source<T: Into<Option<crate::model::reload_document_request::Source>>>(
9223 mut self,
9224 v: T,
9225 ) -> Self {
9226 self.0.request.source = v.into();
9227 self
9228 }
9229
9230 pub fn set_content_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9236 self.0.request = self.0.request.set_content_uri(v);
9237 self
9238 }
9239 }
9240
9241 #[doc(hidden)]
9242 impl crate::RequestBuilder for ReloadDocument {
9243 fn request_options(&mut self) -> &mut crate::RequestOptions {
9244 &mut self.0.options
9245 }
9246 }
9247
9248 #[derive(Clone, Debug)]
9266 pub struct ExportDocument(RequestBuilder<crate::model::ExportDocumentRequest>);
9267
9268 impl ExportDocument {
9269 pub(crate) fn new(
9270 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9271 ) -> Self {
9272 Self(RequestBuilder::new(stub))
9273 }
9274
9275 pub fn with_request<V: Into<crate::model::ExportDocumentRequest>>(mut self, v: V) -> Self {
9277 self.0.request = v.into();
9278 self
9279 }
9280
9281 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9283 self.0.options = v.into();
9284 self
9285 }
9286
9287 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9294 (*self.0.stub)
9295 .export_document(self.0.request, self.0.options)
9296 .await
9297 .map(crate::Response::into_body)
9298 }
9299
9300 pub fn poller(
9302 self,
9303 ) -> impl google_cloud_lro::Poller<
9304 crate::model::Document,
9305 crate::model::KnowledgeOperationMetadata,
9306 > {
9307 type Operation = google_cloud_lro::internal::Operation<
9308 crate::model::Document,
9309 crate::model::KnowledgeOperationMetadata,
9310 >;
9311 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9312 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9313
9314 let stub = self.0.stub.clone();
9315 let mut options = self.0.options.clone();
9316 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9317 let query = move |name| {
9318 let stub = stub.clone();
9319 let options = options.clone();
9320 async {
9321 let op = GetOperation::new(stub)
9322 .set_name(name)
9323 .with_options(options)
9324 .send()
9325 .await?;
9326 Ok(Operation::new(op))
9327 }
9328 };
9329
9330 let start = move || async {
9331 let op = self.send().await?;
9332 Ok(Operation::new(op))
9333 };
9334
9335 google_cloud_lro::internal::new_poller(
9336 polling_error_policy,
9337 polling_backoff_policy,
9338 start,
9339 query,
9340 )
9341 }
9342
9343 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9347 self.0.request.name = v.into();
9348 self
9349 }
9350
9351 pub fn set_export_full_content<T: Into<bool>>(mut self, v: T) -> Self {
9353 self.0.request.export_full_content = v.into();
9354 self
9355 }
9356
9357 pub fn set_smart_messaging_partial_update<T: Into<bool>>(mut self, v: T) -> Self {
9359 self.0.request.smart_messaging_partial_update = v.into();
9360 self
9361 }
9362
9363 pub fn set_destination<
9368 T: Into<Option<crate::model::export_document_request::Destination>>,
9369 >(
9370 mut self,
9371 v: T,
9372 ) -> Self {
9373 self.0.request.destination = v.into();
9374 self
9375 }
9376
9377 pub fn set_gcs_destination<
9383 T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
9384 >(
9385 mut self,
9386 v: T,
9387 ) -> Self {
9388 self.0.request = self.0.request.set_gcs_destination(v);
9389 self
9390 }
9391 }
9392
9393 #[doc(hidden)]
9394 impl crate::RequestBuilder for ExportDocument {
9395 fn request_options(&mut self) -> &mut crate::RequestOptions {
9396 &mut self.0.options
9397 }
9398 }
9399
9400 #[derive(Clone, Debug)]
9421 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
9422
9423 impl ListLocations {
9424 pub(crate) fn new(
9425 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9426 ) -> Self {
9427 Self(RequestBuilder::new(stub))
9428 }
9429
9430 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
9432 mut self,
9433 v: V,
9434 ) -> Self {
9435 self.0.request = v.into();
9436 self
9437 }
9438
9439 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9441 self.0.options = v.into();
9442 self
9443 }
9444
9445 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
9447 (*self.0.stub)
9448 .list_locations(self.0.request, self.0.options)
9449 .await
9450 .map(crate::Response::into_body)
9451 }
9452
9453 pub fn by_page(
9455 self,
9456 ) -> impl google_cloud_gax::paginator::Paginator<
9457 google_cloud_location::model::ListLocationsResponse,
9458 crate::Error,
9459 > {
9460 use std::clone::Clone;
9461 let token = self.0.request.page_token.clone();
9462 let execute = move |token: String| {
9463 let mut builder = self.clone();
9464 builder.0.request = builder.0.request.set_page_token(token);
9465 builder.send()
9466 };
9467 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9468 }
9469
9470 pub fn by_item(
9472 self,
9473 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9474 google_cloud_location::model::ListLocationsResponse,
9475 crate::Error,
9476 > {
9477 use google_cloud_gax::paginator::Paginator;
9478 self.by_page().items()
9479 }
9480
9481 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9483 self.0.request.name = v.into();
9484 self
9485 }
9486
9487 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9489 self.0.request.filter = v.into();
9490 self
9491 }
9492
9493 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9495 self.0.request.page_size = v.into();
9496 self
9497 }
9498
9499 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9501 self.0.request.page_token = v.into();
9502 self
9503 }
9504 }
9505
9506 #[doc(hidden)]
9507 impl crate::RequestBuilder for ListLocations {
9508 fn request_options(&mut self) -> &mut crate::RequestOptions {
9509 &mut self.0.options
9510 }
9511 }
9512
9513 #[derive(Clone, Debug)]
9530 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
9531
9532 impl GetLocation {
9533 pub(crate) fn new(
9534 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9535 ) -> Self {
9536 Self(RequestBuilder::new(stub))
9537 }
9538
9539 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
9541 mut self,
9542 v: V,
9543 ) -> Self {
9544 self.0.request = v.into();
9545 self
9546 }
9547
9548 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9550 self.0.options = v.into();
9551 self
9552 }
9553
9554 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
9556 (*self.0.stub)
9557 .get_location(self.0.request, self.0.options)
9558 .await
9559 .map(crate::Response::into_body)
9560 }
9561
9562 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9564 self.0.request.name = v.into();
9565 self
9566 }
9567 }
9568
9569 #[doc(hidden)]
9570 impl crate::RequestBuilder for GetLocation {
9571 fn request_options(&mut self) -> &mut crate::RequestOptions {
9572 &mut self.0.options
9573 }
9574 }
9575
9576 #[derive(Clone, Debug)]
9597 pub struct ListOperations(
9598 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9599 );
9600
9601 impl ListOperations {
9602 pub(crate) fn new(
9603 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9604 ) -> Self {
9605 Self(RequestBuilder::new(stub))
9606 }
9607
9608 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9610 mut self,
9611 v: V,
9612 ) -> Self {
9613 self.0.request = v.into();
9614 self
9615 }
9616
9617 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9619 self.0.options = v.into();
9620 self
9621 }
9622
9623 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9625 (*self.0.stub)
9626 .list_operations(self.0.request, self.0.options)
9627 .await
9628 .map(crate::Response::into_body)
9629 }
9630
9631 pub fn by_page(
9633 self,
9634 ) -> impl google_cloud_gax::paginator::Paginator<
9635 google_cloud_longrunning::model::ListOperationsResponse,
9636 crate::Error,
9637 > {
9638 use std::clone::Clone;
9639 let token = self.0.request.page_token.clone();
9640 let execute = move |token: String| {
9641 let mut builder = self.clone();
9642 builder.0.request = builder.0.request.set_page_token(token);
9643 builder.send()
9644 };
9645 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9646 }
9647
9648 pub fn by_item(
9650 self,
9651 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9652 google_cloud_longrunning::model::ListOperationsResponse,
9653 crate::Error,
9654 > {
9655 use google_cloud_gax::paginator::Paginator;
9656 self.by_page().items()
9657 }
9658
9659 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9661 self.0.request.name = v.into();
9662 self
9663 }
9664
9665 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9667 self.0.request.filter = v.into();
9668 self
9669 }
9670
9671 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9673 self.0.request.page_size = v.into();
9674 self
9675 }
9676
9677 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9679 self.0.request.page_token = v.into();
9680 self
9681 }
9682
9683 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9685 self.0.request.return_partial_success = v.into();
9686 self
9687 }
9688 }
9689
9690 #[doc(hidden)]
9691 impl crate::RequestBuilder for ListOperations {
9692 fn request_options(&mut self) -> &mut crate::RequestOptions {
9693 &mut self.0.options
9694 }
9695 }
9696
9697 #[derive(Clone, Debug)]
9714 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9715
9716 impl GetOperation {
9717 pub(crate) fn new(
9718 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9719 ) -> Self {
9720 Self(RequestBuilder::new(stub))
9721 }
9722
9723 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9725 mut self,
9726 v: V,
9727 ) -> Self {
9728 self.0.request = v.into();
9729 self
9730 }
9731
9732 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9734 self.0.options = v.into();
9735 self
9736 }
9737
9738 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9740 (*self.0.stub)
9741 .get_operation(self.0.request, self.0.options)
9742 .await
9743 .map(crate::Response::into_body)
9744 }
9745
9746 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9748 self.0.request.name = v.into();
9749 self
9750 }
9751 }
9752
9753 #[doc(hidden)]
9754 impl crate::RequestBuilder for GetOperation {
9755 fn request_options(&mut self) -> &mut crate::RequestOptions {
9756 &mut self.0.options
9757 }
9758 }
9759
9760 #[derive(Clone, Debug)]
9777 pub struct CancelOperation(
9778 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9779 );
9780
9781 impl CancelOperation {
9782 pub(crate) fn new(
9783 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9784 ) -> Self {
9785 Self(RequestBuilder::new(stub))
9786 }
9787
9788 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9790 mut self,
9791 v: V,
9792 ) -> Self {
9793 self.0.request = v.into();
9794 self
9795 }
9796
9797 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9799 self.0.options = v.into();
9800 self
9801 }
9802
9803 pub async fn send(self) -> Result<()> {
9805 (*self.0.stub)
9806 .cancel_operation(self.0.request, self.0.options)
9807 .await
9808 .map(crate::Response::into_body)
9809 }
9810
9811 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9813 self.0.request.name = v.into();
9814 self
9815 }
9816 }
9817
9818 #[doc(hidden)]
9819 impl crate::RequestBuilder for CancelOperation {
9820 fn request_options(&mut self) -> &mut crate::RequestOptions {
9821 &mut self.0.options
9822 }
9823 }
9824}
9825
9826#[cfg(feature = "encryption-spec-service")]
9827#[cfg_attr(docsrs, doc(cfg(feature = "encryption-spec-service")))]
9828pub mod encryption_spec_service {
9829 use crate::Result;
9830
9831 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9845
9846 pub(crate) mod client {
9847 use super::super::super::client::EncryptionSpecService;
9848 pub struct Factory;
9849 impl crate::ClientFactory for Factory {
9850 type Client = EncryptionSpecService;
9851 type Credentials = gaxi::options::Credentials;
9852 async fn build(
9853 self,
9854 config: gaxi::options::ClientConfig,
9855 ) -> crate::ClientBuilderResult<Self::Client> {
9856 Self::Client::new(config).await
9857 }
9858 }
9859 }
9860
9861 #[derive(Clone, Debug)]
9863 pub(crate) struct RequestBuilder<R: std::default::Default> {
9864 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9865 request: R,
9866 options: crate::RequestOptions,
9867 }
9868
9869 impl<R> RequestBuilder<R>
9870 where
9871 R: std::default::Default,
9872 {
9873 pub(crate) fn new(
9874 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9875 ) -> Self {
9876 Self {
9877 stub,
9878 request: R::default(),
9879 options: crate::RequestOptions::default(),
9880 }
9881 }
9882 }
9883
9884 #[derive(Clone, Debug)]
9901 pub struct GetEncryptionSpec(RequestBuilder<crate::model::GetEncryptionSpecRequest>);
9902
9903 impl GetEncryptionSpec {
9904 pub(crate) fn new(
9905 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9906 ) -> Self {
9907 Self(RequestBuilder::new(stub))
9908 }
9909
9910 pub fn with_request<V: Into<crate::model::GetEncryptionSpecRequest>>(
9912 mut self,
9913 v: V,
9914 ) -> Self {
9915 self.0.request = v.into();
9916 self
9917 }
9918
9919 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9921 self.0.options = v.into();
9922 self
9923 }
9924
9925 pub async fn send(self) -> Result<crate::model::EncryptionSpec> {
9927 (*self.0.stub)
9928 .get_encryption_spec(self.0.request, self.0.options)
9929 .await
9930 .map(crate::Response::into_body)
9931 }
9932
9933 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9937 self.0.request.name = v.into();
9938 self
9939 }
9940 }
9941
9942 #[doc(hidden)]
9943 impl crate::RequestBuilder for GetEncryptionSpec {
9944 fn request_options(&mut self) -> &mut crate::RequestOptions {
9945 &mut self.0.options
9946 }
9947 }
9948
9949 #[derive(Clone, Debug)]
9967 pub struct InitializeEncryptionSpec(
9968 RequestBuilder<crate::model::InitializeEncryptionSpecRequest>,
9969 );
9970
9971 impl InitializeEncryptionSpec {
9972 pub(crate) fn new(
9973 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9974 ) -> Self {
9975 Self(RequestBuilder::new(stub))
9976 }
9977
9978 pub fn with_request<V: Into<crate::model::InitializeEncryptionSpecRequest>>(
9980 mut self,
9981 v: V,
9982 ) -> Self {
9983 self.0.request = v.into();
9984 self
9985 }
9986
9987 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9989 self.0.options = v.into();
9990 self
9991 }
9992
9993 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10000 (*self.0.stub)
10001 .initialize_encryption_spec(self.0.request, self.0.options)
10002 .await
10003 .map(crate::Response::into_body)
10004 }
10005
10006 pub fn poller(
10008 self,
10009 ) -> impl google_cloud_lro::Poller<
10010 crate::model::InitializeEncryptionSpecResponse,
10011 crate::model::InitializeEncryptionSpecMetadata,
10012 > {
10013 type Operation = google_cloud_lro::internal::Operation<
10014 crate::model::InitializeEncryptionSpecResponse,
10015 crate::model::InitializeEncryptionSpecMetadata,
10016 >;
10017 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10018 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10019
10020 let stub = self.0.stub.clone();
10021 let mut options = self.0.options.clone();
10022 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10023 let query = move |name| {
10024 let stub = stub.clone();
10025 let options = options.clone();
10026 async {
10027 let op = GetOperation::new(stub)
10028 .set_name(name)
10029 .with_options(options)
10030 .send()
10031 .await?;
10032 Ok(Operation::new(op))
10033 }
10034 };
10035
10036 let start = move || async {
10037 let op = self.send().await?;
10038 Ok(Operation::new(op))
10039 };
10040
10041 google_cloud_lro::internal::new_poller(
10042 polling_error_policy,
10043 polling_backoff_policy,
10044 start,
10045 query,
10046 )
10047 }
10048
10049 pub fn set_encryption_spec<T>(mut self, v: T) -> Self
10053 where
10054 T: std::convert::Into<crate::model::EncryptionSpec>,
10055 {
10056 self.0.request.encryption_spec = std::option::Option::Some(v.into());
10057 self
10058 }
10059
10060 pub fn set_or_clear_encryption_spec<T>(mut self, v: std::option::Option<T>) -> Self
10064 where
10065 T: std::convert::Into<crate::model::EncryptionSpec>,
10066 {
10067 self.0.request.encryption_spec = v.map(|x| x.into());
10068 self
10069 }
10070 }
10071
10072 #[doc(hidden)]
10073 impl crate::RequestBuilder for InitializeEncryptionSpec {
10074 fn request_options(&mut self) -> &mut crate::RequestOptions {
10075 &mut self.0.options
10076 }
10077 }
10078
10079 #[derive(Clone, Debug)]
10100 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
10101
10102 impl ListLocations {
10103 pub(crate) fn new(
10104 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10105 ) -> Self {
10106 Self(RequestBuilder::new(stub))
10107 }
10108
10109 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
10111 mut self,
10112 v: V,
10113 ) -> Self {
10114 self.0.request = v.into();
10115 self
10116 }
10117
10118 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10120 self.0.options = v.into();
10121 self
10122 }
10123
10124 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
10126 (*self.0.stub)
10127 .list_locations(self.0.request, self.0.options)
10128 .await
10129 .map(crate::Response::into_body)
10130 }
10131
10132 pub fn by_page(
10134 self,
10135 ) -> impl google_cloud_gax::paginator::Paginator<
10136 google_cloud_location::model::ListLocationsResponse,
10137 crate::Error,
10138 > {
10139 use std::clone::Clone;
10140 let token = self.0.request.page_token.clone();
10141 let execute = move |token: String| {
10142 let mut builder = self.clone();
10143 builder.0.request = builder.0.request.set_page_token(token);
10144 builder.send()
10145 };
10146 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10147 }
10148
10149 pub fn by_item(
10151 self,
10152 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10153 google_cloud_location::model::ListLocationsResponse,
10154 crate::Error,
10155 > {
10156 use google_cloud_gax::paginator::Paginator;
10157 self.by_page().items()
10158 }
10159
10160 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10162 self.0.request.name = v.into();
10163 self
10164 }
10165
10166 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10168 self.0.request.filter = v.into();
10169 self
10170 }
10171
10172 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10174 self.0.request.page_size = v.into();
10175 self
10176 }
10177
10178 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10180 self.0.request.page_token = v.into();
10181 self
10182 }
10183 }
10184
10185 #[doc(hidden)]
10186 impl crate::RequestBuilder for ListLocations {
10187 fn request_options(&mut self) -> &mut crate::RequestOptions {
10188 &mut self.0.options
10189 }
10190 }
10191
10192 #[derive(Clone, Debug)]
10209 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
10210
10211 impl GetLocation {
10212 pub(crate) fn new(
10213 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10214 ) -> Self {
10215 Self(RequestBuilder::new(stub))
10216 }
10217
10218 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
10220 mut self,
10221 v: V,
10222 ) -> Self {
10223 self.0.request = v.into();
10224 self
10225 }
10226
10227 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10229 self.0.options = v.into();
10230 self
10231 }
10232
10233 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
10235 (*self.0.stub)
10236 .get_location(self.0.request, self.0.options)
10237 .await
10238 .map(crate::Response::into_body)
10239 }
10240
10241 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10243 self.0.request.name = v.into();
10244 self
10245 }
10246 }
10247
10248 #[doc(hidden)]
10249 impl crate::RequestBuilder for GetLocation {
10250 fn request_options(&mut self) -> &mut crate::RequestOptions {
10251 &mut self.0.options
10252 }
10253 }
10254
10255 #[derive(Clone, Debug)]
10276 pub struct ListOperations(
10277 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10278 );
10279
10280 impl ListOperations {
10281 pub(crate) fn new(
10282 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10283 ) -> Self {
10284 Self(RequestBuilder::new(stub))
10285 }
10286
10287 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
10289 mut self,
10290 v: V,
10291 ) -> Self {
10292 self.0.request = v.into();
10293 self
10294 }
10295
10296 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10298 self.0.options = v.into();
10299 self
10300 }
10301
10302 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
10304 (*self.0.stub)
10305 .list_operations(self.0.request, self.0.options)
10306 .await
10307 .map(crate::Response::into_body)
10308 }
10309
10310 pub fn by_page(
10312 self,
10313 ) -> impl google_cloud_gax::paginator::Paginator<
10314 google_cloud_longrunning::model::ListOperationsResponse,
10315 crate::Error,
10316 > {
10317 use std::clone::Clone;
10318 let token = self.0.request.page_token.clone();
10319 let execute = move |token: String| {
10320 let mut builder = self.clone();
10321 builder.0.request = builder.0.request.set_page_token(token);
10322 builder.send()
10323 };
10324 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10325 }
10326
10327 pub fn by_item(
10329 self,
10330 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10331 google_cloud_longrunning::model::ListOperationsResponse,
10332 crate::Error,
10333 > {
10334 use google_cloud_gax::paginator::Paginator;
10335 self.by_page().items()
10336 }
10337
10338 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10340 self.0.request.name = v.into();
10341 self
10342 }
10343
10344 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10346 self.0.request.filter = v.into();
10347 self
10348 }
10349
10350 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10352 self.0.request.page_size = v.into();
10353 self
10354 }
10355
10356 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10358 self.0.request.page_token = v.into();
10359 self
10360 }
10361
10362 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10364 self.0.request.return_partial_success = v.into();
10365 self
10366 }
10367 }
10368
10369 #[doc(hidden)]
10370 impl crate::RequestBuilder for ListOperations {
10371 fn request_options(&mut self) -> &mut crate::RequestOptions {
10372 &mut self.0.options
10373 }
10374 }
10375
10376 #[derive(Clone, Debug)]
10393 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10394
10395 impl GetOperation {
10396 pub(crate) fn new(
10397 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10398 ) -> Self {
10399 Self(RequestBuilder::new(stub))
10400 }
10401
10402 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10404 mut self,
10405 v: V,
10406 ) -> Self {
10407 self.0.request = v.into();
10408 self
10409 }
10410
10411 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10413 self.0.options = v.into();
10414 self
10415 }
10416
10417 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10419 (*self.0.stub)
10420 .get_operation(self.0.request, self.0.options)
10421 .await
10422 .map(crate::Response::into_body)
10423 }
10424
10425 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10427 self.0.request.name = v.into();
10428 self
10429 }
10430 }
10431
10432 #[doc(hidden)]
10433 impl crate::RequestBuilder for GetOperation {
10434 fn request_options(&mut self) -> &mut crate::RequestOptions {
10435 &mut self.0.options
10436 }
10437 }
10438
10439 #[derive(Clone, Debug)]
10456 pub struct CancelOperation(
10457 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10458 );
10459
10460 impl CancelOperation {
10461 pub(crate) fn new(
10462 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10463 ) -> Self {
10464 Self(RequestBuilder::new(stub))
10465 }
10466
10467 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10469 mut self,
10470 v: V,
10471 ) -> Self {
10472 self.0.request = v.into();
10473 self
10474 }
10475
10476 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10478 self.0.options = v.into();
10479 self
10480 }
10481
10482 pub async fn send(self) -> Result<()> {
10484 (*self.0.stub)
10485 .cancel_operation(self.0.request, self.0.options)
10486 .await
10487 .map(crate::Response::into_body)
10488 }
10489
10490 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10492 self.0.request.name = v.into();
10493 self
10494 }
10495 }
10496
10497 #[doc(hidden)]
10498 impl crate::RequestBuilder for CancelOperation {
10499 fn request_options(&mut self) -> &mut crate::RequestOptions {
10500 &mut self.0.options
10501 }
10502 }
10503}
10504
10505#[cfg(feature = "entity-types")]
10506#[cfg_attr(docsrs, doc(cfg(feature = "entity-types")))]
10507pub mod entity_types {
10508 use crate::Result;
10509
10510 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10524
10525 pub(crate) mod client {
10526 use super::super::super::client::EntityTypes;
10527 pub struct Factory;
10528 impl crate::ClientFactory for Factory {
10529 type Client = EntityTypes;
10530 type Credentials = gaxi::options::Credentials;
10531 async fn build(
10532 self,
10533 config: gaxi::options::ClientConfig,
10534 ) -> crate::ClientBuilderResult<Self::Client> {
10535 Self::Client::new(config).await
10536 }
10537 }
10538 }
10539
10540 #[derive(Clone, Debug)]
10542 pub(crate) struct RequestBuilder<R: std::default::Default> {
10543 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10544 request: R,
10545 options: crate::RequestOptions,
10546 }
10547
10548 impl<R> RequestBuilder<R>
10549 where
10550 R: std::default::Default,
10551 {
10552 pub(crate) fn new(
10553 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10554 ) -> Self {
10555 Self {
10556 stub,
10557 request: R::default(),
10558 options: crate::RequestOptions::default(),
10559 }
10560 }
10561 }
10562
10563 #[derive(Clone, Debug)]
10584 pub struct ListEntityTypes(RequestBuilder<crate::model::ListEntityTypesRequest>);
10585
10586 impl ListEntityTypes {
10587 pub(crate) fn new(
10588 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10589 ) -> Self {
10590 Self(RequestBuilder::new(stub))
10591 }
10592
10593 pub fn with_request<V: Into<crate::model::ListEntityTypesRequest>>(mut self, v: V) -> Self {
10595 self.0.request = v.into();
10596 self
10597 }
10598
10599 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10601 self.0.options = v.into();
10602 self
10603 }
10604
10605 pub async fn send(self) -> Result<crate::model::ListEntityTypesResponse> {
10607 (*self.0.stub)
10608 .list_entity_types(self.0.request, self.0.options)
10609 .await
10610 .map(crate::Response::into_body)
10611 }
10612
10613 pub fn by_page(
10615 self,
10616 ) -> impl google_cloud_gax::paginator::Paginator<
10617 crate::model::ListEntityTypesResponse,
10618 crate::Error,
10619 > {
10620 use std::clone::Clone;
10621 let token = self.0.request.page_token.clone();
10622 let execute = move |token: String| {
10623 let mut builder = self.clone();
10624 builder.0.request = builder.0.request.set_page_token(token);
10625 builder.send()
10626 };
10627 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10628 }
10629
10630 pub fn by_item(
10632 self,
10633 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10634 crate::model::ListEntityTypesResponse,
10635 crate::Error,
10636 > {
10637 use google_cloud_gax::paginator::Paginator;
10638 self.by_page().items()
10639 }
10640
10641 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10645 self.0.request.parent = v.into();
10646 self
10647 }
10648
10649 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10651 self.0.request.language_code = v.into();
10652 self
10653 }
10654
10655 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10657 self.0.request.page_size = v.into();
10658 self
10659 }
10660
10661 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10663 self.0.request.page_token = v.into();
10664 self
10665 }
10666 }
10667
10668 #[doc(hidden)]
10669 impl crate::RequestBuilder for ListEntityTypes {
10670 fn request_options(&mut self) -> &mut crate::RequestOptions {
10671 &mut self.0.options
10672 }
10673 }
10674
10675 #[derive(Clone, Debug)]
10692 pub struct GetEntityType(RequestBuilder<crate::model::GetEntityTypeRequest>);
10693
10694 impl GetEntityType {
10695 pub(crate) fn new(
10696 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10697 ) -> Self {
10698 Self(RequestBuilder::new(stub))
10699 }
10700
10701 pub fn with_request<V: Into<crate::model::GetEntityTypeRequest>>(mut self, v: V) -> Self {
10703 self.0.request = v.into();
10704 self
10705 }
10706
10707 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10709 self.0.options = v.into();
10710 self
10711 }
10712
10713 pub async fn send(self) -> Result<crate::model::EntityType> {
10715 (*self.0.stub)
10716 .get_entity_type(self.0.request, self.0.options)
10717 .await
10718 .map(crate::Response::into_body)
10719 }
10720
10721 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10725 self.0.request.name = v.into();
10726 self
10727 }
10728
10729 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10731 self.0.request.language_code = v.into();
10732 self
10733 }
10734 }
10735
10736 #[doc(hidden)]
10737 impl crate::RequestBuilder for GetEntityType {
10738 fn request_options(&mut self) -> &mut crate::RequestOptions {
10739 &mut self.0.options
10740 }
10741 }
10742
10743 #[derive(Clone, Debug)]
10760 pub struct CreateEntityType(RequestBuilder<crate::model::CreateEntityTypeRequest>);
10761
10762 impl CreateEntityType {
10763 pub(crate) fn new(
10764 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10765 ) -> Self {
10766 Self(RequestBuilder::new(stub))
10767 }
10768
10769 pub fn with_request<V: Into<crate::model::CreateEntityTypeRequest>>(
10771 mut self,
10772 v: V,
10773 ) -> Self {
10774 self.0.request = v.into();
10775 self
10776 }
10777
10778 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10780 self.0.options = v.into();
10781 self
10782 }
10783
10784 pub async fn send(self) -> Result<crate::model::EntityType> {
10786 (*self.0.stub)
10787 .create_entity_type(self.0.request, self.0.options)
10788 .await
10789 .map(crate::Response::into_body)
10790 }
10791
10792 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10796 self.0.request.parent = v.into();
10797 self
10798 }
10799
10800 pub fn set_entity_type<T>(mut self, v: T) -> Self
10804 where
10805 T: std::convert::Into<crate::model::EntityType>,
10806 {
10807 self.0.request.entity_type = std::option::Option::Some(v.into());
10808 self
10809 }
10810
10811 pub fn set_or_clear_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
10815 where
10816 T: std::convert::Into<crate::model::EntityType>,
10817 {
10818 self.0.request.entity_type = v.map(|x| x.into());
10819 self
10820 }
10821
10822 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10824 self.0.request.language_code = v.into();
10825 self
10826 }
10827 }
10828
10829 #[doc(hidden)]
10830 impl crate::RequestBuilder for CreateEntityType {
10831 fn request_options(&mut self) -> &mut crate::RequestOptions {
10832 &mut self.0.options
10833 }
10834 }
10835
10836 #[derive(Clone, Debug)]
10853 pub struct UpdateEntityType(RequestBuilder<crate::model::UpdateEntityTypeRequest>);
10854
10855 impl UpdateEntityType {
10856 pub(crate) fn new(
10857 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10858 ) -> Self {
10859 Self(RequestBuilder::new(stub))
10860 }
10861
10862 pub fn with_request<V: Into<crate::model::UpdateEntityTypeRequest>>(
10864 mut self,
10865 v: V,
10866 ) -> Self {
10867 self.0.request = v.into();
10868 self
10869 }
10870
10871 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10873 self.0.options = v.into();
10874 self
10875 }
10876
10877 pub async fn send(self) -> Result<crate::model::EntityType> {
10879 (*self.0.stub)
10880 .update_entity_type(self.0.request, self.0.options)
10881 .await
10882 .map(crate::Response::into_body)
10883 }
10884
10885 pub fn set_entity_type<T>(mut self, v: T) -> Self
10889 where
10890 T: std::convert::Into<crate::model::EntityType>,
10891 {
10892 self.0.request.entity_type = std::option::Option::Some(v.into());
10893 self
10894 }
10895
10896 pub fn set_or_clear_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
10900 where
10901 T: std::convert::Into<crate::model::EntityType>,
10902 {
10903 self.0.request.entity_type = v.map(|x| x.into());
10904 self
10905 }
10906
10907 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10909 self.0.request.language_code = v.into();
10910 self
10911 }
10912
10913 pub fn set_update_mask<T>(mut self, v: T) -> Self
10915 where
10916 T: std::convert::Into<wkt::FieldMask>,
10917 {
10918 self.0.request.update_mask = std::option::Option::Some(v.into());
10919 self
10920 }
10921
10922 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10924 where
10925 T: std::convert::Into<wkt::FieldMask>,
10926 {
10927 self.0.request.update_mask = v.map(|x| x.into());
10928 self
10929 }
10930 }
10931
10932 #[doc(hidden)]
10933 impl crate::RequestBuilder for UpdateEntityType {
10934 fn request_options(&mut self) -> &mut crate::RequestOptions {
10935 &mut self.0.options
10936 }
10937 }
10938
10939 #[derive(Clone, Debug)]
10956 pub struct DeleteEntityType(RequestBuilder<crate::model::DeleteEntityTypeRequest>);
10957
10958 impl DeleteEntityType {
10959 pub(crate) fn new(
10960 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10961 ) -> Self {
10962 Self(RequestBuilder::new(stub))
10963 }
10964
10965 pub fn with_request<V: Into<crate::model::DeleteEntityTypeRequest>>(
10967 mut self,
10968 v: V,
10969 ) -> Self {
10970 self.0.request = v.into();
10971 self
10972 }
10973
10974 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10976 self.0.options = v.into();
10977 self
10978 }
10979
10980 pub async fn send(self) -> Result<()> {
10982 (*self.0.stub)
10983 .delete_entity_type(self.0.request, self.0.options)
10984 .await
10985 .map(crate::Response::into_body)
10986 }
10987
10988 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10992 self.0.request.name = v.into();
10993 self
10994 }
10995 }
10996
10997 #[doc(hidden)]
10998 impl crate::RequestBuilder for DeleteEntityType {
10999 fn request_options(&mut self) -> &mut crate::RequestOptions {
11000 &mut self.0.options
11001 }
11002 }
11003
11004 #[derive(Clone, Debug)]
11022 pub struct BatchUpdateEntityTypes(RequestBuilder<crate::model::BatchUpdateEntityTypesRequest>);
11023
11024 impl BatchUpdateEntityTypes {
11025 pub(crate) fn new(
11026 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11027 ) -> Self {
11028 Self(RequestBuilder::new(stub))
11029 }
11030
11031 pub fn with_request<V: Into<crate::model::BatchUpdateEntityTypesRequest>>(
11033 mut self,
11034 v: V,
11035 ) -> Self {
11036 self.0.request = v.into();
11037 self
11038 }
11039
11040 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11042 self.0.options = v.into();
11043 self
11044 }
11045
11046 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11053 (*self.0.stub)
11054 .batch_update_entity_types(self.0.request, self.0.options)
11055 .await
11056 .map(crate::Response::into_body)
11057 }
11058
11059 pub fn poller(
11061 self,
11062 ) -> impl google_cloud_lro::Poller<crate::model::BatchUpdateEntityTypesResponse, wkt::Struct>
11063 {
11064 type Operation = google_cloud_lro::internal::Operation<
11065 crate::model::BatchUpdateEntityTypesResponse,
11066 wkt::Struct,
11067 >;
11068 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11069 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11070
11071 let stub = self.0.stub.clone();
11072 let mut options = self.0.options.clone();
11073 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11074 let query = move |name| {
11075 let stub = stub.clone();
11076 let options = options.clone();
11077 async {
11078 let op = GetOperation::new(stub)
11079 .set_name(name)
11080 .with_options(options)
11081 .send()
11082 .await?;
11083 Ok(Operation::new(op))
11084 }
11085 };
11086
11087 let start = move || async {
11088 let op = self.send().await?;
11089 Ok(Operation::new(op))
11090 };
11091
11092 google_cloud_lro::internal::new_poller(
11093 polling_error_policy,
11094 polling_backoff_policy,
11095 start,
11096 query,
11097 )
11098 }
11099
11100 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11104 self.0.request.parent = v.into();
11105 self
11106 }
11107
11108 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11110 self.0.request.language_code = v.into();
11111 self
11112 }
11113
11114 pub fn set_update_mask<T>(mut self, v: T) -> Self
11116 where
11117 T: std::convert::Into<wkt::FieldMask>,
11118 {
11119 self.0.request.update_mask = std::option::Option::Some(v.into());
11120 self
11121 }
11122
11123 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11125 where
11126 T: std::convert::Into<wkt::FieldMask>,
11127 {
11128 self.0.request.update_mask = v.map(|x| x.into());
11129 self
11130 }
11131
11132 pub fn set_entity_type_batch<
11137 T: Into<Option<crate::model::batch_update_entity_types_request::EntityTypeBatch>>,
11138 >(
11139 mut self,
11140 v: T,
11141 ) -> Self {
11142 self.0.request.entity_type_batch = v.into();
11143 self
11144 }
11145
11146 pub fn set_entity_type_batch_uri<T: std::convert::Into<std::string::String>>(
11152 mut self,
11153 v: T,
11154 ) -> Self {
11155 self.0.request = self.0.request.set_entity_type_batch_uri(v);
11156 self
11157 }
11158
11159 pub fn set_entity_type_batch_inline<
11165 T: std::convert::Into<std::boxed::Box<crate::model::EntityTypeBatch>>,
11166 >(
11167 mut self,
11168 v: T,
11169 ) -> Self {
11170 self.0.request = self.0.request.set_entity_type_batch_inline(v);
11171 self
11172 }
11173 }
11174
11175 #[doc(hidden)]
11176 impl crate::RequestBuilder for BatchUpdateEntityTypes {
11177 fn request_options(&mut self) -> &mut crate::RequestOptions {
11178 &mut self.0.options
11179 }
11180 }
11181
11182 #[derive(Clone, Debug)]
11200 pub struct BatchDeleteEntityTypes(RequestBuilder<crate::model::BatchDeleteEntityTypesRequest>);
11201
11202 impl BatchDeleteEntityTypes {
11203 pub(crate) fn new(
11204 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11205 ) -> Self {
11206 Self(RequestBuilder::new(stub))
11207 }
11208
11209 pub fn with_request<V: Into<crate::model::BatchDeleteEntityTypesRequest>>(
11211 mut self,
11212 v: V,
11213 ) -> Self {
11214 self.0.request = v.into();
11215 self
11216 }
11217
11218 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11220 self.0.options = v.into();
11221 self
11222 }
11223
11224 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11231 (*self.0.stub)
11232 .batch_delete_entity_types(self.0.request, self.0.options)
11233 .await
11234 .map(crate::Response::into_body)
11235 }
11236
11237 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
11239 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
11240 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11241 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11242
11243 let stub = self.0.stub.clone();
11244 let mut options = self.0.options.clone();
11245 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11246 let query = move |name| {
11247 let stub = stub.clone();
11248 let options = options.clone();
11249 async {
11250 let op = GetOperation::new(stub)
11251 .set_name(name)
11252 .with_options(options)
11253 .send()
11254 .await?;
11255 Ok(Operation::new(op))
11256 }
11257 };
11258
11259 let start = move || async {
11260 let op = self.send().await?;
11261 Ok(Operation::new(op))
11262 };
11263
11264 google_cloud_lro::internal::new_unit_response_poller(
11265 polling_error_policy,
11266 polling_backoff_policy,
11267 start,
11268 query,
11269 )
11270 }
11271
11272 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11276 self.0.request.parent = v.into();
11277 self
11278 }
11279
11280 pub fn set_entity_type_names<T, V>(mut self, v: T) -> Self
11284 where
11285 T: std::iter::IntoIterator<Item = V>,
11286 V: std::convert::Into<std::string::String>,
11287 {
11288 use std::iter::Iterator;
11289 self.0.request.entity_type_names = v.into_iter().map(|i| i.into()).collect();
11290 self
11291 }
11292 }
11293
11294 #[doc(hidden)]
11295 impl crate::RequestBuilder for BatchDeleteEntityTypes {
11296 fn request_options(&mut self) -> &mut crate::RequestOptions {
11297 &mut self.0.options
11298 }
11299 }
11300
11301 #[derive(Clone, Debug)]
11319 pub struct BatchCreateEntities(RequestBuilder<crate::model::BatchCreateEntitiesRequest>);
11320
11321 impl BatchCreateEntities {
11322 pub(crate) fn new(
11323 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11324 ) -> Self {
11325 Self(RequestBuilder::new(stub))
11326 }
11327
11328 pub fn with_request<V: Into<crate::model::BatchCreateEntitiesRequest>>(
11330 mut self,
11331 v: V,
11332 ) -> Self {
11333 self.0.request = v.into();
11334 self
11335 }
11336
11337 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11339 self.0.options = v.into();
11340 self
11341 }
11342
11343 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11350 (*self.0.stub)
11351 .batch_create_entities(self.0.request, self.0.options)
11352 .await
11353 .map(crate::Response::into_body)
11354 }
11355
11356 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
11358 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
11359 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11360 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11361
11362 let stub = self.0.stub.clone();
11363 let mut options = self.0.options.clone();
11364 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11365 let query = move |name| {
11366 let stub = stub.clone();
11367 let options = options.clone();
11368 async {
11369 let op = GetOperation::new(stub)
11370 .set_name(name)
11371 .with_options(options)
11372 .send()
11373 .await?;
11374 Ok(Operation::new(op))
11375 }
11376 };
11377
11378 let start = move || async {
11379 let op = self.send().await?;
11380 Ok(Operation::new(op))
11381 };
11382
11383 google_cloud_lro::internal::new_unit_response_poller(
11384 polling_error_policy,
11385 polling_backoff_policy,
11386 start,
11387 query,
11388 )
11389 }
11390
11391 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11395 self.0.request.parent = v.into();
11396 self
11397 }
11398
11399 pub fn set_entities<T, V>(mut self, v: T) -> Self
11403 where
11404 T: std::iter::IntoIterator<Item = V>,
11405 V: std::convert::Into<crate::model::entity_type::Entity>,
11406 {
11407 use std::iter::Iterator;
11408 self.0.request.entities = v.into_iter().map(|i| i.into()).collect();
11409 self
11410 }
11411
11412 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11414 self.0.request.language_code = v.into();
11415 self
11416 }
11417 }
11418
11419 #[doc(hidden)]
11420 impl crate::RequestBuilder for BatchCreateEntities {
11421 fn request_options(&mut self) -> &mut crate::RequestOptions {
11422 &mut self.0.options
11423 }
11424 }
11425
11426 #[derive(Clone, Debug)]
11444 pub struct BatchUpdateEntities(RequestBuilder<crate::model::BatchUpdateEntitiesRequest>);
11445
11446 impl BatchUpdateEntities {
11447 pub(crate) fn new(
11448 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11449 ) -> Self {
11450 Self(RequestBuilder::new(stub))
11451 }
11452
11453 pub fn with_request<V: Into<crate::model::BatchUpdateEntitiesRequest>>(
11455 mut self,
11456 v: V,
11457 ) -> Self {
11458 self.0.request = v.into();
11459 self
11460 }
11461
11462 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11464 self.0.options = v.into();
11465 self
11466 }
11467
11468 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11475 (*self.0.stub)
11476 .batch_update_entities(self.0.request, self.0.options)
11477 .await
11478 .map(crate::Response::into_body)
11479 }
11480
11481 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
11483 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
11484 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11485 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11486
11487 let stub = self.0.stub.clone();
11488 let mut options = self.0.options.clone();
11489 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11490 let query = move |name| {
11491 let stub = stub.clone();
11492 let options = options.clone();
11493 async {
11494 let op = GetOperation::new(stub)
11495 .set_name(name)
11496 .with_options(options)
11497 .send()
11498 .await?;
11499 Ok(Operation::new(op))
11500 }
11501 };
11502
11503 let start = move || async {
11504 let op = self.send().await?;
11505 Ok(Operation::new(op))
11506 };
11507
11508 google_cloud_lro::internal::new_unit_response_poller(
11509 polling_error_policy,
11510 polling_backoff_policy,
11511 start,
11512 query,
11513 )
11514 }
11515
11516 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11520 self.0.request.parent = v.into();
11521 self
11522 }
11523
11524 pub fn set_entities<T, V>(mut self, v: T) -> Self
11528 where
11529 T: std::iter::IntoIterator<Item = V>,
11530 V: std::convert::Into<crate::model::entity_type::Entity>,
11531 {
11532 use std::iter::Iterator;
11533 self.0.request.entities = v.into_iter().map(|i| i.into()).collect();
11534 self
11535 }
11536
11537 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11539 self.0.request.language_code = v.into();
11540 self
11541 }
11542
11543 pub fn set_update_mask<T>(mut self, v: T) -> Self
11545 where
11546 T: std::convert::Into<wkt::FieldMask>,
11547 {
11548 self.0.request.update_mask = std::option::Option::Some(v.into());
11549 self
11550 }
11551
11552 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11554 where
11555 T: std::convert::Into<wkt::FieldMask>,
11556 {
11557 self.0.request.update_mask = v.map(|x| x.into());
11558 self
11559 }
11560 }
11561
11562 #[doc(hidden)]
11563 impl crate::RequestBuilder for BatchUpdateEntities {
11564 fn request_options(&mut self) -> &mut crate::RequestOptions {
11565 &mut self.0.options
11566 }
11567 }
11568
11569 #[derive(Clone, Debug)]
11587 pub struct BatchDeleteEntities(RequestBuilder<crate::model::BatchDeleteEntitiesRequest>);
11588
11589 impl BatchDeleteEntities {
11590 pub(crate) fn new(
11591 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11592 ) -> Self {
11593 Self(RequestBuilder::new(stub))
11594 }
11595
11596 pub fn with_request<V: Into<crate::model::BatchDeleteEntitiesRequest>>(
11598 mut self,
11599 v: V,
11600 ) -> Self {
11601 self.0.request = v.into();
11602 self
11603 }
11604
11605 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11607 self.0.options = v.into();
11608 self
11609 }
11610
11611 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11618 (*self.0.stub)
11619 .batch_delete_entities(self.0.request, self.0.options)
11620 .await
11621 .map(crate::Response::into_body)
11622 }
11623
11624 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
11626 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
11627 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11628 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11629
11630 let stub = self.0.stub.clone();
11631 let mut options = self.0.options.clone();
11632 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11633 let query = move |name| {
11634 let stub = stub.clone();
11635 let options = options.clone();
11636 async {
11637 let op = GetOperation::new(stub)
11638 .set_name(name)
11639 .with_options(options)
11640 .send()
11641 .await?;
11642 Ok(Operation::new(op))
11643 }
11644 };
11645
11646 let start = move || async {
11647 let op = self.send().await?;
11648 Ok(Operation::new(op))
11649 };
11650
11651 google_cloud_lro::internal::new_unit_response_poller(
11652 polling_error_policy,
11653 polling_backoff_policy,
11654 start,
11655 query,
11656 )
11657 }
11658
11659 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11663 self.0.request.parent = v.into();
11664 self
11665 }
11666
11667 pub fn set_entity_values<T, V>(mut self, v: T) -> Self
11671 where
11672 T: std::iter::IntoIterator<Item = V>,
11673 V: std::convert::Into<std::string::String>,
11674 {
11675 use std::iter::Iterator;
11676 self.0.request.entity_values = v.into_iter().map(|i| i.into()).collect();
11677 self
11678 }
11679
11680 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11682 self.0.request.language_code = v.into();
11683 self
11684 }
11685 }
11686
11687 #[doc(hidden)]
11688 impl crate::RequestBuilder for BatchDeleteEntities {
11689 fn request_options(&mut self) -> &mut crate::RequestOptions {
11690 &mut self.0.options
11691 }
11692 }
11693
11694 #[derive(Clone, Debug)]
11715 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
11716
11717 impl ListLocations {
11718 pub(crate) fn new(
11719 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11720 ) -> Self {
11721 Self(RequestBuilder::new(stub))
11722 }
11723
11724 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
11726 mut self,
11727 v: V,
11728 ) -> Self {
11729 self.0.request = v.into();
11730 self
11731 }
11732
11733 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11735 self.0.options = v.into();
11736 self
11737 }
11738
11739 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
11741 (*self.0.stub)
11742 .list_locations(self.0.request, self.0.options)
11743 .await
11744 .map(crate::Response::into_body)
11745 }
11746
11747 pub fn by_page(
11749 self,
11750 ) -> impl google_cloud_gax::paginator::Paginator<
11751 google_cloud_location::model::ListLocationsResponse,
11752 crate::Error,
11753 > {
11754 use std::clone::Clone;
11755 let token = self.0.request.page_token.clone();
11756 let execute = move |token: String| {
11757 let mut builder = self.clone();
11758 builder.0.request = builder.0.request.set_page_token(token);
11759 builder.send()
11760 };
11761 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11762 }
11763
11764 pub fn by_item(
11766 self,
11767 ) -> impl google_cloud_gax::paginator::ItemPaginator<
11768 google_cloud_location::model::ListLocationsResponse,
11769 crate::Error,
11770 > {
11771 use google_cloud_gax::paginator::Paginator;
11772 self.by_page().items()
11773 }
11774
11775 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11777 self.0.request.name = v.into();
11778 self
11779 }
11780
11781 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11783 self.0.request.filter = v.into();
11784 self
11785 }
11786
11787 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11789 self.0.request.page_size = v.into();
11790 self
11791 }
11792
11793 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11795 self.0.request.page_token = v.into();
11796 self
11797 }
11798 }
11799
11800 #[doc(hidden)]
11801 impl crate::RequestBuilder for ListLocations {
11802 fn request_options(&mut self) -> &mut crate::RequestOptions {
11803 &mut self.0.options
11804 }
11805 }
11806
11807 #[derive(Clone, Debug)]
11824 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
11825
11826 impl GetLocation {
11827 pub(crate) fn new(
11828 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11829 ) -> Self {
11830 Self(RequestBuilder::new(stub))
11831 }
11832
11833 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
11835 mut self,
11836 v: V,
11837 ) -> Self {
11838 self.0.request = v.into();
11839 self
11840 }
11841
11842 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11844 self.0.options = v.into();
11845 self
11846 }
11847
11848 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
11850 (*self.0.stub)
11851 .get_location(self.0.request, self.0.options)
11852 .await
11853 .map(crate::Response::into_body)
11854 }
11855
11856 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11858 self.0.request.name = v.into();
11859 self
11860 }
11861 }
11862
11863 #[doc(hidden)]
11864 impl crate::RequestBuilder for GetLocation {
11865 fn request_options(&mut self) -> &mut crate::RequestOptions {
11866 &mut self.0.options
11867 }
11868 }
11869
11870 #[derive(Clone, Debug)]
11891 pub struct ListOperations(
11892 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
11893 );
11894
11895 impl ListOperations {
11896 pub(crate) fn new(
11897 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11898 ) -> Self {
11899 Self(RequestBuilder::new(stub))
11900 }
11901
11902 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
11904 mut self,
11905 v: V,
11906 ) -> Self {
11907 self.0.request = v.into();
11908 self
11909 }
11910
11911 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11913 self.0.options = v.into();
11914 self
11915 }
11916
11917 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
11919 (*self.0.stub)
11920 .list_operations(self.0.request, self.0.options)
11921 .await
11922 .map(crate::Response::into_body)
11923 }
11924
11925 pub fn by_page(
11927 self,
11928 ) -> impl google_cloud_gax::paginator::Paginator<
11929 google_cloud_longrunning::model::ListOperationsResponse,
11930 crate::Error,
11931 > {
11932 use std::clone::Clone;
11933 let token = self.0.request.page_token.clone();
11934 let execute = move |token: String| {
11935 let mut builder = self.clone();
11936 builder.0.request = builder.0.request.set_page_token(token);
11937 builder.send()
11938 };
11939 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11940 }
11941
11942 pub fn by_item(
11944 self,
11945 ) -> impl google_cloud_gax::paginator::ItemPaginator<
11946 google_cloud_longrunning::model::ListOperationsResponse,
11947 crate::Error,
11948 > {
11949 use google_cloud_gax::paginator::Paginator;
11950 self.by_page().items()
11951 }
11952
11953 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11955 self.0.request.name = v.into();
11956 self
11957 }
11958
11959 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11961 self.0.request.filter = v.into();
11962 self
11963 }
11964
11965 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11967 self.0.request.page_size = v.into();
11968 self
11969 }
11970
11971 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11973 self.0.request.page_token = v.into();
11974 self
11975 }
11976
11977 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
11979 self.0.request.return_partial_success = v.into();
11980 self
11981 }
11982 }
11983
11984 #[doc(hidden)]
11985 impl crate::RequestBuilder for ListOperations {
11986 fn request_options(&mut self) -> &mut crate::RequestOptions {
11987 &mut self.0.options
11988 }
11989 }
11990
11991 #[derive(Clone, Debug)]
12008 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12009
12010 impl GetOperation {
12011 pub(crate) fn new(
12012 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
12013 ) -> Self {
12014 Self(RequestBuilder::new(stub))
12015 }
12016
12017 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12019 mut self,
12020 v: V,
12021 ) -> Self {
12022 self.0.request = v.into();
12023 self
12024 }
12025
12026 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12028 self.0.options = v.into();
12029 self
12030 }
12031
12032 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12034 (*self.0.stub)
12035 .get_operation(self.0.request, self.0.options)
12036 .await
12037 .map(crate::Response::into_body)
12038 }
12039
12040 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12042 self.0.request.name = v.into();
12043 self
12044 }
12045 }
12046
12047 #[doc(hidden)]
12048 impl crate::RequestBuilder for GetOperation {
12049 fn request_options(&mut self) -> &mut crate::RequestOptions {
12050 &mut self.0.options
12051 }
12052 }
12053
12054 #[derive(Clone, Debug)]
12071 pub struct CancelOperation(
12072 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12073 );
12074
12075 impl CancelOperation {
12076 pub(crate) fn new(
12077 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
12078 ) -> Self {
12079 Self(RequestBuilder::new(stub))
12080 }
12081
12082 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12084 mut self,
12085 v: V,
12086 ) -> Self {
12087 self.0.request = v.into();
12088 self
12089 }
12090
12091 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12093 self.0.options = v.into();
12094 self
12095 }
12096
12097 pub async fn send(self) -> Result<()> {
12099 (*self.0.stub)
12100 .cancel_operation(self.0.request, self.0.options)
12101 .await
12102 .map(crate::Response::into_body)
12103 }
12104
12105 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12107 self.0.request.name = v.into();
12108 self
12109 }
12110 }
12111
12112 #[doc(hidden)]
12113 impl crate::RequestBuilder for CancelOperation {
12114 fn request_options(&mut self) -> &mut crate::RequestOptions {
12115 &mut self.0.options
12116 }
12117 }
12118}
12119
12120#[cfg(feature = "environments")]
12121#[cfg_attr(docsrs, doc(cfg(feature = "environments")))]
12122pub mod environments {
12123 use crate::Result;
12124
12125 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12139
12140 pub(crate) mod client {
12141 use super::super::super::client::Environments;
12142 pub struct Factory;
12143 impl crate::ClientFactory for Factory {
12144 type Client = Environments;
12145 type Credentials = gaxi::options::Credentials;
12146 async fn build(
12147 self,
12148 config: gaxi::options::ClientConfig,
12149 ) -> crate::ClientBuilderResult<Self::Client> {
12150 Self::Client::new(config).await
12151 }
12152 }
12153 }
12154
12155 #[derive(Clone, Debug)]
12157 pub(crate) struct RequestBuilder<R: std::default::Default> {
12158 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12159 request: R,
12160 options: crate::RequestOptions,
12161 }
12162
12163 impl<R> RequestBuilder<R>
12164 where
12165 R: std::default::Default,
12166 {
12167 pub(crate) fn new(
12168 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12169 ) -> Self {
12170 Self {
12171 stub,
12172 request: R::default(),
12173 options: crate::RequestOptions::default(),
12174 }
12175 }
12176 }
12177
12178 #[derive(Clone, Debug)]
12199 pub struct ListEnvironments(RequestBuilder<crate::model::ListEnvironmentsRequest>);
12200
12201 impl ListEnvironments {
12202 pub(crate) fn new(
12203 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12204 ) -> Self {
12205 Self(RequestBuilder::new(stub))
12206 }
12207
12208 pub fn with_request<V: Into<crate::model::ListEnvironmentsRequest>>(
12210 mut self,
12211 v: V,
12212 ) -> Self {
12213 self.0.request = v.into();
12214 self
12215 }
12216
12217 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12219 self.0.options = v.into();
12220 self
12221 }
12222
12223 pub async fn send(self) -> Result<crate::model::ListEnvironmentsResponse> {
12225 (*self.0.stub)
12226 .list_environments(self.0.request, self.0.options)
12227 .await
12228 .map(crate::Response::into_body)
12229 }
12230
12231 pub fn by_page(
12233 self,
12234 ) -> impl google_cloud_gax::paginator::Paginator<
12235 crate::model::ListEnvironmentsResponse,
12236 crate::Error,
12237 > {
12238 use std::clone::Clone;
12239 let token = self.0.request.page_token.clone();
12240 let execute = move |token: String| {
12241 let mut builder = self.clone();
12242 builder.0.request = builder.0.request.set_page_token(token);
12243 builder.send()
12244 };
12245 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12246 }
12247
12248 pub fn by_item(
12250 self,
12251 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12252 crate::model::ListEnvironmentsResponse,
12253 crate::Error,
12254 > {
12255 use google_cloud_gax::paginator::Paginator;
12256 self.by_page().items()
12257 }
12258
12259 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
12263 self.0.request.parent = v.into();
12264 self
12265 }
12266
12267 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12269 self.0.request.page_size = v.into();
12270 self
12271 }
12272
12273 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12275 self.0.request.page_token = v.into();
12276 self
12277 }
12278 }
12279
12280 #[doc(hidden)]
12281 impl crate::RequestBuilder for ListEnvironments {
12282 fn request_options(&mut self) -> &mut crate::RequestOptions {
12283 &mut self.0.options
12284 }
12285 }
12286
12287 #[derive(Clone, Debug)]
12304 pub struct GetEnvironment(RequestBuilder<crate::model::GetEnvironmentRequest>);
12305
12306 impl GetEnvironment {
12307 pub(crate) fn new(
12308 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12309 ) -> Self {
12310 Self(RequestBuilder::new(stub))
12311 }
12312
12313 pub fn with_request<V: Into<crate::model::GetEnvironmentRequest>>(mut self, v: V) -> Self {
12315 self.0.request = v.into();
12316 self
12317 }
12318
12319 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12321 self.0.options = v.into();
12322 self
12323 }
12324
12325 pub async fn send(self) -> Result<crate::model::Environment> {
12327 (*self.0.stub)
12328 .get_environment(self.0.request, self.0.options)
12329 .await
12330 .map(crate::Response::into_body)
12331 }
12332
12333 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12337 self.0.request.name = v.into();
12338 self
12339 }
12340 }
12341
12342 #[doc(hidden)]
12343 impl crate::RequestBuilder for GetEnvironment {
12344 fn request_options(&mut self) -> &mut crate::RequestOptions {
12345 &mut self.0.options
12346 }
12347 }
12348
12349 #[derive(Clone, Debug)]
12366 pub struct CreateEnvironment(RequestBuilder<crate::model::CreateEnvironmentRequest>);
12367
12368 impl CreateEnvironment {
12369 pub(crate) fn new(
12370 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12371 ) -> Self {
12372 Self(RequestBuilder::new(stub))
12373 }
12374
12375 pub fn with_request<V: Into<crate::model::CreateEnvironmentRequest>>(
12377 mut self,
12378 v: V,
12379 ) -> Self {
12380 self.0.request = v.into();
12381 self
12382 }
12383
12384 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12386 self.0.options = v.into();
12387 self
12388 }
12389
12390 pub async fn send(self) -> Result<crate::model::Environment> {
12392 (*self.0.stub)
12393 .create_environment(self.0.request, self.0.options)
12394 .await
12395 .map(crate::Response::into_body)
12396 }
12397
12398 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
12402 self.0.request.parent = v.into();
12403 self
12404 }
12405
12406 pub fn set_environment<T>(mut self, v: T) -> Self
12410 where
12411 T: std::convert::Into<crate::model::Environment>,
12412 {
12413 self.0.request.environment = std::option::Option::Some(v.into());
12414 self
12415 }
12416
12417 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
12421 where
12422 T: std::convert::Into<crate::model::Environment>,
12423 {
12424 self.0.request.environment = v.map(|x| x.into());
12425 self
12426 }
12427
12428 pub fn set_environment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12432 self.0.request.environment_id = v.into();
12433 self
12434 }
12435 }
12436
12437 #[doc(hidden)]
12438 impl crate::RequestBuilder for CreateEnvironment {
12439 fn request_options(&mut self) -> &mut crate::RequestOptions {
12440 &mut self.0.options
12441 }
12442 }
12443
12444 #[derive(Clone, Debug)]
12461 pub struct UpdateEnvironment(RequestBuilder<crate::model::UpdateEnvironmentRequest>);
12462
12463 impl UpdateEnvironment {
12464 pub(crate) fn new(
12465 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12466 ) -> Self {
12467 Self(RequestBuilder::new(stub))
12468 }
12469
12470 pub fn with_request<V: Into<crate::model::UpdateEnvironmentRequest>>(
12472 mut self,
12473 v: V,
12474 ) -> Self {
12475 self.0.request = v.into();
12476 self
12477 }
12478
12479 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12481 self.0.options = v.into();
12482 self
12483 }
12484
12485 pub async fn send(self) -> Result<crate::model::Environment> {
12487 (*self.0.stub)
12488 .update_environment(self.0.request, self.0.options)
12489 .await
12490 .map(crate::Response::into_body)
12491 }
12492
12493 pub fn set_environment<T>(mut self, v: T) -> Self
12497 where
12498 T: std::convert::Into<crate::model::Environment>,
12499 {
12500 self.0.request.environment = std::option::Option::Some(v.into());
12501 self
12502 }
12503
12504 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
12508 where
12509 T: std::convert::Into<crate::model::Environment>,
12510 {
12511 self.0.request.environment = v.map(|x| x.into());
12512 self
12513 }
12514
12515 pub fn set_update_mask<T>(mut self, v: T) -> Self
12519 where
12520 T: std::convert::Into<wkt::FieldMask>,
12521 {
12522 self.0.request.update_mask = std::option::Option::Some(v.into());
12523 self
12524 }
12525
12526 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12530 where
12531 T: std::convert::Into<wkt::FieldMask>,
12532 {
12533 self.0.request.update_mask = v.map(|x| x.into());
12534 self
12535 }
12536
12537 pub fn set_allow_load_to_draft_and_discard_changes<T: Into<bool>>(mut self, v: T) -> Self {
12539 self.0.request.allow_load_to_draft_and_discard_changes = v.into();
12540 self
12541 }
12542 }
12543
12544 #[doc(hidden)]
12545 impl crate::RequestBuilder for UpdateEnvironment {
12546 fn request_options(&mut self) -> &mut crate::RequestOptions {
12547 &mut self.0.options
12548 }
12549 }
12550
12551 #[derive(Clone, Debug)]
12568 pub struct DeleteEnvironment(RequestBuilder<crate::model::DeleteEnvironmentRequest>);
12569
12570 impl DeleteEnvironment {
12571 pub(crate) fn new(
12572 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12573 ) -> Self {
12574 Self(RequestBuilder::new(stub))
12575 }
12576
12577 pub fn with_request<V: Into<crate::model::DeleteEnvironmentRequest>>(
12579 mut self,
12580 v: V,
12581 ) -> Self {
12582 self.0.request = v.into();
12583 self
12584 }
12585
12586 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12588 self.0.options = v.into();
12589 self
12590 }
12591
12592 pub async fn send(self) -> Result<()> {
12594 (*self.0.stub)
12595 .delete_environment(self.0.request, self.0.options)
12596 .await
12597 .map(crate::Response::into_body)
12598 }
12599
12600 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12604 self.0.request.name = v.into();
12605 self
12606 }
12607 }
12608
12609 #[doc(hidden)]
12610 impl crate::RequestBuilder for DeleteEnvironment {
12611 fn request_options(&mut self) -> &mut crate::RequestOptions {
12612 &mut self.0.options
12613 }
12614 }
12615
12616 #[derive(Clone, Debug)]
12637 pub struct GetEnvironmentHistory(RequestBuilder<crate::model::GetEnvironmentHistoryRequest>);
12638
12639 impl GetEnvironmentHistory {
12640 pub(crate) fn new(
12641 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12642 ) -> Self {
12643 Self(RequestBuilder::new(stub))
12644 }
12645
12646 pub fn with_request<V: Into<crate::model::GetEnvironmentHistoryRequest>>(
12648 mut self,
12649 v: V,
12650 ) -> Self {
12651 self.0.request = v.into();
12652 self
12653 }
12654
12655 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12657 self.0.options = v.into();
12658 self
12659 }
12660
12661 pub async fn send(self) -> Result<crate::model::EnvironmentHistory> {
12663 (*self.0.stub)
12664 .get_environment_history(self.0.request, self.0.options)
12665 .await
12666 .map(crate::Response::into_body)
12667 }
12668
12669 pub fn by_page(
12671 self,
12672 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::EnvironmentHistory, crate::Error>
12673 {
12674 use std::clone::Clone;
12675 let token = self.0.request.page_token.clone();
12676 let execute = move |token: String| {
12677 let mut builder = self.clone();
12678 builder.0.request = builder.0.request.set_page_token(token);
12679 builder.send()
12680 };
12681 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12682 }
12683
12684 pub fn by_item(
12686 self,
12687 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12688 crate::model::EnvironmentHistory,
12689 crate::Error,
12690 > {
12691 use google_cloud_gax::paginator::Paginator;
12692 self.by_page().items()
12693 }
12694
12695 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
12699 self.0.request.parent = v.into();
12700 self
12701 }
12702
12703 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12705 self.0.request.page_size = v.into();
12706 self
12707 }
12708
12709 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12711 self.0.request.page_token = v.into();
12712 self
12713 }
12714 }
12715
12716 #[doc(hidden)]
12717 impl crate::RequestBuilder for GetEnvironmentHistory {
12718 fn request_options(&mut self) -> &mut crate::RequestOptions {
12719 &mut self.0.options
12720 }
12721 }
12722
12723 #[derive(Clone, Debug)]
12744 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
12745
12746 impl ListLocations {
12747 pub(crate) fn new(
12748 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12749 ) -> Self {
12750 Self(RequestBuilder::new(stub))
12751 }
12752
12753 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
12755 mut self,
12756 v: V,
12757 ) -> Self {
12758 self.0.request = v.into();
12759 self
12760 }
12761
12762 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12764 self.0.options = v.into();
12765 self
12766 }
12767
12768 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
12770 (*self.0.stub)
12771 .list_locations(self.0.request, self.0.options)
12772 .await
12773 .map(crate::Response::into_body)
12774 }
12775
12776 pub fn by_page(
12778 self,
12779 ) -> impl google_cloud_gax::paginator::Paginator<
12780 google_cloud_location::model::ListLocationsResponse,
12781 crate::Error,
12782 > {
12783 use std::clone::Clone;
12784 let token = self.0.request.page_token.clone();
12785 let execute = move |token: String| {
12786 let mut builder = self.clone();
12787 builder.0.request = builder.0.request.set_page_token(token);
12788 builder.send()
12789 };
12790 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12791 }
12792
12793 pub fn by_item(
12795 self,
12796 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12797 google_cloud_location::model::ListLocationsResponse,
12798 crate::Error,
12799 > {
12800 use google_cloud_gax::paginator::Paginator;
12801 self.by_page().items()
12802 }
12803
12804 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12806 self.0.request.name = v.into();
12807 self
12808 }
12809
12810 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12812 self.0.request.filter = v.into();
12813 self
12814 }
12815
12816 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12818 self.0.request.page_size = v.into();
12819 self
12820 }
12821
12822 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12824 self.0.request.page_token = v.into();
12825 self
12826 }
12827 }
12828
12829 #[doc(hidden)]
12830 impl crate::RequestBuilder for ListLocations {
12831 fn request_options(&mut self) -> &mut crate::RequestOptions {
12832 &mut self.0.options
12833 }
12834 }
12835
12836 #[derive(Clone, Debug)]
12853 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
12854
12855 impl GetLocation {
12856 pub(crate) fn new(
12857 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12858 ) -> Self {
12859 Self(RequestBuilder::new(stub))
12860 }
12861
12862 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
12864 mut self,
12865 v: V,
12866 ) -> Self {
12867 self.0.request = v.into();
12868 self
12869 }
12870
12871 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12873 self.0.options = v.into();
12874 self
12875 }
12876
12877 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
12879 (*self.0.stub)
12880 .get_location(self.0.request, self.0.options)
12881 .await
12882 .map(crate::Response::into_body)
12883 }
12884
12885 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12887 self.0.request.name = v.into();
12888 self
12889 }
12890 }
12891
12892 #[doc(hidden)]
12893 impl crate::RequestBuilder for GetLocation {
12894 fn request_options(&mut self) -> &mut crate::RequestOptions {
12895 &mut self.0.options
12896 }
12897 }
12898
12899 #[derive(Clone, Debug)]
12920 pub struct ListOperations(
12921 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12922 );
12923
12924 impl ListOperations {
12925 pub(crate) fn new(
12926 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12927 ) -> Self {
12928 Self(RequestBuilder::new(stub))
12929 }
12930
12931 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12933 mut self,
12934 v: V,
12935 ) -> Self {
12936 self.0.request = v.into();
12937 self
12938 }
12939
12940 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12942 self.0.options = v.into();
12943 self
12944 }
12945
12946 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12948 (*self.0.stub)
12949 .list_operations(self.0.request, self.0.options)
12950 .await
12951 .map(crate::Response::into_body)
12952 }
12953
12954 pub fn by_page(
12956 self,
12957 ) -> impl google_cloud_gax::paginator::Paginator<
12958 google_cloud_longrunning::model::ListOperationsResponse,
12959 crate::Error,
12960 > {
12961 use std::clone::Clone;
12962 let token = self.0.request.page_token.clone();
12963 let execute = move |token: String| {
12964 let mut builder = self.clone();
12965 builder.0.request = builder.0.request.set_page_token(token);
12966 builder.send()
12967 };
12968 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12969 }
12970
12971 pub fn by_item(
12973 self,
12974 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12975 google_cloud_longrunning::model::ListOperationsResponse,
12976 crate::Error,
12977 > {
12978 use google_cloud_gax::paginator::Paginator;
12979 self.by_page().items()
12980 }
12981
12982 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12984 self.0.request.name = v.into();
12985 self
12986 }
12987
12988 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12990 self.0.request.filter = v.into();
12991 self
12992 }
12993
12994 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12996 self.0.request.page_size = v.into();
12997 self
12998 }
12999
13000 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13002 self.0.request.page_token = v.into();
13003 self
13004 }
13005
13006 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13008 self.0.request.return_partial_success = v.into();
13009 self
13010 }
13011 }
13012
13013 #[doc(hidden)]
13014 impl crate::RequestBuilder for ListOperations {
13015 fn request_options(&mut self) -> &mut crate::RequestOptions {
13016 &mut self.0.options
13017 }
13018 }
13019
13020 #[derive(Clone, Debug)]
13037 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13038
13039 impl GetOperation {
13040 pub(crate) fn new(
13041 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
13042 ) -> Self {
13043 Self(RequestBuilder::new(stub))
13044 }
13045
13046 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13048 mut self,
13049 v: V,
13050 ) -> Self {
13051 self.0.request = v.into();
13052 self
13053 }
13054
13055 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13057 self.0.options = v.into();
13058 self
13059 }
13060
13061 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13063 (*self.0.stub)
13064 .get_operation(self.0.request, self.0.options)
13065 .await
13066 .map(crate::Response::into_body)
13067 }
13068
13069 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13071 self.0.request.name = v.into();
13072 self
13073 }
13074 }
13075
13076 #[doc(hidden)]
13077 impl crate::RequestBuilder for GetOperation {
13078 fn request_options(&mut self) -> &mut crate::RequestOptions {
13079 &mut self.0.options
13080 }
13081 }
13082
13083 #[derive(Clone, Debug)]
13100 pub struct CancelOperation(
13101 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13102 );
13103
13104 impl CancelOperation {
13105 pub(crate) fn new(
13106 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
13107 ) -> Self {
13108 Self(RequestBuilder::new(stub))
13109 }
13110
13111 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13113 mut self,
13114 v: V,
13115 ) -> Self {
13116 self.0.request = v.into();
13117 self
13118 }
13119
13120 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13122 self.0.options = v.into();
13123 self
13124 }
13125
13126 pub async fn send(self) -> Result<()> {
13128 (*self.0.stub)
13129 .cancel_operation(self.0.request, self.0.options)
13130 .await
13131 .map(crate::Response::into_body)
13132 }
13133
13134 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13136 self.0.request.name = v.into();
13137 self
13138 }
13139 }
13140
13141 #[doc(hidden)]
13142 impl crate::RequestBuilder for CancelOperation {
13143 fn request_options(&mut self) -> &mut crate::RequestOptions {
13144 &mut self.0.options
13145 }
13146 }
13147}
13148
13149#[cfg(feature = "fulfillments")]
13150#[cfg_attr(docsrs, doc(cfg(feature = "fulfillments")))]
13151pub mod fulfillments {
13152 use crate::Result;
13153
13154 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13168
13169 pub(crate) mod client {
13170 use super::super::super::client::Fulfillments;
13171 pub struct Factory;
13172 impl crate::ClientFactory for Factory {
13173 type Client = Fulfillments;
13174 type Credentials = gaxi::options::Credentials;
13175 async fn build(
13176 self,
13177 config: gaxi::options::ClientConfig,
13178 ) -> crate::ClientBuilderResult<Self::Client> {
13179 Self::Client::new(config).await
13180 }
13181 }
13182 }
13183
13184 #[derive(Clone, Debug)]
13186 pub(crate) struct RequestBuilder<R: std::default::Default> {
13187 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13188 request: R,
13189 options: crate::RequestOptions,
13190 }
13191
13192 impl<R> RequestBuilder<R>
13193 where
13194 R: std::default::Default,
13195 {
13196 pub(crate) fn new(
13197 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13198 ) -> Self {
13199 Self {
13200 stub,
13201 request: R::default(),
13202 options: crate::RequestOptions::default(),
13203 }
13204 }
13205 }
13206
13207 #[derive(Clone, Debug)]
13224 pub struct GetFulfillment(RequestBuilder<crate::model::GetFulfillmentRequest>);
13225
13226 impl GetFulfillment {
13227 pub(crate) fn new(
13228 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13229 ) -> Self {
13230 Self(RequestBuilder::new(stub))
13231 }
13232
13233 pub fn with_request<V: Into<crate::model::GetFulfillmentRequest>>(mut self, v: V) -> Self {
13235 self.0.request = v.into();
13236 self
13237 }
13238
13239 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13241 self.0.options = v.into();
13242 self
13243 }
13244
13245 pub async fn send(self) -> Result<crate::model::Fulfillment> {
13247 (*self.0.stub)
13248 .get_fulfillment(self.0.request, self.0.options)
13249 .await
13250 .map(crate::Response::into_body)
13251 }
13252
13253 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13257 self.0.request.name = v.into();
13258 self
13259 }
13260 }
13261
13262 #[doc(hidden)]
13263 impl crate::RequestBuilder for GetFulfillment {
13264 fn request_options(&mut self) -> &mut crate::RequestOptions {
13265 &mut self.0.options
13266 }
13267 }
13268
13269 #[derive(Clone, Debug)]
13286 pub struct UpdateFulfillment(RequestBuilder<crate::model::UpdateFulfillmentRequest>);
13287
13288 impl UpdateFulfillment {
13289 pub(crate) fn new(
13290 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13291 ) -> Self {
13292 Self(RequestBuilder::new(stub))
13293 }
13294
13295 pub fn with_request<V: Into<crate::model::UpdateFulfillmentRequest>>(
13297 mut self,
13298 v: V,
13299 ) -> Self {
13300 self.0.request = v.into();
13301 self
13302 }
13303
13304 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13306 self.0.options = v.into();
13307 self
13308 }
13309
13310 pub async fn send(self) -> Result<crate::model::Fulfillment> {
13312 (*self.0.stub)
13313 .update_fulfillment(self.0.request, self.0.options)
13314 .await
13315 .map(crate::Response::into_body)
13316 }
13317
13318 pub fn set_fulfillment<T>(mut self, v: T) -> Self
13322 where
13323 T: std::convert::Into<crate::model::Fulfillment>,
13324 {
13325 self.0.request.fulfillment = std::option::Option::Some(v.into());
13326 self
13327 }
13328
13329 pub fn set_or_clear_fulfillment<T>(mut self, v: std::option::Option<T>) -> Self
13333 where
13334 T: std::convert::Into<crate::model::Fulfillment>,
13335 {
13336 self.0.request.fulfillment = v.map(|x| x.into());
13337 self
13338 }
13339
13340 pub fn set_update_mask<T>(mut self, v: T) -> Self
13344 where
13345 T: std::convert::Into<wkt::FieldMask>,
13346 {
13347 self.0.request.update_mask = std::option::Option::Some(v.into());
13348 self
13349 }
13350
13351 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13355 where
13356 T: std::convert::Into<wkt::FieldMask>,
13357 {
13358 self.0.request.update_mask = v.map(|x| x.into());
13359 self
13360 }
13361 }
13362
13363 #[doc(hidden)]
13364 impl crate::RequestBuilder for UpdateFulfillment {
13365 fn request_options(&mut self) -> &mut crate::RequestOptions {
13366 &mut self.0.options
13367 }
13368 }
13369
13370 #[derive(Clone, Debug)]
13391 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
13392
13393 impl ListLocations {
13394 pub(crate) fn new(
13395 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13396 ) -> Self {
13397 Self(RequestBuilder::new(stub))
13398 }
13399
13400 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
13402 mut self,
13403 v: V,
13404 ) -> Self {
13405 self.0.request = v.into();
13406 self
13407 }
13408
13409 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13411 self.0.options = v.into();
13412 self
13413 }
13414
13415 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
13417 (*self.0.stub)
13418 .list_locations(self.0.request, self.0.options)
13419 .await
13420 .map(crate::Response::into_body)
13421 }
13422
13423 pub fn by_page(
13425 self,
13426 ) -> impl google_cloud_gax::paginator::Paginator<
13427 google_cloud_location::model::ListLocationsResponse,
13428 crate::Error,
13429 > {
13430 use std::clone::Clone;
13431 let token = self.0.request.page_token.clone();
13432 let execute = move |token: String| {
13433 let mut builder = self.clone();
13434 builder.0.request = builder.0.request.set_page_token(token);
13435 builder.send()
13436 };
13437 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13438 }
13439
13440 pub fn by_item(
13442 self,
13443 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13444 google_cloud_location::model::ListLocationsResponse,
13445 crate::Error,
13446 > {
13447 use google_cloud_gax::paginator::Paginator;
13448 self.by_page().items()
13449 }
13450
13451 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13453 self.0.request.name = v.into();
13454 self
13455 }
13456
13457 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13459 self.0.request.filter = v.into();
13460 self
13461 }
13462
13463 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13465 self.0.request.page_size = v.into();
13466 self
13467 }
13468
13469 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13471 self.0.request.page_token = v.into();
13472 self
13473 }
13474 }
13475
13476 #[doc(hidden)]
13477 impl crate::RequestBuilder for ListLocations {
13478 fn request_options(&mut self) -> &mut crate::RequestOptions {
13479 &mut self.0.options
13480 }
13481 }
13482
13483 #[derive(Clone, Debug)]
13500 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
13501
13502 impl GetLocation {
13503 pub(crate) fn new(
13504 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13505 ) -> Self {
13506 Self(RequestBuilder::new(stub))
13507 }
13508
13509 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
13511 mut self,
13512 v: V,
13513 ) -> Self {
13514 self.0.request = v.into();
13515 self
13516 }
13517
13518 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13520 self.0.options = v.into();
13521 self
13522 }
13523
13524 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
13526 (*self.0.stub)
13527 .get_location(self.0.request, self.0.options)
13528 .await
13529 .map(crate::Response::into_body)
13530 }
13531
13532 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13534 self.0.request.name = v.into();
13535 self
13536 }
13537 }
13538
13539 #[doc(hidden)]
13540 impl crate::RequestBuilder for GetLocation {
13541 fn request_options(&mut self) -> &mut crate::RequestOptions {
13542 &mut self.0.options
13543 }
13544 }
13545
13546 #[derive(Clone, Debug)]
13567 pub struct ListOperations(
13568 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13569 );
13570
13571 impl ListOperations {
13572 pub(crate) fn new(
13573 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13574 ) -> Self {
13575 Self(RequestBuilder::new(stub))
13576 }
13577
13578 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13580 mut self,
13581 v: V,
13582 ) -> Self {
13583 self.0.request = v.into();
13584 self
13585 }
13586
13587 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13589 self.0.options = v.into();
13590 self
13591 }
13592
13593 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13595 (*self.0.stub)
13596 .list_operations(self.0.request, self.0.options)
13597 .await
13598 .map(crate::Response::into_body)
13599 }
13600
13601 pub fn by_page(
13603 self,
13604 ) -> impl google_cloud_gax::paginator::Paginator<
13605 google_cloud_longrunning::model::ListOperationsResponse,
13606 crate::Error,
13607 > {
13608 use std::clone::Clone;
13609 let token = self.0.request.page_token.clone();
13610 let execute = move |token: String| {
13611 let mut builder = self.clone();
13612 builder.0.request = builder.0.request.set_page_token(token);
13613 builder.send()
13614 };
13615 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13616 }
13617
13618 pub fn by_item(
13620 self,
13621 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13622 google_cloud_longrunning::model::ListOperationsResponse,
13623 crate::Error,
13624 > {
13625 use google_cloud_gax::paginator::Paginator;
13626 self.by_page().items()
13627 }
13628
13629 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13631 self.0.request.name = v.into();
13632 self
13633 }
13634
13635 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13637 self.0.request.filter = v.into();
13638 self
13639 }
13640
13641 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13643 self.0.request.page_size = v.into();
13644 self
13645 }
13646
13647 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13649 self.0.request.page_token = v.into();
13650 self
13651 }
13652
13653 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13655 self.0.request.return_partial_success = v.into();
13656 self
13657 }
13658 }
13659
13660 #[doc(hidden)]
13661 impl crate::RequestBuilder for ListOperations {
13662 fn request_options(&mut self) -> &mut crate::RequestOptions {
13663 &mut self.0.options
13664 }
13665 }
13666
13667 #[derive(Clone, Debug)]
13684 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13685
13686 impl GetOperation {
13687 pub(crate) fn new(
13688 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13689 ) -> Self {
13690 Self(RequestBuilder::new(stub))
13691 }
13692
13693 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13695 mut self,
13696 v: V,
13697 ) -> Self {
13698 self.0.request = v.into();
13699 self
13700 }
13701
13702 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13704 self.0.options = v.into();
13705 self
13706 }
13707
13708 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13710 (*self.0.stub)
13711 .get_operation(self.0.request, self.0.options)
13712 .await
13713 .map(crate::Response::into_body)
13714 }
13715
13716 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13718 self.0.request.name = v.into();
13719 self
13720 }
13721 }
13722
13723 #[doc(hidden)]
13724 impl crate::RequestBuilder for GetOperation {
13725 fn request_options(&mut self) -> &mut crate::RequestOptions {
13726 &mut self.0.options
13727 }
13728 }
13729
13730 #[derive(Clone, Debug)]
13747 pub struct CancelOperation(
13748 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13749 );
13750
13751 impl CancelOperation {
13752 pub(crate) fn new(
13753 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13754 ) -> Self {
13755 Self(RequestBuilder::new(stub))
13756 }
13757
13758 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13760 mut self,
13761 v: V,
13762 ) -> Self {
13763 self.0.request = v.into();
13764 self
13765 }
13766
13767 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13769 self.0.options = v.into();
13770 self
13771 }
13772
13773 pub async fn send(self) -> Result<()> {
13775 (*self.0.stub)
13776 .cancel_operation(self.0.request, self.0.options)
13777 .await
13778 .map(crate::Response::into_body)
13779 }
13780
13781 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13783 self.0.request.name = v.into();
13784 self
13785 }
13786 }
13787
13788 #[doc(hidden)]
13789 impl crate::RequestBuilder for CancelOperation {
13790 fn request_options(&mut self) -> &mut crate::RequestOptions {
13791 &mut self.0.options
13792 }
13793 }
13794}
13795
13796#[cfg(feature = "generators")]
13797#[cfg_attr(docsrs, doc(cfg(feature = "generators")))]
13798pub mod generators {
13799 use crate::Result;
13800
13801 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13815
13816 pub(crate) mod client {
13817 use super::super::super::client::Generators;
13818 pub struct Factory;
13819 impl crate::ClientFactory for Factory {
13820 type Client = Generators;
13821 type Credentials = gaxi::options::Credentials;
13822 async fn build(
13823 self,
13824 config: gaxi::options::ClientConfig,
13825 ) -> crate::ClientBuilderResult<Self::Client> {
13826 Self::Client::new(config).await
13827 }
13828 }
13829 }
13830
13831 #[derive(Clone, Debug)]
13833 pub(crate) struct RequestBuilder<R: std::default::Default> {
13834 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13835 request: R,
13836 options: crate::RequestOptions,
13837 }
13838
13839 impl<R> RequestBuilder<R>
13840 where
13841 R: std::default::Default,
13842 {
13843 pub(crate) fn new(
13844 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13845 ) -> Self {
13846 Self {
13847 stub,
13848 request: R::default(),
13849 options: crate::RequestOptions::default(),
13850 }
13851 }
13852 }
13853
13854 #[derive(Clone, Debug)]
13871 pub struct CreateGenerator(RequestBuilder<crate::model::CreateGeneratorRequest>);
13872
13873 impl CreateGenerator {
13874 pub(crate) fn new(
13875 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13876 ) -> Self {
13877 Self(RequestBuilder::new(stub))
13878 }
13879
13880 pub fn with_request<V: Into<crate::model::CreateGeneratorRequest>>(mut self, v: V) -> Self {
13882 self.0.request = v.into();
13883 self
13884 }
13885
13886 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13888 self.0.options = v.into();
13889 self
13890 }
13891
13892 pub async fn send(self) -> Result<crate::model::Generator> {
13894 (*self.0.stub)
13895 .create_generator(self.0.request, self.0.options)
13896 .await
13897 .map(crate::Response::into_body)
13898 }
13899
13900 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13904 self.0.request.parent = v.into();
13905 self
13906 }
13907
13908 pub fn set_generator<T>(mut self, v: T) -> Self
13912 where
13913 T: std::convert::Into<crate::model::Generator>,
13914 {
13915 self.0.request.generator = std::option::Option::Some(v.into());
13916 self
13917 }
13918
13919 pub fn set_or_clear_generator<T>(mut self, v: std::option::Option<T>) -> Self
13923 where
13924 T: std::convert::Into<crate::model::Generator>,
13925 {
13926 self.0.request.generator = v.map(|x| x.into());
13927 self
13928 }
13929
13930 pub fn set_generator_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
13932 self.0.request.generator_id = v.into();
13933 self
13934 }
13935 }
13936
13937 #[doc(hidden)]
13938 impl crate::RequestBuilder for CreateGenerator {
13939 fn request_options(&mut self) -> &mut crate::RequestOptions {
13940 &mut self.0.options
13941 }
13942 }
13943
13944 #[derive(Clone, Debug)]
13961 pub struct GetGenerator(RequestBuilder<crate::model::GetGeneratorRequest>);
13962
13963 impl GetGenerator {
13964 pub(crate) fn new(
13965 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13966 ) -> Self {
13967 Self(RequestBuilder::new(stub))
13968 }
13969
13970 pub fn with_request<V: Into<crate::model::GetGeneratorRequest>>(mut self, v: V) -> Self {
13972 self.0.request = v.into();
13973 self
13974 }
13975
13976 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13978 self.0.options = v.into();
13979 self
13980 }
13981
13982 pub async fn send(self) -> Result<crate::model::Generator> {
13984 (*self.0.stub)
13985 .get_generator(self.0.request, self.0.options)
13986 .await
13987 .map(crate::Response::into_body)
13988 }
13989
13990 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13994 self.0.request.name = v.into();
13995 self
13996 }
13997 }
13998
13999 #[doc(hidden)]
14000 impl crate::RequestBuilder for GetGenerator {
14001 fn request_options(&mut self) -> &mut crate::RequestOptions {
14002 &mut self.0.options
14003 }
14004 }
14005
14006 #[derive(Clone, Debug)]
14027 pub struct ListGenerators(RequestBuilder<crate::model::ListGeneratorsRequest>);
14028
14029 impl ListGenerators {
14030 pub(crate) fn new(
14031 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14032 ) -> Self {
14033 Self(RequestBuilder::new(stub))
14034 }
14035
14036 pub fn with_request<V: Into<crate::model::ListGeneratorsRequest>>(mut self, v: V) -> Self {
14038 self.0.request = v.into();
14039 self
14040 }
14041
14042 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14044 self.0.options = v.into();
14045 self
14046 }
14047
14048 pub async fn send(self) -> Result<crate::model::ListGeneratorsResponse> {
14050 (*self.0.stub)
14051 .list_generators(self.0.request, self.0.options)
14052 .await
14053 .map(crate::Response::into_body)
14054 }
14055
14056 pub fn by_page(
14058 self,
14059 ) -> impl google_cloud_gax::paginator::Paginator<
14060 crate::model::ListGeneratorsResponse,
14061 crate::Error,
14062 > {
14063 use std::clone::Clone;
14064 let token = self.0.request.page_token.clone();
14065 let execute = move |token: String| {
14066 let mut builder = self.clone();
14067 builder.0.request = builder.0.request.set_page_token(token);
14068 builder.send()
14069 };
14070 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14071 }
14072
14073 pub fn by_item(
14075 self,
14076 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14077 crate::model::ListGeneratorsResponse,
14078 crate::Error,
14079 > {
14080 use google_cloud_gax::paginator::Paginator;
14081 self.by_page().items()
14082 }
14083
14084 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14088 self.0.request.parent = v.into();
14089 self
14090 }
14091
14092 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14094 self.0.request.page_size = v.into();
14095 self
14096 }
14097
14098 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14100 self.0.request.page_token = v.into();
14101 self
14102 }
14103 }
14104
14105 #[doc(hidden)]
14106 impl crate::RequestBuilder for ListGenerators {
14107 fn request_options(&mut self) -> &mut crate::RequestOptions {
14108 &mut self.0.options
14109 }
14110 }
14111
14112 #[derive(Clone, Debug)]
14129 pub struct DeleteGenerator(RequestBuilder<crate::model::DeleteGeneratorRequest>);
14130
14131 impl DeleteGenerator {
14132 pub(crate) fn new(
14133 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14134 ) -> Self {
14135 Self(RequestBuilder::new(stub))
14136 }
14137
14138 pub fn with_request<V: Into<crate::model::DeleteGeneratorRequest>>(mut self, v: V) -> Self {
14140 self.0.request = v.into();
14141 self
14142 }
14143
14144 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14146 self.0.options = v.into();
14147 self
14148 }
14149
14150 pub async fn send(self) -> Result<()> {
14152 (*self.0.stub)
14153 .delete_generator(self.0.request, self.0.options)
14154 .await
14155 .map(crate::Response::into_body)
14156 }
14157
14158 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14162 self.0.request.name = v.into();
14163 self
14164 }
14165 }
14166
14167 #[doc(hidden)]
14168 impl crate::RequestBuilder for DeleteGenerator {
14169 fn request_options(&mut self) -> &mut crate::RequestOptions {
14170 &mut self.0.options
14171 }
14172 }
14173
14174 #[derive(Clone, Debug)]
14191 pub struct UpdateGenerator(RequestBuilder<crate::model::UpdateGeneratorRequest>);
14192
14193 impl UpdateGenerator {
14194 pub(crate) fn new(
14195 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14196 ) -> Self {
14197 Self(RequestBuilder::new(stub))
14198 }
14199
14200 pub fn with_request<V: Into<crate::model::UpdateGeneratorRequest>>(mut self, v: V) -> Self {
14202 self.0.request = v.into();
14203 self
14204 }
14205
14206 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14208 self.0.options = v.into();
14209 self
14210 }
14211
14212 pub async fn send(self) -> Result<crate::model::Generator> {
14214 (*self.0.stub)
14215 .update_generator(self.0.request, self.0.options)
14216 .await
14217 .map(crate::Response::into_body)
14218 }
14219
14220 pub fn set_generator<T>(mut self, v: T) -> Self
14224 where
14225 T: std::convert::Into<crate::model::Generator>,
14226 {
14227 self.0.request.generator = std::option::Option::Some(v.into());
14228 self
14229 }
14230
14231 pub fn set_or_clear_generator<T>(mut self, v: std::option::Option<T>) -> Self
14235 where
14236 T: std::convert::Into<crate::model::Generator>,
14237 {
14238 self.0.request.generator = v.map(|x| x.into());
14239 self
14240 }
14241
14242 pub fn set_update_mask<T>(mut self, v: T) -> Self
14244 where
14245 T: std::convert::Into<wkt::FieldMask>,
14246 {
14247 self.0.request.update_mask = std::option::Option::Some(v.into());
14248 self
14249 }
14250
14251 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14253 where
14254 T: std::convert::Into<wkt::FieldMask>,
14255 {
14256 self.0.request.update_mask = v.map(|x| x.into());
14257 self
14258 }
14259 }
14260
14261 #[doc(hidden)]
14262 impl crate::RequestBuilder for UpdateGenerator {
14263 fn request_options(&mut self) -> &mut crate::RequestOptions {
14264 &mut self.0.options
14265 }
14266 }
14267
14268 #[derive(Clone, Debug)]
14289 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
14290
14291 impl ListLocations {
14292 pub(crate) fn new(
14293 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14294 ) -> Self {
14295 Self(RequestBuilder::new(stub))
14296 }
14297
14298 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
14300 mut self,
14301 v: V,
14302 ) -> Self {
14303 self.0.request = v.into();
14304 self
14305 }
14306
14307 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14309 self.0.options = v.into();
14310 self
14311 }
14312
14313 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
14315 (*self.0.stub)
14316 .list_locations(self.0.request, self.0.options)
14317 .await
14318 .map(crate::Response::into_body)
14319 }
14320
14321 pub fn by_page(
14323 self,
14324 ) -> impl google_cloud_gax::paginator::Paginator<
14325 google_cloud_location::model::ListLocationsResponse,
14326 crate::Error,
14327 > {
14328 use std::clone::Clone;
14329 let token = self.0.request.page_token.clone();
14330 let execute = move |token: String| {
14331 let mut builder = self.clone();
14332 builder.0.request = builder.0.request.set_page_token(token);
14333 builder.send()
14334 };
14335 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14336 }
14337
14338 pub fn by_item(
14340 self,
14341 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14342 google_cloud_location::model::ListLocationsResponse,
14343 crate::Error,
14344 > {
14345 use google_cloud_gax::paginator::Paginator;
14346 self.by_page().items()
14347 }
14348
14349 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14351 self.0.request.name = v.into();
14352 self
14353 }
14354
14355 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14357 self.0.request.filter = v.into();
14358 self
14359 }
14360
14361 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14363 self.0.request.page_size = v.into();
14364 self
14365 }
14366
14367 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14369 self.0.request.page_token = v.into();
14370 self
14371 }
14372 }
14373
14374 #[doc(hidden)]
14375 impl crate::RequestBuilder for ListLocations {
14376 fn request_options(&mut self) -> &mut crate::RequestOptions {
14377 &mut self.0.options
14378 }
14379 }
14380
14381 #[derive(Clone, Debug)]
14398 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
14399
14400 impl GetLocation {
14401 pub(crate) fn new(
14402 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14403 ) -> Self {
14404 Self(RequestBuilder::new(stub))
14405 }
14406
14407 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
14409 mut self,
14410 v: V,
14411 ) -> Self {
14412 self.0.request = v.into();
14413 self
14414 }
14415
14416 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14418 self.0.options = v.into();
14419 self
14420 }
14421
14422 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
14424 (*self.0.stub)
14425 .get_location(self.0.request, self.0.options)
14426 .await
14427 .map(crate::Response::into_body)
14428 }
14429
14430 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14432 self.0.request.name = v.into();
14433 self
14434 }
14435 }
14436
14437 #[doc(hidden)]
14438 impl crate::RequestBuilder for GetLocation {
14439 fn request_options(&mut self) -> &mut crate::RequestOptions {
14440 &mut self.0.options
14441 }
14442 }
14443
14444 #[derive(Clone, Debug)]
14465 pub struct ListOperations(
14466 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
14467 );
14468
14469 impl ListOperations {
14470 pub(crate) fn new(
14471 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14472 ) -> Self {
14473 Self(RequestBuilder::new(stub))
14474 }
14475
14476 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
14478 mut self,
14479 v: V,
14480 ) -> Self {
14481 self.0.request = v.into();
14482 self
14483 }
14484
14485 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14487 self.0.options = v.into();
14488 self
14489 }
14490
14491 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
14493 (*self.0.stub)
14494 .list_operations(self.0.request, self.0.options)
14495 .await
14496 .map(crate::Response::into_body)
14497 }
14498
14499 pub fn by_page(
14501 self,
14502 ) -> impl google_cloud_gax::paginator::Paginator<
14503 google_cloud_longrunning::model::ListOperationsResponse,
14504 crate::Error,
14505 > {
14506 use std::clone::Clone;
14507 let token = self.0.request.page_token.clone();
14508 let execute = move |token: String| {
14509 let mut builder = self.clone();
14510 builder.0.request = builder.0.request.set_page_token(token);
14511 builder.send()
14512 };
14513 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14514 }
14515
14516 pub fn by_item(
14518 self,
14519 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14520 google_cloud_longrunning::model::ListOperationsResponse,
14521 crate::Error,
14522 > {
14523 use google_cloud_gax::paginator::Paginator;
14524 self.by_page().items()
14525 }
14526
14527 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14529 self.0.request.name = v.into();
14530 self
14531 }
14532
14533 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14535 self.0.request.filter = v.into();
14536 self
14537 }
14538
14539 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14541 self.0.request.page_size = v.into();
14542 self
14543 }
14544
14545 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14547 self.0.request.page_token = v.into();
14548 self
14549 }
14550
14551 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14553 self.0.request.return_partial_success = v.into();
14554 self
14555 }
14556 }
14557
14558 #[doc(hidden)]
14559 impl crate::RequestBuilder for ListOperations {
14560 fn request_options(&mut self) -> &mut crate::RequestOptions {
14561 &mut self.0.options
14562 }
14563 }
14564
14565 #[derive(Clone, Debug)]
14582 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14583
14584 impl GetOperation {
14585 pub(crate) fn new(
14586 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14587 ) -> Self {
14588 Self(RequestBuilder::new(stub))
14589 }
14590
14591 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14593 mut self,
14594 v: V,
14595 ) -> Self {
14596 self.0.request = v.into();
14597 self
14598 }
14599
14600 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14602 self.0.options = v.into();
14603 self
14604 }
14605
14606 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14608 (*self.0.stub)
14609 .get_operation(self.0.request, self.0.options)
14610 .await
14611 .map(crate::Response::into_body)
14612 }
14613
14614 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14616 self.0.request.name = v.into();
14617 self
14618 }
14619 }
14620
14621 #[doc(hidden)]
14622 impl crate::RequestBuilder for GetOperation {
14623 fn request_options(&mut self) -> &mut crate::RequestOptions {
14624 &mut self.0.options
14625 }
14626 }
14627
14628 #[derive(Clone, Debug)]
14645 pub struct CancelOperation(
14646 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14647 );
14648
14649 impl CancelOperation {
14650 pub(crate) fn new(
14651 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14652 ) -> Self {
14653 Self(RequestBuilder::new(stub))
14654 }
14655
14656 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
14658 mut self,
14659 v: V,
14660 ) -> Self {
14661 self.0.request = v.into();
14662 self
14663 }
14664
14665 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14667 self.0.options = v.into();
14668 self
14669 }
14670
14671 pub async fn send(self) -> Result<()> {
14673 (*self.0.stub)
14674 .cancel_operation(self.0.request, self.0.options)
14675 .await
14676 .map(crate::Response::into_body)
14677 }
14678
14679 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14681 self.0.request.name = v.into();
14682 self
14683 }
14684 }
14685
14686 #[doc(hidden)]
14687 impl crate::RequestBuilder for CancelOperation {
14688 fn request_options(&mut self) -> &mut crate::RequestOptions {
14689 &mut self.0.options
14690 }
14691 }
14692}
14693
14694#[cfg(feature = "generator-evaluations")]
14695#[cfg_attr(docsrs, doc(cfg(feature = "generator-evaluations")))]
14696pub mod generator_evaluations {
14697 use crate::Result;
14698
14699 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14713
14714 pub(crate) mod client {
14715 use super::super::super::client::GeneratorEvaluations;
14716 pub struct Factory;
14717 impl crate::ClientFactory for Factory {
14718 type Client = GeneratorEvaluations;
14719 type Credentials = gaxi::options::Credentials;
14720 async fn build(
14721 self,
14722 config: gaxi::options::ClientConfig,
14723 ) -> crate::ClientBuilderResult<Self::Client> {
14724 Self::Client::new(config).await
14725 }
14726 }
14727 }
14728
14729 #[derive(Clone, Debug)]
14731 pub(crate) struct RequestBuilder<R: std::default::Default> {
14732 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14733 request: R,
14734 options: crate::RequestOptions,
14735 }
14736
14737 impl<R> RequestBuilder<R>
14738 where
14739 R: std::default::Default,
14740 {
14741 pub(crate) fn new(
14742 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14743 ) -> Self {
14744 Self {
14745 stub,
14746 request: R::default(),
14747 options: crate::RequestOptions::default(),
14748 }
14749 }
14750 }
14751
14752 #[derive(Clone, Debug)]
14770 pub struct CreateGeneratorEvaluation(
14771 RequestBuilder<crate::model::CreateGeneratorEvaluationRequest>,
14772 );
14773
14774 impl CreateGeneratorEvaluation {
14775 pub(crate) fn new(
14776 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14777 ) -> Self {
14778 Self(RequestBuilder::new(stub))
14779 }
14780
14781 pub fn with_request<V: Into<crate::model::CreateGeneratorEvaluationRequest>>(
14783 mut self,
14784 v: V,
14785 ) -> Self {
14786 self.0.request = v.into();
14787 self
14788 }
14789
14790 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14792 self.0.options = v.into();
14793 self
14794 }
14795
14796 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14803 (*self.0.stub)
14804 .create_generator_evaluation(self.0.request, self.0.options)
14805 .await
14806 .map(crate::Response::into_body)
14807 }
14808
14809 pub fn poller(
14811 self,
14812 ) -> impl google_cloud_lro::Poller<
14813 crate::model::GeneratorEvaluation,
14814 crate::model::GeneratorEvaluationOperationMetadata,
14815 > {
14816 type Operation = google_cloud_lro::internal::Operation<
14817 crate::model::GeneratorEvaluation,
14818 crate::model::GeneratorEvaluationOperationMetadata,
14819 >;
14820 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14821 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14822
14823 let stub = self.0.stub.clone();
14824 let mut options = self.0.options.clone();
14825 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14826 let query = move |name| {
14827 let stub = stub.clone();
14828 let options = options.clone();
14829 async {
14830 let op = GetOperation::new(stub)
14831 .set_name(name)
14832 .with_options(options)
14833 .send()
14834 .await?;
14835 Ok(Operation::new(op))
14836 }
14837 };
14838
14839 let start = move || async {
14840 let op = self.send().await?;
14841 Ok(Operation::new(op))
14842 };
14843
14844 google_cloud_lro::internal::new_poller(
14845 polling_error_policy,
14846 polling_backoff_policy,
14847 start,
14848 query,
14849 )
14850 }
14851
14852 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14856 self.0.request.parent = v.into();
14857 self
14858 }
14859
14860 pub fn set_generator_evaluation<T>(mut self, v: T) -> Self
14864 where
14865 T: std::convert::Into<crate::model::GeneratorEvaluation>,
14866 {
14867 self.0.request.generator_evaluation = std::option::Option::Some(v.into());
14868 self
14869 }
14870
14871 pub fn set_or_clear_generator_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
14875 where
14876 T: std::convert::Into<crate::model::GeneratorEvaluation>,
14877 {
14878 self.0.request.generator_evaluation = v.map(|x| x.into());
14879 self
14880 }
14881 }
14882
14883 #[doc(hidden)]
14884 impl crate::RequestBuilder for CreateGeneratorEvaluation {
14885 fn request_options(&mut self) -> &mut crate::RequestOptions {
14886 &mut self.0.options
14887 }
14888 }
14889
14890 #[derive(Clone, Debug)]
14907 pub struct GetGeneratorEvaluation(RequestBuilder<crate::model::GetGeneratorEvaluationRequest>);
14908
14909 impl GetGeneratorEvaluation {
14910 pub(crate) fn new(
14911 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14912 ) -> Self {
14913 Self(RequestBuilder::new(stub))
14914 }
14915
14916 pub fn with_request<V: Into<crate::model::GetGeneratorEvaluationRequest>>(
14918 mut self,
14919 v: V,
14920 ) -> Self {
14921 self.0.request = v.into();
14922 self
14923 }
14924
14925 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14927 self.0.options = v.into();
14928 self
14929 }
14930
14931 pub async fn send(self) -> Result<crate::model::GeneratorEvaluation> {
14933 (*self.0.stub)
14934 .get_generator_evaluation(self.0.request, self.0.options)
14935 .await
14936 .map(crate::Response::into_body)
14937 }
14938
14939 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14943 self.0.request.name = v.into();
14944 self
14945 }
14946 }
14947
14948 #[doc(hidden)]
14949 impl crate::RequestBuilder for GetGeneratorEvaluation {
14950 fn request_options(&mut self) -> &mut crate::RequestOptions {
14951 &mut self.0.options
14952 }
14953 }
14954
14955 #[derive(Clone, Debug)]
14976 pub struct ListGeneratorEvaluations(
14977 RequestBuilder<crate::model::ListGeneratorEvaluationsRequest>,
14978 );
14979
14980 impl ListGeneratorEvaluations {
14981 pub(crate) fn new(
14982 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14983 ) -> Self {
14984 Self(RequestBuilder::new(stub))
14985 }
14986
14987 pub fn with_request<V: Into<crate::model::ListGeneratorEvaluationsRequest>>(
14989 mut self,
14990 v: V,
14991 ) -> Self {
14992 self.0.request = v.into();
14993 self
14994 }
14995
14996 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14998 self.0.options = v.into();
14999 self
15000 }
15001
15002 pub async fn send(self) -> Result<crate::model::ListGeneratorEvaluationsResponse> {
15004 (*self.0.stub)
15005 .list_generator_evaluations(self.0.request, self.0.options)
15006 .await
15007 .map(crate::Response::into_body)
15008 }
15009
15010 pub fn by_page(
15012 self,
15013 ) -> impl google_cloud_gax::paginator::Paginator<
15014 crate::model::ListGeneratorEvaluationsResponse,
15015 crate::Error,
15016 > {
15017 use std::clone::Clone;
15018 let token = self.0.request.page_token.clone();
15019 let execute = move |token: String| {
15020 let mut builder = self.clone();
15021 builder.0.request = builder.0.request.set_page_token(token);
15022 builder.send()
15023 };
15024 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15025 }
15026
15027 pub fn by_item(
15029 self,
15030 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15031 crate::model::ListGeneratorEvaluationsResponse,
15032 crate::Error,
15033 > {
15034 use google_cloud_gax::paginator::Paginator;
15035 self.by_page().items()
15036 }
15037
15038 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15042 self.0.request.parent = v.into();
15043 self
15044 }
15045
15046 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15048 self.0.request.page_size = v.into();
15049 self
15050 }
15051
15052 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15054 self.0.request.page_token = v.into();
15055 self
15056 }
15057 }
15058
15059 #[doc(hidden)]
15060 impl crate::RequestBuilder for ListGeneratorEvaluations {
15061 fn request_options(&mut self) -> &mut crate::RequestOptions {
15062 &mut self.0.options
15063 }
15064 }
15065
15066 #[derive(Clone, Debug)]
15083 pub struct DeleteGeneratorEvaluation(
15084 RequestBuilder<crate::model::DeleteGeneratorEvaluationRequest>,
15085 );
15086
15087 impl DeleteGeneratorEvaluation {
15088 pub(crate) fn new(
15089 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15090 ) -> Self {
15091 Self(RequestBuilder::new(stub))
15092 }
15093
15094 pub fn with_request<V: Into<crate::model::DeleteGeneratorEvaluationRequest>>(
15096 mut self,
15097 v: V,
15098 ) -> Self {
15099 self.0.request = v.into();
15100 self
15101 }
15102
15103 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15105 self.0.options = v.into();
15106 self
15107 }
15108
15109 pub async fn send(self) -> Result<()> {
15111 (*self.0.stub)
15112 .delete_generator_evaluation(self.0.request, self.0.options)
15113 .await
15114 .map(crate::Response::into_body)
15115 }
15116
15117 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15121 self.0.request.name = v.into();
15122 self
15123 }
15124 }
15125
15126 #[doc(hidden)]
15127 impl crate::RequestBuilder for DeleteGeneratorEvaluation {
15128 fn request_options(&mut self) -> &mut crate::RequestOptions {
15129 &mut self.0.options
15130 }
15131 }
15132
15133 #[derive(Clone, Debug)]
15154 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
15155
15156 impl ListLocations {
15157 pub(crate) fn new(
15158 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15159 ) -> Self {
15160 Self(RequestBuilder::new(stub))
15161 }
15162
15163 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
15165 mut self,
15166 v: V,
15167 ) -> Self {
15168 self.0.request = v.into();
15169 self
15170 }
15171
15172 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15174 self.0.options = v.into();
15175 self
15176 }
15177
15178 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
15180 (*self.0.stub)
15181 .list_locations(self.0.request, self.0.options)
15182 .await
15183 .map(crate::Response::into_body)
15184 }
15185
15186 pub fn by_page(
15188 self,
15189 ) -> impl google_cloud_gax::paginator::Paginator<
15190 google_cloud_location::model::ListLocationsResponse,
15191 crate::Error,
15192 > {
15193 use std::clone::Clone;
15194 let token = self.0.request.page_token.clone();
15195 let execute = move |token: String| {
15196 let mut builder = self.clone();
15197 builder.0.request = builder.0.request.set_page_token(token);
15198 builder.send()
15199 };
15200 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15201 }
15202
15203 pub fn by_item(
15205 self,
15206 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15207 google_cloud_location::model::ListLocationsResponse,
15208 crate::Error,
15209 > {
15210 use google_cloud_gax::paginator::Paginator;
15211 self.by_page().items()
15212 }
15213
15214 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15216 self.0.request.name = v.into();
15217 self
15218 }
15219
15220 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15222 self.0.request.filter = v.into();
15223 self
15224 }
15225
15226 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15228 self.0.request.page_size = v.into();
15229 self
15230 }
15231
15232 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15234 self.0.request.page_token = v.into();
15235 self
15236 }
15237 }
15238
15239 #[doc(hidden)]
15240 impl crate::RequestBuilder for ListLocations {
15241 fn request_options(&mut self) -> &mut crate::RequestOptions {
15242 &mut self.0.options
15243 }
15244 }
15245
15246 #[derive(Clone, Debug)]
15263 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
15264
15265 impl GetLocation {
15266 pub(crate) fn new(
15267 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15268 ) -> Self {
15269 Self(RequestBuilder::new(stub))
15270 }
15271
15272 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
15274 mut self,
15275 v: V,
15276 ) -> Self {
15277 self.0.request = v.into();
15278 self
15279 }
15280
15281 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15283 self.0.options = v.into();
15284 self
15285 }
15286
15287 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
15289 (*self.0.stub)
15290 .get_location(self.0.request, self.0.options)
15291 .await
15292 .map(crate::Response::into_body)
15293 }
15294
15295 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15297 self.0.request.name = v.into();
15298 self
15299 }
15300 }
15301
15302 #[doc(hidden)]
15303 impl crate::RequestBuilder for GetLocation {
15304 fn request_options(&mut self) -> &mut crate::RequestOptions {
15305 &mut self.0.options
15306 }
15307 }
15308
15309 #[derive(Clone, Debug)]
15330 pub struct ListOperations(
15331 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
15332 );
15333
15334 impl ListOperations {
15335 pub(crate) fn new(
15336 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15337 ) -> Self {
15338 Self(RequestBuilder::new(stub))
15339 }
15340
15341 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
15343 mut self,
15344 v: V,
15345 ) -> Self {
15346 self.0.request = v.into();
15347 self
15348 }
15349
15350 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15352 self.0.options = v.into();
15353 self
15354 }
15355
15356 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
15358 (*self.0.stub)
15359 .list_operations(self.0.request, self.0.options)
15360 .await
15361 .map(crate::Response::into_body)
15362 }
15363
15364 pub fn by_page(
15366 self,
15367 ) -> impl google_cloud_gax::paginator::Paginator<
15368 google_cloud_longrunning::model::ListOperationsResponse,
15369 crate::Error,
15370 > {
15371 use std::clone::Clone;
15372 let token = self.0.request.page_token.clone();
15373 let execute = move |token: String| {
15374 let mut builder = self.clone();
15375 builder.0.request = builder.0.request.set_page_token(token);
15376 builder.send()
15377 };
15378 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15379 }
15380
15381 pub fn by_item(
15383 self,
15384 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15385 google_cloud_longrunning::model::ListOperationsResponse,
15386 crate::Error,
15387 > {
15388 use google_cloud_gax::paginator::Paginator;
15389 self.by_page().items()
15390 }
15391
15392 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15394 self.0.request.name = v.into();
15395 self
15396 }
15397
15398 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15400 self.0.request.filter = v.into();
15401 self
15402 }
15403
15404 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15406 self.0.request.page_size = v.into();
15407 self
15408 }
15409
15410 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15412 self.0.request.page_token = v.into();
15413 self
15414 }
15415
15416 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
15418 self.0.request.return_partial_success = v.into();
15419 self
15420 }
15421 }
15422
15423 #[doc(hidden)]
15424 impl crate::RequestBuilder for ListOperations {
15425 fn request_options(&mut self) -> &mut crate::RequestOptions {
15426 &mut self.0.options
15427 }
15428 }
15429
15430 #[derive(Clone, Debug)]
15447 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
15448
15449 impl GetOperation {
15450 pub(crate) fn new(
15451 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15452 ) -> Self {
15453 Self(RequestBuilder::new(stub))
15454 }
15455
15456 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
15458 mut self,
15459 v: V,
15460 ) -> Self {
15461 self.0.request = v.into();
15462 self
15463 }
15464
15465 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15467 self.0.options = v.into();
15468 self
15469 }
15470
15471 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15473 (*self.0.stub)
15474 .get_operation(self.0.request, self.0.options)
15475 .await
15476 .map(crate::Response::into_body)
15477 }
15478
15479 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15481 self.0.request.name = v.into();
15482 self
15483 }
15484 }
15485
15486 #[doc(hidden)]
15487 impl crate::RequestBuilder for GetOperation {
15488 fn request_options(&mut self) -> &mut crate::RequestOptions {
15489 &mut self.0.options
15490 }
15491 }
15492
15493 #[derive(Clone, Debug)]
15510 pub struct CancelOperation(
15511 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
15512 );
15513
15514 impl CancelOperation {
15515 pub(crate) fn new(
15516 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15517 ) -> Self {
15518 Self(RequestBuilder::new(stub))
15519 }
15520
15521 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
15523 mut self,
15524 v: V,
15525 ) -> Self {
15526 self.0.request = v.into();
15527 self
15528 }
15529
15530 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15532 self.0.options = v.into();
15533 self
15534 }
15535
15536 pub async fn send(self) -> Result<()> {
15538 (*self.0.stub)
15539 .cancel_operation(self.0.request, self.0.options)
15540 .await
15541 .map(crate::Response::into_body)
15542 }
15543
15544 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15546 self.0.request.name = v.into();
15547 self
15548 }
15549 }
15550
15551 #[doc(hidden)]
15552 impl crate::RequestBuilder for CancelOperation {
15553 fn request_options(&mut self) -> &mut crate::RequestOptions {
15554 &mut self.0.options
15555 }
15556 }
15557}
15558
15559#[cfg(feature = "intents")]
15560#[cfg_attr(docsrs, doc(cfg(feature = "intents")))]
15561pub mod intents {
15562 use crate::Result;
15563
15564 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
15578
15579 pub(crate) mod client {
15580 use super::super::super::client::Intents;
15581 pub struct Factory;
15582 impl crate::ClientFactory for Factory {
15583 type Client = Intents;
15584 type Credentials = gaxi::options::Credentials;
15585 async fn build(
15586 self,
15587 config: gaxi::options::ClientConfig,
15588 ) -> crate::ClientBuilderResult<Self::Client> {
15589 Self::Client::new(config).await
15590 }
15591 }
15592 }
15593
15594 #[derive(Clone, Debug)]
15596 pub(crate) struct RequestBuilder<R: std::default::Default> {
15597 stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>,
15598 request: R,
15599 options: crate::RequestOptions,
15600 }
15601
15602 impl<R> RequestBuilder<R>
15603 where
15604 R: std::default::Default,
15605 {
15606 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15607 Self {
15608 stub,
15609 request: R::default(),
15610 options: crate::RequestOptions::default(),
15611 }
15612 }
15613 }
15614
15615 #[derive(Clone, Debug)]
15636 pub struct ListIntents(RequestBuilder<crate::model::ListIntentsRequest>);
15637
15638 impl ListIntents {
15639 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15640 Self(RequestBuilder::new(stub))
15641 }
15642
15643 pub fn with_request<V: Into<crate::model::ListIntentsRequest>>(mut self, v: V) -> Self {
15645 self.0.request = v.into();
15646 self
15647 }
15648
15649 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15651 self.0.options = v.into();
15652 self
15653 }
15654
15655 pub async fn send(self) -> Result<crate::model::ListIntentsResponse> {
15657 (*self.0.stub)
15658 .list_intents(self.0.request, self.0.options)
15659 .await
15660 .map(crate::Response::into_body)
15661 }
15662
15663 pub fn by_page(
15665 self,
15666 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListIntentsResponse, crate::Error>
15667 {
15668 use std::clone::Clone;
15669 let token = self.0.request.page_token.clone();
15670 let execute = move |token: String| {
15671 let mut builder = self.clone();
15672 builder.0.request = builder.0.request.set_page_token(token);
15673 builder.send()
15674 };
15675 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15676 }
15677
15678 pub fn by_item(
15680 self,
15681 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15682 crate::model::ListIntentsResponse,
15683 crate::Error,
15684 > {
15685 use google_cloud_gax::paginator::Paginator;
15686 self.by_page().items()
15687 }
15688
15689 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15693 self.0.request.parent = v.into();
15694 self
15695 }
15696
15697 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15699 self.0.request.language_code = v.into();
15700 self
15701 }
15702
15703 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
15705 self.0.request.intent_view = v.into();
15706 self
15707 }
15708
15709 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15711 self.0.request.page_size = v.into();
15712 self
15713 }
15714
15715 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15717 self.0.request.page_token = v.into();
15718 self
15719 }
15720 }
15721
15722 #[doc(hidden)]
15723 impl crate::RequestBuilder for ListIntents {
15724 fn request_options(&mut self) -> &mut crate::RequestOptions {
15725 &mut self.0.options
15726 }
15727 }
15728
15729 #[derive(Clone, Debug)]
15746 pub struct GetIntent(RequestBuilder<crate::model::GetIntentRequest>);
15747
15748 impl GetIntent {
15749 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15750 Self(RequestBuilder::new(stub))
15751 }
15752
15753 pub fn with_request<V: Into<crate::model::GetIntentRequest>>(mut self, v: V) -> Self {
15755 self.0.request = v.into();
15756 self
15757 }
15758
15759 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15761 self.0.options = v.into();
15762 self
15763 }
15764
15765 pub async fn send(self) -> Result<crate::model::Intent> {
15767 (*self.0.stub)
15768 .get_intent(self.0.request, self.0.options)
15769 .await
15770 .map(crate::Response::into_body)
15771 }
15772
15773 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15777 self.0.request.name = v.into();
15778 self
15779 }
15780
15781 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15783 self.0.request.language_code = v.into();
15784 self
15785 }
15786
15787 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
15789 self.0.request.intent_view = v.into();
15790 self
15791 }
15792 }
15793
15794 #[doc(hidden)]
15795 impl crate::RequestBuilder for GetIntent {
15796 fn request_options(&mut self) -> &mut crate::RequestOptions {
15797 &mut self.0.options
15798 }
15799 }
15800
15801 #[derive(Clone, Debug)]
15818 pub struct CreateIntent(RequestBuilder<crate::model::CreateIntentRequest>);
15819
15820 impl CreateIntent {
15821 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15822 Self(RequestBuilder::new(stub))
15823 }
15824
15825 pub fn with_request<V: Into<crate::model::CreateIntentRequest>>(mut self, v: V) -> Self {
15827 self.0.request = v.into();
15828 self
15829 }
15830
15831 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15833 self.0.options = v.into();
15834 self
15835 }
15836
15837 pub async fn send(self) -> Result<crate::model::Intent> {
15839 (*self.0.stub)
15840 .create_intent(self.0.request, self.0.options)
15841 .await
15842 .map(crate::Response::into_body)
15843 }
15844
15845 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15849 self.0.request.parent = v.into();
15850 self
15851 }
15852
15853 pub fn set_intent<T>(mut self, v: T) -> Self
15857 where
15858 T: std::convert::Into<crate::model::Intent>,
15859 {
15860 self.0.request.intent = std::option::Option::Some(v.into());
15861 self
15862 }
15863
15864 pub fn set_or_clear_intent<T>(mut self, v: std::option::Option<T>) -> Self
15868 where
15869 T: std::convert::Into<crate::model::Intent>,
15870 {
15871 self.0.request.intent = v.map(|x| x.into());
15872 self
15873 }
15874
15875 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15877 self.0.request.language_code = v.into();
15878 self
15879 }
15880
15881 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
15883 self.0.request.intent_view = v.into();
15884 self
15885 }
15886 }
15887
15888 #[doc(hidden)]
15889 impl crate::RequestBuilder for CreateIntent {
15890 fn request_options(&mut self) -> &mut crate::RequestOptions {
15891 &mut self.0.options
15892 }
15893 }
15894
15895 #[derive(Clone, Debug)]
15912 pub struct UpdateIntent(RequestBuilder<crate::model::UpdateIntentRequest>);
15913
15914 impl UpdateIntent {
15915 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15916 Self(RequestBuilder::new(stub))
15917 }
15918
15919 pub fn with_request<V: Into<crate::model::UpdateIntentRequest>>(mut self, v: V) -> Self {
15921 self.0.request = v.into();
15922 self
15923 }
15924
15925 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15927 self.0.options = v.into();
15928 self
15929 }
15930
15931 pub async fn send(self) -> Result<crate::model::Intent> {
15933 (*self.0.stub)
15934 .update_intent(self.0.request, self.0.options)
15935 .await
15936 .map(crate::Response::into_body)
15937 }
15938
15939 pub fn set_intent<T>(mut self, v: T) -> Self
15943 where
15944 T: std::convert::Into<crate::model::Intent>,
15945 {
15946 self.0.request.intent = std::option::Option::Some(v.into());
15947 self
15948 }
15949
15950 pub fn set_or_clear_intent<T>(mut self, v: std::option::Option<T>) -> Self
15954 where
15955 T: std::convert::Into<crate::model::Intent>,
15956 {
15957 self.0.request.intent = v.map(|x| x.into());
15958 self
15959 }
15960
15961 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15963 self.0.request.language_code = v.into();
15964 self
15965 }
15966
15967 pub fn set_update_mask<T>(mut self, v: T) -> Self
15969 where
15970 T: std::convert::Into<wkt::FieldMask>,
15971 {
15972 self.0.request.update_mask = std::option::Option::Some(v.into());
15973 self
15974 }
15975
15976 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15978 where
15979 T: std::convert::Into<wkt::FieldMask>,
15980 {
15981 self.0.request.update_mask = v.map(|x| x.into());
15982 self
15983 }
15984
15985 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
15987 self.0.request.intent_view = v.into();
15988 self
15989 }
15990 }
15991
15992 #[doc(hidden)]
15993 impl crate::RequestBuilder for UpdateIntent {
15994 fn request_options(&mut self) -> &mut crate::RequestOptions {
15995 &mut self.0.options
15996 }
15997 }
15998
15999 #[derive(Clone, Debug)]
16016 pub struct DeleteIntent(RequestBuilder<crate::model::DeleteIntentRequest>);
16017
16018 impl DeleteIntent {
16019 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16020 Self(RequestBuilder::new(stub))
16021 }
16022
16023 pub fn with_request<V: Into<crate::model::DeleteIntentRequest>>(mut self, v: V) -> Self {
16025 self.0.request = v.into();
16026 self
16027 }
16028
16029 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16031 self.0.options = v.into();
16032 self
16033 }
16034
16035 pub async fn send(self) -> Result<()> {
16037 (*self.0.stub)
16038 .delete_intent(self.0.request, self.0.options)
16039 .await
16040 .map(crate::Response::into_body)
16041 }
16042
16043 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16047 self.0.request.name = v.into();
16048 self
16049 }
16050 }
16051
16052 #[doc(hidden)]
16053 impl crate::RequestBuilder for DeleteIntent {
16054 fn request_options(&mut self) -> &mut crate::RequestOptions {
16055 &mut self.0.options
16056 }
16057 }
16058
16059 #[derive(Clone, Debug)]
16077 pub struct BatchUpdateIntents(RequestBuilder<crate::model::BatchUpdateIntentsRequest>);
16078
16079 impl BatchUpdateIntents {
16080 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16081 Self(RequestBuilder::new(stub))
16082 }
16083
16084 pub fn with_request<V: Into<crate::model::BatchUpdateIntentsRequest>>(
16086 mut self,
16087 v: V,
16088 ) -> Self {
16089 self.0.request = v.into();
16090 self
16091 }
16092
16093 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16095 self.0.options = v.into();
16096 self
16097 }
16098
16099 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16106 (*self.0.stub)
16107 .batch_update_intents(self.0.request, self.0.options)
16108 .await
16109 .map(crate::Response::into_body)
16110 }
16111
16112 pub fn poller(
16114 self,
16115 ) -> impl google_cloud_lro::Poller<crate::model::BatchUpdateIntentsResponse, wkt::Struct>
16116 {
16117 type Operation = google_cloud_lro::internal::Operation<
16118 crate::model::BatchUpdateIntentsResponse,
16119 wkt::Struct,
16120 >;
16121 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16122 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16123
16124 let stub = self.0.stub.clone();
16125 let mut options = self.0.options.clone();
16126 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16127 let query = move |name| {
16128 let stub = stub.clone();
16129 let options = options.clone();
16130 async {
16131 let op = GetOperation::new(stub)
16132 .set_name(name)
16133 .with_options(options)
16134 .send()
16135 .await?;
16136 Ok(Operation::new(op))
16137 }
16138 };
16139
16140 let start = move || async {
16141 let op = self.send().await?;
16142 Ok(Operation::new(op))
16143 };
16144
16145 google_cloud_lro::internal::new_poller(
16146 polling_error_policy,
16147 polling_backoff_policy,
16148 start,
16149 query,
16150 )
16151 }
16152
16153 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16157 self.0.request.parent = v.into();
16158 self
16159 }
16160
16161 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
16163 self.0.request.language_code = v.into();
16164 self
16165 }
16166
16167 pub fn set_update_mask<T>(mut self, v: T) -> Self
16169 where
16170 T: std::convert::Into<wkt::FieldMask>,
16171 {
16172 self.0.request.update_mask = std::option::Option::Some(v.into());
16173 self
16174 }
16175
16176 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
16178 where
16179 T: std::convert::Into<wkt::FieldMask>,
16180 {
16181 self.0.request.update_mask = v.map(|x| x.into());
16182 self
16183 }
16184
16185 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
16187 self.0.request.intent_view = v.into();
16188 self
16189 }
16190
16191 pub fn set_intent_batch<
16196 T: Into<Option<crate::model::batch_update_intents_request::IntentBatch>>,
16197 >(
16198 mut self,
16199 v: T,
16200 ) -> Self {
16201 self.0.request.intent_batch = v.into();
16202 self
16203 }
16204
16205 pub fn set_intent_batch_uri<T: std::convert::Into<std::string::String>>(
16211 mut self,
16212 v: T,
16213 ) -> Self {
16214 self.0.request = self.0.request.set_intent_batch_uri(v);
16215 self
16216 }
16217
16218 pub fn set_intent_batch_inline<
16224 T: std::convert::Into<std::boxed::Box<crate::model::IntentBatch>>,
16225 >(
16226 mut self,
16227 v: T,
16228 ) -> Self {
16229 self.0.request = self.0.request.set_intent_batch_inline(v);
16230 self
16231 }
16232 }
16233
16234 #[doc(hidden)]
16235 impl crate::RequestBuilder for BatchUpdateIntents {
16236 fn request_options(&mut self) -> &mut crate::RequestOptions {
16237 &mut self.0.options
16238 }
16239 }
16240
16241 #[derive(Clone, Debug)]
16259 pub struct BatchDeleteIntents(RequestBuilder<crate::model::BatchDeleteIntentsRequest>);
16260
16261 impl BatchDeleteIntents {
16262 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16263 Self(RequestBuilder::new(stub))
16264 }
16265
16266 pub fn with_request<V: Into<crate::model::BatchDeleteIntentsRequest>>(
16268 mut self,
16269 v: V,
16270 ) -> Self {
16271 self.0.request = v.into();
16272 self
16273 }
16274
16275 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16277 self.0.options = v.into();
16278 self
16279 }
16280
16281 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16288 (*self.0.stub)
16289 .batch_delete_intents(self.0.request, self.0.options)
16290 .await
16291 .map(crate::Response::into_body)
16292 }
16293
16294 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
16296 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
16297 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16298 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16299
16300 let stub = self.0.stub.clone();
16301 let mut options = self.0.options.clone();
16302 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16303 let query = move |name| {
16304 let stub = stub.clone();
16305 let options = options.clone();
16306 async {
16307 let op = GetOperation::new(stub)
16308 .set_name(name)
16309 .with_options(options)
16310 .send()
16311 .await?;
16312 Ok(Operation::new(op))
16313 }
16314 };
16315
16316 let start = move || async {
16317 let op = self.send().await?;
16318 Ok(Operation::new(op))
16319 };
16320
16321 google_cloud_lro::internal::new_unit_response_poller(
16322 polling_error_policy,
16323 polling_backoff_policy,
16324 start,
16325 query,
16326 )
16327 }
16328
16329 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16333 self.0.request.parent = v.into();
16334 self
16335 }
16336
16337 pub fn set_intents<T, V>(mut self, v: T) -> Self
16341 where
16342 T: std::iter::IntoIterator<Item = V>,
16343 V: std::convert::Into<crate::model::Intent>,
16344 {
16345 use std::iter::Iterator;
16346 self.0.request.intents = v.into_iter().map(|i| i.into()).collect();
16347 self
16348 }
16349 }
16350
16351 #[doc(hidden)]
16352 impl crate::RequestBuilder for BatchDeleteIntents {
16353 fn request_options(&mut self) -> &mut crate::RequestOptions {
16354 &mut self.0.options
16355 }
16356 }
16357
16358 #[derive(Clone, Debug)]
16379 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
16380
16381 impl ListLocations {
16382 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16383 Self(RequestBuilder::new(stub))
16384 }
16385
16386 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
16388 mut self,
16389 v: V,
16390 ) -> Self {
16391 self.0.request = v.into();
16392 self
16393 }
16394
16395 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16397 self.0.options = v.into();
16398 self
16399 }
16400
16401 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
16403 (*self.0.stub)
16404 .list_locations(self.0.request, self.0.options)
16405 .await
16406 .map(crate::Response::into_body)
16407 }
16408
16409 pub fn by_page(
16411 self,
16412 ) -> impl google_cloud_gax::paginator::Paginator<
16413 google_cloud_location::model::ListLocationsResponse,
16414 crate::Error,
16415 > {
16416 use std::clone::Clone;
16417 let token = self.0.request.page_token.clone();
16418 let execute = move |token: String| {
16419 let mut builder = self.clone();
16420 builder.0.request = builder.0.request.set_page_token(token);
16421 builder.send()
16422 };
16423 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16424 }
16425
16426 pub fn by_item(
16428 self,
16429 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16430 google_cloud_location::model::ListLocationsResponse,
16431 crate::Error,
16432 > {
16433 use google_cloud_gax::paginator::Paginator;
16434 self.by_page().items()
16435 }
16436
16437 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16439 self.0.request.name = v.into();
16440 self
16441 }
16442
16443 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16445 self.0.request.filter = v.into();
16446 self
16447 }
16448
16449 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16451 self.0.request.page_size = v.into();
16452 self
16453 }
16454
16455 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16457 self.0.request.page_token = v.into();
16458 self
16459 }
16460 }
16461
16462 #[doc(hidden)]
16463 impl crate::RequestBuilder for ListLocations {
16464 fn request_options(&mut self) -> &mut crate::RequestOptions {
16465 &mut self.0.options
16466 }
16467 }
16468
16469 #[derive(Clone, Debug)]
16486 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
16487
16488 impl GetLocation {
16489 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16490 Self(RequestBuilder::new(stub))
16491 }
16492
16493 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
16495 mut self,
16496 v: V,
16497 ) -> Self {
16498 self.0.request = v.into();
16499 self
16500 }
16501
16502 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16504 self.0.options = v.into();
16505 self
16506 }
16507
16508 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
16510 (*self.0.stub)
16511 .get_location(self.0.request, self.0.options)
16512 .await
16513 .map(crate::Response::into_body)
16514 }
16515
16516 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16518 self.0.request.name = v.into();
16519 self
16520 }
16521 }
16522
16523 #[doc(hidden)]
16524 impl crate::RequestBuilder for GetLocation {
16525 fn request_options(&mut self) -> &mut crate::RequestOptions {
16526 &mut self.0.options
16527 }
16528 }
16529
16530 #[derive(Clone, Debug)]
16551 pub struct ListOperations(
16552 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16553 );
16554
16555 impl ListOperations {
16556 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16557 Self(RequestBuilder::new(stub))
16558 }
16559
16560 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16562 mut self,
16563 v: V,
16564 ) -> Self {
16565 self.0.request = v.into();
16566 self
16567 }
16568
16569 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16571 self.0.options = v.into();
16572 self
16573 }
16574
16575 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16577 (*self.0.stub)
16578 .list_operations(self.0.request, self.0.options)
16579 .await
16580 .map(crate::Response::into_body)
16581 }
16582
16583 pub fn by_page(
16585 self,
16586 ) -> impl google_cloud_gax::paginator::Paginator<
16587 google_cloud_longrunning::model::ListOperationsResponse,
16588 crate::Error,
16589 > {
16590 use std::clone::Clone;
16591 let token = self.0.request.page_token.clone();
16592 let execute = move |token: String| {
16593 let mut builder = self.clone();
16594 builder.0.request = builder.0.request.set_page_token(token);
16595 builder.send()
16596 };
16597 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16598 }
16599
16600 pub fn by_item(
16602 self,
16603 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16604 google_cloud_longrunning::model::ListOperationsResponse,
16605 crate::Error,
16606 > {
16607 use google_cloud_gax::paginator::Paginator;
16608 self.by_page().items()
16609 }
16610
16611 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16613 self.0.request.name = v.into();
16614 self
16615 }
16616
16617 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16619 self.0.request.filter = v.into();
16620 self
16621 }
16622
16623 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16625 self.0.request.page_size = v.into();
16626 self
16627 }
16628
16629 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16631 self.0.request.page_token = v.into();
16632 self
16633 }
16634
16635 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16637 self.0.request.return_partial_success = v.into();
16638 self
16639 }
16640 }
16641
16642 #[doc(hidden)]
16643 impl crate::RequestBuilder for ListOperations {
16644 fn request_options(&mut self) -> &mut crate::RequestOptions {
16645 &mut self.0.options
16646 }
16647 }
16648
16649 #[derive(Clone, Debug)]
16666 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16667
16668 impl GetOperation {
16669 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16670 Self(RequestBuilder::new(stub))
16671 }
16672
16673 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16675 mut self,
16676 v: V,
16677 ) -> Self {
16678 self.0.request = v.into();
16679 self
16680 }
16681
16682 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16684 self.0.options = v.into();
16685 self
16686 }
16687
16688 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16690 (*self.0.stub)
16691 .get_operation(self.0.request, self.0.options)
16692 .await
16693 .map(crate::Response::into_body)
16694 }
16695
16696 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16698 self.0.request.name = v.into();
16699 self
16700 }
16701 }
16702
16703 #[doc(hidden)]
16704 impl crate::RequestBuilder for GetOperation {
16705 fn request_options(&mut self) -> &mut crate::RequestOptions {
16706 &mut self.0.options
16707 }
16708 }
16709
16710 #[derive(Clone, Debug)]
16727 pub struct CancelOperation(
16728 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16729 );
16730
16731 impl CancelOperation {
16732 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16733 Self(RequestBuilder::new(stub))
16734 }
16735
16736 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16738 mut self,
16739 v: V,
16740 ) -> Self {
16741 self.0.request = v.into();
16742 self
16743 }
16744
16745 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16747 self.0.options = v.into();
16748 self
16749 }
16750
16751 pub async fn send(self) -> Result<()> {
16753 (*self.0.stub)
16754 .cancel_operation(self.0.request, self.0.options)
16755 .await
16756 .map(crate::Response::into_body)
16757 }
16758
16759 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16761 self.0.request.name = v.into();
16762 self
16763 }
16764 }
16765
16766 #[doc(hidden)]
16767 impl crate::RequestBuilder for CancelOperation {
16768 fn request_options(&mut self) -> &mut crate::RequestOptions {
16769 &mut self.0.options
16770 }
16771 }
16772}
16773
16774#[cfg(feature = "knowledge-bases")]
16775#[cfg_attr(docsrs, doc(cfg(feature = "knowledge-bases")))]
16776pub mod knowledge_bases {
16777 use crate::Result;
16778
16779 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16793
16794 pub(crate) mod client {
16795 use super::super::super::client::KnowledgeBases;
16796 pub struct Factory;
16797 impl crate::ClientFactory for Factory {
16798 type Client = KnowledgeBases;
16799 type Credentials = gaxi::options::Credentials;
16800 async fn build(
16801 self,
16802 config: gaxi::options::ClientConfig,
16803 ) -> crate::ClientBuilderResult<Self::Client> {
16804 Self::Client::new(config).await
16805 }
16806 }
16807 }
16808
16809 #[derive(Clone, Debug)]
16811 pub(crate) struct RequestBuilder<R: std::default::Default> {
16812 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16813 request: R,
16814 options: crate::RequestOptions,
16815 }
16816
16817 impl<R> RequestBuilder<R>
16818 where
16819 R: std::default::Default,
16820 {
16821 pub(crate) fn new(
16822 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16823 ) -> Self {
16824 Self {
16825 stub,
16826 request: R::default(),
16827 options: crate::RequestOptions::default(),
16828 }
16829 }
16830 }
16831
16832 #[derive(Clone, Debug)]
16853 pub struct ListKnowledgeBases(RequestBuilder<crate::model::ListKnowledgeBasesRequest>);
16854
16855 impl ListKnowledgeBases {
16856 pub(crate) fn new(
16857 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16858 ) -> Self {
16859 Self(RequestBuilder::new(stub))
16860 }
16861
16862 pub fn with_request<V: Into<crate::model::ListKnowledgeBasesRequest>>(
16864 mut self,
16865 v: V,
16866 ) -> Self {
16867 self.0.request = v.into();
16868 self
16869 }
16870
16871 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16873 self.0.options = v.into();
16874 self
16875 }
16876
16877 pub async fn send(self) -> Result<crate::model::ListKnowledgeBasesResponse> {
16879 (*self.0.stub)
16880 .list_knowledge_bases(self.0.request, self.0.options)
16881 .await
16882 .map(crate::Response::into_body)
16883 }
16884
16885 pub fn by_page(
16887 self,
16888 ) -> impl google_cloud_gax::paginator::Paginator<
16889 crate::model::ListKnowledgeBasesResponse,
16890 crate::Error,
16891 > {
16892 use std::clone::Clone;
16893 let token = self.0.request.page_token.clone();
16894 let execute = move |token: String| {
16895 let mut builder = self.clone();
16896 builder.0.request = builder.0.request.set_page_token(token);
16897 builder.send()
16898 };
16899 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16900 }
16901
16902 pub fn by_item(
16904 self,
16905 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16906 crate::model::ListKnowledgeBasesResponse,
16907 crate::Error,
16908 > {
16909 use google_cloud_gax::paginator::Paginator;
16910 self.by_page().items()
16911 }
16912
16913 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16917 self.0.request.parent = v.into();
16918 self
16919 }
16920
16921 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16923 self.0.request.page_size = v.into();
16924 self
16925 }
16926
16927 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16929 self.0.request.page_token = v.into();
16930 self
16931 }
16932
16933 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16935 self.0.request.filter = v.into();
16936 self
16937 }
16938 }
16939
16940 #[doc(hidden)]
16941 impl crate::RequestBuilder for ListKnowledgeBases {
16942 fn request_options(&mut self) -> &mut crate::RequestOptions {
16943 &mut self.0.options
16944 }
16945 }
16946
16947 #[derive(Clone, Debug)]
16964 pub struct GetKnowledgeBase(RequestBuilder<crate::model::GetKnowledgeBaseRequest>);
16965
16966 impl GetKnowledgeBase {
16967 pub(crate) fn new(
16968 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16969 ) -> Self {
16970 Self(RequestBuilder::new(stub))
16971 }
16972
16973 pub fn with_request<V: Into<crate::model::GetKnowledgeBaseRequest>>(
16975 mut self,
16976 v: V,
16977 ) -> Self {
16978 self.0.request = v.into();
16979 self
16980 }
16981
16982 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16984 self.0.options = v.into();
16985 self
16986 }
16987
16988 pub async fn send(self) -> Result<crate::model::KnowledgeBase> {
16990 (*self.0.stub)
16991 .get_knowledge_base(self.0.request, self.0.options)
16992 .await
16993 .map(crate::Response::into_body)
16994 }
16995
16996 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17000 self.0.request.name = v.into();
17001 self
17002 }
17003 }
17004
17005 #[doc(hidden)]
17006 impl crate::RequestBuilder for GetKnowledgeBase {
17007 fn request_options(&mut self) -> &mut crate::RequestOptions {
17008 &mut self.0.options
17009 }
17010 }
17011
17012 #[derive(Clone, Debug)]
17029 pub struct CreateKnowledgeBase(RequestBuilder<crate::model::CreateKnowledgeBaseRequest>);
17030
17031 impl CreateKnowledgeBase {
17032 pub(crate) fn new(
17033 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17034 ) -> Self {
17035 Self(RequestBuilder::new(stub))
17036 }
17037
17038 pub fn with_request<V: Into<crate::model::CreateKnowledgeBaseRequest>>(
17040 mut self,
17041 v: V,
17042 ) -> Self {
17043 self.0.request = v.into();
17044 self
17045 }
17046
17047 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17049 self.0.options = v.into();
17050 self
17051 }
17052
17053 pub async fn send(self) -> Result<crate::model::KnowledgeBase> {
17055 (*self.0.stub)
17056 .create_knowledge_base(self.0.request, self.0.options)
17057 .await
17058 .map(crate::Response::into_body)
17059 }
17060
17061 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17065 self.0.request.parent = v.into();
17066 self
17067 }
17068
17069 pub fn set_knowledge_base<T>(mut self, v: T) -> Self
17073 where
17074 T: std::convert::Into<crate::model::KnowledgeBase>,
17075 {
17076 self.0.request.knowledge_base = std::option::Option::Some(v.into());
17077 self
17078 }
17079
17080 pub fn set_or_clear_knowledge_base<T>(mut self, v: std::option::Option<T>) -> Self
17084 where
17085 T: std::convert::Into<crate::model::KnowledgeBase>,
17086 {
17087 self.0.request.knowledge_base = v.map(|x| x.into());
17088 self
17089 }
17090 }
17091
17092 #[doc(hidden)]
17093 impl crate::RequestBuilder for CreateKnowledgeBase {
17094 fn request_options(&mut self) -> &mut crate::RequestOptions {
17095 &mut self.0.options
17096 }
17097 }
17098
17099 #[derive(Clone, Debug)]
17116 pub struct DeleteKnowledgeBase(RequestBuilder<crate::model::DeleteKnowledgeBaseRequest>);
17117
17118 impl DeleteKnowledgeBase {
17119 pub(crate) fn new(
17120 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17121 ) -> Self {
17122 Self(RequestBuilder::new(stub))
17123 }
17124
17125 pub fn with_request<V: Into<crate::model::DeleteKnowledgeBaseRequest>>(
17127 mut self,
17128 v: V,
17129 ) -> Self {
17130 self.0.request = v.into();
17131 self
17132 }
17133
17134 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17136 self.0.options = v.into();
17137 self
17138 }
17139
17140 pub async fn send(self) -> Result<()> {
17142 (*self.0.stub)
17143 .delete_knowledge_base(self.0.request, self.0.options)
17144 .await
17145 .map(crate::Response::into_body)
17146 }
17147
17148 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17152 self.0.request.name = v.into();
17153 self
17154 }
17155
17156 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
17158 self.0.request.force = v.into();
17159 self
17160 }
17161 }
17162
17163 #[doc(hidden)]
17164 impl crate::RequestBuilder for DeleteKnowledgeBase {
17165 fn request_options(&mut self) -> &mut crate::RequestOptions {
17166 &mut self.0.options
17167 }
17168 }
17169
17170 #[derive(Clone, Debug)]
17187 pub struct UpdateKnowledgeBase(RequestBuilder<crate::model::UpdateKnowledgeBaseRequest>);
17188
17189 impl UpdateKnowledgeBase {
17190 pub(crate) fn new(
17191 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17192 ) -> Self {
17193 Self(RequestBuilder::new(stub))
17194 }
17195
17196 pub fn with_request<V: Into<crate::model::UpdateKnowledgeBaseRequest>>(
17198 mut self,
17199 v: V,
17200 ) -> Self {
17201 self.0.request = v.into();
17202 self
17203 }
17204
17205 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17207 self.0.options = v.into();
17208 self
17209 }
17210
17211 pub async fn send(self) -> Result<crate::model::KnowledgeBase> {
17213 (*self.0.stub)
17214 .update_knowledge_base(self.0.request, self.0.options)
17215 .await
17216 .map(crate::Response::into_body)
17217 }
17218
17219 pub fn set_knowledge_base<T>(mut self, v: T) -> Self
17223 where
17224 T: std::convert::Into<crate::model::KnowledgeBase>,
17225 {
17226 self.0.request.knowledge_base = std::option::Option::Some(v.into());
17227 self
17228 }
17229
17230 pub fn set_or_clear_knowledge_base<T>(mut self, v: std::option::Option<T>) -> Self
17234 where
17235 T: std::convert::Into<crate::model::KnowledgeBase>,
17236 {
17237 self.0.request.knowledge_base = v.map(|x| x.into());
17238 self
17239 }
17240
17241 pub fn set_update_mask<T>(mut self, v: T) -> Self
17243 where
17244 T: std::convert::Into<wkt::FieldMask>,
17245 {
17246 self.0.request.update_mask = std::option::Option::Some(v.into());
17247 self
17248 }
17249
17250 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17252 where
17253 T: std::convert::Into<wkt::FieldMask>,
17254 {
17255 self.0.request.update_mask = v.map(|x| x.into());
17256 self
17257 }
17258 }
17259
17260 #[doc(hidden)]
17261 impl crate::RequestBuilder for UpdateKnowledgeBase {
17262 fn request_options(&mut self) -> &mut crate::RequestOptions {
17263 &mut self.0.options
17264 }
17265 }
17266
17267 #[derive(Clone, Debug)]
17288 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
17289
17290 impl ListLocations {
17291 pub(crate) fn new(
17292 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17293 ) -> Self {
17294 Self(RequestBuilder::new(stub))
17295 }
17296
17297 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
17299 mut self,
17300 v: V,
17301 ) -> Self {
17302 self.0.request = v.into();
17303 self
17304 }
17305
17306 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17308 self.0.options = v.into();
17309 self
17310 }
17311
17312 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
17314 (*self.0.stub)
17315 .list_locations(self.0.request, self.0.options)
17316 .await
17317 .map(crate::Response::into_body)
17318 }
17319
17320 pub fn by_page(
17322 self,
17323 ) -> impl google_cloud_gax::paginator::Paginator<
17324 google_cloud_location::model::ListLocationsResponse,
17325 crate::Error,
17326 > {
17327 use std::clone::Clone;
17328 let token = self.0.request.page_token.clone();
17329 let execute = move |token: String| {
17330 let mut builder = self.clone();
17331 builder.0.request = builder.0.request.set_page_token(token);
17332 builder.send()
17333 };
17334 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17335 }
17336
17337 pub fn by_item(
17339 self,
17340 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17341 google_cloud_location::model::ListLocationsResponse,
17342 crate::Error,
17343 > {
17344 use google_cloud_gax::paginator::Paginator;
17345 self.by_page().items()
17346 }
17347
17348 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17350 self.0.request.name = v.into();
17351 self
17352 }
17353
17354 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17356 self.0.request.filter = v.into();
17357 self
17358 }
17359
17360 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17362 self.0.request.page_size = v.into();
17363 self
17364 }
17365
17366 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17368 self.0.request.page_token = v.into();
17369 self
17370 }
17371 }
17372
17373 #[doc(hidden)]
17374 impl crate::RequestBuilder for ListLocations {
17375 fn request_options(&mut self) -> &mut crate::RequestOptions {
17376 &mut self.0.options
17377 }
17378 }
17379
17380 #[derive(Clone, Debug)]
17397 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
17398
17399 impl GetLocation {
17400 pub(crate) fn new(
17401 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17402 ) -> Self {
17403 Self(RequestBuilder::new(stub))
17404 }
17405
17406 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
17408 mut self,
17409 v: V,
17410 ) -> Self {
17411 self.0.request = v.into();
17412 self
17413 }
17414
17415 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17417 self.0.options = v.into();
17418 self
17419 }
17420
17421 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
17423 (*self.0.stub)
17424 .get_location(self.0.request, self.0.options)
17425 .await
17426 .map(crate::Response::into_body)
17427 }
17428
17429 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17431 self.0.request.name = v.into();
17432 self
17433 }
17434 }
17435
17436 #[doc(hidden)]
17437 impl crate::RequestBuilder for GetLocation {
17438 fn request_options(&mut self) -> &mut crate::RequestOptions {
17439 &mut self.0.options
17440 }
17441 }
17442
17443 #[derive(Clone, Debug)]
17464 pub struct ListOperations(
17465 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17466 );
17467
17468 impl ListOperations {
17469 pub(crate) fn new(
17470 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17471 ) -> Self {
17472 Self(RequestBuilder::new(stub))
17473 }
17474
17475 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17477 mut self,
17478 v: V,
17479 ) -> Self {
17480 self.0.request = v.into();
17481 self
17482 }
17483
17484 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17486 self.0.options = v.into();
17487 self
17488 }
17489
17490 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17492 (*self.0.stub)
17493 .list_operations(self.0.request, self.0.options)
17494 .await
17495 .map(crate::Response::into_body)
17496 }
17497
17498 pub fn by_page(
17500 self,
17501 ) -> impl google_cloud_gax::paginator::Paginator<
17502 google_cloud_longrunning::model::ListOperationsResponse,
17503 crate::Error,
17504 > {
17505 use std::clone::Clone;
17506 let token = self.0.request.page_token.clone();
17507 let execute = move |token: String| {
17508 let mut builder = self.clone();
17509 builder.0.request = builder.0.request.set_page_token(token);
17510 builder.send()
17511 };
17512 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17513 }
17514
17515 pub fn by_item(
17517 self,
17518 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17519 google_cloud_longrunning::model::ListOperationsResponse,
17520 crate::Error,
17521 > {
17522 use google_cloud_gax::paginator::Paginator;
17523 self.by_page().items()
17524 }
17525
17526 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17528 self.0.request.name = v.into();
17529 self
17530 }
17531
17532 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17534 self.0.request.filter = v.into();
17535 self
17536 }
17537
17538 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17540 self.0.request.page_size = v.into();
17541 self
17542 }
17543
17544 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17546 self.0.request.page_token = v.into();
17547 self
17548 }
17549
17550 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17552 self.0.request.return_partial_success = v.into();
17553 self
17554 }
17555 }
17556
17557 #[doc(hidden)]
17558 impl crate::RequestBuilder for ListOperations {
17559 fn request_options(&mut self) -> &mut crate::RequestOptions {
17560 &mut self.0.options
17561 }
17562 }
17563
17564 #[derive(Clone, Debug)]
17581 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17582
17583 impl GetOperation {
17584 pub(crate) fn new(
17585 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17586 ) -> Self {
17587 Self(RequestBuilder::new(stub))
17588 }
17589
17590 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17592 mut self,
17593 v: V,
17594 ) -> Self {
17595 self.0.request = v.into();
17596 self
17597 }
17598
17599 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17601 self.0.options = v.into();
17602 self
17603 }
17604
17605 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17607 (*self.0.stub)
17608 .get_operation(self.0.request, self.0.options)
17609 .await
17610 .map(crate::Response::into_body)
17611 }
17612
17613 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17615 self.0.request.name = v.into();
17616 self
17617 }
17618 }
17619
17620 #[doc(hidden)]
17621 impl crate::RequestBuilder for GetOperation {
17622 fn request_options(&mut self) -> &mut crate::RequestOptions {
17623 &mut self.0.options
17624 }
17625 }
17626
17627 #[derive(Clone, Debug)]
17644 pub struct CancelOperation(
17645 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17646 );
17647
17648 impl CancelOperation {
17649 pub(crate) fn new(
17650 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17651 ) -> Self {
17652 Self(RequestBuilder::new(stub))
17653 }
17654
17655 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17657 mut self,
17658 v: V,
17659 ) -> Self {
17660 self.0.request = v.into();
17661 self
17662 }
17663
17664 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17666 self.0.options = v.into();
17667 self
17668 }
17669
17670 pub async fn send(self) -> Result<()> {
17672 (*self.0.stub)
17673 .cancel_operation(self.0.request, self.0.options)
17674 .await
17675 .map(crate::Response::into_body)
17676 }
17677
17678 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17680 self.0.request.name = v.into();
17681 self
17682 }
17683 }
17684
17685 #[doc(hidden)]
17686 impl crate::RequestBuilder for CancelOperation {
17687 fn request_options(&mut self) -> &mut crate::RequestOptions {
17688 &mut self.0.options
17689 }
17690 }
17691}
17692
17693#[cfg(feature = "participants")]
17694#[cfg_attr(docsrs, doc(cfg(feature = "participants")))]
17695pub mod participants {
17696 use crate::Result;
17697
17698 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
17712
17713 pub(crate) mod client {
17714 use super::super::super::client::Participants;
17715 pub struct Factory;
17716 impl crate::ClientFactory for Factory {
17717 type Client = Participants;
17718 type Credentials = gaxi::options::Credentials;
17719 async fn build(
17720 self,
17721 config: gaxi::options::ClientConfig,
17722 ) -> crate::ClientBuilderResult<Self::Client> {
17723 Self::Client::new(config).await
17724 }
17725 }
17726 }
17727
17728 #[derive(Clone, Debug)]
17730 pub(crate) struct RequestBuilder<R: std::default::Default> {
17731 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17732 request: R,
17733 options: crate::RequestOptions,
17734 }
17735
17736 impl<R> RequestBuilder<R>
17737 where
17738 R: std::default::Default,
17739 {
17740 pub(crate) fn new(
17741 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17742 ) -> Self {
17743 Self {
17744 stub,
17745 request: R::default(),
17746 options: crate::RequestOptions::default(),
17747 }
17748 }
17749 }
17750
17751 #[derive(Clone, Debug)]
17768 pub struct CreateParticipant(RequestBuilder<crate::model::CreateParticipantRequest>);
17769
17770 impl CreateParticipant {
17771 pub(crate) fn new(
17772 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17773 ) -> Self {
17774 Self(RequestBuilder::new(stub))
17775 }
17776
17777 pub fn with_request<V: Into<crate::model::CreateParticipantRequest>>(
17779 mut self,
17780 v: V,
17781 ) -> Self {
17782 self.0.request = v.into();
17783 self
17784 }
17785
17786 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17788 self.0.options = v.into();
17789 self
17790 }
17791
17792 pub async fn send(self) -> Result<crate::model::Participant> {
17794 (*self.0.stub)
17795 .create_participant(self.0.request, self.0.options)
17796 .await
17797 .map(crate::Response::into_body)
17798 }
17799
17800 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17804 self.0.request.parent = v.into();
17805 self
17806 }
17807
17808 pub fn set_participant<T>(mut self, v: T) -> Self
17812 where
17813 T: std::convert::Into<crate::model::Participant>,
17814 {
17815 self.0.request.participant = std::option::Option::Some(v.into());
17816 self
17817 }
17818
17819 pub fn set_or_clear_participant<T>(mut self, v: std::option::Option<T>) -> Self
17823 where
17824 T: std::convert::Into<crate::model::Participant>,
17825 {
17826 self.0.request.participant = v.map(|x| x.into());
17827 self
17828 }
17829 }
17830
17831 #[doc(hidden)]
17832 impl crate::RequestBuilder for CreateParticipant {
17833 fn request_options(&mut self) -> &mut crate::RequestOptions {
17834 &mut self.0.options
17835 }
17836 }
17837
17838 #[derive(Clone, Debug)]
17855 pub struct GetParticipant(RequestBuilder<crate::model::GetParticipantRequest>);
17856
17857 impl GetParticipant {
17858 pub(crate) fn new(
17859 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17860 ) -> Self {
17861 Self(RequestBuilder::new(stub))
17862 }
17863
17864 pub fn with_request<V: Into<crate::model::GetParticipantRequest>>(mut self, v: V) -> Self {
17866 self.0.request = v.into();
17867 self
17868 }
17869
17870 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17872 self.0.options = v.into();
17873 self
17874 }
17875
17876 pub async fn send(self) -> Result<crate::model::Participant> {
17878 (*self.0.stub)
17879 .get_participant(self.0.request, self.0.options)
17880 .await
17881 .map(crate::Response::into_body)
17882 }
17883
17884 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17888 self.0.request.name = v.into();
17889 self
17890 }
17891 }
17892
17893 #[doc(hidden)]
17894 impl crate::RequestBuilder for GetParticipant {
17895 fn request_options(&mut self) -> &mut crate::RequestOptions {
17896 &mut self.0.options
17897 }
17898 }
17899
17900 #[derive(Clone, Debug)]
17921 pub struct ListParticipants(RequestBuilder<crate::model::ListParticipantsRequest>);
17922
17923 impl ListParticipants {
17924 pub(crate) fn new(
17925 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17926 ) -> Self {
17927 Self(RequestBuilder::new(stub))
17928 }
17929
17930 pub fn with_request<V: Into<crate::model::ListParticipantsRequest>>(
17932 mut self,
17933 v: V,
17934 ) -> Self {
17935 self.0.request = v.into();
17936 self
17937 }
17938
17939 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17941 self.0.options = v.into();
17942 self
17943 }
17944
17945 pub async fn send(self) -> Result<crate::model::ListParticipantsResponse> {
17947 (*self.0.stub)
17948 .list_participants(self.0.request, self.0.options)
17949 .await
17950 .map(crate::Response::into_body)
17951 }
17952
17953 pub fn by_page(
17955 self,
17956 ) -> impl google_cloud_gax::paginator::Paginator<
17957 crate::model::ListParticipantsResponse,
17958 crate::Error,
17959 > {
17960 use std::clone::Clone;
17961 let token = self.0.request.page_token.clone();
17962 let execute = move |token: String| {
17963 let mut builder = self.clone();
17964 builder.0.request = builder.0.request.set_page_token(token);
17965 builder.send()
17966 };
17967 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17968 }
17969
17970 pub fn by_item(
17972 self,
17973 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17974 crate::model::ListParticipantsResponse,
17975 crate::Error,
17976 > {
17977 use google_cloud_gax::paginator::Paginator;
17978 self.by_page().items()
17979 }
17980
17981 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17985 self.0.request.parent = v.into();
17986 self
17987 }
17988
17989 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17991 self.0.request.page_size = v.into();
17992 self
17993 }
17994
17995 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17997 self.0.request.page_token = v.into();
17998 self
17999 }
18000 }
18001
18002 #[doc(hidden)]
18003 impl crate::RequestBuilder for ListParticipants {
18004 fn request_options(&mut self) -> &mut crate::RequestOptions {
18005 &mut self.0.options
18006 }
18007 }
18008
18009 #[derive(Clone, Debug)]
18026 pub struct UpdateParticipant(RequestBuilder<crate::model::UpdateParticipantRequest>);
18027
18028 impl UpdateParticipant {
18029 pub(crate) fn new(
18030 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18031 ) -> Self {
18032 Self(RequestBuilder::new(stub))
18033 }
18034
18035 pub fn with_request<V: Into<crate::model::UpdateParticipantRequest>>(
18037 mut self,
18038 v: V,
18039 ) -> Self {
18040 self.0.request = v.into();
18041 self
18042 }
18043
18044 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18046 self.0.options = v.into();
18047 self
18048 }
18049
18050 pub async fn send(self) -> Result<crate::model::Participant> {
18052 (*self.0.stub)
18053 .update_participant(self.0.request, self.0.options)
18054 .await
18055 .map(crate::Response::into_body)
18056 }
18057
18058 pub fn set_participant<T>(mut self, v: T) -> Self
18062 where
18063 T: std::convert::Into<crate::model::Participant>,
18064 {
18065 self.0.request.participant = std::option::Option::Some(v.into());
18066 self
18067 }
18068
18069 pub fn set_or_clear_participant<T>(mut self, v: std::option::Option<T>) -> Self
18073 where
18074 T: std::convert::Into<crate::model::Participant>,
18075 {
18076 self.0.request.participant = v.map(|x| x.into());
18077 self
18078 }
18079
18080 pub fn set_update_mask<T>(mut self, v: T) -> Self
18084 where
18085 T: std::convert::Into<wkt::FieldMask>,
18086 {
18087 self.0.request.update_mask = std::option::Option::Some(v.into());
18088 self
18089 }
18090
18091 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
18095 where
18096 T: std::convert::Into<wkt::FieldMask>,
18097 {
18098 self.0.request.update_mask = v.map(|x| x.into());
18099 self
18100 }
18101 }
18102
18103 #[doc(hidden)]
18104 impl crate::RequestBuilder for UpdateParticipant {
18105 fn request_options(&mut self) -> &mut crate::RequestOptions {
18106 &mut self.0.options
18107 }
18108 }
18109
18110 #[derive(Clone, Debug)]
18127 pub struct AnalyzeContent(RequestBuilder<crate::model::AnalyzeContentRequest>);
18128
18129 impl AnalyzeContent {
18130 pub(crate) fn new(
18131 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18132 ) -> Self {
18133 Self(RequestBuilder::new(stub))
18134 }
18135
18136 pub fn with_request<V: Into<crate::model::AnalyzeContentRequest>>(mut self, v: V) -> Self {
18138 self.0.request = v.into();
18139 self
18140 }
18141
18142 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18144 self.0.options = v.into();
18145 self
18146 }
18147
18148 pub async fn send(self) -> Result<crate::model::AnalyzeContentResponse> {
18150 (*self.0.stub)
18151 .analyze_content(self.0.request, self.0.options)
18152 .await
18153 .map(crate::Response::into_body)
18154 }
18155
18156 pub fn set_participant<T: Into<std::string::String>>(mut self, v: T) -> Self {
18160 self.0.request.participant = v.into();
18161 self
18162 }
18163
18164 pub fn set_reply_audio_config<T>(mut self, v: T) -> Self
18166 where
18167 T: std::convert::Into<crate::model::OutputAudioConfig>,
18168 {
18169 self.0.request.reply_audio_config = std::option::Option::Some(v.into());
18170 self
18171 }
18172
18173 pub fn set_or_clear_reply_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
18175 where
18176 T: std::convert::Into<crate::model::OutputAudioConfig>,
18177 {
18178 self.0.request.reply_audio_config = v.map(|x| x.into());
18179 self
18180 }
18181
18182 pub fn set_query_params<T>(mut self, v: T) -> Self
18184 where
18185 T: std::convert::Into<crate::model::QueryParameters>,
18186 {
18187 self.0.request.query_params = std::option::Option::Some(v.into());
18188 self
18189 }
18190
18191 pub fn set_or_clear_query_params<T>(mut self, v: std::option::Option<T>) -> Self
18193 where
18194 T: std::convert::Into<crate::model::QueryParameters>,
18195 {
18196 self.0.request.query_params = v.map(|x| x.into());
18197 self
18198 }
18199
18200 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
18202 where
18203 T: std::convert::Into<crate::model::AssistQueryParameters>,
18204 {
18205 self.0.request.assist_query_params = std::option::Option::Some(v.into());
18206 self
18207 }
18208
18209 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
18211 where
18212 T: std::convert::Into<crate::model::AssistQueryParameters>,
18213 {
18214 self.0.request.assist_query_params = v.map(|x| x.into());
18215 self
18216 }
18217
18218 pub fn set_cx_parameters<T>(mut self, v: T) -> Self
18220 where
18221 T: std::convert::Into<wkt::Struct>,
18222 {
18223 self.0.request.cx_parameters = std::option::Option::Some(v.into());
18224 self
18225 }
18226
18227 pub fn set_or_clear_cx_parameters<T>(mut self, v: std::option::Option<T>) -> Self
18229 where
18230 T: std::convert::Into<wkt::Struct>,
18231 {
18232 self.0.request.cx_parameters = v.map(|x| x.into());
18233 self
18234 }
18235
18236 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
18238 self.0.request.request_id = v.into();
18239 self
18240 }
18241
18242 pub fn set_input<T: Into<Option<crate::model::analyze_content_request::Input>>>(
18247 mut self,
18248 v: T,
18249 ) -> Self {
18250 self.0.request.input = v.into();
18251 self
18252 }
18253
18254 pub fn set_text_input<T: std::convert::Into<std::boxed::Box<crate::model::TextInput>>>(
18260 mut self,
18261 v: T,
18262 ) -> Self {
18263 self.0.request = self.0.request.set_text_input(v);
18264 self
18265 }
18266
18267 pub fn set_audio_input<T: std::convert::Into<std::boxed::Box<crate::model::AudioInput>>>(
18273 mut self,
18274 v: T,
18275 ) -> Self {
18276 self.0.request = self.0.request.set_audio_input(v);
18277 self
18278 }
18279
18280 pub fn set_event_input<T: std::convert::Into<std::boxed::Box<crate::model::EventInput>>>(
18286 mut self,
18287 v: T,
18288 ) -> Self {
18289 self.0.request = self.0.request.set_event_input(v);
18290 self
18291 }
18292
18293 pub fn set_suggestion_input<
18299 T: std::convert::Into<std::boxed::Box<crate::model::SuggestionInput>>,
18300 >(
18301 mut self,
18302 v: T,
18303 ) -> Self {
18304 self.0.request = self.0.request.set_suggestion_input(v);
18305 self
18306 }
18307 }
18308
18309 #[doc(hidden)]
18310 impl crate::RequestBuilder for AnalyzeContent {
18311 fn request_options(&mut self) -> &mut crate::RequestOptions {
18312 &mut self.0.options
18313 }
18314 }
18315
18316 #[derive(Clone, Debug)]
18333 pub struct SuggestArticles(RequestBuilder<crate::model::SuggestArticlesRequest>);
18334
18335 impl SuggestArticles {
18336 pub(crate) fn new(
18337 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18338 ) -> Self {
18339 Self(RequestBuilder::new(stub))
18340 }
18341
18342 pub fn with_request<V: Into<crate::model::SuggestArticlesRequest>>(mut self, v: V) -> Self {
18344 self.0.request = v.into();
18345 self
18346 }
18347
18348 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18350 self.0.options = v.into();
18351 self
18352 }
18353
18354 pub async fn send(self) -> Result<crate::model::SuggestArticlesResponse> {
18356 (*self.0.stub)
18357 .suggest_articles(self.0.request, self.0.options)
18358 .await
18359 .map(crate::Response::into_body)
18360 }
18361
18362 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18366 self.0.request.parent = v.into();
18367 self
18368 }
18369
18370 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
18372 self.0.request.latest_message = v.into();
18373 self
18374 }
18375
18376 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
18378 self.0.request.context_size = v.into();
18379 self
18380 }
18381
18382 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
18384 where
18385 T: std::convert::Into<crate::model::AssistQueryParameters>,
18386 {
18387 self.0.request.assist_query_params = std::option::Option::Some(v.into());
18388 self
18389 }
18390
18391 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
18393 where
18394 T: std::convert::Into<crate::model::AssistQueryParameters>,
18395 {
18396 self.0.request.assist_query_params = v.map(|x| x.into());
18397 self
18398 }
18399 }
18400
18401 #[doc(hidden)]
18402 impl crate::RequestBuilder for SuggestArticles {
18403 fn request_options(&mut self) -> &mut crate::RequestOptions {
18404 &mut self.0.options
18405 }
18406 }
18407
18408 #[derive(Clone, Debug)]
18425 pub struct SuggestFaqAnswers(RequestBuilder<crate::model::SuggestFaqAnswersRequest>);
18426
18427 impl SuggestFaqAnswers {
18428 pub(crate) fn new(
18429 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18430 ) -> Self {
18431 Self(RequestBuilder::new(stub))
18432 }
18433
18434 pub fn with_request<V: Into<crate::model::SuggestFaqAnswersRequest>>(
18436 mut self,
18437 v: V,
18438 ) -> Self {
18439 self.0.request = v.into();
18440 self
18441 }
18442
18443 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18445 self.0.options = v.into();
18446 self
18447 }
18448
18449 pub async fn send(self) -> Result<crate::model::SuggestFaqAnswersResponse> {
18451 (*self.0.stub)
18452 .suggest_faq_answers(self.0.request, self.0.options)
18453 .await
18454 .map(crate::Response::into_body)
18455 }
18456
18457 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18461 self.0.request.parent = v.into();
18462 self
18463 }
18464
18465 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
18467 self.0.request.latest_message = v.into();
18468 self
18469 }
18470
18471 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
18473 self.0.request.context_size = v.into();
18474 self
18475 }
18476
18477 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
18479 where
18480 T: std::convert::Into<crate::model::AssistQueryParameters>,
18481 {
18482 self.0.request.assist_query_params = std::option::Option::Some(v.into());
18483 self
18484 }
18485
18486 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
18488 where
18489 T: std::convert::Into<crate::model::AssistQueryParameters>,
18490 {
18491 self.0.request.assist_query_params = v.map(|x| x.into());
18492 self
18493 }
18494 }
18495
18496 #[doc(hidden)]
18497 impl crate::RequestBuilder for SuggestFaqAnswers {
18498 fn request_options(&mut self) -> &mut crate::RequestOptions {
18499 &mut self.0.options
18500 }
18501 }
18502
18503 #[derive(Clone, Debug)]
18520 pub struct SuggestSmartReplies(RequestBuilder<crate::model::SuggestSmartRepliesRequest>);
18521
18522 impl SuggestSmartReplies {
18523 pub(crate) fn new(
18524 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18525 ) -> Self {
18526 Self(RequestBuilder::new(stub))
18527 }
18528
18529 pub fn with_request<V: Into<crate::model::SuggestSmartRepliesRequest>>(
18531 mut self,
18532 v: V,
18533 ) -> Self {
18534 self.0.request = v.into();
18535 self
18536 }
18537
18538 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18540 self.0.options = v.into();
18541 self
18542 }
18543
18544 pub async fn send(self) -> Result<crate::model::SuggestSmartRepliesResponse> {
18546 (*self.0.stub)
18547 .suggest_smart_replies(self.0.request, self.0.options)
18548 .await
18549 .map(crate::Response::into_body)
18550 }
18551
18552 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18556 self.0.request.parent = v.into();
18557 self
18558 }
18559
18560 pub fn set_current_text_input<T>(mut self, v: T) -> Self
18562 where
18563 T: std::convert::Into<crate::model::TextInput>,
18564 {
18565 self.0.request.current_text_input = std::option::Option::Some(v.into());
18566 self
18567 }
18568
18569 pub fn set_or_clear_current_text_input<T>(mut self, v: std::option::Option<T>) -> Self
18571 where
18572 T: std::convert::Into<crate::model::TextInput>,
18573 {
18574 self.0.request.current_text_input = v.map(|x| x.into());
18575 self
18576 }
18577
18578 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
18580 self.0.request.latest_message = v.into();
18581 self
18582 }
18583
18584 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
18586 self.0.request.context_size = v.into();
18587 self
18588 }
18589 }
18590
18591 #[doc(hidden)]
18592 impl crate::RequestBuilder for SuggestSmartReplies {
18593 fn request_options(&mut self) -> &mut crate::RequestOptions {
18594 &mut self.0.options
18595 }
18596 }
18597
18598 #[derive(Clone, Debug)]
18615 pub struct SuggestKnowledgeAssist(RequestBuilder<crate::model::SuggestKnowledgeAssistRequest>);
18616
18617 impl SuggestKnowledgeAssist {
18618 pub(crate) fn new(
18619 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18620 ) -> Self {
18621 Self(RequestBuilder::new(stub))
18622 }
18623
18624 pub fn with_request<V: Into<crate::model::SuggestKnowledgeAssistRequest>>(
18626 mut self,
18627 v: V,
18628 ) -> Self {
18629 self.0.request = v.into();
18630 self
18631 }
18632
18633 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18635 self.0.options = v.into();
18636 self
18637 }
18638
18639 pub async fn send(self) -> Result<crate::model::SuggestKnowledgeAssistResponse> {
18641 (*self.0.stub)
18642 .suggest_knowledge_assist(self.0.request, self.0.options)
18643 .await
18644 .map(crate::Response::into_body)
18645 }
18646
18647 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18651 self.0.request.parent = v.into();
18652 self
18653 }
18654
18655 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
18657 self.0.request.latest_message = v.into();
18658 self
18659 }
18660
18661 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
18663 self.0.request.context_size = v.into();
18664 self
18665 }
18666
18667 pub fn set_previous_suggested_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
18669 self.0.request.previous_suggested_query = v.into();
18670 self
18671 }
18672 }
18673
18674 #[doc(hidden)]
18675 impl crate::RequestBuilder for SuggestKnowledgeAssist {
18676 fn request_options(&mut self) -> &mut crate::RequestOptions {
18677 &mut self.0.options
18678 }
18679 }
18680
18681 #[derive(Clone, Debug)]
18702 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
18703
18704 impl ListLocations {
18705 pub(crate) fn new(
18706 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18707 ) -> Self {
18708 Self(RequestBuilder::new(stub))
18709 }
18710
18711 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
18713 mut self,
18714 v: V,
18715 ) -> Self {
18716 self.0.request = v.into();
18717 self
18718 }
18719
18720 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18722 self.0.options = v.into();
18723 self
18724 }
18725
18726 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
18728 (*self.0.stub)
18729 .list_locations(self.0.request, self.0.options)
18730 .await
18731 .map(crate::Response::into_body)
18732 }
18733
18734 pub fn by_page(
18736 self,
18737 ) -> impl google_cloud_gax::paginator::Paginator<
18738 google_cloud_location::model::ListLocationsResponse,
18739 crate::Error,
18740 > {
18741 use std::clone::Clone;
18742 let token = self.0.request.page_token.clone();
18743 let execute = move |token: String| {
18744 let mut builder = self.clone();
18745 builder.0.request = builder.0.request.set_page_token(token);
18746 builder.send()
18747 };
18748 google_cloud_gax::paginator::internal::new_paginator(token, execute)
18749 }
18750
18751 pub fn by_item(
18753 self,
18754 ) -> impl google_cloud_gax::paginator::ItemPaginator<
18755 google_cloud_location::model::ListLocationsResponse,
18756 crate::Error,
18757 > {
18758 use google_cloud_gax::paginator::Paginator;
18759 self.by_page().items()
18760 }
18761
18762 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18764 self.0.request.name = v.into();
18765 self
18766 }
18767
18768 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
18770 self.0.request.filter = v.into();
18771 self
18772 }
18773
18774 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
18776 self.0.request.page_size = v.into();
18777 self
18778 }
18779
18780 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
18782 self.0.request.page_token = v.into();
18783 self
18784 }
18785 }
18786
18787 #[doc(hidden)]
18788 impl crate::RequestBuilder for ListLocations {
18789 fn request_options(&mut self) -> &mut crate::RequestOptions {
18790 &mut self.0.options
18791 }
18792 }
18793
18794 #[derive(Clone, Debug)]
18811 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
18812
18813 impl GetLocation {
18814 pub(crate) fn new(
18815 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18816 ) -> Self {
18817 Self(RequestBuilder::new(stub))
18818 }
18819
18820 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
18822 mut self,
18823 v: V,
18824 ) -> Self {
18825 self.0.request = v.into();
18826 self
18827 }
18828
18829 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18831 self.0.options = v.into();
18832 self
18833 }
18834
18835 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
18837 (*self.0.stub)
18838 .get_location(self.0.request, self.0.options)
18839 .await
18840 .map(crate::Response::into_body)
18841 }
18842
18843 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18845 self.0.request.name = v.into();
18846 self
18847 }
18848 }
18849
18850 #[doc(hidden)]
18851 impl crate::RequestBuilder for GetLocation {
18852 fn request_options(&mut self) -> &mut crate::RequestOptions {
18853 &mut self.0.options
18854 }
18855 }
18856
18857 #[derive(Clone, Debug)]
18878 pub struct ListOperations(
18879 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
18880 );
18881
18882 impl ListOperations {
18883 pub(crate) fn new(
18884 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18885 ) -> Self {
18886 Self(RequestBuilder::new(stub))
18887 }
18888
18889 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
18891 mut self,
18892 v: V,
18893 ) -> Self {
18894 self.0.request = v.into();
18895 self
18896 }
18897
18898 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18900 self.0.options = v.into();
18901 self
18902 }
18903
18904 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
18906 (*self.0.stub)
18907 .list_operations(self.0.request, self.0.options)
18908 .await
18909 .map(crate::Response::into_body)
18910 }
18911
18912 pub fn by_page(
18914 self,
18915 ) -> impl google_cloud_gax::paginator::Paginator<
18916 google_cloud_longrunning::model::ListOperationsResponse,
18917 crate::Error,
18918 > {
18919 use std::clone::Clone;
18920 let token = self.0.request.page_token.clone();
18921 let execute = move |token: String| {
18922 let mut builder = self.clone();
18923 builder.0.request = builder.0.request.set_page_token(token);
18924 builder.send()
18925 };
18926 google_cloud_gax::paginator::internal::new_paginator(token, execute)
18927 }
18928
18929 pub fn by_item(
18931 self,
18932 ) -> impl google_cloud_gax::paginator::ItemPaginator<
18933 google_cloud_longrunning::model::ListOperationsResponse,
18934 crate::Error,
18935 > {
18936 use google_cloud_gax::paginator::Paginator;
18937 self.by_page().items()
18938 }
18939
18940 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18942 self.0.request.name = v.into();
18943 self
18944 }
18945
18946 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
18948 self.0.request.filter = v.into();
18949 self
18950 }
18951
18952 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
18954 self.0.request.page_size = v.into();
18955 self
18956 }
18957
18958 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
18960 self.0.request.page_token = v.into();
18961 self
18962 }
18963
18964 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
18966 self.0.request.return_partial_success = v.into();
18967 self
18968 }
18969 }
18970
18971 #[doc(hidden)]
18972 impl crate::RequestBuilder for ListOperations {
18973 fn request_options(&mut self) -> &mut crate::RequestOptions {
18974 &mut self.0.options
18975 }
18976 }
18977
18978 #[derive(Clone, Debug)]
18995 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
18996
18997 impl GetOperation {
18998 pub(crate) fn new(
18999 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
19000 ) -> Self {
19001 Self(RequestBuilder::new(stub))
19002 }
19003
19004 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
19006 mut self,
19007 v: V,
19008 ) -> Self {
19009 self.0.request = v.into();
19010 self
19011 }
19012
19013 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19015 self.0.options = v.into();
19016 self
19017 }
19018
19019 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
19021 (*self.0.stub)
19022 .get_operation(self.0.request, self.0.options)
19023 .await
19024 .map(crate::Response::into_body)
19025 }
19026
19027 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19029 self.0.request.name = v.into();
19030 self
19031 }
19032 }
19033
19034 #[doc(hidden)]
19035 impl crate::RequestBuilder for GetOperation {
19036 fn request_options(&mut self) -> &mut crate::RequestOptions {
19037 &mut self.0.options
19038 }
19039 }
19040
19041 #[derive(Clone, Debug)]
19058 pub struct CancelOperation(
19059 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
19060 );
19061
19062 impl CancelOperation {
19063 pub(crate) fn new(
19064 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
19065 ) -> Self {
19066 Self(RequestBuilder::new(stub))
19067 }
19068
19069 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
19071 mut self,
19072 v: V,
19073 ) -> Self {
19074 self.0.request = v.into();
19075 self
19076 }
19077
19078 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19080 self.0.options = v.into();
19081 self
19082 }
19083
19084 pub async fn send(self) -> Result<()> {
19086 (*self.0.stub)
19087 .cancel_operation(self.0.request, self.0.options)
19088 .await
19089 .map(crate::Response::into_body)
19090 }
19091
19092 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19094 self.0.request.name = v.into();
19095 self
19096 }
19097 }
19098
19099 #[doc(hidden)]
19100 impl crate::RequestBuilder for CancelOperation {
19101 fn request_options(&mut self) -> &mut crate::RequestOptions {
19102 &mut self.0.options
19103 }
19104 }
19105}
19106
19107#[cfg(feature = "sessions")]
19108#[cfg_attr(docsrs, doc(cfg(feature = "sessions")))]
19109pub mod sessions {
19110 use crate::Result;
19111
19112 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
19126
19127 pub(crate) mod client {
19128 use super::super::super::client::Sessions;
19129 pub struct Factory;
19130 impl crate::ClientFactory for Factory {
19131 type Client = Sessions;
19132 type Credentials = gaxi::options::Credentials;
19133 async fn build(
19134 self,
19135 config: gaxi::options::ClientConfig,
19136 ) -> crate::ClientBuilderResult<Self::Client> {
19137 Self::Client::new(config).await
19138 }
19139 }
19140 }
19141
19142 #[derive(Clone, Debug)]
19144 pub(crate) struct RequestBuilder<R: std::default::Default> {
19145 stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>,
19146 request: R,
19147 options: crate::RequestOptions,
19148 }
19149
19150 impl<R> RequestBuilder<R>
19151 where
19152 R: std::default::Default,
19153 {
19154 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19155 Self {
19156 stub,
19157 request: R::default(),
19158 options: crate::RequestOptions::default(),
19159 }
19160 }
19161 }
19162
19163 #[derive(Clone, Debug)]
19180 pub struct DetectIntent(RequestBuilder<crate::model::DetectIntentRequest>);
19181
19182 impl DetectIntent {
19183 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19184 Self(RequestBuilder::new(stub))
19185 }
19186
19187 pub fn with_request<V: Into<crate::model::DetectIntentRequest>>(mut self, v: V) -> Self {
19189 self.0.request = v.into();
19190 self
19191 }
19192
19193 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19195 self.0.options = v.into();
19196 self
19197 }
19198
19199 pub async fn send(self) -> Result<crate::model::DetectIntentResponse> {
19201 (*self.0.stub)
19202 .detect_intent(self.0.request, self.0.options)
19203 .await
19204 .map(crate::Response::into_body)
19205 }
19206
19207 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
19211 self.0.request.session = v.into();
19212 self
19213 }
19214
19215 pub fn set_query_params<T>(mut self, v: T) -> Self
19217 where
19218 T: std::convert::Into<crate::model::QueryParameters>,
19219 {
19220 self.0.request.query_params = std::option::Option::Some(v.into());
19221 self
19222 }
19223
19224 pub fn set_or_clear_query_params<T>(mut self, v: std::option::Option<T>) -> Self
19226 where
19227 T: std::convert::Into<crate::model::QueryParameters>,
19228 {
19229 self.0.request.query_params = v.map(|x| x.into());
19230 self
19231 }
19232
19233 pub fn set_query_input<T>(mut self, v: T) -> Self
19237 where
19238 T: std::convert::Into<crate::model::QueryInput>,
19239 {
19240 self.0.request.query_input = std::option::Option::Some(v.into());
19241 self
19242 }
19243
19244 pub fn set_or_clear_query_input<T>(mut self, v: std::option::Option<T>) -> Self
19248 where
19249 T: std::convert::Into<crate::model::QueryInput>,
19250 {
19251 self.0.request.query_input = v.map(|x| x.into());
19252 self
19253 }
19254
19255 pub fn set_output_audio_config<T>(mut self, v: T) -> Self
19257 where
19258 T: std::convert::Into<crate::model::OutputAudioConfig>,
19259 {
19260 self.0.request.output_audio_config = std::option::Option::Some(v.into());
19261 self
19262 }
19263
19264 pub fn set_or_clear_output_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
19266 where
19267 T: std::convert::Into<crate::model::OutputAudioConfig>,
19268 {
19269 self.0.request.output_audio_config = v.map(|x| x.into());
19270 self
19271 }
19272
19273 pub fn set_output_audio_config_mask<T>(mut self, v: T) -> Self
19275 where
19276 T: std::convert::Into<wkt::FieldMask>,
19277 {
19278 self.0.request.output_audio_config_mask = std::option::Option::Some(v.into());
19279 self
19280 }
19281
19282 pub fn set_or_clear_output_audio_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
19284 where
19285 T: std::convert::Into<wkt::FieldMask>,
19286 {
19287 self.0.request.output_audio_config_mask = v.map(|x| x.into());
19288 self
19289 }
19290
19291 pub fn set_input_audio<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
19293 self.0.request.input_audio = v.into();
19294 self
19295 }
19296 }
19297
19298 #[doc(hidden)]
19299 impl crate::RequestBuilder for DetectIntent {
19300 fn request_options(&mut self) -> &mut crate::RequestOptions {
19301 &mut self.0.options
19302 }
19303 }
19304
19305 #[derive(Clone, Debug)]
19326 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
19327
19328 impl ListLocations {
19329 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19330 Self(RequestBuilder::new(stub))
19331 }
19332
19333 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
19335 mut self,
19336 v: V,
19337 ) -> Self {
19338 self.0.request = v.into();
19339 self
19340 }
19341
19342 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19344 self.0.options = v.into();
19345 self
19346 }
19347
19348 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
19350 (*self.0.stub)
19351 .list_locations(self.0.request, self.0.options)
19352 .await
19353 .map(crate::Response::into_body)
19354 }
19355
19356 pub fn by_page(
19358 self,
19359 ) -> impl google_cloud_gax::paginator::Paginator<
19360 google_cloud_location::model::ListLocationsResponse,
19361 crate::Error,
19362 > {
19363 use std::clone::Clone;
19364 let token = self.0.request.page_token.clone();
19365 let execute = move |token: String| {
19366 let mut builder = self.clone();
19367 builder.0.request = builder.0.request.set_page_token(token);
19368 builder.send()
19369 };
19370 google_cloud_gax::paginator::internal::new_paginator(token, execute)
19371 }
19372
19373 pub fn by_item(
19375 self,
19376 ) -> impl google_cloud_gax::paginator::ItemPaginator<
19377 google_cloud_location::model::ListLocationsResponse,
19378 crate::Error,
19379 > {
19380 use google_cloud_gax::paginator::Paginator;
19381 self.by_page().items()
19382 }
19383
19384 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19386 self.0.request.name = v.into();
19387 self
19388 }
19389
19390 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
19392 self.0.request.filter = v.into();
19393 self
19394 }
19395
19396 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
19398 self.0.request.page_size = v.into();
19399 self
19400 }
19401
19402 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
19404 self.0.request.page_token = v.into();
19405 self
19406 }
19407 }
19408
19409 #[doc(hidden)]
19410 impl crate::RequestBuilder for ListLocations {
19411 fn request_options(&mut self) -> &mut crate::RequestOptions {
19412 &mut self.0.options
19413 }
19414 }
19415
19416 #[derive(Clone, Debug)]
19433 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
19434
19435 impl GetLocation {
19436 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19437 Self(RequestBuilder::new(stub))
19438 }
19439
19440 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
19442 mut self,
19443 v: V,
19444 ) -> Self {
19445 self.0.request = v.into();
19446 self
19447 }
19448
19449 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19451 self.0.options = v.into();
19452 self
19453 }
19454
19455 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
19457 (*self.0.stub)
19458 .get_location(self.0.request, self.0.options)
19459 .await
19460 .map(crate::Response::into_body)
19461 }
19462
19463 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19465 self.0.request.name = v.into();
19466 self
19467 }
19468 }
19469
19470 #[doc(hidden)]
19471 impl crate::RequestBuilder for GetLocation {
19472 fn request_options(&mut self) -> &mut crate::RequestOptions {
19473 &mut self.0.options
19474 }
19475 }
19476
19477 #[derive(Clone, Debug)]
19498 pub struct ListOperations(
19499 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
19500 );
19501
19502 impl ListOperations {
19503 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19504 Self(RequestBuilder::new(stub))
19505 }
19506
19507 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
19509 mut self,
19510 v: V,
19511 ) -> Self {
19512 self.0.request = v.into();
19513 self
19514 }
19515
19516 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19518 self.0.options = v.into();
19519 self
19520 }
19521
19522 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
19524 (*self.0.stub)
19525 .list_operations(self.0.request, self.0.options)
19526 .await
19527 .map(crate::Response::into_body)
19528 }
19529
19530 pub fn by_page(
19532 self,
19533 ) -> impl google_cloud_gax::paginator::Paginator<
19534 google_cloud_longrunning::model::ListOperationsResponse,
19535 crate::Error,
19536 > {
19537 use std::clone::Clone;
19538 let token = self.0.request.page_token.clone();
19539 let execute = move |token: String| {
19540 let mut builder = self.clone();
19541 builder.0.request = builder.0.request.set_page_token(token);
19542 builder.send()
19543 };
19544 google_cloud_gax::paginator::internal::new_paginator(token, execute)
19545 }
19546
19547 pub fn by_item(
19549 self,
19550 ) -> impl google_cloud_gax::paginator::ItemPaginator<
19551 google_cloud_longrunning::model::ListOperationsResponse,
19552 crate::Error,
19553 > {
19554 use google_cloud_gax::paginator::Paginator;
19555 self.by_page().items()
19556 }
19557
19558 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19560 self.0.request.name = v.into();
19561 self
19562 }
19563
19564 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
19566 self.0.request.filter = v.into();
19567 self
19568 }
19569
19570 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
19572 self.0.request.page_size = v.into();
19573 self
19574 }
19575
19576 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
19578 self.0.request.page_token = v.into();
19579 self
19580 }
19581
19582 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
19584 self.0.request.return_partial_success = v.into();
19585 self
19586 }
19587 }
19588
19589 #[doc(hidden)]
19590 impl crate::RequestBuilder for ListOperations {
19591 fn request_options(&mut self) -> &mut crate::RequestOptions {
19592 &mut self.0.options
19593 }
19594 }
19595
19596 #[derive(Clone, Debug)]
19613 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
19614
19615 impl GetOperation {
19616 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19617 Self(RequestBuilder::new(stub))
19618 }
19619
19620 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
19622 mut self,
19623 v: V,
19624 ) -> Self {
19625 self.0.request = v.into();
19626 self
19627 }
19628
19629 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19631 self.0.options = v.into();
19632 self
19633 }
19634
19635 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
19637 (*self.0.stub)
19638 .get_operation(self.0.request, self.0.options)
19639 .await
19640 .map(crate::Response::into_body)
19641 }
19642
19643 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19645 self.0.request.name = v.into();
19646 self
19647 }
19648 }
19649
19650 #[doc(hidden)]
19651 impl crate::RequestBuilder for GetOperation {
19652 fn request_options(&mut self) -> &mut crate::RequestOptions {
19653 &mut self.0.options
19654 }
19655 }
19656
19657 #[derive(Clone, Debug)]
19674 pub struct CancelOperation(
19675 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
19676 );
19677
19678 impl CancelOperation {
19679 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19680 Self(RequestBuilder::new(stub))
19681 }
19682
19683 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
19685 mut self,
19686 v: V,
19687 ) -> Self {
19688 self.0.request = v.into();
19689 self
19690 }
19691
19692 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19694 self.0.options = v.into();
19695 self
19696 }
19697
19698 pub async fn send(self) -> Result<()> {
19700 (*self.0.stub)
19701 .cancel_operation(self.0.request, self.0.options)
19702 .await
19703 .map(crate::Response::into_body)
19704 }
19705
19706 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19708 self.0.request.name = v.into();
19709 self
19710 }
19711 }
19712
19713 #[doc(hidden)]
19714 impl crate::RequestBuilder for CancelOperation {
19715 fn request_options(&mut self) -> &mut crate::RequestOptions {
19716 &mut self.0.options
19717 }
19718 }
19719}
19720
19721#[cfg(feature = "session-entity-types")]
19722#[cfg_attr(docsrs, doc(cfg(feature = "session-entity-types")))]
19723pub mod session_entity_types {
19724 use crate::Result;
19725
19726 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
19740
19741 pub(crate) mod client {
19742 use super::super::super::client::SessionEntityTypes;
19743 pub struct Factory;
19744 impl crate::ClientFactory for Factory {
19745 type Client = SessionEntityTypes;
19746 type Credentials = gaxi::options::Credentials;
19747 async fn build(
19748 self,
19749 config: gaxi::options::ClientConfig,
19750 ) -> crate::ClientBuilderResult<Self::Client> {
19751 Self::Client::new(config).await
19752 }
19753 }
19754 }
19755
19756 #[derive(Clone, Debug)]
19758 pub(crate) struct RequestBuilder<R: std::default::Default> {
19759 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19760 request: R,
19761 options: crate::RequestOptions,
19762 }
19763
19764 impl<R> RequestBuilder<R>
19765 where
19766 R: std::default::Default,
19767 {
19768 pub(crate) fn new(
19769 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19770 ) -> Self {
19771 Self {
19772 stub,
19773 request: R::default(),
19774 options: crate::RequestOptions::default(),
19775 }
19776 }
19777 }
19778
19779 #[derive(Clone, Debug)]
19800 pub struct ListSessionEntityTypes(RequestBuilder<crate::model::ListSessionEntityTypesRequest>);
19801
19802 impl ListSessionEntityTypes {
19803 pub(crate) fn new(
19804 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19805 ) -> Self {
19806 Self(RequestBuilder::new(stub))
19807 }
19808
19809 pub fn with_request<V: Into<crate::model::ListSessionEntityTypesRequest>>(
19811 mut self,
19812 v: V,
19813 ) -> Self {
19814 self.0.request = v.into();
19815 self
19816 }
19817
19818 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19820 self.0.options = v.into();
19821 self
19822 }
19823
19824 pub async fn send(self) -> Result<crate::model::ListSessionEntityTypesResponse> {
19826 (*self.0.stub)
19827 .list_session_entity_types(self.0.request, self.0.options)
19828 .await
19829 .map(crate::Response::into_body)
19830 }
19831
19832 pub fn by_page(
19834 self,
19835 ) -> impl google_cloud_gax::paginator::Paginator<
19836 crate::model::ListSessionEntityTypesResponse,
19837 crate::Error,
19838 > {
19839 use std::clone::Clone;
19840 let token = self.0.request.page_token.clone();
19841 let execute = move |token: String| {
19842 let mut builder = self.clone();
19843 builder.0.request = builder.0.request.set_page_token(token);
19844 builder.send()
19845 };
19846 google_cloud_gax::paginator::internal::new_paginator(token, execute)
19847 }
19848
19849 pub fn by_item(
19851 self,
19852 ) -> impl google_cloud_gax::paginator::ItemPaginator<
19853 crate::model::ListSessionEntityTypesResponse,
19854 crate::Error,
19855 > {
19856 use google_cloud_gax::paginator::Paginator;
19857 self.by_page().items()
19858 }
19859
19860 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
19864 self.0.request.parent = v.into();
19865 self
19866 }
19867
19868 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
19870 self.0.request.page_size = v.into();
19871 self
19872 }
19873
19874 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
19876 self.0.request.page_token = v.into();
19877 self
19878 }
19879 }
19880
19881 #[doc(hidden)]
19882 impl crate::RequestBuilder for ListSessionEntityTypes {
19883 fn request_options(&mut self) -> &mut crate::RequestOptions {
19884 &mut self.0.options
19885 }
19886 }
19887
19888 #[derive(Clone, Debug)]
19905 pub struct GetSessionEntityType(RequestBuilder<crate::model::GetSessionEntityTypeRequest>);
19906
19907 impl GetSessionEntityType {
19908 pub(crate) fn new(
19909 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19910 ) -> Self {
19911 Self(RequestBuilder::new(stub))
19912 }
19913
19914 pub fn with_request<V: Into<crate::model::GetSessionEntityTypeRequest>>(
19916 mut self,
19917 v: V,
19918 ) -> Self {
19919 self.0.request = v.into();
19920 self
19921 }
19922
19923 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19925 self.0.options = v.into();
19926 self
19927 }
19928
19929 pub async fn send(self) -> Result<crate::model::SessionEntityType> {
19931 (*self.0.stub)
19932 .get_session_entity_type(self.0.request, self.0.options)
19933 .await
19934 .map(crate::Response::into_body)
19935 }
19936
19937 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19941 self.0.request.name = v.into();
19942 self
19943 }
19944 }
19945
19946 #[doc(hidden)]
19947 impl crate::RequestBuilder for GetSessionEntityType {
19948 fn request_options(&mut self) -> &mut crate::RequestOptions {
19949 &mut self.0.options
19950 }
19951 }
19952
19953 #[derive(Clone, Debug)]
19970 pub struct CreateSessionEntityType(
19971 RequestBuilder<crate::model::CreateSessionEntityTypeRequest>,
19972 );
19973
19974 impl CreateSessionEntityType {
19975 pub(crate) fn new(
19976 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19977 ) -> Self {
19978 Self(RequestBuilder::new(stub))
19979 }
19980
19981 pub fn with_request<V: Into<crate::model::CreateSessionEntityTypeRequest>>(
19983 mut self,
19984 v: V,
19985 ) -> Self {
19986 self.0.request = v.into();
19987 self
19988 }
19989
19990 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19992 self.0.options = v.into();
19993 self
19994 }
19995
19996 pub async fn send(self) -> Result<crate::model::SessionEntityType> {
19998 (*self.0.stub)
19999 .create_session_entity_type(self.0.request, self.0.options)
20000 .await
20001 .map(crate::Response::into_body)
20002 }
20003
20004 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
20008 self.0.request.parent = v.into();
20009 self
20010 }
20011
20012 pub fn set_session_entity_type<T>(mut self, v: T) -> Self
20016 where
20017 T: std::convert::Into<crate::model::SessionEntityType>,
20018 {
20019 self.0.request.session_entity_type = std::option::Option::Some(v.into());
20020 self
20021 }
20022
20023 pub fn set_or_clear_session_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
20027 where
20028 T: std::convert::Into<crate::model::SessionEntityType>,
20029 {
20030 self.0.request.session_entity_type = v.map(|x| x.into());
20031 self
20032 }
20033 }
20034
20035 #[doc(hidden)]
20036 impl crate::RequestBuilder for CreateSessionEntityType {
20037 fn request_options(&mut self) -> &mut crate::RequestOptions {
20038 &mut self.0.options
20039 }
20040 }
20041
20042 #[derive(Clone, Debug)]
20059 pub struct UpdateSessionEntityType(
20060 RequestBuilder<crate::model::UpdateSessionEntityTypeRequest>,
20061 );
20062
20063 impl UpdateSessionEntityType {
20064 pub(crate) fn new(
20065 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20066 ) -> Self {
20067 Self(RequestBuilder::new(stub))
20068 }
20069
20070 pub fn with_request<V: Into<crate::model::UpdateSessionEntityTypeRequest>>(
20072 mut self,
20073 v: V,
20074 ) -> Self {
20075 self.0.request = v.into();
20076 self
20077 }
20078
20079 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20081 self.0.options = v.into();
20082 self
20083 }
20084
20085 pub async fn send(self) -> Result<crate::model::SessionEntityType> {
20087 (*self.0.stub)
20088 .update_session_entity_type(self.0.request, self.0.options)
20089 .await
20090 .map(crate::Response::into_body)
20091 }
20092
20093 pub fn set_session_entity_type<T>(mut self, v: T) -> Self
20097 where
20098 T: std::convert::Into<crate::model::SessionEntityType>,
20099 {
20100 self.0.request.session_entity_type = std::option::Option::Some(v.into());
20101 self
20102 }
20103
20104 pub fn set_or_clear_session_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
20108 where
20109 T: std::convert::Into<crate::model::SessionEntityType>,
20110 {
20111 self.0.request.session_entity_type = v.map(|x| x.into());
20112 self
20113 }
20114
20115 pub fn set_update_mask<T>(mut self, v: T) -> Self
20117 where
20118 T: std::convert::Into<wkt::FieldMask>,
20119 {
20120 self.0.request.update_mask = std::option::Option::Some(v.into());
20121 self
20122 }
20123
20124 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
20126 where
20127 T: std::convert::Into<wkt::FieldMask>,
20128 {
20129 self.0.request.update_mask = v.map(|x| x.into());
20130 self
20131 }
20132 }
20133
20134 #[doc(hidden)]
20135 impl crate::RequestBuilder for UpdateSessionEntityType {
20136 fn request_options(&mut self) -> &mut crate::RequestOptions {
20137 &mut self.0.options
20138 }
20139 }
20140
20141 #[derive(Clone, Debug)]
20158 pub struct DeleteSessionEntityType(
20159 RequestBuilder<crate::model::DeleteSessionEntityTypeRequest>,
20160 );
20161
20162 impl DeleteSessionEntityType {
20163 pub(crate) fn new(
20164 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20165 ) -> Self {
20166 Self(RequestBuilder::new(stub))
20167 }
20168
20169 pub fn with_request<V: Into<crate::model::DeleteSessionEntityTypeRequest>>(
20171 mut self,
20172 v: V,
20173 ) -> Self {
20174 self.0.request = v.into();
20175 self
20176 }
20177
20178 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20180 self.0.options = v.into();
20181 self
20182 }
20183
20184 pub async fn send(self) -> Result<()> {
20186 (*self.0.stub)
20187 .delete_session_entity_type(self.0.request, self.0.options)
20188 .await
20189 .map(crate::Response::into_body)
20190 }
20191
20192 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20196 self.0.request.name = v.into();
20197 self
20198 }
20199 }
20200
20201 #[doc(hidden)]
20202 impl crate::RequestBuilder for DeleteSessionEntityType {
20203 fn request_options(&mut self) -> &mut crate::RequestOptions {
20204 &mut self.0.options
20205 }
20206 }
20207
20208 #[derive(Clone, Debug)]
20229 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
20230
20231 impl ListLocations {
20232 pub(crate) fn new(
20233 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20234 ) -> Self {
20235 Self(RequestBuilder::new(stub))
20236 }
20237
20238 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
20240 mut self,
20241 v: V,
20242 ) -> Self {
20243 self.0.request = v.into();
20244 self
20245 }
20246
20247 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20249 self.0.options = v.into();
20250 self
20251 }
20252
20253 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
20255 (*self.0.stub)
20256 .list_locations(self.0.request, self.0.options)
20257 .await
20258 .map(crate::Response::into_body)
20259 }
20260
20261 pub fn by_page(
20263 self,
20264 ) -> impl google_cloud_gax::paginator::Paginator<
20265 google_cloud_location::model::ListLocationsResponse,
20266 crate::Error,
20267 > {
20268 use std::clone::Clone;
20269 let token = self.0.request.page_token.clone();
20270 let execute = move |token: String| {
20271 let mut builder = self.clone();
20272 builder.0.request = builder.0.request.set_page_token(token);
20273 builder.send()
20274 };
20275 google_cloud_gax::paginator::internal::new_paginator(token, execute)
20276 }
20277
20278 pub fn by_item(
20280 self,
20281 ) -> impl google_cloud_gax::paginator::ItemPaginator<
20282 google_cloud_location::model::ListLocationsResponse,
20283 crate::Error,
20284 > {
20285 use google_cloud_gax::paginator::Paginator;
20286 self.by_page().items()
20287 }
20288
20289 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20291 self.0.request.name = v.into();
20292 self
20293 }
20294
20295 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
20297 self.0.request.filter = v.into();
20298 self
20299 }
20300
20301 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
20303 self.0.request.page_size = v.into();
20304 self
20305 }
20306
20307 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
20309 self.0.request.page_token = v.into();
20310 self
20311 }
20312 }
20313
20314 #[doc(hidden)]
20315 impl crate::RequestBuilder for ListLocations {
20316 fn request_options(&mut self) -> &mut crate::RequestOptions {
20317 &mut self.0.options
20318 }
20319 }
20320
20321 #[derive(Clone, Debug)]
20338 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
20339
20340 impl GetLocation {
20341 pub(crate) fn new(
20342 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20343 ) -> Self {
20344 Self(RequestBuilder::new(stub))
20345 }
20346
20347 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
20349 mut self,
20350 v: V,
20351 ) -> Self {
20352 self.0.request = v.into();
20353 self
20354 }
20355
20356 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20358 self.0.options = v.into();
20359 self
20360 }
20361
20362 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
20364 (*self.0.stub)
20365 .get_location(self.0.request, self.0.options)
20366 .await
20367 .map(crate::Response::into_body)
20368 }
20369
20370 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20372 self.0.request.name = v.into();
20373 self
20374 }
20375 }
20376
20377 #[doc(hidden)]
20378 impl crate::RequestBuilder for GetLocation {
20379 fn request_options(&mut self) -> &mut crate::RequestOptions {
20380 &mut self.0.options
20381 }
20382 }
20383
20384 #[derive(Clone, Debug)]
20405 pub struct ListOperations(
20406 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
20407 );
20408
20409 impl ListOperations {
20410 pub(crate) fn new(
20411 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20412 ) -> Self {
20413 Self(RequestBuilder::new(stub))
20414 }
20415
20416 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
20418 mut self,
20419 v: V,
20420 ) -> Self {
20421 self.0.request = v.into();
20422 self
20423 }
20424
20425 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20427 self.0.options = v.into();
20428 self
20429 }
20430
20431 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
20433 (*self.0.stub)
20434 .list_operations(self.0.request, self.0.options)
20435 .await
20436 .map(crate::Response::into_body)
20437 }
20438
20439 pub fn by_page(
20441 self,
20442 ) -> impl google_cloud_gax::paginator::Paginator<
20443 google_cloud_longrunning::model::ListOperationsResponse,
20444 crate::Error,
20445 > {
20446 use std::clone::Clone;
20447 let token = self.0.request.page_token.clone();
20448 let execute = move |token: String| {
20449 let mut builder = self.clone();
20450 builder.0.request = builder.0.request.set_page_token(token);
20451 builder.send()
20452 };
20453 google_cloud_gax::paginator::internal::new_paginator(token, execute)
20454 }
20455
20456 pub fn by_item(
20458 self,
20459 ) -> impl google_cloud_gax::paginator::ItemPaginator<
20460 google_cloud_longrunning::model::ListOperationsResponse,
20461 crate::Error,
20462 > {
20463 use google_cloud_gax::paginator::Paginator;
20464 self.by_page().items()
20465 }
20466
20467 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20469 self.0.request.name = v.into();
20470 self
20471 }
20472
20473 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
20475 self.0.request.filter = v.into();
20476 self
20477 }
20478
20479 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
20481 self.0.request.page_size = v.into();
20482 self
20483 }
20484
20485 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
20487 self.0.request.page_token = v.into();
20488 self
20489 }
20490
20491 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
20493 self.0.request.return_partial_success = v.into();
20494 self
20495 }
20496 }
20497
20498 #[doc(hidden)]
20499 impl crate::RequestBuilder for ListOperations {
20500 fn request_options(&mut self) -> &mut crate::RequestOptions {
20501 &mut self.0.options
20502 }
20503 }
20504
20505 #[derive(Clone, Debug)]
20522 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
20523
20524 impl GetOperation {
20525 pub(crate) fn new(
20526 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20527 ) -> Self {
20528 Self(RequestBuilder::new(stub))
20529 }
20530
20531 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
20533 mut self,
20534 v: V,
20535 ) -> Self {
20536 self.0.request = v.into();
20537 self
20538 }
20539
20540 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20542 self.0.options = v.into();
20543 self
20544 }
20545
20546 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
20548 (*self.0.stub)
20549 .get_operation(self.0.request, self.0.options)
20550 .await
20551 .map(crate::Response::into_body)
20552 }
20553
20554 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20556 self.0.request.name = v.into();
20557 self
20558 }
20559 }
20560
20561 #[doc(hidden)]
20562 impl crate::RequestBuilder for GetOperation {
20563 fn request_options(&mut self) -> &mut crate::RequestOptions {
20564 &mut self.0.options
20565 }
20566 }
20567
20568 #[derive(Clone, Debug)]
20585 pub struct CancelOperation(
20586 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
20587 );
20588
20589 impl CancelOperation {
20590 pub(crate) fn new(
20591 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20592 ) -> Self {
20593 Self(RequestBuilder::new(stub))
20594 }
20595
20596 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
20598 mut self,
20599 v: V,
20600 ) -> Self {
20601 self.0.request = v.into();
20602 self
20603 }
20604
20605 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20607 self.0.options = v.into();
20608 self
20609 }
20610
20611 pub async fn send(self) -> Result<()> {
20613 (*self.0.stub)
20614 .cancel_operation(self.0.request, self.0.options)
20615 .await
20616 .map(crate::Response::into_body)
20617 }
20618
20619 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20621 self.0.request.name = v.into();
20622 self
20623 }
20624 }
20625
20626 #[doc(hidden)]
20627 impl crate::RequestBuilder for CancelOperation {
20628 fn request_options(&mut self) -> &mut crate::RequestOptions {
20629 &mut self.0.options
20630 }
20631 }
20632}
20633
20634#[cfg(feature = "sip-trunks")]
20635#[cfg_attr(docsrs, doc(cfg(feature = "sip-trunks")))]
20636pub mod sip_trunks {
20637 use crate::Result;
20638
20639 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
20653
20654 pub(crate) mod client {
20655 use super::super::super::client::SipTrunks;
20656 pub struct Factory;
20657 impl crate::ClientFactory for Factory {
20658 type Client = SipTrunks;
20659 type Credentials = gaxi::options::Credentials;
20660 async fn build(
20661 self,
20662 config: gaxi::options::ClientConfig,
20663 ) -> crate::ClientBuilderResult<Self::Client> {
20664 Self::Client::new(config).await
20665 }
20666 }
20667 }
20668
20669 #[derive(Clone, Debug)]
20671 pub(crate) struct RequestBuilder<R: std::default::Default> {
20672 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20673 request: R,
20674 options: crate::RequestOptions,
20675 }
20676
20677 impl<R> RequestBuilder<R>
20678 where
20679 R: std::default::Default,
20680 {
20681 pub(crate) fn new(
20682 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20683 ) -> Self {
20684 Self {
20685 stub,
20686 request: R::default(),
20687 options: crate::RequestOptions::default(),
20688 }
20689 }
20690 }
20691
20692 #[derive(Clone, Debug)]
20709 pub struct CreateSipTrunk(RequestBuilder<crate::model::CreateSipTrunkRequest>);
20710
20711 impl CreateSipTrunk {
20712 pub(crate) fn new(
20713 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20714 ) -> Self {
20715 Self(RequestBuilder::new(stub))
20716 }
20717
20718 pub fn with_request<V: Into<crate::model::CreateSipTrunkRequest>>(mut self, v: V) -> Self {
20720 self.0.request = v.into();
20721 self
20722 }
20723
20724 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20726 self.0.options = v.into();
20727 self
20728 }
20729
20730 pub async fn send(self) -> Result<crate::model::SipTrunk> {
20732 (*self.0.stub)
20733 .create_sip_trunk(self.0.request, self.0.options)
20734 .await
20735 .map(crate::Response::into_body)
20736 }
20737
20738 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
20742 self.0.request.parent = v.into();
20743 self
20744 }
20745
20746 pub fn set_sip_trunk<T>(mut self, v: T) -> Self
20750 where
20751 T: std::convert::Into<crate::model::SipTrunk>,
20752 {
20753 self.0.request.sip_trunk = std::option::Option::Some(v.into());
20754 self
20755 }
20756
20757 pub fn set_or_clear_sip_trunk<T>(mut self, v: std::option::Option<T>) -> Self
20761 where
20762 T: std::convert::Into<crate::model::SipTrunk>,
20763 {
20764 self.0.request.sip_trunk = v.map(|x| x.into());
20765 self
20766 }
20767 }
20768
20769 #[doc(hidden)]
20770 impl crate::RequestBuilder for CreateSipTrunk {
20771 fn request_options(&mut self) -> &mut crate::RequestOptions {
20772 &mut self.0.options
20773 }
20774 }
20775
20776 #[derive(Clone, Debug)]
20793 pub struct DeleteSipTrunk(RequestBuilder<crate::model::DeleteSipTrunkRequest>);
20794
20795 impl DeleteSipTrunk {
20796 pub(crate) fn new(
20797 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20798 ) -> Self {
20799 Self(RequestBuilder::new(stub))
20800 }
20801
20802 pub fn with_request<V: Into<crate::model::DeleteSipTrunkRequest>>(mut self, v: V) -> Self {
20804 self.0.request = v.into();
20805 self
20806 }
20807
20808 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20810 self.0.options = v.into();
20811 self
20812 }
20813
20814 pub async fn send(self) -> Result<()> {
20816 (*self.0.stub)
20817 .delete_sip_trunk(self.0.request, self.0.options)
20818 .await
20819 .map(crate::Response::into_body)
20820 }
20821
20822 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20826 self.0.request.name = v.into();
20827 self
20828 }
20829 }
20830
20831 #[doc(hidden)]
20832 impl crate::RequestBuilder for DeleteSipTrunk {
20833 fn request_options(&mut self) -> &mut crate::RequestOptions {
20834 &mut self.0.options
20835 }
20836 }
20837
20838 #[derive(Clone, Debug)]
20859 pub struct ListSipTrunks(RequestBuilder<crate::model::ListSipTrunksRequest>);
20860
20861 impl ListSipTrunks {
20862 pub(crate) fn new(
20863 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20864 ) -> Self {
20865 Self(RequestBuilder::new(stub))
20866 }
20867
20868 pub fn with_request<V: Into<crate::model::ListSipTrunksRequest>>(mut self, v: V) -> Self {
20870 self.0.request = v.into();
20871 self
20872 }
20873
20874 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20876 self.0.options = v.into();
20877 self
20878 }
20879
20880 pub async fn send(self) -> Result<crate::model::ListSipTrunksResponse> {
20882 (*self.0.stub)
20883 .list_sip_trunks(self.0.request, self.0.options)
20884 .await
20885 .map(crate::Response::into_body)
20886 }
20887
20888 pub fn by_page(
20890 self,
20891 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSipTrunksResponse, crate::Error>
20892 {
20893 use std::clone::Clone;
20894 let token = self.0.request.page_token.clone();
20895 let execute = move |token: String| {
20896 let mut builder = self.clone();
20897 builder.0.request = builder.0.request.set_page_token(token);
20898 builder.send()
20899 };
20900 google_cloud_gax::paginator::internal::new_paginator(token, execute)
20901 }
20902
20903 pub fn by_item(
20905 self,
20906 ) -> impl google_cloud_gax::paginator::ItemPaginator<
20907 crate::model::ListSipTrunksResponse,
20908 crate::Error,
20909 > {
20910 use google_cloud_gax::paginator::Paginator;
20911 self.by_page().items()
20912 }
20913
20914 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
20918 self.0.request.parent = v.into();
20919 self
20920 }
20921
20922 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
20924 self.0.request.page_size = v.into();
20925 self
20926 }
20927
20928 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
20930 self.0.request.page_token = v.into();
20931 self
20932 }
20933 }
20934
20935 #[doc(hidden)]
20936 impl crate::RequestBuilder for ListSipTrunks {
20937 fn request_options(&mut self) -> &mut crate::RequestOptions {
20938 &mut self.0.options
20939 }
20940 }
20941
20942 #[derive(Clone, Debug)]
20959 pub struct GetSipTrunk(RequestBuilder<crate::model::GetSipTrunkRequest>);
20960
20961 impl GetSipTrunk {
20962 pub(crate) fn new(
20963 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20964 ) -> Self {
20965 Self(RequestBuilder::new(stub))
20966 }
20967
20968 pub fn with_request<V: Into<crate::model::GetSipTrunkRequest>>(mut self, v: V) -> Self {
20970 self.0.request = v.into();
20971 self
20972 }
20973
20974 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20976 self.0.options = v.into();
20977 self
20978 }
20979
20980 pub async fn send(self) -> Result<crate::model::SipTrunk> {
20982 (*self.0.stub)
20983 .get_sip_trunk(self.0.request, self.0.options)
20984 .await
20985 .map(crate::Response::into_body)
20986 }
20987
20988 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20992 self.0.request.name = v.into();
20993 self
20994 }
20995 }
20996
20997 #[doc(hidden)]
20998 impl crate::RequestBuilder for GetSipTrunk {
20999 fn request_options(&mut self) -> &mut crate::RequestOptions {
21000 &mut self.0.options
21001 }
21002 }
21003
21004 #[derive(Clone, Debug)]
21021 pub struct UpdateSipTrunk(RequestBuilder<crate::model::UpdateSipTrunkRequest>);
21022
21023 impl UpdateSipTrunk {
21024 pub(crate) fn new(
21025 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21026 ) -> Self {
21027 Self(RequestBuilder::new(stub))
21028 }
21029
21030 pub fn with_request<V: Into<crate::model::UpdateSipTrunkRequest>>(mut self, v: V) -> Self {
21032 self.0.request = v.into();
21033 self
21034 }
21035
21036 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21038 self.0.options = v.into();
21039 self
21040 }
21041
21042 pub async fn send(self) -> Result<crate::model::SipTrunk> {
21044 (*self.0.stub)
21045 .update_sip_trunk(self.0.request, self.0.options)
21046 .await
21047 .map(crate::Response::into_body)
21048 }
21049
21050 pub fn set_sip_trunk<T>(mut self, v: T) -> Self
21054 where
21055 T: std::convert::Into<crate::model::SipTrunk>,
21056 {
21057 self.0.request.sip_trunk = std::option::Option::Some(v.into());
21058 self
21059 }
21060
21061 pub fn set_or_clear_sip_trunk<T>(mut self, v: std::option::Option<T>) -> Self
21065 where
21066 T: std::convert::Into<crate::model::SipTrunk>,
21067 {
21068 self.0.request.sip_trunk = v.map(|x| x.into());
21069 self
21070 }
21071
21072 pub fn set_update_mask<T>(mut self, v: T) -> Self
21074 where
21075 T: std::convert::Into<wkt::FieldMask>,
21076 {
21077 self.0.request.update_mask = std::option::Option::Some(v.into());
21078 self
21079 }
21080
21081 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
21083 where
21084 T: std::convert::Into<wkt::FieldMask>,
21085 {
21086 self.0.request.update_mask = v.map(|x| x.into());
21087 self
21088 }
21089 }
21090
21091 #[doc(hidden)]
21092 impl crate::RequestBuilder for UpdateSipTrunk {
21093 fn request_options(&mut self) -> &mut crate::RequestOptions {
21094 &mut self.0.options
21095 }
21096 }
21097
21098 #[derive(Clone, Debug)]
21119 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
21120
21121 impl ListLocations {
21122 pub(crate) fn new(
21123 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21124 ) -> Self {
21125 Self(RequestBuilder::new(stub))
21126 }
21127
21128 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
21130 mut self,
21131 v: V,
21132 ) -> Self {
21133 self.0.request = v.into();
21134 self
21135 }
21136
21137 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21139 self.0.options = v.into();
21140 self
21141 }
21142
21143 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
21145 (*self.0.stub)
21146 .list_locations(self.0.request, self.0.options)
21147 .await
21148 .map(crate::Response::into_body)
21149 }
21150
21151 pub fn by_page(
21153 self,
21154 ) -> impl google_cloud_gax::paginator::Paginator<
21155 google_cloud_location::model::ListLocationsResponse,
21156 crate::Error,
21157 > {
21158 use std::clone::Clone;
21159 let token = self.0.request.page_token.clone();
21160 let execute = move |token: String| {
21161 let mut builder = self.clone();
21162 builder.0.request = builder.0.request.set_page_token(token);
21163 builder.send()
21164 };
21165 google_cloud_gax::paginator::internal::new_paginator(token, execute)
21166 }
21167
21168 pub fn by_item(
21170 self,
21171 ) -> impl google_cloud_gax::paginator::ItemPaginator<
21172 google_cloud_location::model::ListLocationsResponse,
21173 crate::Error,
21174 > {
21175 use google_cloud_gax::paginator::Paginator;
21176 self.by_page().items()
21177 }
21178
21179 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21181 self.0.request.name = v.into();
21182 self
21183 }
21184
21185 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
21187 self.0.request.filter = v.into();
21188 self
21189 }
21190
21191 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
21193 self.0.request.page_size = v.into();
21194 self
21195 }
21196
21197 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
21199 self.0.request.page_token = v.into();
21200 self
21201 }
21202 }
21203
21204 #[doc(hidden)]
21205 impl crate::RequestBuilder for ListLocations {
21206 fn request_options(&mut self) -> &mut crate::RequestOptions {
21207 &mut self.0.options
21208 }
21209 }
21210
21211 #[derive(Clone, Debug)]
21228 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
21229
21230 impl GetLocation {
21231 pub(crate) fn new(
21232 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21233 ) -> Self {
21234 Self(RequestBuilder::new(stub))
21235 }
21236
21237 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
21239 mut self,
21240 v: V,
21241 ) -> Self {
21242 self.0.request = v.into();
21243 self
21244 }
21245
21246 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21248 self.0.options = v.into();
21249 self
21250 }
21251
21252 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
21254 (*self.0.stub)
21255 .get_location(self.0.request, self.0.options)
21256 .await
21257 .map(crate::Response::into_body)
21258 }
21259
21260 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21262 self.0.request.name = v.into();
21263 self
21264 }
21265 }
21266
21267 #[doc(hidden)]
21268 impl crate::RequestBuilder for GetLocation {
21269 fn request_options(&mut self) -> &mut crate::RequestOptions {
21270 &mut self.0.options
21271 }
21272 }
21273
21274 #[derive(Clone, Debug)]
21295 pub struct ListOperations(
21296 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
21297 );
21298
21299 impl ListOperations {
21300 pub(crate) fn new(
21301 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21302 ) -> Self {
21303 Self(RequestBuilder::new(stub))
21304 }
21305
21306 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
21308 mut self,
21309 v: V,
21310 ) -> Self {
21311 self.0.request = v.into();
21312 self
21313 }
21314
21315 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21317 self.0.options = v.into();
21318 self
21319 }
21320
21321 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
21323 (*self.0.stub)
21324 .list_operations(self.0.request, self.0.options)
21325 .await
21326 .map(crate::Response::into_body)
21327 }
21328
21329 pub fn by_page(
21331 self,
21332 ) -> impl google_cloud_gax::paginator::Paginator<
21333 google_cloud_longrunning::model::ListOperationsResponse,
21334 crate::Error,
21335 > {
21336 use std::clone::Clone;
21337 let token = self.0.request.page_token.clone();
21338 let execute = move |token: String| {
21339 let mut builder = self.clone();
21340 builder.0.request = builder.0.request.set_page_token(token);
21341 builder.send()
21342 };
21343 google_cloud_gax::paginator::internal::new_paginator(token, execute)
21344 }
21345
21346 pub fn by_item(
21348 self,
21349 ) -> impl google_cloud_gax::paginator::ItemPaginator<
21350 google_cloud_longrunning::model::ListOperationsResponse,
21351 crate::Error,
21352 > {
21353 use google_cloud_gax::paginator::Paginator;
21354 self.by_page().items()
21355 }
21356
21357 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21359 self.0.request.name = v.into();
21360 self
21361 }
21362
21363 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
21365 self.0.request.filter = v.into();
21366 self
21367 }
21368
21369 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
21371 self.0.request.page_size = v.into();
21372 self
21373 }
21374
21375 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
21377 self.0.request.page_token = v.into();
21378 self
21379 }
21380
21381 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
21383 self.0.request.return_partial_success = v.into();
21384 self
21385 }
21386 }
21387
21388 #[doc(hidden)]
21389 impl crate::RequestBuilder for ListOperations {
21390 fn request_options(&mut self) -> &mut crate::RequestOptions {
21391 &mut self.0.options
21392 }
21393 }
21394
21395 #[derive(Clone, Debug)]
21412 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
21413
21414 impl GetOperation {
21415 pub(crate) fn new(
21416 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21417 ) -> Self {
21418 Self(RequestBuilder::new(stub))
21419 }
21420
21421 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
21423 mut self,
21424 v: V,
21425 ) -> Self {
21426 self.0.request = v.into();
21427 self
21428 }
21429
21430 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21432 self.0.options = v.into();
21433 self
21434 }
21435
21436 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
21438 (*self.0.stub)
21439 .get_operation(self.0.request, self.0.options)
21440 .await
21441 .map(crate::Response::into_body)
21442 }
21443
21444 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21446 self.0.request.name = v.into();
21447 self
21448 }
21449 }
21450
21451 #[doc(hidden)]
21452 impl crate::RequestBuilder for GetOperation {
21453 fn request_options(&mut self) -> &mut crate::RequestOptions {
21454 &mut self.0.options
21455 }
21456 }
21457
21458 #[derive(Clone, Debug)]
21475 pub struct CancelOperation(
21476 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
21477 );
21478
21479 impl CancelOperation {
21480 pub(crate) fn new(
21481 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21482 ) -> Self {
21483 Self(RequestBuilder::new(stub))
21484 }
21485
21486 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
21488 mut self,
21489 v: V,
21490 ) -> Self {
21491 self.0.request = v.into();
21492 self
21493 }
21494
21495 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21497 self.0.options = v.into();
21498 self
21499 }
21500
21501 pub async fn send(self) -> Result<()> {
21503 (*self.0.stub)
21504 .cancel_operation(self.0.request, self.0.options)
21505 .await
21506 .map(crate::Response::into_body)
21507 }
21508
21509 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21511 self.0.request.name = v.into();
21512 self
21513 }
21514 }
21515
21516 #[doc(hidden)]
21517 impl crate::RequestBuilder for CancelOperation {
21518 fn request_options(&mut self) -> &mut crate::RequestOptions {
21519 &mut self.0.options
21520 }
21521 }
21522}
21523
21524#[cfg(feature = "tools")]
21525#[cfg_attr(docsrs, doc(cfg(feature = "tools")))]
21526pub mod tools {
21527 use crate::Result;
21528
21529 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
21543
21544 pub(crate) mod client {
21545 use super::super::super::client::Tools;
21546 pub struct Factory;
21547 impl crate::ClientFactory for Factory {
21548 type Client = Tools;
21549 type Credentials = gaxi::options::Credentials;
21550 async fn build(
21551 self,
21552 config: gaxi::options::ClientConfig,
21553 ) -> crate::ClientBuilderResult<Self::Client> {
21554 Self::Client::new(config).await
21555 }
21556 }
21557 }
21558
21559 #[derive(Clone, Debug)]
21561 pub(crate) struct RequestBuilder<R: std::default::Default> {
21562 stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>,
21563 request: R,
21564 options: crate::RequestOptions,
21565 }
21566
21567 impl<R> RequestBuilder<R>
21568 where
21569 R: std::default::Default,
21570 {
21571 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21572 Self {
21573 stub,
21574 request: R::default(),
21575 options: crate::RequestOptions::default(),
21576 }
21577 }
21578 }
21579
21580 #[derive(Clone, Debug)]
21597 pub struct CreateTool(RequestBuilder<crate::model::CreateToolRequest>);
21598
21599 impl CreateTool {
21600 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21601 Self(RequestBuilder::new(stub))
21602 }
21603
21604 pub fn with_request<V: Into<crate::model::CreateToolRequest>>(mut self, v: V) -> Self {
21606 self.0.request = v.into();
21607 self
21608 }
21609
21610 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21612 self.0.options = v.into();
21613 self
21614 }
21615
21616 pub async fn send(self) -> Result<crate::model::Tool> {
21618 (*self.0.stub)
21619 .create_tool(self.0.request, self.0.options)
21620 .await
21621 .map(crate::Response::into_body)
21622 }
21623
21624 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
21628 self.0.request.parent = v.into();
21629 self
21630 }
21631
21632 pub fn set_tool<T>(mut self, v: T) -> Self
21636 where
21637 T: std::convert::Into<crate::model::Tool>,
21638 {
21639 self.0.request.tool = std::option::Option::Some(v.into());
21640 self
21641 }
21642
21643 pub fn set_or_clear_tool<T>(mut self, v: std::option::Option<T>) -> Self
21647 where
21648 T: std::convert::Into<crate::model::Tool>,
21649 {
21650 self.0.request.tool = v.map(|x| x.into());
21651 self
21652 }
21653
21654 pub fn set_tool_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
21656 self.0.request.tool_id = v.into();
21657 self
21658 }
21659 }
21660
21661 #[doc(hidden)]
21662 impl crate::RequestBuilder for CreateTool {
21663 fn request_options(&mut self) -> &mut crate::RequestOptions {
21664 &mut self.0.options
21665 }
21666 }
21667
21668 #[derive(Clone, Debug)]
21685 pub struct GetTool(RequestBuilder<crate::model::GetToolRequest>);
21686
21687 impl GetTool {
21688 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21689 Self(RequestBuilder::new(stub))
21690 }
21691
21692 pub fn with_request<V: Into<crate::model::GetToolRequest>>(mut self, v: V) -> Self {
21694 self.0.request = v.into();
21695 self
21696 }
21697
21698 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21700 self.0.options = v.into();
21701 self
21702 }
21703
21704 pub async fn send(self) -> Result<crate::model::Tool> {
21706 (*self.0.stub)
21707 .get_tool(self.0.request, self.0.options)
21708 .await
21709 .map(crate::Response::into_body)
21710 }
21711
21712 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21716 self.0.request.name = v.into();
21717 self
21718 }
21719 }
21720
21721 #[doc(hidden)]
21722 impl crate::RequestBuilder for GetTool {
21723 fn request_options(&mut self) -> &mut crate::RequestOptions {
21724 &mut self.0.options
21725 }
21726 }
21727
21728 #[derive(Clone, Debug)]
21749 pub struct ListTools(RequestBuilder<crate::model::ListToolsRequest>);
21750
21751 impl ListTools {
21752 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21753 Self(RequestBuilder::new(stub))
21754 }
21755
21756 pub fn with_request<V: Into<crate::model::ListToolsRequest>>(mut self, v: V) -> Self {
21758 self.0.request = v.into();
21759 self
21760 }
21761
21762 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21764 self.0.options = v.into();
21765 self
21766 }
21767
21768 pub async fn send(self) -> Result<crate::model::ListToolsResponse> {
21770 (*self.0.stub)
21771 .list_tools(self.0.request, self.0.options)
21772 .await
21773 .map(crate::Response::into_body)
21774 }
21775
21776 pub fn by_page(
21778 self,
21779 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListToolsResponse, crate::Error>
21780 {
21781 use std::clone::Clone;
21782 let token = self.0.request.page_token.clone();
21783 let execute = move |token: String| {
21784 let mut builder = self.clone();
21785 builder.0.request = builder.0.request.set_page_token(token);
21786 builder.send()
21787 };
21788 google_cloud_gax::paginator::internal::new_paginator(token, execute)
21789 }
21790
21791 pub fn by_item(
21793 self,
21794 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListToolsResponse, crate::Error>
21795 {
21796 use google_cloud_gax::paginator::Paginator;
21797 self.by_page().items()
21798 }
21799
21800 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
21804 self.0.request.parent = v.into();
21805 self
21806 }
21807
21808 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
21810 self.0.request.page_size = v.into();
21811 self
21812 }
21813
21814 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
21816 self.0.request.page_token = v.into();
21817 self
21818 }
21819 }
21820
21821 #[doc(hidden)]
21822 impl crate::RequestBuilder for ListTools {
21823 fn request_options(&mut self) -> &mut crate::RequestOptions {
21824 &mut self.0.options
21825 }
21826 }
21827
21828 #[derive(Clone, Debug)]
21845 pub struct DeleteTool(RequestBuilder<crate::model::DeleteToolRequest>);
21846
21847 impl DeleteTool {
21848 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21849 Self(RequestBuilder::new(stub))
21850 }
21851
21852 pub fn with_request<V: Into<crate::model::DeleteToolRequest>>(mut self, v: V) -> Self {
21854 self.0.request = v.into();
21855 self
21856 }
21857
21858 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21860 self.0.options = v.into();
21861 self
21862 }
21863
21864 pub async fn send(self) -> Result<()> {
21866 (*self.0.stub)
21867 .delete_tool(self.0.request, self.0.options)
21868 .await
21869 .map(crate::Response::into_body)
21870 }
21871
21872 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21876 self.0.request.name = v.into();
21877 self
21878 }
21879 }
21880
21881 #[doc(hidden)]
21882 impl crate::RequestBuilder for DeleteTool {
21883 fn request_options(&mut self) -> &mut crate::RequestOptions {
21884 &mut self.0.options
21885 }
21886 }
21887
21888 #[derive(Clone, Debug)]
21905 pub struct UpdateTool(RequestBuilder<crate::model::UpdateToolRequest>);
21906
21907 impl UpdateTool {
21908 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21909 Self(RequestBuilder::new(stub))
21910 }
21911
21912 pub fn with_request<V: Into<crate::model::UpdateToolRequest>>(mut self, v: V) -> Self {
21914 self.0.request = v.into();
21915 self
21916 }
21917
21918 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21920 self.0.options = v.into();
21921 self
21922 }
21923
21924 pub async fn send(self) -> Result<crate::model::Tool> {
21926 (*self.0.stub)
21927 .update_tool(self.0.request, self.0.options)
21928 .await
21929 .map(crate::Response::into_body)
21930 }
21931
21932 pub fn set_tool<T>(mut self, v: T) -> Self
21936 where
21937 T: std::convert::Into<crate::model::Tool>,
21938 {
21939 self.0.request.tool = std::option::Option::Some(v.into());
21940 self
21941 }
21942
21943 pub fn set_or_clear_tool<T>(mut self, v: std::option::Option<T>) -> Self
21947 where
21948 T: std::convert::Into<crate::model::Tool>,
21949 {
21950 self.0.request.tool = v.map(|x| x.into());
21951 self
21952 }
21953
21954 pub fn set_update_mask<T>(mut self, v: T) -> Self
21956 where
21957 T: std::convert::Into<wkt::FieldMask>,
21958 {
21959 self.0.request.update_mask = std::option::Option::Some(v.into());
21960 self
21961 }
21962
21963 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
21965 where
21966 T: std::convert::Into<wkt::FieldMask>,
21967 {
21968 self.0.request.update_mask = v.map(|x| x.into());
21969 self
21970 }
21971 }
21972
21973 #[doc(hidden)]
21974 impl crate::RequestBuilder for UpdateTool {
21975 fn request_options(&mut self) -> &mut crate::RequestOptions {
21976 &mut self.0.options
21977 }
21978 }
21979
21980 #[derive(Clone, Debug)]
22001 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
22002
22003 impl ListLocations {
22004 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
22005 Self(RequestBuilder::new(stub))
22006 }
22007
22008 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
22010 mut self,
22011 v: V,
22012 ) -> Self {
22013 self.0.request = v.into();
22014 self
22015 }
22016
22017 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22019 self.0.options = v.into();
22020 self
22021 }
22022
22023 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
22025 (*self.0.stub)
22026 .list_locations(self.0.request, self.0.options)
22027 .await
22028 .map(crate::Response::into_body)
22029 }
22030
22031 pub fn by_page(
22033 self,
22034 ) -> impl google_cloud_gax::paginator::Paginator<
22035 google_cloud_location::model::ListLocationsResponse,
22036 crate::Error,
22037 > {
22038 use std::clone::Clone;
22039 let token = self.0.request.page_token.clone();
22040 let execute = move |token: String| {
22041 let mut builder = self.clone();
22042 builder.0.request = builder.0.request.set_page_token(token);
22043 builder.send()
22044 };
22045 google_cloud_gax::paginator::internal::new_paginator(token, execute)
22046 }
22047
22048 pub fn by_item(
22050 self,
22051 ) -> impl google_cloud_gax::paginator::ItemPaginator<
22052 google_cloud_location::model::ListLocationsResponse,
22053 crate::Error,
22054 > {
22055 use google_cloud_gax::paginator::Paginator;
22056 self.by_page().items()
22057 }
22058
22059 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22061 self.0.request.name = v.into();
22062 self
22063 }
22064
22065 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
22067 self.0.request.filter = v.into();
22068 self
22069 }
22070
22071 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
22073 self.0.request.page_size = v.into();
22074 self
22075 }
22076
22077 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
22079 self.0.request.page_token = v.into();
22080 self
22081 }
22082 }
22083
22084 #[doc(hidden)]
22085 impl crate::RequestBuilder for ListLocations {
22086 fn request_options(&mut self) -> &mut crate::RequestOptions {
22087 &mut self.0.options
22088 }
22089 }
22090
22091 #[derive(Clone, Debug)]
22108 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
22109
22110 impl GetLocation {
22111 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
22112 Self(RequestBuilder::new(stub))
22113 }
22114
22115 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
22117 mut self,
22118 v: V,
22119 ) -> Self {
22120 self.0.request = v.into();
22121 self
22122 }
22123
22124 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22126 self.0.options = v.into();
22127 self
22128 }
22129
22130 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
22132 (*self.0.stub)
22133 .get_location(self.0.request, self.0.options)
22134 .await
22135 .map(crate::Response::into_body)
22136 }
22137
22138 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22140 self.0.request.name = v.into();
22141 self
22142 }
22143 }
22144
22145 #[doc(hidden)]
22146 impl crate::RequestBuilder for GetLocation {
22147 fn request_options(&mut self) -> &mut crate::RequestOptions {
22148 &mut self.0.options
22149 }
22150 }
22151
22152 #[derive(Clone, Debug)]
22173 pub struct ListOperations(
22174 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
22175 );
22176
22177 impl ListOperations {
22178 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
22179 Self(RequestBuilder::new(stub))
22180 }
22181
22182 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
22184 mut self,
22185 v: V,
22186 ) -> Self {
22187 self.0.request = v.into();
22188 self
22189 }
22190
22191 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22193 self.0.options = v.into();
22194 self
22195 }
22196
22197 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
22199 (*self.0.stub)
22200 .list_operations(self.0.request, self.0.options)
22201 .await
22202 .map(crate::Response::into_body)
22203 }
22204
22205 pub fn by_page(
22207 self,
22208 ) -> impl google_cloud_gax::paginator::Paginator<
22209 google_cloud_longrunning::model::ListOperationsResponse,
22210 crate::Error,
22211 > {
22212 use std::clone::Clone;
22213 let token = self.0.request.page_token.clone();
22214 let execute = move |token: String| {
22215 let mut builder = self.clone();
22216 builder.0.request = builder.0.request.set_page_token(token);
22217 builder.send()
22218 };
22219 google_cloud_gax::paginator::internal::new_paginator(token, execute)
22220 }
22221
22222 pub fn by_item(
22224 self,
22225 ) -> impl google_cloud_gax::paginator::ItemPaginator<
22226 google_cloud_longrunning::model::ListOperationsResponse,
22227 crate::Error,
22228 > {
22229 use google_cloud_gax::paginator::Paginator;
22230 self.by_page().items()
22231 }
22232
22233 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22235 self.0.request.name = v.into();
22236 self
22237 }
22238
22239 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
22241 self.0.request.filter = v.into();
22242 self
22243 }
22244
22245 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
22247 self.0.request.page_size = v.into();
22248 self
22249 }
22250
22251 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
22253 self.0.request.page_token = v.into();
22254 self
22255 }
22256
22257 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
22259 self.0.request.return_partial_success = v.into();
22260 self
22261 }
22262 }
22263
22264 #[doc(hidden)]
22265 impl crate::RequestBuilder for ListOperations {
22266 fn request_options(&mut self) -> &mut crate::RequestOptions {
22267 &mut self.0.options
22268 }
22269 }
22270
22271 #[derive(Clone, Debug)]
22288 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
22289
22290 impl GetOperation {
22291 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
22292 Self(RequestBuilder::new(stub))
22293 }
22294
22295 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
22297 mut self,
22298 v: V,
22299 ) -> Self {
22300 self.0.request = v.into();
22301 self
22302 }
22303
22304 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22306 self.0.options = v.into();
22307 self
22308 }
22309
22310 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
22312 (*self.0.stub)
22313 .get_operation(self.0.request, self.0.options)
22314 .await
22315 .map(crate::Response::into_body)
22316 }
22317
22318 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22320 self.0.request.name = v.into();
22321 self
22322 }
22323 }
22324
22325 #[doc(hidden)]
22326 impl crate::RequestBuilder for GetOperation {
22327 fn request_options(&mut self) -> &mut crate::RequestOptions {
22328 &mut self.0.options
22329 }
22330 }
22331
22332 #[derive(Clone, Debug)]
22349 pub struct CancelOperation(
22350 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
22351 );
22352
22353 impl CancelOperation {
22354 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
22355 Self(RequestBuilder::new(stub))
22356 }
22357
22358 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
22360 mut self,
22361 v: V,
22362 ) -> Self {
22363 self.0.request = v.into();
22364 self
22365 }
22366
22367 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22369 self.0.options = v.into();
22370 self
22371 }
22372
22373 pub async fn send(self) -> Result<()> {
22375 (*self.0.stub)
22376 .cancel_operation(self.0.request, self.0.options)
22377 .await
22378 .map(crate::Response::into_body)
22379 }
22380
22381 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22383 self.0.request.name = v.into();
22384 self
22385 }
22386 }
22387
22388 #[doc(hidden)]
22389 impl crate::RequestBuilder for CancelOperation {
22390 fn request_options(&mut self) -> &mut crate::RequestOptions {
22391 &mut self.0.options
22392 }
22393 }
22394}
22395
22396#[cfg(feature = "versions")]
22397#[cfg_attr(docsrs, doc(cfg(feature = "versions")))]
22398pub mod versions {
22399 use crate::Result;
22400
22401 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
22415
22416 pub(crate) mod client {
22417 use super::super::super::client::Versions;
22418 pub struct Factory;
22419 impl crate::ClientFactory for Factory {
22420 type Client = Versions;
22421 type Credentials = gaxi::options::Credentials;
22422 async fn build(
22423 self,
22424 config: gaxi::options::ClientConfig,
22425 ) -> crate::ClientBuilderResult<Self::Client> {
22426 Self::Client::new(config).await
22427 }
22428 }
22429 }
22430
22431 #[derive(Clone, Debug)]
22433 pub(crate) struct RequestBuilder<R: std::default::Default> {
22434 stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>,
22435 request: R,
22436 options: crate::RequestOptions,
22437 }
22438
22439 impl<R> RequestBuilder<R>
22440 where
22441 R: std::default::Default,
22442 {
22443 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22444 Self {
22445 stub,
22446 request: R::default(),
22447 options: crate::RequestOptions::default(),
22448 }
22449 }
22450 }
22451
22452 #[derive(Clone, Debug)]
22473 pub struct ListVersions(RequestBuilder<crate::model::ListVersionsRequest>);
22474
22475 impl ListVersions {
22476 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22477 Self(RequestBuilder::new(stub))
22478 }
22479
22480 pub fn with_request<V: Into<crate::model::ListVersionsRequest>>(mut self, v: V) -> Self {
22482 self.0.request = v.into();
22483 self
22484 }
22485
22486 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22488 self.0.options = v.into();
22489 self
22490 }
22491
22492 pub async fn send(self) -> Result<crate::model::ListVersionsResponse> {
22494 (*self.0.stub)
22495 .list_versions(self.0.request, self.0.options)
22496 .await
22497 .map(crate::Response::into_body)
22498 }
22499
22500 pub fn by_page(
22502 self,
22503 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListVersionsResponse, crate::Error>
22504 {
22505 use std::clone::Clone;
22506 let token = self.0.request.page_token.clone();
22507 let execute = move |token: String| {
22508 let mut builder = self.clone();
22509 builder.0.request = builder.0.request.set_page_token(token);
22510 builder.send()
22511 };
22512 google_cloud_gax::paginator::internal::new_paginator(token, execute)
22513 }
22514
22515 pub fn by_item(
22517 self,
22518 ) -> impl google_cloud_gax::paginator::ItemPaginator<
22519 crate::model::ListVersionsResponse,
22520 crate::Error,
22521 > {
22522 use google_cloud_gax::paginator::Paginator;
22523 self.by_page().items()
22524 }
22525
22526 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
22530 self.0.request.parent = v.into();
22531 self
22532 }
22533
22534 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
22536 self.0.request.page_size = v.into();
22537 self
22538 }
22539
22540 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
22542 self.0.request.page_token = v.into();
22543 self
22544 }
22545 }
22546
22547 #[doc(hidden)]
22548 impl crate::RequestBuilder for ListVersions {
22549 fn request_options(&mut self) -> &mut crate::RequestOptions {
22550 &mut self.0.options
22551 }
22552 }
22553
22554 #[derive(Clone, Debug)]
22571 pub struct GetVersion(RequestBuilder<crate::model::GetVersionRequest>);
22572
22573 impl GetVersion {
22574 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22575 Self(RequestBuilder::new(stub))
22576 }
22577
22578 pub fn with_request<V: Into<crate::model::GetVersionRequest>>(mut self, v: V) -> Self {
22580 self.0.request = v.into();
22581 self
22582 }
22583
22584 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22586 self.0.options = v.into();
22587 self
22588 }
22589
22590 pub async fn send(self) -> Result<crate::model::Version> {
22592 (*self.0.stub)
22593 .get_version(self.0.request, self.0.options)
22594 .await
22595 .map(crate::Response::into_body)
22596 }
22597
22598 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22602 self.0.request.name = v.into();
22603 self
22604 }
22605 }
22606
22607 #[doc(hidden)]
22608 impl crate::RequestBuilder for GetVersion {
22609 fn request_options(&mut self) -> &mut crate::RequestOptions {
22610 &mut self.0.options
22611 }
22612 }
22613
22614 #[derive(Clone, Debug)]
22631 pub struct CreateVersion(RequestBuilder<crate::model::CreateVersionRequest>);
22632
22633 impl CreateVersion {
22634 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22635 Self(RequestBuilder::new(stub))
22636 }
22637
22638 pub fn with_request<V: Into<crate::model::CreateVersionRequest>>(mut self, v: V) -> Self {
22640 self.0.request = v.into();
22641 self
22642 }
22643
22644 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22646 self.0.options = v.into();
22647 self
22648 }
22649
22650 pub async fn send(self) -> Result<crate::model::Version> {
22652 (*self.0.stub)
22653 .create_version(self.0.request, self.0.options)
22654 .await
22655 .map(crate::Response::into_body)
22656 }
22657
22658 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
22662 self.0.request.parent = v.into();
22663 self
22664 }
22665
22666 pub fn set_version<T>(mut self, v: T) -> Self
22670 where
22671 T: std::convert::Into<crate::model::Version>,
22672 {
22673 self.0.request.version = std::option::Option::Some(v.into());
22674 self
22675 }
22676
22677 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
22681 where
22682 T: std::convert::Into<crate::model::Version>,
22683 {
22684 self.0.request.version = v.map(|x| x.into());
22685 self
22686 }
22687 }
22688
22689 #[doc(hidden)]
22690 impl crate::RequestBuilder for CreateVersion {
22691 fn request_options(&mut self) -> &mut crate::RequestOptions {
22692 &mut self.0.options
22693 }
22694 }
22695
22696 #[derive(Clone, Debug)]
22713 pub struct UpdateVersion(RequestBuilder<crate::model::UpdateVersionRequest>);
22714
22715 impl UpdateVersion {
22716 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22717 Self(RequestBuilder::new(stub))
22718 }
22719
22720 pub fn with_request<V: Into<crate::model::UpdateVersionRequest>>(mut self, v: V) -> Self {
22722 self.0.request = v.into();
22723 self
22724 }
22725
22726 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22728 self.0.options = v.into();
22729 self
22730 }
22731
22732 pub async fn send(self) -> Result<crate::model::Version> {
22734 (*self.0.stub)
22735 .update_version(self.0.request, self.0.options)
22736 .await
22737 .map(crate::Response::into_body)
22738 }
22739
22740 pub fn set_version<T>(mut self, v: T) -> Self
22744 where
22745 T: std::convert::Into<crate::model::Version>,
22746 {
22747 self.0.request.version = std::option::Option::Some(v.into());
22748 self
22749 }
22750
22751 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
22755 where
22756 T: std::convert::Into<crate::model::Version>,
22757 {
22758 self.0.request.version = v.map(|x| x.into());
22759 self
22760 }
22761
22762 pub fn set_update_mask<T>(mut self, v: T) -> Self
22766 where
22767 T: std::convert::Into<wkt::FieldMask>,
22768 {
22769 self.0.request.update_mask = std::option::Option::Some(v.into());
22770 self
22771 }
22772
22773 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
22777 where
22778 T: std::convert::Into<wkt::FieldMask>,
22779 {
22780 self.0.request.update_mask = v.map(|x| x.into());
22781 self
22782 }
22783 }
22784
22785 #[doc(hidden)]
22786 impl crate::RequestBuilder for UpdateVersion {
22787 fn request_options(&mut self) -> &mut crate::RequestOptions {
22788 &mut self.0.options
22789 }
22790 }
22791
22792 #[derive(Clone, Debug)]
22809 pub struct DeleteVersion(RequestBuilder<crate::model::DeleteVersionRequest>);
22810
22811 impl DeleteVersion {
22812 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22813 Self(RequestBuilder::new(stub))
22814 }
22815
22816 pub fn with_request<V: Into<crate::model::DeleteVersionRequest>>(mut self, v: V) -> Self {
22818 self.0.request = v.into();
22819 self
22820 }
22821
22822 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22824 self.0.options = v.into();
22825 self
22826 }
22827
22828 pub async fn send(self) -> Result<()> {
22830 (*self.0.stub)
22831 .delete_version(self.0.request, self.0.options)
22832 .await
22833 .map(crate::Response::into_body)
22834 }
22835
22836 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22840 self.0.request.name = v.into();
22841 self
22842 }
22843 }
22844
22845 #[doc(hidden)]
22846 impl crate::RequestBuilder for DeleteVersion {
22847 fn request_options(&mut self) -> &mut crate::RequestOptions {
22848 &mut self.0.options
22849 }
22850 }
22851
22852 #[derive(Clone, Debug)]
22873 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
22874
22875 impl ListLocations {
22876 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22877 Self(RequestBuilder::new(stub))
22878 }
22879
22880 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
22882 mut self,
22883 v: V,
22884 ) -> Self {
22885 self.0.request = v.into();
22886 self
22887 }
22888
22889 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22891 self.0.options = v.into();
22892 self
22893 }
22894
22895 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
22897 (*self.0.stub)
22898 .list_locations(self.0.request, self.0.options)
22899 .await
22900 .map(crate::Response::into_body)
22901 }
22902
22903 pub fn by_page(
22905 self,
22906 ) -> impl google_cloud_gax::paginator::Paginator<
22907 google_cloud_location::model::ListLocationsResponse,
22908 crate::Error,
22909 > {
22910 use std::clone::Clone;
22911 let token = self.0.request.page_token.clone();
22912 let execute = move |token: String| {
22913 let mut builder = self.clone();
22914 builder.0.request = builder.0.request.set_page_token(token);
22915 builder.send()
22916 };
22917 google_cloud_gax::paginator::internal::new_paginator(token, execute)
22918 }
22919
22920 pub fn by_item(
22922 self,
22923 ) -> impl google_cloud_gax::paginator::ItemPaginator<
22924 google_cloud_location::model::ListLocationsResponse,
22925 crate::Error,
22926 > {
22927 use google_cloud_gax::paginator::Paginator;
22928 self.by_page().items()
22929 }
22930
22931 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22933 self.0.request.name = v.into();
22934 self
22935 }
22936
22937 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
22939 self.0.request.filter = v.into();
22940 self
22941 }
22942
22943 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
22945 self.0.request.page_size = v.into();
22946 self
22947 }
22948
22949 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
22951 self.0.request.page_token = v.into();
22952 self
22953 }
22954 }
22955
22956 #[doc(hidden)]
22957 impl crate::RequestBuilder for ListLocations {
22958 fn request_options(&mut self) -> &mut crate::RequestOptions {
22959 &mut self.0.options
22960 }
22961 }
22962
22963 #[derive(Clone, Debug)]
22980 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
22981
22982 impl GetLocation {
22983 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22984 Self(RequestBuilder::new(stub))
22985 }
22986
22987 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
22989 mut self,
22990 v: V,
22991 ) -> Self {
22992 self.0.request = v.into();
22993 self
22994 }
22995
22996 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22998 self.0.options = v.into();
22999 self
23000 }
23001
23002 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
23004 (*self.0.stub)
23005 .get_location(self.0.request, self.0.options)
23006 .await
23007 .map(crate::Response::into_body)
23008 }
23009
23010 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
23012 self.0.request.name = v.into();
23013 self
23014 }
23015 }
23016
23017 #[doc(hidden)]
23018 impl crate::RequestBuilder for GetLocation {
23019 fn request_options(&mut self) -> &mut crate::RequestOptions {
23020 &mut self.0.options
23021 }
23022 }
23023
23024 #[derive(Clone, Debug)]
23045 pub struct ListOperations(
23046 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
23047 );
23048
23049 impl ListOperations {
23050 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
23051 Self(RequestBuilder::new(stub))
23052 }
23053
23054 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
23056 mut self,
23057 v: V,
23058 ) -> Self {
23059 self.0.request = v.into();
23060 self
23061 }
23062
23063 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
23065 self.0.options = v.into();
23066 self
23067 }
23068
23069 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
23071 (*self.0.stub)
23072 .list_operations(self.0.request, self.0.options)
23073 .await
23074 .map(crate::Response::into_body)
23075 }
23076
23077 pub fn by_page(
23079 self,
23080 ) -> impl google_cloud_gax::paginator::Paginator<
23081 google_cloud_longrunning::model::ListOperationsResponse,
23082 crate::Error,
23083 > {
23084 use std::clone::Clone;
23085 let token = self.0.request.page_token.clone();
23086 let execute = move |token: String| {
23087 let mut builder = self.clone();
23088 builder.0.request = builder.0.request.set_page_token(token);
23089 builder.send()
23090 };
23091 google_cloud_gax::paginator::internal::new_paginator(token, execute)
23092 }
23093
23094 pub fn by_item(
23096 self,
23097 ) -> impl google_cloud_gax::paginator::ItemPaginator<
23098 google_cloud_longrunning::model::ListOperationsResponse,
23099 crate::Error,
23100 > {
23101 use google_cloud_gax::paginator::Paginator;
23102 self.by_page().items()
23103 }
23104
23105 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
23107 self.0.request.name = v.into();
23108 self
23109 }
23110
23111 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
23113 self.0.request.filter = v.into();
23114 self
23115 }
23116
23117 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
23119 self.0.request.page_size = v.into();
23120 self
23121 }
23122
23123 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
23125 self.0.request.page_token = v.into();
23126 self
23127 }
23128
23129 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
23131 self.0.request.return_partial_success = v.into();
23132 self
23133 }
23134 }
23135
23136 #[doc(hidden)]
23137 impl crate::RequestBuilder for ListOperations {
23138 fn request_options(&mut self) -> &mut crate::RequestOptions {
23139 &mut self.0.options
23140 }
23141 }
23142
23143 #[derive(Clone, Debug)]
23160 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
23161
23162 impl GetOperation {
23163 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
23164 Self(RequestBuilder::new(stub))
23165 }
23166
23167 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
23169 mut self,
23170 v: V,
23171 ) -> Self {
23172 self.0.request = v.into();
23173 self
23174 }
23175
23176 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
23178 self.0.options = v.into();
23179 self
23180 }
23181
23182 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
23184 (*self.0.stub)
23185 .get_operation(self.0.request, self.0.options)
23186 .await
23187 .map(crate::Response::into_body)
23188 }
23189
23190 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
23192 self.0.request.name = v.into();
23193 self
23194 }
23195 }
23196
23197 #[doc(hidden)]
23198 impl crate::RequestBuilder for GetOperation {
23199 fn request_options(&mut self) -> &mut crate::RequestOptions {
23200 &mut self.0.options
23201 }
23202 }
23203
23204 #[derive(Clone, Debug)]
23221 pub struct CancelOperation(
23222 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
23223 );
23224
23225 impl CancelOperation {
23226 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
23227 Self(RequestBuilder::new(stub))
23228 }
23229
23230 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
23232 mut self,
23233 v: V,
23234 ) -> Self {
23235 self.0.request = v.into();
23236 self
23237 }
23238
23239 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
23241 self.0.options = v.into();
23242 self
23243 }
23244
23245 pub async fn send(self) -> Result<()> {
23247 (*self.0.stub)
23248 .cancel_operation(self.0.request, self.0.options)
23249 .await
23250 .map(crate::Response::into_body)
23251 }
23252
23253 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
23255 self.0.request.name = v.into();
23256 self
23257 }
23258 }
23259
23260 #[doc(hidden)]
23261 impl crate::RequestBuilder for CancelOperation {
23262 fn request_options(&mut self) -> &mut crate::RequestOptions {
23263 &mut self.0.options
23264 }
23265 }
23266}