1#[cfg(feature = "agents")]
18#[cfg_attr(docsrs, doc(cfg(feature = "agents")))]
19pub mod agents {
20 use crate::Result;
21
22 pub type ClientBuilder =
36 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
37
38 pub(crate) mod client {
39 use super::super::super::client::Agents;
40 pub struct Factory;
41 impl gax::client_builder::internal::ClientFactory for Factory {
42 type Client = Agents;
43 type Credentials = gaxi::options::Credentials;
44 async fn build(
45 self,
46 config: gaxi::options::ClientConfig,
47 ) -> gax::client_builder::Result<Self::Client> {
48 Self::Client::new(config).await
49 }
50 }
51 }
52
53 #[derive(Clone, Debug)]
55 pub(crate) struct RequestBuilder<R: std::default::Default> {
56 stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>,
57 request: R,
58 options: gax::options::RequestOptions,
59 }
60
61 impl<R> RequestBuilder<R>
62 where
63 R: std::default::Default,
64 {
65 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 #[derive(Clone, Debug)]
92 pub struct GetAgent(RequestBuilder<crate::model::GetAgentRequest>);
93
94 impl GetAgent {
95 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
96 Self(RequestBuilder::new(stub))
97 }
98
99 pub fn with_request<V: Into<crate::model::GetAgentRequest>>(mut self, v: V) -> Self {
101 self.0.request = v.into();
102 self
103 }
104
105 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
107 self.0.options = v.into();
108 self
109 }
110
111 pub async fn send(self) -> Result<crate::model::Agent> {
113 (*self.0.stub)
114 .get_agent(self.0.request, self.0.options)
115 .await
116 .map(gax::response::Response::into_body)
117 }
118
119 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
123 self.0.request.parent = v.into();
124 self
125 }
126 }
127
128 #[doc(hidden)]
129 impl gax::options::internal::RequestBuilder for GetAgent {
130 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
131 &mut self.0.options
132 }
133 }
134
135 #[derive(Clone, Debug)]
153 pub struct SetAgent(RequestBuilder<crate::model::SetAgentRequest>);
154
155 impl SetAgent {
156 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
157 Self(RequestBuilder::new(stub))
158 }
159
160 pub fn with_request<V: Into<crate::model::SetAgentRequest>>(mut self, v: V) -> Self {
162 self.0.request = v.into();
163 self
164 }
165
166 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
168 self.0.options = v.into();
169 self
170 }
171
172 pub async fn send(self) -> Result<crate::model::Agent> {
174 (*self.0.stub)
175 .set_agent(self.0.request, self.0.options)
176 .await
177 .map(gax::response::Response::into_body)
178 }
179
180 pub fn set_agent<T>(mut self, v: T) -> Self
184 where
185 T: std::convert::Into<crate::model::Agent>,
186 {
187 self.0.request.agent = std::option::Option::Some(v.into());
188 self
189 }
190
191 pub fn set_or_clear_agent<T>(mut self, v: std::option::Option<T>) -> Self
195 where
196 T: std::convert::Into<crate::model::Agent>,
197 {
198 self.0.request.agent = v.map(|x| x.into());
199 self
200 }
201
202 pub fn set_update_mask<T>(mut self, v: T) -> Self
204 where
205 T: std::convert::Into<wkt::FieldMask>,
206 {
207 self.0.request.update_mask = std::option::Option::Some(v.into());
208 self
209 }
210
211 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
213 where
214 T: std::convert::Into<wkt::FieldMask>,
215 {
216 self.0.request.update_mask = v.map(|x| x.into());
217 self
218 }
219 }
220
221 #[doc(hidden)]
222 impl gax::options::internal::RequestBuilder for SetAgent {
223 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
224 &mut self.0.options
225 }
226 }
227
228 #[derive(Clone, Debug)]
246 pub struct DeleteAgent(RequestBuilder<crate::model::DeleteAgentRequest>);
247
248 impl DeleteAgent {
249 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
250 Self(RequestBuilder::new(stub))
251 }
252
253 pub fn with_request<V: Into<crate::model::DeleteAgentRequest>>(mut self, v: V) -> Self {
255 self.0.request = v.into();
256 self
257 }
258
259 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
261 self.0.options = v.into();
262 self
263 }
264
265 pub async fn send(self) -> Result<()> {
267 (*self.0.stub)
268 .delete_agent(self.0.request, self.0.options)
269 .await
270 .map(gax::response::Response::into_body)
271 }
272
273 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
277 self.0.request.parent = v.into();
278 self
279 }
280 }
281
282 #[doc(hidden)]
283 impl gax::options::internal::RequestBuilder for DeleteAgent {
284 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
285 &mut self.0.options
286 }
287 }
288
289 #[derive(Clone, Debug)]
311 pub struct SearchAgents(RequestBuilder<crate::model::SearchAgentsRequest>);
312
313 impl SearchAgents {
314 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
315 Self(RequestBuilder::new(stub))
316 }
317
318 pub fn with_request<V: Into<crate::model::SearchAgentsRequest>>(mut self, v: V) -> Self {
320 self.0.request = v.into();
321 self
322 }
323
324 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
326 self.0.options = v.into();
327 self
328 }
329
330 pub async fn send(self) -> Result<crate::model::SearchAgentsResponse> {
332 (*self.0.stub)
333 .search_agents(self.0.request, self.0.options)
334 .await
335 .map(gax::response::Response::into_body)
336 }
337
338 pub fn by_page(
340 self,
341 ) -> impl gax::paginator::Paginator<crate::model::SearchAgentsResponse, gax::error::Error>
342 {
343 use std::clone::Clone;
344 let token = self.0.request.page_token.clone();
345 let execute = move |token: String| {
346 let mut builder = self.clone();
347 builder.0.request = builder.0.request.set_page_token(token);
348 builder.send()
349 };
350 gax::paginator::internal::new_paginator(token, execute)
351 }
352
353 pub fn by_item(
355 self,
356 ) -> impl gax::paginator::ItemPaginator<crate::model::SearchAgentsResponse, gax::error::Error>
357 {
358 use gax::paginator::Paginator;
359 self.by_page().items()
360 }
361
362 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
366 self.0.request.parent = v.into();
367 self
368 }
369
370 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
372 self.0.request.page_size = v.into();
373 self
374 }
375
376 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
378 self.0.request.page_token = v.into();
379 self
380 }
381 }
382
383 #[doc(hidden)]
384 impl gax::options::internal::RequestBuilder for SearchAgents {
385 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
386 &mut self.0.options
387 }
388 }
389
390 #[derive(Clone, Debug)]
409 pub struct TrainAgent(RequestBuilder<crate::model::TrainAgentRequest>);
410
411 impl TrainAgent {
412 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
413 Self(RequestBuilder::new(stub))
414 }
415
416 pub fn with_request<V: Into<crate::model::TrainAgentRequest>>(mut self, v: V) -> Self {
418 self.0.request = v.into();
419 self
420 }
421
422 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
424 self.0.options = v.into();
425 self
426 }
427
428 pub async fn send(self) -> Result<longrunning::model::Operation> {
435 (*self.0.stub)
436 .train_agent(self.0.request, self.0.options)
437 .await
438 .map(gax::response::Response::into_body)
439 }
440
441 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
443 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
444 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
445 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
446
447 let stub = self.0.stub.clone();
448 let mut options = self.0.options.clone();
449 options.set_retry_policy(gax::retry_policy::NeverRetry);
450 let query = move |name| {
451 let stub = stub.clone();
452 let options = options.clone();
453 async {
454 let op = GetOperation::new(stub)
455 .set_name(name)
456 .with_options(options)
457 .send()
458 .await?;
459 Ok(Operation::new(op))
460 }
461 };
462
463 let start = move || async {
464 let op = self.send().await?;
465 Ok(Operation::new(op))
466 };
467
468 lro::internal::new_unit_response_poller(
469 polling_error_policy,
470 polling_backoff_policy,
471 start,
472 query,
473 )
474 }
475
476 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
480 self.0.request.parent = v.into();
481 self
482 }
483 }
484
485 #[doc(hidden)]
486 impl gax::options::internal::RequestBuilder for TrainAgent {
487 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
488 &mut self.0.options
489 }
490 }
491
492 #[derive(Clone, Debug)]
511 pub struct ExportAgent(RequestBuilder<crate::model::ExportAgentRequest>);
512
513 impl ExportAgent {
514 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
515 Self(RequestBuilder::new(stub))
516 }
517
518 pub fn with_request<V: Into<crate::model::ExportAgentRequest>>(mut self, v: V) -> Self {
520 self.0.request = v.into();
521 self
522 }
523
524 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
526 self.0.options = v.into();
527 self
528 }
529
530 pub async fn send(self) -> Result<longrunning::model::Operation> {
537 (*self.0.stub)
538 .export_agent(self.0.request, self.0.options)
539 .await
540 .map(gax::response::Response::into_body)
541 }
542
543 pub fn poller(self) -> impl lro::Poller<crate::model::ExportAgentResponse, wkt::Struct> {
545 type Operation =
546 lro::internal::Operation<crate::model::ExportAgentResponse, wkt::Struct>;
547 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
548 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
549
550 let stub = self.0.stub.clone();
551 let mut options = self.0.options.clone();
552 options.set_retry_policy(gax::retry_policy::NeverRetry);
553 let query = move |name| {
554 let stub = stub.clone();
555 let options = options.clone();
556 async {
557 let op = GetOperation::new(stub)
558 .set_name(name)
559 .with_options(options)
560 .send()
561 .await?;
562 Ok(Operation::new(op))
563 }
564 };
565
566 let start = move || async {
567 let op = self.send().await?;
568 Ok(Operation::new(op))
569 };
570
571 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
572 }
573
574 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
578 self.0.request.parent = v.into();
579 self
580 }
581
582 pub fn set_agent_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
586 self.0.request.agent_uri = v.into();
587 self
588 }
589 }
590
591 #[doc(hidden)]
592 impl gax::options::internal::RequestBuilder for ExportAgent {
593 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
594 &mut self.0.options
595 }
596 }
597
598 #[derive(Clone, Debug)]
617 pub struct ImportAgent(RequestBuilder<crate::model::ImportAgentRequest>);
618
619 impl ImportAgent {
620 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
621 Self(RequestBuilder::new(stub))
622 }
623
624 pub fn with_request<V: Into<crate::model::ImportAgentRequest>>(mut self, v: V) -> Self {
626 self.0.request = v.into();
627 self
628 }
629
630 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
632 self.0.options = v.into();
633 self
634 }
635
636 pub async fn send(self) -> Result<longrunning::model::Operation> {
643 (*self.0.stub)
644 .import_agent(self.0.request, self.0.options)
645 .await
646 .map(gax::response::Response::into_body)
647 }
648
649 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
651 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
652 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
653 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
654
655 let stub = self.0.stub.clone();
656 let mut options = self.0.options.clone();
657 options.set_retry_policy(gax::retry_policy::NeverRetry);
658 let query = move |name| {
659 let stub = stub.clone();
660 let options = options.clone();
661 async {
662 let op = GetOperation::new(stub)
663 .set_name(name)
664 .with_options(options)
665 .send()
666 .await?;
667 Ok(Operation::new(op))
668 }
669 };
670
671 let start = move || async {
672 let op = self.send().await?;
673 Ok(Operation::new(op))
674 };
675
676 lro::internal::new_unit_response_poller(
677 polling_error_policy,
678 polling_backoff_policy,
679 start,
680 query,
681 )
682 }
683
684 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
688 self.0.request.parent = v.into();
689 self
690 }
691
692 pub fn set_agent<T: Into<Option<crate::model::import_agent_request::Agent>>>(
697 mut self,
698 v: T,
699 ) -> Self {
700 self.0.request.agent = v.into();
701 self
702 }
703
704 pub fn set_agent_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
710 self.0.request = self.0.request.set_agent_uri(v);
711 self
712 }
713
714 pub fn set_agent_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
720 self.0.request = self.0.request.set_agent_content(v);
721 self
722 }
723 }
724
725 #[doc(hidden)]
726 impl gax::options::internal::RequestBuilder for ImportAgent {
727 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
728 &mut self.0.options
729 }
730 }
731
732 #[derive(Clone, Debug)]
751 pub struct RestoreAgent(RequestBuilder<crate::model::RestoreAgentRequest>);
752
753 impl RestoreAgent {
754 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
755 Self(RequestBuilder::new(stub))
756 }
757
758 pub fn with_request<V: Into<crate::model::RestoreAgentRequest>>(mut self, v: V) -> Self {
760 self.0.request = v.into();
761 self
762 }
763
764 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
766 self.0.options = v.into();
767 self
768 }
769
770 pub async fn send(self) -> Result<longrunning::model::Operation> {
777 (*self.0.stub)
778 .restore_agent(self.0.request, self.0.options)
779 .await
780 .map(gax::response::Response::into_body)
781 }
782
783 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
785 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
786 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
787 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
788
789 let stub = self.0.stub.clone();
790 let mut options = self.0.options.clone();
791 options.set_retry_policy(gax::retry_policy::NeverRetry);
792 let query = move |name| {
793 let stub = stub.clone();
794 let options = options.clone();
795 async {
796 let op = GetOperation::new(stub)
797 .set_name(name)
798 .with_options(options)
799 .send()
800 .await?;
801 Ok(Operation::new(op))
802 }
803 };
804
805 let start = move || async {
806 let op = self.send().await?;
807 Ok(Operation::new(op))
808 };
809
810 lro::internal::new_unit_response_poller(
811 polling_error_policy,
812 polling_backoff_policy,
813 start,
814 query,
815 )
816 }
817
818 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
822 self.0.request.parent = v.into();
823 self
824 }
825
826 pub fn set_agent<T: Into<Option<crate::model::restore_agent_request::Agent>>>(
831 mut self,
832 v: T,
833 ) -> Self {
834 self.0.request.agent = v.into();
835 self
836 }
837
838 pub fn set_agent_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
844 self.0.request = self.0.request.set_agent_uri(v);
845 self
846 }
847
848 pub fn set_agent_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
854 self.0.request = self.0.request.set_agent_content(v);
855 self
856 }
857 }
858
859 #[doc(hidden)]
860 impl gax::options::internal::RequestBuilder for RestoreAgent {
861 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
862 &mut self.0.options
863 }
864 }
865
866 #[derive(Clone, Debug)]
884 pub struct GetValidationResult(RequestBuilder<crate::model::GetValidationResultRequest>);
885
886 impl GetValidationResult {
887 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
888 Self(RequestBuilder::new(stub))
889 }
890
891 pub fn with_request<V: Into<crate::model::GetValidationResultRequest>>(
893 mut self,
894 v: V,
895 ) -> Self {
896 self.0.request = v.into();
897 self
898 }
899
900 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
902 self.0.options = v.into();
903 self
904 }
905
906 pub async fn send(self) -> Result<crate::model::ValidationResult> {
908 (*self.0.stub)
909 .get_validation_result(self.0.request, self.0.options)
910 .await
911 .map(gax::response::Response::into_body)
912 }
913
914 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
918 self.0.request.parent = v.into();
919 self
920 }
921
922 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
924 self.0.request.language_code = v.into();
925 self
926 }
927 }
928
929 #[doc(hidden)]
930 impl gax::options::internal::RequestBuilder for GetValidationResult {
931 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
932 &mut self.0.options
933 }
934 }
935
936 #[derive(Clone, Debug)]
958 pub struct ListLocations(RequestBuilder<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<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<gax::options::RequestOptions>>(mut self, v: V) -> Self {
976 self.0.options = v.into();
977 self
978 }
979
980 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
982 (*self.0.stub)
983 .list_locations(self.0.request, self.0.options)
984 .await
985 .map(gax::response::Response::into_body)
986 }
987
988 pub fn by_page(
990 self,
991 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
992 {
993 use std::clone::Clone;
994 let token = self.0.request.page_token.clone();
995 let execute = move |token: String| {
996 let mut builder = self.clone();
997 builder.0.request = builder.0.request.set_page_token(token);
998 builder.send()
999 };
1000 gax::paginator::internal::new_paginator(token, execute)
1001 }
1002
1003 pub fn by_item(
1005 self,
1006 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1007 {
1008 use gax::paginator::Paginator;
1009 self.by_page().items()
1010 }
1011
1012 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1014 self.0.request.name = v.into();
1015 self
1016 }
1017
1018 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1020 self.0.request.filter = v.into();
1021 self
1022 }
1023
1024 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1026 self.0.request.page_size = v.into();
1027 self
1028 }
1029
1030 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1032 self.0.request.page_token = v.into();
1033 self
1034 }
1035 }
1036
1037 #[doc(hidden)]
1038 impl gax::options::internal::RequestBuilder for ListLocations {
1039 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1040 &mut self.0.options
1041 }
1042 }
1043
1044 #[derive(Clone, Debug)]
1062 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1063
1064 impl GetLocation {
1065 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1066 Self(RequestBuilder::new(stub))
1067 }
1068
1069 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1071 self.0.request = v.into();
1072 self
1073 }
1074
1075 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1077 self.0.options = v.into();
1078 self
1079 }
1080
1081 pub async fn send(self) -> Result<location::model::Location> {
1083 (*self.0.stub)
1084 .get_location(self.0.request, self.0.options)
1085 .await
1086 .map(gax::response::Response::into_body)
1087 }
1088
1089 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1091 self.0.request.name = v.into();
1092 self
1093 }
1094 }
1095
1096 #[doc(hidden)]
1097 impl gax::options::internal::RequestBuilder for GetLocation {
1098 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1099 &mut self.0.options
1100 }
1101 }
1102
1103 #[derive(Clone, Debug)]
1125 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1126
1127 impl ListOperations {
1128 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1129 Self(RequestBuilder::new(stub))
1130 }
1131
1132 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1134 mut self,
1135 v: V,
1136 ) -> Self {
1137 self.0.request = v.into();
1138 self
1139 }
1140
1141 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1143 self.0.options = v.into();
1144 self
1145 }
1146
1147 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1149 (*self.0.stub)
1150 .list_operations(self.0.request, self.0.options)
1151 .await
1152 .map(gax::response::Response::into_body)
1153 }
1154
1155 pub fn by_page(
1157 self,
1158 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1159 {
1160 use std::clone::Clone;
1161 let token = self.0.request.page_token.clone();
1162 let execute = move |token: String| {
1163 let mut builder = self.clone();
1164 builder.0.request = builder.0.request.set_page_token(token);
1165 builder.send()
1166 };
1167 gax::paginator::internal::new_paginator(token, execute)
1168 }
1169
1170 pub fn by_item(
1172 self,
1173 ) -> impl gax::paginator::ItemPaginator<
1174 longrunning::model::ListOperationsResponse,
1175 gax::error::Error,
1176 > {
1177 use gax::paginator::Paginator;
1178 self.by_page().items()
1179 }
1180
1181 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1183 self.0.request.name = v.into();
1184 self
1185 }
1186
1187 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1189 self.0.request.filter = v.into();
1190 self
1191 }
1192
1193 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1195 self.0.request.page_size = v.into();
1196 self
1197 }
1198
1199 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1201 self.0.request.page_token = v.into();
1202 self
1203 }
1204
1205 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1207 self.0.request.return_partial_success = v.into();
1208 self
1209 }
1210 }
1211
1212 #[doc(hidden)]
1213 impl gax::options::internal::RequestBuilder for ListOperations {
1214 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1215 &mut self.0.options
1216 }
1217 }
1218
1219 #[derive(Clone, Debug)]
1237 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1238
1239 impl GetOperation {
1240 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1241 Self(RequestBuilder::new(stub))
1242 }
1243
1244 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1246 mut self,
1247 v: V,
1248 ) -> Self {
1249 self.0.request = v.into();
1250 self
1251 }
1252
1253 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1255 self.0.options = v.into();
1256 self
1257 }
1258
1259 pub async fn send(self) -> Result<longrunning::model::Operation> {
1261 (*self.0.stub)
1262 .get_operation(self.0.request, self.0.options)
1263 .await
1264 .map(gax::response::Response::into_body)
1265 }
1266
1267 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1269 self.0.request.name = v.into();
1270 self
1271 }
1272 }
1273
1274 #[doc(hidden)]
1275 impl gax::options::internal::RequestBuilder for GetOperation {
1276 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1277 &mut self.0.options
1278 }
1279 }
1280
1281 #[derive(Clone, Debug)]
1299 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1300
1301 impl CancelOperation {
1302 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1303 Self(RequestBuilder::new(stub))
1304 }
1305
1306 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1308 mut self,
1309 v: V,
1310 ) -> Self {
1311 self.0.request = v.into();
1312 self
1313 }
1314
1315 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1317 self.0.options = v.into();
1318 self
1319 }
1320
1321 pub async fn send(self) -> Result<()> {
1323 (*self.0.stub)
1324 .cancel_operation(self.0.request, self.0.options)
1325 .await
1326 .map(gax::response::Response::into_body)
1327 }
1328
1329 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1331 self.0.request.name = v.into();
1332 self
1333 }
1334 }
1335
1336 #[doc(hidden)]
1337 impl gax::options::internal::RequestBuilder for CancelOperation {
1338 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1339 &mut self.0.options
1340 }
1341 }
1342}
1343
1344#[cfg(feature = "answer-records")]
1345#[cfg_attr(docsrs, doc(cfg(feature = "answer-records")))]
1346pub mod answer_records {
1347 use crate::Result;
1348
1349 pub type ClientBuilder =
1363 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1364
1365 pub(crate) mod client {
1366 use super::super::super::client::AnswerRecords;
1367 pub struct Factory;
1368 impl gax::client_builder::internal::ClientFactory for Factory {
1369 type Client = AnswerRecords;
1370 type Credentials = gaxi::options::Credentials;
1371 async fn build(
1372 self,
1373 config: gaxi::options::ClientConfig,
1374 ) -> gax::client_builder::Result<Self::Client> {
1375 Self::Client::new(config).await
1376 }
1377 }
1378 }
1379
1380 #[derive(Clone, Debug)]
1382 pub(crate) struct RequestBuilder<R: std::default::Default> {
1383 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1384 request: R,
1385 options: gax::options::RequestOptions,
1386 }
1387
1388 impl<R> RequestBuilder<R>
1389 where
1390 R: std::default::Default,
1391 {
1392 pub(crate) fn new(
1393 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1394 ) -> Self {
1395 Self {
1396 stub,
1397 request: R::default(),
1398 options: gax::options::RequestOptions::default(),
1399 }
1400 }
1401 }
1402
1403 #[derive(Clone, Debug)]
1425 pub struct ListAnswerRecords(RequestBuilder<crate::model::ListAnswerRecordsRequest>);
1426
1427 impl ListAnswerRecords {
1428 pub(crate) fn new(
1429 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1430 ) -> Self {
1431 Self(RequestBuilder::new(stub))
1432 }
1433
1434 pub fn with_request<V: Into<crate::model::ListAnswerRecordsRequest>>(
1436 mut self,
1437 v: V,
1438 ) -> Self {
1439 self.0.request = v.into();
1440 self
1441 }
1442
1443 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1445 self.0.options = v.into();
1446 self
1447 }
1448
1449 pub async fn send(self) -> Result<crate::model::ListAnswerRecordsResponse> {
1451 (*self.0.stub)
1452 .list_answer_records(self.0.request, self.0.options)
1453 .await
1454 .map(gax::response::Response::into_body)
1455 }
1456
1457 pub fn by_page(
1459 self,
1460 ) -> impl gax::paginator::Paginator<crate::model::ListAnswerRecordsResponse, gax::error::Error>
1461 {
1462 use std::clone::Clone;
1463 let token = self.0.request.page_token.clone();
1464 let execute = move |token: String| {
1465 let mut builder = self.clone();
1466 builder.0.request = builder.0.request.set_page_token(token);
1467 builder.send()
1468 };
1469 gax::paginator::internal::new_paginator(token, execute)
1470 }
1471
1472 pub fn by_item(
1474 self,
1475 ) -> impl gax::paginator::ItemPaginator<crate::model::ListAnswerRecordsResponse, gax::error::Error>
1476 {
1477 use gax::paginator::Paginator;
1478 self.by_page().items()
1479 }
1480
1481 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1485 self.0.request.parent = v.into();
1486 self
1487 }
1488
1489 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1491 self.0.request.filter = v.into();
1492 self
1493 }
1494
1495 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1497 self.0.request.page_size = v.into();
1498 self
1499 }
1500
1501 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1503 self.0.request.page_token = v.into();
1504 self
1505 }
1506 }
1507
1508 #[doc(hidden)]
1509 impl gax::options::internal::RequestBuilder for ListAnswerRecords {
1510 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1511 &mut self.0.options
1512 }
1513 }
1514
1515 #[derive(Clone, Debug)]
1533 pub struct UpdateAnswerRecord(RequestBuilder<crate::model::UpdateAnswerRecordRequest>);
1534
1535 impl UpdateAnswerRecord {
1536 pub(crate) fn new(
1537 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1538 ) -> Self {
1539 Self(RequestBuilder::new(stub))
1540 }
1541
1542 pub fn with_request<V: Into<crate::model::UpdateAnswerRecordRequest>>(
1544 mut self,
1545 v: V,
1546 ) -> Self {
1547 self.0.request = v.into();
1548 self
1549 }
1550
1551 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1553 self.0.options = v.into();
1554 self
1555 }
1556
1557 pub async fn send(self) -> Result<crate::model::AnswerRecord> {
1559 (*self.0.stub)
1560 .update_answer_record(self.0.request, self.0.options)
1561 .await
1562 .map(gax::response::Response::into_body)
1563 }
1564
1565 pub fn set_answer_record<T>(mut self, v: T) -> Self
1569 where
1570 T: std::convert::Into<crate::model::AnswerRecord>,
1571 {
1572 self.0.request.answer_record = std::option::Option::Some(v.into());
1573 self
1574 }
1575
1576 pub fn set_or_clear_answer_record<T>(mut self, v: std::option::Option<T>) -> Self
1580 where
1581 T: std::convert::Into<crate::model::AnswerRecord>,
1582 {
1583 self.0.request.answer_record = v.map(|x| x.into());
1584 self
1585 }
1586
1587 pub fn set_update_mask<T>(mut self, v: T) -> Self
1591 where
1592 T: std::convert::Into<wkt::FieldMask>,
1593 {
1594 self.0.request.update_mask = std::option::Option::Some(v.into());
1595 self
1596 }
1597
1598 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1602 where
1603 T: std::convert::Into<wkt::FieldMask>,
1604 {
1605 self.0.request.update_mask = v.map(|x| x.into());
1606 self
1607 }
1608 }
1609
1610 #[doc(hidden)]
1611 impl gax::options::internal::RequestBuilder for UpdateAnswerRecord {
1612 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1613 &mut self.0.options
1614 }
1615 }
1616
1617 #[derive(Clone, Debug)]
1639 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1640
1641 impl ListLocations {
1642 pub(crate) fn new(
1643 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1644 ) -> Self {
1645 Self(RequestBuilder::new(stub))
1646 }
1647
1648 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1650 mut self,
1651 v: V,
1652 ) -> Self {
1653 self.0.request = v.into();
1654 self
1655 }
1656
1657 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1659 self.0.options = v.into();
1660 self
1661 }
1662
1663 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1665 (*self.0.stub)
1666 .list_locations(self.0.request, self.0.options)
1667 .await
1668 .map(gax::response::Response::into_body)
1669 }
1670
1671 pub fn by_page(
1673 self,
1674 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1675 {
1676 use std::clone::Clone;
1677 let token = self.0.request.page_token.clone();
1678 let execute = move |token: String| {
1679 let mut builder = self.clone();
1680 builder.0.request = builder.0.request.set_page_token(token);
1681 builder.send()
1682 };
1683 gax::paginator::internal::new_paginator(token, execute)
1684 }
1685
1686 pub fn by_item(
1688 self,
1689 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1690 {
1691 use gax::paginator::Paginator;
1692 self.by_page().items()
1693 }
1694
1695 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1697 self.0.request.name = v.into();
1698 self
1699 }
1700
1701 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1703 self.0.request.filter = v.into();
1704 self
1705 }
1706
1707 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1709 self.0.request.page_size = v.into();
1710 self
1711 }
1712
1713 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1715 self.0.request.page_token = v.into();
1716 self
1717 }
1718 }
1719
1720 #[doc(hidden)]
1721 impl gax::options::internal::RequestBuilder for ListLocations {
1722 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1723 &mut self.0.options
1724 }
1725 }
1726
1727 #[derive(Clone, Debug)]
1745 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1746
1747 impl GetLocation {
1748 pub(crate) fn new(
1749 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1750 ) -> Self {
1751 Self(RequestBuilder::new(stub))
1752 }
1753
1754 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1756 self.0.request = v.into();
1757 self
1758 }
1759
1760 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1762 self.0.options = v.into();
1763 self
1764 }
1765
1766 pub async fn send(self) -> Result<location::model::Location> {
1768 (*self.0.stub)
1769 .get_location(self.0.request, self.0.options)
1770 .await
1771 .map(gax::response::Response::into_body)
1772 }
1773
1774 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1776 self.0.request.name = v.into();
1777 self
1778 }
1779 }
1780
1781 #[doc(hidden)]
1782 impl gax::options::internal::RequestBuilder for GetLocation {
1783 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1784 &mut self.0.options
1785 }
1786 }
1787
1788 #[derive(Clone, Debug)]
1810 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1811
1812 impl ListOperations {
1813 pub(crate) fn new(
1814 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1815 ) -> Self {
1816 Self(RequestBuilder::new(stub))
1817 }
1818
1819 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1821 mut self,
1822 v: V,
1823 ) -> Self {
1824 self.0.request = v.into();
1825 self
1826 }
1827
1828 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1830 self.0.options = v.into();
1831 self
1832 }
1833
1834 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1836 (*self.0.stub)
1837 .list_operations(self.0.request, self.0.options)
1838 .await
1839 .map(gax::response::Response::into_body)
1840 }
1841
1842 pub fn by_page(
1844 self,
1845 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1846 {
1847 use std::clone::Clone;
1848 let token = self.0.request.page_token.clone();
1849 let execute = move |token: String| {
1850 let mut builder = self.clone();
1851 builder.0.request = builder.0.request.set_page_token(token);
1852 builder.send()
1853 };
1854 gax::paginator::internal::new_paginator(token, execute)
1855 }
1856
1857 pub fn by_item(
1859 self,
1860 ) -> impl gax::paginator::ItemPaginator<
1861 longrunning::model::ListOperationsResponse,
1862 gax::error::Error,
1863 > {
1864 use gax::paginator::Paginator;
1865 self.by_page().items()
1866 }
1867
1868 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1870 self.0.request.name = v.into();
1871 self
1872 }
1873
1874 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1876 self.0.request.filter = v.into();
1877 self
1878 }
1879
1880 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1882 self.0.request.page_size = v.into();
1883 self
1884 }
1885
1886 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1888 self.0.request.page_token = v.into();
1889 self
1890 }
1891
1892 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1894 self.0.request.return_partial_success = v.into();
1895 self
1896 }
1897 }
1898
1899 #[doc(hidden)]
1900 impl gax::options::internal::RequestBuilder for ListOperations {
1901 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1902 &mut self.0.options
1903 }
1904 }
1905
1906 #[derive(Clone, Debug)]
1924 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1925
1926 impl GetOperation {
1927 pub(crate) fn new(
1928 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1929 ) -> Self {
1930 Self(RequestBuilder::new(stub))
1931 }
1932
1933 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1935 mut self,
1936 v: V,
1937 ) -> Self {
1938 self.0.request = v.into();
1939 self
1940 }
1941
1942 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1944 self.0.options = v.into();
1945 self
1946 }
1947
1948 pub async fn send(self) -> Result<longrunning::model::Operation> {
1950 (*self.0.stub)
1951 .get_operation(self.0.request, self.0.options)
1952 .await
1953 .map(gax::response::Response::into_body)
1954 }
1955
1956 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1958 self.0.request.name = v.into();
1959 self
1960 }
1961 }
1962
1963 #[doc(hidden)]
1964 impl gax::options::internal::RequestBuilder for GetOperation {
1965 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1966 &mut self.0.options
1967 }
1968 }
1969
1970 #[derive(Clone, Debug)]
1988 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1989
1990 impl CancelOperation {
1991 pub(crate) fn new(
1992 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1993 ) -> Self {
1994 Self(RequestBuilder::new(stub))
1995 }
1996
1997 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1999 mut self,
2000 v: V,
2001 ) -> Self {
2002 self.0.request = v.into();
2003 self
2004 }
2005
2006 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2008 self.0.options = v.into();
2009 self
2010 }
2011
2012 pub async fn send(self) -> Result<()> {
2014 (*self.0.stub)
2015 .cancel_operation(self.0.request, self.0.options)
2016 .await
2017 .map(gax::response::Response::into_body)
2018 }
2019
2020 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2022 self.0.request.name = v.into();
2023 self
2024 }
2025 }
2026
2027 #[doc(hidden)]
2028 impl gax::options::internal::RequestBuilder for CancelOperation {
2029 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2030 &mut self.0.options
2031 }
2032 }
2033}
2034
2035#[cfg(feature = "contexts")]
2036#[cfg_attr(docsrs, doc(cfg(feature = "contexts")))]
2037pub mod contexts {
2038 use crate::Result;
2039
2040 pub type ClientBuilder =
2054 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2055
2056 pub(crate) mod client {
2057 use super::super::super::client::Contexts;
2058 pub struct Factory;
2059 impl gax::client_builder::internal::ClientFactory for Factory {
2060 type Client = Contexts;
2061 type Credentials = gaxi::options::Credentials;
2062 async fn build(
2063 self,
2064 config: gaxi::options::ClientConfig,
2065 ) -> gax::client_builder::Result<Self::Client> {
2066 Self::Client::new(config).await
2067 }
2068 }
2069 }
2070
2071 #[derive(Clone, Debug)]
2073 pub(crate) struct RequestBuilder<R: std::default::Default> {
2074 stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>,
2075 request: R,
2076 options: gax::options::RequestOptions,
2077 }
2078
2079 impl<R> RequestBuilder<R>
2080 where
2081 R: std::default::Default,
2082 {
2083 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2084 Self {
2085 stub,
2086 request: R::default(),
2087 options: gax::options::RequestOptions::default(),
2088 }
2089 }
2090 }
2091
2092 #[derive(Clone, Debug)]
2114 pub struct ListContexts(RequestBuilder<crate::model::ListContextsRequest>);
2115
2116 impl ListContexts {
2117 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2118 Self(RequestBuilder::new(stub))
2119 }
2120
2121 pub fn with_request<V: Into<crate::model::ListContextsRequest>>(mut self, v: V) -> Self {
2123 self.0.request = v.into();
2124 self
2125 }
2126
2127 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2129 self.0.options = v.into();
2130 self
2131 }
2132
2133 pub async fn send(self) -> Result<crate::model::ListContextsResponse> {
2135 (*self.0.stub)
2136 .list_contexts(self.0.request, self.0.options)
2137 .await
2138 .map(gax::response::Response::into_body)
2139 }
2140
2141 pub fn by_page(
2143 self,
2144 ) -> impl gax::paginator::Paginator<crate::model::ListContextsResponse, gax::error::Error>
2145 {
2146 use std::clone::Clone;
2147 let token = self.0.request.page_token.clone();
2148 let execute = move |token: String| {
2149 let mut builder = self.clone();
2150 builder.0.request = builder.0.request.set_page_token(token);
2151 builder.send()
2152 };
2153 gax::paginator::internal::new_paginator(token, execute)
2154 }
2155
2156 pub fn by_item(
2158 self,
2159 ) -> impl gax::paginator::ItemPaginator<crate::model::ListContextsResponse, gax::error::Error>
2160 {
2161 use gax::paginator::Paginator;
2162 self.by_page().items()
2163 }
2164
2165 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2169 self.0.request.parent = v.into();
2170 self
2171 }
2172
2173 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2175 self.0.request.page_size = v.into();
2176 self
2177 }
2178
2179 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2181 self.0.request.page_token = v.into();
2182 self
2183 }
2184 }
2185
2186 #[doc(hidden)]
2187 impl gax::options::internal::RequestBuilder for ListContexts {
2188 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2189 &mut self.0.options
2190 }
2191 }
2192
2193 #[derive(Clone, Debug)]
2211 pub struct GetContext(RequestBuilder<crate::model::GetContextRequest>);
2212
2213 impl GetContext {
2214 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2215 Self(RequestBuilder::new(stub))
2216 }
2217
2218 pub fn with_request<V: Into<crate::model::GetContextRequest>>(mut self, v: V) -> Self {
2220 self.0.request = v.into();
2221 self
2222 }
2223
2224 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2226 self.0.options = v.into();
2227 self
2228 }
2229
2230 pub async fn send(self) -> Result<crate::model::Context> {
2232 (*self.0.stub)
2233 .get_context(self.0.request, self.0.options)
2234 .await
2235 .map(gax::response::Response::into_body)
2236 }
2237
2238 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2242 self.0.request.name = v.into();
2243 self
2244 }
2245 }
2246
2247 #[doc(hidden)]
2248 impl gax::options::internal::RequestBuilder for GetContext {
2249 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2250 &mut self.0.options
2251 }
2252 }
2253
2254 #[derive(Clone, Debug)]
2272 pub struct CreateContext(RequestBuilder<crate::model::CreateContextRequest>);
2273
2274 impl CreateContext {
2275 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2276 Self(RequestBuilder::new(stub))
2277 }
2278
2279 pub fn with_request<V: Into<crate::model::CreateContextRequest>>(mut self, v: V) -> Self {
2281 self.0.request = v.into();
2282 self
2283 }
2284
2285 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2287 self.0.options = v.into();
2288 self
2289 }
2290
2291 pub async fn send(self) -> Result<crate::model::Context> {
2293 (*self.0.stub)
2294 .create_context(self.0.request, self.0.options)
2295 .await
2296 .map(gax::response::Response::into_body)
2297 }
2298
2299 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2303 self.0.request.parent = v.into();
2304 self
2305 }
2306
2307 pub fn set_context<T>(mut self, v: T) -> Self
2311 where
2312 T: std::convert::Into<crate::model::Context>,
2313 {
2314 self.0.request.context = std::option::Option::Some(v.into());
2315 self
2316 }
2317
2318 pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
2322 where
2323 T: std::convert::Into<crate::model::Context>,
2324 {
2325 self.0.request.context = v.map(|x| x.into());
2326 self
2327 }
2328 }
2329
2330 #[doc(hidden)]
2331 impl gax::options::internal::RequestBuilder for CreateContext {
2332 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2333 &mut self.0.options
2334 }
2335 }
2336
2337 #[derive(Clone, Debug)]
2355 pub struct UpdateContext(RequestBuilder<crate::model::UpdateContextRequest>);
2356
2357 impl UpdateContext {
2358 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2359 Self(RequestBuilder::new(stub))
2360 }
2361
2362 pub fn with_request<V: Into<crate::model::UpdateContextRequest>>(mut self, v: V) -> Self {
2364 self.0.request = v.into();
2365 self
2366 }
2367
2368 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2370 self.0.options = v.into();
2371 self
2372 }
2373
2374 pub async fn send(self) -> Result<crate::model::Context> {
2376 (*self.0.stub)
2377 .update_context(self.0.request, self.0.options)
2378 .await
2379 .map(gax::response::Response::into_body)
2380 }
2381
2382 pub fn set_context<T>(mut self, v: T) -> Self
2386 where
2387 T: std::convert::Into<crate::model::Context>,
2388 {
2389 self.0.request.context = std::option::Option::Some(v.into());
2390 self
2391 }
2392
2393 pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
2397 where
2398 T: std::convert::Into<crate::model::Context>,
2399 {
2400 self.0.request.context = v.map(|x| x.into());
2401 self
2402 }
2403
2404 pub fn set_update_mask<T>(mut self, v: T) -> Self
2406 where
2407 T: std::convert::Into<wkt::FieldMask>,
2408 {
2409 self.0.request.update_mask = std::option::Option::Some(v.into());
2410 self
2411 }
2412
2413 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2415 where
2416 T: std::convert::Into<wkt::FieldMask>,
2417 {
2418 self.0.request.update_mask = v.map(|x| x.into());
2419 self
2420 }
2421 }
2422
2423 #[doc(hidden)]
2424 impl gax::options::internal::RequestBuilder for UpdateContext {
2425 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2426 &mut self.0.options
2427 }
2428 }
2429
2430 #[derive(Clone, Debug)]
2448 pub struct DeleteContext(RequestBuilder<crate::model::DeleteContextRequest>);
2449
2450 impl DeleteContext {
2451 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2452 Self(RequestBuilder::new(stub))
2453 }
2454
2455 pub fn with_request<V: Into<crate::model::DeleteContextRequest>>(mut self, v: V) -> Self {
2457 self.0.request = v.into();
2458 self
2459 }
2460
2461 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2463 self.0.options = v.into();
2464 self
2465 }
2466
2467 pub async fn send(self) -> Result<()> {
2469 (*self.0.stub)
2470 .delete_context(self.0.request, self.0.options)
2471 .await
2472 .map(gax::response::Response::into_body)
2473 }
2474
2475 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2479 self.0.request.name = v.into();
2480 self
2481 }
2482 }
2483
2484 #[doc(hidden)]
2485 impl gax::options::internal::RequestBuilder for DeleteContext {
2486 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2487 &mut self.0.options
2488 }
2489 }
2490
2491 #[derive(Clone, Debug)]
2509 pub struct DeleteAllContexts(RequestBuilder<crate::model::DeleteAllContextsRequest>);
2510
2511 impl DeleteAllContexts {
2512 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2513 Self(RequestBuilder::new(stub))
2514 }
2515
2516 pub fn with_request<V: Into<crate::model::DeleteAllContextsRequest>>(
2518 mut self,
2519 v: V,
2520 ) -> Self {
2521 self.0.request = v.into();
2522 self
2523 }
2524
2525 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2527 self.0.options = v.into();
2528 self
2529 }
2530
2531 pub async fn send(self) -> Result<()> {
2533 (*self.0.stub)
2534 .delete_all_contexts(self.0.request, self.0.options)
2535 .await
2536 .map(gax::response::Response::into_body)
2537 }
2538
2539 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2543 self.0.request.parent = v.into();
2544 self
2545 }
2546 }
2547
2548 #[doc(hidden)]
2549 impl gax::options::internal::RequestBuilder for DeleteAllContexts {
2550 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2551 &mut self.0.options
2552 }
2553 }
2554
2555 #[derive(Clone, Debug)]
2577 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
2578
2579 impl ListLocations {
2580 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2581 Self(RequestBuilder::new(stub))
2582 }
2583
2584 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
2586 mut self,
2587 v: V,
2588 ) -> Self {
2589 self.0.request = v.into();
2590 self
2591 }
2592
2593 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2595 self.0.options = v.into();
2596 self
2597 }
2598
2599 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
2601 (*self.0.stub)
2602 .list_locations(self.0.request, self.0.options)
2603 .await
2604 .map(gax::response::Response::into_body)
2605 }
2606
2607 pub fn by_page(
2609 self,
2610 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
2611 {
2612 use std::clone::Clone;
2613 let token = self.0.request.page_token.clone();
2614 let execute = move |token: String| {
2615 let mut builder = self.clone();
2616 builder.0.request = builder.0.request.set_page_token(token);
2617 builder.send()
2618 };
2619 gax::paginator::internal::new_paginator(token, execute)
2620 }
2621
2622 pub fn by_item(
2624 self,
2625 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
2626 {
2627 use gax::paginator::Paginator;
2628 self.by_page().items()
2629 }
2630
2631 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2633 self.0.request.name = v.into();
2634 self
2635 }
2636
2637 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2639 self.0.request.filter = v.into();
2640 self
2641 }
2642
2643 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2645 self.0.request.page_size = v.into();
2646 self
2647 }
2648
2649 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2651 self.0.request.page_token = v.into();
2652 self
2653 }
2654 }
2655
2656 #[doc(hidden)]
2657 impl gax::options::internal::RequestBuilder for ListLocations {
2658 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2659 &mut self.0.options
2660 }
2661 }
2662
2663 #[derive(Clone, Debug)]
2681 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
2682
2683 impl GetLocation {
2684 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2685 Self(RequestBuilder::new(stub))
2686 }
2687
2688 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
2690 self.0.request = v.into();
2691 self
2692 }
2693
2694 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2696 self.0.options = v.into();
2697 self
2698 }
2699
2700 pub async fn send(self) -> Result<location::model::Location> {
2702 (*self.0.stub)
2703 .get_location(self.0.request, self.0.options)
2704 .await
2705 .map(gax::response::Response::into_body)
2706 }
2707
2708 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2710 self.0.request.name = v.into();
2711 self
2712 }
2713 }
2714
2715 #[doc(hidden)]
2716 impl gax::options::internal::RequestBuilder for GetLocation {
2717 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2718 &mut self.0.options
2719 }
2720 }
2721
2722 #[derive(Clone, Debug)]
2744 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2745
2746 impl ListOperations {
2747 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2748 Self(RequestBuilder::new(stub))
2749 }
2750
2751 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2753 mut self,
2754 v: V,
2755 ) -> Self {
2756 self.0.request = v.into();
2757 self
2758 }
2759
2760 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2762 self.0.options = v.into();
2763 self
2764 }
2765
2766 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2768 (*self.0.stub)
2769 .list_operations(self.0.request, self.0.options)
2770 .await
2771 .map(gax::response::Response::into_body)
2772 }
2773
2774 pub fn by_page(
2776 self,
2777 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2778 {
2779 use std::clone::Clone;
2780 let token = self.0.request.page_token.clone();
2781 let execute = move |token: String| {
2782 let mut builder = self.clone();
2783 builder.0.request = builder.0.request.set_page_token(token);
2784 builder.send()
2785 };
2786 gax::paginator::internal::new_paginator(token, execute)
2787 }
2788
2789 pub fn by_item(
2791 self,
2792 ) -> impl gax::paginator::ItemPaginator<
2793 longrunning::model::ListOperationsResponse,
2794 gax::error::Error,
2795 > {
2796 use gax::paginator::Paginator;
2797 self.by_page().items()
2798 }
2799
2800 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2802 self.0.request.name = v.into();
2803 self
2804 }
2805
2806 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2808 self.0.request.filter = v.into();
2809 self
2810 }
2811
2812 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2814 self.0.request.page_size = v.into();
2815 self
2816 }
2817
2818 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2820 self.0.request.page_token = v.into();
2821 self
2822 }
2823
2824 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2826 self.0.request.return_partial_success = v.into();
2827 self
2828 }
2829 }
2830
2831 #[doc(hidden)]
2832 impl gax::options::internal::RequestBuilder for ListOperations {
2833 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2834 &mut self.0.options
2835 }
2836 }
2837
2838 #[derive(Clone, Debug)]
2856 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2857
2858 impl GetOperation {
2859 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2860 Self(RequestBuilder::new(stub))
2861 }
2862
2863 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2865 mut self,
2866 v: V,
2867 ) -> Self {
2868 self.0.request = v.into();
2869 self
2870 }
2871
2872 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2874 self.0.options = v.into();
2875 self
2876 }
2877
2878 pub async fn send(self) -> Result<longrunning::model::Operation> {
2880 (*self.0.stub)
2881 .get_operation(self.0.request, self.0.options)
2882 .await
2883 .map(gax::response::Response::into_body)
2884 }
2885
2886 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2888 self.0.request.name = v.into();
2889 self
2890 }
2891 }
2892
2893 #[doc(hidden)]
2894 impl gax::options::internal::RequestBuilder for GetOperation {
2895 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2896 &mut self.0.options
2897 }
2898 }
2899
2900 #[derive(Clone, Debug)]
2918 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2919
2920 impl CancelOperation {
2921 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2922 Self(RequestBuilder::new(stub))
2923 }
2924
2925 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2927 mut self,
2928 v: V,
2929 ) -> Self {
2930 self.0.request = v.into();
2931 self
2932 }
2933
2934 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2936 self.0.options = v.into();
2937 self
2938 }
2939
2940 pub async fn send(self) -> Result<()> {
2942 (*self.0.stub)
2943 .cancel_operation(self.0.request, self.0.options)
2944 .await
2945 .map(gax::response::Response::into_body)
2946 }
2947
2948 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2950 self.0.request.name = v.into();
2951 self
2952 }
2953 }
2954
2955 #[doc(hidden)]
2956 impl gax::options::internal::RequestBuilder for CancelOperation {
2957 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2958 &mut self.0.options
2959 }
2960 }
2961}
2962
2963#[cfg(feature = "conversations")]
2964#[cfg_attr(docsrs, doc(cfg(feature = "conversations")))]
2965pub mod conversations {
2966 use crate::Result;
2967
2968 pub type ClientBuilder =
2982 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2983
2984 pub(crate) mod client {
2985 use super::super::super::client::Conversations;
2986 pub struct Factory;
2987 impl gax::client_builder::internal::ClientFactory for Factory {
2988 type Client = Conversations;
2989 type Credentials = gaxi::options::Credentials;
2990 async fn build(
2991 self,
2992 config: gaxi::options::ClientConfig,
2993 ) -> gax::client_builder::Result<Self::Client> {
2994 Self::Client::new(config).await
2995 }
2996 }
2997 }
2998
2999 #[derive(Clone, Debug)]
3001 pub(crate) struct RequestBuilder<R: std::default::Default> {
3002 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3003 request: R,
3004 options: gax::options::RequestOptions,
3005 }
3006
3007 impl<R> RequestBuilder<R>
3008 where
3009 R: std::default::Default,
3010 {
3011 pub(crate) fn new(
3012 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3013 ) -> Self {
3014 Self {
3015 stub,
3016 request: R::default(),
3017 options: gax::options::RequestOptions::default(),
3018 }
3019 }
3020 }
3021
3022 #[derive(Clone, Debug)]
3040 pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
3041
3042 impl CreateConversation {
3043 pub(crate) fn new(
3044 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3045 ) -> Self {
3046 Self(RequestBuilder::new(stub))
3047 }
3048
3049 pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
3051 mut self,
3052 v: V,
3053 ) -> Self {
3054 self.0.request = v.into();
3055 self
3056 }
3057
3058 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3060 self.0.options = v.into();
3061 self
3062 }
3063
3064 pub async fn send(self) -> Result<crate::model::Conversation> {
3066 (*self.0.stub)
3067 .create_conversation(self.0.request, self.0.options)
3068 .await
3069 .map(gax::response::Response::into_body)
3070 }
3071
3072 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3076 self.0.request.parent = v.into();
3077 self
3078 }
3079
3080 pub fn set_conversation<T>(mut self, v: T) -> Self
3084 where
3085 T: std::convert::Into<crate::model::Conversation>,
3086 {
3087 self.0.request.conversation = std::option::Option::Some(v.into());
3088 self
3089 }
3090
3091 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3095 where
3096 T: std::convert::Into<crate::model::Conversation>,
3097 {
3098 self.0.request.conversation = v.map(|x| x.into());
3099 self
3100 }
3101
3102 pub fn set_conversation_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3104 self.0.request.conversation_id = v.into();
3105 self
3106 }
3107 }
3108
3109 #[doc(hidden)]
3110 impl gax::options::internal::RequestBuilder for CreateConversation {
3111 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3112 &mut self.0.options
3113 }
3114 }
3115
3116 #[derive(Clone, Debug)]
3138 pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3139
3140 impl ListConversations {
3141 pub(crate) fn new(
3142 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3143 ) -> Self {
3144 Self(RequestBuilder::new(stub))
3145 }
3146
3147 pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3149 mut self,
3150 v: V,
3151 ) -> Self {
3152 self.0.request = v.into();
3153 self
3154 }
3155
3156 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3158 self.0.options = v.into();
3159 self
3160 }
3161
3162 pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3164 (*self.0.stub)
3165 .list_conversations(self.0.request, self.0.options)
3166 .await
3167 .map(gax::response::Response::into_body)
3168 }
3169
3170 pub fn by_page(
3172 self,
3173 ) -> impl gax::paginator::Paginator<crate::model::ListConversationsResponse, gax::error::Error>
3174 {
3175 use std::clone::Clone;
3176 let token = self.0.request.page_token.clone();
3177 let execute = move |token: String| {
3178 let mut builder = self.clone();
3179 builder.0.request = builder.0.request.set_page_token(token);
3180 builder.send()
3181 };
3182 gax::paginator::internal::new_paginator(token, execute)
3183 }
3184
3185 pub fn by_item(
3187 self,
3188 ) -> impl gax::paginator::ItemPaginator<crate::model::ListConversationsResponse, gax::error::Error>
3189 {
3190 use gax::paginator::Paginator;
3191 self.by_page().items()
3192 }
3193
3194 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3198 self.0.request.parent = v.into();
3199 self
3200 }
3201
3202 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3204 self.0.request.page_size = v.into();
3205 self
3206 }
3207
3208 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3210 self.0.request.page_token = v.into();
3211 self
3212 }
3213
3214 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3216 self.0.request.filter = v.into();
3217 self
3218 }
3219 }
3220
3221 #[doc(hidden)]
3222 impl gax::options::internal::RequestBuilder for ListConversations {
3223 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3224 &mut self.0.options
3225 }
3226 }
3227
3228 #[derive(Clone, Debug)]
3246 pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3247
3248 impl GetConversation {
3249 pub(crate) fn new(
3250 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3251 ) -> Self {
3252 Self(RequestBuilder::new(stub))
3253 }
3254
3255 pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3257 self.0.request = v.into();
3258 self
3259 }
3260
3261 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3263 self.0.options = v.into();
3264 self
3265 }
3266
3267 pub async fn send(self) -> Result<crate::model::Conversation> {
3269 (*self.0.stub)
3270 .get_conversation(self.0.request, self.0.options)
3271 .await
3272 .map(gax::response::Response::into_body)
3273 }
3274
3275 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3279 self.0.request.name = v.into();
3280 self
3281 }
3282 }
3283
3284 #[doc(hidden)]
3285 impl gax::options::internal::RequestBuilder for GetConversation {
3286 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3287 &mut self.0.options
3288 }
3289 }
3290
3291 #[derive(Clone, Debug)]
3309 pub struct CompleteConversation(RequestBuilder<crate::model::CompleteConversationRequest>);
3310
3311 impl CompleteConversation {
3312 pub(crate) fn new(
3313 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3314 ) -> Self {
3315 Self(RequestBuilder::new(stub))
3316 }
3317
3318 pub fn with_request<V: Into<crate::model::CompleteConversationRequest>>(
3320 mut self,
3321 v: V,
3322 ) -> Self {
3323 self.0.request = v.into();
3324 self
3325 }
3326
3327 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3329 self.0.options = v.into();
3330 self
3331 }
3332
3333 pub async fn send(self) -> Result<crate::model::Conversation> {
3335 (*self.0.stub)
3336 .complete_conversation(self.0.request, self.0.options)
3337 .await
3338 .map(gax::response::Response::into_body)
3339 }
3340
3341 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3345 self.0.request.name = v.into();
3346 self
3347 }
3348 }
3349
3350 #[doc(hidden)]
3351 impl gax::options::internal::RequestBuilder for CompleteConversation {
3352 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3353 &mut self.0.options
3354 }
3355 }
3356
3357 #[derive(Clone, Debug)]
3375 pub struct IngestContextReferences(
3376 RequestBuilder<crate::model::IngestContextReferencesRequest>,
3377 );
3378
3379 impl IngestContextReferences {
3380 pub(crate) fn new(
3381 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3382 ) -> Self {
3383 Self(RequestBuilder::new(stub))
3384 }
3385
3386 pub fn with_request<V: Into<crate::model::IngestContextReferencesRequest>>(
3388 mut self,
3389 v: V,
3390 ) -> Self {
3391 self.0.request = v.into();
3392 self
3393 }
3394
3395 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3397 self.0.options = v.into();
3398 self
3399 }
3400
3401 pub async fn send(self) -> Result<crate::model::IngestContextReferencesResponse> {
3403 (*self.0.stub)
3404 .ingest_context_references(self.0.request, self.0.options)
3405 .await
3406 .map(gax::response::Response::into_body)
3407 }
3408
3409 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
3413 self.0.request.conversation = v.into();
3414 self
3415 }
3416
3417 pub fn set_context_references<T, K, V>(mut self, v: T) -> Self
3421 where
3422 T: std::iter::IntoIterator<Item = (K, V)>,
3423 K: std::convert::Into<std::string::String>,
3424 V: std::convert::Into<crate::model::conversation::ContextReference>,
3425 {
3426 self.0.request.context_references =
3427 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3428 self
3429 }
3430 }
3431
3432 #[doc(hidden)]
3433 impl gax::options::internal::RequestBuilder for IngestContextReferences {
3434 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3435 &mut self.0.options
3436 }
3437 }
3438
3439 #[derive(Clone, Debug)]
3461 pub struct ListMessages(RequestBuilder<crate::model::ListMessagesRequest>);
3462
3463 impl ListMessages {
3464 pub(crate) fn new(
3465 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3466 ) -> Self {
3467 Self(RequestBuilder::new(stub))
3468 }
3469
3470 pub fn with_request<V: Into<crate::model::ListMessagesRequest>>(mut self, v: V) -> Self {
3472 self.0.request = v.into();
3473 self
3474 }
3475
3476 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3478 self.0.options = v.into();
3479 self
3480 }
3481
3482 pub async fn send(self) -> Result<crate::model::ListMessagesResponse> {
3484 (*self.0.stub)
3485 .list_messages(self.0.request, self.0.options)
3486 .await
3487 .map(gax::response::Response::into_body)
3488 }
3489
3490 pub fn by_page(
3492 self,
3493 ) -> impl gax::paginator::Paginator<crate::model::ListMessagesResponse, gax::error::Error>
3494 {
3495 use std::clone::Clone;
3496 let token = self.0.request.page_token.clone();
3497 let execute = move |token: String| {
3498 let mut builder = self.clone();
3499 builder.0.request = builder.0.request.set_page_token(token);
3500 builder.send()
3501 };
3502 gax::paginator::internal::new_paginator(token, execute)
3503 }
3504
3505 pub fn by_item(
3507 self,
3508 ) -> impl gax::paginator::ItemPaginator<crate::model::ListMessagesResponse, gax::error::Error>
3509 {
3510 use gax::paginator::Paginator;
3511 self.by_page().items()
3512 }
3513
3514 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3518 self.0.request.parent = v.into();
3519 self
3520 }
3521
3522 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3524 self.0.request.filter = v.into();
3525 self
3526 }
3527
3528 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3530 self.0.request.page_size = v.into();
3531 self
3532 }
3533
3534 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3536 self.0.request.page_token = v.into();
3537 self
3538 }
3539 }
3540
3541 #[doc(hidden)]
3542 impl gax::options::internal::RequestBuilder for ListMessages {
3543 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3544 &mut self.0.options
3545 }
3546 }
3547
3548 #[derive(Clone, Debug)]
3566 pub struct SuggestConversationSummary(
3567 RequestBuilder<crate::model::SuggestConversationSummaryRequest>,
3568 );
3569
3570 impl SuggestConversationSummary {
3571 pub(crate) fn new(
3572 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3573 ) -> Self {
3574 Self(RequestBuilder::new(stub))
3575 }
3576
3577 pub fn with_request<V: Into<crate::model::SuggestConversationSummaryRequest>>(
3579 mut self,
3580 v: V,
3581 ) -> Self {
3582 self.0.request = v.into();
3583 self
3584 }
3585
3586 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3588 self.0.options = v.into();
3589 self
3590 }
3591
3592 pub async fn send(self) -> Result<crate::model::SuggestConversationSummaryResponse> {
3594 (*self.0.stub)
3595 .suggest_conversation_summary(self.0.request, self.0.options)
3596 .await
3597 .map(gax::response::Response::into_body)
3598 }
3599
3600 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
3604 self.0.request.conversation = v.into();
3605 self
3606 }
3607
3608 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
3610 self.0.request.latest_message = v.into();
3611 self
3612 }
3613
3614 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
3616 self.0.request.context_size = v.into();
3617 self
3618 }
3619
3620 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
3622 where
3623 T: std::convert::Into<crate::model::AssistQueryParameters>,
3624 {
3625 self.0.request.assist_query_params = std::option::Option::Some(v.into());
3626 self
3627 }
3628
3629 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
3631 where
3632 T: std::convert::Into<crate::model::AssistQueryParameters>,
3633 {
3634 self.0.request.assist_query_params = v.map(|x| x.into());
3635 self
3636 }
3637 }
3638
3639 #[doc(hidden)]
3640 impl gax::options::internal::RequestBuilder for SuggestConversationSummary {
3641 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3642 &mut self.0.options
3643 }
3644 }
3645
3646 #[derive(Clone, Debug)]
3664 pub struct GenerateStatelessSummary(
3665 RequestBuilder<crate::model::GenerateStatelessSummaryRequest>,
3666 );
3667
3668 impl GenerateStatelessSummary {
3669 pub(crate) fn new(
3670 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3671 ) -> Self {
3672 Self(RequestBuilder::new(stub))
3673 }
3674
3675 pub fn with_request<V: Into<crate::model::GenerateStatelessSummaryRequest>>(
3677 mut self,
3678 v: V,
3679 ) -> Self {
3680 self.0.request = v.into();
3681 self
3682 }
3683
3684 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3686 self.0.options = v.into();
3687 self
3688 }
3689
3690 pub async fn send(self) -> Result<crate::model::GenerateStatelessSummaryResponse> {
3692 (*self.0.stub)
3693 .generate_stateless_summary(self.0.request, self.0.options)
3694 .await
3695 .map(gax::response::Response::into_body)
3696 }
3697
3698 pub fn set_stateless_conversation<T>(mut self, v: T) -> Self
3702 where
3703 T: std::convert::Into<
3704 crate::model::generate_stateless_summary_request::MinimalConversation,
3705 >,
3706 {
3707 self.0.request.stateless_conversation = std::option::Option::Some(v.into());
3708 self
3709 }
3710
3711 pub fn set_or_clear_stateless_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3715 where
3716 T: std::convert::Into<
3717 crate::model::generate_stateless_summary_request::MinimalConversation,
3718 >,
3719 {
3720 self.0.request.stateless_conversation = v.map(|x| x.into());
3721 self
3722 }
3723
3724 pub fn set_conversation_profile<T>(mut self, v: T) -> Self
3728 where
3729 T: std::convert::Into<crate::model::ConversationProfile>,
3730 {
3731 self.0.request.conversation_profile = std::option::Option::Some(v.into());
3732 self
3733 }
3734
3735 pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
3739 where
3740 T: std::convert::Into<crate::model::ConversationProfile>,
3741 {
3742 self.0.request.conversation_profile = v.map(|x| x.into());
3743 self
3744 }
3745
3746 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
3748 self.0.request.latest_message = v.into();
3749 self
3750 }
3751
3752 pub fn set_max_context_size<T: Into<i32>>(mut self, v: T) -> Self {
3754 self.0.request.max_context_size = v.into();
3755 self
3756 }
3757 }
3758
3759 #[doc(hidden)]
3760 impl gax::options::internal::RequestBuilder for GenerateStatelessSummary {
3761 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3762 &mut self.0.options
3763 }
3764 }
3765
3766 #[derive(Clone, Debug)]
3784 pub struct GenerateStatelessSuggestion(
3785 RequestBuilder<crate::model::GenerateStatelessSuggestionRequest>,
3786 );
3787
3788 impl GenerateStatelessSuggestion {
3789 pub(crate) fn new(
3790 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3791 ) -> Self {
3792 Self(RequestBuilder::new(stub))
3793 }
3794
3795 pub fn with_request<V: Into<crate::model::GenerateStatelessSuggestionRequest>>(
3797 mut self,
3798 v: V,
3799 ) -> Self {
3800 self.0.request = v.into();
3801 self
3802 }
3803
3804 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3806 self.0.options = v.into();
3807 self
3808 }
3809
3810 pub async fn send(self) -> Result<crate::model::GenerateStatelessSuggestionResponse> {
3812 (*self.0.stub)
3813 .generate_stateless_suggestion(self.0.request, self.0.options)
3814 .await
3815 .map(gax::response::Response::into_body)
3816 }
3817
3818 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3822 self.0.request.parent = v.into();
3823 self
3824 }
3825
3826 pub fn set_context_references<T, K, V>(mut self, v: T) -> Self
3828 where
3829 T: std::iter::IntoIterator<Item = (K, V)>,
3830 K: std::convert::Into<std::string::String>,
3831 V: std::convert::Into<crate::model::conversation::ContextReference>,
3832 {
3833 self.0.request.context_references =
3834 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3835 self
3836 }
3837
3838 pub fn set_conversation_context<T>(mut self, v: T) -> Self
3840 where
3841 T: std::convert::Into<crate::model::ConversationContext>,
3842 {
3843 self.0.request.conversation_context = std::option::Option::Some(v.into());
3844 self
3845 }
3846
3847 pub fn set_or_clear_conversation_context<T>(mut self, v: std::option::Option<T>) -> Self
3849 where
3850 T: std::convert::Into<crate::model::ConversationContext>,
3851 {
3852 self.0.request.conversation_context = v.map(|x| x.into());
3853 self
3854 }
3855
3856 pub fn set_trigger_events<T, V>(mut self, v: T) -> Self
3858 where
3859 T: std::iter::IntoIterator<Item = V>,
3860 V: std::convert::Into<crate::model::TriggerEvent>,
3861 {
3862 use std::iter::Iterator;
3863 self.0.request.trigger_events = v.into_iter().map(|i| i.into()).collect();
3864 self
3865 }
3866
3867 pub fn set_generator_resource<
3872 T: Into<Option<crate::model::generate_stateless_suggestion_request::GeneratorResource>>,
3873 >(
3874 mut self,
3875 v: T,
3876 ) -> Self {
3877 self.0.request.generator_resource = v.into();
3878 self
3879 }
3880
3881 pub fn set_generator<T: std::convert::Into<std::boxed::Box<crate::model::Generator>>>(
3887 mut self,
3888 v: T,
3889 ) -> Self {
3890 self.0.request = self.0.request.set_generator(v);
3891 self
3892 }
3893
3894 pub fn set_generator_name<T: std::convert::Into<std::string::String>>(
3900 mut self,
3901 v: T,
3902 ) -> Self {
3903 self.0.request = self.0.request.set_generator_name(v);
3904 self
3905 }
3906 }
3907
3908 #[doc(hidden)]
3909 impl gax::options::internal::RequestBuilder for GenerateStatelessSuggestion {
3910 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3911 &mut self.0.options
3912 }
3913 }
3914
3915 #[derive(Clone, Debug)]
3933 pub struct SearchKnowledge(RequestBuilder<crate::model::SearchKnowledgeRequest>);
3934
3935 impl SearchKnowledge {
3936 pub(crate) fn new(
3937 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3938 ) -> Self {
3939 Self(RequestBuilder::new(stub))
3940 }
3941
3942 pub fn with_request<V: Into<crate::model::SearchKnowledgeRequest>>(mut self, v: V) -> Self {
3944 self.0.request = v.into();
3945 self
3946 }
3947
3948 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3950 self.0.options = v.into();
3951 self
3952 }
3953
3954 pub async fn send(self) -> Result<crate::model::SearchKnowledgeResponse> {
3956 (*self.0.stub)
3957 .search_knowledge(self.0.request, self.0.options)
3958 .await
3959 .map(gax::response::Response::into_body)
3960 }
3961
3962 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3966 self.0.request.parent = v.into();
3967 self
3968 }
3969
3970 pub fn set_query<T>(mut self, v: T) -> Self
3974 where
3975 T: std::convert::Into<crate::model::TextInput>,
3976 {
3977 self.0.request.query = std::option::Option::Some(v.into());
3978 self
3979 }
3980
3981 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3985 where
3986 T: std::convert::Into<crate::model::TextInput>,
3987 {
3988 self.0.request.query = v.map(|x| x.into());
3989 self
3990 }
3991
3992 pub fn set_conversation_profile<T: Into<std::string::String>>(mut self, v: T) -> Self {
3996 self.0.request.conversation_profile = v.into();
3997 self
3998 }
3999
4000 pub fn set_session_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4004 self.0.request.session_id = v.into();
4005 self
4006 }
4007
4008 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
4010 self.0.request.conversation = v.into();
4011 self
4012 }
4013
4014 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
4016 self.0.request.latest_message = v.into();
4017 self
4018 }
4019
4020 pub fn set_query_source<T: Into<crate::model::search_knowledge_request::QuerySource>>(
4022 mut self,
4023 v: T,
4024 ) -> Self {
4025 self.0.request.query_source = v.into();
4026 self
4027 }
4028
4029 pub fn set_end_user_metadata<T>(mut self, v: T) -> Self
4031 where
4032 T: std::convert::Into<wkt::Struct>,
4033 {
4034 self.0.request.end_user_metadata = std::option::Option::Some(v.into());
4035 self
4036 }
4037
4038 pub fn set_or_clear_end_user_metadata<T>(mut self, v: std::option::Option<T>) -> Self
4040 where
4041 T: std::convert::Into<wkt::Struct>,
4042 {
4043 self.0.request.end_user_metadata = v.map(|x| x.into());
4044 self
4045 }
4046
4047 pub fn set_search_config<T>(mut self, v: T) -> Self
4049 where
4050 T: std::convert::Into<crate::model::search_knowledge_request::SearchConfig>,
4051 {
4052 self.0.request.search_config = std::option::Option::Some(v.into());
4053 self
4054 }
4055
4056 pub fn set_or_clear_search_config<T>(mut self, v: std::option::Option<T>) -> Self
4058 where
4059 T: std::convert::Into<crate::model::search_knowledge_request::SearchConfig>,
4060 {
4061 self.0.request.search_config = v.map(|x| x.into());
4062 self
4063 }
4064
4065 pub fn set_exact_search<T: Into<bool>>(mut self, v: T) -> Self {
4067 self.0.request.exact_search = v.into();
4068 self
4069 }
4070 }
4071
4072 #[doc(hidden)]
4073 impl gax::options::internal::RequestBuilder for SearchKnowledge {
4074 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4075 &mut self.0.options
4076 }
4077 }
4078
4079 #[derive(Clone, Debug)]
4097 pub struct GenerateSuggestions(RequestBuilder<crate::model::GenerateSuggestionsRequest>);
4098
4099 impl GenerateSuggestions {
4100 pub(crate) fn new(
4101 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4102 ) -> Self {
4103 Self(RequestBuilder::new(stub))
4104 }
4105
4106 pub fn with_request<V: Into<crate::model::GenerateSuggestionsRequest>>(
4108 mut self,
4109 v: V,
4110 ) -> Self {
4111 self.0.request = v.into();
4112 self
4113 }
4114
4115 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4117 self.0.options = v.into();
4118 self
4119 }
4120
4121 pub async fn send(self) -> Result<crate::model::GenerateSuggestionsResponse> {
4123 (*self.0.stub)
4124 .generate_suggestions(self.0.request, self.0.options)
4125 .await
4126 .map(gax::response::Response::into_body)
4127 }
4128
4129 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
4133 self.0.request.conversation = v.into();
4134 self
4135 }
4136
4137 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
4139 self.0.request.latest_message = v.into();
4140 self
4141 }
4142
4143 pub fn set_trigger_events<T, V>(mut self, v: T) -> Self
4145 where
4146 T: std::iter::IntoIterator<Item = V>,
4147 V: std::convert::Into<crate::model::TriggerEvent>,
4148 {
4149 use std::iter::Iterator;
4150 self.0.request.trigger_events = v.into_iter().map(|i| i.into()).collect();
4151 self
4152 }
4153 }
4154
4155 #[doc(hidden)]
4156 impl gax::options::internal::RequestBuilder for GenerateSuggestions {
4157 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4158 &mut self.0.options
4159 }
4160 }
4161
4162 #[derive(Clone, Debug)]
4184 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
4185
4186 impl ListLocations {
4187 pub(crate) fn new(
4188 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4189 ) -> Self {
4190 Self(RequestBuilder::new(stub))
4191 }
4192
4193 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
4195 mut self,
4196 v: V,
4197 ) -> Self {
4198 self.0.request = v.into();
4199 self
4200 }
4201
4202 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4204 self.0.options = v.into();
4205 self
4206 }
4207
4208 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
4210 (*self.0.stub)
4211 .list_locations(self.0.request, self.0.options)
4212 .await
4213 .map(gax::response::Response::into_body)
4214 }
4215
4216 pub fn by_page(
4218 self,
4219 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
4220 {
4221 use std::clone::Clone;
4222 let token = self.0.request.page_token.clone();
4223 let execute = move |token: String| {
4224 let mut builder = self.clone();
4225 builder.0.request = builder.0.request.set_page_token(token);
4226 builder.send()
4227 };
4228 gax::paginator::internal::new_paginator(token, execute)
4229 }
4230
4231 pub fn by_item(
4233 self,
4234 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
4235 {
4236 use gax::paginator::Paginator;
4237 self.by_page().items()
4238 }
4239
4240 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4242 self.0.request.name = v.into();
4243 self
4244 }
4245
4246 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4248 self.0.request.filter = v.into();
4249 self
4250 }
4251
4252 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4254 self.0.request.page_size = v.into();
4255 self
4256 }
4257
4258 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4260 self.0.request.page_token = v.into();
4261 self
4262 }
4263 }
4264
4265 #[doc(hidden)]
4266 impl gax::options::internal::RequestBuilder for ListLocations {
4267 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4268 &mut self.0.options
4269 }
4270 }
4271
4272 #[derive(Clone, Debug)]
4290 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
4291
4292 impl GetLocation {
4293 pub(crate) fn new(
4294 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4295 ) -> Self {
4296 Self(RequestBuilder::new(stub))
4297 }
4298
4299 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
4301 self.0.request = v.into();
4302 self
4303 }
4304
4305 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4307 self.0.options = v.into();
4308 self
4309 }
4310
4311 pub async fn send(self) -> Result<location::model::Location> {
4313 (*self.0.stub)
4314 .get_location(self.0.request, self.0.options)
4315 .await
4316 .map(gax::response::Response::into_body)
4317 }
4318
4319 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4321 self.0.request.name = v.into();
4322 self
4323 }
4324 }
4325
4326 #[doc(hidden)]
4327 impl gax::options::internal::RequestBuilder for GetLocation {
4328 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4329 &mut self.0.options
4330 }
4331 }
4332
4333 #[derive(Clone, Debug)]
4355 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4356
4357 impl ListOperations {
4358 pub(crate) fn new(
4359 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4360 ) -> Self {
4361 Self(RequestBuilder::new(stub))
4362 }
4363
4364 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4366 mut self,
4367 v: V,
4368 ) -> Self {
4369 self.0.request = v.into();
4370 self
4371 }
4372
4373 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4375 self.0.options = v.into();
4376 self
4377 }
4378
4379 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4381 (*self.0.stub)
4382 .list_operations(self.0.request, self.0.options)
4383 .await
4384 .map(gax::response::Response::into_body)
4385 }
4386
4387 pub fn by_page(
4389 self,
4390 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4391 {
4392 use std::clone::Clone;
4393 let token = self.0.request.page_token.clone();
4394 let execute = move |token: String| {
4395 let mut builder = self.clone();
4396 builder.0.request = builder.0.request.set_page_token(token);
4397 builder.send()
4398 };
4399 gax::paginator::internal::new_paginator(token, execute)
4400 }
4401
4402 pub fn by_item(
4404 self,
4405 ) -> impl gax::paginator::ItemPaginator<
4406 longrunning::model::ListOperationsResponse,
4407 gax::error::Error,
4408 > {
4409 use gax::paginator::Paginator;
4410 self.by_page().items()
4411 }
4412
4413 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4415 self.0.request.name = v.into();
4416 self
4417 }
4418
4419 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4421 self.0.request.filter = v.into();
4422 self
4423 }
4424
4425 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4427 self.0.request.page_size = v.into();
4428 self
4429 }
4430
4431 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4433 self.0.request.page_token = v.into();
4434 self
4435 }
4436
4437 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4439 self.0.request.return_partial_success = v.into();
4440 self
4441 }
4442 }
4443
4444 #[doc(hidden)]
4445 impl gax::options::internal::RequestBuilder for ListOperations {
4446 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4447 &mut self.0.options
4448 }
4449 }
4450
4451 #[derive(Clone, Debug)]
4469 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4470
4471 impl GetOperation {
4472 pub(crate) fn new(
4473 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4474 ) -> Self {
4475 Self(RequestBuilder::new(stub))
4476 }
4477
4478 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4480 mut self,
4481 v: V,
4482 ) -> Self {
4483 self.0.request = v.into();
4484 self
4485 }
4486
4487 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4489 self.0.options = v.into();
4490 self
4491 }
4492
4493 pub async fn send(self) -> Result<longrunning::model::Operation> {
4495 (*self.0.stub)
4496 .get_operation(self.0.request, self.0.options)
4497 .await
4498 .map(gax::response::Response::into_body)
4499 }
4500
4501 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4503 self.0.request.name = v.into();
4504 self
4505 }
4506 }
4507
4508 #[doc(hidden)]
4509 impl gax::options::internal::RequestBuilder for GetOperation {
4510 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4511 &mut self.0.options
4512 }
4513 }
4514
4515 #[derive(Clone, Debug)]
4533 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
4534
4535 impl CancelOperation {
4536 pub(crate) fn new(
4537 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4538 ) -> Self {
4539 Self(RequestBuilder::new(stub))
4540 }
4541
4542 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
4544 mut self,
4545 v: V,
4546 ) -> Self {
4547 self.0.request = v.into();
4548 self
4549 }
4550
4551 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4553 self.0.options = v.into();
4554 self
4555 }
4556
4557 pub async fn send(self) -> Result<()> {
4559 (*self.0.stub)
4560 .cancel_operation(self.0.request, self.0.options)
4561 .await
4562 .map(gax::response::Response::into_body)
4563 }
4564
4565 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4567 self.0.request.name = v.into();
4568 self
4569 }
4570 }
4571
4572 #[doc(hidden)]
4573 impl gax::options::internal::RequestBuilder for CancelOperation {
4574 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4575 &mut self.0.options
4576 }
4577 }
4578}
4579
4580#[cfg(feature = "conversation-datasets")]
4581#[cfg_attr(docsrs, doc(cfg(feature = "conversation-datasets")))]
4582pub mod conversation_datasets {
4583 use crate::Result;
4584
4585 pub type ClientBuilder =
4599 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4600
4601 pub(crate) mod client {
4602 use super::super::super::client::ConversationDatasets;
4603 pub struct Factory;
4604 impl gax::client_builder::internal::ClientFactory for Factory {
4605 type Client = ConversationDatasets;
4606 type Credentials = gaxi::options::Credentials;
4607 async fn build(
4608 self,
4609 config: gaxi::options::ClientConfig,
4610 ) -> gax::client_builder::Result<Self::Client> {
4611 Self::Client::new(config).await
4612 }
4613 }
4614 }
4615
4616 #[derive(Clone, Debug)]
4618 pub(crate) struct RequestBuilder<R: std::default::Default> {
4619 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4620 request: R,
4621 options: gax::options::RequestOptions,
4622 }
4623
4624 impl<R> RequestBuilder<R>
4625 where
4626 R: std::default::Default,
4627 {
4628 pub(crate) fn new(
4629 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4630 ) -> Self {
4631 Self {
4632 stub,
4633 request: R::default(),
4634 options: gax::options::RequestOptions::default(),
4635 }
4636 }
4637 }
4638
4639 #[derive(Clone, Debug)]
4658 pub struct CreateConversationDataset(
4659 RequestBuilder<crate::model::CreateConversationDatasetRequest>,
4660 );
4661
4662 impl CreateConversationDataset {
4663 pub(crate) fn new(
4664 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4665 ) -> Self {
4666 Self(RequestBuilder::new(stub))
4667 }
4668
4669 pub fn with_request<V: Into<crate::model::CreateConversationDatasetRequest>>(
4671 mut self,
4672 v: V,
4673 ) -> Self {
4674 self.0.request = v.into();
4675 self
4676 }
4677
4678 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4680 self.0.options = v.into();
4681 self
4682 }
4683
4684 pub async fn send(self) -> Result<longrunning::model::Operation> {
4691 (*self.0.stub)
4692 .create_conversation_dataset(self.0.request, self.0.options)
4693 .await
4694 .map(gax::response::Response::into_body)
4695 }
4696
4697 pub fn poller(
4699 self,
4700 ) -> impl lro::Poller<
4701 crate::model::ConversationDataset,
4702 crate::model::CreateConversationDatasetOperationMetadata,
4703 > {
4704 type Operation = lro::internal::Operation<
4705 crate::model::ConversationDataset,
4706 crate::model::CreateConversationDatasetOperationMetadata,
4707 >;
4708 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4709 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4710
4711 let stub = self.0.stub.clone();
4712 let mut options = self.0.options.clone();
4713 options.set_retry_policy(gax::retry_policy::NeverRetry);
4714 let query = move |name| {
4715 let stub = stub.clone();
4716 let options = options.clone();
4717 async {
4718 let op = GetOperation::new(stub)
4719 .set_name(name)
4720 .with_options(options)
4721 .send()
4722 .await?;
4723 Ok(Operation::new(op))
4724 }
4725 };
4726
4727 let start = move || async {
4728 let op = self.send().await?;
4729 Ok(Operation::new(op))
4730 };
4731
4732 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4733 }
4734
4735 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4739 self.0.request.parent = v.into();
4740 self
4741 }
4742
4743 pub fn set_conversation_dataset<T>(mut self, v: T) -> Self
4747 where
4748 T: std::convert::Into<crate::model::ConversationDataset>,
4749 {
4750 self.0.request.conversation_dataset = std::option::Option::Some(v.into());
4751 self
4752 }
4753
4754 pub fn set_or_clear_conversation_dataset<T>(mut self, v: std::option::Option<T>) -> Self
4758 where
4759 T: std::convert::Into<crate::model::ConversationDataset>,
4760 {
4761 self.0.request.conversation_dataset = v.map(|x| x.into());
4762 self
4763 }
4764 }
4765
4766 #[doc(hidden)]
4767 impl gax::options::internal::RequestBuilder for CreateConversationDataset {
4768 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4769 &mut self.0.options
4770 }
4771 }
4772
4773 #[derive(Clone, Debug)]
4791 pub struct GetConversationDataset(RequestBuilder<crate::model::GetConversationDatasetRequest>);
4792
4793 impl GetConversationDataset {
4794 pub(crate) fn new(
4795 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4796 ) -> Self {
4797 Self(RequestBuilder::new(stub))
4798 }
4799
4800 pub fn with_request<V: Into<crate::model::GetConversationDatasetRequest>>(
4802 mut self,
4803 v: V,
4804 ) -> Self {
4805 self.0.request = v.into();
4806 self
4807 }
4808
4809 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4811 self.0.options = v.into();
4812 self
4813 }
4814
4815 pub async fn send(self) -> Result<crate::model::ConversationDataset> {
4817 (*self.0.stub)
4818 .get_conversation_dataset(self.0.request, self.0.options)
4819 .await
4820 .map(gax::response::Response::into_body)
4821 }
4822
4823 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4827 self.0.request.name = v.into();
4828 self
4829 }
4830 }
4831
4832 #[doc(hidden)]
4833 impl gax::options::internal::RequestBuilder for GetConversationDataset {
4834 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4835 &mut self.0.options
4836 }
4837 }
4838
4839 #[derive(Clone, Debug)]
4861 pub struct ListConversationDatasets(
4862 RequestBuilder<crate::model::ListConversationDatasetsRequest>,
4863 );
4864
4865 impl ListConversationDatasets {
4866 pub(crate) fn new(
4867 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4868 ) -> Self {
4869 Self(RequestBuilder::new(stub))
4870 }
4871
4872 pub fn with_request<V: Into<crate::model::ListConversationDatasetsRequest>>(
4874 mut self,
4875 v: V,
4876 ) -> Self {
4877 self.0.request = v.into();
4878 self
4879 }
4880
4881 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4883 self.0.options = v.into();
4884 self
4885 }
4886
4887 pub async fn send(self) -> Result<crate::model::ListConversationDatasetsResponse> {
4889 (*self.0.stub)
4890 .list_conversation_datasets(self.0.request, self.0.options)
4891 .await
4892 .map(gax::response::Response::into_body)
4893 }
4894
4895 pub fn by_page(
4897 self,
4898 ) -> impl gax::paginator::Paginator<
4899 crate::model::ListConversationDatasetsResponse,
4900 gax::error::Error,
4901 > {
4902 use std::clone::Clone;
4903 let token = self.0.request.page_token.clone();
4904 let execute = move |token: String| {
4905 let mut builder = self.clone();
4906 builder.0.request = builder.0.request.set_page_token(token);
4907 builder.send()
4908 };
4909 gax::paginator::internal::new_paginator(token, execute)
4910 }
4911
4912 pub fn by_item(
4914 self,
4915 ) -> impl gax::paginator::ItemPaginator<
4916 crate::model::ListConversationDatasetsResponse,
4917 gax::error::Error,
4918 > {
4919 use gax::paginator::Paginator;
4920 self.by_page().items()
4921 }
4922
4923 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4927 self.0.request.parent = v.into();
4928 self
4929 }
4930
4931 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4933 self.0.request.page_size = v.into();
4934 self
4935 }
4936
4937 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4939 self.0.request.page_token = v.into();
4940 self
4941 }
4942 }
4943
4944 #[doc(hidden)]
4945 impl gax::options::internal::RequestBuilder for ListConversationDatasets {
4946 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4947 &mut self.0.options
4948 }
4949 }
4950
4951 #[derive(Clone, Debug)]
4970 pub struct DeleteConversationDataset(
4971 RequestBuilder<crate::model::DeleteConversationDatasetRequest>,
4972 );
4973
4974 impl DeleteConversationDataset {
4975 pub(crate) fn new(
4976 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4977 ) -> Self {
4978 Self(RequestBuilder::new(stub))
4979 }
4980
4981 pub fn with_request<V: Into<crate::model::DeleteConversationDatasetRequest>>(
4983 mut self,
4984 v: V,
4985 ) -> Self {
4986 self.0.request = v.into();
4987 self
4988 }
4989
4990 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4992 self.0.options = v.into();
4993 self
4994 }
4995
4996 pub async fn send(self) -> Result<longrunning::model::Operation> {
5003 (*self.0.stub)
5004 .delete_conversation_dataset(self.0.request, self.0.options)
5005 .await
5006 .map(gax::response::Response::into_body)
5007 }
5008
5009 pub fn poller(
5011 self,
5012 ) -> impl lro::Poller<(), crate::model::DeleteConversationDatasetOperationMetadata>
5013 {
5014 type Operation = lro::internal::Operation<
5015 wkt::Empty,
5016 crate::model::DeleteConversationDatasetOperationMetadata,
5017 >;
5018 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5019 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5020
5021 let stub = self.0.stub.clone();
5022 let mut options = self.0.options.clone();
5023 options.set_retry_policy(gax::retry_policy::NeverRetry);
5024 let query = move |name| {
5025 let stub = stub.clone();
5026 let options = options.clone();
5027 async {
5028 let op = GetOperation::new(stub)
5029 .set_name(name)
5030 .with_options(options)
5031 .send()
5032 .await?;
5033 Ok(Operation::new(op))
5034 }
5035 };
5036
5037 let start = move || async {
5038 let op = self.send().await?;
5039 Ok(Operation::new(op))
5040 };
5041
5042 lro::internal::new_unit_response_poller(
5043 polling_error_policy,
5044 polling_backoff_policy,
5045 start,
5046 query,
5047 )
5048 }
5049
5050 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5054 self.0.request.name = v.into();
5055 self
5056 }
5057 }
5058
5059 #[doc(hidden)]
5060 impl gax::options::internal::RequestBuilder for DeleteConversationDataset {
5061 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5062 &mut self.0.options
5063 }
5064 }
5065
5066 #[derive(Clone, Debug)]
5085 pub struct ImportConversationData(RequestBuilder<crate::model::ImportConversationDataRequest>);
5086
5087 impl ImportConversationData {
5088 pub(crate) fn new(
5089 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5090 ) -> Self {
5091 Self(RequestBuilder::new(stub))
5092 }
5093
5094 pub fn with_request<V: Into<crate::model::ImportConversationDataRequest>>(
5096 mut self,
5097 v: V,
5098 ) -> Self {
5099 self.0.request = v.into();
5100 self
5101 }
5102
5103 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5105 self.0.options = v.into();
5106 self
5107 }
5108
5109 pub async fn send(self) -> Result<longrunning::model::Operation> {
5116 (*self.0.stub)
5117 .import_conversation_data(self.0.request, self.0.options)
5118 .await
5119 .map(gax::response::Response::into_body)
5120 }
5121
5122 pub fn poller(
5124 self,
5125 ) -> impl lro::Poller<
5126 crate::model::ImportConversationDataOperationResponse,
5127 crate::model::ImportConversationDataOperationMetadata,
5128 > {
5129 type Operation = lro::internal::Operation<
5130 crate::model::ImportConversationDataOperationResponse,
5131 crate::model::ImportConversationDataOperationMetadata,
5132 >;
5133 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5134 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5135
5136 let stub = self.0.stub.clone();
5137 let mut options = self.0.options.clone();
5138 options.set_retry_policy(gax::retry_policy::NeverRetry);
5139 let query = move |name| {
5140 let stub = stub.clone();
5141 let options = options.clone();
5142 async {
5143 let op = GetOperation::new(stub)
5144 .set_name(name)
5145 .with_options(options)
5146 .send()
5147 .await?;
5148 Ok(Operation::new(op))
5149 }
5150 };
5151
5152 let start = move || async {
5153 let op = self.send().await?;
5154 Ok(Operation::new(op))
5155 };
5156
5157 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5158 }
5159
5160 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5164 self.0.request.name = v.into();
5165 self
5166 }
5167
5168 pub fn set_input_config<T>(mut self, v: T) -> Self
5172 where
5173 T: std::convert::Into<crate::model::InputConfig>,
5174 {
5175 self.0.request.input_config = std::option::Option::Some(v.into());
5176 self
5177 }
5178
5179 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
5183 where
5184 T: std::convert::Into<crate::model::InputConfig>,
5185 {
5186 self.0.request.input_config = v.map(|x| x.into());
5187 self
5188 }
5189 }
5190
5191 #[doc(hidden)]
5192 impl gax::options::internal::RequestBuilder for ImportConversationData {
5193 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5194 &mut self.0.options
5195 }
5196 }
5197
5198 #[derive(Clone, Debug)]
5220 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
5221
5222 impl ListLocations {
5223 pub(crate) fn new(
5224 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5225 ) -> Self {
5226 Self(RequestBuilder::new(stub))
5227 }
5228
5229 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
5231 mut self,
5232 v: V,
5233 ) -> Self {
5234 self.0.request = v.into();
5235 self
5236 }
5237
5238 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5240 self.0.options = v.into();
5241 self
5242 }
5243
5244 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
5246 (*self.0.stub)
5247 .list_locations(self.0.request, self.0.options)
5248 .await
5249 .map(gax::response::Response::into_body)
5250 }
5251
5252 pub fn by_page(
5254 self,
5255 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
5256 {
5257 use std::clone::Clone;
5258 let token = self.0.request.page_token.clone();
5259 let execute = move |token: String| {
5260 let mut builder = self.clone();
5261 builder.0.request = builder.0.request.set_page_token(token);
5262 builder.send()
5263 };
5264 gax::paginator::internal::new_paginator(token, execute)
5265 }
5266
5267 pub fn by_item(
5269 self,
5270 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
5271 {
5272 use gax::paginator::Paginator;
5273 self.by_page().items()
5274 }
5275
5276 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5278 self.0.request.name = v.into();
5279 self
5280 }
5281
5282 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5284 self.0.request.filter = v.into();
5285 self
5286 }
5287
5288 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5290 self.0.request.page_size = v.into();
5291 self
5292 }
5293
5294 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5296 self.0.request.page_token = v.into();
5297 self
5298 }
5299 }
5300
5301 #[doc(hidden)]
5302 impl gax::options::internal::RequestBuilder for ListLocations {
5303 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5304 &mut self.0.options
5305 }
5306 }
5307
5308 #[derive(Clone, Debug)]
5326 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
5327
5328 impl GetLocation {
5329 pub(crate) fn new(
5330 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5331 ) -> Self {
5332 Self(RequestBuilder::new(stub))
5333 }
5334
5335 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
5337 self.0.request = v.into();
5338 self
5339 }
5340
5341 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5343 self.0.options = v.into();
5344 self
5345 }
5346
5347 pub async fn send(self) -> Result<location::model::Location> {
5349 (*self.0.stub)
5350 .get_location(self.0.request, self.0.options)
5351 .await
5352 .map(gax::response::Response::into_body)
5353 }
5354
5355 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5357 self.0.request.name = v.into();
5358 self
5359 }
5360 }
5361
5362 #[doc(hidden)]
5363 impl gax::options::internal::RequestBuilder for GetLocation {
5364 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5365 &mut self.0.options
5366 }
5367 }
5368
5369 #[derive(Clone, Debug)]
5391 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
5392
5393 impl ListOperations {
5394 pub(crate) fn new(
5395 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5396 ) -> Self {
5397 Self(RequestBuilder::new(stub))
5398 }
5399
5400 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
5402 mut self,
5403 v: V,
5404 ) -> Self {
5405 self.0.request = v.into();
5406 self
5407 }
5408
5409 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5411 self.0.options = v.into();
5412 self
5413 }
5414
5415 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
5417 (*self.0.stub)
5418 .list_operations(self.0.request, self.0.options)
5419 .await
5420 .map(gax::response::Response::into_body)
5421 }
5422
5423 pub fn by_page(
5425 self,
5426 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
5427 {
5428 use std::clone::Clone;
5429 let token = self.0.request.page_token.clone();
5430 let execute = move |token: String| {
5431 let mut builder = self.clone();
5432 builder.0.request = builder.0.request.set_page_token(token);
5433 builder.send()
5434 };
5435 gax::paginator::internal::new_paginator(token, execute)
5436 }
5437
5438 pub fn by_item(
5440 self,
5441 ) -> impl gax::paginator::ItemPaginator<
5442 longrunning::model::ListOperationsResponse,
5443 gax::error::Error,
5444 > {
5445 use gax::paginator::Paginator;
5446 self.by_page().items()
5447 }
5448
5449 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5451 self.0.request.name = v.into();
5452 self
5453 }
5454
5455 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5457 self.0.request.filter = v.into();
5458 self
5459 }
5460
5461 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5463 self.0.request.page_size = v.into();
5464 self
5465 }
5466
5467 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5469 self.0.request.page_token = v.into();
5470 self
5471 }
5472
5473 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5475 self.0.request.return_partial_success = v.into();
5476 self
5477 }
5478 }
5479
5480 #[doc(hidden)]
5481 impl gax::options::internal::RequestBuilder for ListOperations {
5482 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5483 &mut self.0.options
5484 }
5485 }
5486
5487 #[derive(Clone, Debug)]
5505 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5506
5507 impl GetOperation {
5508 pub(crate) fn new(
5509 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5510 ) -> Self {
5511 Self(RequestBuilder::new(stub))
5512 }
5513
5514 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5516 mut self,
5517 v: V,
5518 ) -> Self {
5519 self.0.request = v.into();
5520 self
5521 }
5522
5523 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5525 self.0.options = v.into();
5526 self
5527 }
5528
5529 pub async fn send(self) -> Result<longrunning::model::Operation> {
5531 (*self.0.stub)
5532 .get_operation(self.0.request, self.0.options)
5533 .await
5534 .map(gax::response::Response::into_body)
5535 }
5536
5537 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5539 self.0.request.name = v.into();
5540 self
5541 }
5542 }
5543
5544 #[doc(hidden)]
5545 impl gax::options::internal::RequestBuilder for GetOperation {
5546 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5547 &mut self.0.options
5548 }
5549 }
5550
5551 #[derive(Clone, Debug)]
5569 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5570
5571 impl CancelOperation {
5572 pub(crate) fn new(
5573 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5574 ) -> Self {
5575 Self(RequestBuilder::new(stub))
5576 }
5577
5578 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5580 mut self,
5581 v: V,
5582 ) -> Self {
5583 self.0.request = v.into();
5584 self
5585 }
5586
5587 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5589 self.0.options = v.into();
5590 self
5591 }
5592
5593 pub async fn send(self) -> Result<()> {
5595 (*self.0.stub)
5596 .cancel_operation(self.0.request, self.0.options)
5597 .await
5598 .map(gax::response::Response::into_body)
5599 }
5600
5601 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5603 self.0.request.name = v.into();
5604 self
5605 }
5606 }
5607
5608 #[doc(hidden)]
5609 impl gax::options::internal::RequestBuilder for CancelOperation {
5610 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5611 &mut self.0.options
5612 }
5613 }
5614}
5615
5616#[cfg(feature = "conversation-models")]
5617#[cfg_attr(docsrs, doc(cfg(feature = "conversation-models")))]
5618pub mod conversation_models {
5619 use crate::Result;
5620
5621 pub type ClientBuilder =
5635 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5636
5637 pub(crate) mod client {
5638 use super::super::super::client::ConversationModels;
5639 pub struct Factory;
5640 impl gax::client_builder::internal::ClientFactory for Factory {
5641 type Client = ConversationModels;
5642 type Credentials = gaxi::options::Credentials;
5643 async fn build(
5644 self,
5645 config: gaxi::options::ClientConfig,
5646 ) -> gax::client_builder::Result<Self::Client> {
5647 Self::Client::new(config).await
5648 }
5649 }
5650 }
5651
5652 #[derive(Clone, Debug)]
5654 pub(crate) struct RequestBuilder<R: std::default::Default> {
5655 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5656 request: R,
5657 options: gax::options::RequestOptions,
5658 }
5659
5660 impl<R> RequestBuilder<R>
5661 where
5662 R: std::default::Default,
5663 {
5664 pub(crate) fn new(
5665 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5666 ) -> Self {
5667 Self {
5668 stub,
5669 request: R::default(),
5670 options: gax::options::RequestOptions::default(),
5671 }
5672 }
5673 }
5674
5675 #[derive(Clone, Debug)]
5694 pub struct CreateConversationModel(
5695 RequestBuilder<crate::model::CreateConversationModelRequest>,
5696 );
5697
5698 impl CreateConversationModel {
5699 pub(crate) fn new(
5700 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5701 ) -> Self {
5702 Self(RequestBuilder::new(stub))
5703 }
5704
5705 pub fn with_request<V: Into<crate::model::CreateConversationModelRequest>>(
5707 mut self,
5708 v: V,
5709 ) -> Self {
5710 self.0.request = v.into();
5711 self
5712 }
5713
5714 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5716 self.0.options = v.into();
5717 self
5718 }
5719
5720 pub async fn send(self) -> Result<longrunning::model::Operation> {
5727 (*self.0.stub)
5728 .create_conversation_model(self.0.request, self.0.options)
5729 .await
5730 .map(gax::response::Response::into_body)
5731 }
5732
5733 pub fn poller(
5735 self,
5736 ) -> impl lro::Poller<
5737 crate::model::ConversationModel,
5738 crate::model::CreateConversationModelOperationMetadata,
5739 > {
5740 type Operation = lro::internal::Operation<
5741 crate::model::ConversationModel,
5742 crate::model::CreateConversationModelOperationMetadata,
5743 >;
5744 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5745 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5746
5747 let stub = self.0.stub.clone();
5748 let mut options = self.0.options.clone();
5749 options.set_retry_policy(gax::retry_policy::NeverRetry);
5750 let query = move |name| {
5751 let stub = stub.clone();
5752 let options = options.clone();
5753 async {
5754 let op = GetOperation::new(stub)
5755 .set_name(name)
5756 .with_options(options)
5757 .send()
5758 .await?;
5759 Ok(Operation::new(op))
5760 }
5761 };
5762
5763 let start = move || async {
5764 let op = self.send().await?;
5765 Ok(Operation::new(op))
5766 };
5767
5768 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5769 }
5770
5771 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5773 self.0.request.parent = v.into();
5774 self
5775 }
5776
5777 pub fn set_conversation_model<T>(mut self, v: T) -> Self
5781 where
5782 T: std::convert::Into<crate::model::ConversationModel>,
5783 {
5784 self.0.request.conversation_model = std::option::Option::Some(v.into());
5785 self
5786 }
5787
5788 pub fn set_or_clear_conversation_model<T>(mut self, v: std::option::Option<T>) -> Self
5792 where
5793 T: std::convert::Into<crate::model::ConversationModel>,
5794 {
5795 self.0.request.conversation_model = v.map(|x| x.into());
5796 self
5797 }
5798 }
5799
5800 #[doc(hidden)]
5801 impl gax::options::internal::RequestBuilder for CreateConversationModel {
5802 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5803 &mut self.0.options
5804 }
5805 }
5806
5807 #[derive(Clone, Debug)]
5825 pub struct GetConversationModel(RequestBuilder<crate::model::GetConversationModelRequest>);
5826
5827 impl GetConversationModel {
5828 pub(crate) fn new(
5829 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5830 ) -> Self {
5831 Self(RequestBuilder::new(stub))
5832 }
5833
5834 pub fn with_request<V: Into<crate::model::GetConversationModelRequest>>(
5836 mut self,
5837 v: V,
5838 ) -> Self {
5839 self.0.request = v.into();
5840 self
5841 }
5842
5843 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5845 self.0.options = v.into();
5846 self
5847 }
5848
5849 pub async fn send(self) -> Result<crate::model::ConversationModel> {
5851 (*self.0.stub)
5852 .get_conversation_model(self.0.request, self.0.options)
5853 .await
5854 .map(gax::response::Response::into_body)
5855 }
5856
5857 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5861 self.0.request.name = v.into();
5862 self
5863 }
5864 }
5865
5866 #[doc(hidden)]
5867 impl gax::options::internal::RequestBuilder for GetConversationModel {
5868 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5869 &mut self.0.options
5870 }
5871 }
5872
5873 #[derive(Clone, Debug)]
5895 pub struct ListConversationModels(RequestBuilder<crate::model::ListConversationModelsRequest>);
5896
5897 impl ListConversationModels {
5898 pub(crate) fn new(
5899 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5900 ) -> Self {
5901 Self(RequestBuilder::new(stub))
5902 }
5903
5904 pub fn with_request<V: Into<crate::model::ListConversationModelsRequest>>(
5906 mut self,
5907 v: V,
5908 ) -> Self {
5909 self.0.request = v.into();
5910 self
5911 }
5912
5913 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5915 self.0.options = v.into();
5916 self
5917 }
5918
5919 pub async fn send(self) -> Result<crate::model::ListConversationModelsResponse> {
5921 (*self.0.stub)
5922 .list_conversation_models(self.0.request, self.0.options)
5923 .await
5924 .map(gax::response::Response::into_body)
5925 }
5926
5927 pub fn by_page(
5929 self,
5930 ) -> impl gax::paginator::Paginator<
5931 crate::model::ListConversationModelsResponse,
5932 gax::error::Error,
5933 > {
5934 use std::clone::Clone;
5935 let token = self.0.request.page_token.clone();
5936 let execute = move |token: String| {
5937 let mut builder = self.clone();
5938 builder.0.request = builder.0.request.set_page_token(token);
5939 builder.send()
5940 };
5941 gax::paginator::internal::new_paginator(token, execute)
5942 }
5943
5944 pub fn by_item(
5946 self,
5947 ) -> impl gax::paginator::ItemPaginator<
5948 crate::model::ListConversationModelsResponse,
5949 gax::error::Error,
5950 > {
5951 use gax::paginator::Paginator;
5952 self.by_page().items()
5953 }
5954
5955 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5959 self.0.request.parent = v.into();
5960 self
5961 }
5962
5963 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5965 self.0.request.page_size = v.into();
5966 self
5967 }
5968
5969 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5971 self.0.request.page_token = v.into();
5972 self
5973 }
5974 }
5975
5976 #[doc(hidden)]
5977 impl gax::options::internal::RequestBuilder for ListConversationModels {
5978 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5979 &mut self.0.options
5980 }
5981 }
5982
5983 #[derive(Clone, Debug)]
6002 pub struct DeleteConversationModel(
6003 RequestBuilder<crate::model::DeleteConversationModelRequest>,
6004 );
6005
6006 impl DeleteConversationModel {
6007 pub(crate) fn new(
6008 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6009 ) -> Self {
6010 Self(RequestBuilder::new(stub))
6011 }
6012
6013 pub fn with_request<V: Into<crate::model::DeleteConversationModelRequest>>(
6015 mut self,
6016 v: V,
6017 ) -> Self {
6018 self.0.request = v.into();
6019 self
6020 }
6021
6022 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6024 self.0.options = v.into();
6025 self
6026 }
6027
6028 pub async fn send(self) -> Result<longrunning::model::Operation> {
6035 (*self.0.stub)
6036 .delete_conversation_model(self.0.request, self.0.options)
6037 .await
6038 .map(gax::response::Response::into_body)
6039 }
6040
6041 pub fn poller(
6043 self,
6044 ) -> impl lro::Poller<(), crate::model::DeleteConversationModelOperationMetadata> {
6045 type Operation = lro::internal::Operation<
6046 wkt::Empty,
6047 crate::model::DeleteConversationModelOperationMetadata,
6048 >;
6049 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6050 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6051
6052 let stub = self.0.stub.clone();
6053 let mut options = self.0.options.clone();
6054 options.set_retry_policy(gax::retry_policy::NeverRetry);
6055 let query = move |name| {
6056 let stub = stub.clone();
6057 let options = options.clone();
6058 async {
6059 let op = GetOperation::new(stub)
6060 .set_name(name)
6061 .with_options(options)
6062 .send()
6063 .await?;
6064 Ok(Operation::new(op))
6065 }
6066 };
6067
6068 let start = move || async {
6069 let op = self.send().await?;
6070 Ok(Operation::new(op))
6071 };
6072
6073 lro::internal::new_unit_response_poller(
6074 polling_error_policy,
6075 polling_backoff_policy,
6076 start,
6077 query,
6078 )
6079 }
6080
6081 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6085 self.0.request.name = v.into();
6086 self
6087 }
6088 }
6089
6090 #[doc(hidden)]
6091 impl gax::options::internal::RequestBuilder for DeleteConversationModel {
6092 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6093 &mut self.0.options
6094 }
6095 }
6096
6097 #[derive(Clone, Debug)]
6116 pub struct DeployConversationModel(
6117 RequestBuilder<crate::model::DeployConversationModelRequest>,
6118 );
6119
6120 impl DeployConversationModel {
6121 pub(crate) fn new(
6122 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6123 ) -> Self {
6124 Self(RequestBuilder::new(stub))
6125 }
6126
6127 pub fn with_request<V: Into<crate::model::DeployConversationModelRequest>>(
6129 mut self,
6130 v: V,
6131 ) -> Self {
6132 self.0.request = v.into();
6133 self
6134 }
6135
6136 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6138 self.0.options = v.into();
6139 self
6140 }
6141
6142 pub async fn send(self) -> Result<longrunning::model::Operation> {
6149 (*self.0.stub)
6150 .deploy_conversation_model(self.0.request, self.0.options)
6151 .await
6152 .map(gax::response::Response::into_body)
6153 }
6154
6155 pub fn poller(
6157 self,
6158 ) -> impl lro::Poller<(), crate::model::DeployConversationModelOperationMetadata> {
6159 type Operation = lro::internal::Operation<
6160 wkt::Empty,
6161 crate::model::DeployConversationModelOperationMetadata,
6162 >;
6163 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6164 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6165
6166 let stub = self.0.stub.clone();
6167 let mut options = self.0.options.clone();
6168 options.set_retry_policy(gax::retry_policy::NeverRetry);
6169 let query = move |name| {
6170 let stub = stub.clone();
6171 let options = options.clone();
6172 async {
6173 let op = GetOperation::new(stub)
6174 .set_name(name)
6175 .with_options(options)
6176 .send()
6177 .await?;
6178 Ok(Operation::new(op))
6179 }
6180 };
6181
6182 let start = move || async {
6183 let op = self.send().await?;
6184 Ok(Operation::new(op))
6185 };
6186
6187 lro::internal::new_unit_response_poller(
6188 polling_error_policy,
6189 polling_backoff_policy,
6190 start,
6191 query,
6192 )
6193 }
6194
6195 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6199 self.0.request.name = v.into();
6200 self
6201 }
6202 }
6203
6204 #[doc(hidden)]
6205 impl gax::options::internal::RequestBuilder for DeployConversationModel {
6206 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6207 &mut self.0.options
6208 }
6209 }
6210
6211 #[derive(Clone, Debug)]
6230 pub struct UndeployConversationModel(
6231 RequestBuilder<crate::model::UndeployConversationModelRequest>,
6232 );
6233
6234 impl UndeployConversationModel {
6235 pub(crate) fn new(
6236 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6237 ) -> Self {
6238 Self(RequestBuilder::new(stub))
6239 }
6240
6241 pub fn with_request<V: Into<crate::model::UndeployConversationModelRequest>>(
6243 mut self,
6244 v: V,
6245 ) -> Self {
6246 self.0.request = v.into();
6247 self
6248 }
6249
6250 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6252 self.0.options = v.into();
6253 self
6254 }
6255
6256 pub async fn send(self) -> Result<longrunning::model::Operation> {
6263 (*self.0.stub)
6264 .undeploy_conversation_model(self.0.request, self.0.options)
6265 .await
6266 .map(gax::response::Response::into_body)
6267 }
6268
6269 pub fn poller(
6271 self,
6272 ) -> impl lro::Poller<(), crate::model::UndeployConversationModelOperationMetadata>
6273 {
6274 type Operation = lro::internal::Operation<
6275 wkt::Empty,
6276 crate::model::UndeployConversationModelOperationMetadata,
6277 >;
6278 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6279 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6280
6281 let stub = self.0.stub.clone();
6282 let mut options = self.0.options.clone();
6283 options.set_retry_policy(gax::retry_policy::NeverRetry);
6284 let query = move |name| {
6285 let stub = stub.clone();
6286 let options = options.clone();
6287 async {
6288 let op = GetOperation::new(stub)
6289 .set_name(name)
6290 .with_options(options)
6291 .send()
6292 .await?;
6293 Ok(Operation::new(op))
6294 }
6295 };
6296
6297 let start = move || async {
6298 let op = self.send().await?;
6299 Ok(Operation::new(op))
6300 };
6301
6302 lro::internal::new_unit_response_poller(
6303 polling_error_policy,
6304 polling_backoff_policy,
6305 start,
6306 query,
6307 )
6308 }
6309
6310 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6314 self.0.request.name = v.into();
6315 self
6316 }
6317 }
6318
6319 #[doc(hidden)]
6320 impl gax::options::internal::RequestBuilder for UndeployConversationModel {
6321 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6322 &mut self.0.options
6323 }
6324 }
6325
6326 #[derive(Clone, Debug)]
6344 pub struct GetConversationModelEvaluation(
6345 RequestBuilder<crate::model::GetConversationModelEvaluationRequest>,
6346 );
6347
6348 impl GetConversationModelEvaluation {
6349 pub(crate) fn new(
6350 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6351 ) -> Self {
6352 Self(RequestBuilder::new(stub))
6353 }
6354
6355 pub fn with_request<V: Into<crate::model::GetConversationModelEvaluationRequest>>(
6357 mut self,
6358 v: V,
6359 ) -> Self {
6360 self.0.request = v.into();
6361 self
6362 }
6363
6364 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6366 self.0.options = v.into();
6367 self
6368 }
6369
6370 pub async fn send(self) -> Result<crate::model::ConversationModelEvaluation> {
6372 (*self.0.stub)
6373 .get_conversation_model_evaluation(self.0.request, self.0.options)
6374 .await
6375 .map(gax::response::Response::into_body)
6376 }
6377
6378 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6382 self.0.request.name = v.into();
6383 self
6384 }
6385 }
6386
6387 #[doc(hidden)]
6388 impl gax::options::internal::RequestBuilder for GetConversationModelEvaluation {
6389 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6390 &mut self.0.options
6391 }
6392 }
6393
6394 #[derive(Clone, Debug)]
6416 pub struct ListConversationModelEvaluations(
6417 RequestBuilder<crate::model::ListConversationModelEvaluationsRequest>,
6418 );
6419
6420 impl ListConversationModelEvaluations {
6421 pub(crate) fn new(
6422 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6423 ) -> Self {
6424 Self(RequestBuilder::new(stub))
6425 }
6426
6427 pub fn with_request<V: Into<crate::model::ListConversationModelEvaluationsRequest>>(
6429 mut self,
6430 v: V,
6431 ) -> Self {
6432 self.0.request = v.into();
6433 self
6434 }
6435
6436 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6438 self.0.options = v.into();
6439 self
6440 }
6441
6442 pub async fn send(self) -> Result<crate::model::ListConversationModelEvaluationsResponse> {
6444 (*self.0.stub)
6445 .list_conversation_model_evaluations(self.0.request, self.0.options)
6446 .await
6447 .map(gax::response::Response::into_body)
6448 }
6449
6450 pub fn by_page(
6452 self,
6453 ) -> impl gax::paginator::Paginator<
6454 crate::model::ListConversationModelEvaluationsResponse,
6455 gax::error::Error,
6456 > {
6457 use std::clone::Clone;
6458 let token = self.0.request.page_token.clone();
6459 let execute = move |token: String| {
6460 let mut builder = self.clone();
6461 builder.0.request = builder.0.request.set_page_token(token);
6462 builder.send()
6463 };
6464 gax::paginator::internal::new_paginator(token, execute)
6465 }
6466
6467 pub fn by_item(
6469 self,
6470 ) -> impl gax::paginator::ItemPaginator<
6471 crate::model::ListConversationModelEvaluationsResponse,
6472 gax::error::Error,
6473 > {
6474 use gax::paginator::Paginator;
6475 self.by_page().items()
6476 }
6477
6478 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6482 self.0.request.parent = v.into();
6483 self
6484 }
6485
6486 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6488 self.0.request.page_size = v.into();
6489 self
6490 }
6491
6492 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6494 self.0.request.page_token = v.into();
6495 self
6496 }
6497 }
6498
6499 #[doc(hidden)]
6500 impl gax::options::internal::RequestBuilder for ListConversationModelEvaluations {
6501 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6502 &mut self.0.options
6503 }
6504 }
6505
6506 #[derive(Clone, Debug)]
6525 pub struct CreateConversationModelEvaluation(
6526 RequestBuilder<crate::model::CreateConversationModelEvaluationRequest>,
6527 );
6528
6529 impl CreateConversationModelEvaluation {
6530 pub(crate) fn new(
6531 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6532 ) -> Self {
6533 Self(RequestBuilder::new(stub))
6534 }
6535
6536 pub fn with_request<V: Into<crate::model::CreateConversationModelEvaluationRequest>>(
6538 mut self,
6539 v: V,
6540 ) -> Self {
6541 self.0.request = v.into();
6542 self
6543 }
6544
6545 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6547 self.0.options = v.into();
6548 self
6549 }
6550
6551 pub async fn send(self) -> Result<longrunning::model::Operation> {
6558 (*self.0.stub)
6559 .create_conversation_model_evaluation(self.0.request, self.0.options)
6560 .await
6561 .map(gax::response::Response::into_body)
6562 }
6563
6564 pub fn poller(
6566 self,
6567 ) -> impl lro::Poller<
6568 crate::model::ConversationModelEvaluation,
6569 crate::model::CreateConversationModelEvaluationOperationMetadata,
6570 > {
6571 type Operation = lro::internal::Operation<
6572 crate::model::ConversationModelEvaluation,
6573 crate::model::CreateConversationModelEvaluationOperationMetadata,
6574 >;
6575 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6576 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6577
6578 let stub = self.0.stub.clone();
6579 let mut options = self.0.options.clone();
6580 options.set_retry_policy(gax::retry_policy::NeverRetry);
6581 let query = move |name| {
6582 let stub = stub.clone();
6583 let options = options.clone();
6584 async {
6585 let op = GetOperation::new(stub)
6586 .set_name(name)
6587 .with_options(options)
6588 .send()
6589 .await?;
6590 Ok(Operation::new(op))
6591 }
6592 };
6593
6594 let start = move || async {
6595 let op = self.send().await?;
6596 Ok(Operation::new(op))
6597 };
6598
6599 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6600 }
6601
6602 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6606 self.0.request.parent = v.into();
6607 self
6608 }
6609
6610 pub fn set_conversation_model_evaluation<T>(mut self, v: T) -> Self
6614 where
6615 T: std::convert::Into<crate::model::ConversationModelEvaluation>,
6616 {
6617 self.0.request.conversation_model_evaluation = std::option::Option::Some(v.into());
6618 self
6619 }
6620
6621 pub fn set_or_clear_conversation_model_evaluation<T>(
6625 mut self,
6626 v: std::option::Option<T>,
6627 ) -> Self
6628 where
6629 T: std::convert::Into<crate::model::ConversationModelEvaluation>,
6630 {
6631 self.0.request.conversation_model_evaluation = v.map(|x| x.into());
6632 self
6633 }
6634 }
6635
6636 #[doc(hidden)]
6637 impl gax::options::internal::RequestBuilder for CreateConversationModelEvaluation {
6638 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6639 &mut self.0.options
6640 }
6641 }
6642
6643 #[derive(Clone, Debug)]
6665 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
6666
6667 impl ListLocations {
6668 pub(crate) fn new(
6669 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6670 ) -> Self {
6671 Self(RequestBuilder::new(stub))
6672 }
6673
6674 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
6676 mut self,
6677 v: V,
6678 ) -> Self {
6679 self.0.request = v.into();
6680 self
6681 }
6682
6683 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6685 self.0.options = v.into();
6686 self
6687 }
6688
6689 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
6691 (*self.0.stub)
6692 .list_locations(self.0.request, self.0.options)
6693 .await
6694 .map(gax::response::Response::into_body)
6695 }
6696
6697 pub fn by_page(
6699 self,
6700 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
6701 {
6702 use std::clone::Clone;
6703 let token = self.0.request.page_token.clone();
6704 let execute = move |token: String| {
6705 let mut builder = self.clone();
6706 builder.0.request = builder.0.request.set_page_token(token);
6707 builder.send()
6708 };
6709 gax::paginator::internal::new_paginator(token, execute)
6710 }
6711
6712 pub fn by_item(
6714 self,
6715 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
6716 {
6717 use gax::paginator::Paginator;
6718 self.by_page().items()
6719 }
6720
6721 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6723 self.0.request.name = v.into();
6724 self
6725 }
6726
6727 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6729 self.0.request.filter = v.into();
6730 self
6731 }
6732
6733 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6735 self.0.request.page_size = v.into();
6736 self
6737 }
6738
6739 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6741 self.0.request.page_token = v.into();
6742 self
6743 }
6744 }
6745
6746 #[doc(hidden)]
6747 impl gax::options::internal::RequestBuilder for ListLocations {
6748 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6749 &mut self.0.options
6750 }
6751 }
6752
6753 #[derive(Clone, Debug)]
6771 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
6772
6773 impl GetLocation {
6774 pub(crate) fn new(
6775 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6776 ) -> Self {
6777 Self(RequestBuilder::new(stub))
6778 }
6779
6780 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
6782 self.0.request = v.into();
6783 self
6784 }
6785
6786 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6788 self.0.options = v.into();
6789 self
6790 }
6791
6792 pub async fn send(self) -> Result<location::model::Location> {
6794 (*self.0.stub)
6795 .get_location(self.0.request, self.0.options)
6796 .await
6797 .map(gax::response::Response::into_body)
6798 }
6799
6800 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6802 self.0.request.name = v.into();
6803 self
6804 }
6805 }
6806
6807 #[doc(hidden)]
6808 impl gax::options::internal::RequestBuilder for GetLocation {
6809 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6810 &mut self.0.options
6811 }
6812 }
6813
6814 #[derive(Clone, Debug)]
6836 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6837
6838 impl ListOperations {
6839 pub(crate) fn new(
6840 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6841 ) -> Self {
6842 Self(RequestBuilder::new(stub))
6843 }
6844
6845 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6847 mut self,
6848 v: V,
6849 ) -> Self {
6850 self.0.request = v.into();
6851 self
6852 }
6853
6854 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6856 self.0.options = v.into();
6857 self
6858 }
6859
6860 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6862 (*self.0.stub)
6863 .list_operations(self.0.request, self.0.options)
6864 .await
6865 .map(gax::response::Response::into_body)
6866 }
6867
6868 pub fn by_page(
6870 self,
6871 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6872 {
6873 use std::clone::Clone;
6874 let token = self.0.request.page_token.clone();
6875 let execute = move |token: String| {
6876 let mut builder = self.clone();
6877 builder.0.request = builder.0.request.set_page_token(token);
6878 builder.send()
6879 };
6880 gax::paginator::internal::new_paginator(token, execute)
6881 }
6882
6883 pub fn by_item(
6885 self,
6886 ) -> impl gax::paginator::ItemPaginator<
6887 longrunning::model::ListOperationsResponse,
6888 gax::error::Error,
6889 > {
6890 use gax::paginator::Paginator;
6891 self.by_page().items()
6892 }
6893
6894 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6896 self.0.request.name = v.into();
6897 self
6898 }
6899
6900 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6902 self.0.request.filter = v.into();
6903 self
6904 }
6905
6906 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6908 self.0.request.page_size = v.into();
6909 self
6910 }
6911
6912 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6914 self.0.request.page_token = v.into();
6915 self
6916 }
6917
6918 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6920 self.0.request.return_partial_success = v.into();
6921 self
6922 }
6923 }
6924
6925 #[doc(hidden)]
6926 impl gax::options::internal::RequestBuilder for ListOperations {
6927 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6928 &mut self.0.options
6929 }
6930 }
6931
6932 #[derive(Clone, Debug)]
6950 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6951
6952 impl GetOperation {
6953 pub(crate) fn new(
6954 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6955 ) -> Self {
6956 Self(RequestBuilder::new(stub))
6957 }
6958
6959 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6961 mut self,
6962 v: V,
6963 ) -> Self {
6964 self.0.request = v.into();
6965 self
6966 }
6967
6968 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6970 self.0.options = v.into();
6971 self
6972 }
6973
6974 pub async fn send(self) -> Result<longrunning::model::Operation> {
6976 (*self.0.stub)
6977 .get_operation(self.0.request, self.0.options)
6978 .await
6979 .map(gax::response::Response::into_body)
6980 }
6981
6982 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6984 self.0.request.name = v.into();
6985 self
6986 }
6987 }
6988
6989 #[doc(hidden)]
6990 impl gax::options::internal::RequestBuilder for GetOperation {
6991 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6992 &mut self.0.options
6993 }
6994 }
6995
6996 #[derive(Clone, Debug)]
7014 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
7015
7016 impl CancelOperation {
7017 pub(crate) fn new(
7018 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
7019 ) -> Self {
7020 Self(RequestBuilder::new(stub))
7021 }
7022
7023 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
7025 mut self,
7026 v: V,
7027 ) -> Self {
7028 self.0.request = v.into();
7029 self
7030 }
7031
7032 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7034 self.0.options = v.into();
7035 self
7036 }
7037
7038 pub async fn send(self) -> Result<()> {
7040 (*self.0.stub)
7041 .cancel_operation(self.0.request, self.0.options)
7042 .await
7043 .map(gax::response::Response::into_body)
7044 }
7045
7046 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7048 self.0.request.name = v.into();
7049 self
7050 }
7051 }
7052
7053 #[doc(hidden)]
7054 impl gax::options::internal::RequestBuilder for CancelOperation {
7055 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7056 &mut self.0.options
7057 }
7058 }
7059}
7060
7061#[cfg(feature = "conversation-profiles")]
7062#[cfg_attr(docsrs, doc(cfg(feature = "conversation-profiles")))]
7063pub mod conversation_profiles {
7064 use crate::Result;
7065
7066 pub type ClientBuilder =
7080 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7081
7082 pub(crate) mod client {
7083 use super::super::super::client::ConversationProfiles;
7084 pub struct Factory;
7085 impl gax::client_builder::internal::ClientFactory for Factory {
7086 type Client = ConversationProfiles;
7087 type Credentials = gaxi::options::Credentials;
7088 async fn build(
7089 self,
7090 config: gaxi::options::ClientConfig,
7091 ) -> gax::client_builder::Result<Self::Client> {
7092 Self::Client::new(config).await
7093 }
7094 }
7095 }
7096
7097 #[derive(Clone, Debug)]
7099 pub(crate) struct RequestBuilder<R: std::default::Default> {
7100 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7101 request: R,
7102 options: gax::options::RequestOptions,
7103 }
7104
7105 impl<R> RequestBuilder<R>
7106 where
7107 R: std::default::Default,
7108 {
7109 pub(crate) fn new(
7110 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7111 ) -> Self {
7112 Self {
7113 stub,
7114 request: R::default(),
7115 options: gax::options::RequestOptions::default(),
7116 }
7117 }
7118 }
7119
7120 #[derive(Clone, Debug)]
7142 pub struct ListConversationProfiles(
7143 RequestBuilder<crate::model::ListConversationProfilesRequest>,
7144 );
7145
7146 impl ListConversationProfiles {
7147 pub(crate) fn new(
7148 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7149 ) -> Self {
7150 Self(RequestBuilder::new(stub))
7151 }
7152
7153 pub fn with_request<V: Into<crate::model::ListConversationProfilesRequest>>(
7155 mut self,
7156 v: V,
7157 ) -> Self {
7158 self.0.request = v.into();
7159 self
7160 }
7161
7162 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7164 self.0.options = v.into();
7165 self
7166 }
7167
7168 pub async fn send(self) -> Result<crate::model::ListConversationProfilesResponse> {
7170 (*self.0.stub)
7171 .list_conversation_profiles(self.0.request, self.0.options)
7172 .await
7173 .map(gax::response::Response::into_body)
7174 }
7175
7176 pub fn by_page(
7178 self,
7179 ) -> impl gax::paginator::Paginator<
7180 crate::model::ListConversationProfilesResponse,
7181 gax::error::Error,
7182 > {
7183 use std::clone::Clone;
7184 let token = self.0.request.page_token.clone();
7185 let execute = move |token: String| {
7186 let mut builder = self.clone();
7187 builder.0.request = builder.0.request.set_page_token(token);
7188 builder.send()
7189 };
7190 gax::paginator::internal::new_paginator(token, execute)
7191 }
7192
7193 pub fn by_item(
7195 self,
7196 ) -> impl gax::paginator::ItemPaginator<
7197 crate::model::ListConversationProfilesResponse,
7198 gax::error::Error,
7199 > {
7200 use gax::paginator::Paginator;
7201 self.by_page().items()
7202 }
7203
7204 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7208 self.0.request.parent = v.into();
7209 self
7210 }
7211
7212 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7214 self.0.request.page_size = v.into();
7215 self
7216 }
7217
7218 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7220 self.0.request.page_token = v.into();
7221 self
7222 }
7223 }
7224
7225 #[doc(hidden)]
7226 impl gax::options::internal::RequestBuilder for ListConversationProfiles {
7227 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7228 &mut self.0.options
7229 }
7230 }
7231
7232 #[derive(Clone, Debug)]
7250 pub struct GetConversationProfile(RequestBuilder<crate::model::GetConversationProfileRequest>);
7251
7252 impl GetConversationProfile {
7253 pub(crate) fn new(
7254 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7255 ) -> Self {
7256 Self(RequestBuilder::new(stub))
7257 }
7258
7259 pub fn with_request<V: Into<crate::model::GetConversationProfileRequest>>(
7261 mut self,
7262 v: V,
7263 ) -> Self {
7264 self.0.request = v.into();
7265 self
7266 }
7267
7268 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7270 self.0.options = v.into();
7271 self
7272 }
7273
7274 pub async fn send(self) -> Result<crate::model::ConversationProfile> {
7276 (*self.0.stub)
7277 .get_conversation_profile(self.0.request, self.0.options)
7278 .await
7279 .map(gax::response::Response::into_body)
7280 }
7281
7282 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7286 self.0.request.name = v.into();
7287 self
7288 }
7289 }
7290
7291 #[doc(hidden)]
7292 impl gax::options::internal::RequestBuilder for GetConversationProfile {
7293 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7294 &mut self.0.options
7295 }
7296 }
7297
7298 #[derive(Clone, Debug)]
7316 pub struct CreateConversationProfile(
7317 RequestBuilder<crate::model::CreateConversationProfileRequest>,
7318 );
7319
7320 impl CreateConversationProfile {
7321 pub(crate) fn new(
7322 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7323 ) -> Self {
7324 Self(RequestBuilder::new(stub))
7325 }
7326
7327 pub fn with_request<V: Into<crate::model::CreateConversationProfileRequest>>(
7329 mut self,
7330 v: V,
7331 ) -> Self {
7332 self.0.request = v.into();
7333 self
7334 }
7335
7336 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7338 self.0.options = v.into();
7339 self
7340 }
7341
7342 pub async fn send(self) -> Result<crate::model::ConversationProfile> {
7344 (*self.0.stub)
7345 .create_conversation_profile(self.0.request, self.0.options)
7346 .await
7347 .map(gax::response::Response::into_body)
7348 }
7349
7350 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7354 self.0.request.parent = v.into();
7355 self
7356 }
7357
7358 pub fn set_conversation_profile<T>(mut self, v: T) -> Self
7362 where
7363 T: std::convert::Into<crate::model::ConversationProfile>,
7364 {
7365 self.0.request.conversation_profile = std::option::Option::Some(v.into());
7366 self
7367 }
7368
7369 pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
7373 where
7374 T: std::convert::Into<crate::model::ConversationProfile>,
7375 {
7376 self.0.request.conversation_profile = v.map(|x| x.into());
7377 self
7378 }
7379 }
7380
7381 #[doc(hidden)]
7382 impl gax::options::internal::RequestBuilder for CreateConversationProfile {
7383 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7384 &mut self.0.options
7385 }
7386 }
7387
7388 #[derive(Clone, Debug)]
7406 pub struct UpdateConversationProfile(
7407 RequestBuilder<crate::model::UpdateConversationProfileRequest>,
7408 );
7409
7410 impl UpdateConversationProfile {
7411 pub(crate) fn new(
7412 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7413 ) -> Self {
7414 Self(RequestBuilder::new(stub))
7415 }
7416
7417 pub fn with_request<V: Into<crate::model::UpdateConversationProfileRequest>>(
7419 mut self,
7420 v: V,
7421 ) -> Self {
7422 self.0.request = v.into();
7423 self
7424 }
7425
7426 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7428 self.0.options = v.into();
7429 self
7430 }
7431
7432 pub async fn send(self) -> Result<crate::model::ConversationProfile> {
7434 (*self.0.stub)
7435 .update_conversation_profile(self.0.request, self.0.options)
7436 .await
7437 .map(gax::response::Response::into_body)
7438 }
7439
7440 pub fn set_conversation_profile<T>(mut self, v: T) -> Self
7444 where
7445 T: std::convert::Into<crate::model::ConversationProfile>,
7446 {
7447 self.0.request.conversation_profile = std::option::Option::Some(v.into());
7448 self
7449 }
7450
7451 pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
7455 where
7456 T: std::convert::Into<crate::model::ConversationProfile>,
7457 {
7458 self.0.request.conversation_profile = v.map(|x| x.into());
7459 self
7460 }
7461
7462 pub fn set_update_mask<T>(mut self, v: T) -> Self
7466 where
7467 T: std::convert::Into<wkt::FieldMask>,
7468 {
7469 self.0.request.update_mask = std::option::Option::Some(v.into());
7470 self
7471 }
7472
7473 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7477 where
7478 T: std::convert::Into<wkt::FieldMask>,
7479 {
7480 self.0.request.update_mask = v.map(|x| x.into());
7481 self
7482 }
7483 }
7484
7485 #[doc(hidden)]
7486 impl gax::options::internal::RequestBuilder for UpdateConversationProfile {
7487 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7488 &mut self.0.options
7489 }
7490 }
7491
7492 #[derive(Clone, Debug)]
7510 pub struct DeleteConversationProfile(
7511 RequestBuilder<crate::model::DeleteConversationProfileRequest>,
7512 );
7513
7514 impl DeleteConversationProfile {
7515 pub(crate) fn new(
7516 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7517 ) -> Self {
7518 Self(RequestBuilder::new(stub))
7519 }
7520
7521 pub fn with_request<V: Into<crate::model::DeleteConversationProfileRequest>>(
7523 mut self,
7524 v: V,
7525 ) -> Self {
7526 self.0.request = v.into();
7527 self
7528 }
7529
7530 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7532 self.0.options = v.into();
7533 self
7534 }
7535
7536 pub async fn send(self) -> Result<()> {
7538 (*self.0.stub)
7539 .delete_conversation_profile(self.0.request, self.0.options)
7540 .await
7541 .map(gax::response::Response::into_body)
7542 }
7543
7544 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7548 self.0.request.name = v.into();
7549 self
7550 }
7551 }
7552
7553 #[doc(hidden)]
7554 impl gax::options::internal::RequestBuilder for DeleteConversationProfile {
7555 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7556 &mut self.0.options
7557 }
7558 }
7559
7560 #[derive(Clone, Debug)]
7579 pub struct SetSuggestionFeatureConfig(
7580 RequestBuilder<crate::model::SetSuggestionFeatureConfigRequest>,
7581 );
7582
7583 impl SetSuggestionFeatureConfig {
7584 pub(crate) fn new(
7585 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7586 ) -> Self {
7587 Self(RequestBuilder::new(stub))
7588 }
7589
7590 pub fn with_request<V: Into<crate::model::SetSuggestionFeatureConfigRequest>>(
7592 mut self,
7593 v: V,
7594 ) -> Self {
7595 self.0.request = v.into();
7596 self
7597 }
7598
7599 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7601 self.0.options = v.into();
7602 self
7603 }
7604
7605 pub async fn send(self) -> Result<longrunning::model::Operation> {
7612 (*self.0.stub)
7613 .set_suggestion_feature_config(self.0.request, self.0.options)
7614 .await
7615 .map(gax::response::Response::into_body)
7616 }
7617
7618 pub fn poller(
7620 self,
7621 ) -> impl lro::Poller<
7622 crate::model::ConversationProfile,
7623 crate::model::SetSuggestionFeatureConfigOperationMetadata,
7624 > {
7625 type Operation = lro::internal::Operation<
7626 crate::model::ConversationProfile,
7627 crate::model::SetSuggestionFeatureConfigOperationMetadata,
7628 >;
7629 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7630 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7631
7632 let stub = self.0.stub.clone();
7633 let mut options = self.0.options.clone();
7634 options.set_retry_policy(gax::retry_policy::NeverRetry);
7635 let query = move |name| {
7636 let stub = stub.clone();
7637 let options = options.clone();
7638 async {
7639 let op = GetOperation::new(stub)
7640 .set_name(name)
7641 .with_options(options)
7642 .send()
7643 .await?;
7644 Ok(Operation::new(op))
7645 }
7646 };
7647
7648 let start = move || async {
7649 let op = self.send().await?;
7650 Ok(Operation::new(op))
7651 };
7652
7653 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7654 }
7655
7656 pub fn set_conversation_profile<T: Into<std::string::String>>(mut self, v: T) -> Self {
7660 self.0.request.conversation_profile = v.into();
7661 self
7662 }
7663
7664 pub fn set_participant_role<T: Into<crate::model::participant::Role>>(
7668 mut self,
7669 v: T,
7670 ) -> Self {
7671 self.0.request.participant_role = v.into();
7672 self
7673 }
7674
7675 pub fn set_suggestion_feature_config<T>(mut self, v: T) -> Self
7679 where
7680 T: std::convert::Into<
7681 crate::model::human_agent_assistant_config::SuggestionFeatureConfig,
7682 >,
7683 {
7684 self.0.request.suggestion_feature_config = std::option::Option::Some(v.into());
7685 self
7686 }
7687
7688 pub fn set_or_clear_suggestion_feature_config<T>(
7692 mut self,
7693 v: std::option::Option<T>,
7694 ) -> Self
7695 where
7696 T: std::convert::Into<
7697 crate::model::human_agent_assistant_config::SuggestionFeatureConfig,
7698 >,
7699 {
7700 self.0.request.suggestion_feature_config = v.map(|x| x.into());
7701 self
7702 }
7703 }
7704
7705 #[doc(hidden)]
7706 impl gax::options::internal::RequestBuilder for SetSuggestionFeatureConfig {
7707 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7708 &mut self.0.options
7709 }
7710 }
7711
7712 #[derive(Clone, Debug)]
7731 pub struct ClearSuggestionFeatureConfig(
7732 RequestBuilder<crate::model::ClearSuggestionFeatureConfigRequest>,
7733 );
7734
7735 impl ClearSuggestionFeatureConfig {
7736 pub(crate) fn new(
7737 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7738 ) -> Self {
7739 Self(RequestBuilder::new(stub))
7740 }
7741
7742 pub fn with_request<V: Into<crate::model::ClearSuggestionFeatureConfigRequest>>(
7744 mut self,
7745 v: V,
7746 ) -> Self {
7747 self.0.request = v.into();
7748 self
7749 }
7750
7751 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7753 self.0.options = v.into();
7754 self
7755 }
7756
7757 pub async fn send(self) -> Result<longrunning::model::Operation> {
7764 (*self.0.stub)
7765 .clear_suggestion_feature_config(self.0.request, self.0.options)
7766 .await
7767 .map(gax::response::Response::into_body)
7768 }
7769
7770 pub fn poller(
7772 self,
7773 ) -> impl lro::Poller<
7774 crate::model::ConversationProfile,
7775 crate::model::ClearSuggestionFeatureConfigOperationMetadata,
7776 > {
7777 type Operation = lro::internal::Operation<
7778 crate::model::ConversationProfile,
7779 crate::model::ClearSuggestionFeatureConfigOperationMetadata,
7780 >;
7781 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7782 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7783
7784 let stub = self.0.stub.clone();
7785 let mut options = self.0.options.clone();
7786 options.set_retry_policy(gax::retry_policy::NeverRetry);
7787 let query = move |name| {
7788 let stub = stub.clone();
7789 let options = options.clone();
7790 async {
7791 let op = GetOperation::new(stub)
7792 .set_name(name)
7793 .with_options(options)
7794 .send()
7795 .await?;
7796 Ok(Operation::new(op))
7797 }
7798 };
7799
7800 let start = move || async {
7801 let op = self.send().await?;
7802 Ok(Operation::new(op))
7803 };
7804
7805 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7806 }
7807
7808 pub fn set_conversation_profile<T: Into<std::string::String>>(mut self, v: T) -> Self {
7812 self.0.request.conversation_profile = v.into();
7813 self
7814 }
7815
7816 pub fn set_participant_role<T: Into<crate::model::participant::Role>>(
7820 mut self,
7821 v: T,
7822 ) -> Self {
7823 self.0.request.participant_role = v.into();
7824 self
7825 }
7826
7827 pub fn set_suggestion_feature_type<T: Into<crate::model::suggestion_feature::Type>>(
7831 mut self,
7832 v: T,
7833 ) -> Self {
7834 self.0.request.suggestion_feature_type = v.into();
7835 self
7836 }
7837 }
7838
7839 #[doc(hidden)]
7840 impl gax::options::internal::RequestBuilder for ClearSuggestionFeatureConfig {
7841 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7842 &mut self.0.options
7843 }
7844 }
7845
7846 #[derive(Clone, Debug)]
7868 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
7869
7870 impl ListLocations {
7871 pub(crate) fn new(
7872 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7873 ) -> Self {
7874 Self(RequestBuilder::new(stub))
7875 }
7876
7877 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
7879 mut self,
7880 v: V,
7881 ) -> Self {
7882 self.0.request = v.into();
7883 self
7884 }
7885
7886 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7888 self.0.options = v.into();
7889 self
7890 }
7891
7892 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
7894 (*self.0.stub)
7895 .list_locations(self.0.request, self.0.options)
7896 .await
7897 .map(gax::response::Response::into_body)
7898 }
7899
7900 pub fn by_page(
7902 self,
7903 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
7904 {
7905 use std::clone::Clone;
7906 let token = self.0.request.page_token.clone();
7907 let execute = move |token: String| {
7908 let mut builder = self.clone();
7909 builder.0.request = builder.0.request.set_page_token(token);
7910 builder.send()
7911 };
7912 gax::paginator::internal::new_paginator(token, execute)
7913 }
7914
7915 pub fn by_item(
7917 self,
7918 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
7919 {
7920 use gax::paginator::Paginator;
7921 self.by_page().items()
7922 }
7923
7924 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7926 self.0.request.name = v.into();
7927 self
7928 }
7929
7930 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7932 self.0.request.filter = v.into();
7933 self
7934 }
7935
7936 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7938 self.0.request.page_size = v.into();
7939 self
7940 }
7941
7942 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7944 self.0.request.page_token = v.into();
7945 self
7946 }
7947 }
7948
7949 #[doc(hidden)]
7950 impl gax::options::internal::RequestBuilder for ListLocations {
7951 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7952 &mut self.0.options
7953 }
7954 }
7955
7956 #[derive(Clone, Debug)]
7974 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
7975
7976 impl GetLocation {
7977 pub(crate) fn new(
7978 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7979 ) -> Self {
7980 Self(RequestBuilder::new(stub))
7981 }
7982
7983 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
7985 self.0.request = v.into();
7986 self
7987 }
7988
7989 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7991 self.0.options = v.into();
7992 self
7993 }
7994
7995 pub async fn send(self) -> Result<location::model::Location> {
7997 (*self.0.stub)
7998 .get_location(self.0.request, self.0.options)
7999 .await
8000 .map(gax::response::Response::into_body)
8001 }
8002
8003 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8005 self.0.request.name = v.into();
8006 self
8007 }
8008 }
8009
8010 #[doc(hidden)]
8011 impl gax::options::internal::RequestBuilder for GetLocation {
8012 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8013 &mut self.0.options
8014 }
8015 }
8016
8017 #[derive(Clone, Debug)]
8039 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
8040
8041 impl ListOperations {
8042 pub(crate) fn new(
8043 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
8044 ) -> Self {
8045 Self(RequestBuilder::new(stub))
8046 }
8047
8048 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
8050 mut self,
8051 v: V,
8052 ) -> Self {
8053 self.0.request = v.into();
8054 self
8055 }
8056
8057 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8059 self.0.options = v.into();
8060 self
8061 }
8062
8063 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
8065 (*self.0.stub)
8066 .list_operations(self.0.request, self.0.options)
8067 .await
8068 .map(gax::response::Response::into_body)
8069 }
8070
8071 pub fn by_page(
8073 self,
8074 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
8075 {
8076 use std::clone::Clone;
8077 let token = self.0.request.page_token.clone();
8078 let execute = move |token: String| {
8079 let mut builder = self.clone();
8080 builder.0.request = builder.0.request.set_page_token(token);
8081 builder.send()
8082 };
8083 gax::paginator::internal::new_paginator(token, execute)
8084 }
8085
8086 pub fn by_item(
8088 self,
8089 ) -> impl gax::paginator::ItemPaginator<
8090 longrunning::model::ListOperationsResponse,
8091 gax::error::Error,
8092 > {
8093 use gax::paginator::Paginator;
8094 self.by_page().items()
8095 }
8096
8097 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8099 self.0.request.name = v.into();
8100 self
8101 }
8102
8103 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8105 self.0.request.filter = v.into();
8106 self
8107 }
8108
8109 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8111 self.0.request.page_size = v.into();
8112 self
8113 }
8114
8115 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8117 self.0.request.page_token = v.into();
8118 self
8119 }
8120
8121 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8123 self.0.request.return_partial_success = v.into();
8124 self
8125 }
8126 }
8127
8128 #[doc(hidden)]
8129 impl gax::options::internal::RequestBuilder for ListOperations {
8130 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8131 &mut self.0.options
8132 }
8133 }
8134
8135 #[derive(Clone, Debug)]
8153 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8154
8155 impl GetOperation {
8156 pub(crate) fn new(
8157 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
8158 ) -> Self {
8159 Self(RequestBuilder::new(stub))
8160 }
8161
8162 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8164 mut self,
8165 v: V,
8166 ) -> Self {
8167 self.0.request = v.into();
8168 self
8169 }
8170
8171 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8173 self.0.options = v.into();
8174 self
8175 }
8176
8177 pub async fn send(self) -> Result<longrunning::model::Operation> {
8179 (*self.0.stub)
8180 .get_operation(self.0.request, self.0.options)
8181 .await
8182 .map(gax::response::Response::into_body)
8183 }
8184
8185 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8187 self.0.request.name = v.into();
8188 self
8189 }
8190 }
8191
8192 #[doc(hidden)]
8193 impl gax::options::internal::RequestBuilder for GetOperation {
8194 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8195 &mut self.0.options
8196 }
8197 }
8198
8199 #[derive(Clone, Debug)]
8217 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
8218
8219 impl CancelOperation {
8220 pub(crate) fn new(
8221 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
8222 ) -> Self {
8223 Self(RequestBuilder::new(stub))
8224 }
8225
8226 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
8228 mut self,
8229 v: V,
8230 ) -> Self {
8231 self.0.request = v.into();
8232 self
8233 }
8234
8235 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8237 self.0.options = v.into();
8238 self
8239 }
8240
8241 pub async fn send(self) -> Result<()> {
8243 (*self.0.stub)
8244 .cancel_operation(self.0.request, self.0.options)
8245 .await
8246 .map(gax::response::Response::into_body)
8247 }
8248
8249 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8251 self.0.request.name = v.into();
8252 self
8253 }
8254 }
8255
8256 #[doc(hidden)]
8257 impl gax::options::internal::RequestBuilder for CancelOperation {
8258 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8259 &mut self.0.options
8260 }
8261 }
8262}
8263
8264#[cfg(feature = "documents")]
8265#[cfg_attr(docsrs, doc(cfg(feature = "documents")))]
8266pub mod documents {
8267 use crate::Result;
8268
8269 pub type ClientBuilder =
8283 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8284
8285 pub(crate) mod client {
8286 use super::super::super::client::Documents;
8287 pub struct Factory;
8288 impl gax::client_builder::internal::ClientFactory for Factory {
8289 type Client = Documents;
8290 type Credentials = gaxi::options::Credentials;
8291 async fn build(
8292 self,
8293 config: gaxi::options::ClientConfig,
8294 ) -> gax::client_builder::Result<Self::Client> {
8295 Self::Client::new(config).await
8296 }
8297 }
8298 }
8299
8300 #[derive(Clone, Debug)]
8302 pub(crate) struct RequestBuilder<R: std::default::Default> {
8303 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8304 request: R,
8305 options: gax::options::RequestOptions,
8306 }
8307
8308 impl<R> RequestBuilder<R>
8309 where
8310 R: std::default::Default,
8311 {
8312 pub(crate) fn new(
8313 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8314 ) -> Self {
8315 Self {
8316 stub,
8317 request: R::default(),
8318 options: gax::options::RequestOptions::default(),
8319 }
8320 }
8321 }
8322
8323 #[derive(Clone, Debug)]
8345 pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
8346
8347 impl ListDocuments {
8348 pub(crate) fn new(
8349 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8350 ) -> Self {
8351 Self(RequestBuilder::new(stub))
8352 }
8353
8354 pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
8356 self.0.request = v.into();
8357 self
8358 }
8359
8360 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8362 self.0.options = v.into();
8363 self
8364 }
8365
8366 pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
8368 (*self.0.stub)
8369 .list_documents(self.0.request, self.0.options)
8370 .await
8371 .map(gax::response::Response::into_body)
8372 }
8373
8374 pub fn by_page(
8376 self,
8377 ) -> impl gax::paginator::Paginator<crate::model::ListDocumentsResponse, gax::error::Error>
8378 {
8379 use std::clone::Clone;
8380 let token = self.0.request.page_token.clone();
8381 let execute = move |token: String| {
8382 let mut builder = self.clone();
8383 builder.0.request = builder.0.request.set_page_token(token);
8384 builder.send()
8385 };
8386 gax::paginator::internal::new_paginator(token, execute)
8387 }
8388
8389 pub fn by_item(
8391 self,
8392 ) -> impl gax::paginator::ItemPaginator<crate::model::ListDocumentsResponse, gax::error::Error>
8393 {
8394 use gax::paginator::Paginator;
8395 self.by_page().items()
8396 }
8397
8398 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8402 self.0.request.parent = v.into();
8403 self
8404 }
8405
8406 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8408 self.0.request.page_size = v.into();
8409 self
8410 }
8411
8412 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8414 self.0.request.page_token = v.into();
8415 self
8416 }
8417
8418 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8420 self.0.request.filter = v.into();
8421 self
8422 }
8423 }
8424
8425 #[doc(hidden)]
8426 impl gax::options::internal::RequestBuilder for ListDocuments {
8427 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8428 &mut self.0.options
8429 }
8430 }
8431
8432 #[derive(Clone, Debug)]
8450 pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
8451
8452 impl GetDocument {
8453 pub(crate) fn new(
8454 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8455 ) -> Self {
8456 Self(RequestBuilder::new(stub))
8457 }
8458
8459 pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
8461 self.0.request = v.into();
8462 self
8463 }
8464
8465 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8467 self.0.options = v.into();
8468 self
8469 }
8470
8471 pub async fn send(self) -> Result<crate::model::Document> {
8473 (*self.0.stub)
8474 .get_document(self.0.request, self.0.options)
8475 .await
8476 .map(gax::response::Response::into_body)
8477 }
8478
8479 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8483 self.0.request.name = v.into();
8484 self
8485 }
8486 }
8487
8488 #[doc(hidden)]
8489 impl gax::options::internal::RequestBuilder for GetDocument {
8490 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8491 &mut self.0.options
8492 }
8493 }
8494
8495 #[derive(Clone, Debug)]
8514 pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
8515
8516 impl CreateDocument {
8517 pub(crate) fn new(
8518 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8519 ) -> Self {
8520 Self(RequestBuilder::new(stub))
8521 }
8522
8523 pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
8525 self.0.request = v.into();
8526 self
8527 }
8528
8529 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8531 self.0.options = v.into();
8532 self
8533 }
8534
8535 pub async fn send(self) -> Result<longrunning::model::Operation> {
8542 (*self.0.stub)
8543 .create_document(self.0.request, self.0.options)
8544 .await
8545 .map(gax::response::Response::into_body)
8546 }
8547
8548 pub fn poller(
8550 self,
8551 ) -> impl lro::Poller<crate::model::Document, crate::model::KnowledgeOperationMetadata>
8552 {
8553 type Operation = lro::internal::Operation<
8554 crate::model::Document,
8555 crate::model::KnowledgeOperationMetadata,
8556 >;
8557 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8558 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8559
8560 let stub = self.0.stub.clone();
8561 let mut options = self.0.options.clone();
8562 options.set_retry_policy(gax::retry_policy::NeverRetry);
8563 let query = move |name| {
8564 let stub = stub.clone();
8565 let options = options.clone();
8566 async {
8567 let op = GetOperation::new(stub)
8568 .set_name(name)
8569 .with_options(options)
8570 .send()
8571 .await?;
8572 Ok(Operation::new(op))
8573 }
8574 };
8575
8576 let start = move || async {
8577 let op = self.send().await?;
8578 Ok(Operation::new(op))
8579 };
8580
8581 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8582 }
8583
8584 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8588 self.0.request.parent = v.into();
8589 self
8590 }
8591
8592 pub fn set_document<T>(mut self, v: T) -> Self
8596 where
8597 T: std::convert::Into<crate::model::Document>,
8598 {
8599 self.0.request.document = std::option::Option::Some(v.into());
8600 self
8601 }
8602
8603 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
8607 where
8608 T: std::convert::Into<crate::model::Document>,
8609 {
8610 self.0.request.document = v.map(|x| x.into());
8611 self
8612 }
8613 }
8614
8615 #[doc(hidden)]
8616 impl gax::options::internal::RequestBuilder for CreateDocument {
8617 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8618 &mut self.0.options
8619 }
8620 }
8621
8622 #[derive(Clone, Debug)]
8641 pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
8642
8643 impl ImportDocuments {
8644 pub(crate) fn new(
8645 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8646 ) -> Self {
8647 Self(RequestBuilder::new(stub))
8648 }
8649
8650 pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
8652 self.0.request = v.into();
8653 self
8654 }
8655
8656 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8658 self.0.options = v.into();
8659 self
8660 }
8661
8662 pub async fn send(self) -> Result<longrunning::model::Operation> {
8669 (*self.0.stub)
8670 .import_documents(self.0.request, self.0.options)
8671 .await
8672 .map(gax::response::Response::into_body)
8673 }
8674
8675 pub fn poller(
8677 self,
8678 ) -> impl lro::Poller<
8679 crate::model::ImportDocumentsResponse,
8680 crate::model::KnowledgeOperationMetadata,
8681 > {
8682 type Operation = lro::internal::Operation<
8683 crate::model::ImportDocumentsResponse,
8684 crate::model::KnowledgeOperationMetadata,
8685 >;
8686 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8687 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8688
8689 let stub = self.0.stub.clone();
8690 let mut options = self.0.options.clone();
8691 options.set_retry_policy(gax::retry_policy::NeverRetry);
8692 let query = move |name| {
8693 let stub = stub.clone();
8694 let options = options.clone();
8695 async {
8696 let op = GetOperation::new(stub)
8697 .set_name(name)
8698 .with_options(options)
8699 .send()
8700 .await?;
8701 Ok(Operation::new(op))
8702 }
8703 };
8704
8705 let start = move || async {
8706 let op = self.send().await?;
8707 Ok(Operation::new(op))
8708 };
8709
8710 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8711 }
8712
8713 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8717 self.0.request.parent = v.into();
8718 self
8719 }
8720
8721 pub fn set_document_template<T>(mut self, v: T) -> Self
8725 where
8726 T: std::convert::Into<crate::model::ImportDocumentTemplate>,
8727 {
8728 self.0.request.document_template = std::option::Option::Some(v.into());
8729 self
8730 }
8731
8732 pub fn set_or_clear_document_template<T>(mut self, v: std::option::Option<T>) -> Self
8736 where
8737 T: std::convert::Into<crate::model::ImportDocumentTemplate>,
8738 {
8739 self.0.request.document_template = v.map(|x| x.into());
8740 self
8741 }
8742
8743 pub fn set_import_gcs_custom_metadata<T: Into<bool>>(mut self, v: T) -> Self {
8745 self.0.request.import_gcs_custom_metadata = v.into();
8746 self
8747 }
8748
8749 pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
8754 mut self,
8755 v: T,
8756 ) -> Self {
8757 self.0.request.source = v.into();
8758 self
8759 }
8760
8761 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSources>>>(
8767 mut self,
8768 v: T,
8769 ) -> Self {
8770 self.0.request = self.0.request.set_gcs_source(v);
8771 self
8772 }
8773 }
8774
8775 #[doc(hidden)]
8776 impl gax::options::internal::RequestBuilder for ImportDocuments {
8777 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8778 &mut self.0.options
8779 }
8780 }
8781
8782 #[derive(Clone, Debug)]
8801 pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
8802
8803 impl DeleteDocument {
8804 pub(crate) fn new(
8805 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8806 ) -> Self {
8807 Self(RequestBuilder::new(stub))
8808 }
8809
8810 pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
8812 self.0.request = v.into();
8813 self
8814 }
8815
8816 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8818 self.0.options = v.into();
8819 self
8820 }
8821
8822 pub async fn send(self) -> Result<longrunning::model::Operation> {
8829 (*self.0.stub)
8830 .delete_document(self.0.request, self.0.options)
8831 .await
8832 .map(gax::response::Response::into_body)
8833 }
8834
8835 pub fn poller(self) -> impl lro::Poller<(), crate::model::KnowledgeOperationMetadata> {
8837 type Operation =
8838 lro::internal::Operation<wkt::Empty, crate::model::KnowledgeOperationMetadata>;
8839 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8840 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8841
8842 let stub = self.0.stub.clone();
8843 let mut options = self.0.options.clone();
8844 options.set_retry_policy(gax::retry_policy::NeverRetry);
8845 let query = move |name| {
8846 let stub = stub.clone();
8847 let options = options.clone();
8848 async {
8849 let op = GetOperation::new(stub)
8850 .set_name(name)
8851 .with_options(options)
8852 .send()
8853 .await?;
8854 Ok(Operation::new(op))
8855 }
8856 };
8857
8858 let start = move || async {
8859 let op = self.send().await?;
8860 Ok(Operation::new(op))
8861 };
8862
8863 lro::internal::new_unit_response_poller(
8864 polling_error_policy,
8865 polling_backoff_policy,
8866 start,
8867 query,
8868 )
8869 }
8870
8871 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8875 self.0.request.name = v.into();
8876 self
8877 }
8878 }
8879
8880 #[doc(hidden)]
8881 impl gax::options::internal::RequestBuilder for DeleteDocument {
8882 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8883 &mut self.0.options
8884 }
8885 }
8886
8887 #[derive(Clone, Debug)]
8906 pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
8907
8908 impl UpdateDocument {
8909 pub(crate) fn new(
8910 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8911 ) -> Self {
8912 Self(RequestBuilder::new(stub))
8913 }
8914
8915 pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
8917 self.0.request = v.into();
8918 self
8919 }
8920
8921 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8923 self.0.options = v.into();
8924 self
8925 }
8926
8927 pub async fn send(self) -> Result<longrunning::model::Operation> {
8934 (*self.0.stub)
8935 .update_document(self.0.request, self.0.options)
8936 .await
8937 .map(gax::response::Response::into_body)
8938 }
8939
8940 pub fn poller(
8942 self,
8943 ) -> impl lro::Poller<crate::model::Document, crate::model::KnowledgeOperationMetadata>
8944 {
8945 type Operation = lro::internal::Operation<
8946 crate::model::Document,
8947 crate::model::KnowledgeOperationMetadata,
8948 >;
8949 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8950 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8951
8952 let stub = self.0.stub.clone();
8953 let mut options = self.0.options.clone();
8954 options.set_retry_policy(gax::retry_policy::NeverRetry);
8955 let query = move |name| {
8956 let stub = stub.clone();
8957 let options = options.clone();
8958 async {
8959 let op = GetOperation::new(stub)
8960 .set_name(name)
8961 .with_options(options)
8962 .send()
8963 .await?;
8964 Ok(Operation::new(op))
8965 }
8966 };
8967
8968 let start = move || async {
8969 let op = self.send().await?;
8970 Ok(Operation::new(op))
8971 };
8972
8973 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8974 }
8975
8976 pub fn set_document<T>(mut self, v: T) -> Self
8980 where
8981 T: std::convert::Into<crate::model::Document>,
8982 {
8983 self.0.request.document = std::option::Option::Some(v.into());
8984 self
8985 }
8986
8987 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
8991 where
8992 T: std::convert::Into<crate::model::Document>,
8993 {
8994 self.0.request.document = v.map(|x| x.into());
8995 self
8996 }
8997
8998 pub fn set_update_mask<T>(mut self, v: T) -> Self
9000 where
9001 T: std::convert::Into<wkt::FieldMask>,
9002 {
9003 self.0.request.update_mask = std::option::Option::Some(v.into());
9004 self
9005 }
9006
9007 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9009 where
9010 T: std::convert::Into<wkt::FieldMask>,
9011 {
9012 self.0.request.update_mask = v.map(|x| x.into());
9013 self
9014 }
9015 }
9016
9017 #[doc(hidden)]
9018 impl gax::options::internal::RequestBuilder for UpdateDocument {
9019 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9020 &mut self.0.options
9021 }
9022 }
9023
9024 #[derive(Clone, Debug)]
9043 pub struct ReloadDocument(RequestBuilder<crate::model::ReloadDocumentRequest>);
9044
9045 impl ReloadDocument {
9046 pub(crate) fn new(
9047 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9048 ) -> Self {
9049 Self(RequestBuilder::new(stub))
9050 }
9051
9052 pub fn with_request<V: Into<crate::model::ReloadDocumentRequest>>(mut self, v: V) -> Self {
9054 self.0.request = v.into();
9055 self
9056 }
9057
9058 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9060 self.0.options = v.into();
9061 self
9062 }
9063
9064 pub async fn send(self) -> Result<longrunning::model::Operation> {
9071 (*self.0.stub)
9072 .reload_document(self.0.request, self.0.options)
9073 .await
9074 .map(gax::response::Response::into_body)
9075 }
9076
9077 pub fn poller(
9079 self,
9080 ) -> impl lro::Poller<crate::model::Document, crate::model::KnowledgeOperationMetadata>
9081 {
9082 type Operation = lro::internal::Operation<
9083 crate::model::Document,
9084 crate::model::KnowledgeOperationMetadata,
9085 >;
9086 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9087 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9088
9089 let stub = self.0.stub.clone();
9090 let mut options = self.0.options.clone();
9091 options.set_retry_policy(gax::retry_policy::NeverRetry);
9092 let query = move |name| {
9093 let stub = stub.clone();
9094 let options = options.clone();
9095 async {
9096 let op = GetOperation::new(stub)
9097 .set_name(name)
9098 .with_options(options)
9099 .send()
9100 .await?;
9101 Ok(Operation::new(op))
9102 }
9103 };
9104
9105 let start = move || async {
9106 let op = self.send().await?;
9107 Ok(Operation::new(op))
9108 };
9109
9110 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
9111 }
9112
9113 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9117 self.0.request.name = v.into();
9118 self
9119 }
9120
9121 pub fn set_import_gcs_custom_metadata<T: Into<bool>>(mut self, v: T) -> Self {
9123 self.0.request.import_gcs_custom_metadata = v.into();
9124 self
9125 }
9126
9127 pub fn set_smart_messaging_partial_update<T: Into<bool>>(mut self, v: T) -> Self {
9129 self.0.request.smart_messaging_partial_update = v.into();
9130 self
9131 }
9132
9133 pub fn set_source<T: Into<Option<crate::model::reload_document_request::Source>>>(
9138 mut self,
9139 v: T,
9140 ) -> Self {
9141 self.0.request.source = v.into();
9142 self
9143 }
9144
9145 pub fn set_content_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9151 self.0.request = self.0.request.set_content_uri(v);
9152 self
9153 }
9154 }
9155
9156 #[doc(hidden)]
9157 impl gax::options::internal::RequestBuilder for ReloadDocument {
9158 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9159 &mut self.0.options
9160 }
9161 }
9162
9163 #[derive(Clone, Debug)]
9182 pub struct ExportDocument(RequestBuilder<crate::model::ExportDocumentRequest>);
9183
9184 impl ExportDocument {
9185 pub(crate) fn new(
9186 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9187 ) -> Self {
9188 Self(RequestBuilder::new(stub))
9189 }
9190
9191 pub fn with_request<V: Into<crate::model::ExportDocumentRequest>>(mut self, v: V) -> Self {
9193 self.0.request = v.into();
9194 self
9195 }
9196
9197 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9199 self.0.options = v.into();
9200 self
9201 }
9202
9203 pub async fn send(self) -> Result<longrunning::model::Operation> {
9210 (*self.0.stub)
9211 .export_document(self.0.request, self.0.options)
9212 .await
9213 .map(gax::response::Response::into_body)
9214 }
9215
9216 pub fn poller(
9218 self,
9219 ) -> impl lro::Poller<crate::model::Document, crate::model::KnowledgeOperationMetadata>
9220 {
9221 type Operation = lro::internal::Operation<
9222 crate::model::Document,
9223 crate::model::KnowledgeOperationMetadata,
9224 >;
9225 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9226 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9227
9228 let stub = self.0.stub.clone();
9229 let mut options = self.0.options.clone();
9230 options.set_retry_policy(gax::retry_policy::NeverRetry);
9231 let query = move |name| {
9232 let stub = stub.clone();
9233 let options = options.clone();
9234 async {
9235 let op = GetOperation::new(stub)
9236 .set_name(name)
9237 .with_options(options)
9238 .send()
9239 .await?;
9240 Ok(Operation::new(op))
9241 }
9242 };
9243
9244 let start = move || async {
9245 let op = self.send().await?;
9246 Ok(Operation::new(op))
9247 };
9248
9249 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
9250 }
9251
9252 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9256 self.0.request.name = v.into();
9257 self
9258 }
9259
9260 pub fn set_export_full_content<T: Into<bool>>(mut self, v: T) -> Self {
9262 self.0.request.export_full_content = v.into();
9263 self
9264 }
9265
9266 pub fn set_smart_messaging_partial_update<T: Into<bool>>(mut self, v: T) -> Self {
9268 self.0.request.smart_messaging_partial_update = v.into();
9269 self
9270 }
9271
9272 pub fn set_destination<
9277 T: Into<Option<crate::model::export_document_request::Destination>>,
9278 >(
9279 mut self,
9280 v: T,
9281 ) -> Self {
9282 self.0.request.destination = v.into();
9283 self
9284 }
9285
9286 pub fn set_gcs_destination<
9292 T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
9293 >(
9294 mut self,
9295 v: T,
9296 ) -> Self {
9297 self.0.request = self.0.request.set_gcs_destination(v);
9298 self
9299 }
9300 }
9301
9302 #[doc(hidden)]
9303 impl gax::options::internal::RequestBuilder for ExportDocument {
9304 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9305 &mut self.0.options
9306 }
9307 }
9308
9309 #[derive(Clone, Debug)]
9331 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
9332
9333 impl ListLocations {
9334 pub(crate) fn new(
9335 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9336 ) -> Self {
9337 Self(RequestBuilder::new(stub))
9338 }
9339
9340 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
9342 mut self,
9343 v: V,
9344 ) -> Self {
9345 self.0.request = v.into();
9346 self
9347 }
9348
9349 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9351 self.0.options = v.into();
9352 self
9353 }
9354
9355 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
9357 (*self.0.stub)
9358 .list_locations(self.0.request, self.0.options)
9359 .await
9360 .map(gax::response::Response::into_body)
9361 }
9362
9363 pub fn by_page(
9365 self,
9366 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
9367 {
9368 use std::clone::Clone;
9369 let token = self.0.request.page_token.clone();
9370 let execute = move |token: String| {
9371 let mut builder = self.clone();
9372 builder.0.request = builder.0.request.set_page_token(token);
9373 builder.send()
9374 };
9375 gax::paginator::internal::new_paginator(token, execute)
9376 }
9377
9378 pub fn by_item(
9380 self,
9381 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
9382 {
9383 use gax::paginator::Paginator;
9384 self.by_page().items()
9385 }
9386
9387 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9389 self.0.request.name = v.into();
9390 self
9391 }
9392
9393 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9395 self.0.request.filter = v.into();
9396 self
9397 }
9398
9399 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9401 self.0.request.page_size = v.into();
9402 self
9403 }
9404
9405 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9407 self.0.request.page_token = v.into();
9408 self
9409 }
9410 }
9411
9412 #[doc(hidden)]
9413 impl gax::options::internal::RequestBuilder for ListLocations {
9414 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9415 &mut self.0.options
9416 }
9417 }
9418
9419 #[derive(Clone, Debug)]
9437 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
9438
9439 impl GetLocation {
9440 pub(crate) fn new(
9441 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9442 ) -> Self {
9443 Self(RequestBuilder::new(stub))
9444 }
9445
9446 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
9448 self.0.request = v.into();
9449 self
9450 }
9451
9452 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9454 self.0.options = v.into();
9455 self
9456 }
9457
9458 pub async fn send(self) -> Result<location::model::Location> {
9460 (*self.0.stub)
9461 .get_location(self.0.request, self.0.options)
9462 .await
9463 .map(gax::response::Response::into_body)
9464 }
9465
9466 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9468 self.0.request.name = v.into();
9469 self
9470 }
9471 }
9472
9473 #[doc(hidden)]
9474 impl gax::options::internal::RequestBuilder for GetLocation {
9475 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9476 &mut self.0.options
9477 }
9478 }
9479
9480 #[derive(Clone, Debug)]
9502 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9503
9504 impl ListOperations {
9505 pub(crate) fn new(
9506 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9507 ) -> Self {
9508 Self(RequestBuilder::new(stub))
9509 }
9510
9511 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9513 mut self,
9514 v: V,
9515 ) -> Self {
9516 self.0.request = v.into();
9517 self
9518 }
9519
9520 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9522 self.0.options = v.into();
9523 self
9524 }
9525
9526 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9528 (*self.0.stub)
9529 .list_operations(self.0.request, self.0.options)
9530 .await
9531 .map(gax::response::Response::into_body)
9532 }
9533
9534 pub fn by_page(
9536 self,
9537 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9538 {
9539 use std::clone::Clone;
9540 let token = self.0.request.page_token.clone();
9541 let execute = move |token: String| {
9542 let mut builder = self.clone();
9543 builder.0.request = builder.0.request.set_page_token(token);
9544 builder.send()
9545 };
9546 gax::paginator::internal::new_paginator(token, execute)
9547 }
9548
9549 pub fn by_item(
9551 self,
9552 ) -> impl gax::paginator::ItemPaginator<
9553 longrunning::model::ListOperationsResponse,
9554 gax::error::Error,
9555 > {
9556 use gax::paginator::Paginator;
9557 self.by_page().items()
9558 }
9559
9560 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9562 self.0.request.name = v.into();
9563 self
9564 }
9565
9566 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9568 self.0.request.filter = v.into();
9569 self
9570 }
9571
9572 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9574 self.0.request.page_size = v.into();
9575 self
9576 }
9577
9578 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9580 self.0.request.page_token = v.into();
9581 self
9582 }
9583
9584 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9586 self.0.request.return_partial_success = v.into();
9587 self
9588 }
9589 }
9590
9591 #[doc(hidden)]
9592 impl gax::options::internal::RequestBuilder for ListOperations {
9593 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9594 &mut self.0.options
9595 }
9596 }
9597
9598 #[derive(Clone, Debug)]
9616 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9617
9618 impl GetOperation {
9619 pub(crate) fn new(
9620 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9621 ) -> Self {
9622 Self(RequestBuilder::new(stub))
9623 }
9624
9625 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9627 mut self,
9628 v: V,
9629 ) -> Self {
9630 self.0.request = v.into();
9631 self
9632 }
9633
9634 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9636 self.0.options = v.into();
9637 self
9638 }
9639
9640 pub async fn send(self) -> Result<longrunning::model::Operation> {
9642 (*self.0.stub)
9643 .get_operation(self.0.request, self.0.options)
9644 .await
9645 .map(gax::response::Response::into_body)
9646 }
9647
9648 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9650 self.0.request.name = v.into();
9651 self
9652 }
9653 }
9654
9655 #[doc(hidden)]
9656 impl gax::options::internal::RequestBuilder for GetOperation {
9657 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9658 &mut self.0.options
9659 }
9660 }
9661
9662 #[derive(Clone, Debug)]
9680 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9681
9682 impl CancelOperation {
9683 pub(crate) fn new(
9684 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9685 ) -> Self {
9686 Self(RequestBuilder::new(stub))
9687 }
9688
9689 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9691 mut self,
9692 v: V,
9693 ) -> Self {
9694 self.0.request = v.into();
9695 self
9696 }
9697
9698 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9700 self.0.options = v.into();
9701 self
9702 }
9703
9704 pub async fn send(self) -> Result<()> {
9706 (*self.0.stub)
9707 .cancel_operation(self.0.request, self.0.options)
9708 .await
9709 .map(gax::response::Response::into_body)
9710 }
9711
9712 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9714 self.0.request.name = v.into();
9715 self
9716 }
9717 }
9718
9719 #[doc(hidden)]
9720 impl gax::options::internal::RequestBuilder for CancelOperation {
9721 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9722 &mut self.0.options
9723 }
9724 }
9725}
9726
9727#[cfg(feature = "encryption-spec-service")]
9728#[cfg_attr(docsrs, doc(cfg(feature = "encryption-spec-service")))]
9729pub mod encryption_spec_service {
9730 use crate::Result;
9731
9732 pub type ClientBuilder =
9746 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9747
9748 pub(crate) mod client {
9749 use super::super::super::client::EncryptionSpecService;
9750 pub struct Factory;
9751 impl gax::client_builder::internal::ClientFactory for Factory {
9752 type Client = EncryptionSpecService;
9753 type Credentials = gaxi::options::Credentials;
9754 async fn build(
9755 self,
9756 config: gaxi::options::ClientConfig,
9757 ) -> gax::client_builder::Result<Self::Client> {
9758 Self::Client::new(config).await
9759 }
9760 }
9761 }
9762
9763 #[derive(Clone, Debug)]
9765 pub(crate) struct RequestBuilder<R: std::default::Default> {
9766 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9767 request: R,
9768 options: gax::options::RequestOptions,
9769 }
9770
9771 impl<R> RequestBuilder<R>
9772 where
9773 R: std::default::Default,
9774 {
9775 pub(crate) fn new(
9776 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9777 ) -> Self {
9778 Self {
9779 stub,
9780 request: R::default(),
9781 options: gax::options::RequestOptions::default(),
9782 }
9783 }
9784 }
9785
9786 #[derive(Clone, Debug)]
9804 pub struct GetEncryptionSpec(RequestBuilder<crate::model::GetEncryptionSpecRequest>);
9805
9806 impl GetEncryptionSpec {
9807 pub(crate) fn new(
9808 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9809 ) -> Self {
9810 Self(RequestBuilder::new(stub))
9811 }
9812
9813 pub fn with_request<V: Into<crate::model::GetEncryptionSpecRequest>>(
9815 mut self,
9816 v: V,
9817 ) -> Self {
9818 self.0.request = v.into();
9819 self
9820 }
9821
9822 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9824 self.0.options = v.into();
9825 self
9826 }
9827
9828 pub async fn send(self) -> Result<crate::model::EncryptionSpec> {
9830 (*self.0.stub)
9831 .get_encryption_spec(self.0.request, self.0.options)
9832 .await
9833 .map(gax::response::Response::into_body)
9834 }
9835
9836 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9840 self.0.request.name = v.into();
9841 self
9842 }
9843 }
9844
9845 #[doc(hidden)]
9846 impl gax::options::internal::RequestBuilder for GetEncryptionSpec {
9847 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9848 &mut self.0.options
9849 }
9850 }
9851
9852 #[derive(Clone, Debug)]
9871 pub struct InitializeEncryptionSpec(
9872 RequestBuilder<crate::model::InitializeEncryptionSpecRequest>,
9873 );
9874
9875 impl InitializeEncryptionSpec {
9876 pub(crate) fn new(
9877 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9878 ) -> Self {
9879 Self(RequestBuilder::new(stub))
9880 }
9881
9882 pub fn with_request<V: Into<crate::model::InitializeEncryptionSpecRequest>>(
9884 mut self,
9885 v: V,
9886 ) -> Self {
9887 self.0.request = v.into();
9888 self
9889 }
9890
9891 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9893 self.0.options = v.into();
9894 self
9895 }
9896
9897 pub async fn send(self) -> Result<longrunning::model::Operation> {
9904 (*self.0.stub)
9905 .initialize_encryption_spec(self.0.request, self.0.options)
9906 .await
9907 .map(gax::response::Response::into_body)
9908 }
9909
9910 pub fn poller(
9912 self,
9913 ) -> impl lro::Poller<
9914 crate::model::InitializeEncryptionSpecResponse,
9915 crate::model::InitializeEncryptionSpecMetadata,
9916 > {
9917 type Operation = lro::internal::Operation<
9918 crate::model::InitializeEncryptionSpecResponse,
9919 crate::model::InitializeEncryptionSpecMetadata,
9920 >;
9921 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9922 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9923
9924 let stub = self.0.stub.clone();
9925 let mut options = self.0.options.clone();
9926 options.set_retry_policy(gax::retry_policy::NeverRetry);
9927 let query = move |name| {
9928 let stub = stub.clone();
9929 let options = options.clone();
9930 async {
9931 let op = GetOperation::new(stub)
9932 .set_name(name)
9933 .with_options(options)
9934 .send()
9935 .await?;
9936 Ok(Operation::new(op))
9937 }
9938 };
9939
9940 let start = move || async {
9941 let op = self.send().await?;
9942 Ok(Operation::new(op))
9943 };
9944
9945 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
9946 }
9947
9948 pub fn set_encryption_spec<T>(mut self, v: T) -> Self
9952 where
9953 T: std::convert::Into<crate::model::EncryptionSpec>,
9954 {
9955 self.0.request.encryption_spec = std::option::Option::Some(v.into());
9956 self
9957 }
9958
9959 pub fn set_or_clear_encryption_spec<T>(mut self, v: std::option::Option<T>) -> Self
9963 where
9964 T: std::convert::Into<crate::model::EncryptionSpec>,
9965 {
9966 self.0.request.encryption_spec = v.map(|x| x.into());
9967 self
9968 }
9969 }
9970
9971 #[doc(hidden)]
9972 impl gax::options::internal::RequestBuilder for InitializeEncryptionSpec {
9973 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9974 &mut self.0.options
9975 }
9976 }
9977
9978 #[derive(Clone, Debug)]
10000 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
10001
10002 impl ListLocations {
10003 pub(crate) fn new(
10004 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10005 ) -> Self {
10006 Self(RequestBuilder::new(stub))
10007 }
10008
10009 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
10011 mut self,
10012 v: V,
10013 ) -> Self {
10014 self.0.request = v.into();
10015 self
10016 }
10017
10018 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10020 self.0.options = v.into();
10021 self
10022 }
10023
10024 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
10026 (*self.0.stub)
10027 .list_locations(self.0.request, self.0.options)
10028 .await
10029 .map(gax::response::Response::into_body)
10030 }
10031
10032 pub fn by_page(
10034 self,
10035 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
10036 {
10037 use std::clone::Clone;
10038 let token = self.0.request.page_token.clone();
10039 let execute = move |token: String| {
10040 let mut builder = self.clone();
10041 builder.0.request = builder.0.request.set_page_token(token);
10042 builder.send()
10043 };
10044 gax::paginator::internal::new_paginator(token, execute)
10045 }
10046
10047 pub fn by_item(
10049 self,
10050 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
10051 {
10052 use gax::paginator::Paginator;
10053 self.by_page().items()
10054 }
10055
10056 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10058 self.0.request.name = v.into();
10059 self
10060 }
10061
10062 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10064 self.0.request.filter = v.into();
10065 self
10066 }
10067
10068 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10070 self.0.request.page_size = v.into();
10071 self
10072 }
10073
10074 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10076 self.0.request.page_token = v.into();
10077 self
10078 }
10079 }
10080
10081 #[doc(hidden)]
10082 impl gax::options::internal::RequestBuilder for ListLocations {
10083 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10084 &mut self.0.options
10085 }
10086 }
10087
10088 #[derive(Clone, Debug)]
10106 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
10107
10108 impl GetLocation {
10109 pub(crate) fn new(
10110 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10111 ) -> Self {
10112 Self(RequestBuilder::new(stub))
10113 }
10114
10115 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
10117 self.0.request = v.into();
10118 self
10119 }
10120
10121 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10123 self.0.options = v.into();
10124 self
10125 }
10126
10127 pub async fn send(self) -> Result<location::model::Location> {
10129 (*self.0.stub)
10130 .get_location(self.0.request, self.0.options)
10131 .await
10132 .map(gax::response::Response::into_body)
10133 }
10134
10135 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10137 self.0.request.name = v.into();
10138 self
10139 }
10140 }
10141
10142 #[doc(hidden)]
10143 impl gax::options::internal::RequestBuilder for GetLocation {
10144 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10145 &mut self.0.options
10146 }
10147 }
10148
10149 #[derive(Clone, Debug)]
10171 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
10172
10173 impl ListOperations {
10174 pub(crate) fn new(
10175 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10176 ) -> Self {
10177 Self(RequestBuilder::new(stub))
10178 }
10179
10180 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
10182 mut self,
10183 v: V,
10184 ) -> Self {
10185 self.0.request = v.into();
10186 self
10187 }
10188
10189 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10191 self.0.options = v.into();
10192 self
10193 }
10194
10195 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10197 (*self.0.stub)
10198 .list_operations(self.0.request, self.0.options)
10199 .await
10200 .map(gax::response::Response::into_body)
10201 }
10202
10203 pub fn by_page(
10205 self,
10206 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10207 {
10208 use std::clone::Clone;
10209 let token = self.0.request.page_token.clone();
10210 let execute = move |token: String| {
10211 let mut builder = self.clone();
10212 builder.0.request = builder.0.request.set_page_token(token);
10213 builder.send()
10214 };
10215 gax::paginator::internal::new_paginator(token, execute)
10216 }
10217
10218 pub fn by_item(
10220 self,
10221 ) -> impl gax::paginator::ItemPaginator<
10222 longrunning::model::ListOperationsResponse,
10223 gax::error::Error,
10224 > {
10225 use gax::paginator::Paginator;
10226 self.by_page().items()
10227 }
10228
10229 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10231 self.0.request.name = v.into();
10232 self
10233 }
10234
10235 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10237 self.0.request.filter = v.into();
10238 self
10239 }
10240
10241 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10243 self.0.request.page_size = v.into();
10244 self
10245 }
10246
10247 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10249 self.0.request.page_token = v.into();
10250 self
10251 }
10252
10253 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10255 self.0.request.return_partial_success = v.into();
10256 self
10257 }
10258 }
10259
10260 #[doc(hidden)]
10261 impl gax::options::internal::RequestBuilder for ListOperations {
10262 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10263 &mut self.0.options
10264 }
10265 }
10266
10267 #[derive(Clone, Debug)]
10285 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
10286
10287 impl GetOperation {
10288 pub(crate) fn new(
10289 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10290 ) -> Self {
10291 Self(RequestBuilder::new(stub))
10292 }
10293
10294 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
10296 mut self,
10297 v: V,
10298 ) -> Self {
10299 self.0.request = v.into();
10300 self
10301 }
10302
10303 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10305 self.0.options = v.into();
10306 self
10307 }
10308
10309 pub async fn send(self) -> Result<longrunning::model::Operation> {
10311 (*self.0.stub)
10312 .get_operation(self.0.request, self.0.options)
10313 .await
10314 .map(gax::response::Response::into_body)
10315 }
10316
10317 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10319 self.0.request.name = v.into();
10320 self
10321 }
10322 }
10323
10324 #[doc(hidden)]
10325 impl gax::options::internal::RequestBuilder for GetOperation {
10326 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10327 &mut self.0.options
10328 }
10329 }
10330
10331 #[derive(Clone, Debug)]
10349 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
10350
10351 impl CancelOperation {
10352 pub(crate) fn new(
10353 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10354 ) -> Self {
10355 Self(RequestBuilder::new(stub))
10356 }
10357
10358 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
10360 mut self,
10361 v: V,
10362 ) -> Self {
10363 self.0.request = v.into();
10364 self
10365 }
10366
10367 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10369 self.0.options = v.into();
10370 self
10371 }
10372
10373 pub async fn send(self) -> Result<()> {
10375 (*self.0.stub)
10376 .cancel_operation(self.0.request, self.0.options)
10377 .await
10378 .map(gax::response::Response::into_body)
10379 }
10380
10381 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10383 self.0.request.name = v.into();
10384 self
10385 }
10386 }
10387
10388 #[doc(hidden)]
10389 impl gax::options::internal::RequestBuilder for CancelOperation {
10390 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10391 &mut self.0.options
10392 }
10393 }
10394}
10395
10396#[cfg(feature = "entity-types")]
10397#[cfg_attr(docsrs, doc(cfg(feature = "entity-types")))]
10398pub mod entity_types {
10399 use crate::Result;
10400
10401 pub type ClientBuilder =
10415 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10416
10417 pub(crate) mod client {
10418 use super::super::super::client::EntityTypes;
10419 pub struct Factory;
10420 impl gax::client_builder::internal::ClientFactory for Factory {
10421 type Client = EntityTypes;
10422 type Credentials = gaxi::options::Credentials;
10423 async fn build(
10424 self,
10425 config: gaxi::options::ClientConfig,
10426 ) -> gax::client_builder::Result<Self::Client> {
10427 Self::Client::new(config).await
10428 }
10429 }
10430 }
10431
10432 #[derive(Clone, Debug)]
10434 pub(crate) struct RequestBuilder<R: std::default::Default> {
10435 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10436 request: R,
10437 options: gax::options::RequestOptions,
10438 }
10439
10440 impl<R> RequestBuilder<R>
10441 where
10442 R: std::default::Default,
10443 {
10444 pub(crate) fn new(
10445 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10446 ) -> Self {
10447 Self {
10448 stub,
10449 request: R::default(),
10450 options: gax::options::RequestOptions::default(),
10451 }
10452 }
10453 }
10454
10455 #[derive(Clone, Debug)]
10477 pub struct ListEntityTypes(RequestBuilder<crate::model::ListEntityTypesRequest>);
10478
10479 impl ListEntityTypes {
10480 pub(crate) fn new(
10481 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10482 ) -> Self {
10483 Self(RequestBuilder::new(stub))
10484 }
10485
10486 pub fn with_request<V: Into<crate::model::ListEntityTypesRequest>>(mut self, v: V) -> Self {
10488 self.0.request = v.into();
10489 self
10490 }
10491
10492 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10494 self.0.options = v.into();
10495 self
10496 }
10497
10498 pub async fn send(self) -> Result<crate::model::ListEntityTypesResponse> {
10500 (*self.0.stub)
10501 .list_entity_types(self.0.request, self.0.options)
10502 .await
10503 .map(gax::response::Response::into_body)
10504 }
10505
10506 pub fn by_page(
10508 self,
10509 ) -> impl gax::paginator::Paginator<crate::model::ListEntityTypesResponse, gax::error::Error>
10510 {
10511 use std::clone::Clone;
10512 let token = self.0.request.page_token.clone();
10513 let execute = move |token: String| {
10514 let mut builder = self.clone();
10515 builder.0.request = builder.0.request.set_page_token(token);
10516 builder.send()
10517 };
10518 gax::paginator::internal::new_paginator(token, execute)
10519 }
10520
10521 pub fn by_item(
10523 self,
10524 ) -> impl gax::paginator::ItemPaginator<crate::model::ListEntityTypesResponse, gax::error::Error>
10525 {
10526 use gax::paginator::Paginator;
10527 self.by_page().items()
10528 }
10529
10530 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10534 self.0.request.parent = v.into();
10535 self
10536 }
10537
10538 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10540 self.0.request.language_code = v.into();
10541 self
10542 }
10543
10544 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10546 self.0.request.page_size = v.into();
10547 self
10548 }
10549
10550 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10552 self.0.request.page_token = v.into();
10553 self
10554 }
10555 }
10556
10557 #[doc(hidden)]
10558 impl gax::options::internal::RequestBuilder for ListEntityTypes {
10559 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10560 &mut self.0.options
10561 }
10562 }
10563
10564 #[derive(Clone, Debug)]
10582 pub struct GetEntityType(RequestBuilder<crate::model::GetEntityTypeRequest>);
10583
10584 impl GetEntityType {
10585 pub(crate) fn new(
10586 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10587 ) -> Self {
10588 Self(RequestBuilder::new(stub))
10589 }
10590
10591 pub fn with_request<V: Into<crate::model::GetEntityTypeRequest>>(mut self, v: V) -> Self {
10593 self.0.request = v.into();
10594 self
10595 }
10596
10597 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10599 self.0.options = v.into();
10600 self
10601 }
10602
10603 pub async fn send(self) -> Result<crate::model::EntityType> {
10605 (*self.0.stub)
10606 .get_entity_type(self.0.request, self.0.options)
10607 .await
10608 .map(gax::response::Response::into_body)
10609 }
10610
10611 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10615 self.0.request.name = v.into();
10616 self
10617 }
10618
10619 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10621 self.0.request.language_code = v.into();
10622 self
10623 }
10624 }
10625
10626 #[doc(hidden)]
10627 impl gax::options::internal::RequestBuilder for GetEntityType {
10628 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10629 &mut self.0.options
10630 }
10631 }
10632
10633 #[derive(Clone, Debug)]
10651 pub struct CreateEntityType(RequestBuilder<crate::model::CreateEntityTypeRequest>);
10652
10653 impl CreateEntityType {
10654 pub(crate) fn new(
10655 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10656 ) -> Self {
10657 Self(RequestBuilder::new(stub))
10658 }
10659
10660 pub fn with_request<V: Into<crate::model::CreateEntityTypeRequest>>(
10662 mut self,
10663 v: V,
10664 ) -> Self {
10665 self.0.request = v.into();
10666 self
10667 }
10668
10669 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10671 self.0.options = v.into();
10672 self
10673 }
10674
10675 pub async fn send(self) -> Result<crate::model::EntityType> {
10677 (*self.0.stub)
10678 .create_entity_type(self.0.request, self.0.options)
10679 .await
10680 .map(gax::response::Response::into_body)
10681 }
10682
10683 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10687 self.0.request.parent = v.into();
10688 self
10689 }
10690
10691 pub fn set_entity_type<T>(mut self, v: T) -> Self
10695 where
10696 T: std::convert::Into<crate::model::EntityType>,
10697 {
10698 self.0.request.entity_type = std::option::Option::Some(v.into());
10699 self
10700 }
10701
10702 pub fn set_or_clear_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
10706 where
10707 T: std::convert::Into<crate::model::EntityType>,
10708 {
10709 self.0.request.entity_type = v.map(|x| x.into());
10710 self
10711 }
10712
10713 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10715 self.0.request.language_code = v.into();
10716 self
10717 }
10718 }
10719
10720 #[doc(hidden)]
10721 impl gax::options::internal::RequestBuilder for CreateEntityType {
10722 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10723 &mut self.0.options
10724 }
10725 }
10726
10727 #[derive(Clone, Debug)]
10745 pub struct UpdateEntityType(RequestBuilder<crate::model::UpdateEntityTypeRequest>);
10746
10747 impl UpdateEntityType {
10748 pub(crate) fn new(
10749 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10750 ) -> Self {
10751 Self(RequestBuilder::new(stub))
10752 }
10753
10754 pub fn with_request<V: Into<crate::model::UpdateEntityTypeRequest>>(
10756 mut self,
10757 v: V,
10758 ) -> Self {
10759 self.0.request = v.into();
10760 self
10761 }
10762
10763 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10765 self.0.options = v.into();
10766 self
10767 }
10768
10769 pub async fn send(self) -> Result<crate::model::EntityType> {
10771 (*self.0.stub)
10772 .update_entity_type(self.0.request, self.0.options)
10773 .await
10774 .map(gax::response::Response::into_body)
10775 }
10776
10777 pub fn set_entity_type<T>(mut self, v: T) -> Self
10781 where
10782 T: std::convert::Into<crate::model::EntityType>,
10783 {
10784 self.0.request.entity_type = std::option::Option::Some(v.into());
10785 self
10786 }
10787
10788 pub fn set_or_clear_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
10792 where
10793 T: std::convert::Into<crate::model::EntityType>,
10794 {
10795 self.0.request.entity_type = v.map(|x| x.into());
10796 self
10797 }
10798
10799 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10801 self.0.request.language_code = v.into();
10802 self
10803 }
10804
10805 pub fn set_update_mask<T>(mut self, v: T) -> Self
10807 where
10808 T: std::convert::Into<wkt::FieldMask>,
10809 {
10810 self.0.request.update_mask = std::option::Option::Some(v.into());
10811 self
10812 }
10813
10814 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10816 where
10817 T: std::convert::Into<wkt::FieldMask>,
10818 {
10819 self.0.request.update_mask = v.map(|x| x.into());
10820 self
10821 }
10822 }
10823
10824 #[doc(hidden)]
10825 impl gax::options::internal::RequestBuilder for UpdateEntityType {
10826 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10827 &mut self.0.options
10828 }
10829 }
10830
10831 #[derive(Clone, Debug)]
10849 pub struct DeleteEntityType(RequestBuilder<crate::model::DeleteEntityTypeRequest>);
10850
10851 impl DeleteEntityType {
10852 pub(crate) fn new(
10853 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10854 ) -> Self {
10855 Self(RequestBuilder::new(stub))
10856 }
10857
10858 pub fn with_request<V: Into<crate::model::DeleteEntityTypeRequest>>(
10860 mut self,
10861 v: V,
10862 ) -> Self {
10863 self.0.request = v.into();
10864 self
10865 }
10866
10867 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10869 self.0.options = v.into();
10870 self
10871 }
10872
10873 pub async fn send(self) -> Result<()> {
10875 (*self.0.stub)
10876 .delete_entity_type(self.0.request, self.0.options)
10877 .await
10878 .map(gax::response::Response::into_body)
10879 }
10880
10881 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10885 self.0.request.name = v.into();
10886 self
10887 }
10888 }
10889
10890 #[doc(hidden)]
10891 impl gax::options::internal::RequestBuilder for DeleteEntityType {
10892 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10893 &mut self.0.options
10894 }
10895 }
10896
10897 #[derive(Clone, Debug)]
10916 pub struct BatchUpdateEntityTypes(RequestBuilder<crate::model::BatchUpdateEntityTypesRequest>);
10917
10918 impl BatchUpdateEntityTypes {
10919 pub(crate) fn new(
10920 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10921 ) -> Self {
10922 Self(RequestBuilder::new(stub))
10923 }
10924
10925 pub fn with_request<V: Into<crate::model::BatchUpdateEntityTypesRequest>>(
10927 mut self,
10928 v: V,
10929 ) -> Self {
10930 self.0.request = v.into();
10931 self
10932 }
10933
10934 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10936 self.0.options = v.into();
10937 self
10938 }
10939
10940 pub async fn send(self) -> Result<longrunning::model::Operation> {
10947 (*self.0.stub)
10948 .batch_update_entity_types(self.0.request, self.0.options)
10949 .await
10950 .map(gax::response::Response::into_body)
10951 }
10952
10953 pub fn poller(
10955 self,
10956 ) -> impl lro::Poller<crate::model::BatchUpdateEntityTypesResponse, wkt::Struct> {
10957 type Operation =
10958 lro::internal::Operation<crate::model::BatchUpdateEntityTypesResponse, wkt::Struct>;
10959 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10960 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10961
10962 let stub = self.0.stub.clone();
10963 let mut options = self.0.options.clone();
10964 options.set_retry_policy(gax::retry_policy::NeverRetry);
10965 let query = move |name| {
10966 let stub = stub.clone();
10967 let options = options.clone();
10968 async {
10969 let op = GetOperation::new(stub)
10970 .set_name(name)
10971 .with_options(options)
10972 .send()
10973 .await?;
10974 Ok(Operation::new(op))
10975 }
10976 };
10977
10978 let start = move || async {
10979 let op = self.send().await?;
10980 Ok(Operation::new(op))
10981 };
10982
10983 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10984 }
10985
10986 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10990 self.0.request.parent = v.into();
10991 self
10992 }
10993
10994 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10996 self.0.request.language_code = v.into();
10997 self
10998 }
10999
11000 pub fn set_update_mask<T>(mut self, v: T) -> Self
11002 where
11003 T: std::convert::Into<wkt::FieldMask>,
11004 {
11005 self.0.request.update_mask = std::option::Option::Some(v.into());
11006 self
11007 }
11008
11009 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11011 where
11012 T: std::convert::Into<wkt::FieldMask>,
11013 {
11014 self.0.request.update_mask = v.map(|x| x.into());
11015 self
11016 }
11017
11018 pub fn set_entity_type_batch<
11023 T: Into<Option<crate::model::batch_update_entity_types_request::EntityTypeBatch>>,
11024 >(
11025 mut self,
11026 v: T,
11027 ) -> Self {
11028 self.0.request.entity_type_batch = v.into();
11029 self
11030 }
11031
11032 pub fn set_entity_type_batch_uri<T: std::convert::Into<std::string::String>>(
11038 mut self,
11039 v: T,
11040 ) -> Self {
11041 self.0.request = self.0.request.set_entity_type_batch_uri(v);
11042 self
11043 }
11044
11045 pub fn set_entity_type_batch_inline<
11051 T: std::convert::Into<std::boxed::Box<crate::model::EntityTypeBatch>>,
11052 >(
11053 mut self,
11054 v: T,
11055 ) -> Self {
11056 self.0.request = self.0.request.set_entity_type_batch_inline(v);
11057 self
11058 }
11059 }
11060
11061 #[doc(hidden)]
11062 impl gax::options::internal::RequestBuilder for BatchUpdateEntityTypes {
11063 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11064 &mut self.0.options
11065 }
11066 }
11067
11068 #[derive(Clone, Debug)]
11087 pub struct BatchDeleteEntityTypes(RequestBuilder<crate::model::BatchDeleteEntityTypesRequest>);
11088
11089 impl BatchDeleteEntityTypes {
11090 pub(crate) fn new(
11091 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11092 ) -> Self {
11093 Self(RequestBuilder::new(stub))
11094 }
11095
11096 pub fn with_request<V: Into<crate::model::BatchDeleteEntityTypesRequest>>(
11098 mut self,
11099 v: V,
11100 ) -> Self {
11101 self.0.request = v.into();
11102 self
11103 }
11104
11105 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11107 self.0.options = v.into();
11108 self
11109 }
11110
11111 pub async fn send(self) -> Result<longrunning::model::Operation> {
11118 (*self.0.stub)
11119 .batch_delete_entity_types(self.0.request, self.0.options)
11120 .await
11121 .map(gax::response::Response::into_body)
11122 }
11123
11124 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
11126 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
11127 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11128 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11129
11130 let stub = self.0.stub.clone();
11131 let mut options = self.0.options.clone();
11132 options.set_retry_policy(gax::retry_policy::NeverRetry);
11133 let query = move |name| {
11134 let stub = stub.clone();
11135 let options = options.clone();
11136 async {
11137 let op = GetOperation::new(stub)
11138 .set_name(name)
11139 .with_options(options)
11140 .send()
11141 .await?;
11142 Ok(Operation::new(op))
11143 }
11144 };
11145
11146 let start = move || async {
11147 let op = self.send().await?;
11148 Ok(Operation::new(op))
11149 };
11150
11151 lro::internal::new_unit_response_poller(
11152 polling_error_policy,
11153 polling_backoff_policy,
11154 start,
11155 query,
11156 )
11157 }
11158
11159 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11163 self.0.request.parent = v.into();
11164 self
11165 }
11166
11167 pub fn set_entity_type_names<T, V>(mut self, v: T) -> Self
11171 where
11172 T: std::iter::IntoIterator<Item = V>,
11173 V: std::convert::Into<std::string::String>,
11174 {
11175 use std::iter::Iterator;
11176 self.0.request.entity_type_names = v.into_iter().map(|i| i.into()).collect();
11177 self
11178 }
11179 }
11180
11181 #[doc(hidden)]
11182 impl gax::options::internal::RequestBuilder for BatchDeleteEntityTypes {
11183 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11184 &mut self.0.options
11185 }
11186 }
11187
11188 #[derive(Clone, Debug)]
11207 pub struct BatchCreateEntities(RequestBuilder<crate::model::BatchCreateEntitiesRequest>);
11208
11209 impl BatchCreateEntities {
11210 pub(crate) fn new(
11211 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11212 ) -> Self {
11213 Self(RequestBuilder::new(stub))
11214 }
11215
11216 pub fn with_request<V: Into<crate::model::BatchCreateEntitiesRequest>>(
11218 mut self,
11219 v: V,
11220 ) -> Self {
11221 self.0.request = v.into();
11222 self
11223 }
11224
11225 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11227 self.0.options = v.into();
11228 self
11229 }
11230
11231 pub async fn send(self) -> Result<longrunning::model::Operation> {
11238 (*self.0.stub)
11239 .batch_create_entities(self.0.request, self.0.options)
11240 .await
11241 .map(gax::response::Response::into_body)
11242 }
11243
11244 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
11246 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
11247 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11248 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11249
11250 let stub = self.0.stub.clone();
11251 let mut options = self.0.options.clone();
11252 options.set_retry_policy(gax::retry_policy::NeverRetry);
11253 let query = move |name| {
11254 let stub = stub.clone();
11255 let options = options.clone();
11256 async {
11257 let op = GetOperation::new(stub)
11258 .set_name(name)
11259 .with_options(options)
11260 .send()
11261 .await?;
11262 Ok(Operation::new(op))
11263 }
11264 };
11265
11266 let start = move || async {
11267 let op = self.send().await?;
11268 Ok(Operation::new(op))
11269 };
11270
11271 lro::internal::new_unit_response_poller(
11272 polling_error_policy,
11273 polling_backoff_policy,
11274 start,
11275 query,
11276 )
11277 }
11278
11279 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11283 self.0.request.parent = v.into();
11284 self
11285 }
11286
11287 pub fn set_entities<T, V>(mut self, v: T) -> Self
11291 where
11292 T: std::iter::IntoIterator<Item = V>,
11293 V: std::convert::Into<crate::model::entity_type::Entity>,
11294 {
11295 use std::iter::Iterator;
11296 self.0.request.entities = v.into_iter().map(|i| i.into()).collect();
11297 self
11298 }
11299
11300 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11302 self.0.request.language_code = v.into();
11303 self
11304 }
11305 }
11306
11307 #[doc(hidden)]
11308 impl gax::options::internal::RequestBuilder for BatchCreateEntities {
11309 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11310 &mut self.0.options
11311 }
11312 }
11313
11314 #[derive(Clone, Debug)]
11333 pub struct BatchUpdateEntities(RequestBuilder<crate::model::BatchUpdateEntitiesRequest>);
11334
11335 impl BatchUpdateEntities {
11336 pub(crate) fn new(
11337 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11338 ) -> Self {
11339 Self(RequestBuilder::new(stub))
11340 }
11341
11342 pub fn with_request<V: Into<crate::model::BatchUpdateEntitiesRequest>>(
11344 mut self,
11345 v: V,
11346 ) -> Self {
11347 self.0.request = v.into();
11348 self
11349 }
11350
11351 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11353 self.0.options = v.into();
11354 self
11355 }
11356
11357 pub async fn send(self) -> Result<longrunning::model::Operation> {
11364 (*self.0.stub)
11365 .batch_update_entities(self.0.request, self.0.options)
11366 .await
11367 .map(gax::response::Response::into_body)
11368 }
11369
11370 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
11372 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
11373 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11374 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11375
11376 let stub = self.0.stub.clone();
11377 let mut options = self.0.options.clone();
11378 options.set_retry_policy(gax::retry_policy::NeverRetry);
11379 let query = move |name| {
11380 let stub = stub.clone();
11381 let options = options.clone();
11382 async {
11383 let op = GetOperation::new(stub)
11384 .set_name(name)
11385 .with_options(options)
11386 .send()
11387 .await?;
11388 Ok(Operation::new(op))
11389 }
11390 };
11391
11392 let start = move || async {
11393 let op = self.send().await?;
11394 Ok(Operation::new(op))
11395 };
11396
11397 lro::internal::new_unit_response_poller(
11398 polling_error_policy,
11399 polling_backoff_policy,
11400 start,
11401 query,
11402 )
11403 }
11404
11405 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11409 self.0.request.parent = v.into();
11410 self
11411 }
11412
11413 pub fn set_entities<T, V>(mut self, v: T) -> Self
11417 where
11418 T: std::iter::IntoIterator<Item = V>,
11419 V: std::convert::Into<crate::model::entity_type::Entity>,
11420 {
11421 use std::iter::Iterator;
11422 self.0.request.entities = v.into_iter().map(|i| i.into()).collect();
11423 self
11424 }
11425
11426 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11428 self.0.request.language_code = v.into();
11429 self
11430 }
11431
11432 pub fn set_update_mask<T>(mut self, v: T) -> Self
11434 where
11435 T: std::convert::Into<wkt::FieldMask>,
11436 {
11437 self.0.request.update_mask = std::option::Option::Some(v.into());
11438 self
11439 }
11440
11441 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11443 where
11444 T: std::convert::Into<wkt::FieldMask>,
11445 {
11446 self.0.request.update_mask = v.map(|x| x.into());
11447 self
11448 }
11449 }
11450
11451 #[doc(hidden)]
11452 impl gax::options::internal::RequestBuilder for BatchUpdateEntities {
11453 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11454 &mut self.0.options
11455 }
11456 }
11457
11458 #[derive(Clone, Debug)]
11477 pub struct BatchDeleteEntities(RequestBuilder<crate::model::BatchDeleteEntitiesRequest>);
11478
11479 impl BatchDeleteEntities {
11480 pub(crate) fn new(
11481 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11482 ) -> Self {
11483 Self(RequestBuilder::new(stub))
11484 }
11485
11486 pub fn with_request<V: Into<crate::model::BatchDeleteEntitiesRequest>>(
11488 mut self,
11489 v: V,
11490 ) -> Self {
11491 self.0.request = v.into();
11492 self
11493 }
11494
11495 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11497 self.0.options = v.into();
11498 self
11499 }
11500
11501 pub async fn send(self) -> Result<longrunning::model::Operation> {
11508 (*self.0.stub)
11509 .batch_delete_entities(self.0.request, self.0.options)
11510 .await
11511 .map(gax::response::Response::into_body)
11512 }
11513
11514 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
11516 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
11517 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11518 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11519
11520 let stub = self.0.stub.clone();
11521 let mut options = self.0.options.clone();
11522 options.set_retry_policy(gax::retry_policy::NeverRetry);
11523 let query = move |name| {
11524 let stub = stub.clone();
11525 let options = options.clone();
11526 async {
11527 let op = GetOperation::new(stub)
11528 .set_name(name)
11529 .with_options(options)
11530 .send()
11531 .await?;
11532 Ok(Operation::new(op))
11533 }
11534 };
11535
11536 let start = move || async {
11537 let op = self.send().await?;
11538 Ok(Operation::new(op))
11539 };
11540
11541 lro::internal::new_unit_response_poller(
11542 polling_error_policy,
11543 polling_backoff_policy,
11544 start,
11545 query,
11546 )
11547 }
11548
11549 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11553 self.0.request.parent = v.into();
11554 self
11555 }
11556
11557 pub fn set_entity_values<T, V>(mut self, v: T) -> Self
11561 where
11562 T: std::iter::IntoIterator<Item = V>,
11563 V: std::convert::Into<std::string::String>,
11564 {
11565 use std::iter::Iterator;
11566 self.0.request.entity_values = v.into_iter().map(|i| i.into()).collect();
11567 self
11568 }
11569
11570 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11572 self.0.request.language_code = v.into();
11573 self
11574 }
11575 }
11576
11577 #[doc(hidden)]
11578 impl gax::options::internal::RequestBuilder for BatchDeleteEntities {
11579 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11580 &mut self.0.options
11581 }
11582 }
11583
11584 #[derive(Clone, Debug)]
11606 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
11607
11608 impl ListLocations {
11609 pub(crate) fn new(
11610 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11611 ) -> Self {
11612 Self(RequestBuilder::new(stub))
11613 }
11614
11615 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
11617 mut self,
11618 v: V,
11619 ) -> Self {
11620 self.0.request = v.into();
11621 self
11622 }
11623
11624 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11626 self.0.options = v.into();
11627 self
11628 }
11629
11630 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
11632 (*self.0.stub)
11633 .list_locations(self.0.request, self.0.options)
11634 .await
11635 .map(gax::response::Response::into_body)
11636 }
11637
11638 pub fn by_page(
11640 self,
11641 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
11642 {
11643 use std::clone::Clone;
11644 let token = self.0.request.page_token.clone();
11645 let execute = move |token: String| {
11646 let mut builder = self.clone();
11647 builder.0.request = builder.0.request.set_page_token(token);
11648 builder.send()
11649 };
11650 gax::paginator::internal::new_paginator(token, execute)
11651 }
11652
11653 pub fn by_item(
11655 self,
11656 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
11657 {
11658 use gax::paginator::Paginator;
11659 self.by_page().items()
11660 }
11661
11662 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11664 self.0.request.name = v.into();
11665 self
11666 }
11667
11668 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11670 self.0.request.filter = v.into();
11671 self
11672 }
11673
11674 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11676 self.0.request.page_size = v.into();
11677 self
11678 }
11679
11680 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11682 self.0.request.page_token = v.into();
11683 self
11684 }
11685 }
11686
11687 #[doc(hidden)]
11688 impl gax::options::internal::RequestBuilder for ListLocations {
11689 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11690 &mut self.0.options
11691 }
11692 }
11693
11694 #[derive(Clone, Debug)]
11712 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
11713
11714 impl GetLocation {
11715 pub(crate) fn new(
11716 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11717 ) -> Self {
11718 Self(RequestBuilder::new(stub))
11719 }
11720
11721 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
11723 self.0.request = v.into();
11724 self
11725 }
11726
11727 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11729 self.0.options = v.into();
11730 self
11731 }
11732
11733 pub async fn send(self) -> Result<location::model::Location> {
11735 (*self.0.stub)
11736 .get_location(self.0.request, self.0.options)
11737 .await
11738 .map(gax::response::Response::into_body)
11739 }
11740
11741 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11743 self.0.request.name = v.into();
11744 self
11745 }
11746 }
11747
11748 #[doc(hidden)]
11749 impl gax::options::internal::RequestBuilder for GetLocation {
11750 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11751 &mut self.0.options
11752 }
11753 }
11754
11755 #[derive(Clone, Debug)]
11777 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
11778
11779 impl ListOperations {
11780 pub(crate) fn new(
11781 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11782 ) -> Self {
11783 Self(RequestBuilder::new(stub))
11784 }
11785
11786 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
11788 mut self,
11789 v: V,
11790 ) -> Self {
11791 self.0.request = v.into();
11792 self
11793 }
11794
11795 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11797 self.0.options = v.into();
11798 self
11799 }
11800
11801 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
11803 (*self.0.stub)
11804 .list_operations(self.0.request, self.0.options)
11805 .await
11806 .map(gax::response::Response::into_body)
11807 }
11808
11809 pub fn by_page(
11811 self,
11812 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
11813 {
11814 use std::clone::Clone;
11815 let token = self.0.request.page_token.clone();
11816 let execute = move |token: String| {
11817 let mut builder = self.clone();
11818 builder.0.request = builder.0.request.set_page_token(token);
11819 builder.send()
11820 };
11821 gax::paginator::internal::new_paginator(token, execute)
11822 }
11823
11824 pub fn by_item(
11826 self,
11827 ) -> impl gax::paginator::ItemPaginator<
11828 longrunning::model::ListOperationsResponse,
11829 gax::error::Error,
11830 > {
11831 use gax::paginator::Paginator;
11832 self.by_page().items()
11833 }
11834
11835 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11837 self.0.request.name = v.into();
11838 self
11839 }
11840
11841 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11843 self.0.request.filter = v.into();
11844 self
11845 }
11846
11847 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11849 self.0.request.page_size = v.into();
11850 self
11851 }
11852
11853 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11855 self.0.request.page_token = v.into();
11856 self
11857 }
11858
11859 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
11861 self.0.request.return_partial_success = v.into();
11862 self
11863 }
11864 }
11865
11866 #[doc(hidden)]
11867 impl gax::options::internal::RequestBuilder for ListOperations {
11868 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11869 &mut self.0.options
11870 }
11871 }
11872
11873 #[derive(Clone, Debug)]
11891 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
11892
11893 impl GetOperation {
11894 pub(crate) fn new(
11895 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11896 ) -> Self {
11897 Self(RequestBuilder::new(stub))
11898 }
11899
11900 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
11902 mut self,
11903 v: V,
11904 ) -> Self {
11905 self.0.request = v.into();
11906 self
11907 }
11908
11909 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11911 self.0.options = v.into();
11912 self
11913 }
11914
11915 pub async fn send(self) -> Result<longrunning::model::Operation> {
11917 (*self.0.stub)
11918 .get_operation(self.0.request, self.0.options)
11919 .await
11920 .map(gax::response::Response::into_body)
11921 }
11922
11923 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11925 self.0.request.name = v.into();
11926 self
11927 }
11928 }
11929
11930 #[doc(hidden)]
11931 impl gax::options::internal::RequestBuilder for GetOperation {
11932 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11933 &mut self.0.options
11934 }
11935 }
11936
11937 #[derive(Clone, Debug)]
11955 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
11956
11957 impl CancelOperation {
11958 pub(crate) fn new(
11959 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11960 ) -> Self {
11961 Self(RequestBuilder::new(stub))
11962 }
11963
11964 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
11966 mut self,
11967 v: V,
11968 ) -> Self {
11969 self.0.request = v.into();
11970 self
11971 }
11972
11973 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11975 self.0.options = v.into();
11976 self
11977 }
11978
11979 pub async fn send(self) -> Result<()> {
11981 (*self.0.stub)
11982 .cancel_operation(self.0.request, self.0.options)
11983 .await
11984 .map(gax::response::Response::into_body)
11985 }
11986
11987 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11989 self.0.request.name = v.into();
11990 self
11991 }
11992 }
11993
11994 #[doc(hidden)]
11995 impl gax::options::internal::RequestBuilder for CancelOperation {
11996 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11997 &mut self.0.options
11998 }
11999 }
12000}
12001
12002#[cfg(feature = "environments")]
12003#[cfg_attr(docsrs, doc(cfg(feature = "environments")))]
12004pub mod environments {
12005 use crate::Result;
12006
12007 pub type ClientBuilder =
12021 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12022
12023 pub(crate) mod client {
12024 use super::super::super::client::Environments;
12025 pub struct Factory;
12026 impl gax::client_builder::internal::ClientFactory for Factory {
12027 type Client = Environments;
12028 type Credentials = gaxi::options::Credentials;
12029 async fn build(
12030 self,
12031 config: gaxi::options::ClientConfig,
12032 ) -> gax::client_builder::Result<Self::Client> {
12033 Self::Client::new(config).await
12034 }
12035 }
12036 }
12037
12038 #[derive(Clone, Debug)]
12040 pub(crate) struct RequestBuilder<R: std::default::Default> {
12041 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12042 request: R,
12043 options: gax::options::RequestOptions,
12044 }
12045
12046 impl<R> RequestBuilder<R>
12047 where
12048 R: std::default::Default,
12049 {
12050 pub(crate) fn new(
12051 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12052 ) -> Self {
12053 Self {
12054 stub,
12055 request: R::default(),
12056 options: gax::options::RequestOptions::default(),
12057 }
12058 }
12059 }
12060
12061 #[derive(Clone, Debug)]
12083 pub struct ListEnvironments(RequestBuilder<crate::model::ListEnvironmentsRequest>);
12084
12085 impl ListEnvironments {
12086 pub(crate) fn new(
12087 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12088 ) -> Self {
12089 Self(RequestBuilder::new(stub))
12090 }
12091
12092 pub fn with_request<V: Into<crate::model::ListEnvironmentsRequest>>(
12094 mut self,
12095 v: V,
12096 ) -> Self {
12097 self.0.request = v.into();
12098 self
12099 }
12100
12101 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12103 self.0.options = v.into();
12104 self
12105 }
12106
12107 pub async fn send(self) -> Result<crate::model::ListEnvironmentsResponse> {
12109 (*self.0.stub)
12110 .list_environments(self.0.request, self.0.options)
12111 .await
12112 .map(gax::response::Response::into_body)
12113 }
12114
12115 pub fn by_page(
12117 self,
12118 ) -> impl gax::paginator::Paginator<crate::model::ListEnvironmentsResponse, gax::error::Error>
12119 {
12120 use std::clone::Clone;
12121 let token = self.0.request.page_token.clone();
12122 let execute = move |token: String| {
12123 let mut builder = self.clone();
12124 builder.0.request = builder.0.request.set_page_token(token);
12125 builder.send()
12126 };
12127 gax::paginator::internal::new_paginator(token, execute)
12128 }
12129
12130 pub fn by_item(
12132 self,
12133 ) -> impl gax::paginator::ItemPaginator<crate::model::ListEnvironmentsResponse, gax::error::Error>
12134 {
12135 use gax::paginator::Paginator;
12136 self.by_page().items()
12137 }
12138
12139 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
12143 self.0.request.parent = v.into();
12144 self
12145 }
12146
12147 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12149 self.0.request.page_size = v.into();
12150 self
12151 }
12152
12153 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12155 self.0.request.page_token = v.into();
12156 self
12157 }
12158 }
12159
12160 #[doc(hidden)]
12161 impl gax::options::internal::RequestBuilder for ListEnvironments {
12162 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12163 &mut self.0.options
12164 }
12165 }
12166
12167 #[derive(Clone, Debug)]
12185 pub struct GetEnvironment(RequestBuilder<crate::model::GetEnvironmentRequest>);
12186
12187 impl GetEnvironment {
12188 pub(crate) fn new(
12189 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12190 ) -> Self {
12191 Self(RequestBuilder::new(stub))
12192 }
12193
12194 pub fn with_request<V: Into<crate::model::GetEnvironmentRequest>>(mut self, v: V) -> Self {
12196 self.0.request = v.into();
12197 self
12198 }
12199
12200 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12202 self.0.options = v.into();
12203 self
12204 }
12205
12206 pub async fn send(self) -> Result<crate::model::Environment> {
12208 (*self.0.stub)
12209 .get_environment(self.0.request, self.0.options)
12210 .await
12211 .map(gax::response::Response::into_body)
12212 }
12213
12214 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12218 self.0.request.name = v.into();
12219 self
12220 }
12221 }
12222
12223 #[doc(hidden)]
12224 impl gax::options::internal::RequestBuilder for GetEnvironment {
12225 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12226 &mut self.0.options
12227 }
12228 }
12229
12230 #[derive(Clone, Debug)]
12248 pub struct CreateEnvironment(RequestBuilder<crate::model::CreateEnvironmentRequest>);
12249
12250 impl CreateEnvironment {
12251 pub(crate) fn new(
12252 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12253 ) -> Self {
12254 Self(RequestBuilder::new(stub))
12255 }
12256
12257 pub fn with_request<V: Into<crate::model::CreateEnvironmentRequest>>(
12259 mut self,
12260 v: V,
12261 ) -> Self {
12262 self.0.request = v.into();
12263 self
12264 }
12265
12266 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12268 self.0.options = v.into();
12269 self
12270 }
12271
12272 pub async fn send(self) -> Result<crate::model::Environment> {
12274 (*self.0.stub)
12275 .create_environment(self.0.request, self.0.options)
12276 .await
12277 .map(gax::response::Response::into_body)
12278 }
12279
12280 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
12284 self.0.request.parent = v.into();
12285 self
12286 }
12287
12288 pub fn set_environment<T>(mut self, v: T) -> Self
12292 where
12293 T: std::convert::Into<crate::model::Environment>,
12294 {
12295 self.0.request.environment = std::option::Option::Some(v.into());
12296 self
12297 }
12298
12299 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
12303 where
12304 T: std::convert::Into<crate::model::Environment>,
12305 {
12306 self.0.request.environment = v.map(|x| x.into());
12307 self
12308 }
12309
12310 pub fn set_environment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12314 self.0.request.environment_id = v.into();
12315 self
12316 }
12317 }
12318
12319 #[doc(hidden)]
12320 impl gax::options::internal::RequestBuilder for CreateEnvironment {
12321 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12322 &mut self.0.options
12323 }
12324 }
12325
12326 #[derive(Clone, Debug)]
12344 pub struct UpdateEnvironment(RequestBuilder<crate::model::UpdateEnvironmentRequest>);
12345
12346 impl UpdateEnvironment {
12347 pub(crate) fn new(
12348 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12349 ) -> Self {
12350 Self(RequestBuilder::new(stub))
12351 }
12352
12353 pub fn with_request<V: Into<crate::model::UpdateEnvironmentRequest>>(
12355 mut self,
12356 v: V,
12357 ) -> Self {
12358 self.0.request = v.into();
12359 self
12360 }
12361
12362 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12364 self.0.options = v.into();
12365 self
12366 }
12367
12368 pub async fn send(self) -> Result<crate::model::Environment> {
12370 (*self.0.stub)
12371 .update_environment(self.0.request, self.0.options)
12372 .await
12373 .map(gax::response::Response::into_body)
12374 }
12375
12376 pub fn set_environment<T>(mut self, v: T) -> Self
12380 where
12381 T: std::convert::Into<crate::model::Environment>,
12382 {
12383 self.0.request.environment = std::option::Option::Some(v.into());
12384 self
12385 }
12386
12387 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
12391 where
12392 T: std::convert::Into<crate::model::Environment>,
12393 {
12394 self.0.request.environment = v.map(|x| x.into());
12395 self
12396 }
12397
12398 pub fn set_update_mask<T>(mut self, v: T) -> Self
12402 where
12403 T: std::convert::Into<wkt::FieldMask>,
12404 {
12405 self.0.request.update_mask = std::option::Option::Some(v.into());
12406 self
12407 }
12408
12409 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12413 where
12414 T: std::convert::Into<wkt::FieldMask>,
12415 {
12416 self.0.request.update_mask = v.map(|x| x.into());
12417 self
12418 }
12419
12420 pub fn set_allow_load_to_draft_and_discard_changes<T: Into<bool>>(mut self, v: T) -> Self {
12422 self.0.request.allow_load_to_draft_and_discard_changes = v.into();
12423 self
12424 }
12425 }
12426
12427 #[doc(hidden)]
12428 impl gax::options::internal::RequestBuilder for UpdateEnvironment {
12429 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12430 &mut self.0.options
12431 }
12432 }
12433
12434 #[derive(Clone, Debug)]
12452 pub struct DeleteEnvironment(RequestBuilder<crate::model::DeleteEnvironmentRequest>);
12453
12454 impl DeleteEnvironment {
12455 pub(crate) fn new(
12456 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12457 ) -> Self {
12458 Self(RequestBuilder::new(stub))
12459 }
12460
12461 pub fn with_request<V: Into<crate::model::DeleteEnvironmentRequest>>(
12463 mut self,
12464 v: V,
12465 ) -> Self {
12466 self.0.request = v.into();
12467 self
12468 }
12469
12470 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12472 self.0.options = v.into();
12473 self
12474 }
12475
12476 pub async fn send(self) -> Result<()> {
12478 (*self.0.stub)
12479 .delete_environment(self.0.request, self.0.options)
12480 .await
12481 .map(gax::response::Response::into_body)
12482 }
12483
12484 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12488 self.0.request.name = v.into();
12489 self
12490 }
12491 }
12492
12493 #[doc(hidden)]
12494 impl gax::options::internal::RequestBuilder for DeleteEnvironment {
12495 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12496 &mut self.0.options
12497 }
12498 }
12499
12500 #[derive(Clone, Debug)]
12522 pub struct GetEnvironmentHistory(RequestBuilder<crate::model::GetEnvironmentHistoryRequest>);
12523
12524 impl GetEnvironmentHistory {
12525 pub(crate) fn new(
12526 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12527 ) -> Self {
12528 Self(RequestBuilder::new(stub))
12529 }
12530
12531 pub fn with_request<V: Into<crate::model::GetEnvironmentHistoryRequest>>(
12533 mut self,
12534 v: V,
12535 ) -> Self {
12536 self.0.request = v.into();
12537 self
12538 }
12539
12540 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12542 self.0.options = v.into();
12543 self
12544 }
12545
12546 pub async fn send(self) -> Result<crate::model::EnvironmentHistory> {
12548 (*self.0.stub)
12549 .get_environment_history(self.0.request, self.0.options)
12550 .await
12551 .map(gax::response::Response::into_body)
12552 }
12553
12554 pub fn by_page(
12556 self,
12557 ) -> impl gax::paginator::Paginator<crate::model::EnvironmentHistory, gax::error::Error>
12558 {
12559 use std::clone::Clone;
12560 let token = self.0.request.page_token.clone();
12561 let execute = move |token: String| {
12562 let mut builder = self.clone();
12563 builder.0.request = builder.0.request.set_page_token(token);
12564 builder.send()
12565 };
12566 gax::paginator::internal::new_paginator(token, execute)
12567 }
12568
12569 pub fn by_item(
12571 self,
12572 ) -> impl gax::paginator::ItemPaginator<crate::model::EnvironmentHistory, gax::error::Error>
12573 {
12574 use gax::paginator::Paginator;
12575 self.by_page().items()
12576 }
12577
12578 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
12582 self.0.request.parent = v.into();
12583 self
12584 }
12585
12586 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12588 self.0.request.page_size = v.into();
12589 self
12590 }
12591
12592 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12594 self.0.request.page_token = v.into();
12595 self
12596 }
12597 }
12598
12599 #[doc(hidden)]
12600 impl gax::options::internal::RequestBuilder for GetEnvironmentHistory {
12601 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12602 &mut self.0.options
12603 }
12604 }
12605
12606 #[derive(Clone, Debug)]
12628 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
12629
12630 impl ListLocations {
12631 pub(crate) fn new(
12632 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12633 ) -> Self {
12634 Self(RequestBuilder::new(stub))
12635 }
12636
12637 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
12639 mut self,
12640 v: V,
12641 ) -> Self {
12642 self.0.request = v.into();
12643 self
12644 }
12645
12646 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12648 self.0.options = v.into();
12649 self
12650 }
12651
12652 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
12654 (*self.0.stub)
12655 .list_locations(self.0.request, self.0.options)
12656 .await
12657 .map(gax::response::Response::into_body)
12658 }
12659
12660 pub fn by_page(
12662 self,
12663 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
12664 {
12665 use std::clone::Clone;
12666 let token = self.0.request.page_token.clone();
12667 let execute = move |token: String| {
12668 let mut builder = self.clone();
12669 builder.0.request = builder.0.request.set_page_token(token);
12670 builder.send()
12671 };
12672 gax::paginator::internal::new_paginator(token, execute)
12673 }
12674
12675 pub fn by_item(
12677 self,
12678 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
12679 {
12680 use gax::paginator::Paginator;
12681 self.by_page().items()
12682 }
12683
12684 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12686 self.0.request.name = v.into();
12687 self
12688 }
12689
12690 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12692 self.0.request.filter = v.into();
12693 self
12694 }
12695
12696 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12698 self.0.request.page_size = v.into();
12699 self
12700 }
12701
12702 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12704 self.0.request.page_token = v.into();
12705 self
12706 }
12707 }
12708
12709 #[doc(hidden)]
12710 impl gax::options::internal::RequestBuilder for ListLocations {
12711 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12712 &mut self.0.options
12713 }
12714 }
12715
12716 #[derive(Clone, Debug)]
12734 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
12735
12736 impl GetLocation {
12737 pub(crate) fn new(
12738 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12739 ) -> Self {
12740 Self(RequestBuilder::new(stub))
12741 }
12742
12743 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
12745 self.0.request = v.into();
12746 self
12747 }
12748
12749 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12751 self.0.options = v.into();
12752 self
12753 }
12754
12755 pub async fn send(self) -> Result<location::model::Location> {
12757 (*self.0.stub)
12758 .get_location(self.0.request, self.0.options)
12759 .await
12760 .map(gax::response::Response::into_body)
12761 }
12762
12763 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12765 self.0.request.name = v.into();
12766 self
12767 }
12768 }
12769
12770 #[doc(hidden)]
12771 impl gax::options::internal::RequestBuilder for GetLocation {
12772 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12773 &mut self.0.options
12774 }
12775 }
12776
12777 #[derive(Clone, Debug)]
12799 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12800
12801 impl ListOperations {
12802 pub(crate) fn new(
12803 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12804 ) -> Self {
12805 Self(RequestBuilder::new(stub))
12806 }
12807
12808 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12810 mut self,
12811 v: V,
12812 ) -> Self {
12813 self.0.request = v.into();
12814 self
12815 }
12816
12817 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12819 self.0.options = v.into();
12820 self
12821 }
12822
12823 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12825 (*self.0.stub)
12826 .list_operations(self.0.request, self.0.options)
12827 .await
12828 .map(gax::response::Response::into_body)
12829 }
12830
12831 pub fn by_page(
12833 self,
12834 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12835 {
12836 use std::clone::Clone;
12837 let token = self.0.request.page_token.clone();
12838 let execute = move |token: String| {
12839 let mut builder = self.clone();
12840 builder.0.request = builder.0.request.set_page_token(token);
12841 builder.send()
12842 };
12843 gax::paginator::internal::new_paginator(token, execute)
12844 }
12845
12846 pub fn by_item(
12848 self,
12849 ) -> impl gax::paginator::ItemPaginator<
12850 longrunning::model::ListOperationsResponse,
12851 gax::error::Error,
12852 > {
12853 use gax::paginator::Paginator;
12854 self.by_page().items()
12855 }
12856
12857 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12859 self.0.request.name = v.into();
12860 self
12861 }
12862
12863 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12865 self.0.request.filter = v.into();
12866 self
12867 }
12868
12869 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12871 self.0.request.page_size = v.into();
12872 self
12873 }
12874
12875 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12877 self.0.request.page_token = v.into();
12878 self
12879 }
12880
12881 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12883 self.0.request.return_partial_success = v.into();
12884 self
12885 }
12886 }
12887
12888 #[doc(hidden)]
12889 impl gax::options::internal::RequestBuilder for ListOperations {
12890 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12891 &mut self.0.options
12892 }
12893 }
12894
12895 #[derive(Clone, Debug)]
12913 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12914
12915 impl GetOperation {
12916 pub(crate) fn new(
12917 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12918 ) -> Self {
12919 Self(RequestBuilder::new(stub))
12920 }
12921
12922 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12924 mut self,
12925 v: V,
12926 ) -> Self {
12927 self.0.request = v.into();
12928 self
12929 }
12930
12931 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12933 self.0.options = v.into();
12934 self
12935 }
12936
12937 pub async fn send(self) -> Result<longrunning::model::Operation> {
12939 (*self.0.stub)
12940 .get_operation(self.0.request, self.0.options)
12941 .await
12942 .map(gax::response::Response::into_body)
12943 }
12944
12945 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12947 self.0.request.name = v.into();
12948 self
12949 }
12950 }
12951
12952 #[doc(hidden)]
12953 impl gax::options::internal::RequestBuilder for GetOperation {
12954 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12955 &mut self.0.options
12956 }
12957 }
12958
12959 #[derive(Clone, Debug)]
12977 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12978
12979 impl CancelOperation {
12980 pub(crate) fn new(
12981 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12982 ) -> Self {
12983 Self(RequestBuilder::new(stub))
12984 }
12985
12986 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12988 mut self,
12989 v: V,
12990 ) -> Self {
12991 self.0.request = v.into();
12992 self
12993 }
12994
12995 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12997 self.0.options = v.into();
12998 self
12999 }
13000
13001 pub async fn send(self) -> Result<()> {
13003 (*self.0.stub)
13004 .cancel_operation(self.0.request, self.0.options)
13005 .await
13006 .map(gax::response::Response::into_body)
13007 }
13008
13009 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13011 self.0.request.name = v.into();
13012 self
13013 }
13014 }
13015
13016 #[doc(hidden)]
13017 impl gax::options::internal::RequestBuilder for CancelOperation {
13018 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13019 &mut self.0.options
13020 }
13021 }
13022}
13023
13024#[cfg(feature = "fulfillments")]
13025#[cfg_attr(docsrs, doc(cfg(feature = "fulfillments")))]
13026pub mod fulfillments {
13027 use crate::Result;
13028
13029 pub type ClientBuilder =
13043 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13044
13045 pub(crate) mod client {
13046 use super::super::super::client::Fulfillments;
13047 pub struct Factory;
13048 impl gax::client_builder::internal::ClientFactory for Factory {
13049 type Client = Fulfillments;
13050 type Credentials = gaxi::options::Credentials;
13051 async fn build(
13052 self,
13053 config: gaxi::options::ClientConfig,
13054 ) -> gax::client_builder::Result<Self::Client> {
13055 Self::Client::new(config).await
13056 }
13057 }
13058 }
13059
13060 #[derive(Clone, Debug)]
13062 pub(crate) struct RequestBuilder<R: std::default::Default> {
13063 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13064 request: R,
13065 options: gax::options::RequestOptions,
13066 }
13067
13068 impl<R> RequestBuilder<R>
13069 where
13070 R: std::default::Default,
13071 {
13072 pub(crate) fn new(
13073 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13074 ) -> Self {
13075 Self {
13076 stub,
13077 request: R::default(),
13078 options: gax::options::RequestOptions::default(),
13079 }
13080 }
13081 }
13082
13083 #[derive(Clone, Debug)]
13101 pub struct GetFulfillment(RequestBuilder<crate::model::GetFulfillmentRequest>);
13102
13103 impl GetFulfillment {
13104 pub(crate) fn new(
13105 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13106 ) -> Self {
13107 Self(RequestBuilder::new(stub))
13108 }
13109
13110 pub fn with_request<V: Into<crate::model::GetFulfillmentRequest>>(mut self, v: V) -> Self {
13112 self.0.request = v.into();
13113 self
13114 }
13115
13116 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13118 self.0.options = v.into();
13119 self
13120 }
13121
13122 pub async fn send(self) -> Result<crate::model::Fulfillment> {
13124 (*self.0.stub)
13125 .get_fulfillment(self.0.request, self.0.options)
13126 .await
13127 .map(gax::response::Response::into_body)
13128 }
13129
13130 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13134 self.0.request.name = v.into();
13135 self
13136 }
13137 }
13138
13139 #[doc(hidden)]
13140 impl gax::options::internal::RequestBuilder for GetFulfillment {
13141 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13142 &mut self.0.options
13143 }
13144 }
13145
13146 #[derive(Clone, Debug)]
13164 pub struct UpdateFulfillment(RequestBuilder<crate::model::UpdateFulfillmentRequest>);
13165
13166 impl UpdateFulfillment {
13167 pub(crate) fn new(
13168 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13169 ) -> Self {
13170 Self(RequestBuilder::new(stub))
13171 }
13172
13173 pub fn with_request<V: Into<crate::model::UpdateFulfillmentRequest>>(
13175 mut self,
13176 v: V,
13177 ) -> Self {
13178 self.0.request = v.into();
13179 self
13180 }
13181
13182 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13184 self.0.options = v.into();
13185 self
13186 }
13187
13188 pub async fn send(self) -> Result<crate::model::Fulfillment> {
13190 (*self.0.stub)
13191 .update_fulfillment(self.0.request, self.0.options)
13192 .await
13193 .map(gax::response::Response::into_body)
13194 }
13195
13196 pub fn set_fulfillment<T>(mut self, v: T) -> Self
13200 where
13201 T: std::convert::Into<crate::model::Fulfillment>,
13202 {
13203 self.0.request.fulfillment = std::option::Option::Some(v.into());
13204 self
13205 }
13206
13207 pub fn set_or_clear_fulfillment<T>(mut self, v: std::option::Option<T>) -> Self
13211 where
13212 T: std::convert::Into<crate::model::Fulfillment>,
13213 {
13214 self.0.request.fulfillment = v.map(|x| x.into());
13215 self
13216 }
13217
13218 pub fn set_update_mask<T>(mut self, v: T) -> Self
13222 where
13223 T: std::convert::Into<wkt::FieldMask>,
13224 {
13225 self.0.request.update_mask = std::option::Option::Some(v.into());
13226 self
13227 }
13228
13229 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13233 where
13234 T: std::convert::Into<wkt::FieldMask>,
13235 {
13236 self.0.request.update_mask = v.map(|x| x.into());
13237 self
13238 }
13239 }
13240
13241 #[doc(hidden)]
13242 impl gax::options::internal::RequestBuilder for UpdateFulfillment {
13243 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13244 &mut self.0.options
13245 }
13246 }
13247
13248 #[derive(Clone, Debug)]
13270 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
13271
13272 impl ListLocations {
13273 pub(crate) fn new(
13274 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13275 ) -> Self {
13276 Self(RequestBuilder::new(stub))
13277 }
13278
13279 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
13281 mut self,
13282 v: V,
13283 ) -> Self {
13284 self.0.request = v.into();
13285 self
13286 }
13287
13288 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13290 self.0.options = v.into();
13291 self
13292 }
13293
13294 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
13296 (*self.0.stub)
13297 .list_locations(self.0.request, self.0.options)
13298 .await
13299 .map(gax::response::Response::into_body)
13300 }
13301
13302 pub fn by_page(
13304 self,
13305 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
13306 {
13307 use std::clone::Clone;
13308 let token = self.0.request.page_token.clone();
13309 let execute = move |token: String| {
13310 let mut builder = self.clone();
13311 builder.0.request = builder.0.request.set_page_token(token);
13312 builder.send()
13313 };
13314 gax::paginator::internal::new_paginator(token, execute)
13315 }
13316
13317 pub fn by_item(
13319 self,
13320 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
13321 {
13322 use gax::paginator::Paginator;
13323 self.by_page().items()
13324 }
13325
13326 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13328 self.0.request.name = v.into();
13329 self
13330 }
13331
13332 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13334 self.0.request.filter = v.into();
13335 self
13336 }
13337
13338 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13340 self.0.request.page_size = v.into();
13341 self
13342 }
13343
13344 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13346 self.0.request.page_token = v.into();
13347 self
13348 }
13349 }
13350
13351 #[doc(hidden)]
13352 impl gax::options::internal::RequestBuilder for ListLocations {
13353 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13354 &mut self.0.options
13355 }
13356 }
13357
13358 #[derive(Clone, Debug)]
13376 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
13377
13378 impl GetLocation {
13379 pub(crate) fn new(
13380 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13381 ) -> Self {
13382 Self(RequestBuilder::new(stub))
13383 }
13384
13385 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
13387 self.0.request = v.into();
13388 self
13389 }
13390
13391 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13393 self.0.options = v.into();
13394 self
13395 }
13396
13397 pub async fn send(self) -> Result<location::model::Location> {
13399 (*self.0.stub)
13400 .get_location(self.0.request, self.0.options)
13401 .await
13402 .map(gax::response::Response::into_body)
13403 }
13404
13405 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13407 self.0.request.name = v.into();
13408 self
13409 }
13410 }
13411
13412 #[doc(hidden)]
13413 impl gax::options::internal::RequestBuilder for GetLocation {
13414 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13415 &mut self.0.options
13416 }
13417 }
13418
13419 #[derive(Clone, Debug)]
13441 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
13442
13443 impl ListOperations {
13444 pub(crate) fn new(
13445 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13446 ) -> Self {
13447 Self(RequestBuilder::new(stub))
13448 }
13449
13450 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
13452 mut self,
13453 v: V,
13454 ) -> Self {
13455 self.0.request = v.into();
13456 self
13457 }
13458
13459 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13461 self.0.options = v.into();
13462 self
13463 }
13464
13465 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
13467 (*self.0.stub)
13468 .list_operations(self.0.request, self.0.options)
13469 .await
13470 .map(gax::response::Response::into_body)
13471 }
13472
13473 pub fn by_page(
13475 self,
13476 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
13477 {
13478 use std::clone::Clone;
13479 let token = self.0.request.page_token.clone();
13480 let execute = move |token: String| {
13481 let mut builder = self.clone();
13482 builder.0.request = builder.0.request.set_page_token(token);
13483 builder.send()
13484 };
13485 gax::paginator::internal::new_paginator(token, execute)
13486 }
13487
13488 pub fn by_item(
13490 self,
13491 ) -> impl gax::paginator::ItemPaginator<
13492 longrunning::model::ListOperationsResponse,
13493 gax::error::Error,
13494 > {
13495 use gax::paginator::Paginator;
13496 self.by_page().items()
13497 }
13498
13499 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13501 self.0.request.name = v.into();
13502 self
13503 }
13504
13505 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13507 self.0.request.filter = v.into();
13508 self
13509 }
13510
13511 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13513 self.0.request.page_size = v.into();
13514 self
13515 }
13516
13517 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13519 self.0.request.page_token = v.into();
13520 self
13521 }
13522
13523 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13525 self.0.request.return_partial_success = v.into();
13526 self
13527 }
13528 }
13529
13530 #[doc(hidden)]
13531 impl gax::options::internal::RequestBuilder for ListOperations {
13532 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13533 &mut self.0.options
13534 }
13535 }
13536
13537 #[derive(Clone, Debug)]
13555 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
13556
13557 impl GetOperation {
13558 pub(crate) fn new(
13559 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13560 ) -> Self {
13561 Self(RequestBuilder::new(stub))
13562 }
13563
13564 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
13566 mut self,
13567 v: V,
13568 ) -> Self {
13569 self.0.request = v.into();
13570 self
13571 }
13572
13573 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13575 self.0.options = v.into();
13576 self
13577 }
13578
13579 pub async fn send(self) -> Result<longrunning::model::Operation> {
13581 (*self.0.stub)
13582 .get_operation(self.0.request, self.0.options)
13583 .await
13584 .map(gax::response::Response::into_body)
13585 }
13586
13587 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13589 self.0.request.name = v.into();
13590 self
13591 }
13592 }
13593
13594 #[doc(hidden)]
13595 impl gax::options::internal::RequestBuilder for GetOperation {
13596 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13597 &mut self.0.options
13598 }
13599 }
13600
13601 #[derive(Clone, Debug)]
13619 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13620
13621 impl CancelOperation {
13622 pub(crate) fn new(
13623 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13624 ) -> Self {
13625 Self(RequestBuilder::new(stub))
13626 }
13627
13628 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13630 mut self,
13631 v: V,
13632 ) -> Self {
13633 self.0.request = v.into();
13634 self
13635 }
13636
13637 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13639 self.0.options = v.into();
13640 self
13641 }
13642
13643 pub async fn send(self) -> Result<()> {
13645 (*self.0.stub)
13646 .cancel_operation(self.0.request, self.0.options)
13647 .await
13648 .map(gax::response::Response::into_body)
13649 }
13650
13651 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13653 self.0.request.name = v.into();
13654 self
13655 }
13656 }
13657
13658 #[doc(hidden)]
13659 impl gax::options::internal::RequestBuilder for CancelOperation {
13660 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13661 &mut self.0.options
13662 }
13663 }
13664}
13665
13666#[cfg(feature = "generators")]
13667#[cfg_attr(docsrs, doc(cfg(feature = "generators")))]
13668pub mod generators {
13669 use crate::Result;
13670
13671 pub type ClientBuilder =
13685 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13686
13687 pub(crate) mod client {
13688 use super::super::super::client::Generators;
13689 pub struct Factory;
13690 impl gax::client_builder::internal::ClientFactory for Factory {
13691 type Client = Generators;
13692 type Credentials = gaxi::options::Credentials;
13693 async fn build(
13694 self,
13695 config: gaxi::options::ClientConfig,
13696 ) -> gax::client_builder::Result<Self::Client> {
13697 Self::Client::new(config).await
13698 }
13699 }
13700 }
13701
13702 #[derive(Clone, Debug)]
13704 pub(crate) struct RequestBuilder<R: std::default::Default> {
13705 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13706 request: R,
13707 options: gax::options::RequestOptions,
13708 }
13709
13710 impl<R> RequestBuilder<R>
13711 where
13712 R: std::default::Default,
13713 {
13714 pub(crate) fn new(
13715 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13716 ) -> Self {
13717 Self {
13718 stub,
13719 request: R::default(),
13720 options: gax::options::RequestOptions::default(),
13721 }
13722 }
13723 }
13724
13725 #[derive(Clone, Debug)]
13743 pub struct CreateGenerator(RequestBuilder<crate::model::CreateGeneratorRequest>);
13744
13745 impl CreateGenerator {
13746 pub(crate) fn new(
13747 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13748 ) -> Self {
13749 Self(RequestBuilder::new(stub))
13750 }
13751
13752 pub fn with_request<V: Into<crate::model::CreateGeneratorRequest>>(mut self, v: V) -> Self {
13754 self.0.request = v.into();
13755 self
13756 }
13757
13758 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13760 self.0.options = v.into();
13761 self
13762 }
13763
13764 pub async fn send(self) -> Result<crate::model::Generator> {
13766 (*self.0.stub)
13767 .create_generator(self.0.request, self.0.options)
13768 .await
13769 .map(gax::response::Response::into_body)
13770 }
13771
13772 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13776 self.0.request.parent = v.into();
13777 self
13778 }
13779
13780 pub fn set_generator<T>(mut self, v: T) -> Self
13784 where
13785 T: std::convert::Into<crate::model::Generator>,
13786 {
13787 self.0.request.generator = std::option::Option::Some(v.into());
13788 self
13789 }
13790
13791 pub fn set_or_clear_generator<T>(mut self, v: std::option::Option<T>) -> Self
13795 where
13796 T: std::convert::Into<crate::model::Generator>,
13797 {
13798 self.0.request.generator = v.map(|x| x.into());
13799 self
13800 }
13801
13802 pub fn set_generator_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
13804 self.0.request.generator_id = v.into();
13805 self
13806 }
13807 }
13808
13809 #[doc(hidden)]
13810 impl gax::options::internal::RequestBuilder for CreateGenerator {
13811 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13812 &mut self.0.options
13813 }
13814 }
13815
13816 #[derive(Clone, Debug)]
13834 pub struct GetGenerator(RequestBuilder<crate::model::GetGeneratorRequest>);
13835
13836 impl GetGenerator {
13837 pub(crate) fn new(
13838 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13839 ) -> Self {
13840 Self(RequestBuilder::new(stub))
13841 }
13842
13843 pub fn with_request<V: Into<crate::model::GetGeneratorRequest>>(mut self, v: V) -> Self {
13845 self.0.request = v.into();
13846 self
13847 }
13848
13849 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13851 self.0.options = v.into();
13852 self
13853 }
13854
13855 pub async fn send(self) -> Result<crate::model::Generator> {
13857 (*self.0.stub)
13858 .get_generator(self.0.request, self.0.options)
13859 .await
13860 .map(gax::response::Response::into_body)
13861 }
13862
13863 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13867 self.0.request.name = v.into();
13868 self
13869 }
13870 }
13871
13872 #[doc(hidden)]
13873 impl gax::options::internal::RequestBuilder for GetGenerator {
13874 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13875 &mut self.0.options
13876 }
13877 }
13878
13879 #[derive(Clone, Debug)]
13901 pub struct ListGenerators(RequestBuilder<crate::model::ListGeneratorsRequest>);
13902
13903 impl ListGenerators {
13904 pub(crate) fn new(
13905 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13906 ) -> Self {
13907 Self(RequestBuilder::new(stub))
13908 }
13909
13910 pub fn with_request<V: Into<crate::model::ListGeneratorsRequest>>(mut self, v: V) -> Self {
13912 self.0.request = v.into();
13913 self
13914 }
13915
13916 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13918 self.0.options = v.into();
13919 self
13920 }
13921
13922 pub async fn send(self) -> Result<crate::model::ListGeneratorsResponse> {
13924 (*self.0.stub)
13925 .list_generators(self.0.request, self.0.options)
13926 .await
13927 .map(gax::response::Response::into_body)
13928 }
13929
13930 pub fn by_page(
13932 self,
13933 ) -> impl gax::paginator::Paginator<crate::model::ListGeneratorsResponse, gax::error::Error>
13934 {
13935 use std::clone::Clone;
13936 let token = self.0.request.page_token.clone();
13937 let execute = move |token: String| {
13938 let mut builder = self.clone();
13939 builder.0.request = builder.0.request.set_page_token(token);
13940 builder.send()
13941 };
13942 gax::paginator::internal::new_paginator(token, execute)
13943 }
13944
13945 pub fn by_item(
13947 self,
13948 ) -> impl gax::paginator::ItemPaginator<crate::model::ListGeneratorsResponse, gax::error::Error>
13949 {
13950 use gax::paginator::Paginator;
13951 self.by_page().items()
13952 }
13953
13954 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13958 self.0.request.parent = v.into();
13959 self
13960 }
13961
13962 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13964 self.0.request.page_size = v.into();
13965 self
13966 }
13967
13968 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13970 self.0.request.page_token = v.into();
13971 self
13972 }
13973 }
13974
13975 #[doc(hidden)]
13976 impl gax::options::internal::RequestBuilder for ListGenerators {
13977 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13978 &mut self.0.options
13979 }
13980 }
13981
13982 #[derive(Clone, Debug)]
14000 pub struct DeleteGenerator(RequestBuilder<crate::model::DeleteGeneratorRequest>);
14001
14002 impl DeleteGenerator {
14003 pub(crate) fn new(
14004 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14005 ) -> Self {
14006 Self(RequestBuilder::new(stub))
14007 }
14008
14009 pub fn with_request<V: Into<crate::model::DeleteGeneratorRequest>>(mut self, v: V) -> Self {
14011 self.0.request = v.into();
14012 self
14013 }
14014
14015 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14017 self.0.options = v.into();
14018 self
14019 }
14020
14021 pub async fn send(self) -> Result<()> {
14023 (*self.0.stub)
14024 .delete_generator(self.0.request, self.0.options)
14025 .await
14026 .map(gax::response::Response::into_body)
14027 }
14028
14029 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14033 self.0.request.name = v.into();
14034 self
14035 }
14036 }
14037
14038 #[doc(hidden)]
14039 impl gax::options::internal::RequestBuilder for DeleteGenerator {
14040 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14041 &mut self.0.options
14042 }
14043 }
14044
14045 #[derive(Clone, Debug)]
14063 pub struct UpdateGenerator(RequestBuilder<crate::model::UpdateGeneratorRequest>);
14064
14065 impl UpdateGenerator {
14066 pub(crate) fn new(
14067 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14068 ) -> Self {
14069 Self(RequestBuilder::new(stub))
14070 }
14071
14072 pub fn with_request<V: Into<crate::model::UpdateGeneratorRequest>>(mut self, v: V) -> Self {
14074 self.0.request = v.into();
14075 self
14076 }
14077
14078 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14080 self.0.options = v.into();
14081 self
14082 }
14083
14084 pub async fn send(self) -> Result<crate::model::Generator> {
14086 (*self.0.stub)
14087 .update_generator(self.0.request, self.0.options)
14088 .await
14089 .map(gax::response::Response::into_body)
14090 }
14091
14092 pub fn set_generator<T>(mut self, v: T) -> Self
14096 where
14097 T: std::convert::Into<crate::model::Generator>,
14098 {
14099 self.0.request.generator = std::option::Option::Some(v.into());
14100 self
14101 }
14102
14103 pub fn set_or_clear_generator<T>(mut self, v: std::option::Option<T>) -> Self
14107 where
14108 T: std::convert::Into<crate::model::Generator>,
14109 {
14110 self.0.request.generator = v.map(|x| x.into());
14111 self
14112 }
14113
14114 pub fn set_update_mask<T>(mut self, v: T) -> Self
14116 where
14117 T: std::convert::Into<wkt::FieldMask>,
14118 {
14119 self.0.request.update_mask = std::option::Option::Some(v.into());
14120 self
14121 }
14122
14123 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14125 where
14126 T: std::convert::Into<wkt::FieldMask>,
14127 {
14128 self.0.request.update_mask = v.map(|x| x.into());
14129 self
14130 }
14131 }
14132
14133 #[doc(hidden)]
14134 impl gax::options::internal::RequestBuilder for UpdateGenerator {
14135 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14136 &mut self.0.options
14137 }
14138 }
14139
14140 #[derive(Clone, Debug)]
14162 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
14163
14164 impl ListLocations {
14165 pub(crate) fn new(
14166 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14167 ) -> Self {
14168 Self(RequestBuilder::new(stub))
14169 }
14170
14171 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
14173 mut self,
14174 v: V,
14175 ) -> Self {
14176 self.0.request = v.into();
14177 self
14178 }
14179
14180 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14182 self.0.options = v.into();
14183 self
14184 }
14185
14186 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
14188 (*self.0.stub)
14189 .list_locations(self.0.request, self.0.options)
14190 .await
14191 .map(gax::response::Response::into_body)
14192 }
14193
14194 pub fn by_page(
14196 self,
14197 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
14198 {
14199 use std::clone::Clone;
14200 let token = self.0.request.page_token.clone();
14201 let execute = move |token: String| {
14202 let mut builder = self.clone();
14203 builder.0.request = builder.0.request.set_page_token(token);
14204 builder.send()
14205 };
14206 gax::paginator::internal::new_paginator(token, execute)
14207 }
14208
14209 pub fn by_item(
14211 self,
14212 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
14213 {
14214 use gax::paginator::Paginator;
14215 self.by_page().items()
14216 }
14217
14218 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14220 self.0.request.name = v.into();
14221 self
14222 }
14223
14224 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14226 self.0.request.filter = v.into();
14227 self
14228 }
14229
14230 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14232 self.0.request.page_size = v.into();
14233 self
14234 }
14235
14236 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14238 self.0.request.page_token = v.into();
14239 self
14240 }
14241 }
14242
14243 #[doc(hidden)]
14244 impl gax::options::internal::RequestBuilder for ListLocations {
14245 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14246 &mut self.0.options
14247 }
14248 }
14249
14250 #[derive(Clone, Debug)]
14268 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
14269
14270 impl GetLocation {
14271 pub(crate) fn new(
14272 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14273 ) -> Self {
14274 Self(RequestBuilder::new(stub))
14275 }
14276
14277 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
14279 self.0.request = v.into();
14280 self
14281 }
14282
14283 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14285 self.0.options = v.into();
14286 self
14287 }
14288
14289 pub async fn send(self) -> Result<location::model::Location> {
14291 (*self.0.stub)
14292 .get_location(self.0.request, self.0.options)
14293 .await
14294 .map(gax::response::Response::into_body)
14295 }
14296
14297 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14299 self.0.request.name = v.into();
14300 self
14301 }
14302 }
14303
14304 #[doc(hidden)]
14305 impl gax::options::internal::RequestBuilder for GetLocation {
14306 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14307 &mut self.0.options
14308 }
14309 }
14310
14311 #[derive(Clone, Debug)]
14333 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
14334
14335 impl ListOperations {
14336 pub(crate) fn new(
14337 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14338 ) -> Self {
14339 Self(RequestBuilder::new(stub))
14340 }
14341
14342 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
14344 mut self,
14345 v: V,
14346 ) -> Self {
14347 self.0.request = v.into();
14348 self
14349 }
14350
14351 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14353 self.0.options = v.into();
14354 self
14355 }
14356
14357 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
14359 (*self.0.stub)
14360 .list_operations(self.0.request, self.0.options)
14361 .await
14362 .map(gax::response::Response::into_body)
14363 }
14364
14365 pub fn by_page(
14367 self,
14368 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
14369 {
14370 use std::clone::Clone;
14371 let token = self.0.request.page_token.clone();
14372 let execute = move |token: String| {
14373 let mut builder = self.clone();
14374 builder.0.request = builder.0.request.set_page_token(token);
14375 builder.send()
14376 };
14377 gax::paginator::internal::new_paginator(token, execute)
14378 }
14379
14380 pub fn by_item(
14382 self,
14383 ) -> impl gax::paginator::ItemPaginator<
14384 longrunning::model::ListOperationsResponse,
14385 gax::error::Error,
14386 > {
14387 use gax::paginator::Paginator;
14388 self.by_page().items()
14389 }
14390
14391 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14393 self.0.request.name = v.into();
14394 self
14395 }
14396
14397 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14399 self.0.request.filter = v.into();
14400 self
14401 }
14402
14403 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14405 self.0.request.page_size = v.into();
14406 self
14407 }
14408
14409 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14411 self.0.request.page_token = v.into();
14412 self
14413 }
14414
14415 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14417 self.0.request.return_partial_success = v.into();
14418 self
14419 }
14420 }
14421
14422 #[doc(hidden)]
14423 impl gax::options::internal::RequestBuilder for ListOperations {
14424 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14425 &mut self.0.options
14426 }
14427 }
14428
14429 #[derive(Clone, Debug)]
14447 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
14448
14449 impl GetOperation {
14450 pub(crate) fn new(
14451 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14452 ) -> Self {
14453 Self(RequestBuilder::new(stub))
14454 }
14455
14456 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
14458 mut self,
14459 v: V,
14460 ) -> Self {
14461 self.0.request = v.into();
14462 self
14463 }
14464
14465 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14467 self.0.options = v.into();
14468 self
14469 }
14470
14471 pub async fn send(self) -> Result<longrunning::model::Operation> {
14473 (*self.0.stub)
14474 .get_operation(self.0.request, self.0.options)
14475 .await
14476 .map(gax::response::Response::into_body)
14477 }
14478
14479 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14481 self.0.request.name = v.into();
14482 self
14483 }
14484 }
14485
14486 #[doc(hidden)]
14487 impl gax::options::internal::RequestBuilder for GetOperation {
14488 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14489 &mut self.0.options
14490 }
14491 }
14492
14493 #[derive(Clone, Debug)]
14511 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
14512
14513 impl CancelOperation {
14514 pub(crate) fn new(
14515 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14516 ) -> Self {
14517 Self(RequestBuilder::new(stub))
14518 }
14519
14520 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
14522 mut self,
14523 v: V,
14524 ) -> Self {
14525 self.0.request = v.into();
14526 self
14527 }
14528
14529 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14531 self.0.options = v.into();
14532 self
14533 }
14534
14535 pub async fn send(self) -> Result<()> {
14537 (*self.0.stub)
14538 .cancel_operation(self.0.request, self.0.options)
14539 .await
14540 .map(gax::response::Response::into_body)
14541 }
14542
14543 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14545 self.0.request.name = v.into();
14546 self
14547 }
14548 }
14549
14550 #[doc(hidden)]
14551 impl gax::options::internal::RequestBuilder for CancelOperation {
14552 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14553 &mut self.0.options
14554 }
14555 }
14556}
14557
14558#[cfg(feature = "intents")]
14559#[cfg_attr(docsrs, doc(cfg(feature = "intents")))]
14560pub mod intents {
14561 use crate::Result;
14562
14563 pub type ClientBuilder =
14577 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14578
14579 pub(crate) mod client {
14580 use super::super::super::client::Intents;
14581 pub struct Factory;
14582 impl gax::client_builder::internal::ClientFactory for Factory {
14583 type Client = Intents;
14584 type Credentials = gaxi::options::Credentials;
14585 async fn build(
14586 self,
14587 config: gaxi::options::ClientConfig,
14588 ) -> gax::client_builder::Result<Self::Client> {
14589 Self::Client::new(config).await
14590 }
14591 }
14592 }
14593
14594 #[derive(Clone, Debug)]
14596 pub(crate) struct RequestBuilder<R: std::default::Default> {
14597 stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>,
14598 request: R,
14599 options: gax::options::RequestOptions,
14600 }
14601
14602 impl<R> RequestBuilder<R>
14603 where
14604 R: std::default::Default,
14605 {
14606 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
14607 Self {
14608 stub,
14609 request: R::default(),
14610 options: gax::options::RequestOptions::default(),
14611 }
14612 }
14613 }
14614
14615 #[derive(Clone, Debug)]
14637 pub struct ListIntents(RequestBuilder<crate::model::ListIntentsRequest>);
14638
14639 impl ListIntents {
14640 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
14641 Self(RequestBuilder::new(stub))
14642 }
14643
14644 pub fn with_request<V: Into<crate::model::ListIntentsRequest>>(mut self, v: V) -> Self {
14646 self.0.request = v.into();
14647 self
14648 }
14649
14650 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14652 self.0.options = v.into();
14653 self
14654 }
14655
14656 pub async fn send(self) -> Result<crate::model::ListIntentsResponse> {
14658 (*self.0.stub)
14659 .list_intents(self.0.request, self.0.options)
14660 .await
14661 .map(gax::response::Response::into_body)
14662 }
14663
14664 pub fn by_page(
14666 self,
14667 ) -> impl gax::paginator::Paginator<crate::model::ListIntentsResponse, gax::error::Error>
14668 {
14669 use std::clone::Clone;
14670 let token = self.0.request.page_token.clone();
14671 let execute = move |token: String| {
14672 let mut builder = self.clone();
14673 builder.0.request = builder.0.request.set_page_token(token);
14674 builder.send()
14675 };
14676 gax::paginator::internal::new_paginator(token, execute)
14677 }
14678
14679 pub fn by_item(
14681 self,
14682 ) -> impl gax::paginator::ItemPaginator<crate::model::ListIntentsResponse, gax::error::Error>
14683 {
14684 use gax::paginator::Paginator;
14685 self.by_page().items()
14686 }
14687
14688 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14692 self.0.request.parent = v.into();
14693 self
14694 }
14695
14696 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
14698 self.0.request.language_code = v.into();
14699 self
14700 }
14701
14702 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
14704 self.0.request.intent_view = v.into();
14705 self
14706 }
14707
14708 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14710 self.0.request.page_size = v.into();
14711 self
14712 }
14713
14714 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14716 self.0.request.page_token = v.into();
14717 self
14718 }
14719 }
14720
14721 #[doc(hidden)]
14722 impl gax::options::internal::RequestBuilder for ListIntents {
14723 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14724 &mut self.0.options
14725 }
14726 }
14727
14728 #[derive(Clone, Debug)]
14746 pub struct GetIntent(RequestBuilder<crate::model::GetIntentRequest>);
14747
14748 impl GetIntent {
14749 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
14750 Self(RequestBuilder::new(stub))
14751 }
14752
14753 pub fn with_request<V: Into<crate::model::GetIntentRequest>>(mut self, v: V) -> Self {
14755 self.0.request = v.into();
14756 self
14757 }
14758
14759 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14761 self.0.options = v.into();
14762 self
14763 }
14764
14765 pub async fn send(self) -> Result<crate::model::Intent> {
14767 (*self.0.stub)
14768 .get_intent(self.0.request, self.0.options)
14769 .await
14770 .map(gax::response::Response::into_body)
14771 }
14772
14773 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14777 self.0.request.name = v.into();
14778 self
14779 }
14780
14781 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
14783 self.0.request.language_code = v.into();
14784 self
14785 }
14786
14787 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
14789 self.0.request.intent_view = v.into();
14790 self
14791 }
14792 }
14793
14794 #[doc(hidden)]
14795 impl gax::options::internal::RequestBuilder for GetIntent {
14796 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14797 &mut self.0.options
14798 }
14799 }
14800
14801 #[derive(Clone, Debug)]
14819 pub struct CreateIntent(RequestBuilder<crate::model::CreateIntentRequest>);
14820
14821 impl CreateIntent {
14822 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
14823 Self(RequestBuilder::new(stub))
14824 }
14825
14826 pub fn with_request<V: Into<crate::model::CreateIntentRequest>>(mut self, v: V) -> Self {
14828 self.0.request = v.into();
14829 self
14830 }
14831
14832 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14834 self.0.options = v.into();
14835 self
14836 }
14837
14838 pub async fn send(self) -> Result<crate::model::Intent> {
14840 (*self.0.stub)
14841 .create_intent(self.0.request, self.0.options)
14842 .await
14843 .map(gax::response::Response::into_body)
14844 }
14845
14846 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14850 self.0.request.parent = v.into();
14851 self
14852 }
14853
14854 pub fn set_intent<T>(mut self, v: T) -> Self
14858 where
14859 T: std::convert::Into<crate::model::Intent>,
14860 {
14861 self.0.request.intent = std::option::Option::Some(v.into());
14862 self
14863 }
14864
14865 pub fn set_or_clear_intent<T>(mut self, v: std::option::Option<T>) -> Self
14869 where
14870 T: std::convert::Into<crate::model::Intent>,
14871 {
14872 self.0.request.intent = v.map(|x| x.into());
14873 self
14874 }
14875
14876 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
14878 self.0.request.language_code = v.into();
14879 self
14880 }
14881
14882 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
14884 self.0.request.intent_view = v.into();
14885 self
14886 }
14887 }
14888
14889 #[doc(hidden)]
14890 impl gax::options::internal::RequestBuilder for CreateIntent {
14891 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14892 &mut self.0.options
14893 }
14894 }
14895
14896 #[derive(Clone, Debug)]
14914 pub struct UpdateIntent(RequestBuilder<crate::model::UpdateIntentRequest>);
14915
14916 impl UpdateIntent {
14917 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
14918 Self(RequestBuilder::new(stub))
14919 }
14920
14921 pub fn with_request<V: Into<crate::model::UpdateIntentRequest>>(mut self, v: V) -> Self {
14923 self.0.request = v.into();
14924 self
14925 }
14926
14927 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14929 self.0.options = v.into();
14930 self
14931 }
14932
14933 pub async fn send(self) -> Result<crate::model::Intent> {
14935 (*self.0.stub)
14936 .update_intent(self.0.request, self.0.options)
14937 .await
14938 .map(gax::response::Response::into_body)
14939 }
14940
14941 pub fn set_intent<T>(mut self, v: T) -> Self
14945 where
14946 T: std::convert::Into<crate::model::Intent>,
14947 {
14948 self.0.request.intent = std::option::Option::Some(v.into());
14949 self
14950 }
14951
14952 pub fn set_or_clear_intent<T>(mut self, v: std::option::Option<T>) -> Self
14956 where
14957 T: std::convert::Into<crate::model::Intent>,
14958 {
14959 self.0.request.intent = v.map(|x| x.into());
14960 self
14961 }
14962
14963 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
14965 self.0.request.language_code = v.into();
14966 self
14967 }
14968
14969 pub fn set_update_mask<T>(mut self, v: T) -> Self
14971 where
14972 T: std::convert::Into<wkt::FieldMask>,
14973 {
14974 self.0.request.update_mask = std::option::Option::Some(v.into());
14975 self
14976 }
14977
14978 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14980 where
14981 T: std::convert::Into<wkt::FieldMask>,
14982 {
14983 self.0.request.update_mask = v.map(|x| x.into());
14984 self
14985 }
14986
14987 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
14989 self.0.request.intent_view = v.into();
14990 self
14991 }
14992 }
14993
14994 #[doc(hidden)]
14995 impl gax::options::internal::RequestBuilder for UpdateIntent {
14996 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14997 &mut self.0.options
14998 }
14999 }
15000
15001 #[derive(Clone, Debug)]
15019 pub struct DeleteIntent(RequestBuilder<crate::model::DeleteIntentRequest>);
15020
15021 impl DeleteIntent {
15022 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15023 Self(RequestBuilder::new(stub))
15024 }
15025
15026 pub fn with_request<V: Into<crate::model::DeleteIntentRequest>>(mut self, v: V) -> Self {
15028 self.0.request = v.into();
15029 self
15030 }
15031
15032 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15034 self.0.options = v.into();
15035 self
15036 }
15037
15038 pub async fn send(self) -> Result<()> {
15040 (*self.0.stub)
15041 .delete_intent(self.0.request, self.0.options)
15042 .await
15043 .map(gax::response::Response::into_body)
15044 }
15045
15046 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15050 self.0.request.name = v.into();
15051 self
15052 }
15053 }
15054
15055 #[doc(hidden)]
15056 impl gax::options::internal::RequestBuilder for DeleteIntent {
15057 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15058 &mut self.0.options
15059 }
15060 }
15061
15062 #[derive(Clone, Debug)]
15081 pub struct BatchUpdateIntents(RequestBuilder<crate::model::BatchUpdateIntentsRequest>);
15082
15083 impl BatchUpdateIntents {
15084 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15085 Self(RequestBuilder::new(stub))
15086 }
15087
15088 pub fn with_request<V: Into<crate::model::BatchUpdateIntentsRequest>>(
15090 mut self,
15091 v: V,
15092 ) -> Self {
15093 self.0.request = v.into();
15094 self
15095 }
15096
15097 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15099 self.0.options = v.into();
15100 self
15101 }
15102
15103 pub async fn send(self) -> Result<longrunning::model::Operation> {
15110 (*self.0.stub)
15111 .batch_update_intents(self.0.request, self.0.options)
15112 .await
15113 .map(gax::response::Response::into_body)
15114 }
15115
15116 pub fn poller(
15118 self,
15119 ) -> impl lro::Poller<crate::model::BatchUpdateIntentsResponse, wkt::Struct> {
15120 type Operation =
15121 lro::internal::Operation<crate::model::BatchUpdateIntentsResponse, wkt::Struct>;
15122 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15123 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15124
15125 let stub = self.0.stub.clone();
15126 let mut options = self.0.options.clone();
15127 options.set_retry_policy(gax::retry_policy::NeverRetry);
15128 let query = move |name| {
15129 let stub = stub.clone();
15130 let options = options.clone();
15131 async {
15132 let op = GetOperation::new(stub)
15133 .set_name(name)
15134 .with_options(options)
15135 .send()
15136 .await?;
15137 Ok(Operation::new(op))
15138 }
15139 };
15140
15141 let start = move || async {
15142 let op = self.send().await?;
15143 Ok(Operation::new(op))
15144 };
15145
15146 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15147 }
15148
15149 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15153 self.0.request.parent = v.into();
15154 self
15155 }
15156
15157 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15159 self.0.request.language_code = v.into();
15160 self
15161 }
15162
15163 pub fn set_update_mask<T>(mut self, v: T) -> Self
15165 where
15166 T: std::convert::Into<wkt::FieldMask>,
15167 {
15168 self.0.request.update_mask = std::option::Option::Some(v.into());
15169 self
15170 }
15171
15172 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15174 where
15175 T: std::convert::Into<wkt::FieldMask>,
15176 {
15177 self.0.request.update_mask = v.map(|x| x.into());
15178 self
15179 }
15180
15181 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
15183 self.0.request.intent_view = v.into();
15184 self
15185 }
15186
15187 pub fn set_intent_batch<
15192 T: Into<Option<crate::model::batch_update_intents_request::IntentBatch>>,
15193 >(
15194 mut self,
15195 v: T,
15196 ) -> Self {
15197 self.0.request.intent_batch = v.into();
15198 self
15199 }
15200
15201 pub fn set_intent_batch_uri<T: std::convert::Into<std::string::String>>(
15207 mut self,
15208 v: T,
15209 ) -> Self {
15210 self.0.request = self.0.request.set_intent_batch_uri(v);
15211 self
15212 }
15213
15214 pub fn set_intent_batch_inline<
15220 T: std::convert::Into<std::boxed::Box<crate::model::IntentBatch>>,
15221 >(
15222 mut self,
15223 v: T,
15224 ) -> Self {
15225 self.0.request = self.0.request.set_intent_batch_inline(v);
15226 self
15227 }
15228 }
15229
15230 #[doc(hidden)]
15231 impl gax::options::internal::RequestBuilder for BatchUpdateIntents {
15232 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15233 &mut self.0.options
15234 }
15235 }
15236
15237 #[derive(Clone, Debug)]
15256 pub struct BatchDeleteIntents(RequestBuilder<crate::model::BatchDeleteIntentsRequest>);
15257
15258 impl BatchDeleteIntents {
15259 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15260 Self(RequestBuilder::new(stub))
15261 }
15262
15263 pub fn with_request<V: Into<crate::model::BatchDeleteIntentsRequest>>(
15265 mut self,
15266 v: V,
15267 ) -> Self {
15268 self.0.request = v.into();
15269 self
15270 }
15271
15272 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15274 self.0.options = v.into();
15275 self
15276 }
15277
15278 pub async fn send(self) -> Result<longrunning::model::Operation> {
15285 (*self.0.stub)
15286 .batch_delete_intents(self.0.request, self.0.options)
15287 .await
15288 .map(gax::response::Response::into_body)
15289 }
15290
15291 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
15293 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
15294 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15295 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15296
15297 let stub = self.0.stub.clone();
15298 let mut options = self.0.options.clone();
15299 options.set_retry_policy(gax::retry_policy::NeverRetry);
15300 let query = move |name| {
15301 let stub = stub.clone();
15302 let options = options.clone();
15303 async {
15304 let op = GetOperation::new(stub)
15305 .set_name(name)
15306 .with_options(options)
15307 .send()
15308 .await?;
15309 Ok(Operation::new(op))
15310 }
15311 };
15312
15313 let start = move || async {
15314 let op = self.send().await?;
15315 Ok(Operation::new(op))
15316 };
15317
15318 lro::internal::new_unit_response_poller(
15319 polling_error_policy,
15320 polling_backoff_policy,
15321 start,
15322 query,
15323 )
15324 }
15325
15326 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15330 self.0.request.parent = v.into();
15331 self
15332 }
15333
15334 pub fn set_intents<T, V>(mut self, v: T) -> Self
15338 where
15339 T: std::iter::IntoIterator<Item = V>,
15340 V: std::convert::Into<crate::model::Intent>,
15341 {
15342 use std::iter::Iterator;
15343 self.0.request.intents = v.into_iter().map(|i| i.into()).collect();
15344 self
15345 }
15346 }
15347
15348 #[doc(hidden)]
15349 impl gax::options::internal::RequestBuilder for BatchDeleteIntents {
15350 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15351 &mut self.0.options
15352 }
15353 }
15354
15355 #[derive(Clone, Debug)]
15377 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
15378
15379 impl ListLocations {
15380 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15381 Self(RequestBuilder::new(stub))
15382 }
15383
15384 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
15386 mut self,
15387 v: V,
15388 ) -> Self {
15389 self.0.request = v.into();
15390 self
15391 }
15392
15393 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15395 self.0.options = v.into();
15396 self
15397 }
15398
15399 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
15401 (*self.0.stub)
15402 .list_locations(self.0.request, self.0.options)
15403 .await
15404 .map(gax::response::Response::into_body)
15405 }
15406
15407 pub fn by_page(
15409 self,
15410 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
15411 {
15412 use std::clone::Clone;
15413 let token = self.0.request.page_token.clone();
15414 let execute = move |token: String| {
15415 let mut builder = self.clone();
15416 builder.0.request = builder.0.request.set_page_token(token);
15417 builder.send()
15418 };
15419 gax::paginator::internal::new_paginator(token, execute)
15420 }
15421
15422 pub fn by_item(
15424 self,
15425 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
15426 {
15427 use gax::paginator::Paginator;
15428 self.by_page().items()
15429 }
15430
15431 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15433 self.0.request.name = v.into();
15434 self
15435 }
15436
15437 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15439 self.0.request.filter = v.into();
15440 self
15441 }
15442
15443 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15445 self.0.request.page_size = v.into();
15446 self
15447 }
15448
15449 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15451 self.0.request.page_token = v.into();
15452 self
15453 }
15454 }
15455
15456 #[doc(hidden)]
15457 impl gax::options::internal::RequestBuilder for ListLocations {
15458 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15459 &mut self.0.options
15460 }
15461 }
15462
15463 #[derive(Clone, Debug)]
15481 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
15482
15483 impl GetLocation {
15484 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15485 Self(RequestBuilder::new(stub))
15486 }
15487
15488 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
15490 self.0.request = v.into();
15491 self
15492 }
15493
15494 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15496 self.0.options = v.into();
15497 self
15498 }
15499
15500 pub async fn send(self) -> Result<location::model::Location> {
15502 (*self.0.stub)
15503 .get_location(self.0.request, self.0.options)
15504 .await
15505 .map(gax::response::Response::into_body)
15506 }
15507
15508 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15510 self.0.request.name = v.into();
15511 self
15512 }
15513 }
15514
15515 #[doc(hidden)]
15516 impl gax::options::internal::RequestBuilder for GetLocation {
15517 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15518 &mut self.0.options
15519 }
15520 }
15521
15522 #[derive(Clone, Debug)]
15544 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
15545
15546 impl ListOperations {
15547 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15548 Self(RequestBuilder::new(stub))
15549 }
15550
15551 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
15553 mut self,
15554 v: V,
15555 ) -> Self {
15556 self.0.request = v.into();
15557 self
15558 }
15559
15560 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15562 self.0.options = v.into();
15563 self
15564 }
15565
15566 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
15568 (*self.0.stub)
15569 .list_operations(self.0.request, self.0.options)
15570 .await
15571 .map(gax::response::Response::into_body)
15572 }
15573
15574 pub fn by_page(
15576 self,
15577 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
15578 {
15579 use std::clone::Clone;
15580 let token = self.0.request.page_token.clone();
15581 let execute = move |token: String| {
15582 let mut builder = self.clone();
15583 builder.0.request = builder.0.request.set_page_token(token);
15584 builder.send()
15585 };
15586 gax::paginator::internal::new_paginator(token, execute)
15587 }
15588
15589 pub fn by_item(
15591 self,
15592 ) -> impl gax::paginator::ItemPaginator<
15593 longrunning::model::ListOperationsResponse,
15594 gax::error::Error,
15595 > {
15596 use gax::paginator::Paginator;
15597 self.by_page().items()
15598 }
15599
15600 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15602 self.0.request.name = v.into();
15603 self
15604 }
15605
15606 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15608 self.0.request.filter = v.into();
15609 self
15610 }
15611
15612 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15614 self.0.request.page_size = v.into();
15615 self
15616 }
15617
15618 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15620 self.0.request.page_token = v.into();
15621 self
15622 }
15623
15624 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
15626 self.0.request.return_partial_success = v.into();
15627 self
15628 }
15629 }
15630
15631 #[doc(hidden)]
15632 impl gax::options::internal::RequestBuilder for ListOperations {
15633 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15634 &mut self.0.options
15635 }
15636 }
15637
15638 #[derive(Clone, Debug)]
15656 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
15657
15658 impl GetOperation {
15659 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15660 Self(RequestBuilder::new(stub))
15661 }
15662
15663 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
15665 mut self,
15666 v: V,
15667 ) -> Self {
15668 self.0.request = v.into();
15669 self
15670 }
15671
15672 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15674 self.0.options = v.into();
15675 self
15676 }
15677
15678 pub async fn send(self) -> Result<longrunning::model::Operation> {
15680 (*self.0.stub)
15681 .get_operation(self.0.request, self.0.options)
15682 .await
15683 .map(gax::response::Response::into_body)
15684 }
15685
15686 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15688 self.0.request.name = v.into();
15689 self
15690 }
15691 }
15692
15693 #[doc(hidden)]
15694 impl gax::options::internal::RequestBuilder for GetOperation {
15695 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15696 &mut self.0.options
15697 }
15698 }
15699
15700 #[derive(Clone, Debug)]
15718 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
15719
15720 impl CancelOperation {
15721 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15722 Self(RequestBuilder::new(stub))
15723 }
15724
15725 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
15727 mut self,
15728 v: V,
15729 ) -> Self {
15730 self.0.request = v.into();
15731 self
15732 }
15733
15734 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15736 self.0.options = v.into();
15737 self
15738 }
15739
15740 pub async fn send(self) -> Result<()> {
15742 (*self.0.stub)
15743 .cancel_operation(self.0.request, self.0.options)
15744 .await
15745 .map(gax::response::Response::into_body)
15746 }
15747
15748 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15750 self.0.request.name = v.into();
15751 self
15752 }
15753 }
15754
15755 #[doc(hidden)]
15756 impl gax::options::internal::RequestBuilder for CancelOperation {
15757 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15758 &mut self.0.options
15759 }
15760 }
15761}
15762
15763#[cfg(feature = "knowledge-bases")]
15764#[cfg_attr(docsrs, doc(cfg(feature = "knowledge-bases")))]
15765pub mod knowledge_bases {
15766 use crate::Result;
15767
15768 pub type ClientBuilder =
15782 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
15783
15784 pub(crate) mod client {
15785 use super::super::super::client::KnowledgeBases;
15786 pub struct Factory;
15787 impl gax::client_builder::internal::ClientFactory for Factory {
15788 type Client = KnowledgeBases;
15789 type Credentials = gaxi::options::Credentials;
15790 async fn build(
15791 self,
15792 config: gaxi::options::ClientConfig,
15793 ) -> gax::client_builder::Result<Self::Client> {
15794 Self::Client::new(config).await
15795 }
15796 }
15797 }
15798
15799 #[derive(Clone, Debug)]
15801 pub(crate) struct RequestBuilder<R: std::default::Default> {
15802 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
15803 request: R,
15804 options: gax::options::RequestOptions,
15805 }
15806
15807 impl<R> RequestBuilder<R>
15808 where
15809 R: std::default::Default,
15810 {
15811 pub(crate) fn new(
15812 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
15813 ) -> Self {
15814 Self {
15815 stub,
15816 request: R::default(),
15817 options: gax::options::RequestOptions::default(),
15818 }
15819 }
15820 }
15821
15822 #[derive(Clone, Debug)]
15844 pub struct ListKnowledgeBases(RequestBuilder<crate::model::ListKnowledgeBasesRequest>);
15845
15846 impl ListKnowledgeBases {
15847 pub(crate) fn new(
15848 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
15849 ) -> Self {
15850 Self(RequestBuilder::new(stub))
15851 }
15852
15853 pub fn with_request<V: Into<crate::model::ListKnowledgeBasesRequest>>(
15855 mut self,
15856 v: V,
15857 ) -> Self {
15858 self.0.request = v.into();
15859 self
15860 }
15861
15862 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15864 self.0.options = v.into();
15865 self
15866 }
15867
15868 pub async fn send(self) -> Result<crate::model::ListKnowledgeBasesResponse> {
15870 (*self.0.stub)
15871 .list_knowledge_bases(self.0.request, self.0.options)
15872 .await
15873 .map(gax::response::Response::into_body)
15874 }
15875
15876 pub fn by_page(
15878 self,
15879 ) -> impl gax::paginator::Paginator<crate::model::ListKnowledgeBasesResponse, gax::error::Error>
15880 {
15881 use std::clone::Clone;
15882 let token = self.0.request.page_token.clone();
15883 let execute = move |token: String| {
15884 let mut builder = self.clone();
15885 builder.0.request = builder.0.request.set_page_token(token);
15886 builder.send()
15887 };
15888 gax::paginator::internal::new_paginator(token, execute)
15889 }
15890
15891 pub fn by_item(
15893 self,
15894 ) -> impl gax::paginator::ItemPaginator<
15895 crate::model::ListKnowledgeBasesResponse,
15896 gax::error::Error,
15897 > {
15898 use gax::paginator::Paginator;
15899 self.by_page().items()
15900 }
15901
15902 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15906 self.0.request.parent = v.into();
15907 self
15908 }
15909
15910 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15912 self.0.request.page_size = v.into();
15913 self
15914 }
15915
15916 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15918 self.0.request.page_token = v.into();
15919 self
15920 }
15921
15922 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15924 self.0.request.filter = v.into();
15925 self
15926 }
15927 }
15928
15929 #[doc(hidden)]
15930 impl gax::options::internal::RequestBuilder for ListKnowledgeBases {
15931 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15932 &mut self.0.options
15933 }
15934 }
15935
15936 #[derive(Clone, Debug)]
15954 pub struct GetKnowledgeBase(RequestBuilder<crate::model::GetKnowledgeBaseRequest>);
15955
15956 impl GetKnowledgeBase {
15957 pub(crate) fn new(
15958 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
15959 ) -> Self {
15960 Self(RequestBuilder::new(stub))
15961 }
15962
15963 pub fn with_request<V: Into<crate::model::GetKnowledgeBaseRequest>>(
15965 mut self,
15966 v: V,
15967 ) -> Self {
15968 self.0.request = v.into();
15969 self
15970 }
15971
15972 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15974 self.0.options = v.into();
15975 self
15976 }
15977
15978 pub async fn send(self) -> Result<crate::model::KnowledgeBase> {
15980 (*self.0.stub)
15981 .get_knowledge_base(self.0.request, self.0.options)
15982 .await
15983 .map(gax::response::Response::into_body)
15984 }
15985
15986 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15990 self.0.request.name = v.into();
15991 self
15992 }
15993 }
15994
15995 #[doc(hidden)]
15996 impl gax::options::internal::RequestBuilder for GetKnowledgeBase {
15997 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15998 &mut self.0.options
15999 }
16000 }
16001
16002 #[derive(Clone, Debug)]
16020 pub struct CreateKnowledgeBase(RequestBuilder<crate::model::CreateKnowledgeBaseRequest>);
16021
16022 impl CreateKnowledgeBase {
16023 pub(crate) fn new(
16024 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16025 ) -> Self {
16026 Self(RequestBuilder::new(stub))
16027 }
16028
16029 pub fn with_request<V: Into<crate::model::CreateKnowledgeBaseRequest>>(
16031 mut self,
16032 v: V,
16033 ) -> Self {
16034 self.0.request = v.into();
16035 self
16036 }
16037
16038 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16040 self.0.options = v.into();
16041 self
16042 }
16043
16044 pub async fn send(self) -> Result<crate::model::KnowledgeBase> {
16046 (*self.0.stub)
16047 .create_knowledge_base(self.0.request, self.0.options)
16048 .await
16049 .map(gax::response::Response::into_body)
16050 }
16051
16052 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16056 self.0.request.parent = v.into();
16057 self
16058 }
16059
16060 pub fn set_knowledge_base<T>(mut self, v: T) -> Self
16064 where
16065 T: std::convert::Into<crate::model::KnowledgeBase>,
16066 {
16067 self.0.request.knowledge_base = std::option::Option::Some(v.into());
16068 self
16069 }
16070
16071 pub fn set_or_clear_knowledge_base<T>(mut self, v: std::option::Option<T>) -> Self
16075 where
16076 T: std::convert::Into<crate::model::KnowledgeBase>,
16077 {
16078 self.0.request.knowledge_base = v.map(|x| x.into());
16079 self
16080 }
16081 }
16082
16083 #[doc(hidden)]
16084 impl gax::options::internal::RequestBuilder for CreateKnowledgeBase {
16085 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16086 &mut self.0.options
16087 }
16088 }
16089
16090 #[derive(Clone, Debug)]
16108 pub struct DeleteKnowledgeBase(RequestBuilder<crate::model::DeleteKnowledgeBaseRequest>);
16109
16110 impl DeleteKnowledgeBase {
16111 pub(crate) fn new(
16112 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16113 ) -> Self {
16114 Self(RequestBuilder::new(stub))
16115 }
16116
16117 pub fn with_request<V: Into<crate::model::DeleteKnowledgeBaseRequest>>(
16119 mut self,
16120 v: V,
16121 ) -> Self {
16122 self.0.request = v.into();
16123 self
16124 }
16125
16126 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16128 self.0.options = v.into();
16129 self
16130 }
16131
16132 pub async fn send(self) -> Result<()> {
16134 (*self.0.stub)
16135 .delete_knowledge_base(self.0.request, self.0.options)
16136 .await
16137 .map(gax::response::Response::into_body)
16138 }
16139
16140 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16144 self.0.request.name = v.into();
16145 self
16146 }
16147
16148 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16150 self.0.request.force = v.into();
16151 self
16152 }
16153 }
16154
16155 #[doc(hidden)]
16156 impl gax::options::internal::RequestBuilder for DeleteKnowledgeBase {
16157 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16158 &mut self.0.options
16159 }
16160 }
16161
16162 #[derive(Clone, Debug)]
16180 pub struct UpdateKnowledgeBase(RequestBuilder<crate::model::UpdateKnowledgeBaseRequest>);
16181
16182 impl UpdateKnowledgeBase {
16183 pub(crate) fn new(
16184 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16185 ) -> Self {
16186 Self(RequestBuilder::new(stub))
16187 }
16188
16189 pub fn with_request<V: Into<crate::model::UpdateKnowledgeBaseRequest>>(
16191 mut self,
16192 v: V,
16193 ) -> Self {
16194 self.0.request = v.into();
16195 self
16196 }
16197
16198 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16200 self.0.options = v.into();
16201 self
16202 }
16203
16204 pub async fn send(self) -> Result<crate::model::KnowledgeBase> {
16206 (*self.0.stub)
16207 .update_knowledge_base(self.0.request, self.0.options)
16208 .await
16209 .map(gax::response::Response::into_body)
16210 }
16211
16212 pub fn set_knowledge_base<T>(mut self, v: T) -> Self
16216 where
16217 T: std::convert::Into<crate::model::KnowledgeBase>,
16218 {
16219 self.0.request.knowledge_base = std::option::Option::Some(v.into());
16220 self
16221 }
16222
16223 pub fn set_or_clear_knowledge_base<T>(mut self, v: std::option::Option<T>) -> Self
16227 where
16228 T: std::convert::Into<crate::model::KnowledgeBase>,
16229 {
16230 self.0.request.knowledge_base = v.map(|x| x.into());
16231 self
16232 }
16233
16234 pub fn set_update_mask<T>(mut self, v: T) -> Self
16236 where
16237 T: std::convert::Into<wkt::FieldMask>,
16238 {
16239 self.0.request.update_mask = std::option::Option::Some(v.into());
16240 self
16241 }
16242
16243 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
16245 where
16246 T: std::convert::Into<wkt::FieldMask>,
16247 {
16248 self.0.request.update_mask = v.map(|x| x.into());
16249 self
16250 }
16251 }
16252
16253 #[doc(hidden)]
16254 impl gax::options::internal::RequestBuilder for UpdateKnowledgeBase {
16255 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16256 &mut self.0.options
16257 }
16258 }
16259
16260 #[derive(Clone, Debug)]
16282 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
16283
16284 impl ListLocations {
16285 pub(crate) fn new(
16286 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16287 ) -> Self {
16288 Self(RequestBuilder::new(stub))
16289 }
16290
16291 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
16293 mut self,
16294 v: V,
16295 ) -> Self {
16296 self.0.request = v.into();
16297 self
16298 }
16299
16300 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16302 self.0.options = v.into();
16303 self
16304 }
16305
16306 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
16308 (*self.0.stub)
16309 .list_locations(self.0.request, self.0.options)
16310 .await
16311 .map(gax::response::Response::into_body)
16312 }
16313
16314 pub fn by_page(
16316 self,
16317 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
16318 {
16319 use std::clone::Clone;
16320 let token = self.0.request.page_token.clone();
16321 let execute = move |token: String| {
16322 let mut builder = self.clone();
16323 builder.0.request = builder.0.request.set_page_token(token);
16324 builder.send()
16325 };
16326 gax::paginator::internal::new_paginator(token, execute)
16327 }
16328
16329 pub fn by_item(
16331 self,
16332 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
16333 {
16334 use gax::paginator::Paginator;
16335 self.by_page().items()
16336 }
16337
16338 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16340 self.0.request.name = v.into();
16341 self
16342 }
16343
16344 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16346 self.0.request.filter = v.into();
16347 self
16348 }
16349
16350 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16352 self.0.request.page_size = v.into();
16353 self
16354 }
16355
16356 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16358 self.0.request.page_token = v.into();
16359 self
16360 }
16361 }
16362
16363 #[doc(hidden)]
16364 impl gax::options::internal::RequestBuilder for ListLocations {
16365 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16366 &mut self.0.options
16367 }
16368 }
16369
16370 #[derive(Clone, Debug)]
16388 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
16389
16390 impl GetLocation {
16391 pub(crate) fn new(
16392 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16393 ) -> Self {
16394 Self(RequestBuilder::new(stub))
16395 }
16396
16397 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
16399 self.0.request = v.into();
16400 self
16401 }
16402
16403 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16405 self.0.options = v.into();
16406 self
16407 }
16408
16409 pub async fn send(self) -> Result<location::model::Location> {
16411 (*self.0.stub)
16412 .get_location(self.0.request, self.0.options)
16413 .await
16414 .map(gax::response::Response::into_body)
16415 }
16416
16417 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16419 self.0.request.name = v.into();
16420 self
16421 }
16422 }
16423
16424 #[doc(hidden)]
16425 impl gax::options::internal::RequestBuilder for GetLocation {
16426 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16427 &mut self.0.options
16428 }
16429 }
16430
16431 #[derive(Clone, Debug)]
16453 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
16454
16455 impl ListOperations {
16456 pub(crate) fn new(
16457 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16458 ) -> Self {
16459 Self(RequestBuilder::new(stub))
16460 }
16461
16462 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
16464 mut self,
16465 v: V,
16466 ) -> Self {
16467 self.0.request = v.into();
16468 self
16469 }
16470
16471 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16473 self.0.options = v.into();
16474 self
16475 }
16476
16477 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
16479 (*self.0.stub)
16480 .list_operations(self.0.request, self.0.options)
16481 .await
16482 .map(gax::response::Response::into_body)
16483 }
16484
16485 pub fn by_page(
16487 self,
16488 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
16489 {
16490 use std::clone::Clone;
16491 let token = self.0.request.page_token.clone();
16492 let execute = move |token: String| {
16493 let mut builder = self.clone();
16494 builder.0.request = builder.0.request.set_page_token(token);
16495 builder.send()
16496 };
16497 gax::paginator::internal::new_paginator(token, execute)
16498 }
16499
16500 pub fn by_item(
16502 self,
16503 ) -> impl gax::paginator::ItemPaginator<
16504 longrunning::model::ListOperationsResponse,
16505 gax::error::Error,
16506 > {
16507 use gax::paginator::Paginator;
16508 self.by_page().items()
16509 }
16510
16511 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16513 self.0.request.name = v.into();
16514 self
16515 }
16516
16517 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16519 self.0.request.filter = v.into();
16520 self
16521 }
16522
16523 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16525 self.0.request.page_size = v.into();
16526 self
16527 }
16528
16529 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16531 self.0.request.page_token = v.into();
16532 self
16533 }
16534
16535 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16537 self.0.request.return_partial_success = v.into();
16538 self
16539 }
16540 }
16541
16542 #[doc(hidden)]
16543 impl gax::options::internal::RequestBuilder for ListOperations {
16544 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16545 &mut self.0.options
16546 }
16547 }
16548
16549 #[derive(Clone, Debug)]
16567 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
16568
16569 impl GetOperation {
16570 pub(crate) fn new(
16571 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16572 ) -> Self {
16573 Self(RequestBuilder::new(stub))
16574 }
16575
16576 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
16578 mut self,
16579 v: V,
16580 ) -> Self {
16581 self.0.request = v.into();
16582 self
16583 }
16584
16585 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16587 self.0.options = v.into();
16588 self
16589 }
16590
16591 pub async fn send(self) -> Result<longrunning::model::Operation> {
16593 (*self.0.stub)
16594 .get_operation(self.0.request, self.0.options)
16595 .await
16596 .map(gax::response::Response::into_body)
16597 }
16598
16599 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16601 self.0.request.name = v.into();
16602 self
16603 }
16604 }
16605
16606 #[doc(hidden)]
16607 impl gax::options::internal::RequestBuilder for GetOperation {
16608 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16609 &mut self.0.options
16610 }
16611 }
16612
16613 #[derive(Clone, Debug)]
16631 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
16632
16633 impl CancelOperation {
16634 pub(crate) fn new(
16635 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16636 ) -> Self {
16637 Self(RequestBuilder::new(stub))
16638 }
16639
16640 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
16642 mut self,
16643 v: V,
16644 ) -> Self {
16645 self.0.request = v.into();
16646 self
16647 }
16648
16649 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16651 self.0.options = v.into();
16652 self
16653 }
16654
16655 pub async fn send(self) -> Result<()> {
16657 (*self.0.stub)
16658 .cancel_operation(self.0.request, self.0.options)
16659 .await
16660 .map(gax::response::Response::into_body)
16661 }
16662
16663 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16665 self.0.request.name = v.into();
16666 self
16667 }
16668 }
16669
16670 #[doc(hidden)]
16671 impl gax::options::internal::RequestBuilder for CancelOperation {
16672 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16673 &mut self.0.options
16674 }
16675 }
16676}
16677
16678#[cfg(feature = "participants")]
16679#[cfg_attr(docsrs, doc(cfg(feature = "participants")))]
16680pub mod participants {
16681 use crate::Result;
16682
16683 pub type ClientBuilder =
16697 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16698
16699 pub(crate) mod client {
16700 use super::super::super::client::Participants;
16701 pub struct Factory;
16702 impl gax::client_builder::internal::ClientFactory for Factory {
16703 type Client = Participants;
16704 type Credentials = gaxi::options::Credentials;
16705 async fn build(
16706 self,
16707 config: gaxi::options::ClientConfig,
16708 ) -> gax::client_builder::Result<Self::Client> {
16709 Self::Client::new(config).await
16710 }
16711 }
16712 }
16713
16714 #[derive(Clone, Debug)]
16716 pub(crate) struct RequestBuilder<R: std::default::Default> {
16717 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
16718 request: R,
16719 options: gax::options::RequestOptions,
16720 }
16721
16722 impl<R> RequestBuilder<R>
16723 where
16724 R: std::default::Default,
16725 {
16726 pub(crate) fn new(
16727 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
16728 ) -> Self {
16729 Self {
16730 stub,
16731 request: R::default(),
16732 options: gax::options::RequestOptions::default(),
16733 }
16734 }
16735 }
16736
16737 #[derive(Clone, Debug)]
16755 pub struct CreateParticipant(RequestBuilder<crate::model::CreateParticipantRequest>);
16756
16757 impl CreateParticipant {
16758 pub(crate) fn new(
16759 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
16760 ) -> Self {
16761 Self(RequestBuilder::new(stub))
16762 }
16763
16764 pub fn with_request<V: Into<crate::model::CreateParticipantRequest>>(
16766 mut self,
16767 v: V,
16768 ) -> Self {
16769 self.0.request = v.into();
16770 self
16771 }
16772
16773 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16775 self.0.options = v.into();
16776 self
16777 }
16778
16779 pub async fn send(self) -> Result<crate::model::Participant> {
16781 (*self.0.stub)
16782 .create_participant(self.0.request, self.0.options)
16783 .await
16784 .map(gax::response::Response::into_body)
16785 }
16786
16787 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16791 self.0.request.parent = v.into();
16792 self
16793 }
16794
16795 pub fn set_participant<T>(mut self, v: T) -> Self
16799 where
16800 T: std::convert::Into<crate::model::Participant>,
16801 {
16802 self.0.request.participant = std::option::Option::Some(v.into());
16803 self
16804 }
16805
16806 pub fn set_or_clear_participant<T>(mut self, v: std::option::Option<T>) -> Self
16810 where
16811 T: std::convert::Into<crate::model::Participant>,
16812 {
16813 self.0.request.participant = v.map(|x| x.into());
16814 self
16815 }
16816 }
16817
16818 #[doc(hidden)]
16819 impl gax::options::internal::RequestBuilder for CreateParticipant {
16820 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16821 &mut self.0.options
16822 }
16823 }
16824
16825 #[derive(Clone, Debug)]
16843 pub struct GetParticipant(RequestBuilder<crate::model::GetParticipantRequest>);
16844
16845 impl GetParticipant {
16846 pub(crate) fn new(
16847 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
16848 ) -> Self {
16849 Self(RequestBuilder::new(stub))
16850 }
16851
16852 pub fn with_request<V: Into<crate::model::GetParticipantRequest>>(mut self, v: V) -> Self {
16854 self.0.request = v.into();
16855 self
16856 }
16857
16858 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16860 self.0.options = v.into();
16861 self
16862 }
16863
16864 pub async fn send(self) -> Result<crate::model::Participant> {
16866 (*self.0.stub)
16867 .get_participant(self.0.request, self.0.options)
16868 .await
16869 .map(gax::response::Response::into_body)
16870 }
16871
16872 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16876 self.0.request.name = v.into();
16877 self
16878 }
16879 }
16880
16881 #[doc(hidden)]
16882 impl gax::options::internal::RequestBuilder for GetParticipant {
16883 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16884 &mut self.0.options
16885 }
16886 }
16887
16888 #[derive(Clone, Debug)]
16910 pub struct ListParticipants(RequestBuilder<crate::model::ListParticipantsRequest>);
16911
16912 impl ListParticipants {
16913 pub(crate) fn new(
16914 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
16915 ) -> Self {
16916 Self(RequestBuilder::new(stub))
16917 }
16918
16919 pub fn with_request<V: Into<crate::model::ListParticipantsRequest>>(
16921 mut self,
16922 v: V,
16923 ) -> Self {
16924 self.0.request = v.into();
16925 self
16926 }
16927
16928 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16930 self.0.options = v.into();
16931 self
16932 }
16933
16934 pub async fn send(self) -> Result<crate::model::ListParticipantsResponse> {
16936 (*self.0.stub)
16937 .list_participants(self.0.request, self.0.options)
16938 .await
16939 .map(gax::response::Response::into_body)
16940 }
16941
16942 pub fn by_page(
16944 self,
16945 ) -> impl gax::paginator::Paginator<crate::model::ListParticipantsResponse, gax::error::Error>
16946 {
16947 use std::clone::Clone;
16948 let token = self.0.request.page_token.clone();
16949 let execute = move |token: String| {
16950 let mut builder = self.clone();
16951 builder.0.request = builder.0.request.set_page_token(token);
16952 builder.send()
16953 };
16954 gax::paginator::internal::new_paginator(token, execute)
16955 }
16956
16957 pub fn by_item(
16959 self,
16960 ) -> impl gax::paginator::ItemPaginator<crate::model::ListParticipantsResponse, gax::error::Error>
16961 {
16962 use gax::paginator::Paginator;
16963 self.by_page().items()
16964 }
16965
16966 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16970 self.0.request.parent = v.into();
16971 self
16972 }
16973
16974 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16976 self.0.request.page_size = v.into();
16977 self
16978 }
16979
16980 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16982 self.0.request.page_token = v.into();
16983 self
16984 }
16985 }
16986
16987 #[doc(hidden)]
16988 impl gax::options::internal::RequestBuilder for ListParticipants {
16989 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16990 &mut self.0.options
16991 }
16992 }
16993
16994 #[derive(Clone, Debug)]
17012 pub struct UpdateParticipant(RequestBuilder<crate::model::UpdateParticipantRequest>);
17013
17014 impl UpdateParticipant {
17015 pub(crate) fn new(
17016 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17017 ) -> Self {
17018 Self(RequestBuilder::new(stub))
17019 }
17020
17021 pub fn with_request<V: Into<crate::model::UpdateParticipantRequest>>(
17023 mut self,
17024 v: V,
17025 ) -> Self {
17026 self.0.request = v.into();
17027 self
17028 }
17029
17030 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17032 self.0.options = v.into();
17033 self
17034 }
17035
17036 pub async fn send(self) -> Result<crate::model::Participant> {
17038 (*self.0.stub)
17039 .update_participant(self.0.request, self.0.options)
17040 .await
17041 .map(gax::response::Response::into_body)
17042 }
17043
17044 pub fn set_participant<T>(mut self, v: T) -> Self
17048 where
17049 T: std::convert::Into<crate::model::Participant>,
17050 {
17051 self.0.request.participant = std::option::Option::Some(v.into());
17052 self
17053 }
17054
17055 pub fn set_or_clear_participant<T>(mut self, v: std::option::Option<T>) -> Self
17059 where
17060 T: std::convert::Into<crate::model::Participant>,
17061 {
17062 self.0.request.participant = v.map(|x| x.into());
17063 self
17064 }
17065
17066 pub fn set_update_mask<T>(mut self, v: T) -> Self
17070 where
17071 T: std::convert::Into<wkt::FieldMask>,
17072 {
17073 self.0.request.update_mask = std::option::Option::Some(v.into());
17074 self
17075 }
17076
17077 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17081 where
17082 T: std::convert::Into<wkt::FieldMask>,
17083 {
17084 self.0.request.update_mask = v.map(|x| x.into());
17085 self
17086 }
17087 }
17088
17089 #[doc(hidden)]
17090 impl gax::options::internal::RequestBuilder for UpdateParticipant {
17091 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17092 &mut self.0.options
17093 }
17094 }
17095
17096 #[derive(Clone, Debug)]
17114 pub struct AnalyzeContent(RequestBuilder<crate::model::AnalyzeContentRequest>);
17115
17116 impl AnalyzeContent {
17117 pub(crate) fn new(
17118 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17119 ) -> Self {
17120 Self(RequestBuilder::new(stub))
17121 }
17122
17123 pub fn with_request<V: Into<crate::model::AnalyzeContentRequest>>(mut self, v: V) -> Self {
17125 self.0.request = v.into();
17126 self
17127 }
17128
17129 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17131 self.0.options = v.into();
17132 self
17133 }
17134
17135 pub async fn send(self) -> Result<crate::model::AnalyzeContentResponse> {
17137 (*self.0.stub)
17138 .analyze_content(self.0.request, self.0.options)
17139 .await
17140 .map(gax::response::Response::into_body)
17141 }
17142
17143 pub fn set_participant<T: Into<std::string::String>>(mut self, v: T) -> Self {
17147 self.0.request.participant = v.into();
17148 self
17149 }
17150
17151 pub fn set_reply_audio_config<T>(mut self, v: T) -> Self
17153 where
17154 T: std::convert::Into<crate::model::OutputAudioConfig>,
17155 {
17156 self.0.request.reply_audio_config = std::option::Option::Some(v.into());
17157 self
17158 }
17159
17160 pub fn set_or_clear_reply_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
17162 where
17163 T: std::convert::Into<crate::model::OutputAudioConfig>,
17164 {
17165 self.0.request.reply_audio_config = v.map(|x| x.into());
17166 self
17167 }
17168
17169 pub fn set_query_params<T>(mut self, v: T) -> Self
17171 where
17172 T: std::convert::Into<crate::model::QueryParameters>,
17173 {
17174 self.0.request.query_params = std::option::Option::Some(v.into());
17175 self
17176 }
17177
17178 pub fn set_or_clear_query_params<T>(mut self, v: std::option::Option<T>) -> Self
17180 where
17181 T: std::convert::Into<crate::model::QueryParameters>,
17182 {
17183 self.0.request.query_params = v.map(|x| x.into());
17184 self
17185 }
17186
17187 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
17189 where
17190 T: std::convert::Into<crate::model::AssistQueryParameters>,
17191 {
17192 self.0.request.assist_query_params = std::option::Option::Some(v.into());
17193 self
17194 }
17195
17196 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
17198 where
17199 T: std::convert::Into<crate::model::AssistQueryParameters>,
17200 {
17201 self.0.request.assist_query_params = v.map(|x| x.into());
17202 self
17203 }
17204
17205 pub fn set_cx_parameters<T>(mut self, v: T) -> Self
17207 where
17208 T: std::convert::Into<wkt::Struct>,
17209 {
17210 self.0.request.cx_parameters = std::option::Option::Some(v.into());
17211 self
17212 }
17213
17214 pub fn set_or_clear_cx_parameters<T>(mut self, v: std::option::Option<T>) -> Self
17216 where
17217 T: std::convert::Into<wkt::Struct>,
17218 {
17219 self.0.request.cx_parameters = v.map(|x| x.into());
17220 self
17221 }
17222
17223 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
17225 self.0.request.request_id = v.into();
17226 self
17227 }
17228
17229 pub fn set_input<T: Into<Option<crate::model::analyze_content_request::Input>>>(
17234 mut self,
17235 v: T,
17236 ) -> Self {
17237 self.0.request.input = v.into();
17238 self
17239 }
17240
17241 pub fn set_text_input<T: std::convert::Into<std::boxed::Box<crate::model::TextInput>>>(
17247 mut self,
17248 v: T,
17249 ) -> Self {
17250 self.0.request = self.0.request.set_text_input(v);
17251 self
17252 }
17253
17254 pub fn set_audio_input<T: std::convert::Into<std::boxed::Box<crate::model::AudioInput>>>(
17260 mut self,
17261 v: T,
17262 ) -> Self {
17263 self.0.request = self.0.request.set_audio_input(v);
17264 self
17265 }
17266
17267 pub fn set_event_input<T: std::convert::Into<std::boxed::Box<crate::model::EventInput>>>(
17273 mut self,
17274 v: T,
17275 ) -> Self {
17276 self.0.request = self.0.request.set_event_input(v);
17277 self
17278 }
17279
17280 pub fn set_suggestion_input<
17286 T: std::convert::Into<std::boxed::Box<crate::model::SuggestionInput>>,
17287 >(
17288 mut self,
17289 v: T,
17290 ) -> Self {
17291 self.0.request = self.0.request.set_suggestion_input(v);
17292 self
17293 }
17294 }
17295
17296 #[doc(hidden)]
17297 impl gax::options::internal::RequestBuilder for AnalyzeContent {
17298 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17299 &mut self.0.options
17300 }
17301 }
17302
17303 #[derive(Clone, Debug)]
17321 pub struct SuggestArticles(RequestBuilder<crate::model::SuggestArticlesRequest>);
17322
17323 impl SuggestArticles {
17324 pub(crate) fn new(
17325 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17326 ) -> Self {
17327 Self(RequestBuilder::new(stub))
17328 }
17329
17330 pub fn with_request<V: Into<crate::model::SuggestArticlesRequest>>(mut self, v: V) -> Self {
17332 self.0.request = v.into();
17333 self
17334 }
17335
17336 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17338 self.0.options = v.into();
17339 self
17340 }
17341
17342 pub async fn send(self) -> Result<crate::model::SuggestArticlesResponse> {
17344 (*self.0.stub)
17345 .suggest_articles(self.0.request, self.0.options)
17346 .await
17347 .map(gax::response::Response::into_body)
17348 }
17349
17350 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17354 self.0.request.parent = v.into();
17355 self
17356 }
17357
17358 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
17360 self.0.request.latest_message = v.into();
17361 self
17362 }
17363
17364 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
17366 self.0.request.context_size = v.into();
17367 self
17368 }
17369
17370 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
17372 where
17373 T: std::convert::Into<crate::model::AssistQueryParameters>,
17374 {
17375 self.0.request.assist_query_params = std::option::Option::Some(v.into());
17376 self
17377 }
17378
17379 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
17381 where
17382 T: std::convert::Into<crate::model::AssistQueryParameters>,
17383 {
17384 self.0.request.assist_query_params = v.map(|x| x.into());
17385 self
17386 }
17387 }
17388
17389 #[doc(hidden)]
17390 impl gax::options::internal::RequestBuilder for SuggestArticles {
17391 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17392 &mut self.0.options
17393 }
17394 }
17395
17396 #[derive(Clone, Debug)]
17414 pub struct SuggestFaqAnswers(RequestBuilder<crate::model::SuggestFaqAnswersRequest>);
17415
17416 impl SuggestFaqAnswers {
17417 pub(crate) fn new(
17418 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17419 ) -> Self {
17420 Self(RequestBuilder::new(stub))
17421 }
17422
17423 pub fn with_request<V: Into<crate::model::SuggestFaqAnswersRequest>>(
17425 mut self,
17426 v: V,
17427 ) -> Self {
17428 self.0.request = v.into();
17429 self
17430 }
17431
17432 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17434 self.0.options = v.into();
17435 self
17436 }
17437
17438 pub async fn send(self) -> Result<crate::model::SuggestFaqAnswersResponse> {
17440 (*self.0.stub)
17441 .suggest_faq_answers(self.0.request, self.0.options)
17442 .await
17443 .map(gax::response::Response::into_body)
17444 }
17445
17446 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17450 self.0.request.parent = v.into();
17451 self
17452 }
17453
17454 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
17456 self.0.request.latest_message = v.into();
17457 self
17458 }
17459
17460 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
17462 self.0.request.context_size = v.into();
17463 self
17464 }
17465
17466 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
17468 where
17469 T: std::convert::Into<crate::model::AssistQueryParameters>,
17470 {
17471 self.0.request.assist_query_params = std::option::Option::Some(v.into());
17472 self
17473 }
17474
17475 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
17477 where
17478 T: std::convert::Into<crate::model::AssistQueryParameters>,
17479 {
17480 self.0.request.assist_query_params = v.map(|x| x.into());
17481 self
17482 }
17483 }
17484
17485 #[doc(hidden)]
17486 impl gax::options::internal::RequestBuilder for SuggestFaqAnswers {
17487 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17488 &mut self.0.options
17489 }
17490 }
17491
17492 #[derive(Clone, Debug)]
17510 pub struct SuggestSmartReplies(RequestBuilder<crate::model::SuggestSmartRepliesRequest>);
17511
17512 impl SuggestSmartReplies {
17513 pub(crate) fn new(
17514 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17515 ) -> Self {
17516 Self(RequestBuilder::new(stub))
17517 }
17518
17519 pub fn with_request<V: Into<crate::model::SuggestSmartRepliesRequest>>(
17521 mut self,
17522 v: V,
17523 ) -> Self {
17524 self.0.request = v.into();
17525 self
17526 }
17527
17528 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17530 self.0.options = v.into();
17531 self
17532 }
17533
17534 pub async fn send(self) -> Result<crate::model::SuggestSmartRepliesResponse> {
17536 (*self.0.stub)
17537 .suggest_smart_replies(self.0.request, self.0.options)
17538 .await
17539 .map(gax::response::Response::into_body)
17540 }
17541
17542 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17546 self.0.request.parent = v.into();
17547 self
17548 }
17549
17550 pub fn set_current_text_input<T>(mut self, v: T) -> Self
17552 where
17553 T: std::convert::Into<crate::model::TextInput>,
17554 {
17555 self.0.request.current_text_input = std::option::Option::Some(v.into());
17556 self
17557 }
17558
17559 pub fn set_or_clear_current_text_input<T>(mut self, v: std::option::Option<T>) -> Self
17561 where
17562 T: std::convert::Into<crate::model::TextInput>,
17563 {
17564 self.0.request.current_text_input = v.map(|x| x.into());
17565 self
17566 }
17567
17568 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
17570 self.0.request.latest_message = v.into();
17571 self
17572 }
17573
17574 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
17576 self.0.request.context_size = v.into();
17577 self
17578 }
17579 }
17580
17581 #[doc(hidden)]
17582 impl gax::options::internal::RequestBuilder for SuggestSmartReplies {
17583 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17584 &mut self.0.options
17585 }
17586 }
17587
17588 #[derive(Clone, Debug)]
17606 pub struct SuggestKnowledgeAssist(RequestBuilder<crate::model::SuggestKnowledgeAssistRequest>);
17607
17608 impl SuggestKnowledgeAssist {
17609 pub(crate) fn new(
17610 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17611 ) -> Self {
17612 Self(RequestBuilder::new(stub))
17613 }
17614
17615 pub fn with_request<V: Into<crate::model::SuggestKnowledgeAssistRequest>>(
17617 mut self,
17618 v: V,
17619 ) -> Self {
17620 self.0.request = v.into();
17621 self
17622 }
17623
17624 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17626 self.0.options = v.into();
17627 self
17628 }
17629
17630 pub async fn send(self) -> Result<crate::model::SuggestKnowledgeAssistResponse> {
17632 (*self.0.stub)
17633 .suggest_knowledge_assist(self.0.request, self.0.options)
17634 .await
17635 .map(gax::response::Response::into_body)
17636 }
17637
17638 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17642 self.0.request.parent = v.into();
17643 self
17644 }
17645
17646 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
17648 self.0.request.latest_message = v.into();
17649 self
17650 }
17651
17652 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
17654 self.0.request.context_size = v.into();
17655 self
17656 }
17657
17658 pub fn set_previous_suggested_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
17660 self.0.request.previous_suggested_query = v.into();
17661 self
17662 }
17663 }
17664
17665 #[doc(hidden)]
17666 impl gax::options::internal::RequestBuilder for SuggestKnowledgeAssist {
17667 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17668 &mut self.0.options
17669 }
17670 }
17671
17672 #[derive(Clone, Debug)]
17694 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
17695
17696 impl ListLocations {
17697 pub(crate) fn new(
17698 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17699 ) -> Self {
17700 Self(RequestBuilder::new(stub))
17701 }
17702
17703 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
17705 mut self,
17706 v: V,
17707 ) -> Self {
17708 self.0.request = v.into();
17709 self
17710 }
17711
17712 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17714 self.0.options = v.into();
17715 self
17716 }
17717
17718 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
17720 (*self.0.stub)
17721 .list_locations(self.0.request, self.0.options)
17722 .await
17723 .map(gax::response::Response::into_body)
17724 }
17725
17726 pub fn by_page(
17728 self,
17729 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
17730 {
17731 use std::clone::Clone;
17732 let token = self.0.request.page_token.clone();
17733 let execute = move |token: String| {
17734 let mut builder = self.clone();
17735 builder.0.request = builder.0.request.set_page_token(token);
17736 builder.send()
17737 };
17738 gax::paginator::internal::new_paginator(token, execute)
17739 }
17740
17741 pub fn by_item(
17743 self,
17744 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
17745 {
17746 use gax::paginator::Paginator;
17747 self.by_page().items()
17748 }
17749
17750 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17752 self.0.request.name = v.into();
17753 self
17754 }
17755
17756 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17758 self.0.request.filter = v.into();
17759 self
17760 }
17761
17762 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17764 self.0.request.page_size = v.into();
17765 self
17766 }
17767
17768 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17770 self.0.request.page_token = v.into();
17771 self
17772 }
17773 }
17774
17775 #[doc(hidden)]
17776 impl gax::options::internal::RequestBuilder for ListLocations {
17777 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17778 &mut self.0.options
17779 }
17780 }
17781
17782 #[derive(Clone, Debug)]
17800 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
17801
17802 impl GetLocation {
17803 pub(crate) fn new(
17804 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17805 ) -> Self {
17806 Self(RequestBuilder::new(stub))
17807 }
17808
17809 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
17811 self.0.request = v.into();
17812 self
17813 }
17814
17815 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17817 self.0.options = v.into();
17818 self
17819 }
17820
17821 pub async fn send(self) -> Result<location::model::Location> {
17823 (*self.0.stub)
17824 .get_location(self.0.request, self.0.options)
17825 .await
17826 .map(gax::response::Response::into_body)
17827 }
17828
17829 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17831 self.0.request.name = v.into();
17832 self
17833 }
17834 }
17835
17836 #[doc(hidden)]
17837 impl gax::options::internal::RequestBuilder for GetLocation {
17838 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17839 &mut self.0.options
17840 }
17841 }
17842
17843 #[derive(Clone, Debug)]
17865 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
17866
17867 impl ListOperations {
17868 pub(crate) fn new(
17869 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17870 ) -> Self {
17871 Self(RequestBuilder::new(stub))
17872 }
17873
17874 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
17876 mut self,
17877 v: V,
17878 ) -> Self {
17879 self.0.request = v.into();
17880 self
17881 }
17882
17883 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17885 self.0.options = v.into();
17886 self
17887 }
17888
17889 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
17891 (*self.0.stub)
17892 .list_operations(self.0.request, self.0.options)
17893 .await
17894 .map(gax::response::Response::into_body)
17895 }
17896
17897 pub fn by_page(
17899 self,
17900 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
17901 {
17902 use std::clone::Clone;
17903 let token = self.0.request.page_token.clone();
17904 let execute = move |token: String| {
17905 let mut builder = self.clone();
17906 builder.0.request = builder.0.request.set_page_token(token);
17907 builder.send()
17908 };
17909 gax::paginator::internal::new_paginator(token, execute)
17910 }
17911
17912 pub fn by_item(
17914 self,
17915 ) -> impl gax::paginator::ItemPaginator<
17916 longrunning::model::ListOperationsResponse,
17917 gax::error::Error,
17918 > {
17919 use gax::paginator::Paginator;
17920 self.by_page().items()
17921 }
17922
17923 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17925 self.0.request.name = v.into();
17926 self
17927 }
17928
17929 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17931 self.0.request.filter = v.into();
17932 self
17933 }
17934
17935 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17937 self.0.request.page_size = v.into();
17938 self
17939 }
17940
17941 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17943 self.0.request.page_token = v.into();
17944 self
17945 }
17946
17947 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17949 self.0.request.return_partial_success = v.into();
17950 self
17951 }
17952 }
17953
17954 #[doc(hidden)]
17955 impl gax::options::internal::RequestBuilder for ListOperations {
17956 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17957 &mut self.0.options
17958 }
17959 }
17960
17961 #[derive(Clone, Debug)]
17979 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
17980
17981 impl GetOperation {
17982 pub(crate) fn new(
17983 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17984 ) -> Self {
17985 Self(RequestBuilder::new(stub))
17986 }
17987
17988 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
17990 mut self,
17991 v: V,
17992 ) -> Self {
17993 self.0.request = v.into();
17994 self
17995 }
17996
17997 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17999 self.0.options = v.into();
18000 self
18001 }
18002
18003 pub async fn send(self) -> Result<longrunning::model::Operation> {
18005 (*self.0.stub)
18006 .get_operation(self.0.request, self.0.options)
18007 .await
18008 .map(gax::response::Response::into_body)
18009 }
18010
18011 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18013 self.0.request.name = v.into();
18014 self
18015 }
18016 }
18017
18018 #[doc(hidden)]
18019 impl gax::options::internal::RequestBuilder for GetOperation {
18020 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18021 &mut self.0.options
18022 }
18023 }
18024
18025 #[derive(Clone, Debug)]
18043 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
18044
18045 impl CancelOperation {
18046 pub(crate) fn new(
18047 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18048 ) -> Self {
18049 Self(RequestBuilder::new(stub))
18050 }
18051
18052 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
18054 mut self,
18055 v: V,
18056 ) -> Self {
18057 self.0.request = v.into();
18058 self
18059 }
18060
18061 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18063 self.0.options = v.into();
18064 self
18065 }
18066
18067 pub async fn send(self) -> Result<()> {
18069 (*self.0.stub)
18070 .cancel_operation(self.0.request, self.0.options)
18071 .await
18072 .map(gax::response::Response::into_body)
18073 }
18074
18075 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18077 self.0.request.name = v.into();
18078 self
18079 }
18080 }
18081
18082 #[doc(hidden)]
18083 impl gax::options::internal::RequestBuilder for CancelOperation {
18084 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18085 &mut self.0.options
18086 }
18087 }
18088}
18089
18090#[cfg(feature = "sessions")]
18091#[cfg_attr(docsrs, doc(cfg(feature = "sessions")))]
18092pub mod sessions {
18093 use crate::Result;
18094
18095 pub type ClientBuilder =
18109 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
18110
18111 pub(crate) mod client {
18112 use super::super::super::client::Sessions;
18113 pub struct Factory;
18114 impl gax::client_builder::internal::ClientFactory for Factory {
18115 type Client = Sessions;
18116 type Credentials = gaxi::options::Credentials;
18117 async fn build(
18118 self,
18119 config: gaxi::options::ClientConfig,
18120 ) -> gax::client_builder::Result<Self::Client> {
18121 Self::Client::new(config).await
18122 }
18123 }
18124 }
18125
18126 #[derive(Clone, Debug)]
18128 pub(crate) struct RequestBuilder<R: std::default::Default> {
18129 stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>,
18130 request: R,
18131 options: gax::options::RequestOptions,
18132 }
18133
18134 impl<R> RequestBuilder<R>
18135 where
18136 R: std::default::Default,
18137 {
18138 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
18139 Self {
18140 stub,
18141 request: R::default(),
18142 options: gax::options::RequestOptions::default(),
18143 }
18144 }
18145 }
18146
18147 #[derive(Clone, Debug)]
18165 pub struct DetectIntent(RequestBuilder<crate::model::DetectIntentRequest>);
18166
18167 impl DetectIntent {
18168 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
18169 Self(RequestBuilder::new(stub))
18170 }
18171
18172 pub fn with_request<V: Into<crate::model::DetectIntentRequest>>(mut self, v: V) -> Self {
18174 self.0.request = v.into();
18175 self
18176 }
18177
18178 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18180 self.0.options = v.into();
18181 self
18182 }
18183
18184 pub async fn send(self) -> Result<crate::model::DetectIntentResponse> {
18186 (*self.0.stub)
18187 .detect_intent(self.0.request, self.0.options)
18188 .await
18189 .map(gax::response::Response::into_body)
18190 }
18191
18192 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
18196 self.0.request.session = v.into();
18197 self
18198 }
18199
18200 pub fn set_query_params<T>(mut self, v: T) -> Self
18202 where
18203 T: std::convert::Into<crate::model::QueryParameters>,
18204 {
18205 self.0.request.query_params = std::option::Option::Some(v.into());
18206 self
18207 }
18208
18209 pub fn set_or_clear_query_params<T>(mut self, v: std::option::Option<T>) -> Self
18211 where
18212 T: std::convert::Into<crate::model::QueryParameters>,
18213 {
18214 self.0.request.query_params = v.map(|x| x.into());
18215 self
18216 }
18217
18218 pub fn set_query_input<T>(mut self, v: T) -> Self
18222 where
18223 T: std::convert::Into<crate::model::QueryInput>,
18224 {
18225 self.0.request.query_input = std::option::Option::Some(v.into());
18226 self
18227 }
18228
18229 pub fn set_or_clear_query_input<T>(mut self, v: std::option::Option<T>) -> Self
18233 where
18234 T: std::convert::Into<crate::model::QueryInput>,
18235 {
18236 self.0.request.query_input = v.map(|x| x.into());
18237 self
18238 }
18239
18240 pub fn set_output_audio_config<T>(mut self, v: T) -> Self
18242 where
18243 T: std::convert::Into<crate::model::OutputAudioConfig>,
18244 {
18245 self.0.request.output_audio_config = std::option::Option::Some(v.into());
18246 self
18247 }
18248
18249 pub fn set_or_clear_output_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
18251 where
18252 T: std::convert::Into<crate::model::OutputAudioConfig>,
18253 {
18254 self.0.request.output_audio_config = v.map(|x| x.into());
18255 self
18256 }
18257
18258 pub fn set_output_audio_config_mask<T>(mut self, v: T) -> Self
18260 where
18261 T: std::convert::Into<wkt::FieldMask>,
18262 {
18263 self.0.request.output_audio_config_mask = std::option::Option::Some(v.into());
18264 self
18265 }
18266
18267 pub fn set_or_clear_output_audio_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
18269 where
18270 T: std::convert::Into<wkt::FieldMask>,
18271 {
18272 self.0.request.output_audio_config_mask = v.map(|x| x.into());
18273 self
18274 }
18275
18276 pub fn set_input_audio<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
18278 self.0.request.input_audio = v.into();
18279 self
18280 }
18281 }
18282
18283 #[doc(hidden)]
18284 impl gax::options::internal::RequestBuilder for DetectIntent {
18285 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18286 &mut self.0.options
18287 }
18288 }
18289
18290 #[derive(Clone, Debug)]
18312 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
18313
18314 impl ListLocations {
18315 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
18316 Self(RequestBuilder::new(stub))
18317 }
18318
18319 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
18321 mut self,
18322 v: V,
18323 ) -> Self {
18324 self.0.request = v.into();
18325 self
18326 }
18327
18328 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18330 self.0.options = v.into();
18331 self
18332 }
18333
18334 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
18336 (*self.0.stub)
18337 .list_locations(self.0.request, self.0.options)
18338 .await
18339 .map(gax::response::Response::into_body)
18340 }
18341
18342 pub fn by_page(
18344 self,
18345 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
18346 {
18347 use std::clone::Clone;
18348 let token = self.0.request.page_token.clone();
18349 let execute = move |token: String| {
18350 let mut builder = self.clone();
18351 builder.0.request = builder.0.request.set_page_token(token);
18352 builder.send()
18353 };
18354 gax::paginator::internal::new_paginator(token, execute)
18355 }
18356
18357 pub fn by_item(
18359 self,
18360 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
18361 {
18362 use gax::paginator::Paginator;
18363 self.by_page().items()
18364 }
18365
18366 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18368 self.0.request.name = v.into();
18369 self
18370 }
18371
18372 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
18374 self.0.request.filter = v.into();
18375 self
18376 }
18377
18378 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
18380 self.0.request.page_size = v.into();
18381 self
18382 }
18383
18384 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
18386 self.0.request.page_token = v.into();
18387 self
18388 }
18389 }
18390
18391 #[doc(hidden)]
18392 impl gax::options::internal::RequestBuilder for ListLocations {
18393 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18394 &mut self.0.options
18395 }
18396 }
18397
18398 #[derive(Clone, Debug)]
18416 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
18417
18418 impl GetLocation {
18419 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
18420 Self(RequestBuilder::new(stub))
18421 }
18422
18423 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
18425 self.0.request = v.into();
18426 self
18427 }
18428
18429 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18431 self.0.options = v.into();
18432 self
18433 }
18434
18435 pub async fn send(self) -> Result<location::model::Location> {
18437 (*self.0.stub)
18438 .get_location(self.0.request, self.0.options)
18439 .await
18440 .map(gax::response::Response::into_body)
18441 }
18442
18443 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18445 self.0.request.name = v.into();
18446 self
18447 }
18448 }
18449
18450 #[doc(hidden)]
18451 impl gax::options::internal::RequestBuilder for GetLocation {
18452 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18453 &mut self.0.options
18454 }
18455 }
18456
18457 #[derive(Clone, Debug)]
18479 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
18480
18481 impl ListOperations {
18482 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
18483 Self(RequestBuilder::new(stub))
18484 }
18485
18486 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
18488 mut self,
18489 v: V,
18490 ) -> Self {
18491 self.0.request = v.into();
18492 self
18493 }
18494
18495 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18497 self.0.options = v.into();
18498 self
18499 }
18500
18501 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
18503 (*self.0.stub)
18504 .list_operations(self.0.request, self.0.options)
18505 .await
18506 .map(gax::response::Response::into_body)
18507 }
18508
18509 pub fn by_page(
18511 self,
18512 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
18513 {
18514 use std::clone::Clone;
18515 let token = self.0.request.page_token.clone();
18516 let execute = move |token: String| {
18517 let mut builder = self.clone();
18518 builder.0.request = builder.0.request.set_page_token(token);
18519 builder.send()
18520 };
18521 gax::paginator::internal::new_paginator(token, execute)
18522 }
18523
18524 pub fn by_item(
18526 self,
18527 ) -> impl gax::paginator::ItemPaginator<
18528 longrunning::model::ListOperationsResponse,
18529 gax::error::Error,
18530 > {
18531 use gax::paginator::Paginator;
18532 self.by_page().items()
18533 }
18534
18535 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18537 self.0.request.name = v.into();
18538 self
18539 }
18540
18541 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
18543 self.0.request.filter = v.into();
18544 self
18545 }
18546
18547 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
18549 self.0.request.page_size = v.into();
18550 self
18551 }
18552
18553 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
18555 self.0.request.page_token = v.into();
18556 self
18557 }
18558
18559 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
18561 self.0.request.return_partial_success = v.into();
18562 self
18563 }
18564 }
18565
18566 #[doc(hidden)]
18567 impl gax::options::internal::RequestBuilder for ListOperations {
18568 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18569 &mut self.0.options
18570 }
18571 }
18572
18573 #[derive(Clone, Debug)]
18591 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
18592
18593 impl GetOperation {
18594 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
18595 Self(RequestBuilder::new(stub))
18596 }
18597
18598 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
18600 mut self,
18601 v: V,
18602 ) -> Self {
18603 self.0.request = v.into();
18604 self
18605 }
18606
18607 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18609 self.0.options = v.into();
18610 self
18611 }
18612
18613 pub async fn send(self) -> Result<longrunning::model::Operation> {
18615 (*self.0.stub)
18616 .get_operation(self.0.request, self.0.options)
18617 .await
18618 .map(gax::response::Response::into_body)
18619 }
18620
18621 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18623 self.0.request.name = v.into();
18624 self
18625 }
18626 }
18627
18628 #[doc(hidden)]
18629 impl gax::options::internal::RequestBuilder for GetOperation {
18630 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18631 &mut self.0.options
18632 }
18633 }
18634
18635 #[derive(Clone, Debug)]
18653 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
18654
18655 impl CancelOperation {
18656 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
18657 Self(RequestBuilder::new(stub))
18658 }
18659
18660 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
18662 mut self,
18663 v: V,
18664 ) -> Self {
18665 self.0.request = v.into();
18666 self
18667 }
18668
18669 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18671 self.0.options = v.into();
18672 self
18673 }
18674
18675 pub async fn send(self) -> Result<()> {
18677 (*self.0.stub)
18678 .cancel_operation(self.0.request, self.0.options)
18679 .await
18680 .map(gax::response::Response::into_body)
18681 }
18682
18683 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18685 self.0.request.name = v.into();
18686 self
18687 }
18688 }
18689
18690 #[doc(hidden)]
18691 impl gax::options::internal::RequestBuilder for CancelOperation {
18692 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18693 &mut self.0.options
18694 }
18695 }
18696}
18697
18698#[cfg(feature = "session-entity-types")]
18699#[cfg_attr(docsrs, doc(cfg(feature = "session-entity-types")))]
18700pub mod session_entity_types {
18701 use crate::Result;
18702
18703 pub type ClientBuilder =
18717 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
18718
18719 pub(crate) mod client {
18720 use super::super::super::client::SessionEntityTypes;
18721 pub struct Factory;
18722 impl gax::client_builder::internal::ClientFactory for Factory {
18723 type Client = SessionEntityTypes;
18724 type Credentials = gaxi::options::Credentials;
18725 async fn build(
18726 self,
18727 config: gaxi::options::ClientConfig,
18728 ) -> gax::client_builder::Result<Self::Client> {
18729 Self::Client::new(config).await
18730 }
18731 }
18732 }
18733
18734 #[derive(Clone, Debug)]
18736 pub(crate) struct RequestBuilder<R: std::default::Default> {
18737 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
18738 request: R,
18739 options: gax::options::RequestOptions,
18740 }
18741
18742 impl<R> RequestBuilder<R>
18743 where
18744 R: std::default::Default,
18745 {
18746 pub(crate) fn new(
18747 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
18748 ) -> Self {
18749 Self {
18750 stub,
18751 request: R::default(),
18752 options: gax::options::RequestOptions::default(),
18753 }
18754 }
18755 }
18756
18757 #[derive(Clone, Debug)]
18779 pub struct ListSessionEntityTypes(RequestBuilder<crate::model::ListSessionEntityTypesRequest>);
18780
18781 impl ListSessionEntityTypes {
18782 pub(crate) fn new(
18783 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
18784 ) -> Self {
18785 Self(RequestBuilder::new(stub))
18786 }
18787
18788 pub fn with_request<V: Into<crate::model::ListSessionEntityTypesRequest>>(
18790 mut self,
18791 v: V,
18792 ) -> Self {
18793 self.0.request = v.into();
18794 self
18795 }
18796
18797 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18799 self.0.options = v.into();
18800 self
18801 }
18802
18803 pub async fn send(self) -> Result<crate::model::ListSessionEntityTypesResponse> {
18805 (*self.0.stub)
18806 .list_session_entity_types(self.0.request, self.0.options)
18807 .await
18808 .map(gax::response::Response::into_body)
18809 }
18810
18811 pub fn by_page(
18813 self,
18814 ) -> impl gax::paginator::Paginator<
18815 crate::model::ListSessionEntityTypesResponse,
18816 gax::error::Error,
18817 > {
18818 use std::clone::Clone;
18819 let token = self.0.request.page_token.clone();
18820 let execute = move |token: String| {
18821 let mut builder = self.clone();
18822 builder.0.request = builder.0.request.set_page_token(token);
18823 builder.send()
18824 };
18825 gax::paginator::internal::new_paginator(token, execute)
18826 }
18827
18828 pub fn by_item(
18830 self,
18831 ) -> impl gax::paginator::ItemPaginator<
18832 crate::model::ListSessionEntityTypesResponse,
18833 gax::error::Error,
18834 > {
18835 use gax::paginator::Paginator;
18836 self.by_page().items()
18837 }
18838
18839 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18843 self.0.request.parent = v.into();
18844 self
18845 }
18846
18847 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
18849 self.0.request.page_size = v.into();
18850 self
18851 }
18852
18853 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
18855 self.0.request.page_token = v.into();
18856 self
18857 }
18858 }
18859
18860 #[doc(hidden)]
18861 impl gax::options::internal::RequestBuilder for ListSessionEntityTypes {
18862 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18863 &mut self.0.options
18864 }
18865 }
18866
18867 #[derive(Clone, Debug)]
18885 pub struct GetSessionEntityType(RequestBuilder<crate::model::GetSessionEntityTypeRequest>);
18886
18887 impl GetSessionEntityType {
18888 pub(crate) fn new(
18889 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
18890 ) -> Self {
18891 Self(RequestBuilder::new(stub))
18892 }
18893
18894 pub fn with_request<V: Into<crate::model::GetSessionEntityTypeRequest>>(
18896 mut self,
18897 v: V,
18898 ) -> Self {
18899 self.0.request = v.into();
18900 self
18901 }
18902
18903 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18905 self.0.options = v.into();
18906 self
18907 }
18908
18909 pub async fn send(self) -> Result<crate::model::SessionEntityType> {
18911 (*self.0.stub)
18912 .get_session_entity_type(self.0.request, self.0.options)
18913 .await
18914 .map(gax::response::Response::into_body)
18915 }
18916
18917 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18921 self.0.request.name = v.into();
18922 self
18923 }
18924 }
18925
18926 #[doc(hidden)]
18927 impl gax::options::internal::RequestBuilder for GetSessionEntityType {
18928 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18929 &mut self.0.options
18930 }
18931 }
18932
18933 #[derive(Clone, Debug)]
18951 pub struct CreateSessionEntityType(
18952 RequestBuilder<crate::model::CreateSessionEntityTypeRequest>,
18953 );
18954
18955 impl CreateSessionEntityType {
18956 pub(crate) fn new(
18957 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
18958 ) -> Self {
18959 Self(RequestBuilder::new(stub))
18960 }
18961
18962 pub fn with_request<V: Into<crate::model::CreateSessionEntityTypeRequest>>(
18964 mut self,
18965 v: V,
18966 ) -> Self {
18967 self.0.request = v.into();
18968 self
18969 }
18970
18971 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18973 self.0.options = v.into();
18974 self
18975 }
18976
18977 pub async fn send(self) -> Result<crate::model::SessionEntityType> {
18979 (*self.0.stub)
18980 .create_session_entity_type(self.0.request, self.0.options)
18981 .await
18982 .map(gax::response::Response::into_body)
18983 }
18984
18985 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18989 self.0.request.parent = v.into();
18990 self
18991 }
18992
18993 pub fn set_session_entity_type<T>(mut self, v: T) -> Self
18997 where
18998 T: std::convert::Into<crate::model::SessionEntityType>,
18999 {
19000 self.0.request.session_entity_type = std::option::Option::Some(v.into());
19001 self
19002 }
19003
19004 pub fn set_or_clear_session_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
19008 where
19009 T: std::convert::Into<crate::model::SessionEntityType>,
19010 {
19011 self.0.request.session_entity_type = v.map(|x| x.into());
19012 self
19013 }
19014 }
19015
19016 #[doc(hidden)]
19017 impl gax::options::internal::RequestBuilder for CreateSessionEntityType {
19018 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19019 &mut self.0.options
19020 }
19021 }
19022
19023 #[derive(Clone, Debug)]
19041 pub struct UpdateSessionEntityType(
19042 RequestBuilder<crate::model::UpdateSessionEntityTypeRequest>,
19043 );
19044
19045 impl UpdateSessionEntityType {
19046 pub(crate) fn new(
19047 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19048 ) -> Self {
19049 Self(RequestBuilder::new(stub))
19050 }
19051
19052 pub fn with_request<V: Into<crate::model::UpdateSessionEntityTypeRequest>>(
19054 mut self,
19055 v: V,
19056 ) -> Self {
19057 self.0.request = v.into();
19058 self
19059 }
19060
19061 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19063 self.0.options = v.into();
19064 self
19065 }
19066
19067 pub async fn send(self) -> Result<crate::model::SessionEntityType> {
19069 (*self.0.stub)
19070 .update_session_entity_type(self.0.request, self.0.options)
19071 .await
19072 .map(gax::response::Response::into_body)
19073 }
19074
19075 pub fn set_session_entity_type<T>(mut self, v: T) -> Self
19079 where
19080 T: std::convert::Into<crate::model::SessionEntityType>,
19081 {
19082 self.0.request.session_entity_type = std::option::Option::Some(v.into());
19083 self
19084 }
19085
19086 pub fn set_or_clear_session_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
19090 where
19091 T: std::convert::Into<crate::model::SessionEntityType>,
19092 {
19093 self.0.request.session_entity_type = v.map(|x| x.into());
19094 self
19095 }
19096
19097 pub fn set_update_mask<T>(mut self, v: T) -> Self
19099 where
19100 T: std::convert::Into<wkt::FieldMask>,
19101 {
19102 self.0.request.update_mask = std::option::Option::Some(v.into());
19103 self
19104 }
19105
19106 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
19108 where
19109 T: std::convert::Into<wkt::FieldMask>,
19110 {
19111 self.0.request.update_mask = v.map(|x| x.into());
19112 self
19113 }
19114 }
19115
19116 #[doc(hidden)]
19117 impl gax::options::internal::RequestBuilder for UpdateSessionEntityType {
19118 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19119 &mut self.0.options
19120 }
19121 }
19122
19123 #[derive(Clone, Debug)]
19141 pub struct DeleteSessionEntityType(
19142 RequestBuilder<crate::model::DeleteSessionEntityTypeRequest>,
19143 );
19144
19145 impl DeleteSessionEntityType {
19146 pub(crate) fn new(
19147 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19148 ) -> Self {
19149 Self(RequestBuilder::new(stub))
19150 }
19151
19152 pub fn with_request<V: Into<crate::model::DeleteSessionEntityTypeRequest>>(
19154 mut self,
19155 v: V,
19156 ) -> Self {
19157 self.0.request = v.into();
19158 self
19159 }
19160
19161 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19163 self.0.options = v.into();
19164 self
19165 }
19166
19167 pub async fn send(self) -> Result<()> {
19169 (*self.0.stub)
19170 .delete_session_entity_type(self.0.request, self.0.options)
19171 .await
19172 .map(gax::response::Response::into_body)
19173 }
19174
19175 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19179 self.0.request.name = v.into();
19180 self
19181 }
19182 }
19183
19184 #[doc(hidden)]
19185 impl gax::options::internal::RequestBuilder for DeleteSessionEntityType {
19186 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19187 &mut self.0.options
19188 }
19189 }
19190
19191 #[derive(Clone, Debug)]
19213 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
19214
19215 impl ListLocations {
19216 pub(crate) fn new(
19217 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19218 ) -> Self {
19219 Self(RequestBuilder::new(stub))
19220 }
19221
19222 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
19224 mut self,
19225 v: V,
19226 ) -> Self {
19227 self.0.request = v.into();
19228 self
19229 }
19230
19231 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19233 self.0.options = v.into();
19234 self
19235 }
19236
19237 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
19239 (*self.0.stub)
19240 .list_locations(self.0.request, self.0.options)
19241 .await
19242 .map(gax::response::Response::into_body)
19243 }
19244
19245 pub fn by_page(
19247 self,
19248 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
19249 {
19250 use std::clone::Clone;
19251 let token = self.0.request.page_token.clone();
19252 let execute = move |token: String| {
19253 let mut builder = self.clone();
19254 builder.0.request = builder.0.request.set_page_token(token);
19255 builder.send()
19256 };
19257 gax::paginator::internal::new_paginator(token, execute)
19258 }
19259
19260 pub fn by_item(
19262 self,
19263 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
19264 {
19265 use gax::paginator::Paginator;
19266 self.by_page().items()
19267 }
19268
19269 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19271 self.0.request.name = v.into();
19272 self
19273 }
19274
19275 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
19277 self.0.request.filter = v.into();
19278 self
19279 }
19280
19281 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
19283 self.0.request.page_size = v.into();
19284 self
19285 }
19286
19287 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
19289 self.0.request.page_token = v.into();
19290 self
19291 }
19292 }
19293
19294 #[doc(hidden)]
19295 impl gax::options::internal::RequestBuilder for ListLocations {
19296 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19297 &mut self.0.options
19298 }
19299 }
19300
19301 #[derive(Clone, Debug)]
19319 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
19320
19321 impl GetLocation {
19322 pub(crate) fn new(
19323 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19324 ) -> Self {
19325 Self(RequestBuilder::new(stub))
19326 }
19327
19328 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
19330 self.0.request = v.into();
19331 self
19332 }
19333
19334 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19336 self.0.options = v.into();
19337 self
19338 }
19339
19340 pub async fn send(self) -> Result<location::model::Location> {
19342 (*self.0.stub)
19343 .get_location(self.0.request, self.0.options)
19344 .await
19345 .map(gax::response::Response::into_body)
19346 }
19347
19348 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19350 self.0.request.name = v.into();
19351 self
19352 }
19353 }
19354
19355 #[doc(hidden)]
19356 impl gax::options::internal::RequestBuilder for GetLocation {
19357 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19358 &mut self.0.options
19359 }
19360 }
19361
19362 #[derive(Clone, Debug)]
19384 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
19385
19386 impl ListOperations {
19387 pub(crate) fn new(
19388 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19389 ) -> Self {
19390 Self(RequestBuilder::new(stub))
19391 }
19392
19393 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
19395 mut self,
19396 v: V,
19397 ) -> Self {
19398 self.0.request = v.into();
19399 self
19400 }
19401
19402 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19404 self.0.options = v.into();
19405 self
19406 }
19407
19408 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
19410 (*self.0.stub)
19411 .list_operations(self.0.request, self.0.options)
19412 .await
19413 .map(gax::response::Response::into_body)
19414 }
19415
19416 pub fn by_page(
19418 self,
19419 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
19420 {
19421 use std::clone::Clone;
19422 let token = self.0.request.page_token.clone();
19423 let execute = move |token: String| {
19424 let mut builder = self.clone();
19425 builder.0.request = builder.0.request.set_page_token(token);
19426 builder.send()
19427 };
19428 gax::paginator::internal::new_paginator(token, execute)
19429 }
19430
19431 pub fn by_item(
19433 self,
19434 ) -> impl gax::paginator::ItemPaginator<
19435 longrunning::model::ListOperationsResponse,
19436 gax::error::Error,
19437 > {
19438 use gax::paginator::Paginator;
19439 self.by_page().items()
19440 }
19441
19442 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19444 self.0.request.name = v.into();
19445 self
19446 }
19447
19448 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
19450 self.0.request.filter = v.into();
19451 self
19452 }
19453
19454 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
19456 self.0.request.page_size = v.into();
19457 self
19458 }
19459
19460 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
19462 self.0.request.page_token = v.into();
19463 self
19464 }
19465
19466 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
19468 self.0.request.return_partial_success = v.into();
19469 self
19470 }
19471 }
19472
19473 #[doc(hidden)]
19474 impl gax::options::internal::RequestBuilder for ListOperations {
19475 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19476 &mut self.0.options
19477 }
19478 }
19479
19480 #[derive(Clone, Debug)]
19498 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
19499
19500 impl GetOperation {
19501 pub(crate) fn new(
19502 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19503 ) -> Self {
19504 Self(RequestBuilder::new(stub))
19505 }
19506
19507 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
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<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19518 self.0.options = v.into();
19519 self
19520 }
19521
19522 pub async fn send(self) -> Result<longrunning::model::Operation> {
19524 (*self.0.stub)
19525 .get_operation(self.0.request, self.0.options)
19526 .await
19527 .map(gax::response::Response::into_body)
19528 }
19529
19530 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19532 self.0.request.name = v.into();
19533 self
19534 }
19535 }
19536
19537 #[doc(hidden)]
19538 impl gax::options::internal::RequestBuilder for GetOperation {
19539 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19540 &mut self.0.options
19541 }
19542 }
19543
19544 #[derive(Clone, Debug)]
19562 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
19563
19564 impl CancelOperation {
19565 pub(crate) fn new(
19566 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19567 ) -> Self {
19568 Self(RequestBuilder::new(stub))
19569 }
19570
19571 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
19573 mut self,
19574 v: V,
19575 ) -> Self {
19576 self.0.request = v.into();
19577 self
19578 }
19579
19580 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19582 self.0.options = v.into();
19583 self
19584 }
19585
19586 pub async fn send(self) -> Result<()> {
19588 (*self.0.stub)
19589 .cancel_operation(self.0.request, self.0.options)
19590 .await
19591 .map(gax::response::Response::into_body)
19592 }
19593
19594 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19596 self.0.request.name = v.into();
19597 self
19598 }
19599 }
19600
19601 #[doc(hidden)]
19602 impl gax::options::internal::RequestBuilder for CancelOperation {
19603 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19604 &mut self.0.options
19605 }
19606 }
19607}
19608
19609#[cfg(feature = "versions")]
19610#[cfg_attr(docsrs, doc(cfg(feature = "versions")))]
19611pub mod versions {
19612 use crate::Result;
19613
19614 pub type ClientBuilder =
19628 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
19629
19630 pub(crate) mod client {
19631 use super::super::super::client::Versions;
19632 pub struct Factory;
19633 impl gax::client_builder::internal::ClientFactory for Factory {
19634 type Client = Versions;
19635 type Credentials = gaxi::options::Credentials;
19636 async fn build(
19637 self,
19638 config: gaxi::options::ClientConfig,
19639 ) -> gax::client_builder::Result<Self::Client> {
19640 Self::Client::new(config).await
19641 }
19642 }
19643 }
19644
19645 #[derive(Clone, Debug)]
19647 pub(crate) struct RequestBuilder<R: std::default::Default> {
19648 stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>,
19649 request: R,
19650 options: gax::options::RequestOptions,
19651 }
19652
19653 impl<R> RequestBuilder<R>
19654 where
19655 R: std::default::Default,
19656 {
19657 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
19658 Self {
19659 stub,
19660 request: R::default(),
19661 options: gax::options::RequestOptions::default(),
19662 }
19663 }
19664 }
19665
19666 #[derive(Clone, Debug)]
19688 pub struct ListVersions(RequestBuilder<crate::model::ListVersionsRequest>);
19689
19690 impl ListVersions {
19691 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
19692 Self(RequestBuilder::new(stub))
19693 }
19694
19695 pub fn with_request<V: Into<crate::model::ListVersionsRequest>>(mut self, v: V) -> Self {
19697 self.0.request = v.into();
19698 self
19699 }
19700
19701 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19703 self.0.options = v.into();
19704 self
19705 }
19706
19707 pub async fn send(self) -> Result<crate::model::ListVersionsResponse> {
19709 (*self.0.stub)
19710 .list_versions(self.0.request, self.0.options)
19711 .await
19712 .map(gax::response::Response::into_body)
19713 }
19714
19715 pub fn by_page(
19717 self,
19718 ) -> impl gax::paginator::Paginator<crate::model::ListVersionsResponse, gax::error::Error>
19719 {
19720 use std::clone::Clone;
19721 let token = self.0.request.page_token.clone();
19722 let execute = move |token: String| {
19723 let mut builder = self.clone();
19724 builder.0.request = builder.0.request.set_page_token(token);
19725 builder.send()
19726 };
19727 gax::paginator::internal::new_paginator(token, execute)
19728 }
19729
19730 pub fn by_item(
19732 self,
19733 ) -> impl gax::paginator::ItemPaginator<crate::model::ListVersionsResponse, gax::error::Error>
19734 {
19735 use gax::paginator::Paginator;
19736 self.by_page().items()
19737 }
19738
19739 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
19743 self.0.request.parent = v.into();
19744 self
19745 }
19746
19747 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
19749 self.0.request.page_size = v.into();
19750 self
19751 }
19752
19753 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
19755 self.0.request.page_token = v.into();
19756 self
19757 }
19758 }
19759
19760 #[doc(hidden)]
19761 impl gax::options::internal::RequestBuilder for ListVersions {
19762 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19763 &mut self.0.options
19764 }
19765 }
19766
19767 #[derive(Clone, Debug)]
19785 pub struct GetVersion(RequestBuilder<crate::model::GetVersionRequest>);
19786
19787 impl GetVersion {
19788 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
19789 Self(RequestBuilder::new(stub))
19790 }
19791
19792 pub fn with_request<V: Into<crate::model::GetVersionRequest>>(mut self, v: V) -> Self {
19794 self.0.request = v.into();
19795 self
19796 }
19797
19798 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19800 self.0.options = v.into();
19801 self
19802 }
19803
19804 pub async fn send(self) -> Result<crate::model::Version> {
19806 (*self.0.stub)
19807 .get_version(self.0.request, self.0.options)
19808 .await
19809 .map(gax::response::Response::into_body)
19810 }
19811
19812 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19816 self.0.request.name = v.into();
19817 self
19818 }
19819 }
19820
19821 #[doc(hidden)]
19822 impl gax::options::internal::RequestBuilder for GetVersion {
19823 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19824 &mut self.0.options
19825 }
19826 }
19827
19828 #[derive(Clone, Debug)]
19846 pub struct CreateVersion(RequestBuilder<crate::model::CreateVersionRequest>);
19847
19848 impl CreateVersion {
19849 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
19850 Self(RequestBuilder::new(stub))
19851 }
19852
19853 pub fn with_request<V: Into<crate::model::CreateVersionRequest>>(mut self, v: V) -> Self {
19855 self.0.request = v.into();
19856 self
19857 }
19858
19859 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19861 self.0.options = v.into();
19862 self
19863 }
19864
19865 pub async fn send(self) -> Result<crate::model::Version> {
19867 (*self.0.stub)
19868 .create_version(self.0.request, self.0.options)
19869 .await
19870 .map(gax::response::Response::into_body)
19871 }
19872
19873 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
19877 self.0.request.parent = v.into();
19878 self
19879 }
19880
19881 pub fn set_version<T>(mut self, v: T) -> Self
19885 where
19886 T: std::convert::Into<crate::model::Version>,
19887 {
19888 self.0.request.version = std::option::Option::Some(v.into());
19889 self
19890 }
19891
19892 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
19896 where
19897 T: std::convert::Into<crate::model::Version>,
19898 {
19899 self.0.request.version = v.map(|x| x.into());
19900 self
19901 }
19902 }
19903
19904 #[doc(hidden)]
19905 impl gax::options::internal::RequestBuilder for CreateVersion {
19906 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19907 &mut self.0.options
19908 }
19909 }
19910
19911 #[derive(Clone, Debug)]
19929 pub struct UpdateVersion(RequestBuilder<crate::model::UpdateVersionRequest>);
19930
19931 impl UpdateVersion {
19932 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
19933 Self(RequestBuilder::new(stub))
19934 }
19935
19936 pub fn with_request<V: Into<crate::model::UpdateVersionRequest>>(mut self, v: V) -> Self {
19938 self.0.request = v.into();
19939 self
19940 }
19941
19942 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19944 self.0.options = v.into();
19945 self
19946 }
19947
19948 pub async fn send(self) -> Result<crate::model::Version> {
19950 (*self.0.stub)
19951 .update_version(self.0.request, self.0.options)
19952 .await
19953 .map(gax::response::Response::into_body)
19954 }
19955
19956 pub fn set_version<T>(mut self, v: T) -> Self
19960 where
19961 T: std::convert::Into<crate::model::Version>,
19962 {
19963 self.0.request.version = std::option::Option::Some(v.into());
19964 self
19965 }
19966
19967 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
19971 where
19972 T: std::convert::Into<crate::model::Version>,
19973 {
19974 self.0.request.version = v.map(|x| x.into());
19975 self
19976 }
19977
19978 pub fn set_update_mask<T>(mut self, v: T) -> Self
19982 where
19983 T: std::convert::Into<wkt::FieldMask>,
19984 {
19985 self.0.request.update_mask = std::option::Option::Some(v.into());
19986 self
19987 }
19988
19989 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
19993 where
19994 T: std::convert::Into<wkt::FieldMask>,
19995 {
19996 self.0.request.update_mask = v.map(|x| x.into());
19997 self
19998 }
19999 }
20000
20001 #[doc(hidden)]
20002 impl gax::options::internal::RequestBuilder for UpdateVersion {
20003 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20004 &mut self.0.options
20005 }
20006 }
20007
20008 #[derive(Clone, Debug)]
20026 pub struct DeleteVersion(RequestBuilder<crate::model::DeleteVersionRequest>);
20027
20028 impl DeleteVersion {
20029 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
20030 Self(RequestBuilder::new(stub))
20031 }
20032
20033 pub fn with_request<V: Into<crate::model::DeleteVersionRequest>>(mut self, v: V) -> Self {
20035 self.0.request = v.into();
20036 self
20037 }
20038
20039 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20041 self.0.options = v.into();
20042 self
20043 }
20044
20045 pub async fn send(self) -> Result<()> {
20047 (*self.0.stub)
20048 .delete_version(self.0.request, self.0.options)
20049 .await
20050 .map(gax::response::Response::into_body)
20051 }
20052
20053 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20057 self.0.request.name = v.into();
20058 self
20059 }
20060 }
20061
20062 #[doc(hidden)]
20063 impl gax::options::internal::RequestBuilder for DeleteVersion {
20064 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20065 &mut self.0.options
20066 }
20067 }
20068
20069 #[derive(Clone, Debug)]
20091 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
20092
20093 impl ListLocations {
20094 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
20095 Self(RequestBuilder::new(stub))
20096 }
20097
20098 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
20100 mut self,
20101 v: V,
20102 ) -> Self {
20103 self.0.request = v.into();
20104 self
20105 }
20106
20107 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20109 self.0.options = v.into();
20110 self
20111 }
20112
20113 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
20115 (*self.0.stub)
20116 .list_locations(self.0.request, self.0.options)
20117 .await
20118 .map(gax::response::Response::into_body)
20119 }
20120
20121 pub fn by_page(
20123 self,
20124 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
20125 {
20126 use std::clone::Clone;
20127 let token = self.0.request.page_token.clone();
20128 let execute = move |token: String| {
20129 let mut builder = self.clone();
20130 builder.0.request = builder.0.request.set_page_token(token);
20131 builder.send()
20132 };
20133 gax::paginator::internal::new_paginator(token, execute)
20134 }
20135
20136 pub fn by_item(
20138 self,
20139 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
20140 {
20141 use gax::paginator::Paginator;
20142 self.by_page().items()
20143 }
20144
20145 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20147 self.0.request.name = v.into();
20148 self
20149 }
20150
20151 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
20153 self.0.request.filter = v.into();
20154 self
20155 }
20156
20157 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
20159 self.0.request.page_size = v.into();
20160 self
20161 }
20162
20163 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
20165 self.0.request.page_token = v.into();
20166 self
20167 }
20168 }
20169
20170 #[doc(hidden)]
20171 impl gax::options::internal::RequestBuilder for ListLocations {
20172 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20173 &mut self.0.options
20174 }
20175 }
20176
20177 #[derive(Clone, Debug)]
20195 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
20196
20197 impl GetLocation {
20198 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
20199 Self(RequestBuilder::new(stub))
20200 }
20201
20202 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
20204 self.0.request = v.into();
20205 self
20206 }
20207
20208 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20210 self.0.options = v.into();
20211 self
20212 }
20213
20214 pub async fn send(self) -> Result<location::model::Location> {
20216 (*self.0.stub)
20217 .get_location(self.0.request, self.0.options)
20218 .await
20219 .map(gax::response::Response::into_body)
20220 }
20221
20222 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20224 self.0.request.name = v.into();
20225 self
20226 }
20227 }
20228
20229 #[doc(hidden)]
20230 impl gax::options::internal::RequestBuilder for GetLocation {
20231 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20232 &mut self.0.options
20233 }
20234 }
20235
20236 #[derive(Clone, Debug)]
20258 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
20259
20260 impl ListOperations {
20261 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
20262 Self(RequestBuilder::new(stub))
20263 }
20264
20265 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
20267 mut self,
20268 v: V,
20269 ) -> Self {
20270 self.0.request = v.into();
20271 self
20272 }
20273
20274 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20276 self.0.options = v.into();
20277 self
20278 }
20279
20280 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
20282 (*self.0.stub)
20283 .list_operations(self.0.request, self.0.options)
20284 .await
20285 .map(gax::response::Response::into_body)
20286 }
20287
20288 pub fn by_page(
20290 self,
20291 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
20292 {
20293 use std::clone::Clone;
20294 let token = self.0.request.page_token.clone();
20295 let execute = move |token: String| {
20296 let mut builder = self.clone();
20297 builder.0.request = builder.0.request.set_page_token(token);
20298 builder.send()
20299 };
20300 gax::paginator::internal::new_paginator(token, execute)
20301 }
20302
20303 pub fn by_item(
20305 self,
20306 ) -> impl gax::paginator::ItemPaginator<
20307 longrunning::model::ListOperationsResponse,
20308 gax::error::Error,
20309 > {
20310 use gax::paginator::Paginator;
20311 self.by_page().items()
20312 }
20313
20314 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20316 self.0.request.name = v.into();
20317 self
20318 }
20319
20320 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
20322 self.0.request.filter = v.into();
20323 self
20324 }
20325
20326 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
20328 self.0.request.page_size = v.into();
20329 self
20330 }
20331
20332 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
20334 self.0.request.page_token = v.into();
20335 self
20336 }
20337
20338 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
20340 self.0.request.return_partial_success = v.into();
20341 self
20342 }
20343 }
20344
20345 #[doc(hidden)]
20346 impl gax::options::internal::RequestBuilder for ListOperations {
20347 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20348 &mut self.0.options
20349 }
20350 }
20351
20352 #[derive(Clone, Debug)]
20370 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
20371
20372 impl GetOperation {
20373 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
20374 Self(RequestBuilder::new(stub))
20375 }
20376
20377 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
20379 mut self,
20380 v: V,
20381 ) -> Self {
20382 self.0.request = v.into();
20383 self
20384 }
20385
20386 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20388 self.0.options = v.into();
20389 self
20390 }
20391
20392 pub async fn send(self) -> Result<longrunning::model::Operation> {
20394 (*self.0.stub)
20395 .get_operation(self.0.request, self.0.options)
20396 .await
20397 .map(gax::response::Response::into_body)
20398 }
20399
20400 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20402 self.0.request.name = v.into();
20403 self
20404 }
20405 }
20406
20407 #[doc(hidden)]
20408 impl gax::options::internal::RequestBuilder for GetOperation {
20409 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20410 &mut self.0.options
20411 }
20412 }
20413
20414 #[derive(Clone, Debug)]
20432 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
20433
20434 impl CancelOperation {
20435 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
20436 Self(RequestBuilder::new(stub))
20437 }
20438
20439 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
20441 mut self,
20442 v: V,
20443 ) -> Self {
20444 self.0.request = v.into();
20445 self
20446 }
20447
20448 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20450 self.0.options = v.into();
20451 self
20452 }
20453
20454 pub async fn send(self) -> Result<()> {
20456 (*self.0.stub)
20457 .cancel_operation(self.0.request, self.0.options)
20458 .await
20459 .map(gax::response::Response::into_body)
20460 }
20461
20462 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20464 self.0.request.name = v.into();
20465 self
20466 }
20467 }
20468
20469 #[doc(hidden)]
20470 impl gax::options::internal::RequestBuilder for CancelOperation {
20471 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20472 &mut self.0.options
20473 }
20474 }
20475}