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)]
91 pub struct GetAgent(RequestBuilder<crate::model::GetAgentRequest>);
92
93 impl GetAgent {
94 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
95 Self(RequestBuilder::new(stub))
96 }
97
98 pub fn with_request<V: Into<crate::model::GetAgentRequest>>(mut self, v: V) -> Self {
100 self.0.request = v.into();
101 self
102 }
103
104 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
106 self.0.options = v.into();
107 self
108 }
109
110 pub async fn send(self) -> Result<crate::model::Agent> {
112 (*self.0.stub)
113 .get_agent(self.0.request, self.0.options)
114 .await
115 .map(gax::response::Response::into_body)
116 }
117
118 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
122 self.0.request.parent = v.into();
123 self
124 }
125 }
126
127 #[doc(hidden)]
128 impl gax::options::internal::RequestBuilder for GetAgent {
129 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
130 &mut self.0.options
131 }
132 }
133
134 #[derive(Clone, Debug)]
151 pub struct SetAgent(RequestBuilder<crate::model::SetAgentRequest>);
152
153 impl SetAgent {
154 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
155 Self(RequestBuilder::new(stub))
156 }
157
158 pub fn with_request<V: Into<crate::model::SetAgentRequest>>(mut self, v: V) -> Self {
160 self.0.request = v.into();
161 self
162 }
163
164 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
166 self.0.options = v.into();
167 self
168 }
169
170 pub async fn send(self) -> Result<crate::model::Agent> {
172 (*self.0.stub)
173 .set_agent(self.0.request, self.0.options)
174 .await
175 .map(gax::response::Response::into_body)
176 }
177
178 pub fn set_agent<T>(mut self, v: T) -> Self
182 where
183 T: std::convert::Into<crate::model::Agent>,
184 {
185 self.0.request.agent = std::option::Option::Some(v.into());
186 self
187 }
188
189 pub fn set_or_clear_agent<T>(mut self, v: std::option::Option<T>) -> Self
193 where
194 T: std::convert::Into<crate::model::Agent>,
195 {
196 self.0.request.agent = v.map(|x| x.into());
197 self
198 }
199
200 pub fn set_update_mask<T>(mut self, v: T) -> Self
202 where
203 T: std::convert::Into<wkt::FieldMask>,
204 {
205 self.0.request.update_mask = std::option::Option::Some(v.into());
206 self
207 }
208
209 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
211 where
212 T: std::convert::Into<wkt::FieldMask>,
213 {
214 self.0.request.update_mask = v.map(|x| x.into());
215 self
216 }
217 }
218
219 #[doc(hidden)]
220 impl gax::options::internal::RequestBuilder for SetAgent {
221 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
222 &mut self.0.options
223 }
224 }
225
226 #[derive(Clone, Debug)]
243 pub struct DeleteAgent(RequestBuilder<crate::model::DeleteAgentRequest>);
244
245 impl DeleteAgent {
246 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
247 Self(RequestBuilder::new(stub))
248 }
249
250 pub fn with_request<V: Into<crate::model::DeleteAgentRequest>>(mut self, v: V) -> Self {
252 self.0.request = v.into();
253 self
254 }
255
256 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
258 self.0.options = v.into();
259 self
260 }
261
262 pub async fn send(self) -> Result<()> {
264 (*self.0.stub)
265 .delete_agent(self.0.request, self.0.options)
266 .await
267 .map(gax::response::Response::into_body)
268 }
269
270 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
274 self.0.request.parent = v.into();
275 self
276 }
277 }
278
279 #[doc(hidden)]
280 impl gax::options::internal::RequestBuilder for DeleteAgent {
281 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
282 &mut self.0.options
283 }
284 }
285
286 #[derive(Clone, Debug)]
307 pub struct SearchAgents(RequestBuilder<crate::model::SearchAgentsRequest>);
308
309 impl SearchAgents {
310 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
311 Self(RequestBuilder::new(stub))
312 }
313
314 pub fn with_request<V: Into<crate::model::SearchAgentsRequest>>(mut self, v: V) -> Self {
316 self.0.request = v.into();
317 self
318 }
319
320 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
322 self.0.options = v.into();
323 self
324 }
325
326 pub async fn send(self) -> Result<crate::model::SearchAgentsResponse> {
328 (*self.0.stub)
329 .search_agents(self.0.request, self.0.options)
330 .await
331 .map(gax::response::Response::into_body)
332 }
333
334 pub fn by_page(
336 self,
337 ) -> impl gax::paginator::Paginator<crate::model::SearchAgentsResponse, gax::error::Error>
338 {
339 use std::clone::Clone;
340 let token = self.0.request.page_token.clone();
341 let execute = move |token: String| {
342 let mut builder = self.clone();
343 builder.0.request = builder.0.request.set_page_token(token);
344 builder.send()
345 };
346 gax::paginator::internal::new_paginator(token, execute)
347 }
348
349 pub fn by_item(
351 self,
352 ) -> impl gax::paginator::ItemPaginator<crate::model::SearchAgentsResponse, gax::error::Error>
353 {
354 use gax::paginator::Paginator;
355 self.by_page().items()
356 }
357
358 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
362 self.0.request.parent = v.into();
363 self
364 }
365
366 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
368 self.0.request.page_size = v.into();
369 self
370 }
371
372 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
374 self.0.request.page_token = v.into();
375 self
376 }
377 }
378
379 #[doc(hidden)]
380 impl gax::options::internal::RequestBuilder for SearchAgents {
381 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
382 &mut self.0.options
383 }
384 }
385
386 #[derive(Clone, Debug)]
404 pub struct TrainAgent(RequestBuilder<crate::model::TrainAgentRequest>);
405
406 impl TrainAgent {
407 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
408 Self(RequestBuilder::new(stub))
409 }
410
411 pub fn with_request<V: Into<crate::model::TrainAgentRequest>>(mut self, v: V) -> Self {
413 self.0.request = v.into();
414 self
415 }
416
417 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
419 self.0.options = v.into();
420 self
421 }
422
423 pub async fn send(self) -> Result<longrunning::model::Operation> {
430 (*self.0.stub)
431 .train_agent(self.0.request, self.0.options)
432 .await
433 .map(gax::response::Response::into_body)
434 }
435
436 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
438 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
439 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
440 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
441
442 let stub = self.0.stub.clone();
443 let mut options = self.0.options.clone();
444 options.set_retry_policy(gax::retry_policy::NeverRetry);
445 let query = move |name| {
446 let stub = stub.clone();
447 let options = options.clone();
448 async {
449 let op = GetOperation::new(stub)
450 .set_name(name)
451 .with_options(options)
452 .send()
453 .await?;
454 Ok(Operation::new(op))
455 }
456 };
457
458 let start = move || async {
459 let op = self.send().await?;
460 Ok(Operation::new(op))
461 };
462
463 lro::internal::new_unit_response_poller(
464 polling_error_policy,
465 polling_backoff_policy,
466 start,
467 query,
468 )
469 }
470
471 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
475 self.0.request.parent = v.into();
476 self
477 }
478 }
479
480 #[doc(hidden)]
481 impl gax::options::internal::RequestBuilder for TrainAgent {
482 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
483 &mut self.0.options
484 }
485 }
486
487 #[derive(Clone, Debug)]
505 pub struct ExportAgent(RequestBuilder<crate::model::ExportAgentRequest>);
506
507 impl ExportAgent {
508 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
509 Self(RequestBuilder::new(stub))
510 }
511
512 pub fn with_request<V: Into<crate::model::ExportAgentRequest>>(mut self, v: V) -> Self {
514 self.0.request = v.into();
515 self
516 }
517
518 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
520 self.0.options = v.into();
521 self
522 }
523
524 pub async fn send(self) -> Result<longrunning::model::Operation> {
531 (*self.0.stub)
532 .export_agent(self.0.request, self.0.options)
533 .await
534 .map(gax::response::Response::into_body)
535 }
536
537 pub fn poller(self) -> impl lro::Poller<crate::model::ExportAgentResponse, wkt::Struct> {
539 type Operation =
540 lro::internal::Operation<crate::model::ExportAgentResponse, wkt::Struct>;
541 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
542 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
543
544 let stub = self.0.stub.clone();
545 let mut options = self.0.options.clone();
546 options.set_retry_policy(gax::retry_policy::NeverRetry);
547 let query = move |name| {
548 let stub = stub.clone();
549 let options = options.clone();
550 async {
551 let op = GetOperation::new(stub)
552 .set_name(name)
553 .with_options(options)
554 .send()
555 .await?;
556 Ok(Operation::new(op))
557 }
558 };
559
560 let start = move || async {
561 let op = self.send().await?;
562 Ok(Operation::new(op))
563 };
564
565 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
566 }
567
568 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
572 self.0.request.parent = v.into();
573 self
574 }
575
576 pub fn set_agent_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
580 self.0.request.agent_uri = v.into();
581 self
582 }
583 }
584
585 #[doc(hidden)]
586 impl gax::options::internal::RequestBuilder for ExportAgent {
587 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
588 &mut self.0.options
589 }
590 }
591
592 #[derive(Clone, Debug)]
610 pub struct ImportAgent(RequestBuilder<crate::model::ImportAgentRequest>);
611
612 impl ImportAgent {
613 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
614 Self(RequestBuilder::new(stub))
615 }
616
617 pub fn with_request<V: Into<crate::model::ImportAgentRequest>>(mut self, v: V) -> Self {
619 self.0.request = v.into();
620 self
621 }
622
623 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
625 self.0.options = v.into();
626 self
627 }
628
629 pub async fn send(self) -> Result<longrunning::model::Operation> {
636 (*self.0.stub)
637 .import_agent(self.0.request, self.0.options)
638 .await
639 .map(gax::response::Response::into_body)
640 }
641
642 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
644 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
645 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
646 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
647
648 let stub = self.0.stub.clone();
649 let mut options = self.0.options.clone();
650 options.set_retry_policy(gax::retry_policy::NeverRetry);
651 let query = move |name| {
652 let stub = stub.clone();
653 let options = options.clone();
654 async {
655 let op = GetOperation::new(stub)
656 .set_name(name)
657 .with_options(options)
658 .send()
659 .await?;
660 Ok(Operation::new(op))
661 }
662 };
663
664 let start = move || async {
665 let op = self.send().await?;
666 Ok(Operation::new(op))
667 };
668
669 lro::internal::new_unit_response_poller(
670 polling_error_policy,
671 polling_backoff_policy,
672 start,
673 query,
674 )
675 }
676
677 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
681 self.0.request.parent = v.into();
682 self
683 }
684
685 pub fn set_agent<T: Into<Option<crate::model::import_agent_request::Agent>>>(
690 mut self,
691 v: T,
692 ) -> Self {
693 self.0.request.agent = v.into();
694 self
695 }
696
697 pub fn set_agent_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
703 self.0.request = self.0.request.set_agent_uri(v);
704 self
705 }
706
707 pub fn set_agent_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
713 self.0.request = self.0.request.set_agent_content(v);
714 self
715 }
716 }
717
718 #[doc(hidden)]
719 impl gax::options::internal::RequestBuilder for ImportAgent {
720 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
721 &mut self.0.options
722 }
723 }
724
725 #[derive(Clone, Debug)]
743 pub struct RestoreAgent(RequestBuilder<crate::model::RestoreAgentRequest>);
744
745 impl RestoreAgent {
746 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
747 Self(RequestBuilder::new(stub))
748 }
749
750 pub fn with_request<V: Into<crate::model::RestoreAgentRequest>>(mut self, v: V) -> Self {
752 self.0.request = v.into();
753 self
754 }
755
756 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
758 self.0.options = v.into();
759 self
760 }
761
762 pub async fn send(self) -> Result<longrunning::model::Operation> {
769 (*self.0.stub)
770 .restore_agent(self.0.request, self.0.options)
771 .await
772 .map(gax::response::Response::into_body)
773 }
774
775 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
777 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
778 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
779 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
780
781 let stub = self.0.stub.clone();
782 let mut options = self.0.options.clone();
783 options.set_retry_policy(gax::retry_policy::NeverRetry);
784 let query = move |name| {
785 let stub = stub.clone();
786 let options = options.clone();
787 async {
788 let op = GetOperation::new(stub)
789 .set_name(name)
790 .with_options(options)
791 .send()
792 .await?;
793 Ok(Operation::new(op))
794 }
795 };
796
797 let start = move || async {
798 let op = self.send().await?;
799 Ok(Operation::new(op))
800 };
801
802 lro::internal::new_unit_response_poller(
803 polling_error_policy,
804 polling_backoff_policy,
805 start,
806 query,
807 )
808 }
809
810 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
814 self.0.request.parent = v.into();
815 self
816 }
817
818 pub fn set_agent<T: Into<Option<crate::model::restore_agent_request::Agent>>>(
823 mut self,
824 v: T,
825 ) -> Self {
826 self.0.request.agent = v.into();
827 self
828 }
829
830 pub fn set_agent_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
836 self.0.request = self.0.request.set_agent_uri(v);
837 self
838 }
839
840 pub fn set_agent_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
846 self.0.request = self.0.request.set_agent_content(v);
847 self
848 }
849 }
850
851 #[doc(hidden)]
852 impl gax::options::internal::RequestBuilder for RestoreAgent {
853 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
854 &mut self.0.options
855 }
856 }
857
858 #[derive(Clone, Debug)]
875 pub struct GetValidationResult(RequestBuilder<crate::model::GetValidationResultRequest>);
876
877 impl GetValidationResult {
878 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
879 Self(RequestBuilder::new(stub))
880 }
881
882 pub fn with_request<V: Into<crate::model::GetValidationResultRequest>>(
884 mut self,
885 v: V,
886 ) -> Self {
887 self.0.request = v.into();
888 self
889 }
890
891 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
893 self.0.options = v.into();
894 self
895 }
896
897 pub async fn send(self) -> Result<crate::model::ValidationResult> {
899 (*self.0.stub)
900 .get_validation_result(self.0.request, self.0.options)
901 .await
902 .map(gax::response::Response::into_body)
903 }
904
905 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
909 self.0.request.parent = v.into();
910 self
911 }
912
913 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
915 self.0.request.language_code = v.into();
916 self
917 }
918 }
919
920 #[doc(hidden)]
921 impl gax::options::internal::RequestBuilder for GetValidationResult {
922 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
923 &mut self.0.options
924 }
925 }
926
927 #[derive(Clone, Debug)]
948 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
949
950 impl ListLocations {
951 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
952 Self(RequestBuilder::new(stub))
953 }
954
955 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
957 mut self,
958 v: V,
959 ) -> Self {
960 self.0.request = v.into();
961 self
962 }
963
964 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
966 self.0.options = v.into();
967 self
968 }
969
970 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
972 (*self.0.stub)
973 .list_locations(self.0.request, self.0.options)
974 .await
975 .map(gax::response::Response::into_body)
976 }
977
978 pub fn by_page(
980 self,
981 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
982 {
983 use std::clone::Clone;
984 let token = self.0.request.page_token.clone();
985 let execute = move |token: String| {
986 let mut builder = self.clone();
987 builder.0.request = builder.0.request.set_page_token(token);
988 builder.send()
989 };
990 gax::paginator::internal::new_paginator(token, execute)
991 }
992
993 pub fn by_item(
995 self,
996 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
997 {
998 use gax::paginator::Paginator;
999 self.by_page().items()
1000 }
1001
1002 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1004 self.0.request.name = v.into();
1005 self
1006 }
1007
1008 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1010 self.0.request.filter = v.into();
1011 self
1012 }
1013
1014 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1016 self.0.request.page_size = v.into();
1017 self
1018 }
1019
1020 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1022 self.0.request.page_token = v.into();
1023 self
1024 }
1025 }
1026
1027 #[doc(hidden)]
1028 impl gax::options::internal::RequestBuilder for ListLocations {
1029 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1030 &mut self.0.options
1031 }
1032 }
1033
1034 #[derive(Clone, Debug)]
1051 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1052
1053 impl GetLocation {
1054 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1055 Self(RequestBuilder::new(stub))
1056 }
1057
1058 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1060 self.0.request = v.into();
1061 self
1062 }
1063
1064 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1066 self.0.options = v.into();
1067 self
1068 }
1069
1070 pub async fn send(self) -> Result<location::model::Location> {
1072 (*self.0.stub)
1073 .get_location(self.0.request, self.0.options)
1074 .await
1075 .map(gax::response::Response::into_body)
1076 }
1077
1078 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1080 self.0.request.name = v.into();
1081 self
1082 }
1083 }
1084
1085 #[doc(hidden)]
1086 impl gax::options::internal::RequestBuilder for GetLocation {
1087 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1088 &mut self.0.options
1089 }
1090 }
1091
1092 #[derive(Clone, Debug)]
1113 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1114
1115 impl ListOperations {
1116 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1117 Self(RequestBuilder::new(stub))
1118 }
1119
1120 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1122 mut self,
1123 v: V,
1124 ) -> Self {
1125 self.0.request = v.into();
1126 self
1127 }
1128
1129 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1131 self.0.options = v.into();
1132 self
1133 }
1134
1135 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1137 (*self.0.stub)
1138 .list_operations(self.0.request, self.0.options)
1139 .await
1140 .map(gax::response::Response::into_body)
1141 }
1142
1143 pub fn by_page(
1145 self,
1146 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1147 {
1148 use std::clone::Clone;
1149 let token = self.0.request.page_token.clone();
1150 let execute = move |token: String| {
1151 let mut builder = self.clone();
1152 builder.0.request = builder.0.request.set_page_token(token);
1153 builder.send()
1154 };
1155 gax::paginator::internal::new_paginator(token, execute)
1156 }
1157
1158 pub fn by_item(
1160 self,
1161 ) -> impl gax::paginator::ItemPaginator<
1162 longrunning::model::ListOperationsResponse,
1163 gax::error::Error,
1164 > {
1165 use gax::paginator::Paginator;
1166 self.by_page().items()
1167 }
1168
1169 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1171 self.0.request.name = v.into();
1172 self
1173 }
1174
1175 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1177 self.0.request.filter = v.into();
1178 self
1179 }
1180
1181 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1183 self.0.request.page_size = v.into();
1184 self
1185 }
1186
1187 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1189 self.0.request.page_token = v.into();
1190 self
1191 }
1192
1193 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1195 self.0.request.return_partial_success = v.into();
1196 self
1197 }
1198 }
1199
1200 #[doc(hidden)]
1201 impl gax::options::internal::RequestBuilder for ListOperations {
1202 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1203 &mut self.0.options
1204 }
1205 }
1206
1207 #[derive(Clone, Debug)]
1224 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1225
1226 impl GetOperation {
1227 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1228 Self(RequestBuilder::new(stub))
1229 }
1230
1231 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1233 mut self,
1234 v: V,
1235 ) -> Self {
1236 self.0.request = v.into();
1237 self
1238 }
1239
1240 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1242 self.0.options = v.into();
1243 self
1244 }
1245
1246 pub async fn send(self) -> Result<longrunning::model::Operation> {
1248 (*self.0.stub)
1249 .get_operation(self.0.request, self.0.options)
1250 .await
1251 .map(gax::response::Response::into_body)
1252 }
1253
1254 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1256 self.0.request.name = v.into();
1257 self
1258 }
1259 }
1260
1261 #[doc(hidden)]
1262 impl gax::options::internal::RequestBuilder for GetOperation {
1263 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1264 &mut self.0.options
1265 }
1266 }
1267
1268 #[derive(Clone, Debug)]
1285 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1286
1287 impl CancelOperation {
1288 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1289 Self(RequestBuilder::new(stub))
1290 }
1291
1292 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1294 mut self,
1295 v: V,
1296 ) -> Self {
1297 self.0.request = v.into();
1298 self
1299 }
1300
1301 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1303 self.0.options = v.into();
1304 self
1305 }
1306
1307 pub async fn send(self) -> Result<()> {
1309 (*self.0.stub)
1310 .cancel_operation(self.0.request, self.0.options)
1311 .await
1312 .map(gax::response::Response::into_body)
1313 }
1314
1315 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1317 self.0.request.name = v.into();
1318 self
1319 }
1320 }
1321
1322 #[doc(hidden)]
1323 impl gax::options::internal::RequestBuilder for CancelOperation {
1324 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1325 &mut self.0.options
1326 }
1327 }
1328}
1329
1330#[cfg(feature = "answer-records")]
1331#[cfg_attr(docsrs, doc(cfg(feature = "answer-records")))]
1332pub mod answer_records {
1333 use crate::Result;
1334
1335 pub type ClientBuilder =
1349 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1350
1351 pub(crate) mod client {
1352 use super::super::super::client::AnswerRecords;
1353 pub struct Factory;
1354 impl gax::client_builder::internal::ClientFactory for Factory {
1355 type Client = AnswerRecords;
1356 type Credentials = gaxi::options::Credentials;
1357 async fn build(
1358 self,
1359 config: gaxi::options::ClientConfig,
1360 ) -> gax::client_builder::Result<Self::Client> {
1361 Self::Client::new(config).await
1362 }
1363 }
1364 }
1365
1366 #[derive(Clone, Debug)]
1368 pub(crate) struct RequestBuilder<R: std::default::Default> {
1369 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1370 request: R,
1371 options: gax::options::RequestOptions,
1372 }
1373
1374 impl<R> RequestBuilder<R>
1375 where
1376 R: std::default::Default,
1377 {
1378 pub(crate) fn new(
1379 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1380 ) -> Self {
1381 Self {
1382 stub,
1383 request: R::default(),
1384 options: gax::options::RequestOptions::default(),
1385 }
1386 }
1387 }
1388
1389 #[derive(Clone, Debug)]
1410 pub struct ListAnswerRecords(RequestBuilder<crate::model::ListAnswerRecordsRequest>);
1411
1412 impl ListAnswerRecords {
1413 pub(crate) fn new(
1414 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1415 ) -> Self {
1416 Self(RequestBuilder::new(stub))
1417 }
1418
1419 pub fn with_request<V: Into<crate::model::ListAnswerRecordsRequest>>(
1421 mut self,
1422 v: V,
1423 ) -> Self {
1424 self.0.request = v.into();
1425 self
1426 }
1427
1428 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1430 self.0.options = v.into();
1431 self
1432 }
1433
1434 pub async fn send(self) -> Result<crate::model::ListAnswerRecordsResponse> {
1436 (*self.0.stub)
1437 .list_answer_records(self.0.request, self.0.options)
1438 .await
1439 .map(gax::response::Response::into_body)
1440 }
1441
1442 pub fn by_page(
1444 self,
1445 ) -> impl gax::paginator::Paginator<crate::model::ListAnswerRecordsResponse, gax::error::Error>
1446 {
1447 use std::clone::Clone;
1448 let token = self.0.request.page_token.clone();
1449 let execute = move |token: String| {
1450 let mut builder = self.clone();
1451 builder.0.request = builder.0.request.set_page_token(token);
1452 builder.send()
1453 };
1454 gax::paginator::internal::new_paginator(token, execute)
1455 }
1456
1457 pub fn by_item(
1459 self,
1460 ) -> impl gax::paginator::ItemPaginator<crate::model::ListAnswerRecordsResponse, gax::error::Error>
1461 {
1462 use gax::paginator::Paginator;
1463 self.by_page().items()
1464 }
1465
1466 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1470 self.0.request.parent = v.into();
1471 self
1472 }
1473
1474 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1476 self.0.request.filter = v.into();
1477 self
1478 }
1479
1480 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1482 self.0.request.page_size = v.into();
1483 self
1484 }
1485
1486 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1488 self.0.request.page_token = v.into();
1489 self
1490 }
1491 }
1492
1493 #[doc(hidden)]
1494 impl gax::options::internal::RequestBuilder for ListAnswerRecords {
1495 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1496 &mut self.0.options
1497 }
1498 }
1499
1500 #[derive(Clone, Debug)]
1517 pub struct UpdateAnswerRecord(RequestBuilder<crate::model::UpdateAnswerRecordRequest>);
1518
1519 impl UpdateAnswerRecord {
1520 pub(crate) fn new(
1521 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1522 ) -> Self {
1523 Self(RequestBuilder::new(stub))
1524 }
1525
1526 pub fn with_request<V: Into<crate::model::UpdateAnswerRecordRequest>>(
1528 mut self,
1529 v: V,
1530 ) -> Self {
1531 self.0.request = v.into();
1532 self
1533 }
1534
1535 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1537 self.0.options = v.into();
1538 self
1539 }
1540
1541 pub async fn send(self) -> Result<crate::model::AnswerRecord> {
1543 (*self.0.stub)
1544 .update_answer_record(self.0.request, self.0.options)
1545 .await
1546 .map(gax::response::Response::into_body)
1547 }
1548
1549 pub fn set_answer_record<T>(mut self, v: T) -> Self
1553 where
1554 T: std::convert::Into<crate::model::AnswerRecord>,
1555 {
1556 self.0.request.answer_record = std::option::Option::Some(v.into());
1557 self
1558 }
1559
1560 pub fn set_or_clear_answer_record<T>(mut self, v: std::option::Option<T>) -> Self
1564 where
1565 T: std::convert::Into<crate::model::AnswerRecord>,
1566 {
1567 self.0.request.answer_record = v.map(|x| x.into());
1568 self
1569 }
1570
1571 pub fn set_update_mask<T>(mut self, v: T) -> Self
1575 where
1576 T: std::convert::Into<wkt::FieldMask>,
1577 {
1578 self.0.request.update_mask = std::option::Option::Some(v.into());
1579 self
1580 }
1581
1582 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1586 where
1587 T: std::convert::Into<wkt::FieldMask>,
1588 {
1589 self.0.request.update_mask = v.map(|x| x.into());
1590 self
1591 }
1592 }
1593
1594 #[doc(hidden)]
1595 impl gax::options::internal::RequestBuilder for UpdateAnswerRecord {
1596 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1597 &mut self.0.options
1598 }
1599 }
1600
1601 #[derive(Clone, Debug)]
1622 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1623
1624 impl ListLocations {
1625 pub(crate) fn new(
1626 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1627 ) -> Self {
1628 Self(RequestBuilder::new(stub))
1629 }
1630
1631 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1633 mut self,
1634 v: V,
1635 ) -> Self {
1636 self.0.request = v.into();
1637 self
1638 }
1639
1640 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1642 self.0.options = v.into();
1643 self
1644 }
1645
1646 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1648 (*self.0.stub)
1649 .list_locations(self.0.request, self.0.options)
1650 .await
1651 .map(gax::response::Response::into_body)
1652 }
1653
1654 pub fn by_page(
1656 self,
1657 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1658 {
1659 use std::clone::Clone;
1660 let token = self.0.request.page_token.clone();
1661 let execute = move |token: String| {
1662 let mut builder = self.clone();
1663 builder.0.request = builder.0.request.set_page_token(token);
1664 builder.send()
1665 };
1666 gax::paginator::internal::new_paginator(token, execute)
1667 }
1668
1669 pub fn by_item(
1671 self,
1672 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1673 {
1674 use gax::paginator::Paginator;
1675 self.by_page().items()
1676 }
1677
1678 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1680 self.0.request.name = v.into();
1681 self
1682 }
1683
1684 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1686 self.0.request.filter = v.into();
1687 self
1688 }
1689
1690 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1692 self.0.request.page_size = v.into();
1693 self
1694 }
1695
1696 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1698 self.0.request.page_token = v.into();
1699 self
1700 }
1701 }
1702
1703 #[doc(hidden)]
1704 impl gax::options::internal::RequestBuilder for ListLocations {
1705 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1706 &mut self.0.options
1707 }
1708 }
1709
1710 #[derive(Clone, Debug)]
1727 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1728
1729 impl GetLocation {
1730 pub(crate) fn new(
1731 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1732 ) -> Self {
1733 Self(RequestBuilder::new(stub))
1734 }
1735
1736 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1738 self.0.request = v.into();
1739 self
1740 }
1741
1742 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1744 self.0.options = v.into();
1745 self
1746 }
1747
1748 pub async fn send(self) -> Result<location::model::Location> {
1750 (*self.0.stub)
1751 .get_location(self.0.request, self.0.options)
1752 .await
1753 .map(gax::response::Response::into_body)
1754 }
1755
1756 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1758 self.0.request.name = v.into();
1759 self
1760 }
1761 }
1762
1763 #[doc(hidden)]
1764 impl gax::options::internal::RequestBuilder for GetLocation {
1765 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1766 &mut self.0.options
1767 }
1768 }
1769
1770 #[derive(Clone, Debug)]
1791 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1792
1793 impl ListOperations {
1794 pub(crate) fn new(
1795 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1796 ) -> Self {
1797 Self(RequestBuilder::new(stub))
1798 }
1799
1800 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1802 mut self,
1803 v: V,
1804 ) -> Self {
1805 self.0.request = v.into();
1806 self
1807 }
1808
1809 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1811 self.0.options = v.into();
1812 self
1813 }
1814
1815 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1817 (*self.0.stub)
1818 .list_operations(self.0.request, self.0.options)
1819 .await
1820 .map(gax::response::Response::into_body)
1821 }
1822
1823 pub fn by_page(
1825 self,
1826 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1827 {
1828 use std::clone::Clone;
1829 let token = self.0.request.page_token.clone();
1830 let execute = move |token: String| {
1831 let mut builder = self.clone();
1832 builder.0.request = builder.0.request.set_page_token(token);
1833 builder.send()
1834 };
1835 gax::paginator::internal::new_paginator(token, execute)
1836 }
1837
1838 pub fn by_item(
1840 self,
1841 ) -> impl gax::paginator::ItemPaginator<
1842 longrunning::model::ListOperationsResponse,
1843 gax::error::Error,
1844 > {
1845 use gax::paginator::Paginator;
1846 self.by_page().items()
1847 }
1848
1849 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1851 self.0.request.name = v.into();
1852 self
1853 }
1854
1855 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1857 self.0.request.filter = v.into();
1858 self
1859 }
1860
1861 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1863 self.0.request.page_size = v.into();
1864 self
1865 }
1866
1867 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1869 self.0.request.page_token = v.into();
1870 self
1871 }
1872
1873 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1875 self.0.request.return_partial_success = v.into();
1876 self
1877 }
1878 }
1879
1880 #[doc(hidden)]
1881 impl gax::options::internal::RequestBuilder for ListOperations {
1882 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1883 &mut self.0.options
1884 }
1885 }
1886
1887 #[derive(Clone, Debug)]
1904 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1905
1906 impl GetOperation {
1907 pub(crate) fn new(
1908 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1909 ) -> Self {
1910 Self(RequestBuilder::new(stub))
1911 }
1912
1913 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1915 mut self,
1916 v: V,
1917 ) -> Self {
1918 self.0.request = v.into();
1919 self
1920 }
1921
1922 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1924 self.0.options = v.into();
1925 self
1926 }
1927
1928 pub async fn send(self) -> Result<longrunning::model::Operation> {
1930 (*self.0.stub)
1931 .get_operation(self.0.request, self.0.options)
1932 .await
1933 .map(gax::response::Response::into_body)
1934 }
1935
1936 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1938 self.0.request.name = v.into();
1939 self
1940 }
1941 }
1942
1943 #[doc(hidden)]
1944 impl gax::options::internal::RequestBuilder for GetOperation {
1945 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1946 &mut self.0.options
1947 }
1948 }
1949
1950 #[derive(Clone, Debug)]
1967 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
1968
1969 impl CancelOperation {
1970 pub(crate) fn new(
1971 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1972 ) -> Self {
1973 Self(RequestBuilder::new(stub))
1974 }
1975
1976 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
1978 mut self,
1979 v: V,
1980 ) -> Self {
1981 self.0.request = v.into();
1982 self
1983 }
1984
1985 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1987 self.0.options = v.into();
1988 self
1989 }
1990
1991 pub async fn send(self) -> Result<()> {
1993 (*self.0.stub)
1994 .cancel_operation(self.0.request, self.0.options)
1995 .await
1996 .map(gax::response::Response::into_body)
1997 }
1998
1999 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2001 self.0.request.name = v.into();
2002 self
2003 }
2004 }
2005
2006 #[doc(hidden)]
2007 impl gax::options::internal::RequestBuilder for CancelOperation {
2008 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2009 &mut self.0.options
2010 }
2011 }
2012}
2013
2014#[cfg(feature = "contexts")]
2015#[cfg_attr(docsrs, doc(cfg(feature = "contexts")))]
2016pub mod contexts {
2017 use crate::Result;
2018
2019 pub type ClientBuilder =
2033 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2034
2035 pub(crate) mod client {
2036 use super::super::super::client::Contexts;
2037 pub struct Factory;
2038 impl gax::client_builder::internal::ClientFactory for Factory {
2039 type Client = Contexts;
2040 type Credentials = gaxi::options::Credentials;
2041 async fn build(
2042 self,
2043 config: gaxi::options::ClientConfig,
2044 ) -> gax::client_builder::Result<Self::Client> {
2045 Self::Client::new(config).await
2046 }
2047 }
2048 }
2049
2050 #[derive(Clone, Debug)]
2052 pub(crate) struct RequestBuilder<R: std::default::Default> {
2053 stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>,
2054 request: R,
2055 options: gax::options::RequestOptions,
2056 }
2057
2058 impl<R> RequestBuilder<R>
2059 where
2060 R: std::default::Default,
2061 {
2062 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2063 Self {
2064 stub,
2065 request: R::default(),
2066 options: gax::options::RequestOptions::default(),
2067 }
2068 }
2069 }
2070
2071 #[derive(Clone, Debug)]
2092 pub struct ListContexts(RequestBuilder<crate::model::ListContextsRequest>);
2093
2094 impl ListContexts {
2095 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2096 Self(RequestBuilder::new(stub))
2097 }
2098
2099 pub fn with_request<V: Into<crate::model::ListContextsRequest>>(mut self, v: V) -> Self {
2101 self.0.request = v.into();
2102 self
2103 }
2104
2105 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2107 self.0.options = v.into();
2108 self
2109 }
2110
2111 pub async fn send(self) -> Result<crate::model::ListContextsResponse> {
2113 (*self.0.stub)
2114 .list_contexts(self.0.request, self.0.options)
2115 .await
2116 .map(gax::response::Response::into_body)
2117 }
2118
2119 pub fn by_page(
2121 self,
2122 ) -> impl gax::paginator::Paginator<crate::model::ListContextsResponse, gax::error::Error>
2123 {
2124 use std::clone::Clone;
2125 let token = self.0.request.page_token.clone();
2126 let execute = move |token: String| {
2127 let mut builder = self.clone();
2128 builder.0.request = builder.0.request.set_page_token(token);
2129 builder.send()
2130 };
2131 gax::paginator::internal::new_paginator(token, execute)
2132 }
2133
2134 pub fn by_item(
2136 self,
2137 ) -> impl gax::paginator::ItemPaginator<crate::model::ListContextsResponse, gax::error::Error>
2138 {
2139 use gax::paginator::Paginator;
2140 self.by_page().items()
2141 }
2142
2143 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2147 self.0.request.parent = v.into();
2148 self
2149 }
2150
2151 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2153 self.0.request.page_size = v.into();
2154 self
2155 }
2156
2157 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2159 self.0.request.page_token = v.into();
2160 self
2161 }
2162 }
2163
2164 #[doc(hidden)]
2165 impl gax::options::internal::RequestBuilder for ListContexts {
2166 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2167 &mut self.0.options
2168 }
2169 }
2170
2171 #[derive(Clone, Debug)]
2188 pub struct GetContext(RequestBuilder<crate::model::GetContextRequest>);
2189
2190 impl GetContext {
2191 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2192 Self(RequestBuilder::new(stub))
2193 }
2194
2195 pub fn with_request<V: Into<crate::model::GetContextRequest>>(mut self, v: V) -> Self {
2197 self.0.request = v.into();
2198 self
2199 }
2200
2201 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2203 self.0.options = v.into();
2204 self
2205 }
2206
2207 pub async fn send(self) -> Result<crate::model::Context> {
2209 (*self.0.stub)
2210 .get_context(self.0.request, self.0.options)
2211 .await
2212 .map(gax::response::Response::into_body)
2213 }
2214
2215 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2219 self.0.request.name = v.into();
2220 self
2221 }
2222 }
2223
2224 #[doc(hidden)]
2225 impl gax::options::internal::RequestBuilder for GetContext {
2226 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2227 &mut self.0.options
2228 }
2229 }
2230
2231 #[derive(Clone, Debug)]
2248 pub struct CreateContext(RequestBuilder<crate::model::CreateContextRequest>);
2249
2250 impl CreateContext {
2251 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2252 Self(RequestBuilder::new(stub))
2253 }
2254
2255 pub fn with_request<V: Into<crate::model::CreateContextRequest>>(mut self, v: V) -> Self {
2257 self.0.request = v.into();
2258 self
2259 }
2260
2261 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2263 self.0.options = v.into();
2264 self
2265 }
2266
2267 pub async fn send(self) -> Result<crate::model::Context> {
2269 (*self.0.stub)
2270 .create_context(self.0.request, self.0.options)
2271 .await
2272 .map(gax::response::Response::into_body)
2273 }
2274
2275 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2279 self.0.request.parent = v.into();
2280 self
2281 }
2282
2283 pub fn set_context<T>(mut self, v: T) -> Self
2287 where
2288 T: std::convert::Into<crate::model::Context>,
2289 {
2290 self.0.request.context = std::option::Option::Some(v.into());
2291 self
2292 }
2293
2294 pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
2298 where
2299 T: std::convert::Into<crate::model::Context>,
2300 {
2301 self.0.request.context = v.map(|x| x.into());
2302 self
2303 }
2304 }
2305
2306 #[doc(hidden)]
2307 impl gax::options::internal::RequestBuilder for CreateContext {
2308 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2309 &mut self.0.options
2310 }
2311 }
2312
2313 #[derive(Clone, Debug)]
2330 pub struct UpdateContext(RequestBuilder<crate::model::UpdateContextRequest>);
2331
2332 impl UpdateContext {
2333 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2334 Self(RequestBuilder::new(stub))
2335 }
2336
2337 pub fn with_request<V: Into<crate::model::UpdateContextRequest>>(mut self, v: V) -> Self {
2339 self.0.request = v.into();
2340 self
2341 }
2342
2343 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2345 self.0.options = v.into();
2346 self
2347 }
2348
2349 pub async fn send(self) -> Result<crate::model::Context> {
2351 (*self.0.stub)
2352 .update_context(self.0.request, self.0.options)
2353 .await
2354 .map(gax::response::Response::into_body)
2355 }
2356
2357 pub fn set_context<T>(mut self, v: T) -> Self
2361 where
2362 T: std::convert::Into<crate::model::Context>,
2363 {
2364 self.0.request.context = std::option::Option::Some(v.into());
2365 self
2366 }
2367
2368 pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
2372 where
2373 T: std::convert::Into<crate::model::Context>,
2374 {
2375 self.0.request.context = v.map(|x| x.into());
2376 self
2377 }
2378
2379 pub fn set_update_mask<T>(mut self, v: T) -> Self
2381 where
2382 T: std::convert::Into<wkt::FieldMask>,
2383 {
2384 self.0.request.update_mask = std::option::Option::Some(v.into());
2385 self
2386 }
2387
2388 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2390 where
2391 T: std::convert::Into<wkt::FieldMask>,
2392 {
2393 self.0.request.update_mask = v.map(|x| x.into());
2394 self
2395 }
2396 }
2397
2398 #[doc(hidden)]
2399 impl gax::options::internal::RequestBuilder for UpdateContext {
2400 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2401 &mut self.0.options
2402 }
2403 }
2404
2405 #[derive(Clone, Debug)]
2422 pub struct DeleteContext(RequestBuilder<crate::model::DeleteContextRequest>);
2423
2424 impl DeleteContext {
2425 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2426 Self(RequestBuilder::new(stub))
2427 }
2428
2429 pub fn with_request<V: Into<crate::model::DeleteContextRequest>>(mut self, v: V) -> Self {
2431 self.0.request = v.into();
2432 self
2433 }
2434
2435 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2437 self.0.options = v.into();
2438 self
2439 }
2440
2441 pub async fn send(self) -> Result<()> {
2443 (*self.0.stub)
2444 .delete_context(self.0.request, self.0.options)
2445 .await
2446 .map(gax::response::Response::into_body)
2447 }
2448
2449 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2453 self.0.request.name = v.into();
2454 self
2455 }
2456 }
2457
2458 #[doc(hidden)]
2459 impl gax::options::internal::RequestBuilder for DeleteContext {
2460 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2461 &mut self.0.options
2462 }
2463 }
2464
2465 #[derive(Clone, Debug)]
2482 pub struct DeleteAllContexts(RequestBuilder<crate::model::DeleteAllContextsRequest>);
2483
2484 impl DeleteAllContexts {
2485 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2486 Self(RequestBuilder::new(stub))
2487 }
2488
2489 pub fn with_request<V: Into<crate::model::DeleteAllContextsRequest>>(
2491 mut self,
2492 v: V,
2493 ) -> Self {
2494 self.0.request = v.into();
2495 self
2496 }
2497
2498 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2500 self.0.options = v.into();
2501 self
2502 }
2503
2504 pub async fn send(self) -> Result<()> {
2506 (*self.0.stub)
2507 .delete_all_contexts(self.0.request, self.0.options)
2508 .await
2509 .map(gax::response::Response::into_body)
2510 }
2511
2512 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2516 self.0.request.parent = v.into();
2517 self
2518 }
2519 }
2520
2521 #[doc(hidden)]
2522 impl gax::options::internal::RequestBuilder for DeleteAllContexts {
2523 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2524 &mut self.0.options
2525 }
2526 }
2527
2528 #[derive(Clone, Debug)]
2549 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
2550
2551 impl ListLocations {
2552 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2553 Self(RequestBuilder::new(stub))
2554 }
2555
2556 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
2558 mut self,
2559 v: V,
2560 ) -> Self {
2561 self.0.request = v.into();
2562 self
2563 }
2564
2565 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2567 self.0.options = v.into();
2568 self
2569 }
2570
2571 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
2573 (*self.0.stub)
2574 .list_locations(self.0.request, self.0.options)
2575 .await
2576 .map(gax::response::Response::into_body)
2577 }
2578
2579 pub fn by_page(
2581 self,
2582 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
2583 {
2584 use std::clone::Clone;
2585 let token = self.0.request.page_token.clone();
2586 let execute = move |token: String| {
2587 let mut builder = self.clone();
2588 builder.0.request = builder.0.request.set_page_token(token);
2589 builder.send()
2590 };
2591 gax::paginator::internal::new_paginator(token, execute)
2592 }
2593
2594 pub fn by_item(
2596 self,
2597 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
2598 {
2599 use gax::paginator::Paginator;
2600 self.by_page().items()
2601 }
2602
2603 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2605 self.0.request.name = v.into();
2606 self
2607 }
2608
2609 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2611 self.0.request.filter = v.into();
2612 self
2613 }
2614
2615 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2617 self.0.request.page_size = v.into();
2618 self
2619 }
2620
2621 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2623 self.0.request.page_token = v.into();
2624 self
2625 }
2626 }
2627
2628 #[doc(hidden)]
2629 impl gax::options::internal::RequestBuilder for ListLocations {
2630 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2631 &mut self.0.options
2632 }
2633 }
2634
2635 #[derive(Clone, Debug)]
2652 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
2653
2654 impl GetLocation {
2655 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2656 Self(RequestBuilder::new(stub))
2657 }
2658
2659 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
2661 self.0.request = v.into();
2662 self
2663 }
2664
2665 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2667 self.0.options = v.into();
2668 self
2669 }
2670
2671 pub async fn send(self) -> Result<location::model::Location> {
2673 (*self.0.stub)
2674 .get_location(self.0.request, self.0.options)
2675 .await
2676 .map(gax::response::Response::into_body)
2677 }
2678
2679 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2681 self.0.request.name = v.into();
2682 self
2683 }
2684 }
2685
2686 #[doc(hidden)]
2687 impl gax::options::internal::RequestBuilder for GetLocation {
2688 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2689 &mut self.0.options
2690 }
2691 }
2692
2693 #[derive(Clone, Debug)]
2714 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
2715
2716 impl ListOperations {
2717 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2718 Self(RequestBuilder::new(stub))
2719 }
2720
2721 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
2723 mut self,
2724 v: V,
2725 ) -> Self {
2726 self.0.request = v.into();
2727 self
2728 }
2729
2730 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2732 self.0.options = v.into();
2733 self
2734 }
2735
2736 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
2738 (*self.0.stub)
2739 .list_operations(self.0.request, self.0.options)
2740 .await
2741 .map(gax::response::Response::into_body)
2742 }
2743
2744 pub fn by_page(
2746 self,
2747 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
2748 {
2749 use std::clone::Clone;
2750 let token = self.0.request.page_token.clone();
2751 let execute = move |token: String| {
2752 let mut builder = self.clone();
2753 builder.0.request = builder.0.request.set_page_token(token);
2754 builder.send()
2755 };
2756 gax::paginator::internal::new_paginator(token, execute)
2757 }
2758
2759 pub fn by_item(
2761 self,
2762 ) -> impl gax::paginator::ItemPaginator<
2763 longrunning::model::ListOperationsResponse,
2764 gax::error::Error,
2765 > {
2766 use gax::paginator::Paginator;
2767 self.by_page().items()
2768 }
2769
2770 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2772 self.0.request.name = v.into();
2773 self
2774 }
2775
2776 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2778 self.0.request.filter = v.into();
2779 self
2780 }
2781
2782 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2784 self.0.request.page_size = v.into();
2785 self
2786 }
2787
2788 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2790 self.0.request.page_token = v.into();
2791 self
2792 }
2793
2794 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2796 self.0.request.return_partial_success = v.into();
2797 self
2798 }
2799 }
2800
2801 #[doc(hidden)]
2802 impl gax::options::internal::RequestBuilder for ListOperations {
2803 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2804 &mut self.0.options
2805 }
2806 }
2807
2808 #[derive(Clone, Debug)]
2825 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2826
2827 impl GetOperation {
2828 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2829 Self(RequestBuilder::new(stub))
2830 }
2831
2832 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2834 mut self,
2835 v: V,
2836 ) -> Self {
2837 self.0.request = v.into();
2838 self
2839 }
2840
2841 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2843 self.0.options = v.into();
2844 self
2845 }
2846
2847 pub async fn send(self) -> Result<longrunning::model::Operation> {
2849 (*self.0.stub)
2850 .get_operation(self.0.request, self.0.options)
2851 .await
2852 .map(gax::response::Response::into_body)
2853 }
2854
2855 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2857 self.0.request.name = v.into();
2858 self
2859 }
2860 }
2861
2862 #[doc(hidden)]
2863 impl gax::options::internal::RequestBuilder for GetOperation {
2864 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2865 &mut self.0.options
2866 }
2867 }
2868
2869 #[derive(Clone, Debug)]
2886 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2887
2888 impl CancelOperation {
2889 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2890 Self(RequestBuilder::new(stub))
2891 }
2892
2893 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2895 mut self,
2896 v: V,
2897 ) -> Self {
2898 self.0.request = v.into();
2899 self
2900 }
2901
2902 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2904 self.0.options = v.into();
2905 self
2906 }
2907
2908 pub async fn send(self) -> Result<()> {
2910 (*self.0.stub)
2911 .cancel_operation(self.0.request, self.0.options)
2912 .await
2913 .map(gax::response::Response::into_body)
2914 }
2915
2916 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2918 self.0.request.name = v.into();
2919 self
2920 }
2921 }
2922
2923 #[doc(hidden)]
2924 impl gax::options::internal::RequestBuilder for CancelOperation {
2925 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2926 &mut self.0.options
2927 }
2928 }
2929}
2930
2931#[cfg(feature = "conversations")]
2932#[cfg_attr(docsrs, doc(cfg(feature = "conversations")))]
2933pub mod conversations {
2934 use crate::Result;
2935
2936 pub type ClientBuilder =
2950 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2951
2952 pub(crate) mod client {
2953 use super::super::super::client::Conversations;
2954 pub struct Factory;
2955 impl gax::client_builder::internal::ClientFactory for Factory {
2956 type Client = Conversations;
2957 type Credentials = gaxi::options::Credentials;
2958 async fn build(
2959 self,
2960 config: gaxi::options::ClientConfig,
2961 ) -> gax::client_builder::Result<Self::Client> {
2962 Self::Client::new(config).await
2963 }
2964 }
2965 }
2966
2967 #[derive(Clone, Debug)]
2969 pub(crate) struct RequestBuilder<R: std::default::Default> {
2970 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
2971 request: R,
2972 options: gax::options::RequestOptions,
2973 }
2974
2975 impl<R> RequestBuilder<R>
2976 where
2977 R: std::default::Default,
2978 {
2979 pub(crate) fn new(
2980 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
2981 ) -> Self {
2982 Self {
2983 stub,
2984 request: R::default(),
2985 options: gax::options::RequestOptions::default(),
2986 }
2987 }
2988 }
2989
2990 #[derive(Clone, Debug)]
3007 pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
3008
3009 impl CreateConversation {
3010 pub(crate) fn new(
3011 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3012 ) -> Self {
3013 Self(RequestBuilder::new(stub))
3014 }
3015
3016 pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
3018 mut self,
3019 v: V,
3020 ) -> Self {
3021 self.0.request = v.into();
3022 self
3023 }
3024
3025 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3027 self.0.options = v.into();
3028 self
3029 }
3030
3031 pub async fn send(self) -> Result<crate::model::Conversation> {
3033 (*self.0.stub)
3034 .create_conversation(self.0.request, self.0.options)
3035 .await
3036 .map(gax::response::Response::into_body)
3037 }
3038
3039 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3043 self.0.request.parent = v.into();
3044 self
3045 }
3046
3047 pub fn set_conversation<T>(mut self, v: T) -> Self
3051 where
3052 T: std::convert::Into<crate::model::Conversation>,
3053 {
3054 self.0.request.conversation = std::option::Option::Some(v.into());
3055 self
3056 }
3057
3058 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3062 where
3063 T: std::convert::Into<crate::model::Conversation>,
3064 {
3065 self.0.request.conversation = v.map(|x| x.into());
3066 self
3067 }
3068
3069 pub fn set_conversation_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3071 self.0.request.conversation_id = v.into();
3072 self
3073 }
3074 }
3075
3076 #[doc(hidden)]
3077 impl gax::options::internal::RequestBuilder for CreateConversation {
3078 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3079 &mut self.0.options
3080 }
3081 }
3082
3083 #[derive(Clone, Debug)]
3104 pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3105
3106 impl ListConversations {
3107 pub(crate) fn new(
3108 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3109 ) -> Self {
3110 Self(RequestBuilder::new(stub))
3111 }
3112
3113 pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3115 mut self,
3116 v: V,
3117 ) -> Self {
3118 self.0.request = v.into();
3119 self
3120 }
3121
3122 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3124 self.0.options = v.into();
3125 self
3126 }
3127
3128 pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3130 (*self.0.stub)
3131 .list_conversations(self.0.request, self.0.options)
3132 .await
3133 .map(gax::response::Response::into_body)
3134 }
3135
3136 pub fn by_page(
3138 self,
3139 ) -> impl gax::paginator::Paginator<crate::model::ListConversationsResponse, gax::error::Error>
3140 {
3141 use std::clone::Clone;
3142 let token = self.0.request.page_token.clone();
3143 let execute = move |token: String| {
3144 let mut builder = self.clone();
3145 builder.0.request = builder.0.request.set_page_token(token);
3146 builder.send()
3147 };
3148 gax::paginator::internal::new_paginator(token, execute)
3149 }
3150
3151 pub fn by_item(
3153 self,
3154 ) -> impl gax::paginator::ItemPaginator<crate::model::ListConversationsResponse, gax::error::Error>
3155 {
3156 use gax::paginator::Paginator;
3157 self.by_page().items()
3158 }
3159
3160 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3164 self.0.request.parent = v.into();
3165 self
3166 }
3167
3168 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3170 self.0.request.page_size = v.into();
3171 self
3172 }
3173
3174 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3176 self.0.request.page_token = v.into();
3177 self
3178 }
3179
3180 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3182 self.0.request.filter = v.into();
3183 self
3184 }
3185 }
3186
3187 #[doc(hidden)]
3188 impl gax::options::internal::RequestBuilder for ListConversations {
3189 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3190 &mut self.0.options
3191 }
3192 }
3193
3194 #[derive(Clone, Debug)]
3211 pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3212
3213 impl GetConversation {
3214 pub(crate) fn new(
3215 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3216 ) -> Self {
3217 Self(RequestBuilder::new(stub))
3218 }
3219
3220 pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3222 self.0.request = v.into();
3223 self
3224 }
3225
3226 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3228 self.0.options = v.into();
3229 self
3230 }
3231
3232 pub async fn send(self) -> Result<crate::model::Conversation> {
3234 (*self.0.stub)
3235 .get_conversation(self.0.request, self.0.options)
3236 .await
3237 .map(gax::response::Response::into_body)
3238 }
3239
3240 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3244 self.0.request.name = v.into();
3245 self
3246 }
3247 }
3248
3249 #[doc(hidden)]
3250 impl gax::options::internal::RequestBuilder for GetConversation {
3251 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3252 &mut self.0.options
3253 }
3254 }
3255
3256 #[derive(Clone, Debug)]
3273 pub struct CompleteConversation(RequestBuilder<crate::model::CompleteConversationRequest>);
3274
3275 impl CompleteConversation {
3276 pub(crate) fn new(
3277 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3278 ) -> Self {
3279 Self(RequestBuilder::new(stub))
3280 }
3281
3282 pub fn with_request<V: Into<crate::model::CompleteConversationRequest>>(
3284 mut self,
3285 v: V,
3286 ) -> Self {
3287 self.0.request = v.into();
3288 self
3289 }
3290
3291 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3293 self.0.options = v.into();
3294 self
3295 }
3296
3297 pub async fn send(self) -> Result<crate::model::Conversation> {
3299 (*self.0.stub)
3300 .complete_conversation(self.0.request, self.0.options)
3301 .await
3302 .map(gax::response::Response::into_body)
3303 }
3304
3305 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3309 self.0.request.name = v.into();
3310 self
3311 }
3312 }
3313
3314 #[doc(hidden)]
3315 impl gax::options::internal::RequestBuilder for CompleteConversation {
3316 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3317 &mut self.0.options
3318 }
3319 }
3320
3321 #[derive(Clone, Debug)]
3338 pub struct IngestContextReferences(
3339 RequestBuilder<crate::model::IngestContextReferencesRequest>,
3340 );
3341
3342 impl IngestContextReferences {
3343 pub(crate) fn new(
3344 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3345 ) -> Self {
3346 Self(RequestBuilder::new(stub))
3347 }
3348
3349 pub fn with_request<V: Into<crate::model::IngestContextReferencesRequest>>(
3351 mut self,
3352 v: V,
3353 ) -> Self {
3354 self.0.request = v.into();
3355 self
3356 }
3357
3358 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3360 self.0.options = v.into();
3361 self
3362 }
3363
3364 pub async fn send(self) -> Result<crate::model::IngestContextReferencesResponse> {
3366 (*self.0.stub)
3367 .ingest_context_references(self.0.request, self.0.options)
3368 .await
3369 .map(gax::response::Response::into_body)
3370 }
3371
3372 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
3376 self.0.request.conversation = v.into();
3377 self
3378 }
3379
3380 pub fn set_context_references<T, K, V>(mut self, v: T) -> Self
3384 where
3385 T: std::iter::IntoIterator<Item = (K, V)>,
3386 K: std::convert::Into<std::string::String>,
3387 V: std::convert::Into<crate::model::conversation::ContextReference>,
3388 {
3389 self.0.request.context_references =
3390 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3391 self
3392 }
3393 }
3394
3395 #[doc(hidden)]
3396 impl gax::options::internal::RequestBuilder for IngestContextReferences {
3397 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3398 &mut self.0.options
3399 }
3400 }
3401
3402 #[derive(Clone, Debug)]
3423 pub struct ListMessages(RequestBuilder<crate::model::ListMessagesRequest>);
3424
3425 impl ListMessages {
3426 pub(crate) fn new(
3427 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3428 ) -> Self {
3429 Self(RequestBuilder::new(stub))
3430 }
3431
3432 pub fn with_request<V: Into<crate::model::ListMessagesRequest>>(mut self, v: V) -> Self {
3434 self.0.request = v.into();
3435 self
3436 }
3437
3438 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3440 self.0.options = v.into();
3441 self
3442 }
3443
3444 pub async fn send(self) -> Result<crate::model::ListMessagesResponse> {
3446 (*self.0.stub)
3447 .list_messages(self.0.request, self.0.options)
3448 .await
3449 .map(gax::response::Response::into_body)
3450 }
3451
3452 pub fn by_page(
3454 self,
3455 ) -> impl gax::paginator::Paginator<crate::model::ListMessagesResponse, gax::error::Error>
3456 {
3457 use std::clone::Clone;
3458 let token = self.0.request.page_token.clone();
3459 let execute = move |token: String| {
3460 let mut builder = self.clone();
3461 builder.0.request = builder.0.request.set_page_token(token);
3462 builder.send()
3463 };
3464 gax::paginator::internal::new_paginator(token, execute)
3465 }
3466
3467 pub fn by_item(
3469 self,
3470 ) -> impl gax::paginator::ItemPaginator<crate::model::ListMessagesResponse, gax::error::Error>
3471 {
3472 use gax::paginator::Paginator;
3473 self.by_page().items()
3474 }
3475
3476 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3480 self.0.request.parent = v.into();
3481 self
3482 }
3483
3484 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3486 self.0.request.filter = v.into();
3487 self
3488 }
3489
3490 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3492 self.0.request.page_size = v.into();
3493 self
3494 }
3495
3496 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3498 self.0.request.page_token = v.into();
3499 self
3500 }
3501 }
3502
3503 #[doc(hidden)]
3504 impl gax::options::internal::RequestBuilder for ListMessages {
3505 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3506 &mut self.0.options
3507 }
3508 }
3509
3510 #[derive(Clone, Debug)]
3527 pub struct SuggestConversationSummary(
3528 RequestBuilder<crate::model::SuggestConversationSummaryRequest>,
3529 );
3530
3531 impl SuggestConversationSummary {
3532 pub(crate) fn new(
3533 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3534 ) -> Self {
3535 Self(RequestBuilder::new(stub))
3536 }
3537
3538 pub fn with_request<V: Into<crate::model::SuggestConversationSummaryRequest>>(
3540 mut self,
3541 v: V,
3542 ) -> Self {
3543 self.0.request = v.into();
3544 self
3545 }
3546
3547 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3549 self.0.options = v.into();
3550 self
3551 }
3552
3553 pub async fn send(self) -> Result<crate::model::SuggestConversationSummaryResponse> {
3555 (*self.0.stub)
3556 .suggest_conversation_summary(self.0.request, self.0.options)
3557 .await
3558 .map(gax::response::Response::into_body)
3559 }
3560
3561 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
3565 self.0.request.conversation = v.into();
3566 self
3567 }
3568
3569 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
3571 self.0.request.latest_message = v.into();
3572 self
3573 }
3574
3575 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
3577 self.0.request.context_size = v.into();
3578 self
3579 }
3580
3581 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
3583 where
3584 T: std::convert::Into<crate::model::AssistQueryParameters>,
3585 {
3586 self.0.request.assist_query_params = std::option::Option::Some(v.into());
3587 self
3588 }
3589
3590 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
3592 where
3593 T: std::convert::Into<crate::model::AssistQueryParameters>,
3594 {
3595 self.0.request.assist_query_params = v.map(|x| x.into());
3596 self
3597 }
3598 }
3599
3600 #[doc(hidden)]
3601 impl gax::options::internal::RequestBuilder for SuggestConversationSummary {
3602 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3603 &mut self.0.options
3604 }
3605 }
3606
3607 #[derive(Clone, Debug)]
3624 pub struct GenerateStatelessSummary(
3625 RequestBuilder<crate::model::GenerateStatelessSummaryRequest>,
3626 );
3627
3628 impl GenerateStatelessSummary {
3629 pub(crate) fn new(
3630 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3631 ) -> Self {
3632 Self(RequestBuilder::new(stub))
3633 }
3634
3635 pub fn with_request<V: Into<crate::model::GenerateStatelessSummaryRequest>>(
3637 mut self,
3638 v: V,
3639 ) -> Self {
3640 self.0.request = v.into();
3641 self
3642 }
3643
3644 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3646 self.0.options = v.into();
3647 self
3648 }
3649
3650 pub async fn send(self) -> Result<crate::model::GenerateStatelessSummaryResponse> {
3652 (*self.0.stub)
3653 .generate_stateless_summary(self.0.request, self.0.options)
3654 .await
3655 .map(gax::response::Response::into_body)
3656 }
3657
3658 pub fn set_stateless_conversation<T>(mut self, v: T) -> Self
3662 where
3663 T: std::convert::Into<
3664 crate::model::generate_stateless_summary_request::MinimalConversation,
3665 >,
3666 {
3667 self.0.request.stateless_conversation = std::option::Option::Some(v.into());
3668 self
3669 }
3670
3671 pub fn set_or_clear_stateless_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3675 where
3676 T: std::convert::Into<
3677 crate::model::generate_stateless_summary_request::MinimalConversation,
3678 >,
3679 {
3680 self.0.request.stateless_conversation = v.map(|x| x.into());
3681 self
3682 }
3683
3684 pub fn set_conversation_profile<T>(mut self, v: T) -> Self
3688 where
3689 T: std::convert::Into<crate::model::ConversationProfile>,
3690 {
3691 self.0.request.conversation_profile = std::option::Option::Some(v.into());
3692 self
3693 }
3694
3695 pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
3699 where
3700 T: std::convert::Into<crate::model::ConversationProfile>,
3701 {
3702 self.0.request.conversation_profile = v.map(|x| x.into());
3703 self
3704 }
3705
3706 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
3708 self.0.request.latest_message = v.into();
3709 self
3710 }
3711
3712 pub fn set_max_context_size<T: Into<i32>>(mut self, v: T) -> Self {
3714 self.0.request.max_context_size = v.into();
3715 self
3716 }
3717 }
3718
3719 #[doc(hidden)]
3720 impl gax::options::internal::RequestBuilder for GenerateStatelessSummary {
3721 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3722 &mut self.0.options
3723 }
3724 }
3725
3726 #[derive(Clone, Debug)]
3743 pub struct GenerateStatelessSuggestion(
3744 RequestBuilder<crate::model::GenerateStatelessSuggestionRequest>,
3745 );
3746
3747 impl GenerateStatelessSuggestion {
3748 pub(crate) fn new(
3749 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3750 ) -> Self {
3751 Self(RequestBuilder::new(stub))
3752 }
3753
3754 pub fn with_request<V: Into<crate::model::GenerateStatelessSuggestionRequest>>(
3756 mut self,
3757 v: V,
3758 ) -> Self {
3759 self.0.request = v.into();
3760 self
3761 }
3762
3763 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3765 self.0.options = v.into();
3766 self
3767 }
3768
3769 pub async fn send(self) -> Result<crate::model::GenerateStatelessSuggestionResponse> {
3771 (*self.0.stub)
3772 .generate_stateless_suggestion(self.0.request, self.0.options)
3773 .await
3774 .map(gax::response::Response::into_body)
3775 }
3776
3777 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3781 self.0.request.parent = v.into();
3782 self
3783 }
3784
3785 pub fn set_context_references<T, K, V>(mut self, v: T) -> Self
3787 where
3788 T: std::iter::IntoIterator<Item = (K, V)>,
3789 K: std::convert::Into<std::string::String>,
3790 V: std::convert::Into<crate::model::conversation::ContextReference>,
3791 {
3792 self.0.request.context_references =
3793 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3794 self
3795 }
3796
3797 pub fn set_conversation_context<T>(mut self, v: T) -> Self
3799 where
3800 T: std::convert::Into<crate::model::ConversationContext>,
3801 {
3802 self.0.request.conversation_context = std::option::Option::Some(v.into());
3803 self
3804 }
3805
3806 pub fn set_or_clear_conversation_context<T>(mut self, v: std::option::Option<T>) -> Self
3808 where
3809 T: std::convert::Into<crate::model::ConversationContext>,
3810 {
3811 self.0.request.conversation_context = v.map(|x| x.into());
3812 self
3813 }
3814
3815 pub fn set_trigger_events<T, V>(mut self, v: T) -> Self
3817 where
3818 T: std::iter::IntoIterator<Item = V>,
3819 V: std::convert::Into<crate::model::TriggerEvent>,
3820 {
3821 use std::iter::Iterator;
3822 self.0.request.trigger_events = v.into_iter().map(|i| i.into()).collect();
3823 self
3824 }
3825
3826 pub fn set_security_settings<T: Into<std::string::String>>(mut self, v: T) -> Self {
3828 self.0.request.security_settings = v.into();
3829 self
3830 }
3831
3832 pub fn set_generator_resource<
3837 T: Into<Option<crate::model::generate_stateless_suggestion_request::GeneratorResource>>,
3838 >(
3839 mut self,
3840 v: T,
3841 ) -> Self {
3842 self.0.request.generator_resource = v.into();
3843 self
3844 }
3845
3846 pub fn set_generator<T: std::convert::Into<std::boxed::Box<crate::model::Generator>>>(
3852 mut self,
3853 v: T,
3854 ) -> Self {
3855 self.0.request = self.0.request.set_generator(v);
3856 self
3857 }
3858
3859 pub fn set_generator_name<T: std::convert::Into<std::string::String>>(
3865 mut self,
3866 v: T,
3867 ) -> Self {
3868 self.0.request = self.0.request.set_generator_name(v);
3869 self
3870 }
3871 }
3872
3873 #[doc(hidden)]
3874 impl gax::options::internal::RequestBuilder for GenerateStatelessSuggestion {
3875 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3876 &mut self.0.options
3877 }
3878 }
3879
3880 #[derive(Clone, Debug)]
3897 pub struct SearchKnowledge(RequestBuilder<crate::model::SearchKnowledgeRequest>);
3898
3899 impl SearchKnowledge {
3900 pub(crate) fn new(
3901 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3902 ) -> Self {
3903 Self(RequestBuilder::new(stub))
3904 }
3905
3906 pub fn with_request<V: Into<crate::model::SearchKnowledgeRequest>>(mut self, v: V) -> Self {
3908 self.0.request = v.into();
3909 self
3910 }
3911
3912 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3914 self.0.options = v.into();
3915 self
3916 }
3917
3918 pub async fn send(self) -> Result<crate::model::SearchKnowledgeResponse> {
3920 (*self.0.stub)
3921 .search_knowledge(self.0.request, self.0.options)
3922 .await
3923 .map(gax::response::Response::into_body)
3924 }
3925
3926 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3930 self.0.request.parent = v.into();
3931 self
3932 }
3933
3934 pub fn set_query<T>(mut self, v: T) -> Self
3938 where
3939 T: std::convert::Into<crate::model::TextInput>,
3940 {
3941 self.0.request.query = std::option::Option::Some(v.into());
3942 self
3943 }
3944
3945 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
3949 where
3950 T: std::convert::Into<crate::model::TextInput>,
3951 {
3952 self.0.request.query = v.map(|x| x.into());
3953 self
3954 }
3955
3956 pub fn set_conversation_profile<T: Into<std::string::String>>(mut self, v: T) -> Self {
3960 self.0.request.conversation_profile = v.into();
3961 self
3962 }
3963
3964 pub fn set_session_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3968 self.0.request.session_id = v.into();
3969 self
3970 }
3971
3972 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
3974 self.0.request.conversation = v.into();
3975 self
3976 }
3977
3978 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
3980 self.0.request.latest_message = v.into();
3981 self
3982 }
3983
3984 pub fn set_query_source<T: Into<crate::model::search_knowledge_request::QuerySource>>(
3986 mut self,
3987 v: T,
3988 ) -> Self {
3989 self.0.request.query_source = v.into();
3990 self
3991 }
3992
3993 pub fn set_end_user_metadata<T>(mut self, v: T) -> Self
3995 where
3996 T: std::convert::Into<wkt::Struct>,
3997 {
3998 self.0.request.end_user_metadata = std::option::Option::Some(v.into());
3999 self
4000 }
4001
4002 pub fn set_or_clear_end_user_metadata<T>(mut self, v: std::option::Option<T>) -> Self
4004 where
4005 T: std::convert::Into<wkt::Struct>,
4006 {
4007 self.0.request.end_user_metadata = v.map(|x| x.into());
4008 self
4009 }
4010
4011 pub fn set_search_config<T>(mut self, v: T) -> Self
4013 where
4014 T: std::convert::Into<crate::model::search_knowledge_request::SearchConfig>,
4015 {
4016 self.0.request.search_config = std::option::Option::Some(v.into());
4017 self
4018 }
4019
4020 pub fn set_or_clear_search_config<T>(mut self, v: std::option::Option<T>) -> Self
4022 where
4023 T: std::convert::Into<crate::model::search_knowledge_request::SearchConfig>,
4024 {
4025 self.0.request.search_config = v.map(|x| x.into());
4026 self
4027 }
4028
4029 pub fn set_exact_search<T: Into<bool>>(mut self, v: T) -> Self {
4031 self.0.request.exact_search = v.into();
4032 self
4033 }
4034 }
4035
4036 #[doc(hidden)]
4037 impl gax::options::internal::RequestBuilder for SearchKnowledge {
4038 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4039 &mut self.0.options
4040 }
4041 }
4042
4043 #[derive(Clone, Debug)]
4060 pub struct GenerateSuggestions(RequestBuilder<crate::model::GenerateSuggestionsRequest>);
4061
4062 impl GenerateSuggestions {
4063 pub(crate) fn new(
4064 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4065 ) -> Self {
4066 Self(RequestBuilder::new(stub))
4067 }
4068
4069 pub fn with_request<V: Into<crate::model::GenerateSuggestionsRequest>>(
4071 mut self,
4072 v: V,
4073 ) -> Self {
4074 self.0.request = v.into();
4075 self
4076 }
4077
4078 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4080 self.0.options = v.into();
4081 self
4082 }
4083
4084 pub async fn send(self) -> Result<crate::model::GenerateSuggestionsResponse> {
4086 (*self.0.stub)
4087 .generate_suggestions(self.0.request, self.0.options)
4088 .await
4089 .map(gax::response::Response::into_body)
4090 }
4091
4092 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
4096 self.0.request.conversation = v.into();
4097 self
4098 }
4099
4100 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
4102 self.0.request.latest_message = v.into();
4103 self
4104 }
4105
4106 pub fn set_trigger_events<T, V>(mut self, v: T) -> Self
4108 where
4109 T: std::iter::IntoIterator<Item = V>,
4110 V: std::convert::Into<crate::model::TriggerEvent>,
4111 {
4112 use std::iter::Iterator;
4113 self.0.request.trigger_events = v.into_iter().map(|i| i.into()).collect();
4114 self
4115 }
4116 }
4117
4118 #[doc(hidden)]
4119 impl gax::options::internal::RequestBuilder for GenerateSuggestions {
4120 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4121 &mut self.0.options
4122 }
4123 }
4124
4125 #[derive(Clone, Debug)]
4146 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
4147
4148 impl ListLocations {
4149 pub(crate) fn new(
4150 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4151 ) -> Self {
4152 Self(RequestBuilder::new(stub))
4153 }
4154
4155 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
4157 mut self,
4158 v: V,
4159 ) -> Self {
4160 self.0.request = v.into();
4161 self
4162 }
4163
4164 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4166 self.0.options = v.into();
4167 self
4168 }
4169
4170 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
4172 (*self.0.stub)
4173 .list_locations(self.0.request, self.0.options)
4174 .await
4175 .map(gax::response::Response::into_body)
4176 }
4177
4178 pub fn by_page(
4180 self,
4181 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
4182 {
4183 use std::clone::Clone;
4184 let token = self.0.request.page_token.clone();
4185 let execute = move |token: String| {
4186 let mut builder = self.clone();
4187 builder.0.request = builder.0.request.set_page_token(token);
4188 builder.send()
4189 };
4190 gax::paginator::internal::new_paginator(token, execute)
4191 }
4192
4193 pub fn by_item(
4195 self,
4196 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
4197 {
4198 use gax::paginator::Paginator;
4199 self.by_page().items()
4200 }
4201
4202 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4204 self.0.request.name = v.into();
4205 self
4206 }
4207
4208 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4210 self.0.request.filter = v.into();
4211 self
4212 }
4213
4214 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4216 self.0.request.page_size = v.into();
4217 self
4218 }
4219
4220 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4222 self.0.request.page_token = v.into();
4223 self
4224 }
4225 }
4226
4227 #[doc(hidden)]
4228 impl gax::options::internal::RequestBuilder for ListLocations {
4229 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4230 &mut self.0.options
4231 }
4232 }
4233
4234 #[derive(Clone, Debug)]
4251 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
4252
4253 impl GetLocation {
4254 pub(crate) fn new(
4255 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4256 ) -> Self {
4257 Self(RequestBuilder::new(stub))
4258 }
4259
4260 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
4262 self.0.request = v.into();
4263 self
4264 }
4265
4266 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4268 self.0.options = v.into();
4269 self
4270 }
4271
4272 pub async fn send(self) -> Result<location::model::Location> {
4274 (*self.0.stub)
4275 .get_location(self.0.request, self.0.options)
4276 .await
4277 .map(gax::response::Response::into_body)
4278 }
4279
4280 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4282 self.0.request.name = v.into();
4283 self
4284 }
4285 }
4286
4287 #[doc(hidden)]
4288 impl gax::options::internal::RequestBuilder for GetLocation {
4289 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4290 &mut self.0.options
4291 }
4292 }
4293
4294 #[derive(Clone, Debug)]
4315 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
4316
4317 impl ListOperations {
4318 pub(crate) fn new(
4319 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4320 ) -> Self {
4321 Self(RequestBuilder::new(stub))
4322 }
4323
4324 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4326 mut self,
4327 v: V,
4328 ) -> Self {
4329 self.0.request = v.into();
4330 self
4331 }
4332
4333 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4335 self.0.options = v.into();
4336 self
4337 }
4338
4339 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4341 (*self.0.stub)
4342 .list_operations(self.0.request, self.0.options)
4343 .await
4344 .map(gax::response::Response::into_body)
4345 }
4346
4347 pub fn by_page(
4349 self,
4350 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4351 {
4352 use std::clone::Clone;
4353 let token = self.0.request.page_token.clone();
4354 let execute = move |token: String| {
4355 let mut builder = self.clone();
4356 builder.0.request = builder.0.request.set_page_token(token);
4357 builder.send()
4358 };
4359 gax::paginator::internal::new_paginator(token, execute)
4360 }
4361
4362 pub fn by_item(
4364 self,
4365 ) -> impl gax::paginator::ItemPaginator<
4366 longrunning::model::ListOperationsResponse,
4367 gax::error::Error,
4368 > {
4369 use gax::paginator::Paginator;
4370 self.by_page().items()
4371 }
4372
4373 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4375 self.0.request.name = v.into();
4376 self
4377 }
4378
4379 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4381 self.0.request.filter = v.into();
4382 self
4383 }
4384
4385 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4387 self.0.request.page_size = v.into();
4388 self
4389 }
4390
4391 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4393 self.0.request.page_token = v.into();
4394 self
4395 }
4396
4397 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4399 self.0.request.return_partial_success = v.into();
4400 self
4401 }
4402 }
4403
4404 #[doc(hidden)]
4405 impl gax::options::internal::RequestBuilder for ListOperations {
4406 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4407 &mut self.0.options
4408 }
4409 }
4410
4411 #[derive(Clone, Debug)]
4428 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4429
4430 impl GetOperation {
4431 pub(crate) fn new(
4432 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4433 ) -> Self {
4434 Self(RequestBuilder::new(stub))
4435 }
4436
4437 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4439 mut self,
4440 v: V,
4441 ) -> Self {
4442 self.0.request = v.into();
4443 self
4444 }
4445
4446 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4448 self.0.options = v.into();
4449 self
4450 }
4451
4452 pub async fn send(self) -> Result<longrunning::model::Operation> {
4454 (*self.0.stub)
4455 .get_operation(self.0.request, self.0.options)
4456 .await
4457 .map(gax::response::Response::into_body)
4458 }
4459
4460 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4462 self.0.request.name = v.into();
4463 self
4464 }
4465 }
4466
4467 #[doc(hidden)]
4468 impl gax::options::internal::RequestBuilder for GetOperation {
4469 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4470 &mut self.0.options
4471 }
4472 }
4473
4474 #[derive(Clone, Debug)]
4491 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
4492
4493 impl CancelOperation {
4494 pub(crate) fn new(
4495 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4496 ) -> Self {
4497 Self(RequestBuilder::new(stub))
4498 }
4499
4500 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
4502 mut self,
4503 v: V,
4504 ) -> Self {
4505 self.0.request = v.into();
4506 self
4507 }
4508
4509 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4511 self.0.options = v.into();
4512 self
4513 }
4514
4515 pub async fn send(self) -> Result<()> {
4517 (*self.0.stub)
4518 .cancel_operation(self.0.request, self.0.options)
4519 .await
4520 .map(gax::response::Response::into_body)
4521 }
4522
4523 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4525 self.0.request.name = v.into();
4526 self
4527 }
4528 }
4529
4530 #[doc(hidden)]
4531 impl gax::options::internal::RequestBuilder for CancelOperation {
4532 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4533 &mut self.0.options
4534 }
4535 }
4536}
4537
4538#[cfg(feature = "conversation-datasets")]
4539#[cfg_attr(docsrs, doc(cfg(feature = "conversation-datasets")))]
4540pub mod conversation_datasets {
4541 use crate::Result;
4542
4543 pub type ClientBuilder =
4557 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4558
4559 pub(crate) mod client {
4560 use super::super::super::client::ConversationDatasets;
4561 pub struct Factory;
4562 impl gax::client_builder::internal::ClientFactory for Factory {
4563 type Client = ConversationDatasets;
4564 type Credentials = gaxi::options::Credentials;
4565 async fn build(
4566 self,
4567 config: gaxi::options::ClientConfig,
4568 ) -> gax::client_builder::Result<Self::Client> {
4569 Self::Client::new(config).await
4570 }
4571 }
4572 }
4573
4574 #[derive(Clone, Debug)]
4576 pub(crate) struct RequestBuilder<R: std::default::Default> {
4577 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4578 request: R,
4579 options: gax::options::RequestOptions,
4580 }
4581
4582 impl<R> RequestBuilder<R>
4583 where
4584 R: std::default::Default,
4585 {
4586 pub(crate) fn new(
4587 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4588 ) -> Self {
4589 Self {
4590 stub,
4591 request: R::default(),
4592 options: gax::options::RequestOptions::default(),
4593 }
4594 }
4595 }
4596
4597 #[derive(Clone, Debug)]
4615 pub struct CreateConversationDataset(
4616 RequestBuilder<crate::model::CreateConversationDatasetRequest>,
4617 );
4618
4619 impl CreateConversationDataset {
4620 pub(crate) fn new(
4621 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4622 ) -> Self {
4623 Self(RequestBuilder::new(stub))
4624 }
4625
4626 pub fn with_request<V: Into<crate::model::CreateConversationDatasetRequest>>(
4628 mut self,
4629 v: V,
4630 ) -> Self {
4631 self.0.request = v.into();
4632 self
4633 }
4634
4635 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4637 self.0.options = v.into();
4638 self
4639 }
4640
4641 pub async fn send(self) -> Result<longrunning::model::Operation> {
4648 (*self.0.stub)
4649 .create_conversation_dataset(self.0.request, self.0.options)
4650 .await
4651 .map(gax::response::Response::into_body)
4652 }
4653
4654 pub fn poller(
4656 self,
4657 ) -> impl lro::Poller<
4658 crate::model::ConversationDataset,
4659 crate::model::CreateConversationDatasetOperationMetadata,
4660 > {
4661 type Operation = lro::internal::Operation<
4662 crate::model::ConversationDataset,
4663 crate::model::CreateConversationDatasetOperationMetadata,
4664 >;
4665 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4666 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4667
4668 let stub = self.0.stub.clone();
4669 let mut options = self.0.options.clone();
4670 options.set_retry_policy(gax::retry_policy::NeverRetry);
4671 let query = move |name| {
4672 let stub = stub.clone();
4673 let options = options.clone();
4674 async {
4675 let op = GetOperation::new(stub)
4676 .set_name(name)
4677 .with_options(options)
4678 .send()
4679 .await?;
4680 Ok(Operation::new(op))
4681 }
4682 };
4683
4684 let start = move || async {
4685 let op = self.send().await?;
4686 Ok(Operation::new(op))
4687 };
4688
4689 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
4690 }
4691
4692 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4696 self.0.request.parent = v.into();
4697 self
4698 }
4699
4700 pub fn set_conversation_dataset<T>(mut self, v: T) -> Self
4704 where
4705 T: std::convert::Into<crate::model::ConversationDataset>,
4706 {
4707 self.0.request.conversation_dataset = std::option::Option::Some(v.into());
4708 self
4709 }
4710
4711 pub fn set_or_clear_conversation_dataset<T>(mut self, v: std::option::Option<T>) -> Self
4715 where
4716 T: std::convert::Into<crate::model::ConversationDataset>,
4717 {
4718 self.0.request.conversation_dataset = v.map(|x| x.into());
4719 self
4720 }
4721 }
4722
4723 #[doc(hidden)]
4724 impl gax::options::internal::RequestBuilder for CreateConversationDataset {
4725 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4726 &mut self.0.options
4727 }
4728 }
4729
4730 #[derive(Clone, Debug)]
4747 pub struct GetConversationDataset(RequestBuilder<crate::model::GetConversationDatasetRequest>);
4748
4749 impl GetConversationDataset {
4750 pub(crate) fn new(
4751 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4752 ) -> Self {
4753 Self(RequestBuilder::new(stub))
4754 }
4755
4756 pub fn with_request<V: Into<crate::model::GetConversationDatasetRequest>>(
4758 mut self,
4759 v: V,
4760 ) -> Self {
4761 self.0.request = v.into();
4762 self
4763 }
4764
4765 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4767 self.0.options = v.into();
4768 self
4769 }
4770
4771 pub async fn send(self) -> Result<crate::model::ConversationDataset> {
4773 (*self.0.stub)
4774 .get_conversation_dataset(self.0.request, self.0.options)
4775 .await
4776 .map(gax::response::Response::into_body)
4777 }
4778
4779 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4783 self.0.request.name = v.into();
4784 self
4785 }
4786 }
4787
4788 #[doc(hidden)]
4789 impl gax::options::internal::RequestBuilder for GetConversationDataset {
4790 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4791 &mut self.0.options
4792 }
4793 }
4794
4795 #[derive(Clone, Debug)]
4816 pub struct ListConversationDatasets(
4817 RequestBuilder<crate::model::ListConversationDatasetsRequest>,
4818 );
4819
4820 impl ListConversationDatasets {
4821 pub(crate) fn new(
4822 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4823 ) -> Self {
4824 Self(RequestBuilder::new(stub))
4825 }
4826
4827 pub fn with_request<V: Into<crate::model::ListConversationDatasetsRequest>>(
4829 mut self,
4830 v: V,
4831 ) -> Self {
4832 self.0.request = v.into();
4833 self
4834 }
4835
4836 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4838 self.0.options = v.into();
4839 self
4840 }
4841
4842 pub async fn send(self) -> Result<crate::model::ListConversationDatasetsResponse> {
4844 (*self.0.stub)
4845 .list_conversation_datasets(self.0.request, self.0.options)
4846 .await
4847 .map(gax::response::Response::into_body)
4848 }
4849
4850 pub fn by_page(
4852 self,
4853 ) -> impl gax::paginator::Paginator<
4854 crate::model::ListConversationDatasetsResponse,
4855 gax::error::Error,
4856 > {
4857 use std::clone::Clone;
4858 let token = self.0.request.page_token.clone();
4859 let execute = move |token: String| {
4860 let mut builder = self.clone();
4861 builder.0.request = builder.0.request.set_page_token(token);
4862 builder.send()
4863 };
4864 gax::paginator::internal::new_paginator(token, execute)
4865 }
4866
4867 pub fn by_item(
4869 self,
4870 ) -> impl gax::paginator::ItemPaginator<
4871 crate::model::ListConversationDatasetsResponse,
4872 gax::error::Error,
4873 > {
4874 use gax::paginator::Paginator;
4875 self.by_page().items()
4876 }
4877
4878 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4882 self.0.request.parent = v.into();
4883 self
4884 }
4885
4886 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4888 self.0.request.page_size = v.into();
4889 self
4890 }
4891
4892 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4894 self.0.request.page_token = v.into();
4895 self
4896 }
4897 }
4898
4899 #[doc(hidden)]
4900 impl gax::options::internal::RequestBuilder for ListConversationDatasets {
4901 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4902 &mut self.0.options
4903 }
4904 }
4905
4906 #[derive(Clone, Debug)]
4924 pub struct DeleteConversationDataset(
4925 RequestBuilder<crate::model::DeleteConversationDatasetRequest>,
4926 );
4927
4928 impl DeleteConversationDataset {
4929 pub(crate) fn new(
4930 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4931 ) -> Self {
4932 Self(RequestBuilder::new(stub))
4933 }
4934
4935 pub fn with_request<V: Into<crate::model::DeleteConversationDatasetRequest>>(
4937 mut self,
4938 v: V,
4939 ) -> Self {
4940 self.0.request = v.into();
4941 self
4942 }
4943
4944 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4946 self.0.options = v.into();
4947 self
4948 }
4949
4950 pub async fn send(self) -> Result<longrunning::model::Operation> {
4957 (*self.0.stub)
4958 .delete_conversation_dataset(self.0.request, self.0.options)
4959 .await
4960 .map(gax::response::Response::into_body)
4961 }
4962
4963 pub fn poller(
4965 self,
4966 ) -> impl lro::Poller<(), crate::model::DeleteConversationDatasetOperationMetadata>
4967 {
4968 type Operation = lro::internal::Operation<
4969 wkt::Empty,
4970 crate::model::DeleteConversationDatasetOperationMetadata,
4971 >;
4972 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4973 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4974
4975 let stub = self.0.stub.clone();
4976 let mut options = self.0.options.clone();
4977 options.set_retry_policy(gax::retry_policy::NeverRetry);
4978 let query = move |name| {
4979 let stub = stub.clone();
4980 let options = options.clone();
4981 async {
4982 let op = GetOperation::new(stub)
4983 .set_name(name)
4984 .with_options(options)
4985 .send()
4986 .await?;
4987 Ok(Operation::new(op))
4988 }
4989 };
4990
4991 let start = move || async {
4992 let op = self.send().await?;
4993 Ok(Operation::new(op))
4994 };
4995
4996 lro::internal::new_unit_response_poller(
4997 polling_error_policy,
4998 polling_backoff_policy,
4999 start,
5000 query,
5001 )
5002 }
5003
5004 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5008 self.0.request.name = v.into();
5009 self
5010 }
5011 }
5012
5013 #[doc(hidden)]
5014 impl gax::options::internal::RequestBuilder for DeleteConversationDataset {
5015 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5016 &mut self.0.options
5017 }
5018 }
5019
5020 #[derive(Clone, Debug)]
5038 pub struct ImportConversationData(RequestBuilder<crate::model::ImportConversationDataRequest>);
5039
5040 impl ImportConversationData {
5041 pub(crate) fn new(
5042 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5043 ) -> Self {
5044 Self(RequestBuilder::new(stub))
5045 }
5046
5047 pub fn with_request<V: Into<crate::model::ImportConversationDataRequest>>(
5049 mut self,
5050 v: V,
5051 ) -> Self {
5052 self.0.request = v.into();
5053 self
5054 }
5055
5056 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5058 self.0.options = v.into();
5059 self
5060 }
5061
5062 pub async fn send(self) -> Result<longrunning::model::Operation> {
5069 (*self.0.stub)
5070 .import_conversation_data(self.0.request, self.0.options)
5071 .await
5072 .map(gax::response::Response::into_body)
5073 }
5074
5075 pub fn poller(
5077 self,
5078 ) -> impl lro::Poller<
5079 crate::model::ImportConversationDataOperationResponse,
5080 crate::model::ImportConversationDataOperationMetadata,
5081 > {
5082 type Operation = lro::internal::Operation<
5083 crate::model::ImportConversationDataOperationResponse,
5084 crate::model::ImportConversationDataOperationMetadata,
5085 >;
5086 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5087 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5088
5089 let stub = self.0.stub.clone();
5090 let mut options = self.0.options.clone();
5091 options.set_retry_policy(gax::retry_policy::NeverRetry);
5092 let query = move |name| {
5093 let stub = stub.clone();
5094 let options = options.clone();
5095 async {
5096 let op = GetOperation::new(stub)
5097 .set_name(name)
5098 .with_options(options)
5099 .send()
5100 .await?;
5101 Ok(Operation::new(op))
5102 }
5103 };
5104
5105 let start = move || async {
5106 let op = self.send().await?;
5107 Ok(Operation::new(op))
5108 };
5109
5110 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5111 }
5112
5113 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5117 self.0.request.name = v.into();
5118 self
5119 }
5120
5121 pub fn set_input_config<T>(mut self, v: T) -> Self
5125 where
5126 T: std::convert::Into<crate::model::InputConfig>,
5127 {
5128 self.0.request.input_config = std::option::Option::Some(v.into());
5129 self
5130 }
5131
5132 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
5136 where
5137 T: std::convert::Into<crate::model::InputConfig>,
5138 {
5139 self.0.request.input_config = v.map(|x| x.into());
5140 self
5141 }
5142 }
5143
5144 #[doc(hidden)]
5145 impl gax::options::internal::RequestBuilder for ImportConversationData {
5146 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5147 &mut self.0.options
5148 }
5149 }
5150
5151 #[derive(Clone, Debug)]
5172 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
5173
5174 impl ListLocations {
5175 pub(crate) fn new(
5176 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5177 ) -> Self {
5178 Self(RequestBuilder::new(stub))
5179 }
5180
5181 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
5183 mut self,
5184 v: V,
5185 ) -> Self {
5186 self.0.request = v.into();
5187 self
5188 }
5189
5190 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5192 self.0.options = v.into();
5193 self
5194 }
5195
5196 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
5198 (*self.0.stub)
5199 .list_locations(self.0.request, self.0.options)
5200 .await
5201 .map(gax::response::Response::into_body)
5202 }
5203
5204 pub fn by_page(
5206 self,
5207 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
5208 {
5209 use std::clone::Clone;
5210 let token = self.0.request.page_token.clone();
5211 let execute = move |token: String| {
5212 let mut builder = self.clone();
5213 builder.0.request = builder.0.request.set_page_token(token);
5214 builder.send()
5215 };
5216 gax::paginator::internal::new_paginator(token, execute)
5217 }
5218
5219 pub fn by_item(
5221 self,
5222 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
5223 {
5224 use gax::paginator::Paginator;
5225 self.by_page().items()
5226 }
5227
5228 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5230 self.0.request.name = v.into();
5231 self
5232 }
5233
5234 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5236 self.0.request.filter = v.into();
5237 self
5238 }
5239
5240 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5242 self.0.request.page_size = v.into();
5243 self
5244 }
5245
5246 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5248 self.0.request.page_token = v.into();
5249 self
5250 }
5251 }
5252
5253 #[doc(hidden)]
5254 impl gax::options::internal::RequestBuilder for ListLocations {
5255 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5256 &mut self.0.options
5257 }
5258 }
5259
5260 #[derive(Clone, Debug)]
5277 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
5278
5279 impl GetLocation {
5280 pub(crate) fn new(
5281 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5282 ) -> Self {
5283 Self(RequestBuilder::new(stub))
5284 }
5285
5286 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
5288 self.0.request = v.into();
5289 self
5290 }
5291
5292 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5294 self.0.options = v.into();
5295 self
5296 }
5297
5298 pub async fn send(self) -> Result<location::model::Location> {
5300 (*self.0.stub)
5301 .get_location(self.0.request, self.0.options)
5302 .await
5303 .map(gax::response::Response::into_body)
5304 }
5305
5306 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5308 self.0.request.name = v.into();
5309 self
5310 }
5311 }
5312
5313 #[doc(hidden)]
5314 impl gax::options::internal::RequestBuilder for GetLocation {
5315 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5316 &mut self.0.options
5317 }
5318 }
5319
5320 #[derive(Clone, Debug)]
5341 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
5342
5343 impl ListOperations {
5344 pub(crate) fn new(
5345 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5346 ) -> Self {
5347 Self(RequestBuilder::new(stub))
5348 }
5349
5350 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
5352 mut self,
5353 v: V,
5354 ) -> Self {
5355 self.0.request = v.into();
5356 self
5357 }
5358
5359 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5361 self.0.options = v.into();
5362 self
5363 }
5364
5365 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
5367 (*self.0.stub)
5368 .list_operations(self.0.request, self.0.options)
5369 .await
5370 .map(gax::response::Response::into_body)
5371 }
5372
5373 pub fn by_page(
5375 self,
5376 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
5377 {
5378 use std::clone::Clone;
5379 let token = self.0.request.page_token.clone();
5380 let execute = move |token: String| {
5381 let mut builder = self.clone();
5382 builder.0.request = builder.0.request.set_page_token(token);
5383 builder.send()
5384 };
5385 gax::paginator::internal::new_paginator(token, execute)
5386 }
5387
5388 pub fn by_item(
5390 self,
5391 ) -> impl gax::paginator::ItemPaginator<
5392 longrunning::model::ListOperationsResponse,
5393 gax::error::Error,
5394 > {
5395 use gax::paginator::Paginator;
5396 self.by_page().items()
5397 }
5398
5399 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5401 self.0.request.name = v.into();
5402 self
5403 }
5404
5405 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5407 self.0.request.filter = v.into();
5408 self
5409 }
5410
5411 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5413 self.0.request.page_size = v.into();
5414 self
5415 }
5416
5417 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5419 self.0.request.page_token = v.into();
5420 self
5421 }
5422
5423 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5425 self.0.request.return_partial_success = v.into();
5426 self
5427 }
5428 }
5429
5430 #[doc(hidden)]
5431 impl gax::options::internal::RequestBuilder for ListOperations {
5432 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5433 &mut self.0.options
5434 }
5435 }
5436
5437 #[derive(Clone, Debug)]
5454 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
5455
5456 impl GetOperation {
5457 pub(crate) fn new(
5458 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5459 ) -> Self {
5460 Self(RequestBuilder::new(stub))
5461 }
5462
5463 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
5465 mut self,
5466 v: V,
5467 ) -> Self {
5468 self.0.request = v.into();
5469 self
5470 }
5471
5472 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5474 self.0.options = v.into();
5475 self
5476 }
5477
5478 pub async fn send(self) -> Result<longrunning::model::Operation> {
5480 (*self.0.stub)
5481 .get_operation(self.0.request, self.0.options)
5482 .await
5483 .map(gax::response::Response::into_body)
5484 }
5485
5486 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5488 self.0.request.name = v.into();
5489 self
5490 }
5491 }
5492
5493 #[doc(hidden)]
5494 impl gax::options::internal::RequestBuilder for GetOperation {
5495 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5496 &mut self.0.options
5497 }
5498 }
5499
5500 #[derive(Clone, Debug)]
5517 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
5518
5519 impl CancelOperation {
5520 pub(crate) fn new(
5521 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5522 ) -> Self {
5523 Self(RequestBuilder::new(stub))
5524 }
5525
5526 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
5528 mut self,
5529 v: V,
5530 ) -> Self {
5531 self.0.request = v.into();
5532 self
5533 }
5534
5535 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5537 self.0.options = v.into();
5538 self
5539 }
5540
5541 pub async fn send(self) -> Result<()> {
5543 (*self.0.stub)
5544 .cancel_operation(self.0.request, self.0.options)
5545 .await
5546 .map(gax::response::Response::into_body)
5547 }
5548
5549 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5551 self.0.request.name = v.into();
5552 self
5553 }
5554 }
5555
5556 #[doc(hidden)]
5557 impl gax::options::internal::RequestBuilder for CancelOperation {
5558 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5559 &mut self.0.options
5560 }
5561 }
5562}
5563
5564#[cfg(feature = "conversation-models")]
5565#[cfg_attr(docsrs, doc(cfg(feature = "conversation-models")))]
5566pub mod conversation_models {
5567 use crate::Result;
5568
5569 pub type ClientBuilder =
5583 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5584
5585 pub(crate) mod client {
5586 use super::super::super::client::ConversationModels;
5587 pub struct Factory;
5588 impl gax::client_builder::internal::ClientFactory for Factory {
5589 type Client = ConversationModels;
5590 type Credentials = gaxi::options::Credentials;
5591 async fn build(
5592 self,
5593 config: gaxi::options::ClientConfig,
5594 ) -> gax::client_builder::Result<Self::Client> {
5595 Self::Client::new(config).await
5596 }
5597 }
5598 }
5599
5600 #[derive(Clone, Debug)]
5602 pub(crate) struct RequestBuilder<R: std::default::Default> {
5603 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5604 request: R,
5605 options: gax::options::RequestOptions,
5606 }
5607
5608 impl<R> RequestBuilder<R>
5609 where
5610 R: std::default::Default,
5611 {
5612 pub(crate) fn new(
5613 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5614 ) -> Self {
5615 Self {
5616 stub,
5617 request: R::default(),
5618 options: gax::options::RequestOptions::default(),
5619 }
5620 }
5621 }
5622
5623 #[derive(Clone, Debug)]
5641 pub struct CreateConversationModel(
5642 RequestBuilder<crate::model::CreateConversationModelRequest>,
5643 );
5644
5645 impl CreateConversationModel {
5646 pub(crate) fn new(
5647 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5648 ) -> Self {
5649 Self(RequestBuilder::new(stub))
5650 }
5651
5652 pub fn with_request<V: Into<crate::model::CreateConversationModelRequest>>(
5654 mut self,
5655 v: V,
5656 ) -> Self {
5657 self.0.request = v.into();
5658 self
5659 }
5660
5661 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5663 self.0.options = v.into();
5664 self
5665 }
5666
5667 pub async fn send(self) -> Result<longrunning::model::Operation> {
5674 (*self.0.stub)
5675 .create_conversation_model(self.0.request, self.0.options)
5676 .await
5677 .map(gax::response::Response::into_body)
5678 }
5679
5680 pub fn poller(
5682 self,
5683 ) -> impl lro::Poller<
5684 crate::model::ConversationModel,
5685 crate::model::CreateConversationModelOperationMetadata,
5686 > {
5687 type Operation = lro::internal::Operation<
5688 crate::model::ConversationModel,
5689 crate::model::CreateConversationModelOperationMetadata,
5690 >;
5691 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5692 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5693
5694 let stub = self.0.stub.clone();
5695 let mut options = self.0.options.clone();
5696 options.set_retry_policy(gax::retry_policy::NeverRetry);
5697 let query = move |name| {
5698 let stub = stub.clone();
5699 let options = options.clone();
5700 async {
5701 let op = GetOperation::new(stub)
5702 .set_name(name)
5703 .with_options(options)
5704 .send()
5705 .await?;
5706 Ok(Operation::new(op))
5707 }
5708 };
5709
5710 let start = move || async {
5711 let op = self.send().await?;
5712 Ok(Operation::new(op))
5713 };
5714
5715 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
5716 }
5717
5718 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5720 self.0.request.parent = v.into();
5721 self
5722 }
5723
5724 pub fn set_conversation_model<T>(mut self, v: T) -> Self
5728 where
5729 T: std::convert::Into<crate::model::ConversationModel>,
5730 {
5731 self.0.request.conversation_model = std::option::Option::Some(v.into());
5732 self
5733 }
5734
5735 pub fn set_or_clear_conversation_model<T>(mut self, v: std::option::Option<T>) -> Self
5739 where
5740 T: std::convert::Into<crate::model::ConversationModel>,
5741 {
5742 self.0.request.conversation_model = v.map(|x| x.into());
5743 self
5744 }
5745 }
5746
5747 #[doc(hidden)]
5748 impl gax::options::internal::RequestBuilder for CreateConversationModel {
5749 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5750 &mut self.0.options
5751 }
5752 }
5753
5754 #[derive(Clone, Debug)]
5771 pub struct GetConversationModel(RequestBuilder<crate::model::GetConversationModelRequest>);
5772
5773 impl GetConversationModel {
5774 pub(crate) fn new(
5775 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5776 ) -> Self {
5777 Self(RequestBuilder::new(stub))
5778 }
5779
5780 pub fn with_request<V: Into<crate::model::GetConversationModelRequest>>(
5782 mut self,
5783 v: V,
5784 ) -> Self {
5785 self.0.request = v.into();
5786 self
5787 }
5788
5789 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5791 self.0.options = v.into();
5792 self
5793 }
5794
5795 pub async fn send(self) -> Result<crate::model::ConversationModel> {
5797 (*self.0.stub)
5798 .get_conversation_model(self.0.request, self.0.options)
5799 .await
5800 .map(gax::response::Response::into_body)
5801 }
5802
5803 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5807 self.0.request.name = v.into();
5808 self
5809 }
5810 }
5811
5812 #[doc(hidden)]
5813 impl gax::options::internal::RequestBuilder for GetConversationModel {
5814 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5815 &mut self.0.options
5816 }
5817 }
5818
5819 #[derive(Clone, Debug)]
5840 pub struct ListConversationModels(RequestBuilder<crate::model::ListConversationModelsRequest>);
5841
5842 impl ListConversationModels {
5843 pub(crate) fn new(
5844 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5845 ) -> Self {
5846 Self(RequestBuilder::new(stub))
5847 }
5848
5849 pub fn with_request<V: Into<crate::model::ListConversationModelsRequest>>(
5851 mut self,
5852 v: V,
5853 ) -> Self {
5854 self.0.request = v.into();
5855 self
5856 }
5857
5858 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5860 self.0.options = v.into();
5861 self
5862 }
5863
5864 pub async fn send(self) -> Result<crate::model::ListConversationModelsResponse> {
5866 (*self.0.stub)
5867 .list_conversation_models(self.0.request, self.0.options)
5868 .await
5869 .map(gax::response::Response::into_body)
5870 }
5871
5872 pub fn by_page(
5874 self,
5875 ) -> impl gax::paginator::Paginator<
5876 crate::model::ListConversationModelsResponse,
5877 gax::error::Error,
5878 > {
5879 use std::clone::Clone;
5880 let token = self.0.request.page_token.clone();
5881 let execute = move |token: String| {
5882 let mut builder = self.clone();
5883 builder.0.request = builder.0.request.set_page_token(token);
5884 builder.send()
5885 };
5886 gax::paginator::internal::new_paginator(token, execute)
5887 }
5888
5889 pub fn by_item(
5891 self,
5892 ) -> impl gax::paginator::ItemPaginator<
5893 crate::model::ListConversationModelsResponse,
5894 gax::error::Error,
5895 > {
5896 use gax::paginator::Paginator;
5897 self.by_page().items()
5898 }
5899
5900 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5904 self.0.request.parent = v.into();
5905 self
5906 }
5907
5908 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5910 self.0.request.page_size = v.into();
5911 self
5912 }
5913
5914 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5916 self.0.request.page_token = v.into();
5917 self
5918 }
5919 }
5920
5921 #[doc(hidden)]
5922 impl gax::options::internal::RequestBuilder for ListConversationModels {
5923 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
5924 &mut self.0.options
5925 }
5926 }
5927
5928 #[derive(Clone, Debug)]
5946 pub struct DeleteConversationModel(
5947 RequestBuilder<crate::model::DeleteConversationModelRequest>,
5948 );
5949
5950 impl DeleteConversationModel {
5951 pub(crate) fn new(
5952 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5953 ) -> Self {
5954 Self(RequestBuilder::new(stub))
5955 }
5956
5957 pub fn with_request<V: Into<crate::model::DeleteConversationModelRequest>>(
5959 mut self,
5960 v: V,
5961 ) -> Self {
5962 self.0.request = v.into();
5963 self
5964 }
5965
5966 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
5968 self.0.options = v.into();
5969 self
5970 }
5971
5972 pub async fn send(self) -> Result<longrunning::model::Operation> {
5979 (*self.0.stub)
5980 .delete_conversation_model(self.0.request, self.0.options)
5981 .await
5982 .map(gax::response::Response::into_body)
5983 }
5984
5985 pub fn poller(
5987 self,
5988 ) -> impl lro::Poller<(), crate::model::DeleteConversationModelOperationMetadata> {
5989 type Operation = lro::internal::Operation<
5990 wkt::Empty,
5991 crate::model::DeleteConversationModelOperationMetadata,
5992 >;
5993 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5994 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5995
5996 let stub = self.0.stub.clone();
5997 let mut options = self.0.options.clone();
5998 options.set_retry_policy(gax::retry_policy::NeverRetry);
5999 let query = move |name| {
6000 let stub = stub.clone();
6001 let options = options.clone();
6002 async {
6003 let op = GetOperation::new(stub)
6004 .set_name(name)
6005 .with_options(options)
6006 .send()
6007 .await?;
6008 Ok(Operation::new(op))
6009 }
6010 };
6011
6012 let start = move || async {
6013 let op = self.send().await?;
6014 Ok(Operation::new(op))
6015 };
6016
6017 lro::internal::new_unit_response_poller(
6018 polling_error_policy,
6019 polling_backoff_policy,
6020 start,
6021 query,
6022 )
6023 }
6024
6025 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6029 self.0.request.name = v.into();
6030 self
6031 }
6032 }
6033
6034 #[doc(hidden)]
6035 impl gax::options::internal::RequestBuilder for DeleteConversationModel {
6036 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6037 &mut self.0.options
6038 }
6039 }
6040
6041 #[derive(Clone, Debug)]
6059 pub struct DeployConversationModel(
6060 RequestBuilder<crate::model::DeployConversationModelRequest>,
6061 );
6062
6063 impl DeployConversationModel {
6064 pub(crate) fn new(
6065 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6066 ) -> Self {
6067 Self(RequestBuilder::new(stub))
6068 }
6069
6070 pub fn with_request<V: Into<crate::model::DeployConversationModelRequest>>(
6072 mut self,
6073 v: V,
6074 ) -> Self {
6075 self.0.request = v.into();
6076 self
6077 }
6078
6079 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6081 self.0.options = v.into();
6082 self
6083 }
6084
6085 pub async fn send(self) -> Result<longrunning::model::Operation> {
6092 (*self.0.stub)
6093 .deploy_conversation_model(self.0.request, self.0.options)
6094 .await
6095 .map(gax::response::Response::into_body)
6096 }
6097
6098 pub fn poller(
6100 self,
6101 ) -> impl lro::Poller<(), crate::model::DeployConversationModelOperationMetadata> {
6102 type Operation = lro::internal::Operation<
6103 wkt::Empty,
6104 crate::model::DeployConversationModelOperationMetadata,
6105 >;
6106 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6107 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6108
6109 let stub = self.0.stub.clone();
6110 let mut options = self.0.options.clone();
6111 options.set_retry_policy(gax::retry_policy::NeverRetry);
6112 let query = move |name| {
6113 let stub = stub.clone();
6114 let options = options.clone();
6115 async {
6116 let op = GetOperation::new(stub)
6117 .set_name(name)
6118 .with_options(options)
6119 .send()
6120 .await?;
6121 Ok(Operation::new(op))
6122 }
6123 };
6124
6125 let start = move || async {
6126 let op = self.send().await?;
6127 Ok(Operation::new(op))
6128 };
6129
6130 lro::internal::new_unit_response_poller(
6131 polling_error_policy,
6132 polling_backoff_policy,
6133 start,
6134 query,
6135 )
6136 }
6137
6138 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6142 self.0.request.name = v.into();
6143 self
6144 }
6145 }
6146
6147 #[doc(hidden)]
6148 impl gax::options::internal::RequestBuilder for DeployConversationModel {
6149 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6150 &mut self.0.options
6151 }
6152 }
6153
6154 #[derive(Clone, Debug)]
6172 pub struct UndeployConversationModel(
6173 RequestBuilder<crate::model::UndeployConversationModelRequest>,
6174 );
6175
6176 impl UndeployConversationModel {
6177 pub(crate) fn new(
6178 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6179 ) -> Self {
6180 Self(RequestBuilder::new(stub))
6181 }
6182
6183 pub fn with_request<V: Into<crate::model::UndeployConversationModelRequest>>(
6185 mut self,
6186 v: V,
6187 ) -> Self {
6188 self.0.request = v.into();
6189 self
6190 }
6191
6192 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6194 self.0.options = v.into();
6195 self
6196 }
6197
6198 pub async fn send(self) -> Result<longrunning::model::Operation> {
6205 (*self.0.stub)
6206 .undeploy_conversation_model(self.0.request, self.0.options)
6207 .await
6208 .map(gax::response::Response::into_body)
6209 }
6210
6211 pub fn poller(
6213 self,
6214 ) -> impl lro::Poller<(), crate::model::UndeployConversationModelOperationMetadata>
6215 {
6216 type Operation = lro::internal::Operation<
6217 wkt::Empty,
6218 crate::model::UndeployConversationModelOperationMetadata,
6219 >;
6220 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6221 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6222
6223 let stub = self.0.stub.clone();
6224 let mut options = self.0.options.clone();
6225 options.set_retry_policy(gax::retry_policy::NeverRetry);
6226 let query = move |name| {
6227 let stub = stub.clone();
6228 let options = options.clone();
6229 async {
6230 let op = GetOperation::new(stub)
6231 .set_name(name)
6232 .with_options(options)
6233 .send()
6234 .await?;
6235 Ok(Operation::new(op))
6236 }
6237 };
6238
6239 let start = move || async {
6240 let op = self.send().await?;
6241 Ok(Operation::new(op))
6242 };
6243
6244 lro::internal::new_unit_response_poller(
6245 polling_error_policy,
6246 polling_backoff_policy,
6247 start,
6248 query,
6249 )
6250 }
6251
6252 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6256 self.0.request.name = v.into();
6257 self
6258 }
6259 }
6260
6261 #[doc(hidden)]
6262 impl gax::options::internal::RequestBuilder for UndeployConversationModel {
6263 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6264 &mut self.0.options
6265 }
6266 }
6267
6268 #[derive(Clone, Debug)]
6285 pub struct GetConversationModelEvaluation(
6286 RequestBuilder<crate::model::GetConversationModelEvaluationRequest>,
6287 );
6288
6289 impl GetConversationModelEvaluation {
6290 pub(crate) fn new(
6291 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6292 ) -> Self {
6293 Self(RequestBuilder::new(stub))
6294 }
6295
6296 pub fn with_request<V: Into<crate::model::GetConversationModelEvaluationRequest>>(
6298 mut self,
6299 v: V,
6300 ) -> Self {
6301 self.0.request = v.into();
6302 self
6303 }
6304
6305 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6307 self.0.options = v.into();
6308 self
6309 }
6310
6311 pub async fn send(self) -> Result<crate::model::ConversationModelEvaluation> {
6313 (*self.0.stub)
6314 .get_conversation_model_evaluation(self.0.request, self.0.options)
6315 .await
6316 .map(gax::response::Response::into_body)
6317 }
6318
6319 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6323 self.0.request.name = v.into();
6324 self
6325 }
6326 }
6327
6328 #[doc(hidden)]
6329 impl gax::options::internal::RequestBuilder for GetConversationModelEvaluation {
6330 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6331 &mut self.0.options
6332 }
6333 }
6334
6335 #[derive(Clone, Debug)]
6356 pub struct ListConversationModelEvaluations(
6357 RequestBuilder<crate::model::ListConversationModelEvaluationsRequest>,
6358 );
6359
6360 impl ListConversationModelEvaluations {
6361 pub(crate) fn new(
6362 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6363 ) -> Self {
6364 Self(RequestBuilder::new(stub))
6365 }
6366
6367 pub fn with_request<V: Into<crate::model::ListConversationModelEvaluationsRequest>>(
6369 mut self,
6370 v: V,
6371 ) -> Self {
6372 self.0.request = v.into();
6373 self
6374 }
6375
6376 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6378 self.0.options = v.into();
6379 self
6380 }
6381
6382 pub async fn send(self) -> Result<crate::model::ListConversationModelEvaluationsResponse> {
6384 (*self.0.stub)
6385 .list_conversation_model_evaluations(self.0.request, self.0.options)
6386 .await
6387 .map(gax::response::Response::into_body)
6388 }
6389
6390 pub fn by_page(
6392 self,
6393 ) -> impl gax::paginator::Paginator<
6394 crate::model::ListConversationModelEvaluationsResponse,
6395 gax::error::Error,
6396 > {
6397 use std::clone::Clone;
6398 let token = self.0.request.page_token.clone();
6399 let execute = move |token: String| {
6400 let mut builder = self.clone();
6401 builder.0.request = builder.0.request.set_page_token(token);
6402 builder.send()
6403 };
6404 gax::paginator::internal::new_paginator(token, execute)
6405 }
6406
6407 pub fn by_item(
6409 self,
6410 ) -> impl gax::paginator::ItemPaginator<
6411 crate::model::ListConversationModelEvaluationsResponse,
6412 gax::error::Error,
6413 > {
6414 use gax::paginator::Paginator;
6415 self.by_page().items()
6416 }
6417
6418 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6422 self.0.request.parent = v.into();
6423 self
6424 }
6425
6426 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6428 self.0.request.page_size = v.into();
6429 self
6430 }
6431
6432 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6434 self.0.request.page_token = v.into();
6435 self
6436 }
6437 }
6438
6439 #[doc(hidden)]
6440 impl gax::options::internal::RequestBuilder for ListConversationModelEvaluations {
6441 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6442 &mut self.0.options
6443 }
6444 }
6445
6446 #[derive(Clone, Debug)]
6464 pub struct CreateConversationModelEvaluation(
6465 RequestBuilder<crate::model::CreateConversationModelEvaluationRequest>,
6466 );
6467
6468 impl CreateConversationModelEvaluation {
6469 pub(crate) fn new(
6470 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6471 ) -> Self {
6472 Self(RequestBuilder::new(stub))
6473 }
6474
6475 pub fn with_request<V: Into<crate::model::CreateConversationModelEvaluationRequest>>(
6477 mut self,
6478 v: V,
6479 ) -> Self {
6480 self.0.request = v.into();
6481 self
6482 }
6483
6484 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6486 self.0.options = v.into();
6487 self
6488 }
6489
6490 pub async fn send(self) -> Result<longrunning::model::Operation> {
6497 (*self.0.stub)
6498 .create_conversation_model_evaluation(self.0.request, self.0.options)
6499 .await
6500 .map(gax::response::Response::into_body)
6501 }
6502
6503 pub fn poller(
6505 self,
6506 ) -> impl lro::Poller<
6507 crate::model::ConversationModelEvaluation,
6508 crate::model::CreateConversationModelEvaluationOperationMetadata,
6509 > {
6510 type Operation = lro::internal::Operation<
6511 crate::model::ConversationModelEvaluation,
6512 crate::model::CreateConversationModelEvaluationOperationMetadata,
6513 >;
6514 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6515 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6516
6517 let stub = self.0.stub.clone();
6518 let mut options = self.0.options.clone();
6519 options.set_retry_policy(gax::retry_policy::NeverRetry);
6520 let query = move |name| {
6521 let stub = stub.clone();
6522 let options = options.clone();
6523 async {
6524 let op = GetOperation::new(stub)
6525 .set_name(name)
6526 .with_options(options)
6527 .send()
6528 .await?;
6529 Ok(Operation::new(op))
6530 }
6531 };
6532
6533 let start = move || async {
6534 let op = self.send().await?;
6535 Ok(Operation::new(op))
6536 };
6537
6538 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
6539 }
6540
6541 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6545 self.0.request.parent = v.into();
6546 self
6547 }
6548
6549 pub fn set_conversation_model_evaluation<T>(mut self, v: T) -> Self
6553 where
6554 T: std::convert::Into<crate::model::ConversationModelEvaluation>,
6555 {
6556 self.0.request.conversation_model_evaluation = std::option::Option::Some(v.into());
6557 self
6558 }
6559
6560 pub fn set_or_clear_conversation_model_evaluation<T>(
6564 mut self,
6565 v: std::option::Option<T>,
6566 ) -> Self
6567 where
6568 T: std::convert::Into<crate::model::ConversationModelEvaluation>,
6569 {
6570 self.0.request.conversation_model_evaluation = v.map(|x| x.into());
6571 self
6572 }
6573 }
6574
6575 #[doc(hidden)]
6576 impl gax::options::internal::RequestBuilder for CreateConversationModelEvaluation {
6577 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6578 &mut self.0.options
6579 }
6580 }
6581
6582 #[derive(Clone, Debug)]
6603 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
6604
6605 impl ListLocations {
6606 pub(crate) fn new(
6607 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6608 ) -> Self {
6609 Self(RequestBuilder::new(stub))
6610 }
6611
6612 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
6614 mut self,
6615 v: V,
6616 ) -> Self {
6617 self.0.request = v.into();
6618 self
6619 }
6620
6621 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6623 self.0.options = v.into();
6624 self
6625 }
6626
6627 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
6629 (*self.0.stub)
6630 .list_locations(self.0.request, self.0.options)
6631 .await
6632 .map(gax::response::Response::into_body)
6633 }
6634
6635 pub fn by_page(
6637 self,
6638 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
6639 {
6640 use std::clone::Clone;
6641 let token = self.0.request.page_token.clone();
6642 let execute = move |token: String| {
6643 let mut builder = self.clone();
6644 builder.0.request = builder.0.request.set_page_token(token);
6645 builder.send()
6646 };
6647 gax::paginator::internal::new_paginator(token, execute)
6648 }
6649
6650 pub fn by_item(
6652 self,
6653 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
6654 {
6655 use gax::paginator::Paginator;
6656 self.by_page().items()
6657 }
6658
6659 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6661 self.0.request.name = v.into();
6662 self
6663 }
6664
6665 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6667 self.0.request.filter = v.into();
6668 self
6669 }
6670
6671 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6673 self.0.request.page_size = v.into();
6674 self
6675 }
6676
6677 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6679 self.0.request.page_token = v.into();
6680 self
6681 }
6682 }
6683
6684 #[doc(hidden)]
6685 impl gax::options::internal::RequestBuilder for ListLocations {
6686 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6687 &mut self.0.options
6688 }
6689 }
6690
6691 #[derive(Clone, Debug)]
6708 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
6709
6710 impl GetLocation {
6711 pub(crate) fn new(
6712 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6713 ) -> Self {
6714 Self(RequestBuilder::new(stub))
6715 }
6716
6717 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
6719 self.0.request = v.into();
6720 self
6721 }
6722
6723 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6725 self.0.options = v.into();
6726 self
6727 }
6728
6729 pub async fn send(self) -> Result<location::model::Location> {
6731 (*self.0.stub)
6732 .get_location(self.0.request, self.0.options)
6733 .await
6734 .map(gax::response::Response::into_body)
6735 }
6736
6737 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6739 self.0.request.name = v.into();
6740 self
6741 }
6742 }
6743
6744 #[doc(hidden)]
6745 impl gax::options::internal::RequestBuilder for GetLocation {
6746 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6747 &mut self.0.options
6748 }
6749 }
6750
6751 #[derive(Clone, Debug)]
6772 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
6773
6774 impl ListOperations {
6775 pub(crate) fn new(
6776 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6777 ) -> Self {
6778 Self(RequestBuilder::new(stub))
6779 }
6780
6781 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
6783 mut self,
6784 v: V,
6785 ) -> Self {
6786 self.0.request = v.into();
6787 self
6788 }
6789
6790 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6792 self.0.options = v.into();
6793 self
6794 }
6795
6796 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
6798 (*self.0.stub)
6799 .list_operations(self.0.request, self.0.options)
6800 .await
6801 .map(gax::response::Response::into_body)
6802 }
6803
6804 pub fn by_page(
6806 self,
6807 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
6808 {
6809 use std::clone::Clone;
6810 let token = self.0.request.page_token.clone();
6811 let execute = move |token: String| {
6812 let mut builder = self.clone();
6813 builder.0.request = builder.0.request.set_page_token(token);
6814 builder.send()
6815 };
6816 gax::paginator::internal::new_paginator(token, execute)
6817 }
6818
6819 pub fn by_item(
6821 self,
6822 ) -> impl gax::paginator::ItemPaginator<
6823 longrunning::model::ListOperationsResponse,
6824 gax::error::Error,
6825 > {
6826 use gax::paginator::Paginator;
6827 self.by_page().items()
6828 }
6829
6830 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6832 self.0.request.name = v.into();
6833 self
6834 }
6835
6836 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6838 self.0.request.filter = v.into();
6839 self
6840 }
6841
6842 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6844 self.0.request.page_size = v.into();
6845 self
6846 }
6847
6848 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6850 self.0.request.page_token = v.into();
6851 self
6852 }
6853
6854 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6856 self.0.request.return_partial_success = v.into();
6857 self
6858 }
6859 }
6860
6861 #[doc(hidden)]
6862 impl gax::options::internal::RequestBuilder for ListOperations {
6863 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6864 &mut self.0.options
6865 }
6866 }
6867
6868 #[derive(Clone, Debug)]
6885 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
6886
6887 impl GetOperation {
6888 pub(crate) fn new(
6889 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6890 ) -> Self {
6891 Self(RequestBuilder::new(stub))
6892 }
6893
6894 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
6896 mut self,
6897 v: V,
6898 ) -> Self {
6899 self.0.request = v.into();
6900 self
6901 }
6902
6903 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6905 self.0.options = v.into();
6906 self
6907 }
6908
6909 pub async fn send(self) -> Result<longrunning::model::Operation> {
6911 (*self.0.stub)
6912 .get_operation(self.0.request, self.0.options)
6913 .await
6914 .map(gax::response::Response::into_body)
6915 }
6916
6917 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6919 self.0.request.name = v.into();
6920 self
6921 }
6922 }
6923
6924 #[doc(hidden)]
6925 impl gax::options::internal::RequestBuilder for GetOperation {
6926 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6927 &mut self.0.options
6928 }
6929 }
6930
6931 #[derive(Clone, Debug)]
6948 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
6949
6950 impl CancelOperation {
6951 pub(crate) fn new(
6952 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6953 ) -> Self {
6954 Self(RequestBuilder::new(stub))
6955 }
6956
6957 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
6959 mut self,
6960 v: V,
6961 ) -> Self {
6962 self.0.request = v.into();
6963 self
6964 }
6965
6966 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
6968 self.0.options = v.into();
6969 self
6970 }
6971
6972 pub async fn send(self) -> Result<()> {
6974 (*self.0.stub)
6975 .cancel_operation(self.0.request, self.0.options)
6976 .await
6977 .map(gax::response::Response::into_body)
6978 }
6979
6980 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6982 self.0.request.name = v.into();
6983 self
6984 }
6985 }
6986
6987 #[doc(hidden)]
6988 impl gax::options::internal::RequestBuilder for CancelOperation {
6989 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
6990 &mut self.0.options
6991 }
6992 }
6993}
6994
6995#[cfg(feature = "conversation-profiles")]
6996#[cfg_attr(docsrs, doc(cfg(feature = "conversation-profiles")))]
6997pub mod conversation_profiles {
6998 use crate::Result;
6999
7000 pub type ClientBuilder =
7014 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7015
7016 pub(crate) mod client {
7017 use super::super::super::client::ConversationProfiles;
7018 pub struct Factory;
7019 impl gax::client_builder::internal::ClientFactory for Factory {
7020 type Client = ConversationProfiles;
7021 type Credentials = gaxi::options::Credentials;
7022 async fn build(
7023 self,
7024 config: gaxi::options::ClientConfig,
7025 ) -> gax::client_builder::Result<Self::Client> {
7026 Self::Client::new(config).await
7027 }
7028 }
7029 }
7030
7031 #[derive(Clone, Debug)]
7033 pub(crate) struct RequestBuilder<R: std::default::Default> {
7034 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7035 request: R,
7036 options: gax::options::RequestOptions,
7037 }
7038
7039 impl<R> RequestBuilder<R>
7040 where
7041 R: std::default::Default,
7042 {
7043 pub(crate) fn new(
7044 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7045 ) -> Self {
7046 Self {
7047 stub,
7048 request: R::default(),
7049 options: gax::options::RequestOptions::default(),
7050 }
7051 }
7052 }
7053
7054 #[derive(Clone, Debug)]
7075 pub struct ListConversationProfiles(
7076 RequestBuilder<crate::model::ListConversationProfilesRequest>,
7077 );
7078
7079 impl ListConversationProfiles {
7080 pub(crate) fn new(
7081 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7082 ) -> Self {
7083 Self(RequestBuilder::new(stub))
7084 }
7085
7086 pub fn with_request<V: Into<crate::model::ListConversationProfilesRequest>>(
7088 mut self,
7089 v: V,
7090 ) -> Self {
7091 self.0.request = v.into();
7092 self
7093 }
7094
7095 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7097 self.0.options = v.into();
7098 self
7099 }
7100
7101 pub async fn send(self) -> Result<crate::model::ListConversationProfilesResponse> {
7103 (*self.0.stub)
7104 .list_conversation_profiles(self.0.request, self.0.options)
7105 .await
7106 .map(gax::response::Response::into_body)
7107 }
7108
7109 pub fn by_page(
7111 self,
7112 ) -> impl gax::paginator::Paginator<
7113 crate::model::ListConversationProfilesResponse,
7114 gax::error::Error,
7115 > {
7116 use std::clone::Clone;
7117 let token = self.0.request.page_token.clone();
7118 let execute = move |token: String| {
7119 let mut builder = self.clone();
7120 builder.0.request = builder.0.request.set_page_token(token);
7121 builder.send()
7122 };
7123 gax::paginator::internal::new_paginator(token, execute)
7124 }
7125
7126 pub fn by_item(
7128 self,
7129 ) -> impl gax::paginator::ItemPaginator<
7130 crate::model::ListConversationProfilesResponse,
7131 gax::error::Error,
7132 > {
7133 use gax::paginator::Paginator;
7134 self.by_page().items()
7135 }
7136
7137 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7141 self.0.request.parent = v.into();
7142 self
7143 }
7144
7145 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7147 self.0.request.page_size = v.into();
7148 self
7149 }
7150
7151 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7153 self.0.request.page_token = v.into();
7154 self
7155 }
7156 }
7157
7158 #[doc(hidden)]
7159 impl gax::options::internal::RequestBuilder for ListConversationProfiles {
7160 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7161 &mut self.0.options
7162 }
7163 }
7164
7165 #[derive(Clone, Debug)]
7182 pub struct GetConversationProfile(RequestBuilder<crate::model::GetConversationProfileRequest>);
7183
7184 impl GetConversationProfile {
7185 pub(crate) fn new(
7186 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7187 ) -> Self {
7188 Self(RequestBuilder::new(stub))
7189 }
7190
7191 pub fn with_request<V: Into<crate::model::GetConversationProfileRequest>>(
7193 mut self,
7194 v: V,
7195 ) -> Self {
7196 self.0.request = v.into();
7197 self
7198 }
7199
7200 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7202 self.0.options = v.into();
7203 self
7204 }
7205
7206 pub async fn send(self) -> Result<crate::model::ConversationProfile> {
7208 (*self.0.stub)
7209 .get_conversation_profile(self.0.request, self.0.options)
7210 .await
7211 .map(gax::response::Response::into_body)
7212 }
7213
7214 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7218 self.0.request.name = v.into();
7219 self
7220 }
7221 }
7222
7223 #[doc(hidden)]
7224 impl gax::options::internal::RequestBuilder for GetConversationProfile {
7225 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7226 &mut self.0.options
7227 }
7228 }
7229
7230 #[derive(Clone, Debug)]
7247 pub struct CreateConversationProfile(
7248 RequestBuilder<crate::model::CreateConversationProfileRequest>,
7249 );
7250
7251 impl CreateConversationProfile {
7252 pub(crate) fn new(
7253 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7254 ) -> Self {
7255 Self(RequestBuilder::new(stub))
7256 }
7257
7258 pub fn with_request<V: Into<crate::model::CreateConversationProfileRequest>>(
7260 mut self,
7261 v: V,
7262 ) -> Self {
7263 self.0.request = v.into();
7264 self
7265 }
7266
7267 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7269 self.0.options = v.into();
7270 self
7271 }
7272
7273 pub async fn send(self) -> Result<crate::model::ConversationProfile> {
7275 (*self.0.stub)
7276 .create_conversation_profile(self.0.request, self.0.options)
7277 .await
7278 .map(gax::response::Response::into_body)
7279 }
7280
7281 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7285 self.0.request.parent = v.into();
7286 self
7287 }
7288
7289 pub fn set_conversation_profile<T>(mut self, v: T) -> Self
7293 where
7294 T: std::convert::Into<crate::model::ConversationProfile>,
7295 {
7296 self.0.request.conversation_profile = std::option::Option::Some(v.into());
7297 self
7298 }
7299
7300 pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
7304 where
7305 T: std::convert::Into<crate::model::ConversationProfile>,
7306 {
7307 self.0.request.conversation_profile = v.map(|x| x.into());
7308 self
7309 }
7310 }
7311
7312 #[doc(hidden)]
7313 impl gax::options::internal::RequestBuilder for CreateConversationProfile {
7314 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7315 &mut self.0.options
7316 }
7317 }
7318
7319 #[derive(Clone, Debug)]
7336 pub struct UpdateConversationProfile(
7337 RequestBuilder<crate::model::UpdateConversationProfileRequest>,
7338 );
7339
7340 impl UpdateConversationProfile {
7341 pub(crate) fn new(
7342 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7343 ) -> Self {
7344 Self(RequestBuilder::new(stub))
7345 }
7346
7347 pub fn with_request<V: Into<crate::model::UpdateConversationProfileRequest>>(
7349 mut self,
7350 v: V,
7351 ) -> Self {
7352 self.0.request = v.into();
7353 self
7354 }
7355
7356 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7358 self.0.options = v.into();
7359 self
7360 }
7361
7362 pub async fn send(self) -> Result<crate::model::ConversationProfile> {
7364 (*self.0.stub)
7365 .update_conversation_profile(self.0.request, self.0.options)
7366 .await
7367 .map(gax::response::Response::into_body)
7368 }
7369
7370 pub fn set_conversation_profile<T>(mut self, v: T) -> Self
7374 where
7375 T: std::convert::Into<crate::model::ConversationProfile>,
7376 {
7377 self.0.request.conversation_profile = std::option::Option::Some(v.into());
7378 self
7379 }
7380
7381 pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
7385 where
7386 T: std::convert::Into<crate::model::ConversationProfile>,
7387 {
7388 self.0.request.conversation_profile = v.map(|x| x.into());
7389 self
7390 }
7391
7392 pub fn set_update_mask<T>(mut self, v: T) -> Self
7396 where
7397 T: std::convert::Into<wkt::FieldMask>,
7398 {
7399 self.0.request.update_mask = std::option::Option::Some(v.into());
7400 self
7401 }
7402
7403 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7407 where
7408 T: std::convert::Into<wkt::FieldMask>,
7409 {
7410 self.0.request.update_mask = v.map(|x| x.into());
7411 self
7412 }
7413 }
7414
7415 #[doc(hidden)]
7416 impl gax::options::internal::RequestBuilder for UpdateConversationProfile {
7417 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7418 &mut self.0.options
7419 }
7420 }
7421
7422 #[derive(Clone, Debug)]
7439 pub struct DeleteConversationProfile(
7440 RequestBuilder<crate::model::DeleteConversationProfileRequest>,
7441 );
7442
7443 impl DeleteConversationProfile {
7444 pub(crate) fn new(
7445 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7446 ) -> Self {
7447 Self(RequestBuilder::new(stub))
7448 }
7449
7450 pub fn with_request<V: Into<crate::model::DeleteConversationProfileRequest>>(
7452 mut self,
7453 v: V,
7454 ) -> Self {
7455 self.0.request = v.into();
7456 self
7457 }
7458
7459 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7461 self.0.options = v.into();
7462 self
7463 }
7464
7465 pub async fn send(self) -> Result<()> {
7467 (*self.0.stub)
7468 .delete_conversation_profile(self.0.request, self.0.options)
7469 .await
7470 .map(gax::response::Response::into_body)
7471 }
7472
7473 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7477 self.0.request.name = v.into();
7478 self
7479 }
7480 }
7481
7482 #[doc(hidden)]
7483 impl gax::options::internal::RequestBuilder for DeleteConversationProfile {
7484 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7485 &mut self.0.options
7486 }
7487 }
7488
7489 #[derive(Clone, Debug)]
7507 pub struct SetSuggestionFeatureConfig(
7508 RequestBuilder<crate::model::SetSuggestionFeatureConfigRequest>,
7509 );
7510
7511 impl SetSuggestionFeatureConfig {
7512 pub(crate) fn new(
7513 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7514 ) -> Self {
7515 Self(RequestBuilder::new(stub))
7516 }
7517
7518 pub fn with_request<V: Into<crate::model::SetSuggestionFeatureConfigRequest>>(
7520 mut self,
7521 v: V,
7522 ) -> Self {
7523 self.0.request = v.into();
7524 self
7525 }
7526
7527 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7529 self.0.options = v.into();
7530 self
7531 }
7532
7533 pub async fn send(self) -> Result<longrunning::model::Operation> {
7540 (*self.0.stub)
7541 .set_suggestion_feature_config(self.0.request, self.0.options)
7542 .await
7543 .map(gax::response::Response::into_body)
7544 }
7545
7546 pub fn poller(
7548 self,
7549 ) -> impl lro::Poller<
7550 crate::model::ConversationProfile,
7551 crate::model::SetSuggestionFeatureConfigOperationMetadata,
7552 > {
7553 type Operation = lro::internal::Operation<
7554 crate::model::ConversationProfile,
7555 crate::model::SetSuggestionFeatureConfigOperationMetadata,
7556 >;
7557 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7558 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7559
7560 let stub = self.0.stub.clone();
7561 let mut options = self.0.options.clone();
7562 options.set_retry_policy(gax::retry_policy::NeverRetry);
7563 let query = move |name| {
7564 let stub = stub.clone();
7565 let options = options.clone();
7566 async {
7567 let op = GetOperation::new(stub)
7568 .set_name(name)
7569 .with_options(options)
7570 .send()
7571 .await?;
7572 Ok(Operation::new(op))
7573 }
7574 };
7575
7576 let start = move || async {
7577 let op = self.send().await?;
7578 Ok(Operation::new(op))
7579 };
7580
7581 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7582 }
7583
7584 pub fn set_conversation_profile<T: Into<std::string::String>>(mut self, v: T) -> Self {
7588 self.0.request.conversation_profile = v.into();
7589 self
7590 }
7591
7592 pub fn set_participant_role<T: Into<crate::model::participant::Role>>(
7596 mut self,
7597 v: T,
7598 ) -> Self {
7599 self.0.request.participant_role = v.into();
7600 self
7601 }
7602
7603 pub fn set_suggestion_feature_config<T>(mut self, v: T) -> Self
7607 where
7608 T: std::convert::Into<
7609 crate::model::human_agent_assistant_config::SuggestionFeatureConfig,
7610 >,
7611 {
7612 self.0.request.suggestion_feature_config = std::option::Option::Some(v.into());
7613 self
7614 }
7615
7616 pub fn set_or_clear_suggestion_feature_config<T>(
7620 mut self,
7621 v: std::option::Option<T>,
7622 ) -> Self
7623 where
7624 T: std::convert::Into<
7625 crate::model::human_agent_assistant_config::SuggestionFeatureConfig,
7626 >,
7627 {
7628 self.0.request.suggestion_feature_config = v.map(|x| x.into());
7629 self
7630 }
7631 }
7632
7633 #[doc(hidden)]
7634 impl gax::options::internal::RequestBuilder for SetSuggestionFeatureConfig {
7635 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7636 &mut self.0.options
7637 }
7638 }
7639
7640 #[derive(Clone, Debug)]
7658 pub struct ClearSuggestionFeatureConfig(
7659 RequestBuilder<crate::model::ClearSuggestionFeatureConfigRequest>,
7660 );
7661
7662 impl ClearSuggestionFeatureConfig {
7663 pub(crate) fn new(
7664 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7665 ) -> Self {
7666 Self(RequestBuilder::new(stub))
7667 }
7668
7669 pub fn with_request<V: Into<crate::model::ClearSuggestionFeatureConfigRequest>>(
7671 mut self,
7672 v: V,
7673 ) -> Self {
7674 self.0.request = v.into();
7675 self
7676 }
7677
7678 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7680 self.0.options = v.into();
7681 self
7682 }
7683
7684 pub async fn send(self) -> Result<longrunning::model::Operation> {
7691 (*self.0.stub)
7692 .clear_suggestion_feature_config(self.0.request, self.0.options)
7693 .await
7694 .map(gax::response::Response::into_body)
7695 }
7696
7697 pub fn poller(
7699 self,
7700 ) -> impl lro::Poller<
7701 crate::model::ConversationProfile,
7702 crate::model::ClearSuggestionFeatureConfigOperationMetadata,
7703 > {
7704 type Operation = lro::internal::Operation<
7705 crate::model::ConversationProfile,
7706 crate::model::ClearSuggestionFeatureConfigOperationMetadata,
7707 >;
7708 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7709 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7710
7711 let stub = self.0.stub.clone();
7712 let mut options = self.0.options.clone();
7713 options.set_retry_policy(gax::retry_policy::NeverRetry);
7714 let query = move |name| {
7715 let stub = stub.clone();
7716 let options = options.clone();
7717 async {
7718 let op = GetOperation::new(stub)
7719 .set_name(name)
7720 .with_options(options)
7721 .send()
7722 .await?;
7723 Ok(Operation::new(op))
7724 }
7725 };
7726
7727 let start = move || async {
7728 let op = self.send().await?;
7729 Ok(Operation::new(op))
7730 };
7731
7732 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
7733 }
7734
7735 pub fn set_conversation_profile<T: Into<std::string::String>>(mut self, v: T) -> Self {
7739 self.0.request.conversation_profile = v.into();
7740 self
7741 }
7742
7743 pub fn set_participant_role<T: Into<crate::model::participant::Role>>(
7747 mut self,
7748 v: T,
7749 ) -> Self {
7750 self.0.request.participant_role = v.into();
7751 self
7752 }
7753
7754 pub fn set_suggestion_feature_type<T: Into<crate::model::suggestion_feature::Type>>(
7758 mut self,
7759 v: T,
7760 ) -> Self {
7761 self.0.request.suggestion_feature_type = v.into();
7762 self
7763 }
7764 }
7765
7766 #[doc(hidden)]
7767 impl gax::options::internal::RequestBuilder for ClearSuggestionFeatureConfig {
7768 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7769 &mut self.0.options
7770 }
7771 }
7772
7773 #[derive(Clone, Debug)]
7794 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
7795
7796 impl ListLocations {
7797 pub(crate) fn new(
7798 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7799 ) -> Self {
7800 Self(RequestBuilder::new(stub))
7801 }
7802
7803 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
7805 mut self,
7806 v: V,
7807 ) -> Self {
7808 self.0.request = v.into();
7809 self
7810 }
7811
7812 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7814 self.0.options = v.into();
7815 self
7816 }
7817
7818 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
7820 (*self.0.stub)
7821 .list_locations(self.0.request, self.0.options)
7822 .await
7823 .map(gax::response::Response::into_body)
7824 }
7825
7826 pub fn by_page(
7828 self,
7829 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
7830 {
7831 use std::clone::Clone;
7832 let token = self.0.request.page_token.clone();
7833 let execute = move |token: String| {
7834 let mut builder = self.clone();
7835 builder.0.request = builder.0.request.set_page_token(token);
7836 builder.send()
7837 };
7838 gax::paginator::internal::new_paginator(token, execute)
7839 }
7840
7841 pub fn by_item(
7843 self,
7844 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
7845 {
7846 use gax::paginator::Paginator;
7847 self.by_page().items()
7848 }
7849
7850 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7852 self.0.request.name = v.into();
7853 self
7854 }
7855
7856 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7858 self.0.request.filter = v.into();
7859 self
7860 }
7861
7862 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7864 self.0.request.page_size = v.into();
7865 self
7866 }
7867
7868 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7870 self.0.request.page_token = v.into();
7871 self
7872 }
7873 }
7874
7875 #[doc(hidden)]
7876 impl gax::options::internal::RequestBuilder for ListLocations {
7877 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7878 &mut self.0.options
7879 }
7880 }
7881
7882 #[derive(Clone, Debug)]
7899 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
7900
7901 impl GetLocation {
7902 pub(crate) fn new(
7903 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7904 ) -> Self {
7905 Self(RequestBuilder::new(stub))
7906 }
7907
7908 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
7910 self.0.request = v.into();
7911 self
7912 }
7913
7914 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7916 self.0.options = v.into();
7917 self
7918 }
7919
7920 pub async fn send(self) -> Result<location::model::Location> {
7922 (*self.0.stub)
7923 .get_location(self.0.request, self.0.options)
7924 .await
7925 .map(gax::response::Response::into_body)
7926 }
7927
7928 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7930 self.0.request.name = v.into();
7931 self
7932 }
7933 }
7934
7935 #[doc(hidden)]
7936 impl gax::options::internal::RequestBuilder for GetLocation {
7937 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
7938 &mut self.0.options
7939 }
7940 }
7941
7942 #[derive(Clone, Debug)]
7963 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
7964
7965 impl ListOperations {
7966 pub(crate) fn new(
7967 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7968 ) -> Self {
7969 Self(RequestBuilder::new(stub))
7970 }
7971
7972 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
7974 mut self,
7975 v: V,
7976 ) -> Self {
7977 self.0.request = v.into();
7978 self
7979 }
7980
7981 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
7983 self.0.options = v.into();
7984 self
7985 }
7986
7987 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
7989 (*self.0.stub)
7990 .list_operations(self.0.request, self.0.options)
7991 .await
7992 .map(gax::response::Response::into_body)
7993 }
7994
7995 pub fn by_page(
7997 self,
7998 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
7999 {
8000 use std::clone::Clone;
8001 let token = self.0.request.page_token.clone();
8002 let execute = move |token: String| {
8003 let mut builder = self.clone();
8004 builder.0.request = builder.0.request.set_page_token(token);
8005 builder.send()
8006 };
8007 gax::paginator::internal::new_paginator(token, execute)
8008 }
8009
8010 pub fn by_item(
8012 self,
8013 ) -> impl gax::paginator::ItemPaginator<
8014 longrunning::model::ListOperationsResponse,
8015 gax::error::Error,
8016 > {
8017 use gax::paginator::Paginator;
8018 self.by_page().items()
8019 }
8020
8021 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8023 self.0.request.name = v.into();
8024 self
8025 }
8026
8027 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8029 self.0.request.filter = v.into();
8030 self
8031 }
8032
8033 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8035 self.0.request.page_size = v.into();
8036 self
8037 }
8038
8039 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8041 self.0.request.page_token = v.into();
8042 self
8043 }
8044
8045 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8047 self.0.request.return_partial_success = v.into();
8048 self
8049 }
8050 }
8051
8052 #[doc(hidden)]
8053 impl gax::options::internal::RequestBuilder for ListOperations {
8054 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8055 &mut self.0.options
8056 }
8057 }
8058
8059 #[derive(Clone, Debug)]
8076 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
8077
8078 impl GetOperation {
8079 pub(crate) fn new(
8080 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
8081 ) -> Self {
8082 Self(RequestBuilder::new(stub))
8083 }
8084
8085 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
8087 mut self,
8088 v: V,
8089 ) -> Self {
8090 self.0.request = v.into();
8091 self
8092 }
8093
8094 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8096 self.0.options = v.into();
8097 self
8098 }
8099
8100 pub async fn send(self) -> Result<longrunning::model::Operation> {
8102 (*self.0.stub)
8103 .get_operation(self.0.request, self.0.options)
8104 .await
8105 .map(gax::response::Response::into_body)
8106 }
8107
8108 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8110 self.0.request.name = v.into();
8111 self
8112 }
8113 }
8114
8115 #[doc(hidden)]
8116 impl gax::options::internal::RequestBuilder for GetOperation {
8117 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8118 &mut self.0.options
8119 }
8120 }
8121
8122 #[derive(Clone, Debug)]
8139 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
8140
8141 impl CancelOperation {
8142 pub(crate) fn new(
8143 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
8144 ) -> Self {
8145 Self(RequestBuilder::new(stub))
8146 }
8147
8148 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
8150 mut self,
8151 v: V,
8152 ) -> Self {
8153 self.0.request = v.into();
8154 self
8155 }
8156
8157 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8159 self.0.options = v.into();
8160 self
8161 }
8162
8163 pub async fn send(self) -> Result<()> {
8165 (*self.0.stub)
8166 .cancel_operation(self.0.request, self.0.options)
8167 .await
8168 .map(gax::response::Response::into_body)
8169 }
8170
8171 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8173 self.0.request.name = v.into();
8174 self
8175 }
8176 }
8177
8178 #[doc(hidden)]
8179 impl gax::options::internal::RequestBuilder for CancelOperation {
8180 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8181 &mut self.0.options
8182 }
8183 }
8184}
8185
8186#[cfg(feature = "documents")]
8187#[cfg_attr(docsrs, doc(cfg(feature = "documents")))]
8188pub mod documents {
8189 use crate::Result;
8190
8191 pub type ClientBuilder =
8205 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8206
8207 pub(crate) mod client {
8208 use super::super::super::client::Documents;
8209 pub struct Factory;
8210 impl gax::client_builder::internal::ClientFactory for Factory {
8211 type Client = Documents;
8212 type Credentials = gaxi::options::Credentials;
8213 async fn build(
8214 self,
8215 config: gaxi::options::ClientConfig,
8216 ) -> gax::client_builder::Result<Self::Client> {
8217 Self::Client::new(config).await
8218 }
8219 }
8220 }
8221
8222 #[derive(Clone, Debug)]
8224 pub(crate) struct RequestBuilder<R: std::default::Default> {
8225 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8226 request: R,
8227 options: gax::options::RequestOptions,
8228 }
8229
8230 impl<R> RequestBuilder<R>
8231 where
8232 R: std::default::Default,
8233 {
8234 pub(crate) fn new(
8235 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8236 ) -> Self {
8237 Self {
8238 stub,
8239 request: R::default(),
8240 options: gax::options::RequestOptions::default(),
8241 }
8242 }
8243 }
8244
8245 #[derive(Clone, Debug)]
8266 pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
8267
8268 impl ListDocuments {
8269 pub(crate) fn new(
8270 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8271 ) -> Self {
8272 Self(RequestBuilder::new(stub))
8273 }
8274
8275 pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
8277 self.0.request = v.into();
8278 self
8279 }
8280
8281 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8283 self.0.options = v.into();
8284 self
8285 }
8286
8287 pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
8289 (*self.0.stub)
8290 .list_documents(self.0.request, self.0.options)
8291 .await
8292 .map(gax::response::Response::into_body)
8293 }
8294
8295 pub fn by_page(
8297 self,
8298 ) -> impl gax::paginator::Paginator<crate::model::ListDocumentsResponse, gax::error::Error>
8299 {
8300 use std::clone::Clone;
8301 let token = self.0.request.page_token.clone();
8302 let execute = move |token: String| {
8303 let mut builder = self.clone();
8304 builder.0.request = builder.0.request.set_page_token(token);
8305 builder.send()
8306 };
8307 gax::paginator::internal::new_paginator(token, execute)
8308 }
8309
8310 pub fn by_item(
8312 self,
8313 ) -> impl gax::paginator::ItemPaginator<crate::model::ListDocumentsResponse, gax::error::Error>
8314 {
8315 use gax::paginator::Paginator;
8316 self.by_page().items()
8317 }
8318
8319 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8323 self.0.request.parent = v.into();
8324 self
8325 }
8326
8327 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8329 self.0.request.page_size = v.into();
8330 self
8331 }
8332
8333 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8335 self.0.request.page_token = v.into();
8336 self
8337 }
8338
8339 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8341 self.0.request.filter = v.into();
8342 self
8343 }
8344 }
8345
8346 #[doc(hidden)]
8347 impl gax::options::internal::RequestBuilder for ListDocuments {
8348 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8349 &mut self.0.options
8350 }
8351 }
8352
8353 #[derive(Clone, Debug)]
8370 pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
8371
8372 impl GetDocument {
8373 pub(crate) fn new(
8374 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8375 ) -> Self {
8376 Self(RequestBuilder::new(stub))
8377 }
8378
8379 pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
8381 self.0.request = v.into();
8382 self
8383 }
8384
8385 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8387 self.0.options = v.into();
8388 self
8389 }
8390
8391 pub async fn send(self) -> Result<crate::model::Document> {
8393 (*self.0.stub)
8394 .get_document(self.0.request, self.0.options)
8395 .await
8396 .map(gax::response::Response::into_body)
8397 }
8398
8399 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8403 self.0.request.name = v.into();
8404 self
8405 }
8406 }
8407
8408 #[doc(hidden)]
8409 impl gax::options::internal::RequestBuilder for GetDocument {
8410 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8411 &mut self.0.options
8412 }
8413 }
8414
8415 #[derive(Clone, Debug)]
8433 pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
8434
8435 impl CreateDocument {
8436 pub(crate) fn new(
8437 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8438 ) -> Self {
8439 Self(RequestBuilder::new(stub))
8440 }
8441
8442 pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
8444 self.0.request = v.into();
8445 self
8446 }
8447
8448 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8450 self.0.options = v.into();
8451 self
8452 }
8453
8454 pub async fn send(self) -> Result<longrunning::model::Operation> {
8461 (*self.0.stub)
8462 .create_document(self.0.request, self.0.options)
8463 .await
8464 .map(gax::response::Response::into_body)
8465 }
8466
8467 pub fn poller(
8469 self,
8470 ) -> impl lro::Poller<crate::model::Document, crate::model::KnowledgeOperationMetadata>
8471 {
8472 type Operation = lro::internal::Operation<
8473 crate::model::Document,
8474 crate::model::KnowledgeOperationMetadata,
8475 >;
8476 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8477 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8478
8479 let stub = self.0.stub.clone();
8480 let mut options = self.0.options.clone();
8481 options.set_retry_policy(gax::retry_policy::NeverRetry);
8482 let query = move |name| {
8483 let stub = stub.clone();
8484 let options = options.clone();
8485 async {
8486 let op = GetOperation::new(stub)
8487 .set_name(name)
8488 .with_options(options)
8489 .send()
8490 .await?;
8491 Ok(Operation::new(op))
8492 }
8493 };
8494
8495 let start = move || async {
8496 let op = self.send().await?;
8497 Ok(Operation::new(op))
8498 };
8499
8500 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8501 }
8502
8503 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8507 self.0.request.parent = v.into();
8508 self
8509 }
8510
8511 pub fn set_document<T>(mut self, v: T) -> Self
8515 where
8516 T: std::convert::Into<crate::model::Document>,
8517 {
8518 self.0.request.document = std::option::Option::Some(v.into());
8519 self
8520 }
8521
8522 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
8526 where
8527 T: std::convert::Into<crate::model::Document>,
8528 {
8529 self.0.request.document = v.map(|x| x.into());
8530 self
8531 }
8532 }
8533
8534 #[doc(hidden)]
8535 impl gax::options::internal::RequestBuilder for CreateDocument {
8536 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8537 &mut self.0.options
8538 }
8539 }
8540
8541 #[derive(Clone, Debug)]
8559 pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
8560
8561 impl ImportDocuments {
8562 pub(crate) fn new(
8563 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8564 ) -> Self {
8565 Self(RequestBuilder::new(stub))
8566 }
8567
8568 pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
8570 self.0.request = v.into();
8571 self
8572 }
8573
8574 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8576 self.0.options = v.into();
8577 self
8578 }
8579
8580 pub async fn send(self) -> Result<longrunning::model::Operation> {
8587 (*self.0.stub)
8588 .import_documents(self.0.request, self.0.options)
8589 .await
8590 .map(gax::response::Response::into_body)
8591 }
8592
8593 pub fn poller(
8595 self,
8596 ) -> impl lro::Poller<
8597 crate::model::ImportDocumentsResponse,
8598 crate::model::KnowledgeOperationMetadata,
8599 > {
8600 type Operation = lro::internal::Operation<
8601 crate::model::ImportDocumentsResponse,
8602 crate::model::KnowledgeOperationMetadata,
8603 >;
8604 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8605 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8606
8607 let stub = self.0.stub.clone();
8608 let mut options = self.0.options.clone();
8609 options.set_retry_policy(gax::retry_policy::NeverRetry);
8610 let query = move |name| {
8611 let stub = stub.clone();
8612 let options = options.clone();
8613 async {
8614 let op = GetOperation::new(stub)
8615 .set_name(name)
8616 .with_options(options)
8617 .send()
8618 .await?;
8619 Ok(Operation::new(op))
8620 }
8621 };
8622
8623 let start = move || async {
8624 let op = self.send().await?;
8625 Ok(Operation::new(op))
8626 };
8627
8628 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8629 }
8630
8631 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8635 self.0.request.parent = v.into();
8636 self
8637 }
8638
8639 pub fn set_document_template<T>(mut self, v: T) -> Self
8643 where
8644 T: std::convert::Into<crate::model::ImportDocumentTemplate>,
8645 {
8646 self.0.request.document_template = std::option::Option::Some(v.into());
8647 self
8648 }
8649
8650 pub fn set_or_clear_document_template<T>(mut self, v: std::option::Option<T>) -> Self
8654 where
8655 T: std::convert::Into<crate::model::ImportDocumentTemplate>,
8656 {
8657 self.0.request.document_template = v.map(|x| x.into());
8658 self
8659 }
8660
8661 pub fn set_import_gcs_custom_metadata<T: Into<bool>>(mut self, v: T) -> Self {
8663 self.0.request.import_gcs_custom_metadata = v.into();
8664 self
8665 }
8666
8667 pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
8672 mut self,
8673 v: T,
8674 ) -> Self {
8675 self.0.request.source = v.into();
8676 self
8677 }
8678
8679 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSources>>>(
8685 mut self,
8686 v: T,
8687 ) -> Self {
8688 self.0.request = self.0.request.set_gcs_source(v);
8689 self
8690 }
8691 }
8692
8693 #[doc(hidden)]
8694 impl gax::options::internal::RequestBuilder for ImportDocuments {
8695 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8696 &mut self.0.options
8697 }
8698 }
8699
8700 #[derive(Clone, Debug)]
8718 pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
8719
8720 impl DeleteDocument {
8721 pub(crate) fn new(
8722 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8723 ) -> Self {
8724 Self(RequestBuilder::new(stub))
8725 }
8726
8727 pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
8729 self.0.request = v.into();
8730 self
8731 }
8732
8733 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8735 self.0.options = v.into();
8736 self
8737 }
8738
8739 pub async fn send(self) -> Result<longrunning::model::Operation> {
8746 (*self.0.stub)
8747 .delete_document(self.0.request, self.0.options)
8748 .await
8749 .map(gax::response::Response::into_body)
8750 }
8751
8752 pub fn poller(self) -> impl lro::Poller<(), crate::model::KnowledgeOperationMetadata> {
8754 type Operation =
8755 lro::internal::Operation<wkt::Empty, crate::model::KnowledgeOperationMetadata>;
8756 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8757 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8758
8759 let stub = self.0.stub.clone();
8760 let mut options = self.0.options.clone();
8761 options.set_retry_policy(gax::retry_policy::NeverRetry);
8762 let query = move |name| {
8763 let stub = stub.clone();
8764 let options = options.clone();
8765 async {
8766 let op = GetOperation::new(stub)
8767 .set_name(name)
8768 .with_options(options)
8769 .send()
8770 .await?;
8771 Ok(Operation::new(op))
8772 }
8773 };
8774
8775 let start = move || async {
8776 let op = self.send().await?;
8777 Ok(Operation::new(op))
8778 };
8779
8780 lro::internal::new_unit_response_poller(
8781 polling_error_policy,
8782 polling_backoff_policy,
8783 start,
8784 query,
8785 )
8786 }
8787
8788 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8792 self.0.request.name = v.into();
8793 self
8794 }
8795 }
8796
8797 #[doc(hidden)]
8798 impl gax::options::internal::RequestBuilder for DeleteDocument {
8799 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8800 &mut self.0.options
8801 }
8802 }
8803
8804 #[derive(Clone, Debug)]
8822 pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
8823
8824 impl UpdateDocument {
8825 pub(crate) fn new(
8826 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8827 ) -> Self {
8828 Self(RequestBuilder::new(stub))
8829 }
8830
8831 pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
8833 self.0.request = v.into();
8834 self
8835 }
8836
8837 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8839 self.0.options = v.into();
8840 self
8841 }
8842
8843 pub async fn send(self) -> Result<longrunning::model::Operation> {
8850 (*self.0.stub)
8851 .update_document(self.0.request, self.0.options)
8852 .await
8853 .map(gax::response::Response::into_body)
8854 }
8855
8856 pub fn poller(
8858 self,
8859 ) -> impl lro::Poller<crate::model::Document, crate::model::KnowledgeOperationMetadata>
8860 {
8861 type Operation = lro::internal::Operation<
8862 crate::model::Document,
8863 crate::model::KnowledgeOperationMetadata,
8864 >;
8865 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8866 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8867
8868 let stub = self.0.stub.clone();
8869 let mut options = self.0.options.clone();
8870 options.set_retry_policy(gax::retry_policy::NeverRetry);
8871 let query = move |name| {
8872 let stub = stub.clone();
8873 let options = options.clone();
8874 async {
8875 let op = GetOperation::new(stub)
8876 .set_name(name)
8877 .with_options(options)
8878 .send()
8879 .await?;
8880 Ok(Operation::new(op))
8881 }
8882 };
8883
8884 let start = move || async {
8885 let op = self.send().await?;
8886 Ok(Operation::new(op))
8887 };
8888
8889 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
8890 }
8891
8892 pub fn set_document<T>(mut self, v: T) -> Self
8896 where
8897 T: std::convert::Into<crate::model::Document>,
8898 {
8899 self.0.request.document = std::option::Option::Some(v.into());
8900 self
8901 }
8902
8903 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
8907 where
8908 T: std::convert::Into<crate::model::Document>,
8909 {
8910 self.0.request.document = v.map(|x| x.into());
8911 self
8912 }
8913
8914 pub fn set_update_mask<T>(mut self, v: T) -> Self
8916 where
8917 T: std::convert::Into<wkt::FieldMask>,
8918 {
8919 self.0.request.update_mask = std::option::Option::Some(v.into());
8920 self
8921 }
8922
8923 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
8925 where
8926 T: std::convert::Into<wkt::FieldMask>,
8927 {
8928 self.0.request.update_mask = v.map(|x| x.into());
8929 self
8930 }
8931 }
8932
8933 #[doc(hidden)]
8934 impl gax::options::internal::RequestBuilder for UpdateDocument {
8935 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
8936 &mut self.0.options
8937 }
8938 }
8939
8940 #[derive(Clone, Debug)]
8958 pub struct ReloadDocument(RequestBuilder<crate::model::ReloadDocumentRequest>);
8959
8960 impl ReloadDocument {
8961 pub(crate) fn new(
8962 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8963 ) -> Self {
8964 Self(RequestBuilder::new(stub))
8965 }
8966
8967 pub fn with_request<V: Into<crate::model::ReloadDocumentRequest>>(mut self, v: V) -> Self {
8969 self.0.request = v.into();
8970 self
8971 }
8972
8973 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
8975 self.0.options = v.into();
8976 self
8977 }
8978
8979 pub async fn send(self) -> Result<longrunning::model::Operation> {
8986 (*self.0.stub)
8987 .reload_document(self.0.request, self.0.options)
8988 .await
8989 .map(gax::response::Response::into_body)
8990 }
8991
8992 pub fn poller(
8994 self,
8995 ) -> impl lro::Poller<crate::model::Document, crate::model::KnowledgeOperationMetadata>
8996 {
8997 type Operation = lro::internal::Operation<
8998 crate::model::Document,
8999 crate::model::KnowledgeOperationMetadata,
9000 >;
9001 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9002 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9003
9004 let stub = self.0.stub.clone();
9005 let mut options = self.0.options.clone();
9006 options.set_retry_policy(gax::retry_policy::NeverRetry);
9007 let query = move |name| {
9008 let stub = stub.clone();
9009 let options = options.clone();
9010 async {
9011 let op = GetOperation::new(stub)
9012 .set_name(name)
9013 .with_options(options)
9014 .send()
9015 .await?;
9016 Ok(Operation::new(op))
9017 }
9018 };
9019
9020 let start = move || async {
9021 let op = self.send().await?;
9022 Ok(Operation::new(op))
9023 };
9024
9025 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
9026 }
9027
9028 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9032 self.0.request.name = v.into();
9033 self
9034 }
9035
9036 pub fn set_import_gcs_custom_metadata<T: Into<bool>>(mut self, v: T) -> Self {
9038 self.0.request.import_gcs_custom_metadata = v.into();
9039 self
9040 }
9041
9042 pub fn set_smart_messaging_partial_update<T: Into<bool>>(mut self, v: T) -> Self {
9044 self.0.request.smart_messaging_partial_update = v.into();
9045 self
9046 }
9047
9048 pub fn set_source<T: Into<Option<crate::model::reload_document_request::Source>>>(
9053 mut self,
9054 v: T,
9055 ) -> Self {
9056 self.0.request.source = v.into();
9057 self
9058 }
9059
9060 pub fn set_content_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9066 self.0.request = self.0.request.set_content_uri(v);
9067 self
9068 }
9069 }
9070
9071 #[doc(hidden)]
9072 impl gax::options::internal::RequestBuilder for ReloadDocument {
9073 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9074 &mut self.0.options
9075 }
9076 }
9077
9078 #[derive(Clone, Debug)]
9096 pub struct ExportDocument(RequestBuilder<crate::model::ExportDocumentRequest>);
9097
9098 impl ExportDocument {
9099 pub(crate) fn new(
9100 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9101 ) -> Self {
9102 Self(RequestBuilder::new(stub))
9103 }
9104
9105 pub fn with_request<V: Into<crate::model::ExportDocumentRequest>>(mut self, v: V) -> Self {
9107 self.0.request = v.into();
9108 self
9109 }
9110
9111 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9113 self.0.options = v.into();
9114 self
9115 }
9116
9117 pub async fn send(self) -> Result<longrunning::model::Operation> {
9124 (*self.0.stub)
9125 .export_document(self.0.request, self.0.options)
9126 .await
9127 .map(gax::response::Response::into_body)
9128 }
9129
9130 pub fn poller(
9132 self,
9133 ) -> impl lro::Poller<crate::model::Document, crate::model::KnowledgeOperationMetadata>
9134 {
9135 type Operation = lro::internal::Operation<
9136 crate::model::Document,
9137 crate::model::KnowledgeOperationMetadata,
9138 >;
9139 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9140 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9141
9142 let stub = self.0.stub.clone();
9143 let mut options = self.0.options.clone();
9144 options.set_retry_policy(gax::retry_policy::NeverRetry);
9145 let query = move |name| {
9146 let stub = stub.clone();
9147 let options = options.clone();
9148 async {
9149 let op = GetOperation::new(stub)
9150 .set_name(name)
9151 .with_options(options)
9152 .send()
9153 .await?;
9154 Ok(Operation::new(op))
9155 }
9156 };
9157
9158 let start = move || async {
9159 let op = self.send().await?;
9160 Ok(Operation::new(op))
9161 };
9162
9163 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
9164 }
9165
9166 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9170 self.0.request.name = v.into();
9171 self
9172 }
9173
9174 pub fn set_export_full_content<T: Into<bool>>(mut self, v: T) -> Self {
9176 self.0.request.export_full_content = v.into();
9177 self
9178 }
9179
9180 pub fn set_smart_messaging_partial_update<T: Into<bool>>(mut self, v: T) -> Self {
9182 self.0.request.smart_messaging_partial_update = v.into();
9183 self
9184 }
9185
9186 pub fn set_destination<
9191 T: Into<Option<crate::model::export_document_request::Destination>>,
9192 >(
9193 mut self,
9194 v: T,
9195 ) -> Self {
9196 self.0.request.destination = v.into();
9197 self
9198 }
9199
9200 pub fn set_gcs_destination<
9206 T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
9207 >(
9208 mut self,
9209 v: T,
9210 ) -> Self {
9211 self.0.request = self.0.request.set_gcs_destination(v);
9212 self
9213 }
9214 }
9215
9216 #[doc(hidden)]
9217 impl gax::options::internal::RequestBuilder for ExportDocument {
9218 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9219 &mut self.0.options
9220 }
9221 }
9222
9223 #[derive(Clone, Debug)]
9244 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
9245
9246 impl ListLocations {
9247 pub(crate) fn new(
9248 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9249 ) -> Self {
9250 Self(RequestBuilder::new(stub))
9251 }
9252
9253 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
9255 mut self,
9256 v: V,
9257 ) -> Self {
9258 self.0.request = v.into();
9259 self
9260 }
9261
9262 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9264 self.0.options = v.into();
9265 self
9266 }
9267
9268 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
9270 (*self.0.stub)
9271 .list_locations(self.0.request, self.0.options)
9272 .await
9273 .map(gax::response::Response::into_body)
9274 }
9275
9276 pub fn by_page(
9278 self,
9279 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
9280 {
9281 use std::clone::Clone;
9282 let token = self.0.request.page_token.clone();
9283 let execute = move |token: String| {
9284 let mut builder = self.clone();
9285 builder.0.request = builder.0.request.set_page_token(token);
9286 builder.send()
9287 };
9288 gax::paginator::internal::new_paginator(token, execute)
9289 }
9290
9291 pub fn by_item(
9293 self,
9294 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
9295 {
9296 use gax::paginator::Paginator;
9297 self.by_page().items()
9298 }
9299
9300 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9302 self.0.request.name = v.into();
9303 self
9304 }
9305
9306 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9308 self.0.request.filter = v.into();
9309 self
9310 }
9311
9312 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9314 self.0.request.page_size = v.into();
9315 self
9316 }
9317
9318 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9320 self.0.request.page_token = v.into();
9321 self
9322 }
9323 }
9324
9325 #[doc(hidden)]
9326 impl gax::options::internal::RequestBuilder for ListLocations {
9327 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9328 &mut self.0.options
9329 }
9330 }
9331
9332 #[derive(Clone, Debug)]
9349 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
9350
9351 impl GetLocation {
9352 pub(crate) fn new(
9353 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9354 ) -> Self {
9355 Self(RequestBuilder::new(stub))
9356 }
9357
9358 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
9360 self.0.request = v.into();
9361 self
9362 }
9363
9364 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9366 self.0.options = v.into();
9367 self
9368 }
9369
9370 pub async fn send(self) -> Result<location::model::Location> {
9372 (*self.0.stub)
9373 .get_location(self.0.request, self.0.options)
9374 .await
9375 .map(gax::response::Response::into_body)
9376 }
9377
9378 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9380 self.0.request.name = v.into();
9381 self
9382 }
9383 }
9384
9385 #[doc(hidden)]
9386 impl gax::options::internal::RequestBuilder for GetLocation {
9387 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9388 &mut self.0.options
9389 }
9390 }
9391
9392 #[derive(Clone, Debug)]
9413 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
9414
9415 impl ListOperations {
9416 pub(crate) fn new(
9417 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9418 ) -> Self {
9419 Self(RequestBuilder::new(stub))
9420 }
9421
9422 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
9424 mut self,
9425 v: V,
9426 ) -> Self {
9427 self.0.request = v.into();
9428 self
9429 }
9430
9431 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9433 self.0.options = v.into();
9434 self
9435 }
9436
9437 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
9439 (*self.0.stub)
9440 .list_operations(self.0.request, self.0.options)
9441 .await
9442 .map(gax::response::Response::into_body)
9443 }
9444
9445 pub fn by_page(
9447 self,
9448 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
9449 {
9450 use std::clone::Clone;
9451 let token = self.0.request.page_token.clone();
9452 let execute = move |token: String| {
9453 let mut builder = self.clone();
9454 builder.0.request = builder.0.request.set_page_token(token);
9455 builder.send()
9456 };
9457 gax::paginator::internal::new_paginator(token, execute)
9458 }
9459
9460 pub fn by_item(
9462 self,
9463 ) -> impl gax::paginator::ItemPaginator<
9464 longrunning::model::ListOperationsResponse,
9465 gax::error::Error,
9466 > {
9467 use gax::paginator::Paginator;
9468 self.by_page().items()
9469 }
9470
9471 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9473 self.0.request.name = v.into();
9474 self
9475 }
9476
9477 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9479 self.0.request.filter = v.into();
9480 self
9481 }
9482
9483 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9485 self.0.request.page_size = v.into();
9486 self
9487 }
9488
9489 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9491 self.0.request.page_token = v.into();
9492 self
9493 }
9494
9495 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9497 self.0.request.return_partial_success = v.into();
9498 self
9499 }
9500 }
9501
9502 #[doc(hidden)]
9503 impl gax::options::internal::RequestBuilder for ListOperations {
9504 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9505 &mut self.0.options
9506 }
9507 }
9508
9509 #[derive(Clone, Debug)]
9526 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
9527
9528 impl GetOperation {
9529 pub(crate) fn new(
9530 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9531 ) -> Self {
9532 Self(RequestBuilder::new(stub))
9533 }
9534
9535 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
9537 mut self,
9538 v: V,
9539 ) -> Self {
9540 self.0.request = v.into();
9541 self
9542 }
9543
9544 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9546 self.0.options = v.into();
9547 self
9548 }
9549
9550 pub async fn send(self) -> Result<longrunning::model::Operation> {
9552 (*self.0.stub)
9553 .get_operation(self.0.request, self.0.options)
9554 .await
9555 .map(gax::response::Response::into_body)
9556 }
9557
9558 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9560 self.0.request.name = v.into();
9561 self
9562 }
9563 }
9564
9565 #[doc(hidden)]
9566 impl gax::options::internal::RequestBuilder for GetOperation {
9567 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9568 &mut self.0.options
9569 }
9570 }
9571
9572 #[derive(Clone, Debug)]
9589 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
9590
9591 impl CancelOperation {
9592 pub(crate) fn new(
9593 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9594 ) -> Self {
9595 Self(RequestBuilder::new(stub))
9596 }
9597
9598 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
9600 mut self,
9601 v: V,
9602 ) -> Self {
9603 self.0.request = v.into();
9604 self
9605 }
9606
9607 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9609 self.0.options = v.into();
9610 self
9611 }
9612
9613 pub async fn send(self) -> Result<()> {
9615 (*self.0.stub)
9616 .cancel_operation(self.0.request, self.0.options)
9617 .await
9618 .map(gax::response::Response::into_body)
9619 }
9620
9621 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9623 self.0.request.name = v.into();
9624 self
9625 }
9626 }
9627
9628 #[doc(hidden)]
9629 impl gax::options::internal::RequestBuilder for CancelOperation {
9630 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9631 &mut self.0.options
9632 }
9633 }
9634}
9635
9636#[cfg(feature = "encryption-spec-service")]
9637#[cfg_attr(docsrs, doc(cfg(feature = "encryption-spec-service")))]
9638pub mod encryption_spec_service {
9639 use crate::Result;
9640
9641 pub type ClientBuilder =
9655 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9656
9657 pub(crate) mod client {
9658 use super::super::super::client::EncryptionSpecService;
9659 pub struct Factory;
9660 impl gax::client_builder::internal::ClientFactory for Factory {
9661 type Client = EncryptionSpecService;
9662 type Credentials = gaxi::options::Credentials;
9663 async fn build(
9664 self,
9665 config: gaxi::options::ClientConfig,
9666 ) -> gax::client_builder::Result<Self::Client> {
9667 Self::Client::new(config).await
9668 }
9669 }
9670 }
9671
9672 #[derive(Clone, Debug)]
9674 pub(crate) struct RequestBuilder<R: std::default::Default> {
9675 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9676 request: R,
9677 options: gax::options::RequestOptions,
9678 }
9679
9680 impl<R> RequestBuilder<R>
9681 where
9682 R: std::default::Default,
9683 {
9684 pub(crate) fn new(
9685 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9686 ) -> Self {
9687 Self {
9688 stub,
9689 request: R::default(),
9690 options: gax::options::RequestOptions::default(),
9691 }
9692 }
9693 }
9694
9695 #[derive(Clone, Debug)]
9712 pub struct GetEncryptionSpec(RequestBuilder<crate::model::GetEncryptionSpecRequest>);
9713
9714 impl GetEncryptionSpec {
9715 pub(crate) fn new(
9716 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9717 ) -> Self {
9718 Self(RequestBuilder::new(stub))
9719 }
9720
9721 pub fn with_request<V: Into<crate::model::GetEncryptionSpecRequest>>(
9723 mut self,
9724 v: V,
9725 ) -> Self {
9726 self.0.request = v.into();
9727 self
9728 }
9729
9730 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9732 self.0.options = v.into();
9733 self
9734 }
9735
9736 pub async fn send(self) -> Result<crate::model::EncryptionSpec> {
9738 (*self.0.stub)
9739 .get_encryption_spec(self.0.request, self.0.options)
9740 .await
9741 .map(gax::response::Response::into_body)
9742 }
9743
9744 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9748 self.0.request.name = v.into();
9749 self
9750 }
9751 }
9752
9753 #[doc(hidden)]
9754 impl gax::options::internal::RequestBuilder for GetEncryptionSpec {
9755 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9756 &mut self.0.options
9757 }
9758 }
9759
9760 #[derive(Clone, Debug)]
9778 pub struct InitializeEncryptionSpec(
9779 RequestBuilder<crate::model::InitializeEncryptionSpecRequest>,
9780 );
9781
9782 impl InitializeEncryptionSpec {
9783 pub(crate) fn new(
9784 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9785 ) -> Self {
9786 Self(RequestBuilder::new(stub))
9787 }
9788
9789 pub fn with_request<V: Into<crate::model::InitializeEncryptionSpecRequest>>(
9791 mut self,
9792 v: V,
9793 ) -> Self {
9794 self.0.request = v.into();
9795 self
9796 }
9797
9798 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9800 self.0.options = v.into();
9801 self
9802 }
9803
9804 pub async fn send(self) -> Result<longrunning::model::Operation> {
9811 (*self.0.stub)
9812 .initialize_encryption_spec(self.0.request, self.0.options)
9813 .await
9814 .map(gax::response::Response::into_body)
9815 }
9816
9817 pub fn poller(
9819 self,
9820 ) -> impl lro::Poller<
9821 crate::model::InitializeEncryptionSpecResponse,
9822 crate::model::InitializeEncryptionSpecMetadata,
9823 > {
9824 type Operation = lro::internal::Operation<
9825 crate::model::InitializeEncryptionSpecResponse,
9826 crate::model::InitializeEncryptionSpecMetadata,
9827 >;
9828 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9829 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9830
9831 let stub = self.0.stub.clone();
9832 let mut options = self.0.options.clone();
9833 options.set_retry_policy(gax::retry_policy::NeverRetry);
9834 let query = move |name| {
9835 let stub = stub.clone();
9836 let options = options.clone();
9837 async {
9838 let op = GetOperation::new(stub)
9839 .set_name(name)
9840 .with_options(options)
9841 .send()
9842 .await?;
9843 Ok(Operation::new(op))
9844 }
9845 };
9846
9847 let start = move || async {
9848 let op = self.send().await?;
9849 Ok(Operation::new(op))
9850 };
9851
9852 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
9853 }
9854
9855 pub fn set_encryption_spec<T>(mut self, v: T) -> Self
9859 where
9860 T: std::convert::Into<crate::model::EncryptionSpec>,
9861 {
9862 self.0.request.encryption_spec = std::option::Option::Some(v.into());
9863 self
9864 }
9865
9866 pub fn set_or_clear_encryption_spec<T>(mut self, v: std::option::Option<T>) -> Self
9870 where
9871 T: std::convert::Into<crate::model::EncryptionSpec>,
9872 {
9873 self.0.request.encryption_spec = v.map(|x| x.into());
9874 self
9875 }
9876 }
9877
9878 #[doc(hidden)]
9879 impl gax::options::internal::RequestBuilder for InitializeEncryptionSpec {
9880 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9881 &mut self.0.options
9882 }
9883 }
9884
9885 #[derive(Clone, Debug)]
9906 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
9907
9908 impl ListLocations {
9909 pub(crate) fn new(
9910 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9911 ) -> Self {
9912 Self(RequestBuilder::new(stub))
9913 }
9914
9915 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
9917 mut self,
9918 v: V,
9919 ) -> Self {
9920 self.0.request = v.into();
9921 self
9922 }
9923
9924 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
9926 self.0.options = v.into();
9927 self
9928 }
9929
9930 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
9932 (*self.0.stub)
9933 .list_locations(self.0.request, self.0.options)
9934 .await
9935 .map(gax::response::Response::into_body)
9936 }
9937
9938 pub fn by_page(
9940 self,
9941 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
9942 {
9943 use std::clone::Clone;
9944 let token = self.0.request.page_token.clone();
9945 let execute = move |token: String| {
9946 let mut builder = self.clone();
9947 builder.0.request = builder.0.request.set_page_token(token);
9948 builder.send()
9949 };
9950 gax::paginator::internal::new_paginator(token, execute)
9951 }
9952
9953 pub fn by_item(
9955 self,
9956 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
9957 {
9958 use gax::paginator::Paginator;
9959 self.by_page().items()
9960 }
9961
9962 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9964 self.0.request.name = v.into();
9965 self
9966 }
9967
9968 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9970 self.0.request.filter = v.into();
9971 self
9972 }
9973
9974 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9976 self.0.request.page_size = v.into();
9977 self
9978 }
9979
9980 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9982 self.0.request.page_token = v.into();
9983 self
9984 }
9985 }
9986
9987 #[doc(hidden)]
9988 impl gax::options::internal::RequestBuilder for ListLocations {
9989 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
9990 &mut self.0.options
9991 }
9992 }
9993
9994 #[derive(Clone, Debug)]
10011 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
10012
10013 impl GetLocation {
10014 pub(crate) fn new(
10015 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10016 ) -> Self {
10017 Self(RequestBuilder::new(stub))
10018 }
10019
10020 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
10022 self.0.request = v.into();
10023 self
10024 }
10025
10026 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10028 self.0.options = v.into();
10029 self
10030 }
10031
10032 pub async fn send(self) -> Result<location::model::Location> {
10034 (*self.0.stub)
10035 .get_location(self.0.request, self.0.options)
10036 .await
10037 .map(gax::response::Response::into_body)
10038 }
10039
10040 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10042 self.0.request.name = v.into();
10043 self
10044 }
10045 }
10046
10047 #[doc(hidden)]
10048 impl gax::options::internal::RequestBuilder for GetLocation {
10049 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10050 &mut self.0.options
10051 }
10052 }
10053
10054 #[derive(Clone, Debug)]
10075 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
10076
10077 impl ListOperations {
10078 pub(crate) fn new(
10079 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10080 ) -> Self {
10081 Self(RequestBuilder::new(stub))
10082 }
10083
10084 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
10086 mut self,
10087 v: V,
10088 ) -> Self {
10089 self.0.request = v.into();
10090 self
10091 }
10092
10093 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10095 self.0.options = v.into();
10096 self
10097 }
10098
10099 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
10101 (*self.0.stub)
10102 .list_operations(self.0.request, self.0.options)
10103 .await
10104 .map(gax::response::Response::into_body)
10105 }
10106
10107 pub fn by_page(
10109 self,
10110 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
10111 {
10112 use std::clone::Clone;
10113 let token = self.0.request.page_token.clone();
10114 let execute = move |token: String| {
10115 let mut builder = self.clone();
10116 builder.0.request = builder.0.request.set_page_token(token);
10117 builder.send()
10118 };
10119 gax::paginator::internal::new_paginator(token, execute)
10120 }
10121
10122 pub fn by_item(
10124 self,
10125 ) -> impl gax::paginator::ItemPaginator<
10126 longrunning::model::ListOperationsResponse,
10127 gax::error::Error,
10128 > {
10129 use gax::paginator::Paginator;
10130 self.by_page().items()
10131 }
10132
10133 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10135 self.0.request.name = v.into();
10136 self
10137 }
10138
10139 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10141 self.0.request.filter = v.into();
10142 self
10143 }
10144
10145 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10147 self.0.request.page_size = v.into();
10148 self
10149 }
10150
10151 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10153 self.0.request.page_token = v.into();
10154 self
10155 }
10156
10157 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10159 self.0.request.return_partial_success = v.into();
10160 self
10161 }
10162 }
10163
10164 #[doc(hidden)]
10165 impl gax::options::internal::RequestBuilder for ListOperations {
10166 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10167 &mut self.0.options
10168 }
10169 }
10170
10171 #[derive(Clone, Debug)]
10188 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
10189
10190 impl GetOperation {
10191 pub(crate) fn new(
10192 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10193 ) -> Self {
10194 Self(RequestBuilder::new(stub))
10195 }
10196
10197 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
10199 mut self,
10200 v: V,
10201 ) -> Self {
10202 self.0.request = v.into();
10203 self
10204 }
10205
10206 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10208 self.0.options = v.into();
10209 self
10210 }
10211
10212 pub async fn send(self) -> Result<longrunning::model::Operation> {
10214 (*self.0.stub)
10215 .get_operation(self.0.request, self.0.options)
10216 .await
10217 .map(gax::response::Response::into_body)
10218 }
10219
10220 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10222 self.0.request.name = v.into();
10223 self
10224 }
10225 }
10226
10227 #[doc(hidden)]
10228 impl gax::options::internal::RequestBuilder for GetOperation {
10229 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10230 &mut self.0.options
10231 }
10232 }
10233
10234 #[derive(Clone, Debug)]
10251 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
10252
10253 impl CancelOperation {
10254 pub(crate) fn new(
10255 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10256 ) -> Self {
10257 Self(RequestBuilder::new(stub))
10258 }
10259
10260 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
10262 mut self,
10263 v: V,
10264 ) -> Self {
10265 self.0.request = v.into();
10266 self
10267 }
10268
10269 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10271 self.0.options = v.into();
10272 self
10273 }
10274
10275 pub async fn send(self) -> Result<()> {
10277 (*self.0.stub)
10278 .cancel_operation(self.0.request, self.0.options)
10279 .await
10280 .map(gax::response::Response::into_body)
10281 }
10282
10283 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10285 self.0.request.name = v.into();
10286 self
10287 }
10288 }
10289
10290 #[doc(hidden)]
10291 impl gax::options::internal::RequestBuilder for CancelOperation {
10292 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10293 &mut self.0.options
10294 }
10295 }
10296}
10297
10298#[cfg(feature = "entity-types")]
10299#[cfg_attr(docsrs, doc(cfg(feature = "entity-types")))]
10300pub mod entity_types {
10301 use crate::Result;
10302
10303 pub type ClientBuilder =
10317 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10318
10319 pub(crate) mod client {
10320 use super::super::super::client::EntityTypes;
10321 pub struct Factory;
10322 impl gax::client_builder::internal::ClientFactory for Factory {
10323 type Client = EntityTypes;
10324 type Credentials = gaxi::options::Credentials;
10325 async fn build(
10326 self,
10327 config: gaxi::options::ClientConfig,
10328 ) -> gax::client_builder::Result<Self::Client> {
10329 Self::Client::new(config).await
10330 }
10331 }
10332 }
10333
10334 #[derive(Clone, Debug)]
10336 pub(crate) struct RequestBuilder<R: std::default::Default> {
10337 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10338 request: R,
10339 options: gax::options::RequestOptions,
10340 }
10341
10342 impl<R> RequestBuilder<R>
10343 where
10344 R: std::default::Default,
10345 {
10346 pub(crate) fn new(
10347 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10348 ) -> Self {
10349 Self {
10350 stub,
10351 request: R::default(),
10352 options: gax::options::RequestOptions::default(),
10353 }
10354 }
10355 }
10356
10357 #[derive(Clone, Debug)]
10378 pub struct ListEntityTypes(RequestBuilder<crate::model::ListEntityTypesRequest>);
10379
10380 impl ListEntityTypes {
10381 pub(crate) fn new(
10382 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10383 ) -> Self {
10384 Self(RequestBuilder::new(stub))
10385 }
10386
10387 pub fn with_request<V: Into<crate::model::ListEntityTypesRequest>>(mut self, v: V) -> Self {
10389 self.0.request = v.into();
10390 self
10391 }
10392
10393 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10395 self.0.options = v.into();
10396 self
10397 }
10398
10399 pub async fn send(self) -> Result<crate::model::ListEntityTypesResponse> {
10401 (*self.0.stub)
10402 .list_entity_types(self.0.request, self.0.options)
10403 .await
10404 .map(gax::response::Response::into_body)
10405 }
10406
10407 pub fn by_page(
10409 self,
10410 ) -> impl gax::paginator::Paginator<crate::model::ListEntityTypesResponse, gax::error::Error>
10411 {
10412 use std::clone::Clone;
10413 let token = self.0.request.page_token.clone();
10414 let execute = move |token: String| {
10415 let mut builder = self.clone();
10416 builder.0.request = builder.0.request.set_page_token(token);
10417 builder.send()
10418 };
10419 gax::paginator::internal::new_paginator(token, execute)
10420 }
10421
10422 pub fn by_item(
10424 self,
10425 ) -> impl gax::paginator::ItemPaginator<crate::model::ListEntityTypesResponse, gax::error::Error>
10426 {
10427 use gax::paginator::Paginator;
10428 self.by_page().items()
10429 }
10430
10431 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10435 self.0.request.parent = v.into();
10436 self
10437 }
10438
10439 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10441 self.0.request.language_code = v.into();
10442 self
10443 }
10444
10445 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10447 self.0.request.page_size = v.into();
10448 self
10449 }
10450
10451 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10453 self.0.request.page_token = v.into();
10454 self
10455 }
10456 }
10457
10458 #[doc(hidden)]
10459 impl gax::options::internal::RequestBuilder for ListEntityTypes {
10460 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10461 &mut self.0.options
10462 }
10463 }
10464
10465 #[derive(Clone, Debug)]
10482 pub struct GetEntityType(RequestBuilder<crate::model::GetEntityTypeRequest>);
10483
10484 impl GetEntityType {
10485 pub(crate) fn new(
10486 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10487 ) -> Self {
10488 Self(RequestBuilder::new(stub))
10489 }
10490
10491 pub fn with_request<V: Into<crate::model::GetEntityTypeRequest>>(mut self, v: V) -> Self {
10493 self.0.request = v.into();
10494 self
10495 }
10496
10497 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10499 self.0.options = v.into();
10500 self
10501 }
10502
10503 pub async fn send(self) -> Result<crate::model::EntityType> {
10505 (*self.0.stub)
10506 .get_entity_type(self.0.request, self.0.options)
10507 .await
10508 .map(gax::response::Response::into_body)
10509 }
10510
10511 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10515 self.0.request.name = v.into();
10516 self
10517 }
10518
10519 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10521 self.0.request.language_code = v.into();
10522 self
10523 }
10524 }
10525
10526 #[doc(hidden)]
10527 impl gax::options::internal::RequestBuilder for GetEntityType {
10528 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10529 &mut self.0.options
10530 }
10531 }
10532
10533 #[derive(Clone, Debug)]
10550 pub struct CreateEntityType(RequestBuilder<crate::model::CreateEntityTypeRequest>);
10551
10552 impl CreateEntityType {
10553 pub(crate) fn new(
10554 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10555 ) -> Self {
10556 Self(RequestBuilder::new(stub))
10557 }
10558
10559 pub fn with_request<V: Into<crate::model::CreateEntityTypeRequest>>(
10561 mut self,
10562 v: V,
10563 ) -> Self {
10564 self.0.request = v.into();
10565 self
10566 }
10567
10568 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10570 self.0.options = v.into();
10571 self
10572 }
10573
10574 pub async fn send(self) -> Result<crate::model::EntityType> {
10576 (*self.0.stub)
10577 .create_entity_type(self.0.request, self.0.options)
10578 .await
10579 .map(gax::response::Response::into_body)
10580 }
10581
10582 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10586 self.0.request.parent = v.into();
10587 self
10588 }
10589
10590 pub fn set_entity_type<T>(mut self, v: T) -> Self
10594 where
10595 T: std::convert::Into<crate::model::EntityType>,
10596 {
10597 self.0.request.entity_type = std::option::Option::Some(v.into());
10598 self
10599 }
10600
10601 pub fn set_or_clear_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
10605 where
10606 T: std::convert::Into<crate::model::EntityType>,
10607 {
10608 self.0.request.entity_type = v.map(|x| x.into());
10609 self
10610 }
10611
10612 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10614 self.0.request.language_code = v.into();
10615 self
10616 }
10617 }
10618
10619 #[doc(hidden)]
10620 impl gax::options::internal::RequestBuilder for CreateEntityType {
10621 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10622 &mut self.0.options
10623 }
10624 }
10625
10626 #[derive(Clone, Debug)]
10643 pub struct UpdateEntityType(RequestBuilder<crate::model::UpdateEntityTypeRequest>);
10644
10645 impl UpdateEntityType {
10646 pub(crate) fn new(
10647 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10648 ) -> Self {
10649 Self(RequestBuilder::new(stub))
10650 }
10651
10652 pub fn with_request<V: Into<crate::model::UpdateEntityTypeRequest>>(
10654 mut self,
10655 v: V,
10656 ) -> Self {
10657 self.0.request = v.into();
10658 self
10659 }
10660
10661 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10663 self.0.options = v.into();
10664 self
10665 }
10666
10667 pub async fn send(self) -> Result<crate::model::EntityType> {
10669 (*self.0.stub)
10670 .update_entity_type(self.0.request, self.0.options)
10671 .await
10672 .map(gax::response::Response::into_body)
10673 }
10674
10675 pub fn set_entity_type<T>(mut self, v: T) -> Self
10679 where
10680 T: std::convert::Into<crate::model::EntityType>,
10681 {
10682 self.0.request.entity_type = std::option::Option::Some(v.into());
10683 self
10684 }
10685
10686 pub fn set_or_clear_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
10690 where
10691 T: std::convert::Into<crate::model::EntityType>,
10692 {
10693 self.0.request.entity_type = v.map(|x| x.into());
10694 self
10695 }
10696
10697 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10699 self.0.request.language_code = v.into();
10700 self
10701 }
10702
10703 pub fn set_update_mask<T>(mut self, v: T) -> Self
10705 where
10706 T: std::convert::Into<wkt::FieldMask>,
10707 {
10708 self.0.request.update_mask = std::option::Option::Some(v.into());
10709 self
10710 }
10711
10712 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10714 where
10715 T: std::convert::Into<wkt::FieldMask>,
10716 {
10717 self.0.request.update_mask = v.map(|x| x.into());
10718 self
10719 }
10720 }
10721
10722 #[doc(hidden)]
10723 impl gax::options::internal::RequestBuilder for UpdateEntityType {
10724 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10725 &mut self.0.options
10726 }
10727 }
10728
10729 #[derive(Clone, Debug)]
10746 pub struct DeleteEntityType(RequestBuilder<crate::model::DeleteEntityTypeRequest>);
10747
10748 impl DeleteEntityType {
10749 pub(crate) fn new(
10750 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10751 ) -> Self {
10752 Self(RequestBuilder::new(stub))
10753 }
10754
10755 pub fn with_request<V: Into<crate::model::DeleteEntityTypeRequest>>(
10757 mut self,
10758 v: V,
10759 ) -> Self {
10760 self.0.request = v.into();
10761 self
10762 }
10763
10764 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10766 self.0.options = v.into();
10767 self
10768 }
10769
10770 pub async fn send(self) -> Result<()> {
10772 (*self.0.stub)
10773 .delete_entity_type(self.0.request, self.0.options)
10774 .await
10775 .map(gax::response::Response::into_body)
10776 }
10777
10778 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10782 self.0.request.name = v.into();
10783 self
10784 }
10785 }
10786
10787 #[doc(hidden)]
10788 impl gax::options::internal::RequestBuilder for DeleteEntityType {
10789 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10790 &mut self.0.options
10791 }
10792 }
10793
10794 #[derive(Clone, Debug)]
10812 pub struct BatchUpdateEntityTypes(RequestBuilder<crate::model::BatchUpdateEntityTypesRequest>);
10813
10814 impl BatchUpdateEntityTypes {
10815 pub(crate) fn new(
10816 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10817 ) -> Self {
10818 Self(RequestBuilder::new(stub))
10819 }
10820
10821 pub fn with_request<V: Into<crate::model::BatchUpdateEntityTypesRequest>>(
10823 mut self,
10824 v: V,
10825 ) -> Self {
10826 self.0.request = v.into();
10827 self
10828 }
10829
10830 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
10832 self.0.options = v.into();
10833 self
10834 }
10835
10836 pub async fn send(self) -> Result<longrunning::model::Operation> {
10843 (*self.0.stub)
10844 .batch_update_entity_types(self.0.request, self.0.options)
10845 .await
10846 .map(gax::response::Response::into_body)
10847 }
10848
10849 pub fn poller(
10851 self,
10852 ) -> impl lro::Poller<crate::model::BatchUpdateEntityTypesResponse, wkt::Struct> {
10853 type Operation =
10854 lro::internal::Operation<crate::model::BatchUpdateEntityTypesResponse, wkt::Struct>;
10855 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10856 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10857
10858 let stub = self.0.stub.clone();
10859 let mut options = self.0.options.clone();
10860 options.set_retry_policy(gax::retry_policy::NeverRetry);
10861 let query = move |name| {
10862 let stub = stub.clone();
10863 let options = options.clone();
10864 async {
10865 let op = GetOperation::new(stub)
10866 .set_name(name)
10867 .with_options(options)
10868 .send()
10869 .await?;
10870 Ok(Operation::new(op))
10871 }
10872 };
10873
10874 let start = move || async {
10875 let op = self.send().await?;
10876 Ok(Operation::new(op))
10877 };
10878
10879 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
10880 }
10881
10882 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10886 self.0.request.parent = v.into();
10887 self
10888 }
10889
10890 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10892 self.0.request.language_code = v.into();
10893 self
10894 }
10895
10896 pub fn set_update_mask<T>(mut self, v: T) -> Self
10898 where
10899 T: std::convert::Into<wkt::FieldMask>,
10900 {
10901 self.0.request.update_mask = std::option::Option::Some(v.into());
10902 self
10903 }
10904
10905 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10907 where
10908 T: std::convert::Into<wkt::FieldMask>,
10909 {
10910 self.0.request.update_mask = v.map(|x| x.into());
10911 self
10912 }
10913
10914 pub fn set_entity_type_batch<
10919 T: Into<Option<crate::model::batch_update_entity_types_request::EntityTypeBatch>>,
10920 >(
10921 mut self,
10922 v: T,
10923 ) -> Self {
10924 self.0.request.entity_type_batch = v.into();
10925 self
10926 }
10927
10928 pub fn set_entity_type_batch_uri<T: std::convert::Into<std::string::String>>(
10934 mut self,
10935 v: T,
10936 ) -> Self {
10937 self.0.request = self.0.request.set_entity_type_batch_uri(v);
10938 self
10939 }
10940
10941 pub fn set_entity_type_batch_inline<
10947 T: std::convert::Into<std::boxed::Box<crate::model::EntityTypeBatch>>,
10948 >(
10949 mut self,
10950 v: T,
10951 ) -> Self {
10952 self.0.request = self.0.request.set_entity_type_batch_inline(v);
10953 self
10954 }
10955 }
10956
10957 #[doc(hidden)]
10958 impl gax::options::internal::RequestBuilder for BatchUpdateEntityTypes {
10959 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
10960 &mut self.0.options
10961 }
10962 }
10963
10964 #[derive(Clone, Debug)]
10982 pub struct BatchDeleteEntityTypes(RequestBuilder<crate::model::BatchDeleteEntityTypesRequest>);
10983
10984 impl BatchDeleteEntityTypes {
10985 pub(crate) fn new(
10986 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10987 ) -> Self {
10988 Self(RequestBuilder::new(stub))
10989 }
10990
10991 pub fn with_request<V: Into<crate::model::BatchDeleteEntityTypesRequest>>(
10993 mut self,
10994 v: V,
10995 ) -> Self {
10996 self.0.request = v.into();
10997 self
10998 }
10999
11000 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11002 self.0.options = v.into();
11003 self
11004 }
11005
11006 pub async fn send(self) -> Result<longrunning::model::Operation> {
11013 (*self.0.stub)
11014 .batch_delete_entity_types(self.0.request, self.0.options)
11015 .await
11016 .map(gax::response::Response::into_body)
11017 }
11018
11019 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
11021 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
11022 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11023 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11024
11025 let stub = self.0.stub.clone();
11026 let mut options = self.0.options.clone();
11027 options.set_retry_policy(gax::retry_policy::NeverRetry);
11028 let query = move |name| {
11029 let stub = stub.clone();
11030 let options = options.clone();
11031 async {
11032 let op = GetOperation::new(stub)
11033 .set_name(name)
11034 .with_options(options)
11035 .send()
11036 .await?;
11037 Ok(Operation::new(op))
11038 }
11039 };
11040
11041 let start = move || async {
11042 let op = self.send().await?;
11043 Ok(Operation::new(op))
11044 };
11045
11046 lro::internal::new_unit_response_poller(
11047 polling_error_policy,
11048 polling_backoff_policy,
11049 start,
11050 query,
11051 )
11052 }
11053
11054 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11058 self.0.request.parent = v.into();
11059 self
11060 }
11061
11062 pub fn set_entity_type_names<T, V>(mut self, v: T) -> Self
11066 where
11067 T: std::iter::IntoIterator<Item = V>,
11068 V: std::convert::Into<std::string::String>,
11069 {
11070 use std::iter::Iterator;
11071 self.0.request.entity_type_names = v.into_iter().map(|i| i.into()).collect();
11072 self
11073 }
11074 }
11075
11076 #[doc(hidden)]
11077 impl gax::options::internal::RequestBuilder for BatchDeleteEntityTypes {
11078 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11079 &mut self.0.options
11080 }
11081 }
11082
11083 #[derive(Clone, Debug)]
11101 pub struct BatchCreateEntities(RequestBuilder<crate::model::BatchCreateEntitiesRequest>);
11102
11103 impl BatchCreateEntities {
11104 pub(crate) fn new(
11105 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11106 ) -> Self {
11107 Self(RequestBuilder::new(stub))
11108 }
11109
11110 pub fn with_request<V: Into<crate::model::BatchCreateEntitiesRequest>>(
11112 mut self,
11113 v: V,
11114 ) -> Self {
11115 self.0.request = v.into();
11116 self
11117 }
11118
11119 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11121 self.0.options = v.into();
11122 self
11123 }
11124
11125 pub async fn send(self) -> Result<longrunning::model::Operation> {
11132 (*self.0.stub)
11133 .batch_create_entities(self.0.request, self.0.options)
11134 .await
11135 .map(gax::response::Response::into_body)
11136 }
11137
11138 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
11140 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
11141 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11142 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11143
11144 let stub = self.0.stub.clone();
11145 let mut options = self.0.options.clone();
11146 options.set_retry_policy(gax::retry_policy::NeverRetry);
11147 let query = move |name| {
11148 let stub = stub.clone();
11149 let options = options.clone();
11150 async {
11151 let op = GetOperation::new(stub)
11152 .set_name(name)
11153 .with_options(options)
11154 .send()
11155 .await?;
11156 Ok(Operation::new(op))
11157 }
11158 };
11159
11160 let start = move || async {
11161 let op = self.send().await?;
11162 Ok(Operation::new(op))
11163 };
11164
11165 lro::internal::new_unit_response_poller(
11166 polling_error_policy,
11167 polling_backoff_policy,
11168 start,
11169 query,
11170 )
11171 }
11172
11173 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11177 self.0.request.parent = v.into();
11178 self
11179 }
11180
11181 pub fn set_entities<T, V>(mut self, v: T) -> Self
11185 where
11186 T: std::iter::IntoIterator<Item = V>,
11187 V: std::convert::Into<crate::model::entity_type::Entity>,
11188 {
11189 use std::iter::Iterator;
11190 self.0.request.entities = v.into_iter().map(|i| i.into()).collect();
11191 self
11192 }
11193
11194 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11196 self.0.request.language_code = v.into();
11197 self
11198 }
11199 }
11200
11201 #[doc(hidden)]
11202 impl gax::options::internal::RequestBuilder for BatchCreateEntities {
11203 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11204 &mut self.0.options
11205 }
11206 }
11207
11208 #[derive(Clone, Debug)]
11226 pub struct BatchUpdateEntities(RequestBuilder<crate::model::BatchUpdateEntitiesRequest>);
11227
11228 impl BatchUpdateEntities {
11229 pub(crate) fn new(
11230 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11231 ) -> Self {
11232 Self(RequestBuilder::new(stub))
11233 }
11234
11235 pub fn with_request<V: Into<crate::model::BatchUpdateEntitiesRequest>>(
11237 mut self,
11238 v: V,
11239 ) -> Self {
11240 self.0.request = v.into();
11241 self
11242 }
11243
11244 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11246 self.0.options = v.into();
11247 self
11248 }
11249
11250 pub async fn send(self) -> Result<longrunning::model::Operation> {
11257 (*self.0.stub)
11258 .batch_update_entities(self.0.request, self.0.options)
11259 .await
11260 .map(gax::response::Response::into_body)
11261 }
11262
11263 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
11265 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
11266 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11267 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11268
11269 let stub = self.0.stub.clone();
11270 let mut options = self.0.options.clone();
11271 options.set_retry_policy(gax::retry_policy::NeverRetry);
11272 let query = move |name| {
11273 let stub = stub.clone();
11274 let options = options.clone();
11275 async {
11276 let op = GetOperation::new(stub)
11277 .set_name(name)
11278 .with_options(options)
11279 .send()
11280 .await?;
11281 Ok(Operation::new(op))
11282 }
11283 };
11284
11285 let start = move || async {
11286 let op = self.send().await?;
11287 Ok(Operation::new(op))
11288 };
11289
11290 lro::internal::new_unit_response_poller(
11291 polling_error_policy,
11292 polling_backoff_policy,
11293 start,
11294 query,
11295 )
11296 }
11297
11298 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11302 self.0.request.parent = v.into();
11303 self
11304 }
11305
11306 pub fn set_entities<T, V>(mut self, v: T) -> Self
11310 where
11311 T: std::iter::IntoIterator<Item = V>,
11312 V: std::convert::Into<crate::model::entity_type::Entity>,
11313 {
11314 use std::iter::Iterator;
11315 self.0.request.entities = v.into_iter().map(|i| i.into()).collect();
11316 self
11317 }
11318
11319 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11321 self.0.request.language_code = v.into();
11322 self
11323 }
11324
11325 pub fn set_update_mask<T>(mut self, v: T) -> Self
11327 where
11328 T: std::convert::Into<wkt::FieldMask>,
11329 {
11330 self.0.request.update_mask = std::option::Option::Some(v.into());
11331 self
11332 }
11333
11334 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11336 where
11337 T: std::convert::Into<wkt::FieldMask>,
11338 {
11339 self.0.request.update_mask = v.map(|x| x.into());
11340 self
11341 }
11342 }
11343
11344 #[doc(hidden)]
11345 impl gax::options::internal::RequestBuilder for BatchUpdateEntities {
11346 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11347 &mut self.0.options
11348 }
11349 }
11350
11351 #[derive(Clone, Debug)]
11369 pub struct BatchDeleteEntities(RequestBuilder<crate::model::BatchDeleteEntitiesRequest>);
11370
11371 impl BatchDeleteEntities {
11372 pub(crate) fn new(
11373 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11374 ) -> Self {
11375 Self(RequestBuilder::new(stub))
11376 }
11377
11378 pub fn with_request<V: Into<crate::model::BatchDeleteEntitiesRequest>>(
11380 mut self,
11381 v: V,
11382 ) -> Self {
11383 self.0.request = v.into();
11384 self
11385 }
11386
11387 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11389 self.0.options = v.into();
11390 self
11391 }
11392
11393 pub async fn send(self) -> Result<longrunning::model::Operation> {
11400 (*self.0.stub)
11401 .batch_delete_entities(self.0.request, self.0.options)
11402 .await
11403 .map(gax::response::Response::into_body)
11404 }
11405
11406 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
11408 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
11409 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11410 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11411
11412 let stub = self.0.stub.clone();
11413 let mut options = self.0.options.clone();
11414 options.set_retry_policy(gax::retry_policy::NeverRetry);
11415 let query = move |name| {
11416 let stub = stub.clone();
11417 let options = options.clone();
11418 async {
11419 let op = GetOperation::new(stub)
11420 .set_name(name)
11421 .with_options(options)
11422 .send()
11423 .await?;
11424 Ok(Operation::new(op))
11425 }
11426 };
11427
11428 let start = move || async {
11429 let op = self.send().await?;
11430 Ok(Operation::new(op))
11431 };
11432
11433 lro::internal::new_unit_response_poller(
11434 polling_error_policy,
11435 polling_backoff_policy,
11436 start,
11437 query,
11438 )
11439 }
11440
11441 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11445 self.0.request.parent = v.into();
11446 self
11447 }
11448
11449 pub fn set_entity_values<T, V>(mut self, v: T) -> Self
11453 where
11454 T: std::iter::IntoIterator<Item = V>,
11455 V: std::convert::Into<std::string::String>,
11456 {
11457 use std::iter::Iterator;
11458 self.0.request.entity_values = v.into_iter().map(|i| i.into()).collect();
11459 self
11460 }
11461
11462 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11464 self.0.request.language_code = v.into();
11465 self
11466 }
11467 }
11468
11469 #[doc(hidden)]
11470 impl gax::options::internal::RequestBuilder for BatchDeleteEntities {
11471 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11472 &mut self.0.options
11473 }
11474 }
11475
11476 #[derive(Clone, Debug)]
11497 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
11498
11499 impl ListLocations {
11500 pub(crate) fn new(
11501 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11502 ) -> Self {
11503 Self(RequestBuilder::new(stub))
11504 }
11505
11506 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
11508 mut self,
11509 v: V,
11510 ) -> Self {
11511 self.0.request = v.into();
11512 self
11513 }
11514
11515 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11517 self.0.options = v.into();
11518 self
11519 }
11520
11521 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
11523 (*self.0.stub)
11524 .list_locations(self.0.request, self.0.options)
11525 .await
11526 .map(gax::response::Response::into_body)
11527 }
11528
11529 pub fn by_page(
11531 self,
11532 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
11533 {
11534 use std::clone::Clone;
11535 let token = self.0.request.page_token.clone();
11536 let execute = move |token: String| {
11537 let mut builder = self.clone();
11538 builder.0.request = builder.0.request.set_page_token(token);
11539 builder.send()
11540 };
11541 gax::paginator::internal::new_paginator(token, execute)
11542 }
11543
11544 pub fn by_item(
11546 self,
11547 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
11548 {
11549 use gax::paginator::Paginator;
11550 self.by_page().items()
11551 }
11552
11553 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11555 self.0.request.name = v.into();
11556 self
11557 }
11558
11559 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11561 self.0.request.filter = v.into();
11562 self
11563 }
11564
11565 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11567 self.0.request.page_size = v.into();
11568 self
11569 }
11570
11571 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11573 self.0.request.page_token = v.into();
11574 self
11575 }
11576 }
11577
11578 #[doc(hidden)]
11579 impl gax::options::internal::RequestBuilder for ListLocations {
11580 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11581 &mut self.0.options
11582 }
11583 }
11584
11585 #[derive(Clone, Debug)]
11602 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
11603
11604 impl GetLocation {
11605 pub(crate) fn new(
11606 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11607 ) -> Self {
11608 Self(RequestBuilder::new(stub))
11609 }
11610
11611 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
11613 self.0.request = v.into();
11614 self
11615 }
11616
11617 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11619 self.0.options = v.into();
11620 self
11621 }
11622
11623 pub async fn send(self) -> Result<location::model::Location> {
11625 (*self.0.stub)
11626 .get_location(self.0.request, self.0.options)
11627 .await
11628 .map(gax::response::Response::into_body)
11629 }
11630
11631 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11633 self.0.request.name = v.into();
11634 self
11635 }
11636 }
11637
11638 #[doc(hidden)]
11639 impl gax::options::internal::RequestBuilder for GetLocation {
11640 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11641 &mut self.0.options
11642 }
11643 }
11644
11645 #[derive(Clone, Debug)]
11666 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
11667
11668 impl ListOperations {
11669 pub(crate) fn new(
11670 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11671 ) -> Self {
11672 Self(RequestBuilder::new(stub))
11673 }
11674
11675 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
11677 mut self,
11678 v: V,
11679 ) -> Self {
11680 self.0.request = v.into();
11681 self
11682 }
11683
11684 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11686 self.0.options = v.into();
11687 self
11688 }
11689
11690 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
11692 (*self.0.stub)
11693 .list_operations(self.0.request, self.0.options)
11694 .await
11695 .map(gax::response::Response::into_body)
11696 }
11697
11698 pub fn by_page(
11700 self,
11701 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
11702 {
11703 use std::clone::Clone;
11704 let token = self.0.request.page_token.clone();
11705 let execute = move |token: String| {
11706 let mut builder = self.clone();
11707 builder.0.request = builder.0.request.set_page_token(token);
11708 builder.send()
11709 };
11710 gax::paginator::internal::new_paginator(token, execute)
11711 }
11712
11713 pub fn by_item(
11715 self,
11716 ) -> impl gax::paginator::ItemPaginator<
11717 longrunning::model::ListOperationsResponse,
11718 gax::error::Error,
11719 > {
11720 use gax::paginator::Paginator;
11721 self.by_page().items()
11722 }
11723
11724 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11726 self.0.request.name = v.into();
11727 self
11728 }
11729
11730 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11732 self.0.request.filter = v.into();
11733 self
11734 }
11735
11736 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11738 self.0.request.page_size = v.into();
11739 self
11740 }
11741
11742 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11744 self.0.request.page_token = v.into();
11745 self
11746 }
11747
11748 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
11750 self.0.request.return_partial_success = v.into();
11751 self
11752 }
11753 }
11754
11755 #[doc(hidden)]
11756 impl gax::options::internal::RequestBuilder for ListOperations {
11757 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11758 &mut self.0.options
11759 }
11760 }
11761
11762 #[derive(Clone, Debug)]
11779 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
11780
11781 impl GetOperation {
11782 pub(crate) fn new(
11783 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11784 ) -> Self {
11785 Self(RequestBuilder::new(stub))
11786 }
11787
11788 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
11790 mut self,
11791 v: V,
11792 ) -> Self {
11793 self.0.request = v.into();
11794 self
11795 }
11796
11797 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11799 self.0.options = v.into();
11800 self
11801 }
11802
11803 pub async fn send(self) -> Result<longrunning::model::Operation> {
11805 (*self.0.stub)
11806 .get_operation(self.0.request, self.0.options)
11807 .await
11808 .map(gax::response::Response::into_body)
11809 }
11810
11811 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11813 self.0.request.name = v.into();
11814 self
11815 }
11816 }
11817
11818 #[doc(hidden)]
11819 impl gax::options::internal::RequestBuilder for GetOperation {
11820 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11821 &mut self.0.options
11822 }
11823 }
11824
11825 #[derive(Clone, Debug)]
11842 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
11843
11844 impl CancelOperation {
11845 pub(crate) fn new(
11846 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11847 ) -> Self {
11848 Self(RequestBuilder::new(stub))
11849 }
11850
11851 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
11853 mut self,
11854 v: V,
11855 ) -> Self {
11856 self.0.request = v.into();
11857 self
11858 }
11859
11860 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11862 self.0.options = v.into();
11863 self
11864 }
11865
11866 pub async fn send(self) -> Result<()> {
11868 (*self.0.stub)
11869 .cancel_operation(self.0.request, self.0.options)
11870 .await
11871 .map(gax::response::Response::into_body)
11872 }
11873
11874 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11876 self.0.request.name = v.into();
11877 self
11878 }
11879 }
11880
11881 #[doc(hidden)]
11882 impl gax::options::internal::RequestBuilder for CancelOperation {
11883 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
11884 &mut self.0.options
11885 }
11886 }
11887}
11888
11889#[cfg(feature = "environments")]
11890#[cfg_attr(docsrs, doc(cfg(feature = "environments")))]
11891pub mod environments {
11892 use crate::Result;
11893
11894 pub type ClientBuilder =
11908 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
11909
11910 pub(crate) mod client {
11911 use super::super::super::client::Environments;
11912 pub struct Factory;
11913 impl gax::client_builder::internal::ClientFactory for Factory {
11914 type Client = Environments;
11915 type Credentials = gaxi::options::Credentials;
11916 async fn build(
11917 self,
11918 config: gaxi::options::ClientConfig,
11919 ) -> gax::client_builder::Result<Self::Client> {
11920 Self::Client::new(config).await
11921 }
11922 }
11923 }
11924
11925 #[derive(Clone, Debug)]
11927 pub(crate) struct RequestBuilder<R: std::default::Default> {
11928 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
11929 request: R,
11930 options: gax::options::RequestOptions,
11931 }
11932
11933 impl<R> RequestBuilder<R>
11934 where
11935 R: std::default::Default,
11936 {
11937 pub(crate) fn new(
11938 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
11939 ) -> Self {
11940 Self {
11941 stub,
11942 request: R::default(),
11943 options: gax::options::RequestOptions::default(),
11944 }
11945 }
11946 }
11947
11948 #[derive(Clone, Debug)]
11969 pub struct ListEnvironments(RequestBuilder<crate::model::ListEnvironmentsRequest>);
11970
11971 impl ListEnvironments {
11972 pub(crate) fn new(
11973 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
11974 ) -> Self {
11975 Self(RequestBuilder::new(stub))
11976 }
11977
11978 pub fn with_request<V: Into<crate::model::ListEnvironmentsRequest>>(
11980 mut self,
11981 v: V,
11982 ) -> Self {
11983 self.0.request = v.into();
11984 self
11985 }
11986
11987 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
11989 self.0.options = v.into();
11990 self
11991 }
11992
11993 pub async fn send(self) -> Result<crate::model::ListEnvironmentsResponse> {
11995 (*self.0.stub)
11996 .list_environments(self.0.request, self.0.options)
11997 .await
11998 .map(gax::response::Response::into_body)
11999 }
12000
12001 pub fn by_page(
12003 self,
12004 ) -> impl gax::paginator::Paginator<crate::model::ListEnvironmentsResponse, gax::error::Error>
12005 {
12006 use std::clone::Clone;
12007 let token = self.0.request.page_token.clone();
12008 let execute = move |token: String| {
12009 let mut builder = self.clone();
12010 builder.0.request = builder.0.request.set_page_token(token);
12011 builder.send()
12012 };
12013 gax::paginator::internal::new_paginator(token, execute)
12014 }
12015
12016 pub fn by_item(
12018 self,
12019 ) -> impl gax::paginator::ItemPaginator<crate::model::ListEnvironmentsResponse, gax::error::Error>
12020 {
12021 use gax::paginator::Paginator;
12022 self.by_page().items()
12023 }
12024
12025 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
12029 self.0.request.parent = v.into();
12030 self
12031 }
12032
12033 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12035 self.0.request.page_size = v.into();
12036 self
12037 }
12038
12039 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12041 self.0.request.page_token = v.into();
12042 self
12043 }
12044 }
12045
12046 #[doc(hidden)]
12047 impl gax::options::internal::RequestBuilder for ListEnvironments {
12048 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12049 &mut self.0.options
12050 }
12051 }
12052
12053 #[derive(Clone, Debug)]
12070 pub struct GetEnvironment(RequestBuilder<crate::model::GetEnvironmentRequest>);
12071
12072 impl GetEnvironment {
12073 pub(crate) fn new(
12074 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12075 ) -> Self {
12076 Self(RequestBuilder::new(stub))
12077 }
12078
12079 pub fn with_request<V: Into<crate::model::GetEnvironmentRequest>>(mut self, v: V) -> Self {
12081 self.0.request = v.into();
12082 self
12083 }
12084
12085 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12087 self.0.options = v.into();
12088 self
12089 }
12090
12091 pub async fn send(self) -> Result<crate::model::Environment> {
12093 (*self.0.stub)
12094 .get_environment(self.0.request, self.0.options)
12095 .await
12096 .map(gax::response::Response::into_body)
12097 }
12098
12099 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12103 self.0.request.name = v.into();
12104 self
12105 }
12106 }
12107
12108 #[doc(hidden)]
12109 impl gax::options::internal::RequestBuilder for GetEnvironment {
12110 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12111 &mut self.0.options
12112 }
12113 }
12114
12115 #[derive(Clone, Debug)]
12132 pub struct CreateEnvironment(RequestBuilder<crate::model::CreateEnvironmentRequest>);
12133
12134 impl CreateEnvironment {
12135 pub(crate) fn new(
12136 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12137 ) -> Self {
12138 Self(RequestBuilder::new(stub))
12139 }
12140
12141 pub fn with_request<V: Into<crate::model::CreateEnvironmentRequest>>(
12143 mut self,
12144 v: V,
12145 ) -> Self {
12146 self.0.request = v.into();
12147 self
12148 }
12149
12150 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12152 self.0.options = v.into();
12153 self
12154 }
12155
12156 pub async fn send(self) -> Result<crate::model::Environment> {
12158 (*self.0.stub)
12159 .create_environment(self.0.request, self.0.options)
12160 .await
12161 .map(gax::response::Response::into_body)
12162 }
12163
12164 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
12168 self.0.request.parent = v.into();
12169 self
12170 }
12171
12172 pub fn set_environment<T>(mut self, v: T) -> Self
12176 where
12177 T: std::convert::Into<crate::model::Environment>,
12178 {
12179 self.0.request.environment = std::option::Option::Some(v.into());
12180 self
12181 }
12182
12183 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
12187 where
12188 T: std::convert::Into<crate::model::Environment>,
12189 {
12190 self.0.request.environment = v.map(|x| x.into());
12191 self
12192 }
12193
12194 pub fn set_environment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12198 self.0.request.environment_id = v.into();
12199 self
12200 }
12201 }
12202
12203 #[doc(hidden)]
12204 impl gax::options::internal::RequestBuilder for CreateEnvironment {
12205 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12206 &mut self.0.options
12207 }
12208 }
12209
12210 #[derive(Clone, Debug)]
12227 pub struct UpdateEnvironment(RequestBuilder<crate::model::UpdateEnvironmentRequest>);
12228
12229 impl UpdateEnvironment {
12230 pub(crate) fn new(
12231 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12232 ) -> Self {
12233 Self(RequestBuilder::new(stub))
12234 }
12235
12236 pub fn with_request<V: Into<crate::model::UpdateEnvironmentRequest>>(
12238 mut self,
12239 v: V,
12240 ) -> Self {
12241 self.0.request = v.into();
12242 self
12243 }
12244
12245 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12247 self.0.options = v.into();
12248 self
12249 }
12250
12251 pub async fn send(self) -> Result<crate::model::Environment> {
12253 (*self.0.stub)
12254 .update_environment(self.0.request, self.0.options)
12255 .await
12256 .map(gax::response::Response::into_body)
12257 }
12258
12259 pub fn set_environment<T>(mut self, v: T) -> Self
12263 where
12264 T: std::convert::Into<crate::model::Environment>,
12265 {
12266 self.0.request.environment = std::option::Option::Some(v.into());
12267 self
12268 }
12269
12270 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
12274 where
12275 T: std::convert::Into<crate::model::Environment>,
12276 {
12277 self.0.request.environment = v.map(|x| x.into());
12278 self
12279 }
12280
12281 pub fn set_update_mask<T>(mut self, v: T) -> Self
12285 where
12286 T: std::convert::Into<wkt::FieldMask>,
12287 {
12288 self.0.request.update_mask = std::option::Option::Some(v.into());
12289 self
12290 }
12291
12292 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12296 where
12297 T: std::convert::Into<wkt::FieldMask>,
12298 {
12299 self.0.request.update_mask = v.map(|x| x.into());
12300 self
12301 }
12302
12303 pub fn set_allow_load_to_draft_and_discard_changes<T: Into<bool>>(mut self, v: T) -> Self {
12305 self.0.request.allow_load_to_draft_and_discard_changes = v.into();
12306 self
12307 }
12308 }
12309
12310 #[doc(hidden)]
12311 impl gax::options::internal::RequestBuilder for UpdateEnvironment {
12312 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12313 &mut self.0.options
12314 }
12315 }
12316
12317 #[derive(Clone, Debug)]
12334 pub struct DeleteEnvironment(RequestBuilder<crate::model::DeleteEnvironmentRequest>);
12335
12336 impl DeleteEnvironment {
12337 pub(crate) fn new(
12338 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12339 ) -> Self {
12340 Self(RequestBuilder::new(stub))
12341 }
12342
12343 pub fn with_request<V: Into<crate::model::DeleteEnvironmentRequest>>(
12345 mut self,
12346 v: V,
12347 ) -> Self {
12348 self.0.request = v.into();
12349 self
12350 }
12351
12352 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12354 self.0.options = v.into();
12355 self
12356 }
12357
12358 pub async fn send(self) -> Result<()> {
12360 (*self.0.stub)
12361 .delete_environment(self.0.request, self.0.options)
12362 .await
12363 .map(gax::response::Response::into_body)
12364 }
12365
12366 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12370 self.0.request.name = v.into();
12371 self
12372 }
12373 }
12374
12375 #[doc(hidden)]
12376 impl gax::options::internal::RequestBuilder for DeleteEnvironment {
12377 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12378 &mut self.0.options
12379 }
12380 }
12381
12382 #[derive(Clone, Debug)]
12403 pub struct GetEnvironmentHistory(RequestBuilder<crate::model::GetEnvironmentHistoryRequest>);
12404
12405 impl GetEnvironmentHistory {
12406 pub(crate) fn new(
12407 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12408 ) -> Self {
12409 Self(RequestBuilder::new(stub))
12410 }
12411
12412 pub fn with_request<V: Into<crate::model::GetEnvironmentHistoryRequest>>(
12414 mut self,
12415 v: V,
12416 ) -> Self {
12417 self.0.request = v.into();
12418 self
12419 }
12420
12421 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12423 self.0.options = v.into();
12424 self
12425 }
12426
12427 pub async fn send(self) -> Result<crate::model::EnvironmentHistory> {
12429 (*self.0.stub)
12430 .get_environment_history(self.0.request, self.0.options)
12431 .await
12432 .map(gax::response::Response::into_body)
12433 }
12434
12435 pub fn by_page(
12437 self,
12438 ) -> impl gax::paginator::Paginator<crate::model::EnvironmentHistory, gax::error::Error>
12439 {
12440 use std::clone::Clone;
12441 let token = self.0.request.page_token.clone();
12442 let execute = move |token: String| {
12443 let mut builder = self.clone();
12444 builder.0.request = builder.0.request.set_page_token(token);
12445 builder.send()
12446 };
12447 gax::paginator::internal::new_paginator(token, execute)
12448 }
12449
12450 pub fn by_item(
12452 self,
12453 ) -> impl gax::paginator::ItemPaginator<crate::model::EnvironmentHistory, gax::error::Error>
12454 {
12455 use gax::paginator::Paginator;
12456 self.by_page().items()
12457 }
12458
12459 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
12463 self.0.request.parent = v.into();
12464 self
12465 }
12466
12467 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12469 self.0.request.page_size = v.into();
12470 self
12471 }
12472
12473 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12475 self.0.request.page_token = v.into();
12476 self
12477 }
12478 }
12479
12480 #[doc(hidden)]
12481 impl gax::options::internal::RequestBuilder for GetEnvironmentHistory {
12482 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12483 &mut self.0.options
12484 }
12485 }
12486
12487 #[derive(Clone, Debug)]
12508 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
12509
12510 impl ListLocations {
12511 pub(crate) fn new(
12512 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12513 ) -> Self {
12514 Self(RequestBuilder::new(stub))
12515 }
12516
12517 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
12519 mut self,
12520 v: V,
12521 ) -> Self {
12522 self.0.request = v.into();
12523 self
12524 }
12525
12526 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12528 self.0.options = v.into();
12529 self
12530 }
12531
12532 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
12534 (*self.0.stub)
12535 .list_locations(self.0.request, self.0.options)
12536 .await
12537 .map(gax::response::Response::into_body)
12538 }
12539
12540 pub fn by_page(
12542 self,
12543 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
12544 {
12545 use std::clone::Clone;
12546 let token = self.0.request.page_token.clone();
12547 let execute = move |token: String| {
12548 let mut builder = self.clone();
12549 builder.0.request = builder.0.request.set_page_token(token);
12550 builder.send()
12551 };
12552 gax::paginator::internal::new_paginator(token, execute)
12553 }
12554
12555 pub fn by_item(
12557 self,
12558 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
12559 {
12560 use gax::paginator::Paginator;
12561 self.by_page().items()
12562 }
12563
12564 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12566 self.0.request.name = v.into();
12567 self
12568 }
12569
12570 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12572 self.0.request.filter = v.into();
12573 self
12574 }
12575
12576 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12578 self.0.request.page_size = v.into();
12579 self
12580 }
12581
12582 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12584 self.0.request.page_token = v.into();
12585 self
12586 }
12587 }
12588
12589 #[doc(hidden)]
12590 impl gax::options::internal::RequestBuilder for ListLocations {
12591 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12592 &mut self.0.options
12593 }
12594 }
12595
12596 #[derive(Clone, Debug)]
12613 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
12614
12615 impl GetLocation {
12616 pub(crate) fn new(
12617 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12618 ) -> Self {
12619 Self(RequestBuilder::new(stub))
12620 }
12621
12622 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
12624 self.0.request = v.into();
12625 self
12626 }
12627
12628 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12630 self.0.options = v.into();
12631 self
12632 }
12633
12634 pub async fn send(self) -> Result<location::model::Location> {
12636 (*self.0.stub)
12637 .get_location(self.0.request, self.0.options)
12638 .await
12639 .map(gax::response::Response::into_body)
12640 }
12641
12642 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12644 self.0.request.name = v.into();
12645 self
12646 }
12647 }
12648
12649 #[doc(hidden)]
12650 impl gax::options::internal::RequestBuilder for GetLocation {
12651 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12652 &mut self.0.options
12653 }
12654 }
12655
12656 #[derive(Clone, Debug)]
12677 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
12678
12679 impl ListOperations {
12680 pub(crate) fn new(
12681 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12682 ) -> Self {
12683 Self(RequestBuilder::new(stub))
12684 }
12685
12686 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
12688 mut self,
12689 v: V,
12690 ) -> Self {
12691 self.0.request = v.into();
12692 self
12693 }
12694
12695 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12697 self.0.options = v.into();
12698 self
12699 }
12700
12701 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
12703 (*self.0.stub)
12704 .list_operations(self.0.request, self.0.options)
12705 .await
12706 .map(gax::response::Response::into_body)
12707 }
12708
12709 pub fn by_page(
12711 self,
12712 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
12713 {
12714 use std::clone::Clone;
12715 let token = self.0.request.page_token.clone();
12716 let execute = move |token: String| {
12717 let mut builder = self.clone();
12718 builder.0.request = builder.0.request.set_page_token(token);
12719 builder.send()
12720 };
12721 gax::paginator::internal::new_paginator(token, execute)
12722 }
12723
12724 pub fn by_item(
12726 self,
12727 ) -> impl gax::paginator::ItemPaginator<
12728 longrunning::model::ListOperationsResponse,
12729 gax::error::Error,
12730 > {
12731 use gax::paginator::Paginator;
12732 self.by_page().items()
12733 }
12734
12735 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12737 self.0.request.name = v.into();
12738 self
12739 }
12740
12741 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12743 self.0.request.filter = v.into();
12744 self
12745 }
12746
12747 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12749 self.0.request.page_size = v.into();
12750 self
12751 }
12752
12753 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12755 self.0.request.page_token = v.into();
12756 self
12757 }
12758
12759 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
12761 self.0.request.return_partial_success = v.into();
12762 self
12763 }
12764 }
12765
12766 #[doc(hidden)]
12767 impl gax::options::internal::RequestBuilder for ListOperations {
12768 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12769 &mut self.0.options
12770 }
12771 }
12772
12773 #[derive(Clone, Debug)]
12790 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
12791
12792 impl GetOperation {
12793 pub(crate) fn new(
12794 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12795 ) -> Self {
12796 Self(RequestBuilder::new(stub))
12797 }
12798
12799 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
12801 mut self,
12802 v: V,
12803 ) -> Self {
12804 self.0.request = v.into();
12805 self
12806 }
12807
12808 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12810 self.0.options = v.into();
12811 self
12812 }
12813
12814 pub async fn send(self) -> Result<longrunning::model::Operation> {
12816 (*self.0.stub)
12817 .get_operation(self.0.request, self.0.options)
12818 .await
12819 .map(gax::response::Response::into_body)
12820 }
12821
12822 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12824 self.0.request.name = v.into();
12825 self
12826 }
12827 }
12828
12829 #[doc(hidden)]
12830 impl gax::options::internal::RequestBuilder for GetOperation {
12831 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12832 &mut self.0.options
12833 }
12834 }
12835
12836 #[derive(Clone, Debug)]
12853 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
12854
12855 impl CancelOperation {
12856 pub(crate) fn new(
12857 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12858 ) -> Self {
12859 Self(RequestBuilder::new(stub))
12860 }
12861
12862 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
12864 mut self,
12865 v: V,
12866 ) -> Self {
12867 self.0.request = v.into();
12868 self
12869 }
12870
12871 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12873 self.0.options = v.into();
12874 self
12875 }
12876
12877 pub async fn send(self) -> Result<()> {
12879 (*self.0.stub)
12880 .cancel_operation(self.0.request, self.0.options)
12881 .await
12882 .map(gax::response::Response::into_body)
12883 }
12884
12885 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12887 self.0.request.name = v.into();
12888 self
12889 }
12890 }
12891
12892 #[doc(hidden)]
12893 impl gax::options::internal::RequestBuilder for CancelOperation {
12894 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
12895 &mut self.0.options
12896 }
12897 }
12898}
12899
12900#[cfg(feature = "fulfillments")]
12901#[cfg_attr(docsrs, doc(cfg(feature = "fulfillments")))]
12902pub mod fulfillments {
12903 use crate::Result;
12904
12905 pub type ClientBuilder =
12919 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12920
12921 pub(crate) mod client {
12922 use super::super::super::client::Fulfillments;
12923 pub struct Factory;
12924 impl gax::client_builder::internal::ClientFactory for Factory {
12925 type Client = Fulfillments;
12926 type Credentials = gaxi::options::Credentials;
12927 async fn build(
12928 self,
12929 config: gaxi::options::ClientConfig,
12930 ) -> gax::client_builder::Result<Self::Client> {
12931 Self::Client::new(config).await
12932 }
12933 }
12934 }
12935
12936 #[derive(Clone, Debug)]
12938 pub(crate) struct RequestBuilder<R: std::default::Default> {
12939 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
12940 request: R,
12941 options: gax::options::RequestOptions,
12942 }
12943
12944 impl<R> RequestBuilder<R>
12945 where
12946 R: std::default::Default,
12947 {
12948 pub(crate) fn new(
12949 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
12950 ) -> Self {
12951 Self {
12952 stub,
12953 request: R::default(),
12954 options: gax::options::RequestOptions::default(),
12955 }
12956 }
12957 }
12958
12959 #[derive(Clone, Debug)]
12976 pub struct GetFulfillment(RequestBuilder<crate::model::GetFulfillmentRequest>);
12977
12978 impl GetFulfillment {
12979 pub(crate) fn new(
12980 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
12981 ) -> Self {
12982 Self(RequestBuilder::new(stub))
12983 }
12984
12985 pub fn with_request<V: Into<crate::model::GetFulfillmentRequest>>(mut self, v: V) -> Self {
12987 self.0.request = v.into();
12988 self
12989 }
12990
12991 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
12993 self.0.options = v.into();
12994 self
12995 }
12996
12997 pub async fn send(self) -> Result<crate::model::Fulfillment> {
12999 (*self.0.stub)
13000 .get_fulfillment(self.0.request, self.0.options)
13001 .await
13002 .map(gax::response::Response::into_body)
13003 }
13004
13005 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13009 self.0.request.name = v.into();
13010 self
13011 }
13012 }
13013
13014 #[doc(hidden)]
13015 impl gax::options::internal::RequestBuilder for GetFulfillment {
13016 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13017 &mut self.0.options
13018 }
13019 }
13020
13021 #[derive(Clone, Debug)]
13038 pub struct UpdateFulfillment(RequestBuilder<crate::model::UpdateFulfillmentRequest>);
13039
13040 impl UpdateFulfillment {
13041 pub(crate) fn new(
13042 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13043 ) -> Self {
13044 Self(RequestBuilder::new(stub))
13045 }
13046
13047 pub fn with_request<V: Into<crate::model::UpdateFulfillmentRequest>>(
13049 mut self,
13050 v: V,
13051 ) -> Self {
13052 self.0.request = v.into();
13053 self
13054 }
13055
13056 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13058 self.0.options = v.into();
13059 self
13060 }
13061
13062 pub async fn send(self) -> Result<crate::model::Fulfillment> {
13064 (*self.0.stub)
13065 .update_fulfillment(self.0.request, self.0.options)
13066 .await
13067 .map(gax::response::Response::into_body)
13068 }
13069
13070 pub fn set_fulfillment<T>(mut self, v: T) -> Self
13074 where
13075 T: std::convert::Into<crate::model::Fulfillment>,
13076 {
13077 self.0.request.fulfillment = std::option::Option::Some(v.into());
13078 self
13079 }
13080
13081 pub fn set_or_clear_fulfillment<T>(mut self, v: std::option::Option<T>) -> Self
13085 where
13086 T: std::convert::Into<crate::model::Fulfillment>,
13087 {
13088 self.0.request.fulfillment = v.map(|x| x.into());
13089 self
13090 }
13091
13092 pub fn set_update_mask<T>(mut self, v: T) -> Self
13096 where
13097 T: std::convert::Into<wkt::FieldMask>,
13098 {
13099 self.0.request.update_mask = std::option::Option::Some(v.into());
13100 self
13101 }
13102
13103 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13107 where
13108 T: std::convert::Into<wkt::FieldMask>,
13109 {
13110 self.0.request.update_mask = v.map(|x| x.into());
13111 self
13112 }
13113 }
13114
13115 #[doc(hidden)]
13116 impl gax::options::internal::RequestBuilder for UpdateFulfillment {
13117 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13118 &mut self.0.options
13119 }
13120 }
13121
13122 #[derive(Clone, Debug)]
13143 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
13144
13145 impl ListLocations {
13146 pub(crate) fn new(
13147 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13148 ) -> Self {
13149 Self(RequestBuilder::new(stub))
13150 }
13151
13152 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
13154 mut self,
13155 v: V,
13156 ) -> Self {
13157 self.0.request = v.into();
13158 self
13159 }
13160
13161 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13163 self.0.options = v.into();
13164 self
13165 }
13166
13167 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
13169 (*self.0.stub)
13170 .list_locations(self.0.request, self.0.options)
13171 .await
13172 .map(gax::response::Response::into_body)
13173 }
13174
13175 pub fn by_page(
13177 self,
13178 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
13179 {
13180 use std::clone::Clone;
13181 let token = self.0.request.page_token.clone();
13182 let execute = move |token: String| {
13183 let mut builder = self.clone();
13184 builder.0.request = builder.0.request.set_page_token(token);
13185 builder.send()
13186 };
13187 gax::paginator::internal::new_paginator(token, execute)
13188 }
13189
13190 pub fn by_item(
13192 self,
13193 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
13194 {
13195 use gax::paginator::Paginator;
13196 self.by_page().items()
13197 }
13198
13199 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13201 self.0.request.name = v.into();
13202 self
13203 }
13204
13205 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13207 self.0.request.filter = v.into();
13208 self
13209 }
13210
13211 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13213 self.0.request.page_size = v.into();
13214 self
13215 }
13216
13217 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13219 self.0.request.page_token = v.into();
13220 self
13221 }
13222 }
13223
13224 #[doc(hidden)]
13225 impl gax::options::internal::RequestBuilder for ListLocations {
13226 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13227 &mut self.0.options
13228 }
13229 }
13230
13231 #[derive(Clone, Debug)]
13248 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
13249
13250 impl GetLocation {
13251 pub(crate) fn new(
13252 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13253 ) -> Self {
13254 Self(RequestBuilder::new(stub))
13255 }
13256
13257 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
13259 self.0.request = v.into();
13260 self
13261 }
13262
13263 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13265 self.0.options = v.into();
13266 self
13267 }
13268
13269 pub async fn send(self) -> Result<location::model::Location> {
13271 (*self.0.stub)
13272 .get_location(self.0.request, self.0.options)
13273 .await
13274 .map(gax::response::Response::into_body)
13275 }
13276
13277 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13279 self.0.request.name = v.into();
13280 self
13281 }
13282 }
13283
13284 #[doc(hidden)]
13285 impl gax::options::internal::RequestBuilder for GetLocation {
13286 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13287 &mut self.0.options
13288 }
13289 }
13290
13291 #[derive(Clone, Debug)]
13312 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
13313
13314 impl ListOperations {
13315 pub(crate) fn new(
13316 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13317 ) -> Self {
13318 Self(RequestBuilder::new(stub))
13319 }
13320
13321 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
13323 mut self,
13324 v: V,
13325 ) -> Self {
13326 self.0.request = v.into();
13327 self
13328 }
13329
13330 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13332 self.0.options = v.into();
13333 self
13334 }
13335
13336 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
13338 (*self.0.stub)
13339 .list_operations(self.0.request, self.0.options)
13340 .await
13341 .map(gax::response::Response::into_body)
13342 }
13343
13344 pub fn by_page(
13346 self,
13347 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
13348 {
13349 use std::clone::Clone;
13350 let token = self.0.request.page_token.clone();
13351 let execute = move |token: String| {
13352 let mut builder = self.clone();
13353 builder.0.request = builder.0.request.set_page_token(token);
13354 builder.send()
13355 };
13356 gax::paginator::internal::new_paginator(token, execute)
13357 }
13358
13359 pub fn by_item(
13361 self,
13362 ) -> impl gax::paginator::ItemPaginator<
13363 longrunning::model::ListOperationsResponse,
13364 gax::error::Error,
13365 > {
13366 use gax::paginator::Paginator;
13367 self.by_page().items()
13368 }
13369
13370 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13372 self.0.request.name = v.into();
13373 self
13374 }
13375
13376 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13378 self.0.request.filter = v.into();
13379 self
13380 }
13381
13382 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13384 self.0.request.page_size = v.into();
13385 self
13386 }
13387
13388 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13390 self.0.request.page_token = v.into();
13391 self
13392 }
13393
13394 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13396 self.0.request.return_partial_success = v.into();
13397 self
13398 }
13399 }
13400
13401 #[doc(hidden)]
13402 impl gax::options::internal::RequestBuilder for ListOperations {
13403 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13404 &mut self.0.options
13405 }
13406 }
13407
13408 #[derive(Clone, Debug)]
13425 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
13426
13427 impl GetOperation {
13428 pub(crate) fn new(
13429 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13430 ) -> Self {
13431 Self(RequestBuilder::new(stub))
13432 }
13433
13434 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
13436 mut self,
13437 v: V,
13438 ) -> Self {
13439 self.0.request = v.into();
13440 self
13441 }
13442
13443 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13445 self.0.options = v.into();
13446 self
13447 }
13448
13449 pub async fn send(self) -> Result<longrunning::model::Operation> {
13451 (*self.0.stub)
13452 .get_operation(self.0.request, self.0.options)
13453 .await
13454 .map(gax::response::Response::into_body)
13455 }
13456
13457 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13459 self.0.request.name = v.into();
13460 self
13461 }
13462 }
13463
13464 #[doc(hidden)]
13465 impl gax::options::internal::RequestBuilder for GetOperation {
13466 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13467 &mut self.0.options
13468 }
13469 }
13470
13471 #[derive(Clone, Debug)]
13488 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
13489
13490 impl CancelOperation {
13491 pub(crate) fn new(
13492 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13493 ) -> Self {
13494 Self(RequestBuilder::new(stub))
13495 }
13496
13497 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
13499 mut self,
13500 v: V,
13501 ) -> Self {
13502 self.0.request = v.into();
13503 self
13504 }
13505
13506 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13508 self.0.options = v.into();
13509 self
13510 }
13511
13512 pub async fn send(self) -> Result<()> {
13514 (*self.0.stub)
13515 .cancel_operation(self.0.request, self.0.options)
13516 .await
13517 .map(gax::response::Response::into_body)
13518 }
13519
13520 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13522 self.0.request.name = v.into();
13523 self
13524 }
13525 }
13526
13527 #[doc(hidden)]
13528 impl gax::options::internal::RequestBuilder for CancelOperation {
13529 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13530 &mut self.0.options
13531 }
13532 }
13533}
13534
13535#[cfg(feature = "generators")]
13536#[cfg_attr(docsrs, doc(cfg(feature = "generators")))]
13537pub mod generators {
13538 use crate::Result;
13539
13540 pub type ClientBuilder =
13554 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13555
13556 pub(crate) mod client {
13557 use super::super::super::client::Generators;
13558 pub struct Factory;
13559 impl gax::client_builder::internal::ClientFactory for Factory {
13560 type Client = Generators;
13561 type Credentials = gaxi::options::Credentials;
13562 async fn build(
13563 self,
13564 config: gaxi::options::ClientConfig,
13565 ) -> gax::client_builder::Result<Self::Client> {
13566 Self::Client::new(config).await
13567 }
13568 }
13569 }
13570
13571 #[derive(Clone, Debug)]
13573 pub(crate) struct RequestBuilder<R: std::default::Default> {
13574 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13575 request: R,
13576 options: gax::options::RequestOptions,
13577 }
13578
13579 impl<R> RequestBuilder<R>
13580 where
13581 R: std::default::Default,
13582 {
13583 pub(crate) fn new(
13584 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13585 ) -> Self {
13586 Self {
13587 stub,
13588 request: R::default(),
13589 options: gax::options::RequestOptions::default(),
13590 }
13591 }
13592 }
13593
13594 #[derive(Clone, Debug)]
13611 pub struct CreateGenerator(RequestBuilder<crate::model::CreateGeneratorRequest>);
13612
13613 impl CreateGenerator {
13614 pub(crate) fn new(
13615 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13616 ) -> Self {
13617 Self(RequestBuilder::new(stub))
13618 }
13619
13620 pub fn with_request<V: Into<crate::model::CreateGeneratorRequest>>(mut self, v: V) -> Self {
13622 self.0.request = v.into();
13623 self
13624 }
13625
13626 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13628 self.0.options = v.into();
13629 self
13630 }
13631
13632 pub async fn send(self) -> Result<crate::model::Generator> {
13634 (*self.0.stub)
13635 .create_generator(self.0.request, self.0.options)
13636 .await
13637 .map(gax::response::Response::into_body)
13638 }
13639
13640 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13644 self.0.request.parent = v.into();
13645 self
13646 }
13647
13648 pub fn set_generator<T>(mut self, v: T) -> Self
13652 where
13653 T: std::convert::Into<crate::model::Generator>,
13654 {
13655 self.0.request.generator = std::option::Option::Some(v.into());
13656 self
13657 }
13658
13659 pub fn set_or_clear_generator<T>(mut self, v: std::option::Option<T>) -> Self
13663 where
13664 T: std::convert::Into<crate::model::Generator>,
13665 {
13666 self.0.request.generator = v.map(|x| x.into());
13667 self
13668 }
13669
13670 pub fn set_generator_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
13672 self.0.request.generator_id = v.into();
13673 self
13674 }
13675 }
13676
13677 #[doc(hidden)]
13678 impl gax::options::internal::RequestBuilder for CreateGenerator {
13679 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13680 &mut self.0.options
13681 }
13682 }
13683
13684 #[derive(Clone, Debug)]
13701 pub struct GetGenerator(RequestBuilder<crate::model::GetGeneratorRequest>);
13702
13703 impl GetGenerator {
13704 pub(crate) fn new(
13705 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13706 ) -> Self {
13707 Self(RequestBuilder::new(stub))
13708 }
13709
13710 pub fn with_request<V: Into<crate::model::GetGeneratorRequest>>(mut self, v: V) -> Self {
13712 self.0.request = v.into();
13713 self
13714 }
13715
13716 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13718 self.0.options = v.into();
13719 self
13720 }
13721
13722 pub async fn send(self) -> Result<crate::model::Generator> {
13724 (*self.0.stub)
13725 .get_generator(self.0.request, self.0.options)
13726 .await
13727 .map(gax::response::Response::into_body)
13728 }
13729
13730 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13734 self.0.request.name = v.into();
13735 self
13736 }
13737 }
13738
13739 #[doc(hidden)]
13740 impl gax::options::internal::RequestBuilder for GetGenerator {
13741 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13742 &mut self.0.options
13743 }
13744 }
13745
13746 #[derive(Clone, Debug)]
13767 pub struct ListGenerators(RequestBuilder<crate::model::ListGeneratorsRequest>);
13768
13769 impl ListGenerators {
13770 pub(crate) fn new(
13771 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13772 ) -> Self {
13773 Self(RequestBuilder::new(stub))
13774 }
13775
13776 pub fn with_request<V: Into<crate::model::ListGeneratorsRequest>>(mut self, v: V) -> Self {
13778 self.0.request = v.into();
13779 self
13780 }
13781
13782 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13784 self.0.options = v.into();
13785 self
13786 }
13787
13788 pub async fn send(self) -> Result<crate::model::ListGeneratorsResponse> {
13790 (*self.0.stub)
13791 .list_generators(self.0.request, self.0.options)
13792 .await
13793 .map(gax::response::Response::into_body)
13794 }
13795
13796 pub fn by_page(
13798 self,
13799 ) -> impl gax::paginator::Paginator<crate::model::ListGeneratorsResponse, gax::error::Error>
13800 {
13801 use std::clone::Clone;
13802 let token = self.0.request.page_token.clone();
13803 let execute = move |token: String| {
13804 let mut builder = self.clone();
13805 builder.0.request = builder.0.request.set_page_token(token);
13806 builder.send()
13807 };
13808 gax::paginator::internal::new_paginator(token, execute)
13809 }
13810
13811 pub fn by_item(
13813 self,
13814 ) -> impl gax::paginator::ItemPaginator<crate::model::ListGeneratorsResponse, gax::error::Error>
13815 {
13816 use gax::paginator::Paginator;
13817 self.by_page().items()
13818 }
13819
13820 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13824 self.0.request.parent = v.into();
13825 self
13826 }
13827
13828 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13830 self.0.request.page_size = v.into();
13831 self
13832 }
13833
13834 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13836 self.0.request.page_token = v.into();
13837 self
13838 }
13839 }
13840
13841 #[doc(hidden)]
13842 impl gax::options::internal::RequestBuilder for ListGenerators {
13843 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13844 &mut self.0.options
13845 }
13846 }
13847
13848 #[derive(Clone, Debug)]
13865 pub struct DeleteGenerator(RequestBuilder<crate::model::DeleteGeneratorRequest>);
13866
13867 impl DeleteGenerator {
13868 pub(crate) fn new(
13869 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13870 ) -> Self {
13871 Self(RequestBuilder::new(stub))
13872 }
13873
13874 pub fn with_request<V: Into<crate::model::DeleteGeneratorRequest>>(mut self, v: V) -> Self {
13876 self.0.request = v.into();
13877 self
13878 }
13879
13880 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13882 self.0.options = v.into();
13883 self
13884 }
13885
13886 pub async fn send(self) -> Result<()> {
13888 (*self.0.stub)
13889 .delete_generator(self.0.request, self.0.options)
13890 .await
13891 .map(gax::response::Response::into_body)
13892 }
13893
13894 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13898 self.0.request.name = v.into();
13899 self
13900 }
13901 }
13902
13903 #[doc(hidden)]
13904 impl gax::options::internal::RequestBuilder for DeleteGenerator {
13905 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
13906 &mut self.0.options
13907 }
13908 }
13909
13910 #[derive(Clone, Debug)]
13927 pub struct UpdateGenerator(RequestBuilder<crate::model::UpdateGeneratorRequest>);
13928
13929 impl UpdateGenerator {
13930 pub(crate) fn new(
13931 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13932 ) -> Self {
13933 Self(RequestBuilder::new(stub))
13934 }
13935
13936 pub fn with_request<V: Into<crate::model::UpdateGeneratorRequest>>(mut self, v: V) -> Self {
13938 self.0.request = v.into();
13939 self
13940 }
13941
13942 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
13944 self.0.options = v.into();
13945 self
13946 }
13947
13948 pub async fn send(self) -> Result<crate::model::Generator> {
13950 (*self.0.stub)
13951 .update_generator(self.0.request, self.0.options)
13952 .await
13953 .map(gax::response::Response::into_body)
13954 }
13955
13956 pub fn set_generator<T>(mut self, v: T) -> Self
13960 where
13961 T: std::convert::Into<crate::model::Generator>,
13962 {
13963 self.0.request.generator = std::option::Option::Some(v.into());
13964 self
13965 }
13966
13967 pub fn set_or_clear_generator<T>(mut self, v: std::option::Option<T>) -> Self
13971 where
13972 T: std::convert::Into<crate::model::Generator>,
13973 {
13974 self.0.request.generator = v.map(|x| x.into());
13975 self
13976 }
13977
13978 pub fn set_update_mask<T>(mut self, v: T) -> Self
13980 where
13981 T: std::convert::Into<wkt::FieldMask>,
13982 {
13983 self.0.request.update_mask = std::option::Option::Some(v.into());
13984 self
13985 }
13986
13987 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13989 where
13990 T: std::convert::Into<wkt::FieldMask>,
13991 {
13992 self.0.request.update_mask = v.map(|x| x.into());
13993 self
13994 }
13995 }
13996
13997 #[doc(hidden)]
13998 impl gax::options::internal::RequestBuilder for UpdateGenerator {
13999 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14000 &mut self.0.options
14001 }
14002 }
14003
14004 #[derive(Clone, Debug)]
14025 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
14026
14027 impl ListLocations {
14028 pub(crate) fn new(
14029 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14030 ) -> Self {
14031 Self(RequestBuilder::new(stub))
14032 }
14033
14034 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
14036 mut self,
14037 v: V,
14038 ) -> Self {
14039 self.0.request = v.into();
14040 self
14041 }
14042
14043 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14045 self.0.options = v.into();
14046 self
14047 }
14048
14049 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
14051 (*self.0.stub)
14052 .list_locations(self.0.request, self.0.options)
14053 .await
14054 .map(gax::response::Response::into_body)
14055 }
14056
14057 pub fn by_page(
14059 self,
14060 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
14061 {
14062 use std::clone::Clone;
14063 let token = self.0.request.page_token.clone();
14064 let execute = move |token: String| {
14065 let mut builder = self.clone();
14066 builder.0.request = builder.0.request.set_page_token(token);
14067 builder.send()
14068 };
14069 gax::paginator::internal::new_paginator(token, execute)
14070 }
14071
14072 pub fn by_item(
14074 self,
14075 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
14076 {
14077 use gax::paginator::Paginator;
14078 self.by_page().items()
14079 }
14080
14081 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14083 self.0.request.name = v.into();
14084 self
14085 }
14086
14087 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14089 self.0.request.filter = v.into();
14090 self
14091 }
14092
14093 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14095 self.0.request.page_size = v.into();
14096 self
14097 }
14098
14099 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14101 self.0.request.page_token = v.into();
14102 self
14103 }
14104 }
14105
14106 #[doc(hidden)]
14107 impl gax::options::internal::RequestBuilder for ListLocations {
14108 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14109 &mut self.0.options
14110 }
14111 }
14112
14113 #[derive(Clone, Debug)]
14130 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
14131
14132 impl GetLocation {
14133 pub(crate) fn new(
14134 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14135 ) -> Self {
14136 Self(RequestBuilder::new(stub))
14137 }
14138
14139 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
14141 self.0.request = v.into();
14142 self
14143 }
14144
14145 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14147 self.0.options = v.into();
14148 self
14149 }
14150
14151 pub async fn send(self) -> Result<location::model::Location> {
14153 (*self.0.stub)
14154 .get_location(self.0.request, self.0.options)
14155 .await
14156 .map(gax::response::Response::into_body)
14157 }
14158
14159 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14161 self.0.request.name = v.into();
14162 self
14163 }
14164 }
14165
14166 #[doc(hidden)]
14167 impl gax::options::internal::RequestBuilder for GetLocation {
14168 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14169 &mut self.0.options
14170 }
14171 }
14172
14173 #[derive(Clone, Debug)]
14194 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
14195
14196 impl ListOperations {
14197 pub(crate) fn new(
14198 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14199 ) -> Self {
14200 Self(RequestBuilder::new(stub))
14201 }
14202
14203 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
14205 mut self,
14206 v: V,
14207 ) -> Self {
14208 self.0.request = v.into();
14209 self
14210 }
14211
14212 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14214 self.0.options = v.into();
14215 self
14216 }
14217
14218 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
14220 (*self.0.stub)
14221 .list_operations(self.0.request, self.0.options)
14222 .await
14223 .map(gax::response::Response::into_body)
14224 }
14225
14226 pub fn by_page(
14228 self,
14229 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
14230 {
14231 use std::clone::Clone;
14232 let token = self.0.request.page_token.clone();
14233 let execute = move |token: String| {
14234 let mut builder = self.clone();
14235 builder.0.request = builder.0.request.set_page_token(token);
14236 builder.send()
14237 };
14238 gax::paginator::internal::new_paginator(token, execute)
14239 }
14240
14241 pub fn by_item(
14243 self,
14244 ) -> impl gax::paginator::ItemPaginator<
14245 longrunning::model::ListOperationsResponse,
14246 gax::error::Error,
14247 > {
14248 use gax::paginator::Paginator;
14249 self.by_page().items()
14250 }
14251
14252 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14254 self.0.request.name = v.into();
14255 self
14256 }
14257
14258 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14260 self.0.request.filter = v.into();
14261 self
14262 }
14263
14264 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14266 self.0.request.page_size = v.into();
14267 self
14268 }
14269
14270 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14272 self.0.request.page_token = v.into();
14273 self
14274 }
14275
14276 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14278 self.0.request.return_partial_success = v.into();
14279 self
14280 }
14281 }
14282
14283 #[doc(hidden)]
14284 impl gax::options::internal::RequestBuilder for ListOperations {
14285 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14286 &mut self.0.options
14287 }
14288 }
14289
14290 #[derive(Clone, Debug)]
14307 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
14308
14309 impl GetOperation {
14310 pub(crate) fn new(
14311 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14312 ) -> Self {
14313 Self(RequestBuilder::new(stub))
14314 }
14315
14316 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
14318 mut self,
14319 v: V,
14320 ) -> Self {
14321 self.0.request = v.into();
14322 self
14323 }
14324
14325 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14327 self.0.options = v.into();
14328 self
14329 }
14330
14331 pub async fn send(self) -> Result<longrunning::model::Operation> {
14333 (*self.0.stub)
14334 .get_operation(self.0.request, self.0.options)
14335 .await
14336 .map(gax::response::Response::into_body)
14337 }
14338
14339 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14341 self.0.request.name = v.into();
14342 self
14343 }
14344 }
14345
14346 #[doc(hidden)]
14347 impl gax::options::internal::RequestBuilder for GetOperation {
14348 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14349 &mut self.0.options
14350 }
14351 }
14352
14353 #[derive(Clone, Debug)]
14370 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
14371
14372 impl CancelOperation {
14373 pub(crate) fn new(
14374 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14375 ) -> Self {
14376 Self(RequestBuilder::new(stub))
14377 }
14378
14379 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
14381 mut self,
14382 v: V,
14383 ) -> Self {
14384 self.0.request = v.into();
14385 self
14386 }
14387
14388 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14390 self.0.options = v.into();
14391 self
14392 }
14393
14394 pub async fn send(self) -> Result<()> {
14396 (*self.0.stub)
14397 .cancel_operation(self.0.request, self.0.options)
14398 .await
14399 .map(gax::response::Response::into_body)
14400 }
14401
14402 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14404 self.0.request.name = v.into();
14405 self
14406 }
14407 }
14408
14409 #[doc(hidden)]
14410 impl gax::options::internal::RequestBuilder for CancelOperation {
14411 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14412 &mut self.0.options
14413 }
14414 }
14415}
14416
14417#[cfg(feature = "generator-evaluations")]
14418#[cfg_attr(docsrs, doc(cfg(feature = "generator-evaluations")))]
14419pub mod generator_evaluations {
14420 use crate::Result;
14421
14422 pub type ClientBuilder =
14436 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14437
14438 pub(crate) mod client {
14439 use super::super::super::client::GeneratorEvaluations;
14440 pub struct Factory;
14441 impl gax::client_builder::internal::ClientFactory for Factory {
14442 type Client = GeneratorEvaluations;
14443 type Credentials = gaxi::options::Credentials;
14444 async fn build(
14445 self,
14446 config: gaxi::options::ClientConfig,
14447 ) -> gax::client_builder::Result<Self::Client> {
14448 Self::Client::new(config).await
14449 }
14450 }
14451 }
14452
14453 #[derive(Clone, Debug)]
14455 pub(crate) struct RequestBuilder<R: std::default::Default> {
14456 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14457 request: R,
14458 options: gax::options::RequestOptions,
14459 }
14460
14461 impl<R> RequestBuilder<R>
14462 where
14463 R: std::default::Default,
14464 {
14465 pub(crate) fn new(
14466 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14467 ) -> Self {
14468 Self {
14469 stub,
14470 request: R::default(),
14471 options: gax::options::RequestOptions::default(),
14472 }
14473 }
14474 }
14475
14476 #[derive(Clone, Debug)]
14494 pub struct CreateGeneratorEvaluation(
14495 RequestBuilder<crate::model::CreateGeneratorEvaluationRequest>,
14496 );
14497
14498 impl CreateGeneratorEvaluation {
14499 pub(crate) fn new(
14500 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14501 ) -> Self {
14502 Self(RequestBuilder::new(stub))
14503 }
14504
14505 pub fn with_request<V: Into<crate::model::CreateGeneratorEvaluationRequest>>(
14507 mut self,
14508 v: V,
14509 ) -> Self {
14510 self.0.request = v.into();
14511 self
14512 }
14513
14514 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14516 self.0.options = v.into();
14517 self
14518 }
14519
14520 pub async fn send(self) -> Result<longrunning::model::Operation> {
14527 (*self.0.stub)
14528 .create_generator_evaluation(self.0.request, self.0.options)
14529 .await
14530 .map(gax::response::Response::into_body)
14531 }
14532
14533 pub fn poller(
14535 self,
14536 ) -> impl lro::Poller<
14537 crate::model::GeneratorEvaluation,
14538 crate::model::GeneratorEvaluationOperationMetadata,
14539 > {
14540 type Operation = lro::internal::Operation<
14541 crate::model::GeneratorEvaluation,
14542 crate::model::GeneratorEvaluationOperationMetadata,
14543 >;
14544 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14545 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14546
14547 let stub = self.0.stub.clone();
14548 let mut options = self.0.options.clone();
14549 options.set_retry_policy(gax::retry_policy::NeverRetry);
14550 let query = move |name| {
14551 let stub = stub.clone();
14552 let options = options.clone();
14553 async {
14554 let op = GetOperation::new(stub)
14555 .set_name(name)
14556 .with_options(options)
14557 .send()
14558 .await?;
14559 Ok(Operation::new(op))
14560 }
14561 };
14562
14563 let start = move || async {
14564 let op = self.send().await?;
14565 Ok(Operation::new(op))
14566 };
14567
14568 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
14569 }
14570
14571 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14575 self.0.request.parent = v.into();
14576 self
14577 }
14578
14579 pub fn set_generator_evaluation<T>(mut self, v: T) -> Self
14583 where
14584 T: std::convert::Into<crate::model::GeneratorEvaluation>,
14585 {
14586 self.0.request.generator_evaluation = std::option::Option::Some(v.into());
14587 self
14588 }
14589
14590 pub fn set_or_clear_generator_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
14594 where
14595 T: std::convert::Into<crate::model::GeneratorEvaluation>,
14596 {
14597 self.0.request.generator_evaluation = v.map(|x| x.into());
14598 self
14599 }
14600 }
14601
14602 #[doc(hidden)]
14603 impl gax::options::internal::RequestBuilder for CreateGeneratorEvaluation {
14604 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14605 &mut self.0.options
14606 }
14607 }
14608
14609 #[derive(Clone, Debug)]
14626 pub struct GetGeneratorEvaluation(RequestBuilder<crate::model::GetGeneratorEvaluationRequest>);
14627
14628 impl GetGeneratorEvaluation {
14629 pub(crate) fn new(
14630 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14631 ) -> Self {
14632 Self(RequestBuilder::new(stub))
14633 }
14634
14635 pub fn with_request<V: Into<crate::model::GetGeneratorEvaluationRequest>>(
14637 mut self,
14638 v: V,
14639 ) -> Self {
14640 self.0.request = v.into();
14641 self
14642 }
14643
14644 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14646 self.0.options = v.into();
14647 self
14648 }
14649
14650 pub async fn send(self) -> Result<crate::model::GeneratorEvaluation> {
14652 (*self.0.stub)
14653 .get_generator_evaluation(self.0.request, self.0.options)
14654 .await
14655 .map(gax::response::Response::into_body)
14656 }
14657
14658 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14662 self.0.request.name = v.into();
14663 self
14664 }
14665 }
14666
14667 #[doc(hidden)]
14668 impl gax::options::internal::RequestBuilder for GetGeneratorEvaluation {
14669 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14670 &mut self.0.options
14671 }
14672 }
14673
14674 #[derive(Clone, Debug)]
14695 pub struct ListGeneratorEvaluations(
14696 RequestBuilder<crate::model::ListGeneratorEvaluationsRequest>,
14697 );
14698
14699 impl ListGeneratorEvaluations {
14700 pub(crate) fn new(
14701 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14702 ) -> Self {
14703 Self(RequestBuilder::new(stub))
14704 }
14705
14706 pub fn with_request<V: Into<crate::model::ListGeneratorEvaluationsRequest>>(
14708 mut self,
14709 v: V,
14710 ) -> Self {
14711 self.0.request = v.into();
14712 self
14713 }
14714
14715 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14717 self.0.options = v.into();
14718 self
14719 }
14720
14721 pub async fn send(self) -> Result<crate::model::ListGeneratorEvaluationsResponse> {
14723 (*self.0.stub)
14724 .list_generator_evaluations(self.0.request, self.0.options)
14725 .await
14726 .map(gax::response::Response::into_body)
14727 }
14728
14729 pub fn by_page(
14731 self,
14732 ) -> impl gax::paginator::Paginator<
14733 crate::model::ListGeneratorEvaluationsResponse,
14734 gax::error::Error,
14735 > {
14736 use std::clone::Clone;
14737 let token = self.0.request.page_token.clone();
14738 let execute = move |token: String| {
14739 let mut builder = self.clone();
14740 builder.0.request = builder.0.request.set_page_token(token);
14741 builder.send()
14742 };
14743 gax::paginator::internal::new_paginator(token, execute)
14744 }
14745
14746 pub fn by_item(
14748 self,
14749 ) -> impl gax::paginator::ItemPaginator<
14750 crate::model::ListGeneratorEvaluationsResponse,
14751 gax::error::Error,
14752 > {
14753 use gax::paginator::Paginator;
14754 self.by_page().items()
14755 }
14756
14757 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14761 self.0.request.parent = v.into();
14762 self
14763 }
14764
14765 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14767 self.0.request.page_size = v.into();
14768 self
14769 }
14770
14771 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14773 self.0.request.page_token = v.into();
14774 self
14775 }
14776 }
14777
14778 #[doc(hidden)]
14779 impl gax::options::internal::RequestBuilder for ListGeneratorEvaluations {
14780 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14781 &mut self.0.options
14782 }
14783 }
14784
14785 #[derive(Clone, Debug)]
14802 pub struct DeleteGeneratorEvaluation(
14803 RequestBuilder<crate::model::DeleteGeneratorEvaluationRequest>,
14804 );
14805
14806 impl DeleteGeneratorEvaluation {
14807 pub(crate) fn new(
14808 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14809 ) -> Self {
14810 Self(RequestBuilder::new(stub))
14811 }
14812
14813 pub fn with_request<V: Into<crate::model::DeleteGeneratorEvaluationRequest>>(
14815 mut self,
14816 v: V,
14817 ) -> Self {
14818 self.0.request = v.into();
14819 self
14820 }
14821
14822 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14824 self.0.options = v.into();
14825 self
14826 }
14827
14828 pub async fn send(self) -> Result<()> {
14830 (*self.0.stub)
14831 .delete_generator_evaluation(self.0.request, self.0.options)
14832 .await
14833 .map(gax::response::Response::into_body)
14834 }
14835
14836 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14840 self.0.request.name = v.into();
14841 self
14842 }
14843 }
14844
14845 #[doc(hidden)]
14846 impl gax::options::internal::RequestBuilder for DeleteGeneratorEvaluation {
14847 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14848 &mut self.0.options
14849 }
14850 }
14851
14852 #[derive(Clone, Debug)]
14873 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
14874
14875 impl ListLocations {
14876 pub(crate) fn new(
14877 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14878 ) -> Self {
14879 Self(RequestBuilder::new(stub))
14880 }
14881
14882 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
14884 mut self,
14885 v: V,
14886 ) -> Self {
14887 self.0.request = v.into();
14888 self
14889 }
14890
14891 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14893 self.0.options = v.into();
14894 self
14895 }
14896
14897 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
14899 (*self.0.stub)
14900 .list_locations(self.0.request, self.0.options)
14901 .await
14902 .map(gax::response::Response::into_body)
14903 }
14904
14905 pub fn by_page(
14907 self,
14908 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
14909 {
14910 use std::clone::Clone;
14911 let token = self.0.request.page_token.clone();
14912 let execute = move |token: String| {
14913 let mut builder = self.clone();
14914 builder.0.request = builder.0.request.set_page_token(token);
14915 builder.send()
14916 };
14917 gax::paginator::internal::new_paginator(token, execute)
14918 }
14919
14920 pub fn by_item(
14922 self,
14923 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
14924 {
14925 use gax::paginator::Paginator;
14926 self.by_page().items()
14927 }
14928
14929 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14931 self.0.request.name = v.into();
14932 self
14933 }
14934
14935 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14937 self.0.request.filter = v.into();
14938 self
14939 }
14940
14941 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14943 self.0.request.page_size = v.into();
14944 self
14945 }
14946
14947 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14949 self.0.request.page_token = v.into();
14950 self
14951 }
14952 }
14953
14954 #[doc(hidden)]
14955 impl gax::options::internal::RequestBuilder for ListLocations {
14956 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
14957 &mut self.0.options
14958 }
14959 }
14960
14961 #[derive(Clone, Debug)]
14978 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
14979
14980 impl GetLocation {
14981 pub(crate) fn new(
14982 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14983 ) -> Self {
14984 Self(RequestBuilder::new(stub))
14985 }
14986
14987 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
14989 self.0.request = v.into();
14990 self
14991 }
14992
14993 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
14995 self.0.options = v.into();
14996 self
14997 }
14998
14999 pub async fn send(self) -> Result<location::model::Location> {
15001 (*self.0.stub)
15002 .get_location(self.0.request, self.0.options)
15003 .await
15004 .map(gax::response::Response::into_body)
15005 }
15006
15007 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15009 self.0.request.name = v.into();
15010 self
15011 }
15012 }
15013
15014 #[doc(hidden)]
15015 impl gax::options::internal::RequestBuilder for GetLocation {
15016 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15017 &mut self.0.options
15018 }
15019 }
15020
15021 #[derive(Clone, Debug)]
15042 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
15043
15044 impl ListOperations {
15045 pub(crate) fn new(
15046 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15047 ) -> Self {
15048 Self(RequestBuilder::new(stub))
15049 }
15050
15051 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
15053 mut self,
15054 v: V,
15055 ) -> Self {
15056 self.0.request = v.into();
15057 self
15058 }
15059
15060 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15062 self.0.options = v.into();
15063 self
15064 }
15065
15066 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
15068 (*self.0.stub)
15069 .list_operations(self.0.request, self.0.options)
15070 .await
15071 .map(gax::response::Response::into_body)
15072 }
15073
15074 pub fn by_page(
15076 self,
15077 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
15078 {
15079 use std::clone::Clone;
15080 let token = self.0.request.page_token.clone();
15081 let execute = move |token: String| {
15082 let mut builder = self.clone();
15083 builder.0.request = builder.0.request.set_page_token(token);
15084 builder.send()
15085 };
15086 gax::paginator::internal::new_paginator(token, execute)
15087 }
15088
15089 pub fn by_item(
15091 self,
15092 ) -> impl gax::paginator::ItemPaginator<
15093 longrunning::model::ListOperationsResponse,
15094 gax::error::Error,
15095 > {
15096 use gax::paginator::Paginator;
15097 self.by_page().items()
15098 }
15099
15100 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15102 self.0.request.name = v.into();
15103 self
15104 }
15105
15106 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15108 self.0.request.filter = v.into();
15109 self
15110 }
15111
15112 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15114 self.0.request.page_size = v.into();
15115 self
15116 }
15117
15118 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15120 self.0.request.page_token = v.into();
15121 self
15122 }
15123
15124 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
15126 self.0.request.return_partial_success = v.into();
15127 self
15128 }
15129 }
15130
15131 #[doc(hidden)]
15132 impl gax::options::internal::RequestBuilder for ListOperations {
15133 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15134 &mut self.0.options
15135 }
15136 }
15137
15138 #[derive(Clone, Debug)]
15155 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
15156
15157 impl GetOperation {
15158 pub(crate) fn new(
15159 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15160 ) -> Self {
15161 Self(RequestBuilder::new(stub))
15162 }
15163
15164 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
15166 mut self,
15167 v: V,
15168 ) -> Self {
15169 self.0.request = v.into();
15170 self
15171 }
15172
15173 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15175 self.0.options = v.into();
15176 self
15177 }
15178
15179 pub async fn send(self) -> Result<longrunning::model::Operation> {
15181 (*self.0.stub)
15182 .get_operation(self.0.request, self.0.options)
15183 .await
15184 .map(gax::response::Response::into_body)
15185 }
15186
15187 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15189 self.0.request.name = v.into();
15190 self
15191 }
15192 }
15193
15194 #[doc(hidden)]
15195 impl gax::options::internal::RequestBuilder for GetOperation {
15196 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15197 &mut self.0.options
15198 }
15199 }
15200
15201 #[derive(Clone, Debug)]
15218 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
15219
15220 impl CancelOperation {
15221 pub(crate) fn new(
15222 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15223 ) -> Self {
15224 Self(RequestBuilder::new(stub))
15225 }
15226
15227 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
15229 mut self,
15230 v: V,
15231 ) -> Self {
15232 self.0.request = v.into();
15233 self
15234 }
15235
15236 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15238 self.0.options = v.into();
15239 self
15240 }
15241
15242 pub async fn send(self) -> Result<()> {
15244 (*self.0.stub)
15245 .cancel_operation(self.0.request, self.0.options)
15246 .await
15247 .map(gax::response::Response::into_body)
15248 }
15249
15250 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15252 self.0.request.name = v.into();
15253 self
15254 }
15255 }
15256
15257 #[doc(hidden)]
15258 impl gax::options::internal::RequestBuilder for CancelOperation {
15259 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15260 &mut self.0.options
15261 }
15262 }
15263}
15264
15265#[cfg(feature = "intents")]
15266#[cfg_attr(docsrs, doc(cfg(feature = "intents")))]
15267pub mod intents {
15268 use crate::Result;
15269
15270 pub type ClientBuilder =
15284 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
15285
15286 pub(crate) mod client {
15287 use super::super::super::client::Intents;
15288 pub struct Factory;
15289 impl gax::client_builder::internal::ClientFactory for Factory {
15290 type Client = Intents;
15291 type Credentials = gaxi::options::Credentials;
15292 async fn build(
15293 self,
15294 config: gaxi::options::ClientConfig,
15295 ) -> gax::client_builder::Result<Self::Client> {
15296 Self::Client::new(config).await
15297 }
15298 }
15299 }
15300
15301 #[derive(Clone, Debug)]
15303 pub(crate) struct RequestBuilder<R: std::default::Default> {
15304 stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>,
15305 request: R,
15306 options: gax::options::RequestOptions,
15307 }
15308
15309 impl<R> RequestBuilder<R>
15310 where
15311 R: std::default::Default,
15312 {
15313 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15314 Self {
15315 stub,
15316 request: R::default(),
15317 options: gax::options::RequestOptions::default(),
15318 }
15319 }
15320 }
15321
15322 #[derive(Clone, Debug)]
15343 pub struct ListIntents(RequestBuilder<crate::model::ListIntentsRequest>);
15344
15345 impl ListIntents {
15346 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15347 Self(RequestBuilder::new(stub))
15348 }
15349
15350 pub fn with_request<V: Into<crate::model::ListIntentsRequest>>(mut self, v: V) -> Self {
15352 self.0.request = v.into();
15353 self
15354 }
15355
15356 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15358 self.0.options = v.into();
15359 self
15360 }
15361
15362 pub async fn send(self) -> Result<crate::model::ListIntentsResponse> {
15364 (*self.0.stub)
15365 .list_intents(self.0.request, self.0.options)
15366 .await
15367 .map(gax::response::Response::into_body)
15368 }
15369
15370 pub fn by_page(
15372 self,
15373 ) -> impl gax::paginator::Paginator<crate::model::ListIntentsResponse, gax::error::Error>
15374 {
15375 use std::clone::Clone;
15376 let token = self.0.request.page_token.clone();
15377 let execute = move |token: String| {
15378 let mut builder = self.clone();
15379 builder.0.request = builder.0.request.set_page_token(token);
15380 builder.send()
15381 };
15382 gax::paginator::internal::new_paginator(token, execute)
15383 }
15384
15385 pub fn by_item(
15387 self,
15388 ) -> impl gax::paginator::ItemPaginator<crate::model::ListIntentsResponse, gax::error::Error>
15389 {
15390 use gax::paginator::Paginator;
15391 self.by_page().items()
15392 }
15393
15394 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15398 self.0.request.parent = v.into();
15399 self
15400 }
15401
15402 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15404 self.0.request.language_code = v.into();
15405 self
15406 }
15407
15408 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
15410 self.0.request.intent_view = v.into();
15411 self
15412 }
15413
15414 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15416 self.0.request.page_size = v.into();
15417 self
15418 }
15419
15420 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15422 self.0.request.page_token = v.into();
15423 self
15424 }
15425 }
15426
15427 #[doc(hidden)]
15428 impl gax::options::internal::RequestBuilder for ListIntents {
15429 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15430 &mut self.0.options
15431 }
15432 }
15433
15434 #[derive(Clone, Debug)]
15451 pub struct GetIntent(RequestBuilder<crate::model::GetIntentRequest>);
15452
15453 impl GetIntent {
15454 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15455 Self(RequestBuilder::new(stub))
15456 }
15457
15458 pub fn with_request<V: Into<crate::model::GetIntentRequest>>(mut self, v: V) -> Self {
15460 self.0.request = v.into();
15461 self
15462 }
15463
15464 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15466 self.0.options = v.into();
15467 self
15468 }
15469
15470 pub async fn send(self) -> Result<crate::model::Intent> {
15472 (*self.0.stub)
15473 .get_intent(self.0.request, self.0.options)
15474 .await
15475 .map(gax::response::Response::into_body)
15476 }
15477
15478 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15482 self.0.request.name = v.into();
15483 self
15484 }
15485
15486 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15488 self.0.request.language_code = v.into();
15489 self
15490 }
15491
15492 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
15494 self.0.request.intent_view = v.into();
15495 self
15496 }
15497 }
15498
15499 #[doc(hidden)]
15500 impl gax::options::internal::RequestBuilder for GetIntent {
15501 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15502 &mut self.0.options
15503 }
15504 }
15505
15506 #[derive(Clone, Debug)]
15523 pub struct CreateIntent(RequestBuilder<crate::model::CreateIntentRequest>);
15524
15525 impl CreateIntent {
15526 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15527 Self(RequestBuilder::new(stub))
15528 }
15529
15530 pub fn with_request<V: Into<crate::model::CreateIntentRequest>>(mut self, v: V) -> Self {
15532 self.0.request = v.into();
15533 self
15534 }
15535
15536 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15538 self.0.options = v.into();
15539 self
15540 }
15541
15542 pub async fn send(self) -> Result<crate::model::Intent> {
15544 (*self.0.stub)
15545 .create_intent(self.0.request, self.0.options)
15546 .await
15547 .map(gax::response::Response::into_body)
15548 }
15549
15550 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15554 self.0.request.parent = v.into();
15555 self
15556 }
15557
15558 pub fn set_intent<T>(mut self, v: T) -> Self
15562 where
15563 T: std::convert::Into<crate::model::Intent>,
15564 {
15565 self.0.request.intent = std::option::Option::Some(v.into());
15566 self
15567 }
15568
15569 pub fn set_or_clear_intent<T>(mut self, v: std::option::Option<T>) -> Self
15573 where
15574 T: std::convert::Into<crate::model::Intent>,
15575 {
15576 self.0.request.intent = v.map(|x| x.into());
15577 self
15578 }
15579
15580 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15582 self.0.request.language_code = v.into();
15583 self
15584 }
15585
15586 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
15588 self.0.request.intent_view = v.into();
15589 self
15590 }
15591 }
15592
15593 #[doc(hidden)]
15594 impl gax::options::internal::RequestBuilder for CreateIntent {
15595 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15596 &mut self.0.options
15597 }
15598 }
15599
15600 #[derive(Clone, Debug)]
15617 pub struct UpdateIntent(RequestBuilder<crate::model::UpdateIntentRequest>);
15618
15619 impl UpdateIntent {
15620 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15621 Self(RequestBuilder::new(stub))
15622 }
15623
15624 pub fn with_request<V: Into<crate::model::UpdateIntentRequest>>(mut self, v: V) -> Self {
15626 self.0.request = v.into();
15627 self
15628 }
15629
15630 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15632 self.0.options = v.into();
15633 self
15634 }
15635
15636 pub async fn send(self) -> Result<crate::model::Intent> {
15638 (*self.0.stub)
15639 .update_intent(self.0.request, self.0.options)
15640 .await
15641 .map(gax::response::Response::into_body)
15642 }
15643
15644 pub fn set_intent<T>(mut self, v: T) -> Self
15648 where
15649 T: std::convert::Into<crate::model::Intent>,
15650 {
15651 self.0.request.intent = std::option::Option::Some(v.into());
15652 self
15653 }
15654
15655 pub fn set_or_clear_intent<T>(mut self, v: std::option::Option<T>) -> Self
15659 where
15660 T: std::convert::Into<crate::model::Intent>,
15661 {
15662 self.0.request.intent = v.map(|x| x.into());
15663 self
15664 }
15665
15666 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15668 self.0.request.language_code = v.into();
15669 self
15670 }
15671
15672 pub fn set_update_mask<T>(mut self, v: T) -> Self
15674 where
15675 T: std::convert::Into<wkt::FieldMask>,
15676 {
15677 self.0.request.update_mask = std::option::Option::Some(v.into());
15678 self
15679 }
15680
15681 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15683 where
15684 T: std::convert::Into<wkt::FieldMask>,
15685 {
15686 self.0.request.update_mask = v.map(|x| x.into());
15687 self
15688 }
15689
15690 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
15692 self.0.request.intent_view = v.into();
15693 self
15694 }
15695 }
15696
15697 #[doc(hidden)]
15698 impl gax::options::internal::RequestBuilder for UpdateIntent {
15699 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15700 &mut self.0.options
15701 }
15702 }
15703
15704 #[derive(Clone, Debug)]
15721 pub struct DeleteIntent(RequestBuilder<crate::model::DeleteIntentRequest>);
15722
15723 impl DeleteIntent {
15724 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15725 Self(RequestBuilder::new(stub))
15726 }
15727
15728 pub fn with_request<V: Into<crate::model::DeleteIntentRequest>>(mut self, v: V) -> 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 .delete_intent(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 {
15752 self.0.request.name = v.into();
15753 self
15754 }
15755 }
15756
15757 #[doc(hidden)]
15758 impl gax::options::internal::RequestBuilder for DeleteIntent {
15759 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15760 &mut self.0.options
15761 }
15762 }
15763
15764 #[derive(Clone, Debug)]
15782 pub struct BatchUpdateIntents(RequestBuilder<crate::model::BatchUpdateIntentsRequest>);
15783
15784 impl BatchUpdateIntents {
15785 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15786 Self(RequestBuilder::new(stub))
15787 }
15788
15789 pub fn with_request<V: Into<crate::model::BatchUpdateIntentsRequest>>(
15791 mut self,
15792 v: V,
15793 ) -> Self {
15794 self.0.request = v.into();
15795 self
15796 }
15797
15798 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
15800 self.0.options = v.into();
15801 self
15802 }
15803
15804 pub async fn send(self) -> Result<longrunning::model::Operation> {
15811 (*self.0.stub)
15812 .batch_update_intents(self.0.request, self.0.options)
15813 .await
15814 .map(gax::response::Response::into_body)
15815 }
15816
15817 pub fn poller(
15819 self,
15820 ) -> impl lro::Poller<crate::model::BatchUpdateIntentsResponse, wkt::Struct> {
15821 type Operation =
15822 lro::internal::Operation<crate::model::BatchUpdateIntentsResponse, wkt::Struct>;
15823 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15824 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15825
15826 let stub = self.0.stub.clone();
15827 let mut options = self.0.options.clone();
15828 options.set_retry_policy(gax::retry_policy::NeverRetry);
15829 let query = move |name| {
15830 let stub = stub.clone();
15831 let options = options.clone();
15832 async {
15833 let op = GetOperation::new(stub)
15834 .set_name(name)
15835 .with_options(options)
15836 .send()
15837 .await?;
15838 Ok(Operation::new(op))
15839 }
15840 };
15841
15842 let start = move || async {
15843 let op = self.send().await?;
15844 Ok(Operation::new(op))
15845 };
15846
15847 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
15848 }
15849
15850 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15854 self.0.request.parent = v.into();
15855 self
15856 }
15857
15858 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15860 self.0.request.language_code = v.into();
15861 self
15862 }
15863
15864 pub fn set_update_mask<T>(mut self, v: T) -> Self
15866 where
15867 T: std::convert::Into<wkt::FieldMask>,
15868 {
15869 self.0.request.update_mask = std::option::Option::Some(v.into());
15870 self
15871 }
15872
15873 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15875 where
15876 T: std::convert::Into<wkt::FieldMask>,
15877 {
15878 self.0.request.update_mask = v.map(|x| x.into());
15879 self
15880 }
15881
15882 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
15884 self.0.request.intent_view = v.into();
15885 self
15886 }
15887
15888 pub fn set_intent_batch<
15893 T: Into<Option<crate::model::batch_update_intents_request::IntentBatch>>,
15894 >(
15895 mut self,
15896 v: T,
15897 ) -> Self {
15898 self.0.request.intent_batch = v.into();
15899 self
15900 }
15901
15902 pub fn set_intent_batch_uri<T: std::convert::Into<std::string::String>>(
15908 mut self,
15909 v: T,
15910 ) -> Self {
15911 self.0.request = self.0.request.set_intent_batch_uri(v);
15912 self
15913 }
15914
15915 pub fn set_intent_batch_inline<
15921 T: std::convert::Into<std::boxed::Box<crate::model::IntentBatch>>,
15922 >(
15923 mut self,
15924 v: T,
15925 ) -> Self {
15926 self.0.request = self.0.request.set_intent_batch_inline(v);
15927 self
15928 }
15929 }
15930
15931 #[doc(hidden)]
15932 impl gax::options::internal::RequestBuilder for BatchUpdateIntents {
15933 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
15934 &mut self.0.options
15935 }
15936 }
15937
15938 #[derive(Clone, Debug)]
15956 pub struct BatchDeleteIntents(RequestBuilder<crate::model::BatchDeleteIntentsRequest>);
15957
15958 impl BatchDeleteIntents {
15959 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15960 Self(RequestBuilder::new(stub))
15961 }
15962
15963 pub fn with_request<V: Into<crate::model::BatchDeleteIntentsRequest>>(
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<longrunning::model::Operation> {
15985 (*self.0.stub)
15986 .batch_delete_intents(self.0.request, self.0.options)
15987 .await
15988 .map(gax::response::Response::into_body)
15989 }
15990
15991 pub fn poller(self) -> impl lro::Poller<(), wkt::Struct> {
15993 type Operation = lro::internal::Operation<wkt::Empty, wkt::Struct>;
15994 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
15995 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
15996
15997 let stub = self.0.stub.clone();
15998 let mut options = self.0.options.clone();
15999 options.set_retry_policy(gax::retry_policy::NeverRetry);
16000 let query = move |name| {
16001 let stub = stub.clone();
16002 let options = options.clone();
16003 async {
16004 let op = GetOperation::new(stub)
16005 .set_name(name)
16006 .with_options(options)
16007 .send()
16008 .await?;
16009 Ok(Operation::new(op))
16010 }
16011 };
16012
16013 let start = move || async {
16014 let op = self.send().await?;
16015 Ok(Operation::new(op))
16016 };
16017
16018 lro::internal::new_unit_response_poller(
16019 polling_error_policy,
16020 polling_backoff_policy,
16021 start,
16022 query,
16023 )
16024 }
16025
16026 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16030 self.0.request.parent = v.into();
16031 self
16032 }
16033
16034 pub fn set_intents<T, V>(mut self, v: T) -> Self
16038 where
16039 T: std::iter::IntoIterator<Item = V>,
16040 V: std::convert::Into<crate::model::Intent>,
16041 {
16042 use std::iter::Iterator;
16043 self.0.request.intents = v.into_iter().map(|i| i.into()).collect();
16044 self
16045 }
16046 }
16047
16048 #[doc(hidden)]
16049 impl gax::options::internal::RequestBuilder for BatchDeleteIntents {
16050 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16051 &mut self.0.options
16052 }
16053 }
16054
16055 #[derive(Clone, Debug)]
16076 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
16077
16078 impl ListLocations {
16079 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16080 Self(RequestBuilder::new(stub))
16081 }
16082
16083 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
16085 mut self,
16086 v: V,
16087 ) -> Self {
16088 self.0.request = v.into();
16089 self
16090 }
16091
16092 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16094 self.0.options = v.into();
16095 self
16096 }
16097
16098 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
16100 (*self.0.stub)
16101 .list_locations(self.0.request, self.0.options)
16102 .await
16103 .map(gax::response::Response::into_body)
16104 }
16105
16106 pub fn by_page(
16108 self,
16109 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
16110 {
16111 use std::clone::Clone;
16112 let token = self.0.request.page_token.clone();
16113 let execute = move |token: String| {
16114 let mut builder = self.clone();
16115 builder.0.request = builder.0.request.set_page_token(token);
16116 builder.send()
16117 };
16118 gax::paginator::internal::new_paginator(token, execute)
16119 }
16120
16121 pub fn by_item(
16123 self,
16124 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
16125 {
16126 use gax::paginator::Paginator;
16127 self.by_page().items()
16128 }
16129
16130 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16132 self.0.request.name = v.into();
16133 self
16134 }
16135
16136 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16138 self.0.request.filter = v.into();
16139 self
16140 }
16141
16142 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16144 self.0.request.page_size = v.into();
16145 self
16146 }
16147
16148 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16150 self.0.request.page_token = v.into();
16151 self
16152 }
16153 }
16154
16155 #[doc(hidden)]
16156 impl gax::options::internal::RequestBuilder for ListLocations {
16157 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16158 &mut self.0.options
16159 }
16160 }
16161
16162 #[derive(Clone, Debug)]
16179 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
16180
16181 impl GetLocation {
16182 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16183 Self(RequestBuilder::new(stub))
16184 }
16185
16186 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
16188 self.0.request = v.into();
16189 self
16190 }
16191
16192 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16194 self.0.options = v.into();
16195 self
16196 }
16197
16198 pub async fn send(self) -> Result<location::model::Location> {
16200 (*self.0.stub)
16201 .get_location(self.0.request, self.0.options)
16202 .await
16203 .map(gax::response::Response::into_body)
16204 }
16205
16206 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16208 self.0.request.name = v.into();
16209 self
16210 }
16211 }
16212
16213 #[doc(hidden)]
16214 impl gax::options::internal::RequestBuilder for GetLocation {
16215 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16216 &mut self.0.options
16217 }
16218 }
16219
16220 #[derive(Clone, Debug)]
16241 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
16242
16243 impl ListOperations {
16244 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16245 Self(RequestBuilder::new(stub))
16246 }
16247
16248 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
16250 mut self,
16251 v: V,
16252 ) -> Self {
16253 self.0.request = v.into();
16254 self
16255 }
16256
16257 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16259 self.0.options = v.into();
16260 self
16261 }
16262
16263 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
16265 (*self.0.stub)
16266 .list_operations(self.0.request, self.0.options)
16267 .await
16268 .map(gax::response::Response::into_body)
16269 }
16270
16271 pub fn by_page(
16273 self,
16274 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
16275 {
16276 use std::clone::Clone;
16277 let token = self.0.request.page_token.clone();
16278 let execute = move |token: String| {
16279 let mut builder = self.clone();
16280 builder.0.request = builder.0.request.set_page_token(token);
16281 builder.send()
16282 };
16283 gax::paginator::internal::new_paginator(token, execute)
16284 }
16285
16286 pub fn by_item(
16288 self,
16289 ) -> impl gax::paginator::ItemPaginator<
16290 longrunning::model::ListOperationsResponse,
16291 gax::error::Error,
16292 > {
16293 use gax::paginator::Paginator;
16294 self.by_page().items()
16295 }
16296
16297 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16299 self.0.request.name = v.into();
16300 self
16301 }
16302
16303 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16305 self.0.request.filter = v.into();
16306 self
16307 }
16308
16309 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16311 self.0.request.page_size = v.into();
16312 self
16313 }
16314
16315 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16317 self.0.request.page_token = v.into();
16318 self
16319 }
16320
16321 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16323 self.0.request.return_partial_success = v.into();
16324 self
16325 }
16326 }
16327
16328 #[doc(hidden)]
16329 impl gax::options::internal::RequestBuilder for ListOperations {
16330 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16331 &mut self.0.options
16332 }
16333 }
16334
16335 #[derive(Clone, Debug)]
16352 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
16353
16354 impl GetOperation {
16355 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16356 Self(RequestBuilder::new(stub))
16357 }
16358
16359 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
16361 mut self,
16362 v: V,
16363 ) -> Self {
16364 self.0.request = v.into();
16365 self
16366 }
16367
16368 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16370 self.0.options = v.into();
16371 self
16372 }
16373
16374 pub async fn send(self) -> Result<longrunning::model::Operation> {
16376 (*self.0.stub)
16377 .get_operation(self.0.request, self.0.options)
16378 .await
16379 .map(gax::response::Response::into_body)
16380 }
16381
16382 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16384 self.0.request.name = v.into();
16385 self
16386 }
16387 }
16388
16389 #[doc(hidden)]
16390 impl gax::options::internal::RequestBuilder for GetOperation {
16391 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16392 &mut self.0.options
16393 }
16394 }
16395
16396 #[derive(Clone, Debug)]
16413 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
16414
16415 impl CancelOperation {
16416 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16417 Self(RequestBuilder::new(stub))
16418 }
16419
16420 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
16422 mut self,
16423 v: V,
16424 ) -> Self {
16425 self.0.request = v.into();
16426 self
16427 }
16428
16429 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16431 self.0.options = v.into();
16432 self
16433 }
16434
16435 pub async fn send(self) -> Result<()> {
16437 (*self.0.stub)
16438 .cancel_operation(self.0.request, self.0.options)
16439 .await
16440 .map(gax::response::Response::into_body)
16441 }
16442
16443 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16445 self.0.request.name = v.into();
16446 self
16447 }
16448 }
16449
16450 #[doc(hidden)]
16451 impl gax::options::internal::RequestBuilder for CancelOperation {
16452 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16453 &mut self.0.options
16454 }
16455 }
16456}
16457
16458#[cfg(feature = "knowledge-bases")]
16459#[cfg_attr(docsrs, doc(cfg(feature = "knowledge-bases")))]
16460pub mod knowledge_bases {
16461 use crate::Result;
16462
16463 pub type ClientBuilder =
16477 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16478
16479 pub(crate) mod client {
16480 use super::super::super::client::KnowledgeBases;
16481 pub struct Factory;
16482 impl gax::client_builder::internal::ClientFactory for Factory {
16483 type Client = KnowledgeBases;
16484 type Credentials = gaxi::options::Credentials;
16485 async fn build(
16486 self,
16487 config: gaxi::options::ClientConfig,
16488 ) -> gax::client_builder::Result<Self::Client> {
16489 Self::Client::new(config).await
16490 }
16491 }
16492 }
16493
16494 #[derive(Clone, Debug)]
16496 pub(crate) struct RequestBuilder<R: std::default::Default> {
16497 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16498 request: R,
16499 options: gax::options::RequestOptions,
16500 }
16501
16502 impl<R> RequestBuilder<R>
16503 where
16504 R: std::default::Default,
16505 {
16506 pub(crate) fn new(
16507 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16508 ) -> Self {
16509 Self {
16510 stub,
16511 request: R::default(),
16512 options: gax::options::RequestOptions::default(),
16513 }
16514 }
16515 }
16516
16517 #[derive(Clone, Debug)]
16538 pub struct ListKnowledgeBases(RequestBuilder<crate::model::ListKnowledgeBasesRequest>);
16539
16540 impl ListKnowledgeBases {
16541 pub(crate) fn new(
16542 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16543 ) -> Self {
16544 Self(RequestBuilder::new(stub))
16545 }
16546
16547 pub fn with_request<V: Into<crate::model::ListKnowledgeBasesRequest>>(
16549 mut self,
16550 v: V,
16551 ) -> Self {
16552 self.0.request = v.into();
16553 self
16554 }
16555
16556 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16558 self.0.options = v.into();
16559 self
16560 }
16561
16562 pub async fn send(self) -> Result<crate::model::ListKnowledgeBasesResponse> {
16564 (*self.0.stub)
16565 .list_knowledge_bases(self.0.request, self.0.options)
16566 .await
16567 .map(gax::response::Response::into_body)
16568 }
16569
16570 pub fn by_page(
16572 self,
16573 ) -> impl gax::paginator::Paginator<crate::model::ListKnowledgeBasesResponse, gax::error::Error>
16574 {
16575 use std::clone::Clone;
16576 let token = self.0.request.page_token.clone();
16577 let execute = move |token: String| {
16578 let mut builder = self.clone();
16579 builder.0.request = builder.0.request.set_page_token(token);
16580 builder.send()
16581 };
16582 gax::paginator::internal::new_paginator(token, execute)
16583 }
16584
16585 pub fn by_item(
16587 self,
16588 ) -> impl gax::paginator::ItemPaginator<
16589 crate::model::ListKnowledgeBasesResponse,
16590 gax::error::Error,
16591 > {
16592 use gax::paginator::Paginator;
16593 self.by_page().items()
16594 }
16595
16596 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16600 self.0.request.parent = v.into();
16601 self
16602 }
16603
16604 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16606 self.0.request.page_size = v.into();
16607 self
16608 }
16609
16610 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16612 self.0.request.page_token = v.into();
16613 self
16614 }
16615
16616 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16618 self.0.request.filter = v.into();
16619 self
16620 }
16621 }
16622
16623 #[doc(hidden)]
16624 impl gax::options::internal::RequestBuilder for ListKnowledgeBases {
16625 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16626 &mut self.0.options
16627 }
16628 }
16629
16630 #[derive(Clone, Debug)]
16647 pub struct GetKnowledgeBase(RequestBuilder<crate::model::GetKnowledgeBaseRequest>);
16648
16649 impl GetKnowledgeBase {
16650 pub(crate) fn new(
16651 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16652 ) -> Self {
16653 Self(RequestBuilder::new(stub))
16654 }
16655
16656 pub fn with_request<V: Into<crate::model::GetKnowledgeBaseRequest>>(
16658 mut self,
16659 v: V,
16660 ) -> Self {
16661 self.0.request = v.into();
16662 self
16663 }
16664
16665 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16667 self.0.options = v.into();
16668 self
16669 }
16670
16671 pub async fn send(self) -> Result<crate::model::KnowledgeBase> {
16673 (*self.0.stub)
16674 .get_knowledge_base(self.0.request, self.0.options)
16675 .await
16676 .map(gax::response::Response::into_body)
16677 }
16678
16679 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16683 self.0.request.name = v.into();
16684 self
16685 }
16686 }
16687
16688 #[doc(hidden)]
16689 impl gax::options::internal::RequestBuilder for GetKnowledgeBase {
16690 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16691 &mut self.0.options
16692 }
16693 }
16694
16695 #[derive(Clone, Debug)]
16712 pub struct CreateKnowledgeBase(RequestBuilder<crate::model::CreateKnowledgeBaseRequest>);
16713
16714 impl CreateKnowledgeBase {
16715 pub(crate) fn new(
16716 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16717 ) -> Self {
16718 Self(RequestBuilder::new(stub))
16719 }
16720
16721 pub fn with_request<V: Into<crate::model::CreateKnowledgeBaseRequest>>(
16723 mut self,
16724 v: V,
16725 ) -> Self {
16726 self.0.request = v.into();
16727 self
16728 }
16729
16730 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16732 self.0.options = v.into();
16733 self
16734 }
16735
16736 pub async fn send(self) -> Result<crate::model::KnowledgeBase> {
16738 (*self.0.stub)
16739 .create_knowledge_base(self.0.request, self.0.options)
16740 .await
16741 .map(gax::response::Response::into_body)
16742 }
16743
16744 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16748 self.0.request.parent = v.into();
16749 self
16750 }
16751
16752 pub fn set_knowledge_base<T>(mut self, v: T) -> Self
16756 where
16757 T: std::convert::Into<crate::model::KnowledgeBase>,
16758 {
16759 self.0.request.knowledge_base = std::option::Option::Some(v.into());
16760 self
16761 }
16762
16763 pub fn set_or_clear_knowledge_base<T>(mut self, v: std::option::Option<T>) -> Self
16767 where
16768 T: std::convert::Into<crate::model::KnowledgeBase>,
16769 {
16770 self.0.request.knowledge_base = v.map(|x| x.into());
16771 self
16772 }
16773 }
16774
16775 #[doc(hidden)]
16776 impl gax::options::internal::RequestBuilder for CreateKnowledgeBase {
16777 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16778 &mut self.0.options
16779 }
16780 }
16781
16782 #[derive(Clone, Debug)]
16799 pub struct DeleteKnowledgeBase(RequestBuilder<crate::model::DeleteKnowledgeBaseRequest>);
16800
16801 impl DeleteKnowledgeBase {
16802 pub(crate) fn new(
16803 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16804 ) -> Self {
16805 Self(RequestBuilder::new(stub))
16806 }
16807
16808 pub fn with_request<V: Into<crate::model::DeleteKnowledgeBaseRequest>>(
16810 mut self,
16811 v: V,
16812 ) -> Self {
16813 self.0.request = v.into();
16814 self
16815 }
16816
16817 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16819 self.0.options = v.into();
16820 self
16821 }
16822
16823 pub async fn send(self) -> Result<()> {
16825 (*self.0.stub)
16826 .delete_knowledge_base(self.0.request, self.0.options)
16827 .await
16828 .map(gax::response::Response::into_body)
16829 }
16830
16831 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16835 self.0.request.name = v.into();
16836 self
16837 }
16838
16839 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
16841 self.0.request.force = v.into();
16842 self
16843 }
16844 }
16845
16846 #[doc(hidden)]
16847 impl gax::options::internal::RequestBuilder for DeleteKnowledgeBase {
16848 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16849 &mut self.0.options
16850 }
16851 }
16852
16853 #[derive(Clone, Debug)]
16870 pub struct UpdateKnowledgeBase(RequestBuilder<crate::model::UpdateKnowledgeBaseRequest>);
16871
16872 impl UpdateKnowledgeBase {
16873 pub(crate) fn new(
16874 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16875 ) -> Self {
16876 Self(RequestBuilder::new(stub))
16877 }
16878
16879 pub fn with_request<V: Into<crate::model::UpdateKnowledgeBaseRequest>>(
16881 mut self,
16882 v: V,
16883 ) -> Self {
16884 self.0.request = v.into();
16885 self
16886 }
16887
16888 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16890 self.0.options = v.into();
16891 self
16892 }
16893
16894 pub async fn send(self) -> Result<crate::model::KnowledgeBase> {
16896 (*self.0.stub)
16897 .update_knowledge_base(self.0.request, self.0.options)
16898 .await
16899 .map(gax::response::Response::into_body)
16900 }
16901
16902 pub fn set_knowledge_base<T>(mut self, v: T) -> Self
16906 where
16907 T: std::convert::Into<crate::model::KnowledgeBase>,
16908 {
16909 self.0.request.knowledge_base = std::option::Option::Some(v.into());
16910 self
16911 }
16912
16913 pub fn set_or_clear_knowledge_base<T>(mut self, v: std::option::Option<T>) -> Self
16917 where
16918 T: std::convert::Into<crate::model::KnowledgeBase>,
16919 {
16920 self.0.request.knowledge_base = v.map(|x| x.into());
16921 self
16922 }
16923
16924 pub fn set_update_mask<T>(mut self, v: T) -> Self
16926 where
16927 T: std::convert::Into<wkt::FieldMask>,
16928 {
16929 self.0.request.update_mask = std::option::Option::Some(v.into());
16930 self
16931 }
16932
16933 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
16935 where
16936 T: std::convert::Into<wkt::FieldMask>,
16937 {
16938 self.0.request.update_mask = v.map(|x| x.into());
16939 self
16940 }
16941 }
16942
16943 #[doc(hidden)]
16944 impl gax::options::internal::RequestBuilder for UpdateKnowledgeBase {
16945 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
16946 &mut self.0.options
16947 }
16948 }
16949
16950 #[derive(Clone, Debug)]
16971 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
16972
16973 impl ListLocations {
16974 pub(crate) fn new(
16975 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16976 ) -> Self {
16977 Self(RequestBuilder::new(stub))
16978 }
16979
16980 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
16982 mut self,
16983 v: V,
16984 ) -> Self {
16985 self.0.request = v.into();
16986 self
16987 }
16988
16989 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
16991 self.0.options = v.into();
16992 self
16993 }
16994
16995 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
16997 (*self.0.stub)
16998 .list_locations(self.0.request, self.0.options)
16999 .await
17000 .map(gax::response::Response::into_body)
17001 }
17002
17003 pub fn by_page(
17005 self,
17006 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
17007 {
17008 use std::clone::Clone;
17009 let token = self.0.request.page_token.clone();
17010 let execute = move |token: String| {
17011 let mut builder = self.clone();
17012 builder.0.request = builder.0.request.set_page_token(token);
17013 builder.send()
17014 };
17015 gax::paginator::internal::new_paginator(token, execute)
17016 }
17017
17018 pub fn by_item(
17020 self,
17021 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
17022 {
17023 use gax::paginator::Paginator;
17024 self.by_page().items()
17025 }
17026
17027 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17029 self.0.request.name = v.into();
17030 self
17031 }
17032
17033 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17035 self.0.request.filter = v.into();
17036 self
17037 }
17038
17039 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17041 self.0.request.page_size = v.into();
17042 self
17043 }
17044
17045 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17047 self.0.request.page_token = v.into();
17048 self
17049 }
17050 }
17051
17052 #[doc(hidden)]
17053 impl gax::options::internal::RequestBuilder for ListLocations {
17054 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17055 &mut self.0.options
17056 }
17057 }
17058
17059 #[derive(Clone, Debug)]
17076 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
17077
17078 impl GetLocation {
17079 pub(crate) fn new(
17080 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17081 ) -> Self {
17082 Self(RequestBuilder::new(stub))
17083 }
17084
17085 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
17087 self.0.request = v.into();
17088 self
17089 }
17090
17091 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17093 self.0.options = v.into();
17094 self
17095 }
17096
17097 pub async fn send(self) -> Result<location::model::Location> {
17099 (*self.0.stub)
17100 .get_location(self.0.request, self.0.options)
17101 .await
17102 .map(gax::response::Response::into_body)
17103 }
17104
17105 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17107 self.0.request.name = v.into();
17108 self
17109 }
17110 }
17111
17112 #[doc(hidden)]
17113 impl gax::options::internal::RequestBuilder for GetLocation {
17114 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17115 &mut self.0.options
17116 }
17117 }
17118
17119 #[derive(Clone, Debug)]
17140 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
17141
17142 impl ListOperations {
17143 pub(crate) fn new(
17144 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17145 ) -> Self {
17146 Self(RequestBuilder::new(stub))
17147 }
17148
17149 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
17151 mut self,
17152 v: V,
17153 ) -> Self {
17154 self.0.request = v.into();
17155 self
17156 }
17157
17158 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17160 self.0.options = v.into();
17161 self
17162 }
17163
17164 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
17166 (*self.0.stub)
17167 .list_operations(self.0.request, self.0.options)
17168 .await
17169 .map(gax::response::Response::into_body)
17170 }
17171
17172 pub fn by_page(
17174 self,
17175 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
17176 {
17177 use std::clone::Clone;
17178 let token = self.0.request.page_token.clone();
17179 let execute = move |token: String| {
17180 let mut builder = self.clone();
17181 builder.0.request = builder.0.request.set_page_token(token);
17182 builder.send()
17183 };
17184 gax::paginator::internal::new_paginator(token, execute)
17185 }
17186
17187 pub fn by_item(
17189 self,
17190 ) -> impl gax::paginator::ItemPaginator<
17191 longrunning::model::ListOperationsResponse,
17192 gax::error::Error,
17193 > {
17194 use gax::paginator::Paginator;
17195 self.by_page().items()
17196 }
17197
17198 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17200 self.0.request.name = v.into();
17201 self
17202 }
17203
17204 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17206 self.0.request.filter = v.into();
17207 self
17208 }
17209
17210 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17212 self.0.request.page_size = v.into();
17213 self
17214 }
17215
17216 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17218 self.0.request.page_token = v.into();
17219 self
17220 }
17221
17222 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17224 self.0.request.return_partial_success = v.into();
17225 self
17226 }
17227 }
17228
17229 #[doc(hidden)]
17230 impl gax::options::internal::RequestBuilder for ListOperations {
17231 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17232 &mut self.0.options
17233 }
17234 }
17235
17236 #[derive(Clone, Debug)]
17253 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
17254
17255 impl GetOperation {
17256 pub(crate) fn new(
17257 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17258 ) -> Self {
17259 Self(RequestBuilder::new(stub))
17260 }
17261
17262 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
17264 mut self,
17265 v: V,
17266 ) -> Self {
17267 self.0.request = v.into();
17268 self
17269 }
17270
17271 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17273 self.0.options = v.into();
17274 self
17275 }
17276
17277 pub async fn send(self) -> Result<longrunning::model::Operation> {
17279 (*self.0.stub)
17280 .get_operation(self.0.request, self.0.options)
17281 .await
17282 .map(gax::response::Response::into_body)
17283 }
17284
17285 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17287 self.0.request.name = v.into();
17288 self
17289 }
17290 }
17291
17292 #[doc(hidden)]
17293 impl gax::options::internal::RequestBuilder for GetOperation {
17294 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17295 &mut self.0.options
17296 }
17297 }
17298
17299 #[derive(Clone, Debug)]
17316 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
17317
17318 impl CancelOperation {
17319 pub(crate) fn new(
17320 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17321 ) -> Self {
17322 Self(RequestBuilder::new(stub))
17323 }
17324
17325 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
17327 mut self,
17328 v: V,
17329 ) -> Self {
17330 self.0.request = v.into();
17331 self
17332 }
17333
17334 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17336 self.0.options = v.into();
17337 self
17338 }
17339
17340 pub async fn send(self) -> Result<()> {
17342 (*self.0.stub)
17343 .cancel_operation(self.0.request, self.0.options)
17344 .await
17345 .map(gax::response::Response::into_body)
17346 }
17347
17348 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17350 self.0.request.name = v.into();
17351 self
17352 }
17353 }
17354
17355 #[doc(hidden)]
17356 impl gax::options::internal::RequestBuilder for CancelOperation {
17357 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17358 &mut self.0.options
17359 }
17360 }
17361}
17362
17363#[cfg(feature = "participants")]
17364#[cfg_attr(docsrs, doc(cfg(feature = "participants")))]
17365pub mod participants {
17366 use crate::Result;
17367
17368 pub type ClientBuilder =
17382 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
17383
17384 pub(crate) mod client {
17385 use super::super::super::client::Participants;
17386 pub struct Factory;
17387 impl gax::client_builder::internal::ClientFactory for Factory {
17388 type Client = Participants;
17389 type Credentials = gaxi::options::Credentials;
17390 async fn build(
17391 self,
17392 config: gaxi::options::ClientConfig,
17393 ) -> gax::client_builder::Result<Self::Client> {
17394 Self::Client::new(config).await
17395 }
17396 }
17397 }
17398
17399 #[derive(Clone, Debug)]
17401 pub(crate) struct RequestBuilder<R: std::default::Default> {
17402 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17403 request: R,
17404 options: gax::options::RequestOptions,
17405 }
17406
17407 impl<R> RequestBuilder<R>
17408 where
17409 R: std::default::Default,
17410 {
17411 pub(crate) fn new(
17412 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17413 ) -> Self {
17414 Self {
17415 stub,
17416 request: R::default(),
17417 options: gax::options::RequestOptions::default(),
17418 }
17419 }
17420 }
17421
17422 #[derive(Clone, Debug)]
17439 pub struct CreateParticipant(RequestBuilder<crate::model::CreateParticipantRequest>);
17440
17441 impl CreateParticipant {
17442 pub(crate) fn new(
17443 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17444 ) -> Self {
17445 Self(RequestBuilder::new(stub))
17446 }
17447
17448 pub fn with_request<V: Into<crate::model::CreateParticipantRequest>>(
17450 mut self,
17451 v: V,
17452 ) -> Self {
17453 self.0.request = v.into();
17454 self
17455 }
17456
17457 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17459 self.0.options = v.into();
17460 self
17461 }
17462
17463 pub async fn send(self) -> Result<crate::model::Participant> {
17465 (*self.0.stub)
17466 .create_participant(self.0.request, self.0.options)
17467 .await
17468 .map(gax::response::Response::into_body)
17469 }
17470
17471 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17475 self.0.request.parent = v.into();
17476 self
17477 }
17478
17479 pub fn set_participant<T>(mut self, v: T) -> Self
17483 where
17484 T: std::convert::Into<crate::model::Participant>,
17485 {
17486 self.0.request.participant = std::option::Option::Some(v.into());
17487 self
17488 }
17489
17490 pub fn set_or_clear_participant<T>(mut self, v: std::option::Option<T>) -> Self
17494 where
17495 T: std::convert::Into<crate::model::Participant>,
17496 {
17497 self.0.request.participant = v.map(|x| x.into());
17498 self
17499 }
17500 }
17501
17502 #[doc(hidden)]
17503 impl gax::options::internal::RequestBuilder for CreateParticipant {
17504 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17505 &mut self.0.options
17506 }
17507 }
17508
17509 #[derive(Clone, Debug)]
17526 pub struct GetParticipant(RequestBuilder<crate::model::GetParticipantRequest>);
17527
17528 impl GetParticipant {
17529 pub(crate) fn new(
17530 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17531 ) -> Self {
17532 Self(RequestBuilder::new(stub))
17533 }
17534
17535 pub fn with_request<V: Into<crate::model::GetParticipantRequest>>(mut self, v: V) -> Self {
17537 self.0.request = v.into();
17538 self
17539 }
17540
17541 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17543 self.0.options = v.into();
17544 self
17545 }
17546
17547 pub async fn send(self) -> Result<crate::model::Participant> {
17549 (*self.0.stub)
17550 .get_participant(self.0.request, self.0.options)
17551 .await
17552 .map(gax::response::Response::into_body)
17553 }
17554
17555 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17559 self.0.request.name = v.into();
17560 self
17561 }
17562 }
17563
17564 #[doc(hidden)]
17565 impl gax::options::internal::RequestBuilder for GetParticipant {
17566 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17567 &mut self.0.options
17568 }
17569 }
17570
17571 #[derive(Clone, Debug)]
17592 pub struct ListParticipants(RequestBuilder<crate::model::ListParticipantsRequest>);
17593
17594 impl ListParticipants {
17595 pub(crate) fn new(
17596 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17597 ) -> Self {
17598 Self(RequestBuilder::new(stub))
17599 }
17600
17601 pub fn with_request<V: Into<crate::model::ListParticipantsRequest>>(
17603 mut self,
17604 v: V,
17605 ) -> Self {
17606 self.0.request = v.into();
17607 self
17608 }
17609
17610 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17612 self.0.options = v.into();
17613 self
17614 }
17615
17616 pub async fn send(self) -> Result<crate::model::ListParticipantsResponse> {
17618 (*self.0.stub)
17619 .list_participants(self.0.request, self.0.options)
17620 .await
17621 .map(gax::response::Response::into_body)
17622 }
17623
17624 pub fn by_page(
17626 self,
17627 ) -> impl gax::paginator::Paginator<crate::model::ListParticipantsResponse, gax::error::Error>
17628 {
17629 use std::clone::Clone;
17630 let token = self.0.request.page_token.clone();
17631 let execute = move |token: String| {
17632 let mut builder = self.clone();
17633 builder.0.request = builder.0.request.set_page_token(token);
17634 builder.send()
17635 };
17636 gax::paginator::internal::new_paginator(token, execute)
17637 }
17638
17639 pub fn by_item(
17641 self,
17642 ) -> impl gax::paginator::ItemPaginator<crate::model::ListParticipantsResponse, gax::error::Error>
17643 {
17644 use gax::paginator::Paginator;
17645 self.by_page().items()
17646 }
17647
17648 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17652 self.0.request.parent = v.into();
17653 self
17654 }
17655
17656 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17658 self.0.request.page_size = v.into();
17659 self
17660 }
17661
17662 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17664 self.0.request.page_token = v.into();
17665 self
17666 }
17667 }
17668
17669 #[doc(hidden)]
17670 impl gax::options::internal::RequestBuilder for ListParticipants {
17671 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17672 &mut self.0.options
17673 }
17674 }
17675
17676 #[derive(Clone, Debug)]
17693 pub struct UpdateParticipant(RequestBuilder<crate::model::UpdateParticipantRequest>);
17694
17695 impl UpdateParticipant {
17696 pub(crate) fn new(
17697 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17698 ) -> Self {
17699 Self(RequestBuilder::new(stub))
17700 }
17701
17702 pub fn with_request<V: Into<crate::model::UpdateParticipantRequest>>(
17704 mut self,
17705 v: V,
17706 ) -> Self {
17707 self.0.request = v.into();
17708 self
17709 }
17710
17711 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17713 self.0.options = v.into();
17714 self
17715 }
17716
17717 pub async fn send(self) -> Result<crate::model::Participant> {
17719 (*self.0.stub)
17720 .update_participant(self.0.request, self.0.options)
17721 .await
17722 .map(gax::response::Response::into_body)
17723 }
17724
17725 pub fn set_participant<T>(mut self, v: T) -> Self
17729 where
17730 T: std::convert::Into<crate::model::Participant>,
17731 {
17732 self.0.request.participant = std::option::Option::Some(v.into());
17733 self
17734 }
17735
17736 pub fn set_or_clear_participant<T>(mut self, v: std::option::Option<T>) -> Self
17740 where
17741 T: std::convert::Into<crate::model::Participant>,
17742 {
17743 self.0.request.participant = v.map(|x| x.into());
17744 self
17745 }
17746
17747 pub fn set_update_mask<T>(mut self, v: T) -> Self
17751 where
17752 T: std::convert::Into<wkt::FieldMask>,
17753 {
17754 self.0.request.update_mask = std::option::Option::Some(v.into());
17755 self
17756 }
17757
17758 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17762 where
17763 T: std::convert::Into<wkt::FieldMask>,
17764 {
17765 self.0.request.update_mask = v.map(|x| x.into());
17766 self
17767 }
17768 }
17769
17770 #[doc(hidden)]
17771 impl gax::options::internal::RequestBuilder for UpdateParticipant {
17772 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17773 &mut self.0.options
17774 }
17775 }
17776
17777 #[derive(Clone, Debug)]
17794 pub struct AnalyzeContent(RequestBuilder<crate::model::AnalyzeContentRequest>);
17795
17796 impl AnalyzeContent {
17797 pub(crate) fn new(
17798 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17799 ) -> Self {
17800 Self(RequestBuilder::new(stub))
17801 }
17802
17803 pub fn with_request<V: Into<crate::model::AnalyzeContentRequest>>(mut self, v: V) -> Self {
17805 self.0.request = v.into();
17806 self
17807 }
17808
17809 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
17811 self.0.options = v.into();
17812 self
17813 }
17814
17815 pub async fn send(self) -> Result<crate::model::AnalyzeContentResponse> {
17817 (*self.0.stub)
17818 .analyze_content(self.0.request, self.0.options)
17819 .await
17820 .map(gax::response::Response::into_body)
17821 }
17822
17823 pub fn set_participant<T: Into<std::string::String>>(mut self, v: T) -> Self {
17827 self.0.request.participant = v.into();
17828 self
17829 }
17830
17831 pub fn set_reply_audio_config<T>(mut self, v: T) -> Self
17833 where
17834 T: std::convert::Into<crate::model::OutputAudioConfig>,
17835 {
17836 self.0.request.reply_audio_config = std::option::Option::Some(v.into());
17837 self
17838 }
17839
17840 pub fn set_or_clear_reply_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
17842 where
17843 T: std::convert::Into<crate::model::OutputAudioConfig>,
17844 {
17845 self.0.request.reply_audio_config = v.map(|x| x.into());
17846 self
17847 }
17848
17849 pub fn set_query_params<T>(mut self, v: T) -> Self
17851 where
17852 T: std::convert::Into<crate::model::QueryParameters>,
17853 {
17854 self.0.request.query_params = std::option::Option::Some(v.into());
17855 self
17856 }
17857
17858 pub fn set_or_clear_query_params<T>(mut self, v: std::option::Option<T>) -> Self
17860 where
17861 T: std::convert::Into<crate::model::QueryParameters>,
17862 {
17863 self.0.request.query_params = v.map(|x| x.into());
17864 self
17865 }
17866
17867 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
17869 where
17870 T: std::convert::Into<crate::model::AssistQueryParameters>,
17871 {
17872 self.0.request.assist_query_params = std::option::Option::Some(v.into());
17873 self
17874 }
17875
17876 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
17878 where
17879 T: std::convert::Into<crate::model::AssistQueryParameters>,
17880 {
17881 self.0.request.assist_query_params = v.map(|x| x.into());
17882 self
17883 }
17884
17885 pub fn set_cx_parameters<T>(mut self, v: T) -> Self
17887 where
17888 T: std::convert::Into<wkt::Struct>,
17889 {
17890 self.0.request.cx_parameters = std::option::Option::Some(v.into());
17891 self
17892 }
17893
17894 pub fn set_or_clear_cx_parameters<T>(mut self, v: std::option::Option<T>) -> Self
17896 where
17897 T: std::convert::Into<wkt::Struct>,
17898 {
17899 self.0.request.cx_parameters = v.map(|x| x.into());
17900 self
17901 }
17902
17903 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
17905 self.0.request.request_id = v.into();
17906 self
17907 }
17908
17909 pub fn set_input<T: Into<Option<crate::model::analyze_content_request::Input>>>(
17914 mut self,
17915 v: T,
17916 ) -> Self {
17917 self.0.request.input = v.into();
17918 self
17919 }
17920
17921 pub fn set_text_input<T: std::convert::Into<std::boxed::Box<crate::model::TextInput>>>(
17927 mut self,
17928 v: T,
17929 ) -> Self {
17930 self.0.request = self.0.request.set_text_input(v);
17931 self
17932 }
17933
17934 pub fn set_audio_input<T: std::convert::Into<std::boxed::Box<crate::model::AudioInput>>>(
17940 mut self,
17941 v: T,
17942 ) -> Self {
17943 self.0.request = self.0.request.set_audio_input(v);
17944 self
17945 }
17946
17947 pub fn set_event_input<T: std::convert::Into<std::boxed::Box<crate::model::EventInput>>>(
17953 mut self,
17954 v: T,
17955 ) -> Self {
17956 self.0.request = self.0.request.set_event_input(v);
17957 self
17958 }
17959
17960 pub fn set_suggestion_input<
17966 T: std::convert::Into<std::boxed::Box<crate::model::SuggestionInput>>,
17967 >(
17968 mut self,
17969 v: T,
17970 ) -> Self {
17971 self.0.request = self.0.request.set_suggestion_input(v);
17972 self
17973 }
17974 }
17975
17976 #[doc(hidden)]
17977 impl gax::options::internal::RequestBuilder for AnalyzeContent {
17978 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
17979 &mut self.0.options
17980 }
17981 }
17982
17983 #[derive(Clone, Debug)]
18000 pub struct SuggestArticles(RequestBuilder<crate::model::SuggestArticlesRequest>);
18001
18002 impl SuggestArticles {
18003 pub(crate) fn new(
18004 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18005 ) -> Self {
18006 Self(RequestBuilder::new(stub))
18007 }
18008
18009 pub fn with_request<V: Into<crate::model::SuggestArticlesRequest>>(mut self, v: V) -> Self {
18011 self.0.request = v.into();
18012 self
18013 }
18014
18015 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18017 self.0.options = v.into();
18018 self
18019 }
18020
18021 pub async fn send(self) -> Result<crate::model::SuggestArticlesResponse> {
18023 (*self.0.stub)
18024 .suggest_articles(self.0.request, self.0.options)
18025 .await
18026 .map(gax::response::Response::into_body)
18027 }
18028
18029 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18033 self.0.request.parent = v.into();
18034 self
18035 }
18036
18037 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
18039 self.0.request.latest_message = v.into();
18040 self
18041 }
18042
18043 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
18045 self.0.request.context_size = v.into();
18046 self
18047 }
18048
18049 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
18051 where
18052 T: std::convert::Into<crate::model::AssistQueryParameters>,
18053 {
18054 self.0.request.assist_query_params = std::option::Option::Some(v.into());
18055 self
18056 }
18057
18058 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
18060 where
18061 T: std::convert::Into<crate::model::AssistQueryParameters>,
18062 {
18063 self.0.request.assist_query_params = v.map(|x| x.into());
18064 self
18065 }
18066 }
18067
18068 #[doc(hidden)]
18069 impl gax::options::internal::RequestBuilder for SuggestArticles {
18070 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18071 &mut self.0.options
18072 }
18073 }
18074
18075 #[derive(Clone, Debug)]
18092 pub struct SuggestFaqAnswers(RequestBuilder<crate::model::SuggestFaqAnswersRequest>);
18093
18094 impl SuggestFaqAnswers {
18095 pub(crate) fn new(
18096 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18097 ) -> Self {
18098 Self(RequestBuilder::new(stub))
18099 }
18100
18101 pub fn with_request<V: Into<crate::model::SuggestFaqAnswersRequest>>(
18103 mut self,
18104 v: V,
18105 ) -> Self {
18106 self.0.request = v.into();
18107 self
18108 }
18109
18110 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18112 self.0.options = v.into();
18113 self
18114 }
18115
18116 pub async fn send(self) -> Result<crate::model::SuggestFaqAnswersResponse> {
18118 (*self.0.stub)
18119 .suggest_faq_answers(self.0.request, self.0.options)
18120 .await
18121 .map(gax::response::Response::into_body)
18122 }
18123
18124 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18128 self.0.request.parent = v.into();
18129 self
18130 }
18131
18132 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
18134 self.0.request.latest_message = v.into();
18135 self
18136 }
18137
18138 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
18140 self.0.request.context_size = v.into();
18141 self
18142 }
18143
18144 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
18146 where
18147 T: std::convert::Into<crate::model::AssistQueryParameters>,
18148 {
18149 self.0.request.assist_query_params = std::option::Option::Some(v.into());
18150 self
18151 }
18152
18153 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
18155 where
18156 T: std::convert::Into<crate::model::AssistQueryParameters>,
18157 {
18158 self.0.request.assist_query_params = v.map(|x| x.into());
18159 self
18160 }
18161 }
18162
18163 #[doc(hidden)]
18164 impl gax::options::internal::RequestBuilder for SuggestFaqAnswers {
18165 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18166 &mut self.0.options
18167 }
18168 }
18169
18170 #[derive(Clone, Debug)]
18187 pub struct SuggestSmartReplies(RequestBuilder<crate::model::SuggestSmartRepliesRequest>);
18188
18189 impl SuggestSmartReplies {
18190 pub(crate) fn new(
18191 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18192 ) -> Self {
18193 Self(RequestBuilder::new(stub))
18194 }
18195
18196 pub fn with_request<V: Into<crate::model::SuggestSmartRepliesRequest>>(
18198 mut self,
18199 v: V,
18200 ) -> Self {
18201 self.0.request = v.into();
18202 self
18203 }
18204
18205 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18207 self.0.options = v.into();
18208 self
18209 }
18210
18211 pub async fn send(self) -> Result<crate::model::SuggestSmartRepliesResponse> {
18213 (*self.0.stub)
18214 .suggest_smart_replies(self.0.request, self.0.options)
18215 .await
18216 .map(gax::response::Response::into_body)
18217 }
18218
18219 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18223 self.0.request.parent = v.into();
18224 self
18225 }
18226
18227 pub fn set_current_text_input<T>(mut self, v: T) -> Self
18229 where
18230 T: std::convert::Into<crate::model::TextInput>,
18231 {
18232 self.0.request.current_text_input = std::option::Option::Some(v.into());
18233 self
18234 }
18235
18236 pub fn set_or_clear_current_text_input<T>(mut self, v: std::option::Option<T>) -> Self
18238 where
18239 T: std::convert::Into<crate::model::TextInput>,
18240 {
18241 self.0.request.current_text_input = v.map(|x| x.into());
18242 self
18243 }
18244
18245 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
18247 self.0.request.latest_message = v.into();
18248 self
18249 }
18250
18251 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
18253 self.0.request.context_size = v.into();
18254 self
18255 }
18256 }
18257
18258 #[doc(hidden)]
18259 impl gax::options::internal::RequestBuilder for SuggestSmartReplies {
18260 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18261 &mut self.0.options
18262 }
18263 }
18264
18265 #[derive(Clone, Debug)]
18282 pub struct SuggestKnowledgeAssist(RequestBuilder<crate::model::SuggestKnowledgeAssistRequest>);
18283
18284 impl SuggestKnowledgeAssist {
18285 pub(crate) fn new(
18286 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18287 ) -> Self {
18288 Self(RequestBuilder::new(stub))
18289 }
18290
18291 pub fn with_request<V: Into<crate::model::SuggestKnowledgeAssistRequest>>(
18293 mut self,
18294 v: V,
18295 ) -> Self {
18296 self.0.request = v.into();
18297 self
18298 }
18299
18300 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18302 self.0.options = v.into();
18303 self
18304 }
18305
18306 pub async fn send(self) -> Result<crate::model::SuggestKnowledgeAssistResponse> {
18308 (*self.0.stub)
18309 .suggest_knowledge_assist(self.0.request, self.0.options)
18310 .await
18311 .map(gax::response::Response::into_body)
18312 }
18313
18314 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18318 self.0.request.parent = v.into();
18319 self
18320 }
18321
18322 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
18324 self.0.request.latest_message = v.into();
18325 self
18326 }
18327
18328 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
18330 self.0.request.context_size = v.into();
18331 self
18332 }
18333
18334 pub fn set_previous_suggested_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
18336 self.0.request.previous_suggested_query = v.into();
18337 self
18338 }
18339 }
18340
18341 #[doc(hidden)]
18342 impl gax::options::internal::RequestBuilder for SuggestKnowledgeAssist {
18343 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18344 &mut self.0.options
18345 }
18346 }
18347
18348 #[derive(Clone, Debug)]
18369 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
18370
18371 impl ListLocations {
18372 pub(crate) fn new(
18373 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18374 ) -> Self {
18375 Self(RequestBuilder::new(stub))
18376 }
18377
18378 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
18380 mut self,
18381 v: V,
18382 ) -> Self {
18383 self.0.request = v.into();
18384 self
18385 }
18386
18387 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18389 self.0.options = v.into();
18390 self
18391 }
18392
18393 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
18395 (*self.0.stub)
18396 .list_locations(self.0.request, self.0.options)
18397 .await
18398 .map(gax::response::Response::into_body)
18399 }
18400
18401 pub fn by_page(
18403 self,
18404 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
18405 {
18406 use std::clone::Clone;
18407 let token = self.0.request.page_token.clone();
18408 let execute = move |token: String| {
18409 let mut builder = self.clone();
18410 builder.0.request = builder.0.request.set_page_token(token);
18411 builder.send()
18412 };
18413 gax::paginator::internal::new_paginator(token, execute)
18414 }
18415
18416 pub fn by_item(
18418 self,
18419 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
18420 {
18421 use gax::paginator::Paginator;
18422 self.by_page().items()
18423 }
18424
18425 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18427 self.0.request.name = v.into();
18428 self
18429 }
18430
18431 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
18433 self.0.request.filter = v.into();
18434 self
18435 }
18436
18437 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
18439 self.0.request.page_size = v.into();
18440 self
18441 }
18442
18443 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
18445 self.0.request.page_token = v.into();
18446 self
18447 }
18448 }
18449
18450 #[doc(hidden)]
18451 impl gax::options::internal::RequestBuilder for ListLocations {
18452 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18453 &mut self.0.options
18454 }
18455 }
18456
18457 #[derive(Clone, Debug)]
18474 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
18475
18476 impl GetLocation {
18477 pub(crate) fn new(
18478 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18479 ) -> Self {
18480 Self(RequestBuilder::new(stub))
18481 }
18482
18483 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
18485 self.0.request = v.into();
18486 self
18487 }
18488
18489 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18491 self.0.options = v.into();
18492 self
18493 }
18494
18495 pub async fn send(self) -> Result<location::model::Location> {
18497 (*self.0.stub)
18498 .get_location(self.0.request, self.0.options)
18499 .await
18500 .map(gax::response::Response::into_body)
18501 }
18502
18503 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18505 self.0.request.name = v.into();
18506 self
18507 }
18508 }
18509
18510 #[doc(hidden)]
18511 impl gax::options::internal::RequestBuilder for GetLocation {
18512 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18513 &mut self.0.options
18514 }
18515 }
18516
18517 #[derive(Clone, Debug)]
18538 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
18539
18540 impl ListOperations {
18541 pub(crate) fn new(
18542 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18543 ) -> Self {
18544 Self(RequestBuilder::new(stub))
18545 }
18546
18547 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
18549 mut self,
18550 v: V,
18551 ) -> Self {
18552 self.0.request = v.into();
18553 self
18554 }
18555
18556 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18558 self.0.options = v.into();
18559 self
18560 }
18561
18562 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
18564 (*self.0.stub)
18565 .list_operations(self.0.request, self.0.options)
18566 .await
18567 .map(gax::response::Response::into_body)
18568 }
18569
18570 pub fn by_page(
18572 self,
18573 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
18574 {
18575 use std::clone::Clone;
18576 let token = self.0.request.page_token.clone();
18577 let execute = move |token: String| {
18578 let mut builder = self.clone();
18579 builder.0.request = builder.0.request.set_page_token(token);
18580 builder.send()
18581 };
18582 gax::paginator::internal::new_paginator(token, execute)
18583 }
18584
18585 pub fn by_item(
18587 self,
18588 ) -> impl gax::paginator::ItemPaginator<
18589 longrunning::model::ListOperationsResponse,
18590 gax::error::Error,
18591 > {
18592 use gax::paginator::Paginator;
18593 self.by_page().items()
18594 }
18595
18596 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18598 self.0.request.name = v.into();
18599 self
18600 }
18601
18602 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
18604 self.0.request.filter = v.into();
18605 self
18606 }
18607
18608 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
18610 self.0.request.page_size = v.into();
18611 self
18612 }
18613
18614 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
18616 self.0.request.page_token = v.into();
18617 self
18618 }
18619
18620 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
18622 self.0.request.return_partial_success = v.into();
18623 self
18624 }
18625 }
18626
18627 #[doc(hidden)]
18628 impl gax::options::internal::RequestBuilder for ListOperations {
18629 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18630 &mut self.0.options
18631 }
18632 }
18633
18634 #[derive(Clone, Debug)]
18651 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
18652
18653 impl GetOperation {
18654 pub(crate) fn new(
18655 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18656 ) -> Self {
18657 Self(RequestBuilder::new(stub))
18658 }
18659
18660 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
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<longrunning::model::Operation> {
18677 (*self.0.stub)
18678 .get_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 GetOperation {
18692 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18693 &mut self.0.options
18694 }
18695 }
18696
18697 #[derive(Clone, Debug)]
18714 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
18715
18716 impl CancelOperation {
18717 pub(crate) fn new(
18718 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18719 ) -> Self {
18720 Self(RequestBuilder::new(stub))
18721 }
18722
18723 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
18725 mut self,
18726 v: V,
18727 ) -> Self {
18728 self.0.request = v.into();
18729 self
18730 }
18731
18732 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18734 self.0.options = v.into();
18735 self
18736 }
18737
18738 pub async fn send(self) -> Result<()> {
18740 (*self.0.stub)
18741 .cancel_operation(self.0.request, self.0.options)
18742 .await
18743 .map(gax::response::Response::into_body)
18744 }
18745
18746 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18748 self.0.request.name = v.into();
18749 self
18750 }
18751 }
18752
18753 #[doc(hidden)]
18754 impl gax::options::internal::RequestBuilder for CancelOperation {
18755 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18756 &mut self.0.options
18757 }
18758 }
18759}
18760
18761#[cfg(feature = "sessions")]
18762#[cfg_attr(docsrs, doc(cfg(feature = "sessions")))]
18763pub mod sessions {
18764 use crate::Result;
18765
18766 pub type ClientBuilder =
18780 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
18781
18782 pub(crate) mod client {
18783 use super::super::super::client::Sessions;
18784 pub struct Factory;
18785 impl gax::client_builder::internal::ClientFactory for Factory {
18786 type Client = Sessions;
18787 type Credentials = gaxi::options::Credentials;
18788 async fn build(
18789 self,
18790 config: gaxi::options::ClientConfig,
18791 ) -> gax::client_builder::Result<Self::Client> {
18792 Self::Client::new(config).await
18793 }
18794 }
18795 }
18796
18797 #[derive(Clone, Debug)]
18799 pub(crate) struct RequestBuilder<R: std::default::Default> {
18800 stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>,
18801 request: R,
18802 options: gax::options::RequestOptions,
18803 }
18804
18805 impl<R> RequestBuilder<R>
18806 where
18807 R: std::default::Default,
18808 {
18809 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
18810 Self {
18811 stub,
18812 request: R::default(),
18813 options: gax::options::RequestOptions::default(),
18814 }
18815 }
18816 }
18817
18818 #[derive(Clone, Debug)]
18835 pub struct DetectIntent(RequestBuilder<crate::model::DetectIntentRequest>);
18836
18837 impl DetectIntent {
18838 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
18839 Self(RequestBuilder::new(stub))
18840 }
18841
18842 pub fn with_request<V: Into<crate::model::DetectIntentRequest>>(mut self, v: V) -> Self {
18844 self.0.request = v.into();
18845 self
18846 }
18847
18848 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18850 self.0.options = v.into();
18851 self
18852 }
18853
18854 pub async fn send(self) -> Result<crate::model::DetectIntentResponse> {
18856 (*self.0.stub)
18857 .detect_intent(self.0.request, self.0.options)
18858 .await
18859 .map(gax::response::Response::into_body)
18860 }
18861
18862 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
18866 self.0.request.session = v.into();
18867 self
18868 }
18869
18870 pub fn set_query_params<T>(mut self, v: T) -> Self
18872 where
18873 T: std::convert::Into<crate::model::QueryParameters>,
18874 {
18875 self.0.request.query_params = std::option::Option::Some(v.into());
18876 self
18877 }
18878
18879 pub fn set_or_clear_query_params<T>(mut self, v: std::option::Option<T>) -> Self
18881 where
18882 T: std::convert::Into<crate::model::QueryParameters>,
18883 {
18884 self.0.request.query_params = v.map(|x| x.into());
18885 self
18886 }
18887
18888 pub fn set_query_input<T>(mut self, v: T) -> Self
18892 where
18893 T: std::convert::Into<crate::model::QueryInput>,
18894 {
18895 self.0.request.query_input = std::option::Option::Some(v.into());
18896 self
18897 }
18898
18899 pub fn set_or_clear_query_input<T>(mut self, v: std::option::Option<T>) -> Self
18903 where
18904 T: std::convert::Into<crate::model::QueryInput>,
18905 {
18906 self.0.request.query_input = v.map(|x| x.into());
18907 self
18908 }
18909
18910 pub fn set_output_audio_config<T>(mut self, v: T) -> Self
18912 where
18913 T: std::convert::Into<crate::model::OutputAudioConfig>,
18914 {
18915 self.0.request.output_audio_config = std::option::Option::Some(v.into());
18916 self
18917 }
18918
18919 pub fn set_or_clear_output_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
18921 where
18922 T: std::convert::Into<crate::model::OutputAudioConfig>,
18923 {
18924 self.0.request.output_audio_config = v.map(|x| x.into());
18925 self
18926 }
18927
18928 pub fn set_output_audio_config_mask<T>(mut self, v: T) -> Self
18930 where
18931 T: std::convert::Into<wkt::FieldMask>,
18932 {
18933 self.0.request.output_audio_config_mask = std::option::Option::Some(v.into());
18934 self
18935 }
18936
18937 pub fn set_or_clear_output_audio_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
18939 where
18940 T: std::convert::Into<wkt::FieldMask>,
18941 {
18942 self.0.request.output_audio_config_mask = v.map(|x| x.into());
18943 self
18944 }
18945
18946 pub fn set_input_audio<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
18948 self.0.request.input_audio = v.into();
18949 self
18950 }
18951 }
18952
18953 #[doc(hidden)]
18954 impl gax::options::internal::RequestBuilder for DetectIntent {
18955 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
18956 &mut self.0.options
18957 }
18958 }
18959
18960 #[derive(Clone, Debug)]
18981 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
18982
18983 impl ListLocations {
18984 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
18985 Self(RequestBuilder::new(stub))
18986 }
18987
18988 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
18990 mut self,
18991 v: V,
18992 ) -> Self {
18993 self.0.request = v.into();
18994 self
18995 }
18996
18997 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
18999 self.0.options = v.into();
19000 self
19001 }
19002
19003 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
19005 (*self.0.stub)
19006 .list_locations(self.0.request, self.0.options)
19007 .await
19008 .map(gax::response::Response::into_body)
19009 }
19010
19011 pub fn by_page(
19013 self,
19014 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
19015 {
19016 use std::clone::Clone;
19017 let token = self.0.request.page_token.clone();
19018 let execute = move |token: String| {
19019 let mut builder = self.clone();
19020 builder.0.request = builder.0.request.set_page_token(token);
19021 builder.send()
19022 };
19023 gax::paginator::internal::new_paginator(token, execute)
19024 }
19025
19026 pub fn by_item(
19028 self,
19029 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
19030 {
19031 use gax::paginator::Paginator;
19032 self.by_page().items()
19033 }
19034
19035 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19037 self.0.request.name = v.into();
19038 self
19039 }
19040
19041 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
19043 self.0.request.filter = v.into();
19044 self
19045 }
19046
19047 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
19049 self.0.request.page_size = v.into();
19050 self
19051 }
19052
19053 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
19055 self.0.request.page_token = v.into();
19056 self
19057 }
19058 }
19059
19060 #[doc(hidden)]
19061 impl gax::options::internal::RequestBuilder for ListLocations {
19062 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19063 &mut self.0.options
19064 }
19065 }
19066
19067 #[derive(Clone, Debug)]
19084 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
19085
19086 impl GetLocation {
19087 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19088 Self(RequestBuilder::new(stub))
19089 }
19090
19091 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
19093 self.0.request = v.into();
19094 self
19095 }
19096
19097 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19099 self.0.options = v.into();
19100 self
19101 }
19102
19103 pub async fn send(self) -> Result<location::model::Location> {
19105 (*self.0.stub)
19106 .get_location(self.0.request, self.0.options)
19107 .await
19108 .map(gax::response::Response::into_body)
19109 }
19110
19111 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19113 self.0.request.name = v.into();
19114 self
19115 }
19116 }
19117
19118 #[doc(hidden)]
19119 impl gax::options::internal::RequestBuilder for GetLocation {
19120 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19121 &mut self.0.options
19122 }
19123 }
19124
19125 #[derive(Clone, Debug)]
19146 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
19147
19148 impl ListOperations {
19149 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19150 Self(RequestBuilder::new(stub))
19151 }
19152
19153 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
19155 mut self,
19156 v: V,
19157 ) -> Self {
19158 self.0.request = v.into();
19159 self
19160 }
19161
19162 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19164 self.0.options = v.into();
19165 self
19166 }
19167
19168 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
19170 (*self.0.stub)
19171 .list_operations(self.0.request, self.0.options)
19172 .await
19173 .map(gax::response::Response::into_body)
19174 }
19175
19176 pub fn by_page(
19178 self,
19179 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
19180 {
19181 use std::clone::Clone;
19182 let token = self.0.request.page_token.clone();
19183 let execute = move |token: String| {
19184 let mut builder = self.clone();
19185 builder.0.request = builder.0.request.set_page_token(token);
19186 builder.send()
19187 };
19188 gax::paginator::internal::new_paginator(token, execute)
19189 }
19190
19191 pub fn by_item(
19193 self,
19194 ) -> impl gax::paginator::ItemPaginator<
19195 longrunning::model::ListOperationsResponse,
19196 gax::error::Error,
19197 > {
19198 use gax::paginator::Paginator;
19199 self.by_page().items()
19200 }
19201
19202 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19204 self.0.request.name = v.into();
19205 self
19206 }
19207
19208 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
19210 self.0.request.filter = v.into();
19211 self
19212 }
19213
19214 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
19216 self.0.request.page_size = v.into();
19217 self
19218 }
19219
19220 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
19222 self.0.request.page_token = v.into();
19223 self
19224 }
19225
19226 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
19228 self.0.request.return_partial_success = v.into();
19229 self
19230 }
19231 }
19232
19233 #[doc(hidden)]
19234 impl gax::options::internal::RequestBuilder for ListOperations {
19235 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19236 &mut self.0.options
19237 }
19238 }
19239
19240 #[derive(Clone, Debug)]
19257 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
19258
19259 impl GetOperation {
19260 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19261 Self(RequestBuilder::new(stub))
19262 }
19263
19264 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
19266 mut self,
19267 v: V,
19268 ) -> Self {
19269 self.0.request = v.into();
19270 self
19271 }
19272
19273 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19275 self.0.options = v.into();
19276 self
19277 }
19278
19279 pub async fn send(self) -> Result<longrunning::model::Operation> {
19281 (*self.0.stub)
19282 .get_operation(self.0.request, self.0.options)
19283 .await
19284 .map(gax::response::Response::into_body)
19285 }
19286
19287 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19289 self.0.request.name = v.into();
19290 self
19291 }
19292 }
19293
19294 #[doc(hidden)]
19295 impl gax::options::internal::RequestBuilder for GetOperation {
19296 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19297 &mut self.0.options
19298 }
19299 }
19300
19301 #[derive(Clone, Debug)]
19318 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
19319
19320 impl CancelOperation {
19321 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19322 Self(RequestBuilder::new(stub))
19323 }
19324
19325 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
19327 mut self,
19328 v: V,
19329 ) -> 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<()> {
19342 (*self.0.stub)
19343 .cancel_operation(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 CancelOperation {
19357 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19358 &mut self.0.options
19359 }
19360 }
19361}
19362
19363#[cfg(feature = "session-entity-types")]
19364#[cfg_attr(docsrs, doc(cfg(feature = "session-entity-types")))]
19365pub mod session_entity_types {
19366 use crate::Result;
19367
19368 pub type ClientBuilder =
19382 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
19383
19384 pub(crate) mod client {
19385 use super::super::super::client::SessionEntityTypes;
19386 pub struct Factory;
19387 impl gax::client_builder::internal::ClientFactory for Factory {
19388 type Client = SessionEntityTypes;
19389 type Credentials = gaxi::options::Credentials;
19390 async fn build(
19391 self,
19392 config: gaxi::options::ClientConfig,
19393 ) -> gax::client_builder::Result<Self::Client> {
19394 Self::Client::new(config).await
19395 }
19396 }
19397 }
19398
19399 #[derive(Clone, Debug)]
19401 pub(crate) struct RequestBuilder<R: std::default::Default> {
19402 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19403 request: R,
19404 options: gax::options::RequestOptions,
19405 }
19406
19407 impl<R> RequestBuilder<R>
19408 where
19409 R: std::default::Default,
19410 {
19411 pub(crate) fn new(
19412 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19413 ) -> Self {
19414 Self {
19415 stub,
19416 request: R::default(),
19417 options: gax::options::RequestOptions::default(),
19418 }
19419 }
19420 }
19421
19422 #[derive(Clone, Debug)]
19443 pub struct ListSessionEntityTypes(RequestBuilder<crate::model::ListSessionEntityTypesRequest>);
19444
19445 impl ListSessionEntityTypes {
19446 pub(crate) fn new(
19447 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19448 ) -> Self {
19449 Self(RequestBuilder::new(stub))
19450 }
19451
19452 pub fn with_request<V: Into<crate::model::ListSessionEntityTypesRequest>>(
19454 mut self,
19455 v: V,
19456 ) -> Self {
19457 self.0.request = v.into();
19458 self
19459 }
19460
19461 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19463 self.0.options = v.into();
19464 self
19465 }
19466
19467 pub async fn send(self) -> Result<crate::model::ListSessionEntityTypesResponse> {
19469 (*self.0.stub)
19470 .list_session_entity_types(self.0.request, self.0.options)
19471 .await
19472 .map(gax::response::Response::into_body)
19473 }
19474
19475 pub fn by_page(
19477 self,
19478 ) -> impl gax::paginator::Paginator<
19479 crate::model::ListSessionEntityTypesResponse,
19480 gax::error::Error,
19481 > {
19482 use std::clone::Clone;
19483 let token = self.0.request.page_token.clone();
19484 let execute = move |token: String| {
19485 let mut builder = self.clone();
19486 builder.0.request = builder.0.request.set_page_token(token);
19487 builder.send()
19488 };
19489 gax::paginator::internal::new_paginator(token, execute)
19490 }
19491
19492 pub fn by_item(
19494 self,
19495 ) -> impl gax::paginator::ItemPaginator<
19496 crate::model::ListSessionEntityTypesResponse,
19497 gax::error::Error,
19498 > {
19499 use gax::paginator::Paginator;
19500 self.by_page().items()
19501 }
19502
19503 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
19507 self.0.request.parent = v.into();
19508 self
19509 }
19510
19511 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
19513 self.0.request.page_size = v.into();
19514 self
19515 }
19516
19517 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
19519 self.0.request.page_token = v.into();
19520 self
19521 }
19522 }
19523
19524 #[doc(hidden)]
19525 impl gax::options::internal::RequestBuilder for ListSessionEntityTypes {
19526 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19527 &mut self.0.options
19528 }
19529 }
19530
19531 #[derive(Clone, Debug)]
19548 pub struct GetSessionEntityType(RequestBuilder<crate::model::GetSessionEntityTypeRequest>);
19549
19550 impl GetSessionEntityType {
19551 pub(crate) fn new(
19552 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19553 ) -> Self {
19554 Self(RequestBuilder::new(stub))
19555 }
19556
19557 pub fn with_request<V: Into<crate::model::GetSessionEntityTypeRequest>>(
19559 mut self,
19560 v: V,
19561 ) -> Self {
19562 self.0.request = v.into();
19563 self
19564 }
19565
19566 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19568 self.0.options = v.into();
19569 self
19570 }
19571
19572 pub async fn send(self) -> Result<crate::model::SessionEntityType> {
19574 (*self.0.stub)
19575 .get_session_entity_type(self.0.request, self.0.options)
19576 .await
19577 .map(gax::response::Response::into_body)
19578 }
19579
19580 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19584 self.0.request.name = v.into();
19585 self
19586 }
19587 }
19588
19589 #[doc(hidden)]
19590 impl gax::options::internal::RequestBuilder for GetSessionEntityType {
19591 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19592 &mut self.0.options
19593 }
19594 }
19595
19596 #[derive(Clone, Debug)]
19613 pub struct CreateSessionEntityType(
19614 RequestBuilder<crate::model::CreateSessionEntityTypeRequest>,
19615 );
19616
19617 impl CreateSessionEntityType {
19618 pub(crate) fn new(
19619 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19620 ) -> Self {
19621 Self(RequestBuilder::new(stub))
19622 }
19623
19624 pub fn with_request<V: Into<crate::model::CreateSessionEntityTypeRequest>>(
19626 mut self,
19627 v: V,
19628 ) -> Self {
19629 self.0.request = v.into();
19630 self
19631 }
19632
19633 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19635 self.0.options = v.into();
19636 self
19637 }
19638
19639 pub async fn send(self) -> Result<crate::model::SessionEntityType> {
19641 (*self.0.stub)
19642 .create_session_entity_type(self.0.request, self.0.options)
19643 .await
19644 .map(gax::response::Response::into_body)
19645 }
19646
19647 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
19651 self.0.request.parent = v.into();
19652 self
19653 }
19654
19655 pub fn set_session_entity_type<T>(mut self, v: T) -> Self
19659 where
19660 T: std::convert::Into<crate::model::SessionEntityType>,
19661 {
19662 self.0.request.session_entity_type = std::option::Option::Some(v.into());
19663 self
19664 }
19665
19666 pub fn set_or_clear_session_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
19670 where
19671 T: std::convert::Into<crate::model::SessionEntityType>,
19672 {
19673 self.0.request.session_entity_type = v.map(|x| x.into());
19674 self
19675 }
19676 }
19677
19678 #[doc(hidden)]
19679 impl gax::options::internal::RequestBuilder for CreateSessionEntityType {
19680 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19681 &mut self.0.options
19682 }
19683 }
19684
19685 #[derive(Clone, Debug)]
19702 pub struct UpdateSessionEntityType(
19703 RequestBuilder<crate::model::UpdateSessionEntityTypeRequest>,
19704 );
19705
19706 impl UpdateSessionEntityType {
19707 pub(crate) fn new(
19708 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19709 ) -> Self {
19710 Self(RequestBuilder::new(stub))
19711 }
19712
19713 pub fn with_request<V: Into<crate::model::UpdateSessionEntityTypeRequest>>(
19715 mut self,
19716 v: V,
19717 ) -> Self {
19718 self.0.request = v.into();
19719 self
19720 }
19721
19722 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19724 self.0.options = v.into();
19725 self
19726 }
19727
19728 pub async fn send(self) -> Result<crate::model::SessionEntityType> {
19730 (*self.0.stub)
19731 .update_session_entity_type(self.0.request, self.0.options)
19732 .await
19733 .map(gax::response::Response::into_body)
19734 }
19735
19736 pub fn set_session_entity_type<T>(mut self, v: T) -> Self
19740 where
19741 T: std::convert::Into<crate::model::SessionEntityType>,
19742 {
19743 self.0.request.session_entity_type = std::option::Option::Some(v.into());
19744 self
19745 }
19746
19747 pub fn set_or_clear_session_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
19751 where
19752 T: std::convert::Into<crate::model::SessionEntityType>,
19753 {
19754 self.0.request.session_entity_type = v.map(|x| x.into());
19755 self
19756 }
19757
19758 pub fn set_update_mask<T>(mut self, v: T) -> Self
19760 where
19761 T: std::convert::Into<wkt::FieldMask>,
19762 {
19763 self.0.request.update_mask = std::option::Option::Some(v.into());
19764 self
19765 }
19766
19767 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
19769 where
19770 T: std::convert::Into<wkt::FieldMask>,
19771 {
19772 self.0.request.update_mask = v.map(|x| x.into());
19773 self
19774 }
19775 }
19776
19777 #[doc(hidden)]
19778 impl gax::options::internal::RequestBuilder for UpdateSessionEntityType {
19779 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19780 &mut self.0.options
19781 }
19782 }
19783
19784 #[derive(Clone, Debug)]
19801 pub struct DeleteSessionEntityType(
19802 RequestBuilder<crate::model::DeleteSessionEntityTypeRequest>,
19803 );
19804
19805 impl DeleteSessionEntityType {
19806 pub(crate) fn new(
19807 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19808 ) -> Self {
19809 Self(RequestBuilder::new(stub))
19810 }
19811
19812 pub fn with_request<V: Into<crate::model::DeleteSessionEntityTypeRequest>>(
19814 mut self,
19815 v: V,
19816 ) -> Self {
19817 self.0.request = v.into();
19818 self
19819 }
19820
19821 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19823 self.0.options = v.into();
19824 self
19825 }
19826
19827 pub async fn send(self) -> Result<()> {
19829 (*self.0.stub)
19830 .delete_session_entity_type(self.0.request, self.0.options)
19831 .await
19832 .map(gax::response::Response::into_body)
19833 }
19834
19835 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19839 self.0.request.name = v.into();
19840 self
19841 }
19842 }
19843
19844 #[doc(hidden)]
19845 impl gax::options::internal::RequestBuilder for DeleteSessionEntityType {
19846 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19847 &mut self.0.options
19848 }
19849 }
19850
19851 #[derive(Clone, Debug)]
19872 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
19873
19874 impl ListLocations {
19875 pub(crate) fn new(
19876 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19877 ) -> Self {
19878 Self(RequestBuilder::new(stub))
19879 }
19880
19881 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
19883 mut self,
19884 v: V,
19885 ) -> Self {
19886 self.0.request = v.into();
19887 self
19888 }
19889
19890 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19892 self.0.options = v.into();
19893 self
19894 }
19895
19896 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
19898 (*self.0.stub)
19899 .list_locations(self.0.request, self.0.options)
19900 .await
19901 .map(gax::response::Response::into_body)
19902 }
19903
19904 pub fn by_page(
19906 self,
19907 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
19908 {
19909 use std::clone::Clone;
19910 let token = self.0.request.page_token.clone();
19911 let execute = move |token: String| {
19912 let mut builder = self.clone();
19913 builder.0.request = builder.0.request.set_page_token(token);
19914 builder.send()
19915 };
19916 gax::paginator::internal::new_paginator(token, execute)
19917 }
19918
19919 pub fn by_item(
19921 self,
19922 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
19923 {
19924 use gax::paginator::Paginator;
19925 self.by_page().items()
19926 }
19927
19928 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19930 self.0.request.name = v.into();
19931 self
19932 }
19933
19934 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
19936 self.0.request.filter = v.into();
19937 self
19938 }
19939
19940 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
19942 self.0.request.page_size = v.into();
19943 self
19944 }
19945
19946 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
19948 self.0.request.page_token = v.into();
19949 self
19950 }
19951 }
19952
19953 #[doc(hidden)]
19954 impl gax::options::internal::RequestBuilder for ListLocations {
19955 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
19956 &mut self.0.options
19957 }
19958 }
19959
19960 #[derive(Clone, Debug)]
19977 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
19978
19979 impl GetLocation {
19980 pub(crate) fn new(
19981 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19982 ) -> Self {
19983 Self(RequestBuilder::new(stub))
19984 }
19985
19986 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
19988 self.0.request = v.into();
19989 self
19990 }
19991
19992 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
19994 self.0.options = v.into();
19995 self
19996 }
19997
19998 pub async fn send(self) -> Result<location::model::Location> {
20000 (*self.0.stub)
20001 .get_location(self.0.request, self.0.options)
20002 .await
20003 .map(gax::response::Response::into_body)
20004 }
20005
20006 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20008 self.0.request.name = v.into();
20009 self
20010 }
20011 }
20012
20013 #[doc(hidden)]
20014 impl gax::options::internal::RequestBuilder for GetLocation {
20015 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20016 &mut self.0.options
20017 }
20018 }
20019
20020 #[derive(Clone, Debug)]
20041 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
20042
20043 impl ListOperations {
20044 pub(crate) fn new(
20045 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20046 ) -> Self {
20047 Self(RequestBuilder::new(stub))
20048 }
20049
20050 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
20052 mut self,
20053 v: V,
20054 ) -> Self {
20055 self.0.request = v.into();
20056 self
20057 }
20058
20059 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20061 self.0.options = v.into();
20062 self
20063 }
20064
20065 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
20067 (*self.0.stub)
20068 .list_operations(self.0.request, self.0.options)
20069 .await
20070 .map(gax::response::Response::into_body)
20071 }
20072
20073 pub fn by_page(
20075 self,
20076 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
20077 {
20078 use std::clone::Clone;
20079 let token = self.0.request.page_token.clone();
20080 let execute = move |token: String| {
20081 let mut builder = self.clone();
20082 builder.0.request = builder.0.request.set_page_token(token);
20083 builder.send()
20084 };
20085 gax::paginator::internal::new_paginator(token, execute)
20086 }
20087
20088 pub fn by_item(
20090 self,
20091 ) -> impl gax::paginator::ItemPaginator<
20092 longrunning::model::ListOperationsResponse,
20093 gax::error::Error,
20094 > {
20095 use gax::paginator::Paginator;
20096 self.by_page().items()
20097 }
20098
20099 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20101 self.0.request.name = v.into();
20102 self
20103 }
20104
20105 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
20107 self.0.request.filter = v.into();
20108 self
20109 }
20110
20111 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
20113 self.0.request.page_size = v.into();
20114 self
20115 }
20116
20117 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
20119 self.0.request.page_token = v.into();
20120 self
20121 }
20122
20123 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
20125 self.0.request.return_partial_success = v.into();
20126 self
20127 }
20128 }
20129
20130 #[doc(hidden)]
20131 impl gax::options::internal::RequestBuilder for ListOperations {
20132 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20133 &mut self.0.options
20134 }
20135 }
20136
20137 #[derive(Clone, Debug)]
20154 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
20155
20156 impl GetOperation {
20157 pub(crate) fn new(
20158 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20159 ) -> Self {
20160 Self(RequestBuilder::new(stub))
20161 }
20162
20163 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
20165 mut self,
20166 v: V,
20167 ) -> Self {
20168 self.0.request = v.into();
20169 self
20170 }
20171
20172 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20174 self.0.options = v.into();
20175 self
20176 }
20177
20178 pub async fn send(self) -> Result<longrunning::model::Operation> {
20180 (*self.0.stub)
20181 .get_operation(self.0.request, self.0.options)
20182 .await
20183 .map(gax::response::Response::into_body)
20184 }
20185
20186 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20188 self.0.request.name = v.into();
20189 self
20190 }
20191 }
20192
20193 #[doc(hidden)]
20194 impl gax::options::internal::RequestBuilder for GetOperation {
20195 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20196 &mut self.0.options
20197 }
20198 }
20199
20200 #[derive(Clone, Debug)]
20217 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
20218
20219 impl CancelOperation {
20220 pub(crate) fn new(
20221 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20222 ) -> Self {
20223 Self(RequestBuilder::new(stub))
20224 }
20225
20226 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
20228 mut self,
20229 v: V,
20230 ) -> Self {
20231 self.0.request = v.into();
20232 self
20233 }
20234
20235 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20237 self.0.options = v.into();
20238 self
20239 }
20240
20241 pub async fn send(self) -> Result<()> {
20243 (*self.0.stub)
20244 .cancel_operation(self.0.request, self.0.options)
20245 .await
20246 .map(gax::response::Response::into_body)
20247 }
20248
20249 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20251 self.0.request.name = v.into();
20252 self
20253 }
20254 }
20255
20256 #[doc(hidden)]
20257 impl gax::options::internal::RequestBuilder for CancelOperation {
20258 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20259 &mut self.0.options
20260 }
20261 }
20262}
20263
20264#[cfg(feature = "sip-trunks")]
20265#[cfg_attr(docsrs, doc(cfg(feature = "sip-trunks")))]
20266pub mod sip_trunks {
20267 use crate::Result;
20268
20269 pub type ClientBuilder =
20283 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
20284
20285 pub(crate) mod client {
20286 use super::super::super::client::SipTrunks;
20287 pub struct Factory;
20288 impl gax::client_builder::internal::ClientFactory for Factory {
20289 type Client = SipTrunks;
20290 type Credentials = gaxi::options::Credentials;
20291 async fn build(
20292 self,
20293 config: gaxi::options::ClientConfig,
20294 ) -> gax::client_builder::Result<Self::Client> {
20295 Self::Client::new(config).await
20296 }
20297 }
20298 }
20299
20300 #[derive(Clone, Debug)]
20302 pub(crate) struct RequestBuilder<R: std::default::Default> {
20303 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20304 request: R,
20305 options: gax::options::RequestOptions,
20306 }
20307
20308 impl<R> RequestBuilder<R>
20309 where
20310 R: std::default::Default,
20311 {
20312 pub(crate) fn new(
20313 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20314 ) -> Self {
20315 Self {
20316 stub,
20317 request: R::default(),
20318 options: gax::options::RequestOptions::default(),
20319 }
20320 }
20321 }
20322
20323 #[derive(Clone, Debug)]
20340 pub struct CreateSipTrunk(RequestBuilder<crate::model::CreateSipTrunkRequest>);
20341
20342 impl CreateSipTrunk {
20343 pub(crate) fn new(
20344 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20345 ) -> Self {
20346 Self(RequestBuilder::new(stub))
20347 }
20348
20349 pub fn with_request<V: Into<crate::model::CreateSipTrunkRequest>>(mut self, v: V) -> Self {
20351 self.0.request = v.into();
20352 self
20353 }
20354
20355 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20357 self.0.options = v.into();
20358 self
20359 }
20360
20361 pub async fn send(self) -> Result<crate::model::SipTrunk> {
20363 (*self.0.stub)
20364 .create_sip_trunk(self.0.request, self.0.options)
20365 .await
20366 .map(gax::response::Response::into_body)
20367 }
20368
20369 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
20373 self.0.request.parent = v.into();
20374 self
20375 }
20376
20377 pub fn set_sip_trunk<T>(mut self, v: T) -> Self
20381 where
20382 T: std::convert::Into<crate::model::SipTrunk>,
20383 {
20384 self.0.request.sip_trunk = std::option::Option::Some(v.into());
20385 self
20386 }
20387
20388 pub fn set_or_clear_sip_trunk<T>(mut self, v: std::option::Option<T>) -> Self
20392 where
20393 T: std::convert::Into<crate::model::SipTrunk>,
20394 {
20395 self.0.request.sip_trunk = v.map(|x| x.into());
20396 self
20397 }
20398 }
20399
20400 #[doc(hidden)]
20401 impl gax::options::internal::RequestBuilder for CreateSipTrunk {
20402 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20403 &mut self.0.options
20404 }
20405 }
20406
20407 #[derive(Clone, Debug)]
20424 pub struct DeleteSipTrunk(RequestBuilder<crate::model::DeleteSipTrunkRequest>);
20425
20426 impl DeleteSipTrunk {
20427 pub(crate) fn new(
20428 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20429 ) -> Self {
20430 Self(RequestBuilder::new(stub))
20431 }
20432
20433 pub fn with_request<V: Into<crate::model::DeleteSipTrunkRequest>>(mut self, v: V) -> Self {
20435 self.0.request = v.into();
20436 self
20437 }
20438
20439 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20441 self.0.options = v.into();
20442 self
20443 }
20444
20445 pub async fn send(self) -> Result<()> {
20447 (*self.0.stub)
20448 .delete_sip_trunk(self.0.request, self.0.options)
20449 .await
20450 .map(gax::response::Response::into_body)
20451 }
20452
20453 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20457 self.0.request.name = v.into();
20458 self
20459 }
20460 }
20461
20462 #[doc(hidden)]
20463 impl gax::options::internal::RequestBuilder for DeleteSipTrunk {
20464 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20465 &mut self.0.options
20466 }
20467 }
20468
20469 #[derive(Clone, Debug)]
20490 pub struct ListSipTrunks(RequestBuilder<crate::model::ListSipTrunksRequest>);
20491
20492 impl ListSipTrunks {
20493 pub(crate) fn new(
20494 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20495 ) -> Self {
20496 Self(RequestBuilder::new(stub))
20497 }
20498
20499 pub fn with_request<V: Into<crate::model::ListSipTrunksRequest>>(mut self, v: V) -> Self {
20501 self.0.request = v.into();
20502 self
20503 }
20504
20505 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20507 self.0.options = v.into();
20508 self
20509 }
20510
20511 pub async fn send(self) -> Result<crate::model::ListSipTrunksResponse> {
20513 (*self.0.stub)
20514 .list_sip_trunks(self.0.request, self.0.options)
20515 .await
20516 .map(gax::response::Response::into_body)
20517 }
20518
20519 pub fn by_page(
20521 self,
20522 ) -> impl gax::paginator::Paginator<crate::model::ListSipTrunksResponse, gax::error::Error>
20523 {
20524 use std::clone::Clone;
20525 let token = self.0.request.page_token.clone();
20526 let execute = move |token: String| {
20527 let mut builder = self.clone();
20528 builder.0.request = builder.0.request.set_page_token(token);
20529 builder.send()
20530 };
20531 gax::paginator::internal::new_paginator(token, execute)
20532 }
20533
20534 pub fn by_item(
20536 self,
20537 ) -> impl gax::paginator::ItemPaginator<crate::model::ListSipTrunksResponse, gax::error::Error>
20538 {
20539 use gax::paginator::Paginator;
20540 self.by_page().items()
20541 }
20542
20543 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
20547 self.0.request.parent = v.into();
20548 self
20549 }
20550
20551 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
20553 self.0.request.page_size = v.into();
20554 self
20555 }
20556
20557 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
20559 self.0.request.page_token = v.into();
20560 self
20561 }
20562 }
20563
20564 #[doc(hidden)]
20565 impl gax::options::internal::RequestBuilder for ListSipTrunks {
20566 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20567 &mut self.0.options
20568 }
20569 }
20570
20571 #[derive(Clone, Debug)]
20588 pub struct GetSipTrunk(RequestBuilder<crate::model::GetSipTrunkRequest>);
20589
20590 impl GetSipTrunk {
20591 pub(crate) fn new(
20592 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20593 ) -> Self {
20594 Self(RequestBuilder::new(stub))
20595 }
20596
20597 pub fn with_request<V: Into<crate::model::GetSipTrunkRequest>>(mut self, v: V) -> Self {
20599 self.0.request = v.into();
20600 self
20601 }
20602
20603 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20605 self.0.options = v.into();
20606 self
20607 }
20608
20609 pub async fn send(self) -> Result<crate::model::SipTrunk> {
20611 (*self.0.stub)
20612 .get_sip_trunk(self.0.request, self.0.options)
20613 .await
20614 .map(gax::response::Response::into_body)
20615 }
20616
20617 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20621 self.0.request.name = v.into();
20622 self
20623 }
20624 }
20625
20626 #[doc(hidden)]
20627 impl gax::options::internal::RequestBuilder for GetSipTrunk {
20628 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20629 &mut self.0.options
20630 }
20631 }
20632
20633 #[derive(Clone, Debug)]
20650 pub struct UpdateSipTrunk(RequestBuilder<crate::model::UpdateSipTrunkRequest>);
20651
20652 impl UpdateSipTrunk {
20653 pub(crate) fn new(
20654 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20655 ) -> Self {
20656 Self(RequestBuilder::new(stub))
20657 }
20658
20659 pub fn with_request<V: Into<crate::model::UpdateSipTrunkRequest>>(mut self, v: V) -> Self {
20661 self.0.request = v.into();
20662 self
20663 }
20664
20665 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20667 self.0.options = v.into();
20668 self
20669 }
20670
20671 pub async fn send(self) -> Result<crate::model::SipTrunk> {
20673 (*self.0.stub)
20674 .update_sip_trunk(self.0.request, self.0.options)
20675 .await
20676 .map(gax::response::Response::into_body)
20677 }
20678
20679 pub fn set_sip_trunk<T>(mut self, v: T) -> Self
20683 where
20684 T: std::convert::Into<crate::model::SipTrunk>,
20685 {
20686 self.0.request.sip_trunk = std::option::Option::Some(v.into());
20687 self
20688 }
20689
20690 pub fn set_or_clear_sip_trunk<T>(mut self, v: std::option::Option<T>) -> Self
20694 where
20695 T: std::convert::Into<crate::model::SipTrunk>,
20696 {
20697 self.0.request.sip_trunk = v.map(|x| x.into());
20698 self
20699 }
20700
20701 pub fn set_update_mask<T>(mut self, v: T) -> Self
20703 where
20704 T: std::convert::Into<wkt::FieldMask>,
20705 {
20706 self.0.request.update_mask = std::option::Option::Some(v.into());
20707 self
20708 }
20709
20710 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
20712 where
20713 T: std::convert::Into<wkt::FieldMask>,
20714 {
20715 self.0.request.update_mask = v.map(|x| x.into());
20716 self
20717 }
20718 }
20719
20720 #[doc(hidden)]
20721 impl gax::options::internal::RequestBuilder for UpdateSipTrunk {
20722 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20723 &mut self.0.options
20724 }
20725 }
20726
20727 #[derive(Clone, Debug)]
20748 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
20749
20750 impl ListLocations {
20751 pub(crate) fn new(
20752 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20753 ) -> Self {
20754 Self(RequestBuilder::new(stub))
20755 }
20756
20757 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
20759 mut self,
20760 v: V,
20761 ) -> Self {
20762 self.0.request = v.into();
20763 self
20764 }
20765
20766 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20768 self.0.options = v.into();
20769 self
20770 }
20771
20772 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
20774 (*self.0.stub)
20775 .list_locations(self.0.request, self.0.options)
20776 .await
20777 .map(gax::response::Response::into_body)
20778 }
20779
20780 pub fn by_page(
20782 self,
20783 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
20784 {
20785 use std::clone::Clone;
20786 let token = self.0.request.page_token.clone();
20787 let execute = move |token: String| {
20788 let mut builder = self.clone();
20789 builder.0.request = builder.0.request.set_page_token(token);
20790 builder.send()
20791 };
20792 gax::paginator::internal::new_paginator(token, execute)
20793 }
20794
20795 pub fn by_item(
20797 self,
20798 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
20799 {
20800 use gax::paginator::Paginator;
20801 self.by_page().items()
20802 }
20803
20804 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20806 self.0.request.name = v.into();
20807 self
20808 }
20809
20810 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
20812 self.0.request.filter = v.into();
20813 self
20814 }
20815
20816 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
20818 self.0.request.page_size = v.into();
20819 self
20820 }
20821
20822 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
20824 self.0.request.page_token = v.into();
20825 self
20826 }
20827 }
20828
20829 #[doc(hidden)]
20830 impl gax::options::internal::RequestBuilder for ListLocations {
20831 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20832 &mut self.0.options
20833 }
20834 }
20835
20836 #[derive(Clone, Debug)]
20853 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
20854
20855 impl GetLocation {
20856 pub(crate) fn new(
20857 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20858 ) -> Self {
20859 Self(RequestBuilder::new(stub))
20860 }
20861
20862 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
20864 self.0.request = v.into();
20865 self
20866 }
20867
20868 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20870 self.0.options = v.into();
20871 self
20872 }
20873
20874 pub async fn send(self) -> Result<location::model::Location> {
20876 (*self.0.stub)
20877 .get_location(self.0.request, self.0.options)
20878 .await
20879 .map(gax::response::Response::into_body)
20880 }
20881
20882 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20884 self.0.request.name = v.into();
20885 self
20886 }
20887 }
20888
20889 #[doc(hidden)]
20890 impl gax::options::internal::RequestBuilder for GetLocation {
20891 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
20892 &mut self.0.options
20893 }
20894 }
20895
20896 #[derive(Clone, Debug)]
20917 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
20918
20919 impl ListOperations {
20920 pub(crate) fn new(
20921 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20922 ) -> Self {
20923 Self(RequestBuilder::new(stub))
20924 }
20925
20926 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
20928 mut self,
20929 v: V,
20930 ) -> Self {
20931 self.0.request = v.into();
20932 self
20933 }
20934
20935 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
20937 self.0.options = v.into();
20938 self
20939 }
20940
20941 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
20943 (*self.0.stub)
20944 .list_operations(self.0.request, self.0.options)
20945 .await
20946 .map(gax::response::Response::into_body)
20947 }
20948
20949 pub fn by_page(
20951 self,
20952 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
20953 {
20954 use std::clone::Clone;
20955 let token = self.0.request.page_token.clone();
20956 let execute = move |token: String| {
20957 let mut builder = self.clone();
20958 builder.0.request = builder.0.request.set_page_token(token);
20959 builder.send()
20960 };
20961 gax::paginator::internal::new_paginator(token, execute)
20962 }
20963
20964 pub fn by_item(
20966 self,
20967 ) -> impl gax::paginator::ItemPaginator<
20968 longrunning::model::ListOperationsResponse,
20969 gax::error::Error,
20970 > {
20971 use gax::paginator::Paginator;
20972 self.by_page().items()
20973 }
20974
20975 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20977 self.0.request.name = v.into();
20978 self
20979 }
20980
20981 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
20983 self.0.request.filter = v.into();
20984 self
20985 }
20986
20987 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
20989 self.0.request.page_size = v.into();
20990 self
20991 }
20992
20993 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
20995 self.0.request.page_token = v.into();
20996 self
20997 }
20998
20999 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
21001 self.0.request.return_partial_success = v.into();
21002 self
21003 }
21004 }
21005
21006 #[doc(hidden)]
21007 impl gax::options::internal::RequestBuilder for ListOperations {
21008 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
21009 &mut self.0.options
21010 }
21011 }
21012
21013 #[derive(Clone, Debug)]
21030 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
21031
21032 impl GetOperation {
21033 pub(crate) fn new(
21034 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21035 ) -> Self {
21036 Self(RequestBuilder::new(stub))
21037 }
21038
21039 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
21041 mut self,
21042 v: V,
21043 ) -> Self {
21044 self.0.request = v.into();
21045 self
21046 }
21047
21048 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
21050 self.0.options = v.into();
21051 self
21052 }
21053
21054 pub async fn send(self) -> Result<longrunning::model::Operation> {
21056 (*self.0.stub)
21057 .get_operation(self.0.request, self.0.options)
21058 .await
21059 .map(gax::response::Response::into_body)
21060 }
21061
21062 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21064 self.0.request.name = v.into();
21065 self
21066 }
21067 }
21068
21069 #[doc(hidden)]
21070 impl gax::options::internal::RequestBuilder for GetOperation {
21071 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
21072 &mut self.0.options
21073 }
21074 }
21075
21076 #[derive(Clone, Debug)]
21093 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
21094
21095 impl CancelOperation {
21096 pub(crate) fn new(
21097 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21098 ) -> Self {
21099 Self(RequestBuilder::new(stub))
21100 }
21101
21102 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
21104 mut self,
21105 v: V,
21106 ) -> Self {
21107 self.0.request = v.into();
21108 self
21109 }
21110
21111 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
21113 self.0.options = v.into();
21114 self
21115 }
21116
21117 pub async fn send(self) -> Result<()> {
21119 (*self.0.stub)
21120 .cancel_operation(self.0.request, self.0.options)
21121 .await
21122 .map(gax::response::Response::into_body)
21123 }
21124
21125 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21127 self.0.request.name = v.into();
21128 self
21129 }
21130 }
21131
21132 #[doc(hidden)]
21133 impl gax::options::internal::RequestBuilder for CancelOperation {
21134 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
21135 &mut self.0.options
21136 }
21137 }
21138}
21139
21140#[cfg(feature = "tools")]
21141#[cfg_attr(docsrs, doc(cfg(feature = "tools")))]
21142pub mod tools {
21143 use crate::Result;
21144
21145 pub type ClientBuilder =
21159 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
21160
21161 pub(crate) mod client {
21162 use super::super::super::client::Tools;
21163 pub struct Factory;
21164 impl gax::client_builder::internal::ClientFactory for Factory {
21165 type Client = Tools;
21166 type Credentials = gaxi::options::Credentials;
21167 async fn build(
21168 self,
21169 config: gaxi::options::ClientConfig,
21170 ) -> gax::client_builder::Result<Self::Client> {
21171 Self::Client::new(config).await
21172 }
21173 }
21174 }
21175
21176 #[derive(Clone, Debug)]
21178 pub(crate) struct RequestBuilder<R: std::default::Default> {
21179 stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>,
21180 request: R,
21181 options: gax::options::RequestOptions,
21182 }
21183
21184 impl<R> RequestBuilder<R>
21185 where
21186 R: std::default::Default,
21187 {
21188 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21189 Self {
21190 stub,
21191 request: R::default(),
21192 options: gax::options::RequestOptions::default(),
21193 }
21194 }
21195 }
21196
21197 #[derive(Clone, Debug)]
21214 pub struct CreateTool(RequestBuilder<crate::model::CreateToolRequest>);
21215
21216 impl CreateTool {
21217 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21218 Self(RequestBuilder::new(stub))
21219 }
21220
21221 pub fn with_request<V: Into<crate::model::CreateToolRequest>>(mut self, v: V) -> Self {
21223 self.0.request = v.into();
21224 self
21225 }
21226
21227 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
21229 self.0.options = v.into();
21230 self
21231 }
21232
21233 pub async fn send(self) -> Result<crate::model::Tool> {
21235 (*self.0.stub)
21236 .create_tool(self.0.request, self.0.options)
21237 .await
21238 .map(gax::response::Response::into_body)
21239 }
21240
21241 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
21245 self.0.request.parent = v.into();
21246 self
21247 }
21248
21249 pub fn set_tool<T>(mut self, v: T) -> Self
21253 where
21254 T: std::convert::Into<crate::model::Tool>,
21255 {
21256 self.0.request.tool = std::option::Option::Some(v.into());
21257 self
21258 }
21259
21260 pub fn set_or_clear_tool<T>(mut self, v: std::option::Option<T>) -> Self
21264 where
21265 T: std::convert::Into<crate::model::Tool>,
21266 {
21267 self.0.request.tool = v.map(|x| x.into());
21268 self
21269 }
21270
21271 pub fn set_tool_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
21273 self.0.request.tool_id = v.into();
21274 self
21275 }
21276 }
21277
21278 #[doc(hidden)]
21279 impl gax::options::internal::RequestBuilder for CreateTool {
21280 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
21281 &mut self.0.options
21282 }
21283 }
21284
21285 #[derive(Clone, Debug)]
21302 pub struct GetTool(RequestBuilder<crate::model::GetToolRequest>);
21303
21304 impl GetTool {
21305 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21306 Self(RequestBuilder::new(stub))
21307 }
21308
21309 pub fn with_request<V: Into<crate::model::GetToolRequest>>(mut self, v: V) -> Self {
21311 self.0.request = v.into();
21312 self
21313 }
21314
21315 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
21317 self.0.options = v.into();
21318 self
21319 }
21320
21321 pub async fn send(self) -> Result<crate::model::Tool> {
21323 (*self.0.stub)
21324 .get_tool(self.0.request, self.0.options)
21325 .await
21326 .map(gax::response::Response::into_body)
21327 }
21328
21329 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21333 self.0.request.name = v.into();
21334 self
21335 }
21336 }
21337
21338 #[doc(hidden)]
21339 impl gax::options::internal::RequestBuilder for GetTool {
21340 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
21341 &mut self.0.options
21342 }
21343 }
21344
21345 #[derive(Clone, Debug)]
21366 pub struct ListTools(RequestBuilder<crate::model::ListToolsRequest>);
21367
21368 impl ListTools {
21369 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21370 Self(RequestBuilder::new(stub))
21371 }
21372
21373 pub fn with_request<V: Into<crate::model::ListToolsRequest>>(mut self, v: V) -> Self {
21375 self.0.request = v.into();
21376 self
21377 }
21378
21379 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
21381 self.0.options = v.into();
21382 self
21383 }
21384
21385 pub async fn send(self) -> Result<crate::model::ListToolsResponse> {
21387 (*self.0.stub)
21388 .list_tools(self.0.request, self.0.options)
21389 .await
21390 .map(gax::response::Response::into_body)
21391 }
21392
21393 pub fn by_page(
21395 self,
21396 ) -> impl gax::paginator::Paginator<crate::model::ListToolsResponse, gax::error::Error>
21397 {
21398 use std::clone::Clone;
21399 let token = self.0.request.page_token.clone();
21400 let execute = move |token: String| {
21401 let mut builder = self.clone();
21402 builder.0.request = builder.0.request.set_page_token(token);
21403 builder.send()
21404 };
21405 gax::paginator::internal::new_paginator(token, execute)
21406 }
21407
21408 pub fn by_item(
21410 self,
21411 ) -> impl gax::paginator::ItemPaginator<crate::model::ListToolsResponse, gax::error::Error>
21412 {
21413 use gax::paginator::Paginator;
21414 self.by_page().items()
21415 }
21416
21417 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
21421 self.0.request.parent = v.into();
21422 self
21423 }
21424
21425 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
21427 self.0.request.page_size = v.into();
21428 self
21429 }
21430
21431 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
21433 self.0.request.page_token = v.into();
21434 self
21435 }
21436 }
21437
21438 #[doc(hidden)]
21439 impl gax::options::internal::RequestBuilder for ListTools {
21440 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
21441 &mut self.0.options
21442 }
21443 }
21444
21445 #[derive(Clone, Debug)]
21462 pub struct DeleteTool(RequestBuilder<crate::model::DeleteToolRequest>);
21463
21464 impl DeleteTool {
21465 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21466 Self(RequestBuilder::new(stub))
21467 }
21468
21469 pub fn with_request<V: Into<crate::model::DeleteToolRequest>>(mut self, v: V) -> Self {
21471 self.0.request = v.into();
21472 self
21473 }
21474
21475 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
21477 self.0.options = v.into();
21478 self
21479 }
21480
21481 pub async fn send(self) -> Result<()> {
21483 (*self.0.stub)
21484 .delete_tool(self.0.request, self.0.options)
21485 .await
21486 .map(gax::response::Response::into_body)
21487 }
21488
21489 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21493 self.0.request.name = v.into();
21494 self
21495 }
21496 }
21497
21498 #[doc(hidden)]
21499 impl gax::options::internal::RequestBuilder for DeleteTool {
21500 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
21501 &mut self.0.options
21502 }
21503 }
21504
21505 #[derive(Clone, Debug)]
21522 pub struct UpdateTool(RequestBuilder<crate::model::UpdateToolRequest>);
21523
21524 impl UpdateTool {
21525 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21526 Self(RequestBuilder::new(stub))
21527 }
21528
21529 pub fn with_request<V: Into<crate::model::UpdateToolRequest>>(mut self, v: V) -> Self {
21531 self.0.request = v.into();
21532 self
21533 }
21534
21535 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
21537 self.0.options = v.into();
21538 self
21539 }
21540
21541 pub async fn send(self) -> Result<crate::model::Tool> {
21543 (*self.0.stub)
21544 .update_tool(self.0.request, self.0.options)
21545 .await
21546 .map(gax::response::Response::into_body)
21547 }
21548
21549 pub fn set_tool<T>(mut self, v: T) -> Self
21553 where
21554 T: std::convert::Into<crate::model::Tool>,
21555 {
21556 self.0.request.tool = std::option::Option::Some(v.into());
21557 self
21558 }
21559
21560 pub fn set_or_clear_tool<T>(mut self, v: std::option::Option<T>) -> Self
21564 where
21565 T: std::convert::Into<crate::model::Tool>,
21566 {
21567 self.0.request.tool = v.map(|x| x.into());
21568 self
21569 }
21570
21571 pub fn set_update_mask<T>(mut self, v: T) -> Self
21573 where
21574 T: std::convert::Into<wkt::FieldMask>,
21575 {
21576 self.0.request.update_mask = std::option::Option::Some(v.into());
21577 self
21578 }
21579
21580 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
21582 where
21583 T: std::convert::Into<wkt::FieldMask>,
21584 {
21585 self.0.request.update_mask = v.map(|x| x.into());
21586 self
21587 }
21588 }
21589
21590 #[doc(hidden)]
21591 impl gax::options::internal::RequestBuilder for UpdateTool {
21592 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
21593 &mut self.0.options
21594 }
21595 }
21596
21597 #[derive(Clone, Debug)]
21618 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
21619
21620 impl ListLocations {
21621 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21622 Self(RequestBuilder::new(stub))
21623 }
21624
21625 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
21627 mut self,
21628 v: V,
21629 ) -> Self {
21630 self.0.request = v.into();
21631 self
21632 }
21633
21634 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
21636 self.0.options = v.into();
21637 self
21638 }
21639
21640 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
21642 (*self.0.stub)
21643 .list_locations(self.0.request, self.0.options)
21644 .await
21645 .map(gax::response::Response::into_body)
21646 }
21647
21648 pub fn by_page(
21650 self,
21651 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
21652 {
21653 use std::clone::Clone;
21654 let token = self.0.request.page_token.clone();
21655 let execute = move |token: String| {
21656 let mut builder = self.clone();
21657 builder.0.request = builder.0.request.set_page_token(token);
21658 builder.send()
21659 };
21660 gax::paginator::internal::new_paginator(token, execute)
21661 }
21662
21663 pub fn by_item(
21665 self,
21666 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
21667 {
21668 use gax::paginator::Paginator;
21669 self.by_page().items()
21670 }
21671
21672 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21674 self.0.request.name = v.into();
21675 self
21676 }
21677
21678 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
21680 self.0.request.filter = v.into();
21681 self
21682 }
21683
21684 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
21686 self.0.request.page_size = v.into();
21687 self
21688 }
21689
21690 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
21692 self.0.request.page_token = v.into();
21693 self
21694 }
21695 }
21696
21697 #[doc(hidden)]
21698 impl gax::options::internal::RequestBuilder for ListLocations {
21699 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
21700 &mut self.0.options
21701 }
21702 }
21703
21704 #[derive(Clone, Debug)]
21721 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
21722
21723 impl GetLocation {
21724 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21725 Self(RequestBuilder::new(stub))
21726 }
21727
21728 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
21730 self.0.request = v.into();
21731 self
21732 }
21733
21734 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
21736 self.0.options = v.into();
21737 self
21738 }
21739
21740 pub async fn send(self) -> Result<location::model::Location> {
21742 (*self.0.stub)
21743 .get_location(self.0.request, self.0.options)
21744 .await
21745 .map(gax::response::Response::into_body)
21746 }
21747
21748 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21750 self.0.request.name = v.into();
21751 self
21752 }
21753 }
21754
21755 #[doc(hidden)]
21756 impl gax::options::internal::RequestBuilder for GetLocation {
21757 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
21758 &mut self.0.options
21759 }
21760 }
21761
21762 #[derive(Clone, Debug)]
21783 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
21784
21785 impl ListOperations {
21786 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21787 Self(RequestBuilder::new(stub))
21788 }
21789
21790 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
21792 mut self,
21793 v: V,
21794 ) -> Self {
21795 self.0.request = v.into();
21796 self
21797 }
21798
21799 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
21801 self.0.options = v.into();
21802 self
21803 }
21804
21805 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
21807 (*self.0.stub)
21808 .list_operations(self.0.request, self.0.options)
21809 .await
21810 .map(gax::response::Response::into_body)
21811 }
21812
21813 pub fn by_page(
21815 self,
21816 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
21817 {
21818 use std::clone::Clone;
21819 let token = self.0.request.page_token.clone();
21820 let execute = move |token: String| {
21821 let mut builder = self.clone();
21822 builder.0.request = builder.0.request.set_page_token(token);
21823 builder.send()
21824 };
21825 gax::paginator::internal::new_paginator(token, execute)
21826 }
21827
21828 pub fn by_item(
21830 self,
21831 ) -> impl gax::paginator::ItemPaginator<
21832 longrunning::model::ListOperationsResponse,
21833 gax::error::Error,
21834 > {
21835 use gax::paginator::Paginator;
21836 self.by_page().items()
21837 }
21838
21839 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21841 self.0.request.name = v.into();
21842 self
21843 }
21844
21845 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
21847 self.0.request.filter = v.into();
21848 self
21849 }
21850
21851 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
21853 self.0.request.page_size = v.into();
21854 self
21855 }
21856
21857 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
21859 self.0.request.page_token = v.into();
21860 self
21861 }
21862
21863 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
21865 self.0.request.return_partial_success = v.into();
21866 self
21867 }
21868 }
21869
21870 #[doc(hidden)]
21871 impl gax::options::internal::RequestBuilder for ListOperations {
21872 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
21873 &mut self.0.options
21874 }
21875 }
21876
21877 #[derive(Clone, Debug)]
21894 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
21895
21896 impl GetOperation {
21897 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21898 Self(RequestBuilder::new(stub))
21899 }
21900
21901 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
21903 mut self,
21904 v: V,
21905 ) -> Self {
21906 self.0.request = v.into();
21907 self
21908 }
21909
21910 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
21912 self.0.options = v.into();
21913 self
21914 }
21915
21916 pub async fn send(self) -> Result<longrunning::model::Operation> {
21918 (*self.0.stub)
21919 .get_operation(self.0.request, self.0.options)
21920 .await
21921 .map(gax::response::Response::into_body)
21922 }
21923
21924 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21926 self.0.request.name = v.into();
21927 self
21928 }
21929 }
21930
21931 #[doc(hidden)]
21932 impl gax::options::internal::RequestBuilder for GetOperation {
21933 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
21934 &mut self.0.options
21935 }
21936 }
21937
21938 #[derive(Clone, Debug)]
21955 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
21956
21957 impl CancelOperation {
21958 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21959 Self(RequestBuilder::new(stub))
21960 }
21961
21962 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
21964 mut self,
21965 v: V,
21966 ) -> Self {
21967 self.0.request = v.into();
21968 self
21969 }
21970
21971 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
21973 self.0.options = v.into();
21974 self
21975 }
21976
21977 pub async fn send(self) -> Result<()> {
21979 (*self.0.stub)
21980 .cancel_operation(self.0.request, self.0.options)
21981 .await
21982 .map(gax::response::Response::into_body)
21983 }
21984
21985 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21987 self.0.request.name = v.into();
21988 self
21989 }
21990 }
21991
21992 #[doc(hidden)]
21993 impl gax::options::internal::RequestBuilder for CancelOperation {
21994 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
21995 &mut self.0.options
21996 }
21997 }
21998}
21999
22000#[cfg(feature = "versions")]
22001#[cfg_attr(docsrs, doc(cfg(feature = "versions")))]
22002pub mod versions {
22003 use crate::Result;
22004
22005 pub type ClientBuilder =
22019 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
22020
22021 pub(crate) mod client {
22022 use super::super::super::client::Versions;
22023 pub struct Factory;
22024 impl gax::client_builder::internal::ClientFactory for Factory {
22025 type Client = Versions;
22026 type Credentials = gaxi::options::Credentials;
22027 async fn build(
22028 self,
22029 config: gaxi::options::ClientConfig,
22030 ) -> gax::client_builder::Result<Self::Client> {
22031 Self::Client::new(config).await
22032 }
22033 }
22034 }
22035
22036 #[derive(Clone, Debug)]
22038 pub(crate) struct RequestBuilder<R: std::default::Default> {
22039 stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>,
22040 request: R,
22041 options: gax::options::RequestOptions,
22042 }
22043
22044 impl<R> RequestBuilder<R>
22045 where
22046 R: std::default::Default,
22047 {
22048 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22049 Self {
22050 stub,
22051 request: R::default(),
22052 options: gax::options::RequestOptions::default(),
22053 }
22054 }
22055 }
22056
22057 #[derive(Clone, Debug)]
22078 pub struct ListVersions(RequestBuilder<crate::model::ListVersionsRequest>);
22079
22080 impl ListVersions {
22081 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22082 Self(RequestBuilder::new(stub))
22083 }
22084
22085 pub fn with_request<V: Into<crate::model::ListVersionsRequest>>(mut self, v: V) -> Self {
22087 self.0.request = v.into();
22088 self
22089 }
22090
22091 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
22093 self.0.options = v.into();
22094 self
22095 }
22096
22097 pub async fn send(self) -> Result<crate::model::ListVersionsResponse> {
22099 (*self.0.stub)
22100 .list_versions(self.0.request, self.0.options)
22101 .await
22102 .map(gax::response::Response::into_body)
22103 }
22104
22105 pub fn by_page(
22107 self,
22108 ) -> impl gax::paginator::Paginator<crate::model::ListVersionsResponse, gax::error::Error>
22109 {
22110 use std::clone::Clone;
22111 let token = self.0.request.page_token.clone();
22112 let execute = move |token: String| {
22113 let mut builder = self.clone();
22114 builder.0.request = builder.0.request.set_page_token(token);
22115 builder.send()
22116 };
22117 gax::paginator::internal::new_paginator(token, execute)
22118 }
22119
22120 pub fn by_item(
22122 self,
22123 ) -> impl gax::paginator::ItemPaginator<crate::model::ListVersionsResponse, gax::error::Error>
22124 {
22125 use gax::paginator::Paginator;
22126 self.by_page().items()
22127 }
22128
22129 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
22133 self.0.request.parent = v.into();
22134 self
22135 }
22136
22137 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
22139 self.0.request.page_size = v.into();
22140 self
22141 }
22142
22143 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
22145 self.0.request.page_token = v.into();
22146 self
22147 }
22148 }
22149
22150 #[doc(hidden)]
22151 impl gax::options::internal::RequestBuilder for ListVersions {
22152 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
22153 &mut self.0.options
22154 }
22155 }
22156
22157 #[derive(Clone, Debug)]
22174 pub struct GetVersion(RequestBuilder<crate::model::GetVersionRequest>);
22175
22176 impl GetVersion {
22177 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22178 Self(RequestBuilder::new(stub))
22179 }
22180
22181 pub fn with_request<V: Into<crate::model::GetVersionRequest>>(mut self, v: V) -> Self {
22183 self.0.request = v.into();
22184 self
22185 }
22186
22187 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
22189 self.0.options = v.into();
22190 self
22191 }
22192
22193 pub async fn send(self) -> Result<crate::model::Version> {
22195 (*self.0.stub)
22196 .get_version(self.0.request, self.0.options)
22197 .await
22198 .map(gax::response::Response::into_body)
22199 }
22200
22201 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22205 self.0.request.name = v.into();
22206 self
22207 }
22208 }
22209
22210 #[doc(hidden)]
22211 impl gax::options::internal::RequestBuilder for GetVersion {
22212 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
22213 &mut self.0.options
22214 }
22215 }
22216
22217 #[derive(Clone, Debug)]
22234 pub struct CreateVersion(RequestBuilder<crate::model::CreateVersionRequest>);
22235
22236 impl CreateVersion {
22237 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22238 Self(RequestBuilder::new(stub))
22239 }
22240
22241 pub fn with_request<V: Into<crate::model::CreateVersionRequest>>(mut self, v: V) -> Self {
22243 self.0.request = v.into();
22244 self
22245 }
22246
22247 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
22249 self.0.options = v.into();
22250 self
22251 }
22252
22253 pub async fn send(self) -> Result<crate::model::Version> {
22255 (*self.0.stub)
22256 .create_version(self.0.request, self.0.options)
22257 .await
22258 .map(gax::response::Response::into_body)
22259 }
22260
22261 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
22265 self.0.request.parent = v.into();
22266 self
22267 }
22268
22269 pub fn set_version<T>(mut self, v: T) -> Self
22273 where
22274 T: std::convert::Into<crate::model::Version>,
22275 {
22276 self.0.request.version = std::option::Option::Some(v.into());
22277 self
22278 }
22279
22280 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
22284 where
22285 T: std::convert::Into<crate::model::Version>,
22286 {
22287 self.0.request.version = v.map(|x| x.into());
22288 self
22289 }
22290 }
22291
22292 #[doc(hidden)]
22293 impl gax::options::internal::RequestBuilder for CreateVersion {
22294 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
22295 &mut self.0.options
22296 }
22297 }
22298
22299 #[derive(Clone, Debug)]
22316 pub struct UpdateVersion(RequestBuilder<crate::model::UpdateVersionRequest>);
22317
22318 impl UpdateVersion {
22319 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22320 Self(RequestBuilder::new(stub))
22321 }
22322
22323 pub fn with_request<V: Into<crate::model::UpdateVersionRequest>>(mut self, v: V) -> Self {
22325 self.0.request = v.into();
22326 self
22327 }
22328
22329 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
22331 self.0.options = v.into();
22332 self
22333 }
22334
22335 pub async fn send(self) -> Result<crate::model::Version> {
22337 (*self.0.stub)
22338 .update_version(self.0.request, self.0.options)
22339 .await
22340 .map(gax::response::Response::into_body)
22341 }
22342
22343 pub fn set_version<T>(mut self, v: T) -> Self
22347 where
22348 T: std::convert::Into<crate::model::Version>,
22349 {
22350 self.0.request.version = std::option::Option::Some(v.into());
22351 self
22352 }
22353
22354 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
22358 where
22359 T: std::convert::Into<crate::model::Version>,
22360 {
22361 self.0.request.version = v.map(|x| x.into());
22362 self
22363 }
22364
22365 pub fn set_update_mask<T>(mut self, v: T) -> Self
22369 where
22370 T: std::convert::Into<wkt::FieldMask>,
22371 {
22372 self.0.request.update_mask = std::option::Option::Some(v.into());
22373 self
22374 }
22375
22376 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
22380 where
22381 T: std::convert::Into<wkt::FieldMask>,
22382 {
22383 self.0.request.update_mask = v.map(|x| x.into());
22384 self
22385 }
22386 }
22387
22388 #[doc(hidden)]
22389 impl gax::options::internal::RequestBuilder for UpdateVersion {
22390 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
22391 &mut self.0.options
22392 }
22393 }
22394
22395 #[derive(Clone, Debug)]
22412 pub struct DeleteVersion(RequestBuilder<crate::model::DeleteVersionRequest>);
22413
22414 impl DeleteVersion {
22415 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22416 Self(RequestBuilder::new(stub))
22417 }
22418
22419 pub fn with_request<V: Into<crate::model::DeleteVersionRequest>>(mut self, v: V) -> Self {
22421 self.0.request = v.into();
22422 self
22423 }
22424
22425 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
22427 self.0.options = v.into();
22428 self
22429 }
22430
22431 pub async fn send(self) -> Result<()> {
22433 (*self.0.stub)
22434 .delete_version(self.0.request, self.0.options)
22435 .await
22436 .map(gax::response::Response::into_body)
22437 }
22438
22439 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22443 self.0.request.name = v.into();
22444 self
22445 }
22446 }
22447
22448 #[doc(hidden)]
22449 impl gax::options::internal::RequestBuilder for DeleteVersion {
22450 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
22451 &mut self.0.options
22452 }
22453 }
22454
22455 #[derive(Clone, Debug)]
22476 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
22477
22478 impl ListLocations {
22479 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22480 Self(RequestBuilder::new(stub))
22481 }
22482
22483 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
22485 mut self,
22486 v: V,
22487 ) -> Self {
22488 self.0.request = v.into();
22489 self
22490 }
22491
22492 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
22494 self.0.options = v.into();
22495 self
22496 }
22497
22498 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
22500 (*self.0.stub)
22501 .list_locations(self.0.request, self.0.options)
22502 .await
22503 .map(gax::response::Response::into_body)
22504 }
22505
22506 pub fn by_page(
22508 self,
22509 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
22510 {
22511 use std::clone::Clone;
22512 let token = self.0.request.page_token.clone();
22513 let execute = move |token: String| {
22514 let mut builder = self.clone();
22515 builder.0.request = builder.0.request.set_page_token(token);
22516 builder.send()
22517 };
22518 gax::paginator::internal::new_paginator(token, execute)
22519 }
22520
22521 pub fn by_item(
22523 self,
22524 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
22525 {
22526 use gax::paginator::Paginator;
22527 self.by_page().items()
22528 }
22529
22530 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22532 self.0.request.name = v.into();
22533 self
22534 }
22535
22536 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
22538 self.0.request.filter = v.into();
22539 self
22540 }
22541
22542 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
22544 self.0.request.page_size = v.into();
22545 self
22546 }
22547
22548 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
22550 self.0.request.page_token = v.into();
22551 self
22552 }
22553 }
22554
22555 #[doc(hidden)]
22556 impl gax::options::internal::RequestBuilder for ListLocations {
22557 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
22558 &mut self.0.options
22559 }
22560 }
22561
22562 #[derive(Clone, Debug)]
22579 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
22580
22581 impl GetLocation {
22582 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22583 Self(RequestBuilder::new(stub))
22584 }
22585
22586 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
22588 self.0.request = v.into();
22589 self
22590 }
22591
22592 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
22594 self.0.options = v.into();
22595 self
22596 }
22597
22598 pub async fn send(self) -> Result<location::model::Location> {
22600 (*self.0.stub)
22601 .get_location(self.0.request, self.0.options)
22602 .await
22603 .map(gax::response::Response::into_body)
22604 }
22605
22606 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22608 self.0.request.name = v.into();
22609 self
22610 }
22611 }
22612
22613 #[doc(hidden)]
22614 impl gax::options::internal::RequestBuilder for GetLocation {
22615 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
22616 &mut self.0.options
22617 }
22618 }
22619
22620 #[derive(Clone, Debug)]
22641 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
22642
22643 impl ListOperations {
22644 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22645 Self(RequestBuilder::new(stub))
22646 }
22647
22648 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
22650 mut self,
22651 v: V,
22652 ) -> Self {
22653 self.0.request = v.into();
22654 self
22655 }
22656
22657 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
22659 self.0.options = v.into();
22660 self
22661 }
22662
22663 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
22665 (*self.0.stub)
22666 .list_operations(self.0.request, self.0.options)
22667 .await
22668 .map(gax::response::Response::into_body)
22669 }
22670
22671 pub fn by_page(
22673 self,
22674 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
22675 {
22676 use std::clone::Clone;
22677 let token = self.0.request.page_token.clone();
22678 let execute = move |token: String| {
22679 let mut builder = self.clone();
22680 builder.0.request = builder.0.request.set_page_token(token);
22681 builder.send()
22682 };
22683 gax::paginator::internal::new_paginator(token, execute)
22684 }
22685
22686 pub fn by_item(
22688 self,
22689 ) -> impl gax::paginator::ItemPaginator<
22690 longrunning::model::ListOperationsResponse,
22691 gax::error::Error,
22692 > {
22693 use gax::paginator::Paginator;
22694 self.by_page().items()
22695 }
22696
22697 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22699 self.0.request.name = v.into();
22700 self
22701 }
22702
22703 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
22705 self.0.request.filter = v.into();
22706 self
22707 }
22708
22709 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
22711 self.0.request.page_size = v.into();
22712 self
22713 }
22714
22715 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
22717 self.0.request.page_token = v.into();
22718 self
22719 }
22720
22721 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
22723 self.0.request.return_partial_success = v.into();
22724 self
22725 }
22726 }
22727
22728 #[doc(hidden)]
22729 impl gax::options::internal::RequestBuilder for ListOperations {
22730 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
22731 &mut self.0.options
22732 }
22733 }
22734
22735 #[derive(Clone, Debug)]
22752 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
22753
22754 impl GetOperation {
22755 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22756 Self(RequestBuilder::new(stub))
22757 }
22758
22759 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
22761 mut self,
22762 v: V,
22763 ) -> Self {
22764 self.0.request = v.into();
22765 self
22766 }
22767
22768 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
22770 self.0.options = v.into();
22771 self
22772 }
22773
22774 pub async fn send(self) -> Result<longrunning::model::Operation> {
22776 (*self.0.stub)
22777 .get_operation(self.0.request, self.0.options)
22778 .await
22779 .map(gax::response::Response::into_body)
22780 }
22781
22782 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22784 self.0.request.name = v.into();
22785 self
22786 }
22787 }
22788
22789 #[doc(hidden)]
22790 impl gax::options::internal::RequestBuilder for GetOperation {
22791 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
22792 &mut self.0.options
22793 }
22794 }
22795
22796 #[derive(Clone, Debug)]
22813 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
22814
22815 impl CancelOperation {
22816 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22817 Self(RequestBuilder::new(stub))
22818 }
22819
22820 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
22822 mut self,
22823 v: V,
22824 ) -> Self {
22825 self.0.request = v.into();
22826 self
22827 }
22828
22829 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
22831 self.0.options = v.into();
22832 self
22833 }
22834
22835 pub async fn send(self) -> Result<()> {
22837 (*self.0.stub)
22838 .cancel_operation(self.0.request, self.0.options)
22839 .await
22840 .map(gax::response::Response::into_body)
22841 }
22842
22843 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22845 self.0.request.name = v.into();
22846 self
22847 }
22848 }
22849
22850 #[doc(hidden)]
22851 impl gax::options::internal::RequestBuilder for CancelOperation {
22852 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
22853 &mut self.0.options
22854 }
22855 }
22856}