1#[cfg(feature = "agents")]
19#[cfg_attr(docsrs, doc(cfg(feature = "agents")))]
20pub mod agents {
21 use crate::Result;
22
23 pub type ClientBuilder = crate::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 crate::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 ) -> crate::ClientBuilderResult<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: crate::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: crate::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<crate::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(crate::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 crate::RequestBuilder for GetAgent {
129 fn request_options(&mut self) -> &mut crate::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<crate::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(crate::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 crate::RequestBuilder for SetAgent {
221 fn request_options(&mut self) -> &mut crate::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<crate::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(crate::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 crate::RequestBuilder for DeleteAgent {
281 fn request_options(&mut self) -> &mut crate::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<crate::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(crate::Response::into_body)
332 }
333
334 pub fn by_page(
336 self,
337 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::SearchAgentsResponse, crate::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 google_cloud_gax::paginator::internal::new_paginator(token, execute)
347 }
348
349 pub fn by_item(
351 self,
352 ) -> impl google_cloud_gax::paginator::ItemPaginator<
353 crate::model::SearchAgentsResponse,
354 crate::Error,
355 > {
356 use google_cloud_gax::paginator::Paginator;
357 self.by_page().items()
358 }
359
360 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
364 self.0.request.parent = v.into();
365 self
366 }
367
368 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
370 self.0.request.page_size = v.into();
371 self
372 }
373
374 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
376 self.0.request.page_token = v.into();
377 self
378 }
379 }
380
381 #[doc(hidden)]
382 impl crate::RequestBuilder for SearchAgents {
383 fn request_options(&mut self) -> &mut crate::RequestOptions {
384 &mut self.0.options
385 }
386 }
387
388 #[derive(Clone, Debug)]
406 pub struct TrainAgent(RequestBuilder<crate::model::TrainAgentRequest>);
407
408 impl TrainAgent {
409 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
410 Self(RequestBuilder::new(stub))
411 }
412
413 pub fn with_request<V: Into<crate::model::TrainAgentRequest>>(mut self, v: V) -> Self {
415 self.0.request = v.into();
416 self
417 }
418
419 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
421 self.0.options = v.into();
422 self
423 }
424
425 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
432 (*self.0.stub)
433 .train_agent(self.0.request, self.0.options)
434 .await
435 .map(crate::Response::into_body)
436 }
437
438 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
440 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
441 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
442 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
443
444 let stub = self.0.stub.clone();
445 let mut options = self.0.options.clone();
446 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
447 let query = move |name| {
448 let stub = stub.clone();
449 let options = options.clone();
450 async {
451 let op = GetOperation::new(stub)
452 .set_name(name)
453 .with_options(options)
454 .send()
455 .await?;
456 Ok(Operation::new(op))
457 }
458 };
459
460 let start = move || async {
461 let op = self.send().await?;
462 Ok(Operation::new(op))
463 };
464
465 google_cloud_lro::internal::new_unit_response_poller(
466 polling_error_policy,
467 polling_backoff_policy,
468 start,
469 query,
470 )
471 }
472
473 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
477 self.0.request.parent = v.into();
478 self
479 }
480 }
481
482 #[doc(hidden)]
483 impl crate::RequestBuilder for TrainAgent {
484 fn request_options(&mut self) -> &mut crate::RequestOptions {
485 &mut self.0.options
486 }
487 }
488
489 #[derive(Clone, Debug)]
507 pub struct ExportAgent(RequestBuilder<crate::model::ExportAgentRequest>);
508
509 impl ExportAgent {
510 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
511 Self(RequestBuilder::new(stub))
512 }
513
514 pub fn with_request<V: Into<crate::model::ExportAgentRequest>>(mut self, v: V) -> Self {
516 self.0.request = v.into();
517 self
518 }
519
520 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
522 self.0.options = v.into();
523 self
524 }
525
526 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
533 (*self.0.stub)
534 .export_agent(self.0.request, self.0.options)
535 .await
536 .map(crate::Response::into_body)
537 }
538
539 pub fn poller(
541 self,
542 ) -> impl google_cloud_lro::Poller<crate::model::ExportAgentResponse, wkt::Struct> {
543 type Operation = google_cloud_lro::internal::Operation<
544 crate::model::ExportAgentResponse,
545 wkt::Struct,
546 >;
547 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
548 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
549
550 let stub = self.0.stub.clone();
551 let mut options = self.0.options.clone();
552 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
553 let query = move |name| {
554 let stub = stub.clone();
555 let options = options.clone();
556 async {
557 let op = GetOperation::new(stub)
558 .set_name(name)
559 .with_options(options)
560 .send()
561 .await?;
562 Ok(Operation::new(op))
563 }
564 };
565
566 let start = move || async {
567 let op = self.send().await?;
568 Ok(Operation::new(op))
569 };
570
571 google_cloud_lro::internal::new_poller(
572 polling_error_policy,
573 polling_backoff_policy,
574 start,
575 query,
576 )
577 }
578
579 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
583 self.0.request.parent = v.into();
584 self
585 }
586
587 pub fn set_agent_uri<T: Into<std::string::String>>(mut self, v: T) -> Self {
591 self.0.request.agent_uri = v.into();
592 self
593 }
594 }
595
596 #[doc(hidden)]
597 impl crate::RequestBuilder for ExportAgent {
598 fn request_options(&mut self) -> &mut crate::RequestOptions {
599 &mut self.0.options
600 }
601 }
602
603 #[derive(Clone, Debug)]
621 pub struct ImportAgent(RequestBuilder<crate::model::ImportAgentRequest>);
622
623 impl ImportAgent {
624 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
625 Self(RequestBuilder::new(stub))
626 }
627
628 pub fn with_request<V: Into<crate::model::ImportAgentRequest>>(mut self, v: V) -> Self {
630 self.0.request = v.into();
631 self
632 }
633
634 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
636 self.0.options = v.into();
637 self
638 }
639
640 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
647 (*self.0.stub)
648 .import_agent(self.0.request, self.0.options)
649 .await
650 .map(crate::Response::into_body)
651 }
652
653 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
655 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
656 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
657 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
658
659 let stub = self.0.stub.clone();
660 let mut options = self.0.options.clone();
661 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
662 let query = move |name| {
663 let stub = stub.clone();
664 let options = options.clone();
665 async {
666 let op = GetOperation::new(stub)
667 .set_name(name)
668 .with_options(options)
669 .send()
670 .await?;
671 Ok(Operation::new(op))
672 }
673 };
674
675 let start = move || async {
676 let op = self.send().await?;
677 Ok(Operation::new(op))
678 };
679
680 google_cloud_lro::internal::new_unit_response_poller(
681 polling_error_policy,
682 polling_backoff_policy,
683 start,
684 query,
685 )
686 }
687
688 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
692 self.0.request.parent = v.into();
693 self
694 }
695
696 pub fn set_agent<T: Into<Option<crate::model::import_agent_request::Agent>>>(
701 mut self,
702 v: T,
703 ) -> Self {
704 self.0.request.agent = v.into();
705 self
706 }
707
708 pub fn set_agent_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
714 self.0.request = self.0.request.set_agent_uri(v);
715 self
716 }
717
718 pub fn set_agent_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
724 self.0.request = self.0.request.set_agent_content(v);
725 self
726 }
727 }
728
729 #[doc(hidden)]
730 impl crate::RequestBuilder for ImportAgent {
731 fn request_options(&mut self) -> &mut crate::RequestOptions {
732 &mut self.0.options
733 }
734 }
735
736 #[derive(Clone, Debug)]
754 pub struct RestoreAgent(RequestBuilder<crate::model::RestoreAgentRequest>);
755
756 impl RestoreAgent {
757 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
758 Self(RequestBuilder::new(stub))
759 }
760
761 pub fn with_request<V: Into<crate::model::RestoreAgentRequest>>(mut self, v: V) -> Self {
763 self.0.request = v.into();
764 self
765 }
766
767 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
769 self.0.options = v.into();
770 self
771 }
772
773 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
780 (*self.0.stub)
781 .restore_agent(self.0.request, self.0.options)
782 .await
783 .map(crate::Response::into_body)
784 }
785
786 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
788 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
789 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
790 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
791
792 let stub = self.0.stub.clone();
793 let mut options = self.0.options.clone();
794 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
795 let query = move |name| {
796 let stub = stub.clone();
797 let options = options.clone();
798 async {
799 let op = GetOperation::new(stub)
800 .set_name(name)
801 .with_options(options)
802 .send()
803 .await?;
804 Ok(Operation::new(op))
805 }
806 };
807
808 let start = move || async {
809 let op = self.send().await?;
810 Ok(Operation::new(op))
811 };
812
813 google_cloud_lro::internal::new_unit_response_poller(
814 polling_error_policy,
815 polling_backoff_policy,
816 start,
817 query,
818 )
819 }
820
821 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
825 self.0.request.parent = v.into();
826 self
827 }
828
829 pub fn set_agent<T: Into<Option<crate::model::restore_agent_request::Agent>>>(
834 mut self,
835 v: T,
836 ) -> Self {
837 self.0.request.agent = v.into();
838 self
839 }
840
841 pub fn set_agent_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
847 self.0.request = self.0.request.set_agent_uri(v);
848 self
849 }
850
851 pub fn set_agent_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
857 self.0.request = self.0.request.set_agent_content(v);
858 self
859 }
860 }
861
862 #[doc(hidden)]
863 impl crate::RequestBuilder for RestoreAgent {
864 fn request_options(&mut self) -> &mut crate::RequestOptions {
865 &mut self.0.options
866 }
867 }
868
869 #[derive(Clone, Debug)]
886 pub struct GetValidationResult(RequestBuilder<crate::model::GetValidationResultRequest>);
887
888 impl GetValidationResult {
889 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
890 Self(RequestBuilder::new(stub))
891 }
892
893 pub fn with_request<V: Into<crate::model::GetValidationResultRequest>>(
895 mut self,
896 v: V,
897 ) -> Self {
898 self.0.request = v.into();
899 self
900 }
901
902 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
904 self.0.options = v.into();
905 self
906 }
907
908 pub async fn send(self) -> Result<crate::model::ValidationResult> {
910 (*self.0.stub)
911 .get_validation_result(self.0.request, self.0.options)
912 .await
913 .map(crate::Response::into_body)
914 }
915
916 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
920 self.0.request.parent = v.into();
921 self
922 }
923
924 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
926 self.0.request.language_code = v.into();
927 self
928 }
929 }
930
931 #[doc(hidden)]
932 impl crate::RequestBuilder for GetValidationResult {
933 fn request_options(&mut self) -> &mut crate::RequestOptions {
934 &mut self.0.options
935 }
936 }
937
938 #[derive(Clone, Debug)]
959 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
960
961 impl ListLocations {
962 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
963 Self(RequestBuilder::new(stub))
964 }
965
966 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
968 mut self,
969 v: V,
970 ) -> Self {
971 self.0.request = v.into();
972 self
973 }
974
975 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
977 self.0.options = v.into();
978 self
979 }
980
981 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
983 (*self.0.stub)
984 .list_locations(self.0.request, self.0.options)
985 .await
986 .map(crate::Response::into_body)
987 }
988
989 pub fn by_page(
991 self,
992 ) -> impl google_cloud_gax::paginator::Paginator<
993 google_cloud_location::model::ListLocationsResponse,
994 crate::Error,
995 > {
996 use std::clone::Clone;
997 let token = self.0.request.page_token.clone();
998 let execute = move |token: String| {
999 let mut builder = self.clone();
1000 builder.0.request = builder.0.request.set_page_token(token);
1001 builder.send()
1002 };
1003 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1004 }
1005
1006 pub fn by_item(
1008 self,
1009 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1010 google_cloud_location::model::ListLocationsResponse,
1011 crate::Error,
1012 > {
1013 use google_cloud_gax::paginator::Paginator;
1014 self.by_page().items()
1015 }
1016
1017 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1019 self.0.request.name = v.into();
1020 self
1021 }
1022
1023 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1025 self.0.request.filter = v.into();
1026 self
1027 }
1028
1029 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1031 self.0.request.page_size = v.into();
1032 self
1033 }
1034
1035 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1037 self.0.request.page_token = v.into();
1038 self
1039 }
1040 }
1041
1042 #[doc(hidden)]
1043 impl crate::RequestBuilder for ListLocations {
1044 fn request_options(&mut self) -> &mut crate::RequestOptions {
1045 &mut self.0.options
1046 }
1047 }
1048
1049 #[derive(Clone, Debug)]
1066 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1067
1068 impl GetLocation {
1069 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1070 Self(RequestBuilder::new(stub))
1071 }
1072
1073 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1075 mut self,
1076 v: V,
1077 ) -> Self {
1078 self.0.request = v.into();
1079 self
1080 }
1081
1082 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1084 self.0.options = v.into();
1085 self
1086 }
1087
1088 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1090 (*self.0.stub)
1091 .get_location(self.0.request, self.0.options)
1092 .await
1093 .map(crate::Response::into_body)
1094 }
1095
1096 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1098 self.0.request.name = v.into();
1099 self
1100 }
1101 }
1102
1103 #[doc(hidden)]
1104 impl crate::RequestBuilder for GetLocation {
1105 fn request_options(&mut self) -> &mut crate::RequestOptions {
1106 &mut self.0.options
1107 }
1108 }
1109
1110 #[derive(Clone, Debug)]
1131 pub struct ListOperations(
1132 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1133 );
1134
1135 impl ListOperations {
1136 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1137 Self(RequestBuilder::new(stub))
1138 }
1139
1140 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1142 mut self,
1143 v: V,
1144 ) -> Self {
1145 self.0.request = v.into();
1146 self
1147 }
1148
1149 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1151 self.0.options = v.into();
1152 self
1153 }
1154
1155 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1157 (*self.0.stub)
1158 .list_operations(self.0.request, self.0.options)
1159 .await
1160 .map(crate::Response::into_body)
1161 }
1162
1163 pub fn by_page(
1165 self,
1166 ) -> impl google_cloud_gax::paginator::Paginator<
1167 google_cloud_longrunning::model::ListOperationsResponse,
1168 crate::Error,
1169 > {
1170 use std::clone::Clone;
1171 let token = self.0.request.page_token.clone();
1172 let execute = move |token: String| {
1173 let mut builder = self.clone();
1174 builder.0.request = builder.0.request.set_page_token(token);
1175 builder.send()
1176 };
1177 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1178 }
1179
1180 pub fn by_item(
1182 self,
1183 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1184 google_cloud_longrunning::model::ListOperationsResponse,
1185 crate::Error,
1186 > {
1187 use google_cloud_gax::paginator::Paginator;
1188 self.by_page().items()
1189 }
1190
1191 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1193 self.0.request.name = v.into();
1194 self
1195 }
1196
1197 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1199 self.0.request.filter = v.into();
1200 self
1201 }
1202
1203 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1205 self.0.request.page_size = v.into();
1206 self
1207 }
1208
1209 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1211 self.0.request.page_token = v.into();
1212 self
1213 }
1214
1215 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1217 self.0.request.return_partial_success = v.into();
1218 self
1219 }
1220 }
1221
1222 #[doc(hidden)]
1223 impl crate::RequestBuilder for ListOperations {
1224 fn request_options(&mut self) -> &mut crate::RequestOptions {
1225 &mut self.0.options
1226 }
1227 }
1228
1229 #[derive(Clone, Debug)]
1246 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1247
1248 impl GetOperation {
1249 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1250 Self(RequestBuilder::new(stub))
1251 }
1252
1253 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1255 mut self,
1256 v: V,
1257 ) -> Self {
1258 self.0.request = v.into();
1259 self
1260 }
1261
1262 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1264 self.0.options = v.into();
1265 self
1266 }
1267
1268 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1270 (*self.0.stub)
1271 .get_operation(self.0.request, self.0.options)
1272 .await
1273 .map(crate::Response::into_body)
1274 }
1275
1276 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1278 self.0.request.name = v.into();
1279 self
1280 }
1281 }
1282
1283 #[doc(hidden)]
1284 impl crate::RequestBuilder for GetOperation {
1285 fn request_options(&mut self) -> &mut crate::RequestOptions {
1286 &mut self.0.options
1287 }
1288 }
1289
1290 #[derive(Clone, Debug)]
1307 pub struct CancelOperation(
1308 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
1309 );
1310
1311 impl CancelOperation {
1312 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Agents>) -> Self {
1313 Self(RequestBuilder::new(stub))
1314 }
1315
1316 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
1318 mut self,
1319 v: V,
1320 ) -> Self {
1321 self.0.request = v.into();
1322 self
1323 }
1324
1325 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1327 self.0.options = v.into();
1328 self
1329 }
1330
1331 pub async fn send(self) -> Result<()> {
1333 (*self.0.stub)
1334 .cancel_operation(self.0.request, self.0.options)
1335 .await
1336 .map(crate::Response::into_body)
1337 }
1338
1339 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1341 self.0.request.name = v.into();
1342 self
1343 }
1344 }
1345
1346 #[doc(hidden)]
1347 impl crate::RequestBuilder for CancelOperation {
1348 fn request_options(&mut self) -> &mut crate::RequestOptions {
1349 &mut self.0.options
1350 }
1351 }
1352}
1353
1354#[cfg(feature = "answer-records")]
1356#[cfg_attr(docsrs, doc(cfg(feature = "answer-records")))]
1357pub mod answer_records {
1358 use crate::Result;
1359
1360 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
1374
1375 pub(crate) mod client {
1376 use super::super::super::client::AnswerRecords;
1377 pub struct Factory;
1378 impl crate::ClientFactory for Factory {
1379 type Client = AnswerRecords;
1380 type Credentials = gaxi::options::Credentials;
1381 async fn build(
1382 self,
1383 config: gaxi::options::ClientConfig,
1384 ) -> crate::ClientBuilderResult<Self::Client> {
1385 Self::Client::new(config).await
1386 }
1387 }
1388 }
1389
1390 #[derive(Clone, Debug)]
1392 pub(crate) struct RequestBuilder<R: std::default::Default> {
1393 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1394 request: R,
1395 options: crate::RequestOptions,
1396 }
1397
1398 impl<R> RequestBuilder<R>
1399 where
1400 R: std::default::Default,
1401 {
1402 pub(crate) fn new(
1403 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1404 ) -> Self {
1405 Self {
1406 stub,
1407 request: R::default(),
1408 options: crate::RequestOptions::default(),
1409 }
1410 }
1411 }
1412
1413 #[derive(Clone, Debug)]
1434 pub struct ListAnswerRecords(RequestBuilder<crate::model::ListAnswerRecordsRequest>);
1435
1436 impl ListAnswerRecords {
1437 pub(crate) fn new(
1438 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1439 ) -> Self {
1440 Self(RequestBuilder::new(stub))
1441 }
1442
1443 pub fn with_request<V: Into<crate::model::ListAnswerRecordsRequest>>(
1445 mut self,
1446 v: V,
1447 ) -> Self {
1448 self.0.request = v.into();
1449 self
1450 }
1451
1452 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1454 self.0.options = v.into();
1455 self
1456 }
1457
1458 pub async fn send(self) -> Result<crate::model::ListAnswerRecordsResponse> {
1460 (*self.0.stub)
1461 .list_answer_records(self.0.request, self.0.options)
1462 .await
1463 .map(crate::Response::into_body)
1464 }
1465
1466 pub fn by_page(
1468 self,
1469 ) -> impl google_cloud_gax::paginator::Paginator<
1470 crate::model::ListAnswerRecordsResponse,
1471 crate::Error,
1472 > {
1473 use std::clone::Clone;
1474 let token = self.0.request.page_token.clone();
1475 let execute = move |token: String| {
1476 let mut builder = self.clone();
1477 builder.0.request = builder.0.request.set_page_token(token);
1478 builder.send()
1479 };
1480 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1481 }
1482
1483 pub fn by_item(
1485 self,
1486 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1487 crate::model::ListAnswerRecordsResponse,
1488 crate::Error,
1489 > {
1490 use google_cloud_gax::paginator::Paginator;
1491 self.by_page().items()
1492 }
1493
1494 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1498 self.0.request.parent = v.into();
1499 self
1500 }
1501
1502 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1504 self.0.request.filter = v.into();
1505 self
1506 }
1507
1508 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1510 self.0.request.page_size = v.into();
1511 self
1512 }
1513
1514 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1516 self.0.request.page_token = v.into();
1517 self
1518 }
1519 }
1520
1521 #[doc(hidden)]
1522 impl crate::RequestBuilder for ListAnswerRecords {
1523 fn request_options(&mut self) -> &mut crate::RequestOptions {
1524 &mut self.0.options
1525 }
1526 }
1527
1528 #[derive(Clone, Debug)]
1545 pub struct UpdateAnswerRecord(RequestBuilder<crate::model::UpdateAnswerRecordRequest>);
1546
1547 impl UpdateAnswerRecord {
1548 pub(crate) fn new(
1549 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1550 ) -> Self {
1551 Self(RequestBuilder::new(stub))
1552 }
1553
1554 pub fn with_request<V: Into<crate::model::UpdateAnswerRecordRequest>>(
1556 mut self,
1557 v: V,
1558 ) -> Self {
1559 self.0.request = v.into();
1560 self
1561 }
1562
1563 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1565 self.0.options = v.into();
1566 self
1567 }
1568
1569 pub async fn send(self) -> Result<crate::model::AnswerRecord> {
1571 (*self.0.stub)
1572 .update_answer_record(self.0.request, self.0.options)
1573 .await
1574 .map(crate::Response::into_body)
1575 }
1576
1577 pub fn set_answer_record<T>(mut self, v: T) -> Self
1581 where
1582 T: std::convert::Into<crate::model::AnswerRecord>,
1583 {
1584 self.0.request.answer_record = std::option::Option::Some(v.into());
1585 self
1586 }
1587
1588 pub fn set_or_clear_answer_record<T>(mut self, v: std::option::Option<T>) -> Self
1592 where
1593 T: std::convert::Into<crate::model::AnswerRecord>,
1594 {
1595 self.0.request.answer_record = v.map(|x| x.into());
1596 self
1597 }
1598
1599 pub fn set_update_mask<T>(mut self, v: T) -> Self
1603 where
1604 T: std::convert::Into<wkt::FieldMask>,
1605 {
1606 self.0.request.update_mask = std::option::Option::Some(v.into());
1607 self
1608 }
1609
1610 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1614 where
1615 T: std::convert::Into<wkt::FieldMask>,
1616 {
1617 self.0.request.update_mask = v.map(|x| x.into());
1618 self
1619 }
1620 }
1621
1622 #[doc(hidden)]
1623 impl crate::RequestBuilder for UpdateAnswerRecord {
1624 fn request_options(&mut self) -> &mut crate::RequestOptions {
1625 &mut self.0.options
1626 }
1627 }
1628
1629 #[derive(Clone, Debug)]
1650 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
1651
1652 impl ListLocations {
1653 pub(crate) fn new(
1654 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1655 ) -> Self {
1656 Self(RequestBuilder::new(stub))
1657 }
1658
1659 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
1661 mut self,
1662 v: V,
1663 ) -> Self {
1664 self.0.request = v.into();
1665 self
1666 }
1667
1668 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1670 self.0.options = v.into();
1671 self
1672 }
1673
1674 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
1676 (*self.0.stub)
1677 .list_locations(self.0.request, self.0.options)
1678 .await
1679 .map(crate::Response::into_body)
1680 }
1681
1682 pub fn by_page(
1684 self,
1685 ) -> impl google_cloud_gax::paginator::Paginator<
1686 google_cloud_location::model::ListLocationsResponse,
1687 crate::Error,
1688 > {
1689 use std::clone::Clone;
1690 let token = self.0.request.page_token.clone();
1691 let execute = move |token: String| {
1692 let mut builder = self.clone();
1693 builder.0.request = builder.0.request.set_page_token(token);
1694 builder.send()
1695 };
1696 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1697 }
1698
1699 pub fn by_item(
1701 self,
1702 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1703 google_cloud_location::model::ListLocationsResponse,
1704 crate::Error,
1705 > {
1706 use google_cloud_gax::paginator::Paginator;
1707 self.by_page().items()
1708 }
1709
1710 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1712 self.0.request.name = v.into();
1713 self
1714 }
1715
1716 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1718 self.0.request.filter = v.into();
1719 self
1720 }
1721
1722 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1724 self.0.request.page_size = v.into();
1725 self
1726 }
1727
1728 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1730 self.0.request.page_token = v.into();
1731 self
1732 }
1733 }
1734
1735 #[doc(hidden)]
1736 impl crate::RequestBuilder for ListLocations {
1737 fn request_options(&mut self) -> &mut crate::RequestOptions {
1738 &mut self.0.options
1739 }
1740 }
1741
1742 #[derive(Clone, Debug)]
1759 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
1760
1761 impl GetLocation {
1762 pub(crate) fn new(
1763 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1764 ) -> Self {
1765 Self(RequestBuilder::new(stub))
1766 }
1767
1768 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
1770 mut self,
1771 v: V,
1772 ) -> Self {
1773 self.0.request = v.into();
1774 self
1775 }
1776
1777 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1779 self.0.options = v.into();
1780 self
1781 }
1782
1783 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
1785 (*self.0.stub)
1786 .get_location(self.0.request, self.0.options)
1787 .await
1788 .map(crate::Response::into_body)
1789 }
1790
1791 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1793 self.0.request.name = v.into();
1794 self
1795 }
1796 }
1797
1798 #[doc(hidden)]
1799 impl crate::RequestBuilder for GetLocation {
1800 fn request_options(&mut self) -> &mut crate::RequestOptions {
1801 &mut self.0.options
1802 }
1803 }
1804
1805 #[derive(Clone, Debug)]
1826 pub struct ListOperations(
1827 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
1828 );
1829
1830 impl ListOperations {
1831 pub(crate) fn new(
1832 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1833 ) -> Self {
1834 Self(RequestBuilder::new(stub))
1835 }
1836
1837 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
1839 mut self,
1840 v: V,
1841 ) -> Self {
1842 self.0.request = v.into();
1843 self
1844 }
1845
1846 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1848 self.0.options = v.into();
1849 self
1850 }
1851
1852 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
1854 (*self.0.stub)
1855 .list_operations(self.0.request, self.0.options)
1856 .await
1857 .map(crate::Response::into_body)
1858 }
1859
1860 pub fn by_page(
1862 self,
1863 ) -> impl google_cloud_gax::paginator::Paginator<
1864 google_cloud_longrunning::model::ListOperationsResponse,
1865 crate::Error,
1866 > {
1867 use std::clone::Clone;
1868 let token = self.0.request.page_token.clone();
1869 let execute = move |token: String| {
1870 let mut builder = self.clone();
1871 builder.0.request = builder.0.request.set_page_token(token);
1872 builder.send()
1873 };
1874 google_cloud_gax::paginator::internal::new_paginator(token, execute)
1875 }
1876
1877 pub fn by_item(
1879 self,
1880 ) -> impl google_cloud_gax::paginator::ItemPaginator<
1881 google_cloud_longrunning::model::ListOperationsResponse,
1882 crate::Error,
1883 > {
1884 use google_cloud_gax::paginator::Paginator;
1885 self.by_page().items()
1886 }
1887
1888 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1890 self.0.request.name = v.into();
1891 self
1892 }
1893
1894 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1896 self.0.request.filter = v.into();
1897 self
1898 }
1899
1900 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1902 self.0.request.page_size = v.into();
1903 self
1904 }
1905
1906 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1908 self.0.request.page_token = v.into();
1909 self
1910 }
1911
1912 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1914 self.0.request.return_partial_success = v.into();
1915 self
1916 }
1917 }
1918
1919 #[doc(hidden)]
1920 impl crate::RequestBuilder for ListOperations {
1921 fn request_options(&mut self) -> &mut crate::RequestOptions {
1922 &mut self.0.options
1923 }
1924 }
1925
1926 #[derive(Clone, Debug)]
1943 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
1944
1945 impl GetOperation {
1946 pub(crate) fn new(
1947 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
1948 ) -> Self {
1949 Self(RequestBuilder::new(stub))
1950 }
1951
1952 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
1954 mut self,
1955 v: V,
1956 ) -> Self {
1957 self.0.request = v.into();
1958 self
1959 }
1960
1961 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1963 self.0.options = v.into();
1964 self
1965 }
1966
1967 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
1969 (*self.0.stub)
1970 .get_operation(self.0.request, self.0.options)
1971 .await
1972 .map(crate::Response::into_body)
1973 }
1974
1975 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1977 self.0.request.name = v.into();
1978 self
1979 }
1980 }
1981
1982 #[doc(hidden)]
1983 impl crate::RequestBuilder for GetOperation {
1984 fn request_options(&mut self) -> &mut crate::RequestOptions {
1985 &mut self.0.options
1986 }
1987 }
1988
1989 #[derive(Clone, Debug)]
2006 pub struct CancelOperation(
2007 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2008 );
2009
2010 impl CancelOperation {
2011 pub(crate) fn new(
2012 stub: std::sync::Arc<dyn super::super::stub::dynamic::AnswerRecords>,
2013 ) -> Self {
2014 Self(RequestBuilder::new(stub))
2015 }
2016
2017 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2019 mut self,
2020 v: V,
2021 ) -> Self {
2022 self.0.request = v.into();
2023 self
2024 }
2025
2026 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2028 self.0.options = v.into();
2029 self
2030 }
2031
2032 pub async fn send(self) -> Result<()> {
2034 (*self.0.stub)
2035 .cancel_operation(self.0.request, self.0.options)
2036 .await
2037 .map(crate::Response::into_body)
2038 }
2039
2040 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2042 self.0.request.name = v.into();
2043 self
2044 }
2045 }
2046
2047 #[doc(hidden)]
2048 impl crate::RequestBuilder for CancelOperation {
2049 fn request_options(&mut self) -> &mut crate::RequestOptions {
2050 &mut self.0.options
2051 }
2052 }
2053}
2054
2055#[cfg(feature = "contexts")]
2057#[cfg_attr(docsrs, doc(cfg(feature = "contexts")))]
2058pub mod contexts {
2059 use crate::Result;
2060
2061 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2075
2076 pub(crate) mod client {
2077 use super::super::super::client::Contexts;
2078 pub struct Factory;
2079 impl crate::ClientFactory for Factory {
2080 type Client = Contexts;
2081 type Credentials = gaxi::options::Credentials;
2082 async fn build(
2083 self,
2084 config: gaxi::options::ClientConfig,
2085 ) -> crate::ClientBuilderResult<Self::Client> {
2086 Self::Client::new(config).await
2087 }
2088 }
2089 }
2090
2091 #[derive(Clone, Debug)]
2093 pub(crate) struct RequestBuilder<R: std::default::Default> {
2094 stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>,
2095 request: R,
2096 options: crate::RequestOptions,
2097 }
2098
2099 impl<R> RequestBuilder<R>
2100 where
2101 R: std::default::Default,
2102 {
2103 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2104 Self {
2105 stub,
2106 request: R::default(),
2107 options: crate::RequestOptions::default(),
2108 }
2109 }
2110 }
2111
2112 #[derive(Clone, Debug)]
2133 pub struct ListContexts(RequestBuilder<crate::model::ListContextsRequest>);
2134
2135 impl ListContexts {
2136 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2137 Self(RequestBuilder::new(stub))
2138 }
2139
2140 pub fn with_request<V: Into<crate::model::ListContextsRequest>>(mut self, v: V) -> Self {
2142 self.0.request = v.into();
2143 self
2144 }
2145
2146 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2148 self.0.options = v.into();
2149 self
2150 }
2151
2152 pub async fn send(self) -> Result<crate::model::ListContextsResponse> {
2154 (*self.0.stub)
2155 .list_contexts(self.0.request, self.0.options)
2156 .await
2157 .map(crate::Response::into_body)
2158 }
2159
2160 pub fn by_page(
2162 self,
2163 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListContextsResponse, crate::Error>
2164 {
2165 use std::clone::Clone;
2166 let token = self.0.request.page_token.clone();
2167 let execute = move |token: String| {
2168 let mut builder = self.clone();
2169 builder.0.request = builder.0.request.set_page_token(token);
2170 builder.send()
2171 };
2172 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2173 }
2174
2175 pub fn by_item(
2177 self,
2178 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2179 crate::model::ListContextsResponse,
2180 crate::Error,
2181 > {
2182 use google_cloud_gax::paginator::Paginator;
2183 self.by_page().items()
2184 }
2185
2186 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2190 self.0.request.parent = v.into();
2191 self
2192 }
2193
2194 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2196 self.0.request.page_size = v.into();
2197 self
2198 }
2199
2200 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2202 self.0.request.page_token = v.into();
2203 self
2204 }
2205 }
2206
2207 #[doc(hidden)]
2208 impl crate::RequestBuilder for ListContexts {
2209 fn request_options(&mut self) -> &mut crate::RequestOptions {
2210 &mut self.0.options
2211 }
2212 }
2213
2214 #[derive(Clone, Debug)]
2231 pub struct GetContext(RequestBuilder<crate::model::GetContextRequest>);
2232
2233 impl GetContext {
2234 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2235 Self(RequestBuilder::new(stub))
2236 }
2237
2238 pub fn with_request<V: Into<crate::model::GetContextRequest>>(mut self, v: V) -> Self {
2240 self.0.request = v.into();
2241 self
2242 }
2243
2244 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2246 self.0.options = v.into();
2247 self
2248 }
2249
2250 pub async fn send(self) -> Result<crate::model::Context> {
2252 (*self.0.stub)
2253 .get_context(self.0.request, self.0.options)
2254 .await
2255 .map(crate::Response::into_body)
2256 }
2257
2258 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2262 self.0.request.name = v.into();
2263 self
2264 }
2265 }
2266
2267 #[doc(hidden)]
2268 impl crate::RequestBuilder for GetContext {
2269 fn request_options(&mut self) -> &mut crate::RequestOptions {
2270 &mut self.0.options
2271 }
2272 }
2273
2274 #[derive(Clone, Debug)]
2291 pub struct CreateContext(RequestBuilder<crate::model::CreateContextRequest>);
2292
2293 impl CreateContext {
2294 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2295 Self(RequestBuilder::new(stub))
2296 }
2297
2298 pub fn with_request<V: Into<crate::model::CreateContextRequest>>(mut self, v: V) -> Self {
2300 self.0.request = v.into();
2301 self
2302 }
2303
2304 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2306 self.0.options = v.into();
2307 self
2308 }
2309
2310 pub async fn send(self) -> Result<crate::model::Context> {
2312 (*self.0.stub)
2313 .create_context(self.0.request, self.0.options)
2314 .await
2315 .map(crate::Response::into_body)
2316 }
2317
2318 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2322 self.0.request.parent = v.into();
2323 self
2324 }
2325
2326 pub fn set_context<T>(mut self, v: T) -> Self
2330 where
2331 T: std::convert::Into<crate::model::Context>,
2332 {
2333 self.0.request.context = std::option::Option::Some(v.into());
2334 self
2335 }
2336
2337 pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
2341 where
2342 T: std::convert::Into<crate::model::Context>,
2343 {
2344 self.0.request.context = v.map(|x| x.into());
2345 self
2346 }
2347 }
2348
2349 #[doc(hidden)]
2350 impl crate::RequestBuilder for CreateContext {
2351 fn request_options(&mut self) -> &mut crate::RequestOptions {
2352 &mut self.0.options
2353 }
2354 }
2355
2356 #[derive(Clone, Debug)]
2373 pub struct UpdateContext(RequestBuilder<crate::model::UpdateContextRequest>);
2374
2375 impl UpdateContext {
2376 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2377 Self(RequestBuilder::new(stub))
2378 }
2379
2380 pub fn with_request<V: Into<crate::model::UpdateContextRequest>>(mut self, v: V) -> Self {
2382 self.0.request = v.into();
2383 self
2384 }
2385
2386 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2388 self.0.options = v.into();
2389 self
2390 }
2391
2392 pub async fn send(self) -> Result<crate::model::Context> {
2394 (*self.0.stub)
2395 .update_context(self.0.request, self.0.options)
2396 .await
2397 .map(crate::Response::into_body)
2398 }
2399
2400 pub fn set_context<T>(mut self, v: T) -> Self
2404 where
2405 T: std::convert::Into<crate::model::Context>,
2406 {
2407 self.0.request.context = std::option::Option::Some(v.into());
2408 self
2409 }
2410
2411 pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
2415 where
2416 T: std::convert::Into<crate::model::Context>,
2417 {
2418 self.0.request.context = v.map(|x| x.into());
2419 self
2420 }
2421
2422 pub fn set_update_mask<T>(mut self, v: T) -> Self
2424 where
2425 T: std::convert::Into<wkt::FieldMask>,
2426 {
2427 self.0.request.update_mask = std::option::Option::Some(v.into());
2428 self
2429 }
2430
2431 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2433 where
2434 T: std::convert::Into<wkt::FieldMask>,
2435 {
2436 self.0.request.update_mask = v.map(|x| x.into());
2437 self
2438 }
2439 }
2440
2441 #[doc(hidden)]
2442 impl crate::RequestBuilder for UpdateContext {
2443 fn request_options(&mut self) -> &mut crate::RequestOptions {
2444 &mut self.0.options
2445 }
2446 }
2447
2448 #[derive(Clone, Debug)]
2465 pub struct DeleteContext(RequestBuilder<crate::model::DeleteContextRequest>);
2466
2467 impl DeleteContext {
2468 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2469 Self(RequestBuilder::new(stub))
2470 }
2471
2472 pub fn with_request<V: Into<crate::model::DeleteContextRequest>>(mut self, v: V) -> Self {
2474 self.0.request = v.into();
2475 self
2476 }
2477
2478 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2480 self.0.options = v.into();
2481 self
2482 }
2483
2484 pub async fn send(self) -> Result<()> {
2486 (*self.0.stub)
2487 .delete_context(self.0.request, self.0.options)
2488 .await
2489 .map(crate::Response::into_body)
2490 }
2491
2492 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2496 self.0.request.name = v.into();
2497 self
2498 }
2499 }
2500
2501 #[doc(hidden)]
2502 impl crate::RequestBuilder for DeleteContext {
2503 fn request_options(&mut self) -> &mut crate::RequestOptions {
2504 &mut self.0.options
2505 }
2506 }
2507
2508 #[derive(Clone, Debug)]
2525 pub struct DeleteAllContexts(RequestBuilder<crate::model::DeleteAllContextsRequest>);
2526
2527 impl DeleteAllContexts {
2528 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2529 Self(RequestBuilder::new(stub))
2530 }
2531
2532 pub fn with_request<V: Into<crate::model::DeleteAllContextsRequest>>(
2534 mut self,
2535 v: V,
2536 ) -> Self {
2537 self.0.request = v.into();
2538 self
2539 }
2540
2541 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2543 self.0.options = v.into();
2544 self
2545 }
2546
2547 pub async fn send(self) -> Result<()> {
2549 (*self.0.stub)
2550 .delete_all_contexts(self.0.request, self.0.options)
2551 .await
2552 .map(crate::Response::into_body)
2553 }
2554
2555 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2559 self.0.request.parent = v.into();
2560 self
2561 }
2562 }
2563
2564 #[doc(hidden)]
2565 impl crate::RequestBuilder for DeleteAllContexts {
2566 fn request_options(&mut self) -> &mut crate::RequestOptions {
2567 &mut self.0.options
2568 }
2569 }
2570
2571 #[derive(Clone, Debug)]
2592 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
2593
2594 impl ListLocations {
2595 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2596 Self(RequestBuilder::new(stub))
2597 }
2598
2599 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
2601 mut self,
2602 v: V,
2603 ) -> Self {
2604 self.0.request = v.into();
2605 self
2606 }
2607
2608 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2610 self.0.options = v.into();
2611 self
2612 }
2613
2614 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
2616 (*self.0.stub)
2617 .list_locations(self.0.request, self.0.options)
2618 .await
2619 .map(crate::Response::into_body)
2620 }
2621
2622 pub fn by_page(
2624 self,
2625 ) -> impl google_cloud_gax::paginator::Paginator<
2626 google_cloud_location::model::ListLocationsResponse,
2627 crate::Error,
2628 > {
2629 use std::clone::Clone;
2630 let token = self.0.request.page_token.clone();
2631 let execute = move |token: String| {
2632 let mut builder = self.clone();
2633 builder.0.request = builder.0.request.set_page_token(token);
2634 builder.send()
2635 };
2636 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2637 }
2638
2639 pub fn by_item(
2641 self,
2642 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2643 google_cloud_location::model::ListLocationsResponse,
2644 crate::Error,
2645 > {
2646 use google_cloud_gax::paginator::Paginator;
2647 self.by_page().items()
2648 }
2649
2650 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2652 self.0.request.name = v.into();
2653 self
2654 }
2655
2656 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2658 self.0.request.filter = v.into();
2659 self
2660 }
2661
2662 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2664 self.0.request.page_size = v.into();
2665 self
2666 }
2667
2668 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2670 self.0.request.page_token = v.into();
2671 self
2672 }
2673 }
2674
2675 #[doc(hidden)]
2676 impl crate::RequestBuilder for ListLocations {
2677 fn request_options(&mut self) -> &mut crate::RequestOptions {
2678 &mut self.0.options
2679 }
2680 }
2681
2682 #[derive(Clone, Debug)]
2699 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
2700
2701 impl GetLocation {
2702 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2703 Self(RequestBuilder::new(stub))
2704 }
2705
2706 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
2708 mut self,
2709 v: V,
2710 ) -> Self {
2711 self.0.request = v.into();
2712 self
2713 }
2714
2715 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2717 self.0.options = v.into();
2718 self
2719 }
2720
2721 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
2723 (*self.0.stub)
2724 .get_location(self.0.request, self.0.options)
2725 .await
2726 .map(crate::Response::into_body)
2727 }
2728
2729 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2731 self.0.request.name = v.into();
2732 self
2733 }
2734 }
2735
2736 #[doc(hidden)]
2737 impl crate::RequestBuilder for GetLocation {
2738 fn request_options(&mut self) -> &mut crate::RequestOptions {
2739 &mut self.0.options
2740 }
2741 }
2742
2743 #[derive(Clone, Debug)]
2764 pub struct ListOperations(
2765 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
2766 );
2767
2768 impl ListOperations {
2769 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2770 Self(RequestBuilder::new(stub))
2771 }
2772
2773 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
2775 mut self,
2776 v: V,
2777 ) -> Self {
2778 self.0.request = v.into();
2779 self
2780 }
2781
2782 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2784 self.0.options = v.into();
2785 self
2786 }
2787
2788 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
2790 (*self.0.stub)
2791 .list_operations(self.0.request, self.0.options)
2792 .await
2793 .map(crate::Response::into_body)
2794 }
2795
2796 pub fn by_page(
2798 self,
2799 ) -> impl google_cloud_gax::paginator::Paginator<
2800 google_cloud_longrunning::model::ListOperationsResponse,
2801 crate::Error,
2802 > {
2803 use std::clone::Clone;
2804 let token = self.0.request.page_token.clone();
2805 let execute = move |token: String| {
2806 let mut builder = self.clone();
2807 builder.0.request = builder.0.request.set_page_token(token);
2808 builder.send()
2809 };
2810 google_cloud_gax::paginator::internal::new_paginator(token, execute)
2811 }
2812
2813 pub fn by_item(
2815 self,
2816 ) -> impl google_cloud_gax::paginator::ItemPaginator<
2817 google_cloud_longrunning::model::ListOperationsResponse,
2818 crate::Error,
2819 > {
2820 use google_cloud_gax::paginator::Paginator;
2821 self.by_page().items()
2822 }
2823
2824 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2826 self.0.request.name = v.into();
2827 self
2828 }
2829
2830 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2832 self.0.request.filter = v.into();
2833 self
2834 }
2835
2836 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2838 self.0.request.page_size = v.into();
2839 self
2840 }
2841
2842 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2844 self.0.request.page_token = v.into();
2845 self
2846 }
2847
2848 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2850 self.0.request.return_partial_success = v.into();
2851 self
2852 }
2853 }
2854
2855 #[doc(hidden)]
2856 impl crate::RequestBuilder for ListOperations {
2857 fn request_options(&mut self) -> &mut crate::RequestOptions {
2858 &mut self.0.options
2859 }
2860 }
2861
2862 #[derive(Clone, Debug)]
2879 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
2880
2881 impl GetOperation {
2882 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2883 Self(RequestBuilder::new(stub))
2884 }
2885
2886 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
2888 mut self,
2889 v: V,
2890 ) -> Self {
2891 self.0.request = v.into();
2892 self
2893 }
2894
2895 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2897 self.0.options = v.into();
2898 self
2899 }
2900
2901 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
2903 (*self.0.stub)
2904 .get_operation(self.0.request, self.0.options)
2905 .await
2906 .map(crate::Response::into_body)
2907 }
2908
2909 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2911 self.0.request.name = v.into();
2912 self
2913 }
2914 }
2915
2916 #[doc(hidden)]
2917 impl crate::RequestBuilder for GetOperation {
2918 fn request_options(&mut self) -> &mut crate::RequestOptions {
2919 &mut self.0.options
2920 }
2921 }
2922
2923 #[derive(Clone, Debug)]
2940 pub struct CancelOperation(
2941 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
2942 );
2943
2944 impl CancelOperation {
2945 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Contexts>) -> Self {
2946 Self(RequestBuilder::new(stub))
2947 }
2948
2949 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
2951 mut self,
2952 v: V,
2953 ) -> Self {
2954 self.0.request = v.into();
2955 self
2956 }
2957
2958 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
2960 self.0.options = v.into();
2961 self
2962 }
2963
2964 pub async fn send(self) -> Result<()> {
2966 (*self.0.stub)
2967 .cancel_operation(self.0.request, self.0.options)
2968 .await
2969 .map(crate::Response::into_body)
2970 }
2971
2972 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2974 self.0.request.name = v.into();
2975 self
2976 }
2977 }
2978
2979 #[doc(hidden)]
2980 impl crate::RequestBuilder for CancelOperation {
2981 fn request_options(&mut self) -> &mut crate::RequestOptions {
2982 &mut self.0.options
2983 }
2984 }
2985}
2986
2987#[cfg(feature = "conversations")]
2989#[cfg_attr(docsrs, doc(cfg(feature = "conversations")))]
2990pub mod conversations {
2991 use crate::Result;
2992
2993 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
3007
3008 pub(crate) mod client {
3009 use super::super::super::client::Conversations;
3010 pub struct Factory;
3011 impl crate::ClientFactory for Factory {
3012 type Client = Conversations;
3013 type Credentials = gaxi::options::Credentials;
3014 async fn build(
3015 self,
3016 config: gaxi::options::ClientConfig,
3017 ) -> crate::ClientBuilderResult<Self::Client> {
3018 Self::Client::new(config).await
3019 }
3020 }
3021 }
3022
3023 #[derive(Clone, Debug)]
3025 pub(crate) struct RequestBuilder<R: std::default::Default> {
3026 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3027 request: R,
3028 options: crate::RequestOptions,
3029 }
3030
3031 impl<R> RequestBuilder<R>
3032 where
3033 R: std::default::Default,
3034 {
3035 pub(crate) fn new(
3036 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3037 ) -> Self {
3038 Self {
3039 stub,
3040 request: R::default(),
3041 options: crate::RequestOptions::default(),
3042 }
3043 }
3044 }
3045
3046 #[derive(Clone, Debug)]
3063 pub struct CreateConversation(RequestBuilder<crate::model::CreateConversationRequest>);
3064
3065 impl CreateConversation {
3066 pub(crate) fn new(
3067 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3068 ) -> Self {
3069 Self(RequestBuilder::new(stub))
3070 }
3071
3072 pub fn with_request<V: Into<crate::model::CreateConversationRequest>>(
3074 mut self,
3075 v: V,
3076 ) -> Self {
3077 self.0.request = v.into();
3078 self
3079 }
3080
3081 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3083 self.0.options = v.into();
3084 self
3085 }
3086
3087 pub async fn send(self) -> Result<crate::model::Conversation> {
3089 (*self.0.stub)
3090 .create_conversation(self.0.request, self.0.options)
3091 .await
3092 .map(crate::Response::into_body)
3093 }
3094
3095 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3099 self.0.request.parent = v.into();
3100 self
3101 }
3102
3103 pub fn set_conversation<T>(mut self, v: T) -> Self
3107 where
3108 T: std::convert::Into<crate::model::Conversation>,
3109 {
3110 self.0.request.conversation = std::option::Option::Some(v.into());
3111 self
3112 }
3113
3114 pub fn set_or_clear_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3118 where
3119 T: std::convert::Into<crate::model::Conversation>,
3120 {
3121 self.0.request.conversation = v.map(|x| x.into());
3122 self
3123 }
3124
3125 pub fn set_conversation_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3127 self.0.request.conversation_id = v.into();
3128 self
3129 }
3130 }
3131
3132 #[doc(hidden)]
3133 impl crate::RequestBuilder for CreateConversation {
3134 fn request_options(&mut self) -> &mut crate::RequestOptions {
3135 &mut self.0.options
3136 }
3137 }
3138
3139 #[derive(Clone, Debug)]
3160 pub struct ListConversations(RequestBuilder<crate::model::ListConversationsRequest>);
3161
3162 impl ListConversations {
3163 pub(crate) fn new(
3164 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3165 ) -> Self {
3166 Self(RequestBuilder::new(stub))
3167 }
3168
3169 pub fn with_request<V: Into<crate::model::ListConversationsRequest>>(
3171 mut self,
3172 v: V,
3173 ) -> Self {
3174 self.0.request = v.into();
3175 self
3176 }
3177
3178 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3180 self.0.options = v.into();
3181 self
3182 }
3183
3184 pub async fn send(self) -> Result<crate::model::ListConversationsResponse> {
3186 (*self.0.stub)
3187 .list_conversations(self.0.request, self.0.options)
3188 .await
3189 .map(crate::Response::into_body)
3190 }
3191
3192 pub fn by_page(
3194 self,
3195 ) -> impl google_cloud_gax::paginator::Paginator<
3196 crate::model::ListConversationsResponse,
3197 crate::Error,
3198 > {
3199 use std::clone::Clone;
3200 let token = self.0.request.page_token.clone();
3201 let execute = move |token: String| {
3202 let mut builder = self.clone();
3203 builder.0.request = builder.0.request.set_page_token(token);
3204 builder.send()
3205 };
3206 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3207 }
3208
3209 pub fn by_item(
3211 self,
3212 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3213 crate::model::ListConversationsResponse,
3214 crate::Error,
3215 > {
3216 use google_cloud_gax::paginator::Paginator;
3217 self.by_page().items()
3218 }
3219
3220 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3224 self.0.request.parent = v.into();
3225 self
3226 }
3227
3228 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3230 self.0.request.page_size = v.into();
3231 self
3232 }
3233
3234 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3236 self.0.request.page_token = v.into();
3237 self
3238 }
3239
3240 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3242 self.0.request.filter = v.into();
3243 self
3244 }
3245 }
3246
3247 #[doc(hidden)]
3248 impl crate::RequestBuilder for ListConversations {
3249 fn request_options(&mut self) -> &mut crate::RequestOptions {
3250 &mut self.0.options
3251 }
3252 }
3253
3254 #[derive(Clone, Debug)]
3271 pub struct GetConversation(RequestBuilder<crate::model::GetConversationRequest>);
3272
3273 impl GetConversation {
3274 pub(crate) fn new(
3275 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3276 ) -> Self {
3277 Self(RequestBuilder::new(stub))
3278 }
3279
3280 pub fn with_request<V: Into<crate::model::GetConversationRequest>>(mut self, v: V) -> Self {
3282 self.0.request = v.into();
3283 self
3284 }
3285
3286 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3288 self.0.options = v.into();
3289 self
3290 }
3291
3292 pub async fn send(self) -> Result<crate::model::Conversation> {
3294 (*self.0.stub)
3295 .get_conversation(self.0.request, self.0.options)
3296 .await
3297 .map(crate::Response::into_body)
3298 }
3299
3300 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3304 self.0.request.name = v.into();
3305 self
3306 }
3307 }
3308
3309 #[doc(hidden)]
3310 impl crate::RequestBuilder for GetConversation {
3311 fn request_options(&mut self) -> &mut crate::RequestOptions {
3312 &mut self.0.options
3313 }
3314 }
3315
3316 #[derive(Clone, Debug)]
3333 pub struct CompleteConversation(RequestBuilder<crate::model::CompleteConversationRequest>);
3334
3335 impl CompleteConversation {
3336 pub(crate) fn new(
3337 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3338 ) -> Self {
3339 Self(RequestBuilder::new(stub))
3340 }
3341
3342 pub fn with_request<V: Into<crate::model::CompleteConversationRequest>>(
3344 mut self,
3345 v: V,
3346 ) -> Self {
3347 self.0.request = v.into();
3348 self
3349 }
3350
3351 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3353 self.0.options = v.into();
3354 self
3355 }
3356
3357 pub async fn send(self) -> Result<crate::model::Conversation> {
3359 (*self.0.stub)
3360 .complete_conversation(self.0.request, self.0.options)
3361 .await
3362 .map(crate::Response::into_body)
3363 }
3364
3365 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3369 self.0.request.name = v.into();
3370 self
3371 }
3372 }
3373
3374 #[doc(hidden)]
3375 impl crate::RequestBuilder for CompleteConversation {
3376 fn request_options(&mut self) -> &mut crate::RequestOptions {
3377 &mut self.0.options
3378 }
3379 }
3380
3381 #[derive(Clone, Debug)]
3398 pub struct IngestContextReferences(
3399 RequestBuilder<crate::model::IngestContextReferencesRequest>,
3400 );
3401
3402 impl IngestContextReferences {
3403 pub(crate) fn new(
3404 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3405 ) -> Self {
3406 Self(RequestBuilder::new(stub))
3407 }
3408
3409 pub fn with_request<V: Into<crate::model::IngestContextReferencesRequest>>(
3411 mut self,
3412 v: V,
3413 ) -> Self {
3414 self.0.request = v.into();
3415 self
3416 }
3417
3418 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3420 self.0.options = v.into();
3421 self
3422 }
3423
3424 pub async fn send(self) -> Result<crate::model::IngestContextReferencesResponse> {
3426 (*self.0.stub)
3427 .ingest_context_references(self.0.request, self.0.options)
3428 .await
3429 .map(crate::Response::into_body)
3430 }
3431
3432 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
3436 self.0.request.conversation = v.into();
3437 self
3438 }
3439
3440 pub fn set_context_references<T, K, V>(mut self, v: T) -> Self
3444 where
3445 T: std::iter::IntoIterator<Item = (K, V)>,
3446 K: std::convert::Into<std::string::String>,
3447 V: std::convert::Into<crate::model::conversation::ContextReference>,
3448 {
3449 self.0.request.context_references =
3450 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3451 self
3452 }
3453 }
3454
3455 #[doc(hidden)]
3456 impl crate::RequestBuilder for IngestContextReferences {
3457 fn request_options(&mut self) -> &mut crate::RequestOptions {
3458 &mut self.0.options
3459 }
3460 }
3461
3462 #[derive(Clone, Debug)]
3483 pub struct ListMessages(RequestBuilder<crate::model::ListMessagesRequest>);
3484
3485 impl ListMessages {
3486 pub(crate) fn new(
3487 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3488 ) -> Self {
3489 Self(RequestBuilder::new(stub))
3490 }
3491
3492 pub fn with_request<V: Into<crate::model::ListMessagesRequest>>(mut self, v: V) -> Self {
3494 self.0.request = v.into();
3495 self
3496 }
3497
3498 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3500 self.0.options = v.into();
3501 self
3502 }
3503
3504 pub async fn send(self) -> Result<crate::model::ListMessagesResponse> {
3506 (*self.0.stub)
3507 .list_messages(self.0.request, self.0.options)
3508 .await
3509 .map(crate::Response::into_body)
3510 }
3511
3512 pub fn by_page(
3514 self,
3515 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListMessagesResponse, crate::Error>
3516 {
3517 use std::clone::Clone;
3518 let token = self.0.request.page_token.clone();
3519 let execute = move |token: String| {
3520 let mut builder = self.clone();
3521 builder.0.request = builder.0.request.set_page_token(token);
3522 builder.send()
3523 };
3524 google_cloud_gax::paginator::internal::new_paginator(token, execute)
3525 }
3526
3527 pub fn by_item(
3529 self,
3530 ) -> impl google_cloud_gax::paginator::ItemPaginator<
3531 crate::model::ListMessagesResponse,
3532 crate::Error,
3533 > {
3534 use google_cloud_gax::paginator::Paginator;
3535 self.by_page().items()
3536 }
3537
3538 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3542 self.0.request.parent = v.into();
3543 self
3544 }
3545
3546 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3548 self.0.request.filter = v.into();
3549 self
3550 }
3551
3552 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3554 self.0.request.page_size = v.into();
3555 self
3556 }
3557
3558 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3560 self.0.request.page_token = v.into();
3561 self
3562 }
3563 }
3564
3565 #[doc(hidden)]
3566 impl crate::RequestBuilder for ListMessages {
3567 fn request_options(&mut self) -> &mut crate::RequestOptions {
3568 &mut self.0.options
3569 }
3570 }
3571
3572 #[derive(Clone, Debug)]
3589 pub struct SuggestConversationSummary(
3590 RequestBuilder<crate::model::SuggestConversationSummaryRequest>,
3591 );
3592
3593 impl SuggestConversationSummary {
3594 pub(crate) fn new(
3595 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3596 ) -> Self {
3597 Self(RequestBuilder::new(stub))
3598 }
3599
3600 pub fn with_request<V: Into<crate::model::SuggestConversationSummaryRequest>>(
3602 mut self,
3603 v: V,
3604 ) -> Self {
3605 self.0.request = v.into();
3606 self
3607 }
3608
3609 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3611 self.0.options = v.into();
3612 self
3613 }
3614
3615 pub async fn send(self) -> Result<crate::model::SuggestConversationSummaryResponse> {
3617 (*self.0.stub)
3618 .suggest_conversation_summary(self.0.request, self.0.options)
3619 .await
3620 .map(crate::Response::into_body)
3621 }
3622
3623 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
3627 self.0.request.conversation = v.into();
3628 self
3629 }
3630
3631 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
3633 self.0.request.latest_message = v.into();
3634 self
3635 }
3636
3637 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
3639 self.0.request.context_size = v.into();
3640 self
3641 }
3642
3643 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
3645 where
3646 T: std::convert::Into<crate::model::AssistQueryParameters>,
3647 {
3648 self.0.request.assist_query_params = std::option::Option::Some(v.into());
3649 self
3650 }
3651
3652 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
3654 where
3655 T: std::convert::Into<crate::model::AssistQueryParameters>,
3656 {
3657 self.0.request.assist_query_params = v.map(|x| x.into());
3658 self
3659 }
3660 }
3661
3662 #[doc(hidden)]
3663 impl crate::RequestBuilder for SuggestConversationSummary {
3664 fn request_options(&mut self) -> &mut crate::RequestOptions {
3665 &mut self.0.options
3666 }
3667 }
3668
3669 #[derive(Clone, Debug)]
3686 pub struct GenerateStatelessSummary(
3687 RequestBuilder<crate::model::GenerateStatelessSummaryRequest>,
3688 );
3689
3690 impl GenerateStatelessSummary {
3691 pub(crate) fn new(
3692 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3693 ) -> Self {
3694 Self(RequestBuilder::new(stub))
3695 }
3696
3697 pub fn with_request<V: Into<crate::model::GenerateStatelessSummaryRequest>>(
3699 mut self,
3700 v: V,
3701 ) -> Self {
3702 self.0.request = v.into();
3703 self
3704 }
3705
3706 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3708 self.0.options = v.into();
3709 self
3710 }
3711
3712 pub async fn send(self) -> Result<crate::model::GenerateStatelessSummaryResponse> {
3714 (*self.0.stub)
3715 .generate_stateless_summary(self.0.request, self.0.options)
3716 .await
3717 .map(crate::Response::into_body)
3718 }
3719
3720 pub fn set_stateless_conversation<T>(mut self, v: T) -> Self
3724 where
3725 T: std::convert::Into<
3726 crate::model::generate_stateless_summary_request::MinimalConversation,
3727 >,
3728 {
3729 self.0.request.stateless_conversation = std::option::Option::Some(v.into());
3730 self
3731 }
3732
3733 pub fn set_or_clear_stateless_conversation<T>(mut self, v: std::option::Option<T>) -> Self
3737 where
3738 T: std::convert::Into<
3739 crate::model::generate_stateless_summary_request::MinimalConversation,
3740 >,
3741 {
3742 self.0.request.stateless_conversation = v.map(|x| x.into());
3743 self
3744 }
3745
3746 pub fn set_conversation_profile<T>(mut self, v: T) -> Self
3750 where
3751 T: std::convert::Into<crate::model::ConversationProfile>,
3752 {
3753 self.0.request.conversation_profile = std::option::Option::Some(v.into());
3754 self
3755 }
3756
3757 pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
3761 where
3762 T: std::convert::Into<crate::model::ConversationProfile>,
3763 {
3764 self.0.request.conversation_profile = v.map(|x| x.into());
3765 self
3766 }
3767
3768 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
3770 self.0.request.latest_message = v.into();
3771 self
3772 }
3773
3774 pub fn set_max_context_size<T: Into<i32>>(mut self, v: T) -> Self {
3776 self.0.request.max_context_size = v.into();
3777 self
3778 }
3779 }
3780
3781 #[doc(hidden)]
3782 impl crate::RequestBuilder for GenerateStatelessSummary {
3783 fn request_options(&mut self) -> &mut crate::RequestOptions {
3784 &mut self.0.options
3785 }
3786 }
3787
3788 #[derive(Clone, Debug)]
3805 pub struct GenerateStatelessSuggestion(
3806 RequestBuilder<crate::model::GenerateStatelessSuggestionRequest>,
3807 );
3808
3809 impl GenerateStatelessSuggestion {
3810 pub(crate) fn new(
3811 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3812 ) -> Self {
3813 Self(RequestBuilder::new(stub))
3814 }
3815
3816 pub fn with_request<V: Into<crate::model::GenerateStatelessSuggestionRequest>>(
3818 mut self,
3819 v: V,
3820 ) -> Self {
3821 self.0.request = v.into();
3822 self
3823 }
3824
3825 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3827 self.0.options = v.into();
3828 self
3829 }
3830
3831 pub async fn send(self) -> Result<crate::model::GenerateStatelessSuggestionResponse> {
3833 (*self.0.stub)
3834 .generate_stateless_suggestion(self.0.request, self.0.options)
3835 .await
3836 .map(crate::Response::into_body)
3837 }
3838
3839 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3843 self.0.request.parent = v.into();
3844 self
3845 }
3846
3847 pub fn set_context_references<T, K, V>(mut self, v: T) -> Self
3849 where
3850 T: std::iter::IntoIterator<Item = (K, V)>,
3851 K: std::convert::Into<std::string::String>,
3852 V: std::convert::Into<crate::model::conversation::ContextReference>,
3853 {
3854 self.0.request.context_references =
3855 v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3856 self
3857 }
3858
3859 pub fn set_conversation_context<T>(mut self, v: T) -> Self
3861 where
3862 T: std::convert::Into<crate::model::ConversationContext>,
3863 {
3864 self.0.request.conversation_context = std::option::Option::Some(v.into());
3865 self
3866 }
3867
3868 pub fn set_or_clear_conversation_context<T>(mut self, v: std::option::Option<T>) -> Self
3870 where
3871 T: std::convert::Into<crate::model::ConversationContext>,
3872 {
3873 self.0.request.conversation_context = v.map(|x| x.into());
3874 self
3875 }
3876
3877 pub fn set_trigger_events<T, V>(mut self, v: T) -> Self
3879 where
3880 T: std::iter::IntoIterator<Item = V>,
3881 V: std::convert::Into<crate::model::TriggerEvent>,
3882 {
3883 use std::iter::Iterator;
3884 self.0.request.trigger_events = v.into_iter().map(|i| i.into()).collect();
3885 self
3886 }
3887
3888 pub fn set_security_settings<T: Into<std::string::String>>(mut self, v: T) -> Self {
3890 self.0.request.security_settings = v.into();
3891 self
3892 }
3893
3894 pub fn set_generator_resource<
3899 T: Into<Option<crate::model::generate_stateless_suggestion_request::GeneratorResource>>,
3900 >(
3901 mut self,
3902 v: T,
3903 ) -> Self {
3904 self.0.request.generator_resource = v.into();
3905 self
3906 }
3907
3908 pub fn set_generator<T: std::convert::Into<std::boxed::Box<crate::model::Generator>>>(
3914 mut self,
3915 v: T,
3916 ) -> Self {
3917 self.0.request = self.0.request.set_generator(v);
3918 self
3919 }
3920
3921 pub fn set_generator_name<T: std::convert::Into<std::string::String>>(
3927 mut self,
3928 v: T,
3929 ) -> Self {
3930 self.0.request = self.0.request.set_generator_name(v);
3931 self
3932 }
3933 }
3934
3935 #[doc(hidden)]
3936 impl crate::RequestBuilder for GenerateStatelessSuggestion {
3937 fn request_options(&mut self) -> &mut crate::RequestOptions {
3938 &mut self.0.options
3939 }
3940 }
3941
3942 #[derive(Clone, Debug)]
3959 pub struct SearchKnowledge(RequestBuilder<crate::model::SearchKnowledgeRequest>);
3960
3961 impl SearchKnowledge {
3962 pub(crate) fn new(
3963 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
3964 ) -> Self {
3965 Self(RequestBuilder::new(stub))
3966 }
3967
3968 pub fn with_request<V: Into<crate::model::SearchKnowledgeRequest>>(mut self, v: V) -> Self {
3970 self.0.request = v.into();
3971 self
3972 }
3973
3974 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
3976 self.0.options = v.into();
3977 self
3978 }
3979
3980 pub async fn send(self) -> Result<crate::model::SearchKnowledgeResponse> {
3982 (*self.0.stub)
3983 .search_knowledge(self.0.request, self.0.options)
3984 .await
3985 .map(crate::Response::into_body)
3986 }
3987
3988 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3992 self.0.request.parent = v.into();
3993 self
3994 }
3995
3996 pub fn set_query<T>(mut self, v: T) -> Self
4000 where
4001 T: std::convert::Into<crate::model::TextInput>,
4002 {
4003 self.0.request.query = std::option::Option::Some(v.into());
4004 self
4005 }
4006
4007 pub fn set_or_clear_query<T>(mut self, v: std::option::Option<T>) -> Self
4011 where
4012 T: std::convert::Into<crate::model::TextInput>,
4013 {
4014 self.0.request.query = v.map(|x| x.into());
4015 self
4016 }
4017
4018 pub fn set_conversation_profile<T: Into<std::string::String>>(mut self, v: T) -> Self {
4022 self.0.request.conversation_profile = v.into();
4023 self
4024 }
4025
4026 pub fn set_session_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
4030 self.0.request.session_id = v.into();
4031 self
4032 }
4033
4034 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
4036 self.0.request.conversation = v.into();
4037 self
4038 }
4039
4040 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
4042 self.0.request.latest_message = v.into();
4043 self
4044 }
4045
4046 pub fn set_query_source<T: Into<crate::model::search_knowledge_request::QuerySource>>(
4048 mut self,
4049 v: T,
4050 ) -> Self {
4051 self.0.request.query_source = v.into();
4052 self
4053 }
4054
4055 pub fn set_end_user_metadata<T>(mut self, v: T) -> Self
4057 where
4058 T: std::convert::Into<wkt::Struct>,
4059 {
4060 self.0.request.end_user_metadata = std::option::Option::Some(v.into());
4061 self
4062 }
4063
4064 pub fn set_or_clear_end_user_metadata<T>(mut self, v: std::option::Option<T>) -> Self
4066 where
4067 T: std::convert::Into<wkt::Struct>,
4068 {
4069 self.0.request.end_user_metadata = v.map(|x| x.into());
4070 self
4071 }
4072
4073 pub fn set_search_config<T>(mut self, v: T) -> Self
4075 where
4076 T: std::convert::Into<crate::model::search_knowledge_request::SearchConfig>,
4077 {
4078 self.0.request.search_config = std::option::Option::Some(v.into());
4079 self
4080 }
4081
4082 pub fn set_or_clear_search_config<T>(mut self, v: std::option::Option<T>) -> Self
4084 where
4085 T: std::convert::Into<crate::model::search_knowledge_request::SearchConfig>,
4086 {
4087 self.0.request.search_config = v.map(|x| x.into());
4088 self
4089 }
4090
4091 pub fn set_exact_search<T: Into<bool>>(mut self, v: T) -> Self {
4093 self.0.request.exact_search = v.into();
4094 self
4095 }
4096 }
4097
4098 #[doc(hidden)]
4099 impl crate::RequestBuilder for SearchKnowledge {
4100 fn request_options(&mut self) -> &mut crate::RequestOptions {
4101 &mut self.0.options
4102 }
4103 }
4104
4105 #[derive(Clone, Debug)]
4122 pub struct GenerateSuggestions(RequestBuilder<crate::model::GenerateSuggestionsRequest>);
4123
4124 impl GenerateSuggestions {
4125 pub(crate) fn new(
4126 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4127 ) -> Self {
4128 Self(RequestBuilder::new(stub))
4129 }
4130
4131 pub fn with_request<V: Into<crate::model::GenerateSuggestionsRequest>>(
4133 mut self,
4134 v: V,
4135 ) -> Self {
4136 self.0.request = v.into();
4137 self
4138 }
4139
4140 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4142 self.0.options = v.into();
4143 self
4144 }
4145
4146 pub async fn send(self) -> Result<crate::model::GenerateSuggestionsResponse> {
4148 (*self.0.stub)
4149 .generate_suggestions(self.0.request, self.0.options)
4150 .await
4151 .map(crate::Response::into_body)
4152 }
4153
4154 pub fn set_conversation<T: Into<std::string::String>>(mut self, v: T) -> Self {
4158 self.0.request.conversation = v.into();
4159 self
4160 }
4161
4162 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
4164 self.0.request.latest_message = v.into();
4165 self
4166 }
4167
4168 pub fn set_trigger_events<T, V>(mut self, v: T) -> Self
4170 where
4171 T: std::iter::IntoIterator<Item = V>,
4172 V: std::convert::Into<crate::model::TriggerEvent>,
4173 {
4174 use std::iter::Iterator;
4175 self.0.request.trigger_events = v.into_iter().map(|i| i.into()).collect();
4176 self
4177 }
4178 }
4179
4180 #[doc(hidden)]
4181 impl crate::RequestBuilder for GenerateSuggestions {
4182 fn request_options(&mut self) -> &mut crate::RequestOptions {
4183 &mut self.0.options
4184 }
4185 }
4186
4187 #[derive(Clone, Debug)]
4208 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
4209
4210 impl ListLocations {
4211 pub(crate) fn new(
4212 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4213 ) -> Self {
4214 Self(RequestBuilder::new(stub))
4215 }
4216
4217 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
4219 mut self,
4220 v: V,
4221 ) -> Self {
4222 self.0.request = v.into();
4223 self
4224 }
4225
4226 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4228 self.0.options = v.into();
4229 self
4230 }
4231
4232 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
4234 (*self.0.stub)
4235 .list_locations(self.0.request, self.0.options)
4236 .await
4237 .map(crate::Response::into_body)
4238 }
4239
4240 pub fn by_page(
4242 self,
4243 ) -> impl google_cloud_gax::paginator::Paginator<
4244 google_cloud_location::model::ListLocationsResponse,
4245 crate::Error,
4246 > {
4247 use std::clone::Clone;
4248 let token = self.0.request.page_token.clone();
4249 let execute = move |token: String| {
4250 let mut builder = self.clone();
4251 builder.0.request = builder.0.request.set_page_token(token);
4252 builder.send()
4253 };
4254 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4255 }
4256
4257 pub fn by_item(
4259 self,
4260 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4261 google_cloud_location::model::ListLocationsResponse,
4262 crate::Error,
4263 > {
4264 use google_cloud_gax::paginator::Paginator;
4265 self.by_page().items()
4266 }
4267
4268 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4270 self.0.request.name = v.into();
4271 self
4272 }
4273
4274 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4276 self.0.request.filter = v.into();
4277 self
4278 }
4279
4280 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4282 self.0.request.page_size = v.into();
4283 self
4284 }
4285
4286 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4288 self.0.request.page_token = v.into();
4289 self
4290 }
4291 }
4292
4293 #[doc(hidden)]
4294 impl crate::RequestBuilder for ListLocations {
4295 fn request_options(&mut self) -> &mut crate::RequestOptions {
4296 &mut self.0.options
4297 }
4298 }
4299
4300 #[derive(Clone, Debug)]
4317 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
4318
4319 impl GetLocation {
4320 pub(crate) fn new(
4321 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4322 ) -> Self {
4323 Self(RequestBuilder::new(stub))
4324 }
4325
4326 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
4328 mut self,
4329 v: V,
4330 ) -> Self {
4331 self.0.request = v.into();
4332 self
4333 }
4334
4335 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4337 self.0.options = v.into();
4338 self
4339 }
4340
4341 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
4343 (*self.0.stub)
4344 .get_location(self.0.request, self.0.options)
4345 .await
4346 .map(crate::Response::into_body)
4347 }
4348
4349 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4351 self.0.request.name = v.into();
4352 self
4353 }
4354 }
4355
4356 #[doc(hidden)]
4357 impl crate::RequestBuilder for GetLocation {
4358 fn request_options(&mut self) -> &mut crate::RequestOptions {
4359 &mut self.0.options
4360 }
4361 }
4362
4363 #[derive(Clone, Debug)]
4384 pub struct ListOperations(
4385 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
4386 );
4387
4388 impl ListOperations {
4389 pub(crate) fn new(
4390 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4391 ) -> Self {
4392 Self(RequestBuilder::new(stub))
4393 }
4394
4395 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
4397 mut self,
4398 v: V,
4399 ) -> Self {
4400 self.0.request = v.into();
4401 self
4402 }
4403
4404 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4406 self.0.options = v.into();
4407 self
4408 }
4409
4410 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
4412 (*self.0.stub)
4413 .list_operations(self.0.request, self.0.options)
4414 .await
4415 .map(crate::Response::into_body)
4416 }
4417
4418 pub fn by_page(
4420 self,
4421 ) -> impl google_cloud_gax::paginator::Paginator<
4422 google_cloud_longrunning::model::ListOperationsResponse,
4423 crate::Error,
4424 > {
4425 use std::clone::Clone;
4426 let token = self.0.request.page_token.clone();
4427 let execute = move |token: String| {
4428 let mut builder = self.clone();
4429 builder.0.request = builder.0.request.set_page_token(token);
4430 builder.send()
4431 };
4432 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4433 }
4434
4435 pub fn by_item(
4437 self,
4438 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4439 google_cloud_longrunning::model::ListOperationsResponse,
4440 crate::Error,
4441 > {
4442 use google_cloud_gax::paginator::Paginator;
4443 self.by_page().items()
4444 }
4445
4446 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4448 self.0.request.name = v.into();
4449 self
4450 }
4451
4452 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4454 self.0.request.filter = v.into();
4455 self
4456 }
4457
4458 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4460 self.0.request.page_size = v.into();
4461 self
4462 }
4463
4464 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4466 self.0.request.page_token = v.into();
4467 self
4468 }
4469
4470 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4472 self.0.request.return_partial_success = v.into();
4473 self
4474 }
4475 }
4476
4477 #[doc(hidden)]
4478 impl crate::RequestBuilder for ListOperations {
4479 fn request_options(&mut self) -> &mut crate::RequestOptions {
4480 &mut self.0.options
4481 }
4482 }
4483
4484 #[derive(Clone, Debug)]
4501 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
4502
4503 impl GetOperation {
4504 pub(crate) fn new(
4505 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4506 ) -> Self {
4507 Self(RequestBuilder::new(stub))
4508 }
4509
4510 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
4512 mut self,
4513 v: V,
4514 ) -> Self {
4515 self.0.request = v.into();
4516 self
4517 }
4518
4519 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4521 self.0.options = v.into();
4522 self
4523 }
4524
4525 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4527 (*self.0.stub)
4528 .get_operation(self.0.request, self.0.options)
4529 .await
4530 .map(crate::Response::into_body)
4531 }
4532
4533 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4535 self.0.request.name = v.into();
4536 self
4537 }
4538 }
4539
4540 #[doc(hidden)]
4541 impl crate::RequestBuilder for GetOperation {
4542 fn request_options(&mut self) -> &mut crate::RequestOptions {
4543 &mut self.0.options
4544 }
4545 }
4546
4547 #[derive(Clone, Debug)]
4564 pub struct CancelOperation(
4565 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
4566 );
4567
4568 impl CancelOperation {
4569 pub(crate) fn new(
4570 stub: std::sync::Arc<dyn super::super::stub::dynamic::Conversations>,
4571 ) -> Self {
4572 Self(RequestBuilder::new(stub))
4573 }
4574
4575 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
4577 mut self,
4578 v: V,
4579 ) -> Self {
4580 self.0.request = v.into();
4581 self
4582 }
4583
4584 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4586 self.0.options = v.into();
4587 self
4588 }
4589
4590 pub async fn send(self) -> Result<()> {
4592 (*self.0.stub)
4593 .cancel_operation(self.0.request, self.0.options)
4594 .await
4595 .map(crate::Response::into_body)
4596 }
4597
4598 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4600 self.0.request.name = v.into();
4601 self
4602 }
4603 }
4604
4605 #[doc(hidden)]
4606 impl crate::RequestBuilder for CancelOperation {
4607 fn request_options(&mut self) -> &mut crate::RequestOptions {
4608 &mut self.0.options
4609 }
4610 }
4611}
4612
4613#[cfg(feature = "conversation-datasets")]
4615#[cfg_attr(docsrs, doc(cfg(feature = "conversation-datasets")))]
4616pub mod conversation_datasets {
4617 use crate::Result;
4618
4619 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
4633
4634 pub(crate) mod client {
4635 use super::super::super::client::ConversationDatasets;
4636 pub struct Factory;
4637 impl crate::ClientFactory for Factory {
4638 type Client = ConversationDatasets;
4639 type Credentials = gaxi::options::Credentials;
4640 async fn build(
4641 self,
4642 config: gaxi::options::ClientConfig,
4643 ) -> crate::ClientBuilderResult<Self::Client> {
4644 Self::Client::new(config).await
4645 }
4646 }
4647 }
4648
4649 #[derive(Clone, Debug)]
4651 pub(crate) struct RequestBuilder<R: std::default::Default> {
4652 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4653 request: R,
4654 options: crate::RequestOptions,
4655 }
4656
4657 impl<R> RequestBuilder<R>
4658 where
4659 R: std::default::Default,
4660 {
4661 pub(crate) fn new(
4662 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4663 ) -> Self {
4664 Self {
4665 stub,
4666 request: R::default(),
4667 options: crate::RequestOptions::default(),
4668 }
4669 }
4670 }
4671
4672 #[derive(Clone, Debug)]
4690 pub struct CreateConversationDataset(
4691 RequestBuilder<crate::model::CreateConversationDatasetRequest>,
4692 );
4693
4694 impl CreateConversationDataset {
4695 pub(crate) fn new(
4696 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4697 ) -> Self {
4698 Self(RequestBuilder::new(stub))
4699 }
4700
4701 pub fn with_request<V: Into<crate::model::CreateConversationDatasetRequest>>(
4703 mut self,
4704 v: V,
4705 ) -> Self {
4706 self.0.request = v.into();
4707 self
4708 }
4709
4710 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4712 self.0.options = v.into();
4713 self
4714 }
4715
4716 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
4723 (*self.0.stub)
4724 .create_conversation_dataset(self.0.request, self.0.options)
4725 .await
4726 .map(crate::Response::into_body)
4727 }
4728
4729 pub fn poller(
4731 self,
4732 ) -> impl google_cloud_lro::Poller<
4733 crate::model::ConversationDataset,
4734 crate::model::CreateConversationDatasetOperationMetadata,
4735 > {
4736 type Operation = google_cloud_lro::internal::Operation<
4737 crate::model::ConversationDataset,
4738 crate::model::CreateConversationDatasetOperationMetadata,
4739 >;
4740 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
4741 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
4742
4743 let stub = self.0.stub.clone();
4744 let mut options = self.0.options.clone();
4745 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
4746 let query = move |name| {
4747 let stub = stub.clone();
4748 let options = options.clone();
4749 async {
4750 let op = GetOperation::new(stub)
4751 .set_name(name)
4752 .with_options(options)
4753 .send()
4754 .await?;
4755 Ok(Operation::new(op))
4756 }
4757 };
4758
4759 let start = move || async {
4760 let op = self.send().await?;
4761 Ok(Operation::new(op))
4762 };
4763
4764 google_cloud_lro::internal::new_poller(
4765 polling_error_policy,
4766 polling_backoff_policy,
4767 start,
4768 query,
4769 )
4770 }
4771
4772 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4776 self.0.request.parent = v.into();
4777 self
4778 }
4779
4780 pub fn set_conversation_dataset<T>(mut self, v: T) -> Self
4784 where
4785 T: std::convert::Into<crate::model::ConversationDataset>,
4786 {
4787 self.0.request.conversation_dataset = std::option::Option::Some(v.into());
4788 self
4789 }
4790
4791 pub fn set_or_clear_conversation_dataset<T>(mut self, v: std::option::Option<T>) -> Self
4795 where
4796 T: std::convert::Into<crate::model::ConversationDataset>,
4797 {
4798 self.0.request.conversation_dataset = v.map(|x| x.into());
4799 self
4800 }
4801 }
4802
4803 #[doc(hidden)]
4804 impl crate::RequestBuilder for CreateConversationDataset {
4805 fn request_options(&mut self) -> &mut crate::RequestOptions {
4806 &mut self.0.options
4807 }
4808 }
4809
4810 #[derive(Clone, Debug)]
4827 pub struct GetConversationDataset(RequestBuilder<crate::model::GetConversationDatasetRequest>);
4828
4829 impl GetConversationDataset {
4830 pub(crate) fn new(
4831 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4832 ) -> Self {
4833 Self(RequestBuilder::new(stub))
4834 }
4835
4836 pub fn with_request<V: Into<crate::model::GetConversationDatasetRequest>>(
4838 mut self,
4839 v: V,
4840 ) -> Self {
4841 self.0.request = v.into();
4842 self
4843 }
4844
4845 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4847 self.0.options = v.into();
4848 self
4849 }
4850
4851 pub async fn send(self) -> Result<crate::model::ConversationDataset> {
4853 (*self.0.stub)
4854 .get_conversation_dataset(self.0.request, self.0.options)
4855 .await
4856 .map(crate::Response::into_body)
4857 }
4858
4859 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4863 self.0.request.name = v.into();
4864 self
4865 }
4866 }
4867
4868 #[doc(hidden)]
4869 impl crate::RequestBuilder for GetConversationDataset {
4870 fn request_options(&mut self) -> &mut crate::RequestOptions {
4871 &mut self.0.options
4872 }
4873 }
4874
4875 #[derive(Clone, Debug)]
4896 pub struct ListConversationDatasets(
4897 RequestBuilder<crate::model::ListConversationDatasetsRequest>,
4898 );
4899
4900 impl ListConversationDatasets {
4901 pub(crate) fn new(
4902 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
4903 ) -> Self {
4904 Self(RequestBuilder::new(stub))
4905 }
4906
4907 pub fn with_request<V: Into<crate::model::ListConversationDatasetsRequest>>(
4909 mut self,
4910 v: V,
4911 ) -> Self {
4912 self.0.request = v.into();
4913 self
4914 }
4915
4916 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
4918 self.0.options = v.into();
4919 self
4920 }
4921
4922 pub async fn send(self) -> Result<crate::model::ListConversationDatasetsResponse> {
4924 (*self.0.stub)
4925 .list_conversation_datasets(self.0.request, self.0.options)
4926 .await
4927 .map(crate::Response::into_body)
4928 }
4929
4930 pub fn by_page(
4932 self,
4933 ) -> impl google_cloud_gax::paginator::Paginator<
4934 crate::model::ListConversationDatasetsResponse,
4935 crate::Error,
4936 > {
4937 use std::clone::Clone;
4938 let token = self.0.request.page_token.clone();
4939 let execute = move |token: String| {
4940 let mut builder = self.clone();
4941 builder.0.request = builder.0.request.set_page_token(token);
4942 builder.send()
4943 };
4944 google_cloud_gax::paginator::internal::new_paginator(token, execute)
4945 }
4946
4947 pub fn by_item(
4949 self,
4950 ) -> impl google_cloud_gax::paginator::ItemPaginator<
4951 crate::model::ListConversationDatasetsResponse,
4952 crate::Error,
4953 > {
4954 use google_cloud_gax::paginator::Paginator;
4955 self.by_page().items()
4956 }
4957
4958 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
4962 self.0.request.parent = v.into();
4963 self
4964 }
4965
4966 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4968 self.0.request.page_size = v.into();
4969 self
4970 }
4971
4972 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4974 self.0.request.page_token = v.into();
4975 self
4976 }
4977 }
4978
4979 #[doc(hidden)]
4980 impl crate::RequestBuilder for ListConversationDatasets {
4981 fn request_options(&mut self) -> &mut crate::RequestOptions {
4982 &mut self.0.options
4983 }
4984 }
4985
4986 #[derive(Clone, Debug)]
5004 pub struct DeleteConversationDataset(
5005 RequestBuilder<crate::model::DeleteConversationDatasetRequest>,
5006 );
5007
5008 impl DeleteConversationDataset {
5009 pub(crate) fn new(
5010 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5011 ) -> Self {
5012 Self(RequestBuilder::new(stub))
5013 }
5014
5015 pub fn with_request<V: Into<crate::model::DeleteConversationDatasetRequest>>(
5017 mut self,
5018 v: V,
5019 ) -> Self {
5020 self.0.request = v.into();
5021 self
5022 }
5023
5024 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5026 self.0.options = v.into();
5027 self
5028 }
5029
5030 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5037 (*self.0.stub)
5038 .delete_conversation_dataset(self.0.request, self.0.options)
5039 .await
5040 .map(crate::Response::into_body)
5041 }
5042
5043 pub fn poller(
5045 self,
5046 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteConversationDatasetOperationMetadata>
5047 {
5048 type Operation = google_cloud_lro::internal::Operation<
5049 wkt::Empty,
5050 crate::model::DeleteConversationDatasetOperationMetadata,
5051 >;
5052 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5053 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5054
5055 let stub = self.0.stub.clone();
5056 let mut options = self.0.options.clone();
5057 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5058 let query = move |name| {
5059 let stub = stub.clone();
5060 let options = options.clone();
5061 async {
5062 let op = GetOperation::new(stub)
5063 .set_name(name)
5064 .with_options(options)
5065 .send()
5066 .await?;
5067 Ok(Operation::new(op))
5068 }
5069 };
5070
5071 let start = move || async {
5072 let op = self.send().await?;
5073 Ok(Operation::new(op))
5074 };
5075
5076 google_cloud_lro::internal::new_unit_response_poller(
5077 polling_error_policy,
5078 polling_backoff_policy,
5079 start,
5080 query,
5081 )
5082 }
5083
5084 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5088 self.0.request.name = v.into();
5089 self
5090 }
5091 }
5092
5093 #[doc(hidden)]
5094 impl crate::RequestBuilder for DeleteConversationDataset {
5095 fn request_options(&mut self) -> &mut crate::RequestOptions {
5096 &mut self.0.options
5097 }
5098 }
5099
5100 #[derive(Clone, Debug)]
5118 pub struct ImportConversationData(RequestBuilder<crate::model::ImportConversationDataRequest>);
5119
5120 impl ImportConversationData {
5121 pub(crate) fn new(
5122 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5123 ) -> Self {
5124 Self(RequestBuilder::new(stub))
5125 }
5126
5127 pub fn with_request<V: Into<crate::model::ImportConversationDataRequest>>(
5129 mut self,
5130 v: V,
5131 ) -> Self {
5132 self.0.request = v.into();
5133 self
5134 }
5135
5136 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5138 self.0.options = v.into();
5139 self
5140 }
5141
5142 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5149 (*self.0.stub)
5150 .import_conversation_data(self.0.request, self.0.options)
5151 .await
5152 .map(crate::Response::into_body)
5153 }
5154
5155 pub fn poller(
5157 self,
5158 ) -> impl google_cloud_lro::Poller<
5159 crate::model::ImportConversationDataOperationResponse,
5160 crate::model::ImportConversationDataOperationMetadata,
5161 > {
5162 type Operation = google_cloud_lro::internal::Operation<
5163 crate::model::ImportConversationDataOperationResponse,
5164 crate::model::ImportConversationDataOperationMetadata,
5165 >;
5166 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5167 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5168
5169 let stub = self.0.stub.clone();
5170 let mut options = self.0.options.clone();
5171 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5172 let query = move |name| {
5173 let stub = stub.clone();
5174 let options = options.clone();
5175 async {
5176 let op = GetOperation::new(stub)
5177 .set_name(name)
5178 .with_options(options)
5179 .send()
5180 .await?;
5181 Ok(Operation::new(op))
5182 }
5183 };
5184
5185 let start = move || async {
5186 let op = self.send().await?;
5187 Ok(Operation::new(op))
5188 };
5189
5190 google_cloud_lro::internal::new_poller(
5191 polling_error_policy,
5192 polling_backoff_policy,
5193 start,
5194 query,
5195 )
5196 }
5197
5198 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5202 self.0.request.name = v.into();
5203 self
5204 }
5205
5206 pub fn set_input_config<T>(mut self, v: T) -> Self
5210 where
5211 T: std::convert::Into<crate::model::InputConfig>,
5212 {
5213 self.0.request.input_config = std::option::Option::Some(v.into());
5214 self
5215 }
5216
5217 pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
5221 where
5222 T: std::convert::Into<crate::model::InputConfig>,
5223 {
5224 self.0.request.input_config = v.map(|x| x.into());
5225 self
5226 }
5227 }
5228
5229 #[doc(hidden)]
5230 impl crate::RequestBuilder for ImportConversationData {
5231 fn request_options(&mut self) -> &mut crate::RequestOptions {
5232 &mut self.0.options
5233 }
5234 }
5235
5236 #[derive(Clone, Debug)]
5257 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
5258
5259 impl ListLocations {
5260 pub(crate) fn new(
5261 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5262 ) -> Self {
5263 Self(RequestBuilder::new(stub))
5264 }
5265
5266 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
5268 mut self,
5269 v: V,
5270 ) -> Self {
5271 self.0.request = v.into();
5272 self
5273 }
5274
5275 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5277 self.0.options = v.into();
5278 self
5279 }
5280
5281 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
5283 (*self.0.stub)
5284 .list_locations(self.0.request, self.0.options)
5285 .await
5286 .map(crate::Response::into_body)
5287 }
5288
5289 pub fn by_page(
5291 self,
5292 ) -> impl google_cloud_gax::paginator::Paginator<
5293 google_cloud_location::model::ListLocationsResponse,
5294 crate::Error,
5295 > {
5296 use std::clone::Clone;
5297 let token = self.0.request.page_token.clone();
5298 let execute = move |token: String| {
5299 let mut builder = self.clone();
5300 builder.0.request = builder.0.request.set_page_token(token);
5301 builder.send()
5302 };
5303 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5304 }
5305
5306 pub fn by_item(
5308 self,
5309 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5310 google_cloud_location::model::ListLocationsResponse,
5311 crate::Error,
5312 > {
5313 use google_cloud_gax::paginator::Paginator;
5314 self.by_page().items()
5315 }
5316
5317 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5319 self.0.request.name = v.into();
5320 self
5321 }
5322
5323 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5325 self.0.request.filter = v.into();
5326 self
5327 }
5328
5329 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5331 self.0.request.page_size = v.into();
5332 self
5333 }
5334
5335 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5337 self.0.request.page_token = v.into();
5338 self
5339 }
5340 }
5341
5342 #[doc(hidden)]
5343 impl crate::RequestBuilder for ListLocations {
5344 fn request_options(&mut self) -> &mut crate::RequestOptions {
5345 &mut self.0.options
5346 }
5347 }
5348
5349 #[derive(Clone, Debug)]
5366 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
5367
5368 impl GetLocation {
5369 pub(crate) fn new(
5370 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5371 ) -> Self {
5372 Self(RequestBuilder::new(stub))
5373 }
5374
5375 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
5377 mut self,
5378 v: V,
5379 ) -> Self {
5380 self.0.request = v.into();
5381 self
5382 }
5383
5384 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5386 self.0.options = v.into();
5387 self
5388 }
5389
5390 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
5392 (*self.0.stub)
5393 .get_location(self.0.request, self.0.options)
5394 .await
5395 .map(crate::Response::into_body)
5396 }
5397
5398 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5400 self.0.request.name = v.into();
5401 self
5402 }
5403 }
5404
5405 #[doc(hidden)]
5406 impl crate::RequestBuilder for GetLocation {
5407 fn request_options(&mut self) -> &mut crate::RequestOptions {
5408 &mut self.0.options
5409 }
5410 }
5411
5412 #[derive(Clone, Debug)]
5433 pub struct ListOperations(
5434 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
5435 );
5436
5437 impl ListOperations {
5438 pub(crate) fn new(
5439 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5440 ) -> Self {
5441 Self(RequestBuilder::new(stub))
5442 }
5443
5444 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
5446 mut self,
5447 v: V,
5448 ) -> Self {
5449 self.0.request = v.into();
5450 self
5451 }
5452
5453 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5455 self.0.options = v.into();
5456 self
5457 }
5458
5459 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
5461 (*self.0.stub)
5462 .list_operations(self.0.request, self.0.options)
5463 .await
5464 .map(crate::Response::into_body)
5465 }
5466
5467 pub fn by_page(
5469 self,
5470 ) -> impl google_cloud_gax::paginator::Paginator<
5471 google_cloud_longrunning::model::ListOperationsResponse,
5472 crate::Error,
5473 > {
5474 use std::clone::Clone;
5475 let token = self.0.request.page_token.clone();
5476 let execute = move |token: String| {
5477 let mut builder = self.clone();
5478 builder.0.request = builder.0.request.set_page_token(token);
5479 builder.send()
5480 };
5481 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5482 }
5483
5484 pub fn by_item(
5486 self,
5487 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5488 google_cloud_longrunning::model::ListOperationsResponse,
5489 crate::Error,
5490 > {
5491 use google_cloud_gax::paginator::Paginator;
5492 self.by_page().items()
5493 }
5494
5495 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5497 self.0.request.name = v.into();
5498 self
5499 }
5500
5501 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
5503 self.0.request.filter = v.into();
5504 self
5505 }
5506
5507 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
5509 self.0.request.page_size = v.into();
5510 self
5511 }
5512
5513 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
5515 self.0.request.page_token = v.into();
5516 self
5517 }
5518
5519 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
5521 self.0.request.return_partial_success = v.into();
5522 self
5523 }
5524 }
5525
5526 #[doc(hidden)]
5527 impl crate::RequestBuilder for ListOperations {
5528 fn request_options(&mut self) -> &mut crate::RequestOptions {
5529 &mut self.0.options
5530 }
5531 }
5532
5533 #[derive(Clone, Debug)]
5550 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
5551
5552 impl GetOperation {
5553 pub(crate) fn new(
5554 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5555 ) -> Self {
5556 Self(RequestBuilder::new(stub))
5557 }
5558
5559 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
5561 mut self,
5562 v: V,
5563 ) -> Self {
5564 self.0.request = v.into();
5565 self
5566 }
5567
5568 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5570 self.0.options = v.into();
5571 self
5572 }
5573
5574 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5576 (*self.0.stub)
5577 .get_operation(self.0.request, self.0.options)
5578 .await
5579 .map(crate::Response::into_body)
5580 }
5581
5582 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5584 self.0.request.name = v.into();
5585 self
5586 }
5587 }
5588
5589 #[doc(hidden)]
5590 impl crate::RequestBuilder for GetOperation {
5591 fn request_options(&mut self) -> &mut crate::RequestOptions {
5592 &mut self.0.options
5593 }
5594 }
5595
5596 #[derive(Clone, Debug)]
5613 pub struct CancelOperation(
5614 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
5615 );
5616
5617 impl CancelOperation {
5618 pub(crate) fn new(
5619 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationDatasets>,
5620 ) -> Self {
5621 Self(RequestBuilder::new(stub))
5622 }
5623
5624 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
5626 mut self,
5627 v: V,
5628 ) -> Self {
5629 self.0.request = v.into();
5630 self
5631 }
5632
5633 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5635 self.0.options = v.into();
5636 self
5637 }
5638
5639 pub async fn send(self) -> Result<()> {
5641 (*self.0.stub)
5642 .cancel_operation(self.0.request, self.0.options)
5643 .await
5644 .map(crate::Response::into_body)
5645 }
5646
5647 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5649 self.0.request.name = v.into();
5650 self
5651 }
5652 }
5653
5654 #[doc(hidden)]
5655 impl crate::RequestBuilder for CancelOperation {
5656 fn request_options(&mut self) -> &mut crate::RequestOptions {
5657 &mut self.0.options
5658 }
5659 }
5660}
5661
5662#[cfg(feature = "conversation-models")]
5664#[cfg_attr(docsrs, doc(cfg(feature = "conversation-models")))]
5665pub mod conversation_models {
5666 use crate::Result;
5667
5668 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
5682
5683 pub(crate) mod client {
5684 use super::super::super::client::ConversationModels;
5685 pub struct Factory;
5686 impl crate::ClientFactory for Factory {
5687 type Client = ConversationModels;
5688 type Credentials = gaxi::options::Credentials;
5689 async fn build(
5690 self,
5691 config: gaxi::options::ClientConfig,
5692 ) -> crate::ClientBuilderResult<Self::Client> {
5693 Self::Client::new(config).await
5694 }
5695 }
5696 }
5697
5698 #[derive(Clone, Debug)]
5700 pub(crate) struct RequestBuilder<R: std::default::Default> {
5701 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5702 request: R,
5703 options: crate::RequestOptions,
5704 }
5705
5706 impl<R> RequestBuilder<R>
5707 where
5708 R: std::default::Default,
5709 {
5710 pub(crate) fn new(
5711 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5712 ) -> Self {
5713 Self {
5714 stub,
5715 request: R::default(),
5716 options: crate::RequestOptions::default(),
5717 }
5718 }
5719 }
5720
5721 #[derive(Clone, Debug)]
5739 pub struct CreateConversationModel(
5740 RequestBuilder<crate::model::CreateConversationModelRequest>,
5741 );
5742
5743 impl CreateConversationModel {
5744 pub(crate) fn new(
5745 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5746 ) -> Self {
5747 Self(RequestBuilder::new(stub))
5748 }
5749
5750 pub fn with_request<V: Into<crate::model::CreateConversationModelRequest>>(
5752 mut self,
5753 v: V,
5754 ) -> Self {
5755 self.0.request = v.into();
5756 self
5757 }
5758
5759 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5761 self.0.options = v.into();
5762 self
5763 }
5764
5765 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
5772 (*self.0.stub)
5773 .create_conversation_model(self.0.request, self.0.options)
5774 .await
5775 .map(crate::Response::into_body)
5776 }
5777
5778 pub fn poller(
5780 self,
5781 ) -> impl google_cloud_lro::Poller<
5782 crate::model::ConversationModel,
5783 crate::model::CreateConversationModelOperationMetadata,
5784 > {
5785 type Operation = google_cloud_lro::internal::Operation<
5786 crate::model::ConversationModel,
5787 crate::model::CreateConversationModelOperationMetadata,
5788 >;
5789 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
5790 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
5791
5792 let stub = self.0.stub.clone();
5793 let mut options = self.0.options.clone();
5794 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
5795 let query = move |name| {
5796 let stub = stub.clone();
5797 let options = options.clone();
5798 async {
5799 let op = GetOperation::new(stub)
5800 .set_name(name)
5801 .with_options(options)
5802 .send()
5803 .await?;
5804 Ok(Operation::new(op))
5805 }
5806 };
5807
5808 let start = move || async {
5809 let op = self.send().await?;
5810 Ok(Operation::new(op))
5811 };
5812
5813 google_cloud_lro::internal::new_poller(
5814 polling_error_policy,
5815 polling_backoff_policy,
5816 start,
5817 query,
5818 )
5819 }
5820
5821 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
5823 self.0.request.parent = v.into();
5824 self
5825 }
5826
5827 pub fn set_conversation_model<T>(mut self, v: T) -> Self
5831 where
5832 T: std::convert::Into<crate::model::ConversationModel>,
5833 {
5834 self.0.request.conversation_model = std::option::Option::Some(v.into());
5835 self
5836 }
5837
5838 pub fn set_or_clear_conversation_model<T>(mut self, v: std::option::Option<T>) -> Self
5842 where
5843 T: std::convert::Into<crate::model::ConversationModel>,
5844 {
5845 self.0.request.conversation_model = v.map(|x| x.into());
5846 self
5847 }
5848 }
5849
5850 #[doc(hidden)]
5851 impl crate::RequestBuilder for CreateConversationModel {
5852 fn request_options(&mut self) -> &mut crate::RequestOptions {
5853 &mut self.0.options
5854 }
5855 }
5856
5857 #[derive(Clone, Debug)]
5874 pub struct GetConversationModel(RequestBuilder<crate::model::GetConversationModelRequest>);
5875
5876 impl GetConversationModel {
5877 pub(crate) fn new(
5878 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5879 ) -> Self {
5880 Self(RequestBuilder::new(stub))
5881 }
5882
5883 pub fn with_request<V: Into<crate::model::GetConversationModelRequest>>(
5885 mut self,
5886 v: V,
5887 ) -> Self {
5888 self.0.request = v.into();
5889 self
5890 }
5891
5892 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5894 self.0.options = v.into();
5895 self
5896 }
5897
5898 pub async fn send(self) -> Result<crate::model::ConversationModel> {
5900 (*self.0.stub)
5901 .get_conversation_model(self.0.request, self.0.options)
5902 .await
5903 .map(crate::Response::into_body)
5904 }
5905
5906 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
5910 self.0.request.name = v.into();
5911 self
5912 }
5913 }
5914
5915 #[doc(hidden)]
5916 impl crate::RequestBuilder for GetConversationModel {
5917 fn request_options(&mut self) -> &mut crate::RequestOptions {
5918 &mut self.0.options
5919 }
5920 }
5921
5922 #[derive(Clone, Debug)]
5943 pub struct ListConversationModels(RequestBuilder<crate::model::ListConversationModelsRequest>);
5944
5945 impl ListConversationModels {
5946 pub(crate) fn new(
5947 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
5948 ) -> Self {
5949 Self(RequestBuilder::new(stub))
5950 }
5951
5952 pub fn with_request<V: Into<crate::model::ListConversationModelsRequest>>(
5954 mut self,
5955 v: V,
5956 ) -> Self {
5957 self.0.request = v.into();
5958 self
5959 }
5960
5961 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
5963 self.0.options = v.into();
5964 self
5965 }
5966
5967 pub async fn send(self) -> Result<crate::model::ListConversationModelsResponse> {
5969 (*self.0.stub)
5970 .list_conversation_models(self.0.request, self.0.options)
5971 .await
5972 .map(crate::Response::into_body)
5973 }
5974
5975 pub fn by_page(
5977 self,
5978 ) -> impl google_cloud_gax::paginator::Paginator<
5979 crate::model::ListConversationModelsResponse,
5980 crate::Error,
5981 > {
5982 use std::clone::Clone;
5983 let token = self.0.request.page_token.clone();
5984 let execute = move |token: String| {
5985 let mut builder = self.clone();
5986 builder.0.request = builder.0.request.set_page_token(token);
5987 builder.send()
5988 };
5989 google_cloud_gax::paginator::internal::new_paginator(token, execute)
5990 }
5991
5992 pub fn by_item(
5994 self,
5995 ) -> impl google_cloud_gax::paginator::ItemPaginator<
5996 crate::model::ListConversationModelsResponse,
5997 crate::Error,
5998 > {
5999 use google_cloud_gax::paginator::Paginator;
6000 self.by_page().items()
6001 }
6002
6003 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6007 self.0.request.parent = v.into();
6008 self
6009 }
6010
6011 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6013 self.0.request.page_size = v.into();
6014 self
6015 }
6016
6017 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6019 self.0.request.page_token = v.into();
6020 self
6021 }
6022 }
6023
6024 #[doc(hidden)]
6025 impl crate::RequestBuilder for ListConversationModels {
6026 fn request_options(&mut self) -> &mut crate::RequestOptions {
6027 &mut self.0.options
6028 }
6029 }
6030
6031 #[derive(Clone, Debug)]
6049 pub struct DeleteConversationModel(
6050 RequestBuilder<crate::model::DeleteConversationModelRequest>,
6051 );
6052
6053 impl DeleteConversationModel {
6054 pub(crate) fn new(
6055 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6056 ) -> Self {
6057 Self(RequestBuilder::new(stub))
6058 }
6059
6060 pub fn with_request<V: Into<crate::model::DeleteConversationModelRequest>>(
6062 mut self,
6063 v: V,
6064 ) -> Self {
6065 self.0.request = v.into();
6066 self
6067 }
6068
6069 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6071 self.0.options = v.into();
6072 self
6073 }
6074
6075 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6082 (*self.0.stub)
6083 .delete_conversation_model(self.0.request, self.0.options)
6084 .await
6085 .map(crate::Response::into_body)
6086 }
6087
6088 pub fn poller(
6090 self,
6091 ) -> impl google_cloud_lro::Poller<(), crate::model::DeleteConversationModelOperationMetadata>
6092 {
6093 type Operation = google_cloud_lro::internal::Operation<
6094 wkt::Empty,
6095 crate::model::DeleteConversationModelOperationMetadata,
6096 >;
6097 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6098 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6099
6100 let stub = self.0.stub.clone();
6101 let mut options = self.0.options.clone();
6102 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6103 let query = move |name| {
6104 let stub = stub.clone();
6105 let options = options.clone();
6106 async {
6107 let op = GetOperation::new(stub)
6108 .set_name(name)
6109 .with_options(options)
6110 .send()
6111 .await?;
6112 Ok(Operation::new(op))
6113 }
6114 };
6115
6116 let start = move || async {
6117 let op = self.send().await?;
6118 Ok(Operation::new(op))
6119 };
6120
6121 google_cloud_lro::internal::new_unit_response_poller(
6122 polling_error_policy,
6123 polling_backoff_policy,
6124 start,
6125 query,
6126 )
6127 }
6128
6129 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6133 self.0.request.name = v.into();
6134 self
6135 }
6136 }
6137
6138 #[doc(hidden)]
6139 impl crate::RequestBuilder for DeleteConversationModel {
6140 fn request_options(&mut self) -> &mut crate::RequestOptions {
6141 &mut self.0.options
6142 }
6143 }
6144
6145 #[derive(Clone, Debug)]
6163 pub struct DeployConversationModel(
6164 RequestBuilder<crate::model::DeployConversationModelRequest>,
6165 );
6166
6167 impl DeployConversationModel {
6168 pub(crate) fn new(
6169 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6170 ) -> Self {
6171 Self(RequestBuilder::new(stub))
6172 }
6173
6174 pub fn with_request<V: Into<crate::model::DeployConversationModelRequest>>(
6176 mut self,
6177 v: V,
6178 ) -> Self {
6179 self.0.request = v.into();
6180 self
6181 }
6182
6183 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6185 self.0.options = v.into();
6186 self
6187 }
6188
6189 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6196 (*self.0.stub)
6197 .deploy_conversation_model(self.0.request, self.0.options)
6198 .await
6199 .map(crate::Response::into_body)
6200 }
6201
6202 pub fn poller(
6204 self,
6205 ) -> impl google_cloud_lro::Poller<(), crate::model::DeployConversationModelOperationMetadata>
6206 {
6207 type Operation = google_cloud_lro::internal::Operation<
6208 wkt::Empty,
6209 crate::model::DeployConversationModelOperationMetadata,
6210 >;
6211 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6212 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6213
6214 let stub = self.0.stub.clone();
6215 let mut options = self.0.options.clone();
6216 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6217 let query = move |name| {
6218 let stub = stub.clone();
6219 let options = options.clone();
6220 async {
6221 let op = GetOperation::new(stub)
6222 .set_name(name)
6223 .with_options(options)
6224 .send()
6225 .await?;
6226 Ok(Operation::new(op))
6227 }
6228 };
6229
6230 let start = move || async {
6231 let op = self.send().await?;
6232 Ok(Operation::new(op))
6233 };
6234
6235 google_cloud_lro::internal::new_unit_response_poller(
6236 polling_error_policy,
6237 polling_backoff_policy,
6238 start,
6239 query,
6240 )
6241 }
6242
6243 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6247 self.0.request.name = v.into();
6248 self
6249 }
6250 }
6251
6252 #[doc(hidden)]
6253 impl crate::RequestBuilder for DeployConversationModel {
6254 fn request_options(&mut self) -> &mut crate::RequestOptions {
6255 &mut self.0.options
6256 }
6257 }
6258
6259 #[derive(Clone, Debug)]
6277 pub struct UndeployConversationModel(
6278 RequestBuilder<crate::model::UndeployConversationModelRequest>,
6279 );
6280
6281 impl UndeployConversationModel {
6282 pub(crate) fn new(
6283 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6284 ) -> Self {
6285 Self(RequestBuilder::new(stub))
6286 }
6287
6288 pub fn with_request<V: Into<crate::model::UndeployConversationModelRequest>>(
6290 mut self,
6291 v: V,
6292 ) -> Self {
6293 self.0.request = v.into();
6294 self
6295 }
6296
6297 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6299 self.0.options = v.into();
6300 self
6301 }
6302
6303 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6310 (*self.0.stub)
6311 .undeploy_conversation_model(self.0.request, self.0.options)
6312 .await
6313 .map(crate::Response::into_body)
6314 }
6315
6316 pub fn poller(
6318 self,
6319 ) -> impl google_cloud_lro::Poller<(), crate::model::UndeployConversationModelOperationMetadata>
6320 {
6321 type Operation = google_cloud_lro::internal::Operation<
6322 wkt::Empty,
6323 crate::model::UndeployConversationModelOperationMetadata,
6324 >;
6325 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6326 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6327
6328 let stub = self.0.stub.clone();
6329 let mut options = self.0.options.clone();
6330 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6331 let query = move |name| {
6332 let stub = stub.clone();
6333 let options = options.clone();
6334 async {
6335 let op = GetOperation::new(stub)
6336 .set_name(name)
6337 .with_options(options)
6338 .send()
6339 .await?;
6340 Ok(Operation::new(op))
6341 }
6342 };
6343
6344 let start = move || async {
6345 let op = self.send().await?;
6346 Ok(Operation::new(op))
6347 };
6348
6349 google_cloud_lro::internal::new_unit_response_poller(
6350 polling_error_policy,
6351 polling_backoff_policy,
6352 start,
6353 query,
6354 )
6355 }
6356
6357 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6361 self.0.request.name = v.into();
6362 self
6363 }
6364 }
6365
6366 #[doc(hidden)]
6367 impl crate::RequestBuilder for UndeployConversationModel {
6368 fn request_options(&mut self) -> &mut crate::RequestOptions {
6369 &mut self.0.options
6370 }
6371 }
6372
6373 #[derive(Clone, Debug)]
6390 pub struct GetConversationModelEvaluation(
6391 RequestBuilder<crate::model::GetConversationModelEvaluationRequest>,
6392 );
6393
6394 impl GetConversationModelEvaluation {
6395 pub(crate) fn new(
6396 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6397 ) -> Self {
6398 Self(RequestBuilder::new(stub))
6399 }
6400
6401 pub fn with_request<V: Into<crate::model::GetConversationModelEvaluationRequest>>(
6403 mut self,
6404 v: V,
6405 ) -> Self {
6406 self.0.request = v.into();
6407 self
6408 }
6409
6410 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6412 self.0.options = v.into();
6413 self
6414 }
6415
6416 pub async fn send(self) -> Result<crate::model::ConversationModelEvaluation> {
6418 (*self.0.stub)
6419 .get_conversation_model_evaluation(self.0.request, self.0.options)
6420 .await
6421 .map(crate::Response::into_body)
6422 }
6423
6424 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6428 self.0.request.name = v.into();
6429 self
6430 }
6431 }
6432
6433 #[doc(hidden)]
6434 impl crate::RequestBuilder for GetConversationModelEvaluation {
6435 fn request_options(&mut self) -> &mut crate::RequestOptions {
6436 &mut self.0.options
6437 }
6438 }
6439
6440 #[derive(Clone, Debug)]
6461 pub struct ListConversationModelEvaluations(
6462 RequestBuilder<crate::model::ListConversationModelEvaluationsRequest>,
6463 );
6464
6465 impl ListConversationModelEvaluations {
6466 pub(crate) fn new(
6467 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6468 ) -> Self {
6469 Self(RequestBuilder::new(stub))
6470 }
6471
6472 pub fn with_request<V: Into<crate::model::ListConversationModelEvaluationsRequest>>(
6474 mut self,
6475 v: V,
6476 ) -> Self {
6477 self.0.request = v.into();
6478 self
6479 }
6480
6481 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6483 self.0.options = v.into();
6484 self
6485 }
6486
6487 pub async fn send(self) -> Result<crate::model::ListConversationModelEvaluationsResponse> {
6489 (*self.0.stub)
6490 .list_conversation_model_evaluations(self.0.request, self.0.options)
6491 .await
6492 .map(crate::Response::into_body)
6493 }
6494
6495 pub fn by_page(
6497 self,
6498 ) -> impl google_cloud_gax::paginator::Paginator<
6499 crate::model::ListConversationModelEvaluationsResponse,
6500 crate::Error,
6501 > {
6502 use std::clone::Clone;
6503 let token = self.0.request.page_token.clone();
6504 let execute = move |token: String| {
6505 let mut builder = self.clone();
6506 builder.0.request = builder.0.request.set_page_token(token);
6507 builder.send()
6508 };
6509 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6510 }
6511
6512 pub fn by_item(
6514 self,
6515 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6516 crate::model::ListConversationModelEvaluationsResponse,
6517 crate::Error,
6518 > {
6519 use google_cloud_gax::paginator::Paginator;
6520 self.by_page().items()
6521 }
6522
6523 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6527 self.0.request.parent = v.into();
6528 self
6529 }
6530
6531 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6533 self.0.request.page_size = v.into();
6534 self
6535 }
6536
6537 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6539 self.0.request.page_token = v.into();
6540 self
6541 }
6542 }
6543
6544 #[doc(hidden)]
6545 impl crate::RequestBuilder for ListConversationModelEvaluations {
6546 fn request_options(&mut self) -> &mut crate::RequestOptions {
6547 &mut self.0.options
6548 }
6549 }
6550
6551 #[derive(Clone, Debug)]
6569 pub struct CreateConversationModelEvaluation(
6570 RequestBuilder<crate::model::CreateConversationModelEvaluationRequest>,
6571 );
6572
6573 impl CreateConversationModelEvaluation {
6574 pub(crate) fn new(
6575 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6576 ) -> Self {
6577 Self(RequestBuilder::new(stub))
6578 }
6579
6580 pub fn with_request<V: Into<crate::model::CreateConversationModelEvaluationRequest>>(
6582 mut self,
6583 v: V,
6584 ) -> Self {
6585 self.0.request = v.into();
6586 self
6587 }
6588
6589 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6591 self.0.options = v.into();
6592 self
6593 }
6594
6595 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
6602 (*self.0.stub)
6603 .create_conversation_model_evaluation(self.0.request, self.0.options)
6604 .await
6605 .map(crate::Response::into_body)
6606 }
6607
6608 pub fn poller(
6610 self,
6611 ) -> impl google_cloud_lro::Poller<
6612 crate::model::ConversationModelEvaluation,
6613 crate::model::CreateConversationModelEvaluationOperationMetadata,
6614 > {
6615 type Operation = google_cloud_lro::internal::Operation<
6616 crate::model::ConversationModelEvaluation,
6617 crate::model::CreateConversationModelEvaluationOperationMetadata,
6618 >;
6619 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
6620 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
6621
6622 let stub = self.0.stub.clone();
6623 let mut options = self.0.options.clone();
6624 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
6625 let query = move |name| {
6626 let stub = stub.clone();
6627 let options = options.clone();
6628 async {
6629 let op = GetOperation::new(stub)
6630 .set_name(name)
6631 .with_options(options)
6632 .send()
6633 .await?;
6634 Ok(Operation::new(op))
6635 }
6636 };
6637
6638 let start = move || async {
6639 let op = self.send().await?;
6640 Ok(Operation::new(op))
6641 };
6642
6643 google_cloud_lro::internal::new_poller(
6644 polling_error_policy,
6645 polling_backoff_policy,
6646 start,
6647 query,
6648 )
6649 }
6650
6651 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
6655 self.0.request.parent = v.into();
6656 self
6657 }
6658
6659 pub fn set_conversation_model_evaluation<T>(mut self, v: T) -> Self
6663 where
6664 T: std::convert::Into<crate::model::ConversationModelEvaluation>,
6665 {
6666 self.0.request.conversation_model_evaluation = std::option::Option::Some(v.into());
6667 self
6668 }
6669
6670 pub fn set_or_clear_conversation_model_evaluation<T>(
6674 mut self,
6675 v: std::option::Option<T>,
6676 ) -> Self
6677 where
6678 T: std::convert::Into<crate::model::ConversationModelEvaluation>,
6679 {
6680 self.0.request.conversation_model_evaluation = v.map(|x| x.into());
6681 self
6682 }
6683 }
6684
6685 #[doc(hidden)]
6686 impl crate::RequestBuilder for CreateConversationModelEvaluation {
6687 fn request_options(&mut self) -> &mut crate::RequestOptions {
6688 &mut self.0.options
6689 }
6690 }
6691
6692 #[derive(Clone, Debug)]
6713 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
6714
6715 impl ListLocations {
6716 pub(crate) fn new(
6717 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6718 ) -> Self {
6719 Self(RequestBuilder::new(stub))
6720 }
6721
6722 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
6724 mut self,
6725 v: V,
6726 ) -> Self {
6727 self.0.request = v.into();
6728 self
6729 }
6730
6731 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6733 self.0.options = v.into();
6734 self
6735 }
6736
6737 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
6739 (*self.0.stub)
6740 .list_locations(self.0.request, self.0.options)
6741 .await
6742 .map(crate::Response::into_body)
6743 }
6744
6745 pub fn by_page(
6747 self,
6748 ) -> impl google_cloud_gax::paginator::Paginator<
6749 google_cloud_location::model::ListLocationsResponse,
6750 crate::Error,
6751 > {
6752 use std::clone::Clone;
6753 let token = self.0.request.page_token.clone();
6754 let execute = move |token: String| {
6755 let mut builder = self.clone();
6756 builder.0.request = builder.0.request.set_page_token(token);
6757 builder.send()
6758 };
6759 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6760 }
6761
6762 pub fn by_item(
6764 self,
6765 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6766 google_cloud_location::model::ListLocationsResponse,
6767 crate::Error,
6768 > {
6769 use google_cloud_gax::paginator::Paginator;
6770 self.by_page().items()
6771 }
6772
6773 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6775 self.0.request.name = v.into();
6776 self
6777 }
6778
6779 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6781 self.0.request.filter = v.into();
6782 self
6783 }
6784
6785 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6787 self.0.request.page_size = v.into();
6788 self
6789 }
6790
6791 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6793 self.0.request.page_token = v.into();
6794 self
6795 }
6796 }
6797
6798 #[doc(hidden)]
6799 impl crate::RequestBuilder for ListLocations {
6800 fn request_options(&mut self) -> &mut crate::RequestOptions {
6801 &mut self.0.options
6802 }
6803 }
6804
6805 #[derive(Clone, Debug)]
6822 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
6823
6824 impl GetLocation {
6825 pub(crate) fn new(
6826 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6827 ) -> Self {
6828 Self(RequestBuilder::new(stub))
6829 }
6830
6831 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
6833 mut self,
6834 v: V,
6835 ) -> Self {
6836 self.0.request = v.into();
6837 self
6838 }
6839
6840 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6842 self.0.options = v.into();
6843 self
6844 }
6845
6846 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
6848 (*self.0.stub)
6849 .get_location(self.0.request, self.0.options)
6850 .await
6851 .map(crate::Response::into_body)
6852 }
6853
6854 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6856 self.0.request.name = v.into();
6857 self
6858 }
6859 }
6860
6861 #[doc(hidden)]
6862 impl crate::RequestBuilder for GetLocation {
6863 fn request_options(&mut self) -> &mut crate::RequestOptions {
6864 &mut self.0.options
6865 }
6866 }
6867
6868 #[derive(Clone, Debug)]
6889 pub struct ListOperations(
6890 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
6891 );
6892
6893 impl ListOperations {
6894 pub(crate) fn new(
6895 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
6896 ) -> Self {
6897 Self(RequestBuilder::new(stub))
6898 }
6899
6900 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
6902 mut self,
6903 v: V,
6904 ) -> Self {
6905 self.0.request = v.into();
6906 self
6907 }
6908
6909 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
6911 self.0.options = v.into();
6912 self
6913 }
6914
6915 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
6917 (*self.0.stub)
6918 .list_operations(self.0.request, self.0.options)
6919 .await
6920 .map(crate::Response::into_body)
6921 }
6922
6923 pub fn by_page(
6925 self,
6926 ) -> impl google_cloud_gax::paginator::Paginator<
6927 google_cloud_longrunning::model::ListOperationsResponse,
6928 crate::Error,
6929 > {
6930 use std::clone::Clone;
6931 let token = self.0.request.page_token.clone();
6932 let execute = move |token: String| {
6933 let mut builder = self.clone();
6934 builder.0.request = builder.0.request.set_page_token(token);
6935 builder.send()
6936 };
6937 google_cloud_gax::paginator::internal::new_paginator(token, execute)
6938 }
6939
6940 pub fn by_item(
6942 self,
6943 ) -> impl google_cloud_gax::paginator::ItemPaginator<
6944 google_cloud_longrunning::model::ListOperationsResponse,
6945 crate::Error,
6946 > {
6947 use google_cloud_gax::paginator::Paginator;
6948 self.by_page().items()
6949 }
6950
6951 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
6953 self.0.request.name = v.into();
6954 self
6955 }
6956
6957 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
6959 self.0.request.filter = v.into();
6960 self
6961 }
6962
6963 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
6965 self.0.request.page_size = v.into();
6966 self
6967 }
6968
6969 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
6971 self.0.request.page_token = v.into();
6972 self
6973 }
6974
6975 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
6977 self.0.request.return_partial_success = v.into();
6978 self
6979 }
6980 }
6981
6982 #[doc(hidden)]
6983 impl crate::RequestBuilder for ListOperations {
6984 fn request_options(&mut self) -> &mut crate::RequestOptions {
6985 &mut self.0.options
6986 }
6987 }
6988
6989 #[derive(Clone, Debug)]
7006 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
7007
7008 impl GetOperation {
7009 pub(crate) fn new(
7010 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
7011 ) -> Self {
7012 Self(RequestBuilder::new(stub))
7013 }
7014
7015 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
7017 mut self,
7018 v: V,
7019 ) -> Self {
7020 self.0.request = v.into();
7021 self
7022 }
7023
7024 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7026 self.0.options = v.into();
7027 self
7028 }
7029
7030 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7032 (*self.0.stub)
7033 .get_operation(self.0.request, self.0.options)
7034 .await
7035 .map(crate::Response::into_body)
7036 }
7037
7038 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7040 self.0.request.name = v.into();
7041 self
7042 }
7043 }
7044
7045 #[doc(hidden)]
7046 impl crate::RequestBuilder for GetOperation {
7047 fn request_options(&mut self) -> &mut crate::RequestOptions {
7048 &mut self.0.options
7049 }
7050 }
7051
7052 #[derive(Clone, Debug)]
7069 pub struct CancelOperation(
7070 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
7071 );
7072
7073 impl CancelOperation {
7074 pub(crate) fn new(
7075 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationModels>,
7076 ) -> Self {
7077 Self(RequestBuilder::new(stub))
7078 }
7079
7080 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
7082 mut self,
7083 v: V,
7084 ) -> Self {
7085 self.0.request = v.into();
7086 self
7087 }
7088
7089 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7091 self.0.options = v.into();
7092 self
7093 }
7094
7095 pub async fn send(self) -> Result<()> {
7097 (*self.0.stub)
7098 .cancel_operation(self.0.request, self.0.options)
7099 .await
7100 .map(crate::Response::into_body)
7101 }
7102
7103 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7105 self.0.request.name = v.into();
7106 self
7107 }
7108 }
7109
7110 #[doc(hidden)]
7111 impl crate::RequestBuilder for CancelOperation {
7112 fn request_options(&mut self) -> &mut crate::RequestOptions {
7113 &mut self.0.options
7114 }
7115 }
7116}
7117
7118#[cfg(feature = "conversation-profiles")]
7120#[cfg_attr(docsrs, doc(cfg(feature = "conversation-profiles")))]
7121pub mod conversation_profiles {
7122 use crate::Result;
7123
7124 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
7138
7139 pub(crate) mod client {
7140 use super::super::super::client::ConversationProfiles;
7141 pub struct Factory;
7142 impl crate::ClientFactory for Factory {
7143 type Client = ConversationProfiles;
7144 type Credentials = gaxi::options::Credentials;
7145 async fn build(
7146 self,
7147 config: gaxi::options::ClientConfig,
7148 ) -> crate::ClientBuilderResult<Self::Client> {
7149 Self::Client::new(config).await
7150 }
7151 }
7152 }
7153
7154 #[derive(Clone, Debug)]
7156 pub(crate) struct RequestBuilder<R: std::default::Default> {
7157 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7158 request: R,
7159 options: crate::RequestOptions,
7160 }
7161
7162 impl<R> RequestBuilder<R>
7163 where
7164 R: std::default::Default,
7165 {
7166 pub(crate) fn new(
7167 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7168 ) -> Self {
7169 Self {
7170 stub,
7171 request: R::default(),
7172 options: crate::RequestOptions::default(),
7173 }
7174 }
7175 }
7176
7177 #[derive(Clone, Debug)]
7198 pub struct ListConversationProfiles(
7199 RequestBuilder<crate::model::ListConversationProfilesRequest>,
7200 );
7201
7202 impl ListConversationProfiles {
7203 pub(crate) fn new(
7204 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7205 ) -> Self {
7206 Self(RequestBuilder::new(stub))
7207 }
7208
7209 pub fn with_request<V: Into<crate::model::ListConversationProfilesRequest>>(
7211 mut self,
7212 v: V,
7213 ) -> Self {
7214 self.0.request = v.into();
7215 self
7216 }
7217
7218 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7220 self.0.options = v.into();
7221 self
7222 }
7223
7224 pub async fn send(self) -> Result<crate::model::ListConversationProfilesResponse> {
7226 (*self.0.stub)
7227 .list_conversation_profiles(self.0.request, self.0.options)
7228 .await
7229 .map(crate::Response::into_body)
7230 }
7231
7232 pub fn by_page(
7234 self,
7235 ) -> impl google_cloud_gax::paginator::Paginator<
7236 crate::model::ListConversationProfilesResponse,
7237 crate::Error,
7238 > {
7239 use std::clone::Clone;
7240 let token = self.0.request.page_token.clone();
7241 let execute = move |token: String| {
7242 let mut builder = self.clone();
7243 builder.0.request = builder.0.request.set_page_token(token);
7244 builder.send()
7245 };
7246 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7247 }
7248
7249 pub fn by_item(
7251 self,
7252 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7253 crate::model::ListConversationProfilesResponse,
7254 crate::Error,
7255 > {
7256 use google_cloud_gax::paginator::Paginator;
7257 self.by_page().items()
7258 }
7259
7260 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7264 self.0.request.parent = v.into();
7265 self
7266 }
7267
7268 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
7270 self.0.request.page_size = v.into();
7271 self
7272 }
7273
7274 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
7276 self.0.request.page_token = v.into();
7277 self
7278 }
7279 }
7280
7281 #[doc(hidden)]
7282 impl crate::RequestBuilder for ListConversationProfiles {
7283 fn request_options(&mut self) -> &mut crate::RequestOptions {
7284 &mut self.0.options
7285 }
7286 }
7287
7288 #[derive(Clone, Debug)]
7305 pub struct GetConversationProfile(RequestBuilder<crate::model::GetConversationProfileRequest>);
7306
7307 impl GetConversationProfile {
7308 pub(crate) fn new(
7309 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7310 ) -> Self {
7311 Self(RequestBuilder::new(stub))
7312 }
7313
7314 pub fn with_request<V: Into<crate::model::GetConversationProfileRequest>>(
7316 mut self,
7317 v: V,
7318 ) -> Self {
7319 self.0.request = v.into();
7320 self
7321 }
7322
7323 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7325 self.0.options = v.into();
7326 self
7327 }
7328
7329 pub async fn send(self) -> Result<crate::model::ConversationProfile> {
7331 (*self.0.stub)
7332 .get_conversation_profile(self.0.request, self.0.options)
7333 .await
7334 .map(crate::Response::into_body)
7335 }
7336
7337 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7341 self.0.request.name = v.into();
7342 self
7343 }
7344 }
7345
7346 #[doc(hidden)]
7347 impl crate::RequestBuilder for GetConversationProfile {
7348 fn request_options(&mut self) -> &mut crate::RequestOptions {
7349 &mut self.0.options
7350 }
7351 }
7352
7353 #[derive(Clone, Debug)]
7370 pub struct CreateConversationProfile(
7371 RequestBuilder<crate::model::CreateConversationProfileRequest>,
7372 );
7373
7374 impl CreateConversationProfile {
7375 pub(crate) fn new(
7376 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7377 ) -> Self {
7378 Self(RequestBuilder::new(stub))
7379 }
7380
7381 pub fn with_request<V: Into<crate::model::CreateConversationProfileRequest>>(
7383 mut self,
7384 v: V,
7385 ) -> Self {
7386 self.0.request = v.into();
7387 self
7388 }
7389
7390 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7392 self.0.options = v.into();
7393 self
7394 }
7395
7396 pub async fn send(self) -> Result<crate::model::ConversationProfile> {
7398 (*self.0.stub)
7399 .create_conversation_profile(self.0.request, self.0.options)
7400 .await
7401 .map(crate::Response::into_body)
7402 }
7403
7404 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
7408 self.0.request.parent = v.into();
7409 self
7410 }
7411
7412 pub fn set_conversation_profile<T>(mut self, v: T) -> Self
7416 where
7417 T: std::convert::Into<crate::model::ConversationProfile>,
7418 {
7419 self.0.request.conversation_profile = std::option::Option::Some(v.into());
7420 self
7421 }
7422
7423 pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
7427 where
7428 T: std::convert::Into<crate::model::ConversationProfile>,
7429 {
7430 self.0.request.conversation_profile = v.map(|x| x.into());
7431 self
7432 }
7433 }
7434
7435 #[doc(hidden)]
7436 impl crate::RequestBuilder for CreateConversationProfile {
7437 fn request_options(&mut self) -> &mut crate::RequestOptions {
7438 &mut self.0.options
7439 }
7440 }
7441
7442 #[derive(Clone, Debug)]
7459 pub struct UpdateConversationProfile(
7460 RequestBuilder<crate::model::UpdateConversationProfileRequest>,
7461 );
7462
7463 impl UpdateConversationProfile {
7464 pub(crate) fn new(
7465 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7466 ) -> Self {
7467 Self(RequestBuilder::new(stub))
7468 }
7469
7470 pub fn with_request<V: Into<crate::model::UpdateConversationProfileRequest>>(
7472 mut self,
7473 v: V,
7474 ) -> Self {
7475 self.0.request = v.into();
7476 self
7477 }
7478
7479 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7481 self.0.options = v.into();
7482 self
7483 }
7484
7485 pub async fn send(self) -> Result<crate::model::ConversationProfile> {
7487 (*self.0.stub)
7488 .update_conversation_profile(self.0.request, self.0.options)
7489 .await
7490 .map(crate::Response::into_body)
7491 }
7492
7493 pub fn set_conversation_profile<T>(mut self, v: T) -> Self
7497 where
7498 T: std::convert::Into<crate::model::ConversationProfile>,
7499 {
7500 self.0.request.conversation_profile = std::option::Option::Some(v.into());
7501 self
7502 }
7503
7504 pub fn set_or_clear_conversation_profile<T>(mut self, v: std::option::Option<T>) -> Self
7508 where
7509 T: std::convert::Into<crate::model::ConversationProfile>,
7510 {
7511 self.0.request.conversation_profile = v.map(|x| x.into());
7512 self
7513 }
7514
7515 pub fn set_update_mask<T>(mut self, v: T) -> Self
7519 where
7520 T: std::convert::Into<wkt::FieldMask>,
7521 {
7522 self.0.request.update_mask = std::option::Option::Some(v.into());
7523 self
7524 }
7525
7526 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7530 where
7531 T: std::convert::Into<wkt::FieldMask>,
7532 {
7533 self.0.request.update_mask = v.map(|x| x.into());
7534 self
7535 }
7536 }
7537
7538 #[doc(hidden)]
7539 impl crate::RequestBuilder for UpdateConversationProfile {
7540 fn request_options(&mut self) -> &mut crate::RequestOptions {
7541 &mut self.0.options
7542 }
7543 }
7544
7545 #[derive(Clone, Debug)]
7562 pub struct DeleteConversationProfile(
7563 RequestBuilder<crate::model::DeleteConversationProfileRequest>,
7564 );
7565
7566 impl DeleteConversationProfile {
7567 pub(crate) fn new(
7568 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7569 ) -> Self {
7570 Self(RequestBuilder::new(stub))
7571 }
7572
7573 pub fn with_request<V: Into<crate::model::DeleteConversationProfileRequest>>(
7575 mut self,
7576 v: V,
7577 ) -> Self {
7578 self.0.request = v.into();
7579 self
7580 }
7581
7582 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7584 self.0.options = v.into();
7585 self
7586 }
7587
7588 pub async fn send(self) -> Result<()> {
7590 (*self.0.stub)
7591 .delete_conversation_profile(self.0.request, self.0.options)
7592 .await
7593 .map(crate::Response::into_body)
7594 }
7595
7596 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7600 self.0.request.name = v.into();
7601 self
7602 }
7603 }
7604
7605 #[doc(hidden)]
7606 impl crate::RequestBuilder for DeleteConversationProfile {
7607 fn request_options(&mut self) -> &mut crate::RequestOptions {
7608 &mut self.0.options
7609 }
7610 }
7611
7612 #[derive(Clone, Debug)]
7630 pub struct SetSuggestionFeatureConfig(
7631 RequestBuilder<crate::model::SetSuggestionFeatureConfigRequest>,
7632 );
7633
7634 impl SetSuggestionFeatureConfig {
7635 pub(crate) fn new(
7636 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7637 ) -> Self {
7638 Self(RequestBuilder::new(stub))
7639 }
7640
7641 pub fn with_request<V: Into<crate::model::SetSuggestionFeatureConfigRequest>>(
7643 mut self,
7644 v: V,
7645 ) -> Self {
7646 self.0.request = v.into();
7647 self
7648 }
7649
7650 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7652 self.0.options = v.into();
7653 self
7654 }
7655
7656 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7663 (*self.0.stub)
7664 .set_suggestion_feature_config(self.0.request, self.0.options)
7665 .await
7666 .map(crate::Response::into_body)
7667 }
7668
7669 pub fn poller(
7671 self,
7672 ) -> impl google_cloud_lro::Poller<
7673 crate::model::ConversationProfile,
7674 crate::model::SetSuggestionFeatureConfigOperationMetadata,
7675 > {
7676 type Operation = google_cloud_lro::internal::Operation<
7677 crate::model::ConversationProfile,
7678 crate::model::SetSuggestionFeatureConfigOperationMetadata,
7679 >;
7680 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7681 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7682
7683 let stub = self.0.stub.clone();
7684 let mut options = self.0.options.clone();
7685 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7686 let query = move |name| {
7687 let stub = stub.clone();
7688 let options = options.clone();
7689 async {
7690 let op = GetOperation::new(stub)
7691 .set_name(name)
7692 .with_options(options)
7693 .send()
7694 .await?;
7695 Ok(Operation::new(op))
7696 }
7697 };
7698
7699 let start = move || async {
7700 let op = self.send().await?;
7701 Ok(Operation::new(op))
7702 };
7703
7704 google_cloud_lro::internal::new_poller(
7705 polling_error_policy,
7706 polling_backoff_policy,
7707 start,
7708 query,
7709 )
7710 }
7711
7712 pub fn set_conversation_profile<T: Into<std::string::String>>(mut self, v: T) -> Self {
7716 self.0.request.conversation_profile = v.into();
7717 self
7718 }
7719
7720 pub fn set_participant_role<T: Into<crate::model::participant::Role>>(
7724 mut self,
7725 v: T,
7726 ) -> Self {
7727 self.0.request.participant_role = v.into();
7728 self
7729 }
7730
7731 pub fn set_suggestion_feature_config<T>(mut self, v: T) -> Self
7735 where
7736 T: std::convert::Into<
7737 crate::model::human_agent_assistant_config::SuggestionFeatureConfig,
7738 >,
7739 {
7740 self.0.request.suggestion_feature_config = std::option::Option::Some(v.into());
7741 self
7742 }
7743
7744 pub fn set_or_clear_suggestion_feature_config<T>(
7748 mut self,
7749 v: std::option::Option<T>,
7750 ) -> Self
7751 where
7752 T: std::convert::Into<
7753 crate::model::human_agent_assistant_config::SuggestionFeatureConfig,
7754 >,
7755 {
7756 self.0.request.suggestion_feature_config = v.map(|x| x.into());
7757 self
7758 }
7759 }
7760
7761 #[doc(hidden)]
7762 impl crate::RequestBuilder for SetSuggestionFeatureConfig {
7763 fn request_options(&mut self) -> &mut crate::RequestOptions {
7764 &mut self.0.options
7765 }
7766 }
7767
7768 #[derive(Clone, Debug)]
7786 pub struct ClearSuggestionFeatureConfig(
7787 RequestBuilder<crate::model::ClearSuggestionFeatureConfigRequest>,
7788 );
7789
7790 impl ClearSuggestionFeatureConfig {
7791 pub(crate) fn new(
7792 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7793 ) -> Self {
7794 Self(RequestBuilder::new(stub))
7795 }
7796
7797 pub fn with_request<V: Into<crate::model::ClearSuggestionFeatureConfigRequest>>(
7799 mut self,
7800 v: V,
7801 ) -> Self {
7802 self.0.request = v.into();
7803 self
7804 }
7805
7806 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7808 self.0.options = v.into();
7809 self
7810 }
7811
7812 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
7819 (*self.0.stub)
7820 .clear_suggestion_feature_config(self.0.request, self.0.options)
7821 .await
7822 .map(crate::Response::into_body)
7823 }
7824
7825 pub fn poller(
7827 self,
7828 ) -> impl google_cloud_lro::Poller<
7829 crate::model::ConversationProfile,
7830 crate::model::ClearSuggestionFeatureConfigOperationMetadata,
7831 > {
7832 type Operation = google_cloud_lro::internal::Operation<
7833 crate::model::ConversationProfile,
7834 crate::model::ClearSuggestionFeatureConfigOperationMetadata,
7835 >;
7836 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
7837 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
7838
7839 let stub = self.0.stub.clone();
7840 let mut options = self.0.options.clone();
7841 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
7842 let query = move |name| {
7843 let stub = stub.clone();
7844 let options = options.clone();
7845 async {
7846 let op = GetOperation::new(stub)
7847 .set_name(name)
7848 .with_options(options)
7849 .send()
7850 .await?;
7851 Ok(Operation::new(op))
7852 }
7853 };
7854
7855 let start = move || async {
7856 let op = self.send().await?;
7857 Ok(Operation::new(op))
7858 };
7859
7860 google_cloud_lro::internal::new_poller(
7861 polling_error_policy,
7862 polling_backoff_policy,
7863 start,
7864 query,
7865 )
7866 }
7867
7868 pub fn set_conversation_profile<T: Into<std::string::String>>(mut self, v: T) -> Self {
7872 self.0.request.conversation_profile = v.into();
7873 self
7874 }
7875
7876 pub fn set_participant_role<T: Into<crate::model::participant::Role>>(
7880 mut self,
7881 v: T,
7882 ) -> Self {
7883 self.0.request.participant_role = v.into();
7884 self
7885 }
7886
7887 pub fn set_suggestion_feature_type<T: Into<crate::model::suggestion_feature::Type>>(
7891 mut self,
7892 v: T,
7893 ) -> Self {
7894 self.0.request.suggestion_feature_type = v.into();
7895 self
7896 }
7897 }
7898
7899 #[doc(hidden)]
7900 impl crate::RequestBuilder for ClearSuggestionFeatureConfig {
7901 fn request_options(&mut self) -> &mut crate::RequestOptions {
7902 &mut self.0.options
7903 }
7904 }
7905
7906 #[derive(Clone, Debug)]
7927 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
7928
7929 impl ListLocations {
7930 pub(crate) fn new(
7931 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
7932 ) -> Self {
7933 Self(RequestBuilder::new(stub))
7934 }
7935
7936 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
7938 mut self,
7939 v: V,
7940 ) -> Self {
7941 self.0.request = v.into();
7942 self
7943 }
7944
7945 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
7947 self.0.options = v.into();
7948 self
7949 }
7950
7951 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
7953 (*self.0.stub)
7954 .list_locations(self.0.request, self.0.options)
7955 .await
7956 .map(crate::Response::into_body)
7957 }
7958
7959 pub fn by_page(
7961 self,
7962 ) -> impl google_cloud_gax::paginator::Paginator<
7963 google_cloud_location::model::ListLocationsResponse,
7964 crate::Error,
7965 > {
7966 use std::clone::Clone;
7967 let token = self.0.request.page_token.clone();
7968 let execute = move |token: String| {
7969 let mut builder = self.clone();
7970 builder.0.request = builder.0.request.set_page_token(token);
7971 builder.send()
7972 };
7973 google_cloud_gax::paginator::internal::new_paginator(token, execute)
7974 }
7975
7976 pub fn by_item(
7978 self,
7979 ) -> impl google_cloud_gax::paginator::ItemPaginator<
7980 google_cloud_location::model::ListLocationsResponse,
7981 crate::Error,
7982 > {
7983 use google_cloud_gax::paginator::Paginator;
7984 self.by_page().items()
7985 }
7986
7987 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
7989 self.0.request.name = v.into();
7990 self
7991 }
7992
7993 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
7995 self.0.request.filter = v.into();
7996 self
7997 }
7998
7999 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8001 self.0.request.page_size = v.into();
8002 self
8003 }
8004
8005 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8007 self.0.request.page_token = v.into();
8008 self
8009 }
8010 }
8011
8012 #[doc(hidden)]
8013 impl crate::RequestBuilder for ListLocations {
8014 fn request_options(&mut self) -> &mut crate::RequestOptions {
8015 &mut self.0.options
8016 }
8017 }
8018
8019 #[derive(Clone, Debug)]
8036 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
8037
8038 impl GetLocation {
8039 pub(crate) fn new(
8040 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
8041 ) -> Self {
8042 Self(RequestBuilder::new(stub))
8043 }
8044
8045 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
8047 mut self,
8048 v: V,
8049 ) -> Self {
8050 self.0.request = v.into();
8051 self
8052 }
8053
8054 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8056 self.0.options = v.into();
8057 self
8058 }
8059
8060 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
8062 (*self.0.stub)
8063 .get_location(self.0.request, self.0.options)
8064 .await
8065 .map(crate::Response::into_body)
8066 }
8067
8068 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8070 self.0.request.name = v.into();
8071 self
8072 }
8073 }
8074
8075 #[doc(hidden)]
8076 impl crate::RequestBuilder for GetLocation {
8077 fn request_options(&mut self) -> &mut crate::RequestOptions {
8078 &mut self.0.options
8079 }
8080 }
8081
8082 #[derive(Clone, Debug)]
8103 pub struct ListOperations(
8104 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
8105 );
8106
8107 impl ListOperations {
8108 pub(crate) fn new(
8109 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
8110 ) -> Self {
8111 Self(RequestBuilder::new(stub))
8112 }
8113
8114 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
8116 mut self,
8117 v: V,
8118 ) -> Self {
8119 self.0.request = v.into();
8120 self
8121 }
8122
8123 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8125 self.0.options = v.into();
8126 self
8127 }
8128
8129 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
8131 (*self.0.stub)
8132 .list_operations(self.0.request, self.0.options)
8133 .await
8134 .map(crate::Response::into_body)
8135 }
8136
8137 pub fn by_page(
8139 self,
8140 ) -> impl google_cloud_gax::paginator::Paginator<
8141 google_cloud_longrunning::model::ListOperationsResponse,
8142 crate::Error,
8143 > {
8144 use std::clone::Clone;
8145 let token = self.0.request.page_token.clone();
8146 let execute = move |token: String| {
8147 let mut builder = self.clone();
8148 builder.0.request = builder.0.request.set_page_token(token);
8149 builder.send()
8150 };
8151 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8152 }
8153
8154 pub fn by_item(
8156 self,
8157 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8158 google_cloud_longrunning::model::ListOperationsResponse,
8159 crate::Error,
8160 > {
8161 use google_cloud_gax::paginator::Paginator;
8162 self.by_page().items()
8163 }
8164
8165 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8167 self.0.request.name = v.into();
8168 self
8169 }
8170
8171 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8173 self.0.request.filter = v.into();
8174 self
8175 }
8176
8177 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8179 self.0.request.page_size = v.into();
8180 self
8181 }
8182
8183 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8185 self.0.request.page_token = v.into();
8186 self
8187 }
8188
8189 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
8191 self.0.request.return_partial_success = v.into();
8192 self
8193 }
8194 }
8195
8196 #[doc(hidden)]
8197 impl crate::RequestBuilder for ListOperations {
8198 fn request_options(&mut self) -> &mut crate::RequestOptions {
8199 &mut self.0.options
8200 }
8201 }
8202
8203 #[derive(Clone, Debug)]
8220 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
8221
8222 impl GetOperation {
8223 pub(crate) fn new(
8224 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
8225 ) -> Self {
8226 Self(RequestBuilder::new(stub))
8227 }
8228
8229 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
8231 mut self,
8232 v: V,
8233 ) -> Self {
8234 self.0.request = v.into();
8235 self
8236 }
8237
8238 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8240 self.0.options = v.into();
8241 self
8242 }
8243
8244 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8246 (*self.0.stub)
8247 .get_operation(self.0.request, self.0.options)
8248 .await
8249 .map(crate::Response::into_body)
8250 }
8251
8252 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8254 self.0.request.name = v.into();
8255 self
8256 }
8257 }
8258
8259 #[doc(hidden)]
8260 impl crate::RequestBuilder for GetOperation {
8261 fn request_options(&mut self) -> &mut crate::RequestOptions {
8262 &mut self.0.options
8263 }
8264 }
8265
8266 #[derive(Clone, Debug)]
8283 pub struct CancelOperation(
8284 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
8285 );
8286
8287 impl CancelOperation {
8288 pub(crate) fn new(
8289 stub: std::sync::Arc<dyn super::super::stub::dynamic::ConversationProfiles>,
8290 ) -> Self {
8291 Self(RequestBuilder::new(stub))
8292 }
8293
8294 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
8296 mut self,
8297 v: V,
8298 ) -> Self {
8299 self.0.request = v.into();
8300 self
8301 }
8302
8303 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8305 self.0.options = v.into();
8306 self
8307 }
8308
8309 pub async fn send(self) -> Result<()> {
8311 (*self.0.stub)
8312 .cancel_operation(self.0.request, self.0.options)
8313 .await
8314 .map(crate::Response::into_body)
8315 }
8316
8317 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8319 self.0.request.name = v.into();
8320 self
8321 }
8322 }
8323
8324 #[doc(hidden)]
8325 impl crate::RequestBuilder for CancelOperation {
8326 fn request_options(&mut self) -> &mut crate::RequestOptions {
8327 &mut self.0.options
8328 }
8329 }
8330}
8331
8332#[cfg(feature = "documents")]
8334#[cfg_attr(docsrs, doc(cfg(feature = "documents")))]
8335pub mod documents {
8336 use crate::Result;
8337
8338 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
8352
8353 pub(crate) mod client {
8354 use super::super::super::client::Documents;
8355 pub struct Factory;
8356 impl crate::ClientFactory for Factory {
8357 type Client = Documents;
8358 type Credentials = gaxi::options::Credentials;
8359 async fn build(
8360 self,
8361 config: gaxi::options::ClientConfig,
8362 ) -> crate::ClientBuilderResult<Self::Client> {
8363 Self::Client::new(config).await
8364 }
8365 }
8366 }
8367
8368 #[derive(Clone, Debug)]
8370 pub(crate) struct RequestBuilder<R: std::default::Default> {
8371 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8372 request: R,
8373 options: crate::RequestOptions,
8374 }
8375
8376 impl<R> RequestBuilder<R>
8377 where
8378 R: std::default::Default,
8379 {
8380 pub(crate) fn new(
8381 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8382 ) -> Self {
8383 Self {
8384 stub,
8385 request: R::default(),
8386 options: crate::RequestOptions::default(),
8387 }
8388 }
8389 }
8390
8391 #[derive(Clone, Debug)]
8412 pub struct ListDocuments(RequestBuilder<crate::model::ListDocumentsRequest>);
8413
8414 impl ListDocuments {
8415 pub(crate) fn new(
8416 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8417 ) -> Self {
8418 Self(RequestBuilder::new(stub))
8419 }
8420
8421 pub fn with_request<V: Into<crate::model::ListDocumentsRequest>>(mut self, v: V) -> Self {
8423 self.0.request = v.into();
8424 self
8425 }
8426
8427 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8429 self.0.options = v.into();
8430 self
8431 }
8432
8433 pub async fn send(self) -> Result<crate::model::ListDocumentsResponse> {
8435 (*self.0.stub)
8436 .list_documents(self.0.request, self.0.options)
8437 .await
8438 .map(crate::Response::into_body)
8439 }
8440
8441 pub fn by_page(
8443 self,
8444 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListDocumentsResponse, crate::Error>
8445 {
8446 use std::clone::Clone;
8447 let token = self.0.request.page_token.clone();
8448 let execute = move |token: String| {
8449 let mut builder = self.clone();
8450 builder.0.request = builder.0.request.set_page_token(token);
8451 builder.send()
8452 };
8453 google_cloud_gax::paginator::internal::new_paginator(token, execute)
8454 }
8455
8456 pub fn by_item(
8458 self,
8459 ) -> impl google_cloud_gax::paginator::ItemPaginator<
8460 crate::model::ListDocumentsResponse,
8461 crate::Error,
8462 > {
8463 use google_cloud_gax::paginator::Paginator;
8464 self.by_page().items()
8465 }
8466
8467 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8471 self.0.request.parent = v.into();
8472 self
8473 }
8474
8475 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
8477 self.0.request.page_size = v.into();
8478 self
8479 }
8480
8481 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
8483 self.0.request.page_token = v.into();
8484 self
8485 }
8486
8487 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
8489 self.0.request.filter = v.into();
8490 self
8491 }
8492 }
8493
8494 #[doc(hidden)]
8495 impl crate::RequestBuilder for ListDocuments {
8496 fn request_options(&mut self) -> &mut crate::RequestOptions {
8497 &mut self.0.options
8498 }
8499 }
8500
8501 #[derive(Clone, Debug)]
8518 pub struct GetDocument(RequestBuilder<crate::model::GetDocumentRequest>);
8519
8520 impl GetDocument {
8521 pub(crate) fn new(
8522 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8523 ) -> Self {
8524 Self(RequestBuilder::new(stub))
8525 }
8526
8527 pub fn with_request<V: Into<crate::model::GetDocumentRequest>>(mut self, v: V) -> Self {
8529 self.0.request = v.into();
8530 self
8531 }
8532
8533 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8535 self.0.options = v.into();
8536 self
8537 }
8538
8539 pub async fn send(self) -> Result<crate::model::Document> {
8541 (*self.0.stub)
8542 .get_document(self.0.request, self.0.options)
8543 .await
8544 .map(crate::Response::into_body)
8545 }
8546
8547 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8551 self.0.request.name = v.into();
8552 self
8553 }
8554 }
8555
8556 #[doc(hidden)]
8557 impl crate::RequestBuilder for GetDocument {
8558 fn request_options(&mut self) -> &mut crate::RequestOptions {
8559 &mut self.0.options
8560 }
8561 }
8562
8563 #[derive(Clone, Debug)]
8581 pub struct CreateDocument(RequestBuilder<crate::model::CreateDocumentRequest>);
8582
8583 impl CreateDocument {
8584 pub(crate) fn new(
8585 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8586 ) -> Self {
8587 Self(RequestBuilder::new(stub))
8588 }
8589
8590 pub fn with_request<V: Into<crate::model::CreateDocumentRequest>>(mut self, v: V) -> Self {
8592 self.0.request = v.into();
8593 self
8594 }
8595
8596 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8598 self.0.options = v.into();
8599 self
8600 }
8601
8602 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8609 (*self.0.stub)
8610 .create_document(self.0.request, self.0.options)
8611 .await
8612 .map(crate::Response::into_body)
8613 }
8614
8615 pub fn poller(
8617 self,
8618 ) -> impl google_cloud_lro::Poller<
8619 crate::model::Document,
8620 crate::model::KnowledgeOperationMetadata,
8621 > {
8622 type Operation = google_cloud_lro::internal::Operation<
8623 crate::model::Document,
8624 crate::model::KnowledgeOperationMetadata,
8625 >;
8626 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8627 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8628
8629 let stub = self.0.stub.clone();
8630 let mut options = self.0.options.clone();
8631 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8632 let query = move |name| {
8633 let stub = stub.clone();
8634 let options = options.clone();
8635 async {
8636 let op = GetOperation::new(stub)
8637 .set_name(name)
8638 .with_options(options)
8639 .send()
8640 .await?;
8641 Ok(Operation::new(op))
8642 }
8643 };
8644
8645 let start = move || async {
8646 let op = self.send().await?;
8647 Ok(Operation::new(op))
8648 };
8649
8650 google_cloud_lro::internal::new_poller(
8651 polling_error_policy,
8652 polling_backoff_policy,
8653 start,
8654 query,
8655 )
8656 }
8657
8658 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8662 self.0.request.parent = v.into();
8663 self
8664 }
8665
8666 pub fn set_document<T>(mut self, v: T) -> Self
8670 where
8671 T: std::convert::Into<crate::model::Document>,
8672 {
8673 self.0.request.document = std::option::Option::Some(v.into());
8674 self
8675 }
8676
8677 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
8681 where
8682 T: std::convert::Into<crate::model::Document>,
8683 {
8684 self.0.request.document = v.map(|x| x.into());
8685 self
8686 }
8687 }
8688
8689 #[doc(hidden)]
8690 impl crate::RequestBuilder for CreateDocument {
8691 fn request_options(&mut self) -> &mut crate::RequestOptions {
8692 &mut self.0.options
8693 }
8694 }
8695
8696 #[derive(Clone, Debug)]
8714 pub struct ImportDocuments(RequestBuilder<crate::model::ImportDocumentsRequest>);
8715
8716 impl ImportDocuments {
8717 pub(crate) fn new(
8718 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8719 ) -> Self {
8720 Self(RequestBuilder::new(stub))
8721 }
8722
8723 pub fn with_request<V: Into<crate::model::ImportDocumentsRequest>>(mut self, v: V) -> Self {
8725 self.0.request = v.into();
8726 self
8727 }
8728
8729 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8731 self.0.options = v.into();
8732 self
8733 }
8734
8735 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8742 (*self.0.stub)
8743 .import_documents(self.0.request, self.0.options)
8744 .await
8745 .map(crate::Response::into_body)
8746 }
8747
8748 pub fn poller(
8750 self,
8751 ) -> impl google_cloud_lro::Poller<
8752 crate::model::ImportDocumentsResponse,
8753 crate::model::KnowledgeOperationMetadata,
8754 > {
8755 type Operation = google_cloud_lro::internal::Operation<
8756 crate::model::ImportDocumentsResponse,
8757 crate::model::KnowledgeOperationMetadata,
8758 >;
8759 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8760 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8761
8762 let stub = self.0.stub.clone();
8763 let mut options = self.0.options.clone();
8764 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8765 let query = move |name| {
8766 let stub = stub.clone();
8767 let options = options.clone();
8768 async {
8769 let op = GetOperation::new(stub)
8770 .set_name(name)
8771 .with_options(options)
8772 .send()
8773 .await?;
8774 Ok(Operation::new(op))
8775 }
8776 };
8777
8778 let start = move || async {
8779 let op = self.send().await?;
8780 Ok(Operation::new(op))
8781 };
8782
8783 google_cloud_lro::internal::new_poller(
8784 polling_error_policy,
8785 polling_backoff_policy,
8786 start,
8787 query,
8788 )
8789 }
8790
8791 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
8795 self.0.request.parent = v.into();
8796 self
8797 }
8798
8799 pub fn set_document_template<T>(mut self, v: T) -> Self
8803 where
8804 T: std::convert::Into<crate::model::ImportDocumentTemplate>,
8805 {
8806 self.0.request.document_template = std::option::Option::Some(v.into());
8807 self
8808 }
8809
8810 pub fn set_or_clear_document_template<T>(mut self, v: std::option::Option<T>) -> Self
8814 where
8815 T: std::convert::Into<crate::model::ImportDocumentTemplate>,
8816 {
8817 self.0.request.document_template = v.map(|x| x.into());
8818 self
8819 }
8820
8821 pub fn set_import_gcs_custom_metadata<T: Into<bool>>(mut self, v: T) -> Self {
8823 self.0.request.import_gcs_custom_metadata = v.into();
8824 self
8825 }
8826
8827 pub fn set_source<T: Into<Option<crate::model::import_documents_request::Source>>>(
8832 mut self,
8833 v: T,
8834 ) -> Self {
8835 self.0.request.source = v.into();
8836 self
8837 }
8838
8839 pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSources>>>(
8845 mut self,
8846 v: T,
8847 ) -> Self {
8848 self.0.request = self.0.request.set_gcs_source(v);
8849 self
8850 }
8851 }
8852
8853 #[doc(hidden)]
8854 impl crate::RequestBuilder for ImportDocuments {
8855 fn request_options(&mut self) -> &mut crate::RequestOptions {
8856 &mut self.0.options
8857 }
8858 }
8859
8860 #[derive(Clone, Debug)]
8878 pub struct DeleteDocument(RequestBuilder<crate::model::DeleteDocumentRequest>);
8879
8880 impl DeleteDocument {
8881 pub(crate) fn new(
8882 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8883 ) -> Self {
8884 Self(RequestBuilder::new(stub))
8885 }
8886
8887 pub fn with_request<V: Into<crate::model::DeleteDocumentRequest>>(mut self, v: V) -> Self {
8889 self.0.request = v.into();
8890 self
8891 }
8892
8893 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
8895 self.0.options = v.into();
8896 self
8897 }
8898
8899 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
8906 (*self.0.stub)
8907 .delete_document(self.0.request, self.0.options)
8908 .await
8909 .map(crate::Response::into_body)
8910 }
8911
8912 pub fn poller(
8914 self,
8915 ) -> impl google_cloud_lro::Poller<(), crate::model::KnowledgeOperationMetadata> {
8916 type Operation = google_cloud_lro::internal::Operation<
8917 wkt::Empty,
8918 crate::model::KnowledgeOperationMetadata,
8919 >;
8920 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
8921 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
8922
8923 let stub = self.0.stub.clone();
8924 let mut options = self.0.options.clone();
8925 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
8926 let query = move |name| {
8927 let stub = stub.clone();
8928 let options = options.clone();
8929 async {
8930 let op = GetOperation::new(stub)
8931 .set_name(name)
8932 .with_options(options)
8933 .send()
8934 .await?;
8935 Ok(Operation::new(op))
8936 }
8937 };
8938
8939 let start = move || async {
8940 let op = self.send().await?;
8941 Ok(Operation::new(op))
8942 };
8943
8944 google_cloud_lro::internal::new_unit_response_poller(
8945 polling_error_policy,
8946 polling_backoff_policy,
8947 start,
8948 query,
8949 )
8950 }
8951
8952 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
8956 self.0.request.name = v.into();
8957 self
8958 }
8959 }
8960
8961 #[doc(hidden)]
8962 impl crate::RequestBuilder for DeleteDocument {
8963 fn request_options(&mut self) -> &mut crate::RequestOptions {
8964 &mut self.0.options
8965 }
8966 }
8967
8968 #[derive(Clone, Debug)]
8986 pub struct UpdateDocument(RequestBuilder<crate::model::UpdateDocumentRequest>);
8987
8988 impl UpdateDocument {
8989 pub(crate) fn new(
8990 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
8991 ) -> Self {
8992 Self(RequestBuilder::new(stub))
8993 }
8994
8995 pub fn with_request<V: Into<crate::model::UpdateDocumentRequest>>(mut self, v: V) -> Self {
8997 self.0.request = v.into();
8998 self
8999 }
9000
9001 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9003 self.0.options = v.into();
9004 self
9005 }
9006
9007 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9014 (*self.0.stub)
9015 .update_document(self.0.request, self.0.options)
9016 .await
9017 .map(crate::Response::into_body)
9018 }
9019
9020 pub fn poller(
9022 self,
9023 ) -> impl google_cloud_lro::Poller<
9024 crate::model::Document,
9025 crate::model::KnowledgeOperationMetadata,
9026 > {
9027 type Operation = google_cloud_lro::internal::Operation<
9028 crate::model::Document,
9029 crate::model::KnowledgeOperationMetadata,
9030 >;
9031 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9032 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9033
9034 let stub = self.0.stub.clone();
9035 let mut options = self.0.options.clone();
9036 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9037 let query = move |name| {
9038 let stub = stub.clone();
9039 let options = options.clone();
9040 async {
9041 let op = GetOperation::new(stub)
9042 .set_name(name)
9043 .with_options(options)
9044 .send()
9045 .await?;
9046 Ok(Operation::new(op))
9047 }
9048 };
9049
9050 let start = move || async {
9051 let op = self.send().await?;
9052 Ok(Operation::new(op))
9053 };
9054
9055 google_cloud_lro::internal::new_poller(
9056 polling_error_policy,
9057 polling_backoff_policy,
9058 start,
9059 query,
9060 )
9061 }
9062
9063 pub fn set_document<T>(mut self, v: T) -> Self
9067 where
9068 T: std::convert::Into<crate::model::Document>,
9069 {
9070 self.0.request.document = std::option::Option::Some(v.into());
9071 self
9072 }
9073
9074 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
9078 where
9079 T: std::convert::Into<crate::model::Document>,
9080 {
9081 self.0.request.document = v.map(|x| x.into());
9082 self
9083 }
9084
9085 pub fn set_update_mask<T>(mut self, v: T) -> Self
9087 where
9088 T: std::convert::Into<wkt::FieldMask>,
9089 {
9090 self.0.request.update_mask = std::option::Option::Some(v.into());
9091 self
9092 }
9093
9094 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
9096 where
9097 T: std::convert::Into<wkt::FieldMask>,
9098 {
9099 self.0.request.update_mask = v.map(|x| x.into());
9100 self
9101 }
9102 }
9103
9104 #[doc(hidden)]
9105 impl crate::RequestBuilder for UpdateDocument {
9106 fn request_options(&mut self) -> &mut crate::RequestOptions {
9107 &mut self.0.options
9108 }
9109 }
9110
9111 #[derive(Clone, Debug)]
9129 pub struct ReloadDocument(RequestBuilder<crate::model::ReloadDocumentRequest>);
9130
9131 impl ReloadDocument {
9132 pub(crate) fn new(
9133 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9134 ) -> Self {
9135 Self(RequestBuilder::new(stub))
9136 }
9137
9138 pub fn with_request<V: Into<crate::model::ReloadDocumentRequest>>(mut self, v: V) -> Self {
9140 self.0.request = v.into();
9141 self
9142 }
9143
9144 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9146 self.0.options = v.into();
9147 self
9148 }
9149
9150 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9157 (*self.0.stub)
9158 .reload_document(self.0.request, self.0.options)
9159 .await
9160 .map(crate::Response::into_body)
9161 }
9162
9163 pub fn poller(
9165 self,
9166 ) -> impl google_cloud_lro::Poller<
9167 crate::model::Document,
9168 crate::model::KnowledgeOperationMetadata,
9169 > {
9170 type Operation = google_cloud_lro::internal::Operation<
9171 crate::model::Document,
9172 crate::model::KnowledgeOperationMetadata,
9173 >;
9174 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9175 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9176
9177 let stub = self.0.stub.clone();
9178 let mut options = self.0.options.clone();
9179 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9180 let query = move |name| {
9181 let stub = stub.clone();
9182 let options = options.clone();
9183 async {
9184 let op = GetOperation::new(stub)
9185 .set_name(name)
9186 .with_options(options)
9187 .send()
9188 .await?;
9189 Ok(Operation::new(op))
9190 }
9191 };
9192
9193 let start = move || async {
9194 let op = self.send().await?;
9195 Ok(Operation::new(op))
9196 };
9197
9198 google_cloud_lro::internal::new_poller(
9199 polling_error_policy,
9200 polling_backoff_policy,
9201 start,
9202 query,
9203 )
9204 }
9205
9206 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9210 self.0.request.name = v.into();
9211 self
9212 }
9213
9214 pub fn set_import_gcs_custom_metadata<T: Into<bool>>(mut self, v: T) -> Self {
9216 self.0.request.import_gcs_custom_metadata = v.into();
9217 self
9218 }
9219
9220 pub fn set_smart_messaging_partial_update<T: Into<bool>>(mut self, v: T) -> Self {
9222 self.0.request.smart_messaging_partial_update = v.into();
9223 self
9224 }
9225
9226 pub fn set_source<T: Into<Option<crate::model::reload_document_request::Source>>>(
9231 mut self,
9232 v: T,
9233 ) -> Self {
9234 self.0.request.source = v.into();
9235 self
9236 }
9237
9238 pub fn set_content_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9244 self.0.request = self.0.request.set_content_uri(v);
9245 self
9246 }
9247 }
9248
9249 #[doc(hidden)]
9250 impl crate::RequestBuilder for ReloadDocument {
9251 fn request_options(&mut self) -> &mut crate::RequestOptions {
9252 &mut self.0.options
9253 }
9254 }
9255
9256 #[derive(Clone, Debug)]
9274 pub struct ExportDocument(RequestBuilder<crate::model::ExportDocumentRequest>);
9275
9276 impl ExportDocument {
9277 pub(crate) fn new(
9278 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9279 ) -> Self {
9280 Self(RequestBuilder::new(stub))
9281 }
9282
9283 pub fn with_request<V: Into<crate::model::ExportDocumentRequest>>(mut self, v: V) -> Self {
9285 self.0.request = v.into();
9286 self
9287 }
9288
9289 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9291 self.0.options = v.into();
9292 self
9293 }
9294
9295 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9302 (*self.0.stub)
9303 .export_document(self.0.request, self.0.options)
9304 .await
9305 .map(crate::Response::into_body)
9306 }
9307
9308 pub fn poller(
9310 self,
9311 ) -> impl google_cloud_lro::Poller<
9312 crate::model::Document,
9313 crate::model::KnowledgeOperationMetadata,
9314 > {
9315 type Operation = google_cloud_lro::internal::Operation<
9316 crate::model::Document,
9317 crate::model::KnowledgeOperationMetadata,
9318 >;
9319 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
9320 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
9321
9322 let stub = self.0.stub.clone();
9323 let mut options = self.0.options.clone();
9324 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
9325 let query = move |name| {
9326 let stub = stub.clone();
9327 let options = options.clone();
9328 async {
9329 let op = GetOperation::new(stub)
9330 .set_name(name)
9331 .with_options(options)
9332 .send()
9333 .await?;
9334 Ok(Operation::new(op))
9335 }
9336 };
9337
9338 let start = move || async {
9339 let op = self.send().await?;
9340 Ok(Operation::new(op))
9341 };
9342
9343 google_cloud_lro::internal::new_poller(
9344 polling_error_policy,
9345 polling_backoff_policy,
9346 start,
9347 query,
9348 )
9349 }
9350
9351 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9355 self.0.request.name = v.into();
9356 self
9357 }
9358
9359 pub fn set_export_full_content<T: Into<bool>>(mut self, v: T) -> Self {
9361 self.0.request.export_full_content = v.into();
9362 self
9363 }
9364
9365 pub fn set_smart_messaging_partial_update<T: Into<bool>>(mut self, v: T) -> Self {
9367 self.0.request.smart_messaging_partial_update = v.into();
9368 self
9369 }
9370
9371 pub fn set_destination<
9376 T: Into<Option<crate::model::export_document_request::Destination>>,
9377 >(
9378 mut self,
9379 v: T,
9380 ) -> Self {
9381 self.0.request.destination = v.into();
9382 self
9383 }
9384
9385 pub fn set_gcs_destination<
9391 T: std::convert::Into<std::boxed::Box<crate::model::GcsDestination>>,
9392 >(
9393 mut self,
9394 v: T,
9395 ) -> Self {
9396 self.0.request = self.0.request.set_gcs_destination(v);
9397 self
9398 }
9399 }
9400
9401 #[doc(hidden)]
9402 impl crate::RequestBuilder for ExportDocument {
9403 fn request_options(&mut self) -> &mut crate::RequestOptions {
9404 &mut self.0.options
9405 }
9406 }
9407
9408 #[derive(Clone, Debug)]
9429 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
9430
9431 impl ListLocations {
9432 pub(crate) fn new(
9433 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9434 ) -> Self {
9435 Self(RequestBuilder::new(stub))
9436 }
9437
9438 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
9440 mut self,
9441 v: V,
9442 ) -> Self {
9443 self.0.request = v.into();
9444 self
9445 }
9446
9447 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9449 self.0.options = v.into();
9450 self
9451 }
9452
9453 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
9455 (*self.0.stub)
9456 .list_locations(self.0.request, self.0.options)
9457 .await
9458 .map(crate::Response::into_body)
9459 }
9460
9461 pub fn by_page(
9463 self,
9464 ) -> impl google_cloud_gax::paginator::Paginator<
9465 google_cloud_location::model::ListLocationsResponse,
9466 crate::Error,
9467 > {
9468 use std::clone::Clone;
9469 let token = self.0.request.page_token.clone();
9470 let execute = move |token: String| {
9471 let mut builder = self.clone();
9472 builder.0.request = builder.0.request.set_page_token(token);
9473 builder.send()
9474 };
9475 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9476 }
9477
9478 pub fn by_item(
9480 self,
9481 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9482 google_cloud_location::model::ListLocationsResponse,
9483 crate::Error,
9484 > {
9485 use google_cloud_gax::paginator::Paginator;
9486 self.by_page().items()
9487 }
9488
9489 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9491 self.0.request.name = v.into();
9492 self
9493 }
9494
9495 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9497 self.0.request.filter = v.into();
9498 self
9499 }
9500
9501 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9503 self.0.request.page_size = v.into();
9504 self
9505 }
9506
9507 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9509 self.0.request.page_token = v.into();
9510 self
9511 }
9512 }
9513
9514 #[doc(hidden)]
9515 impl crate::RequestBuilder for ListLocations {
9516 fn request_options(&mut self) -> &mut crate::RequestOptions {
9517 &mut self.0.options
9518 }
9519 }
9520
9521 #[derive(Clone, Debug)]
9538 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
9539
9540 impl GetLocation {
9541 pub(crate) fn new(
9542 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9543 ) -> Self {
9544 Self(RequestBuilder::new(stub))
9545 }
9546
9547 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
9549 mut self,
9550 v: V,
9551 ) -> Self {
9552 self.0.request = v.into();
9553 self
9554 }
9555
9556 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9558 self.0.options = v.into();
9559 self
9560 }
9561
9562 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
9564 (*self.0.stub)
9565 .get_location(self.0.request, self.0.options)
9566 .await
9567 .map(crate::Response::into_body)
9568 }
9569
9570 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9572 self.0.request.name = v.into();
9573 self
9574 }
9575 }
9576
9577 #[doc(hidden)]
9578 impl crate::RequestBuilder for GetLocation {
9579 fn request_options(&mut self) -> &mut crate::RequestOptions {
9580 &mut self.0.options
9581 }
9582 }
9583
9584 #[derive(Clone, Debug)]
9605 pub struct ListOperations(
9606 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
9607 );
9608
9609 impl ListOperations {
9610 pub(crate) fn new(
9611 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9612 ) -> Self {
9613 Self(RequestBuilder::new(stub))
9614 }
9615
9616 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
9618 mut self,
9619 v: V,
9620 ) -> Self {
9621 self.0.request = v.into();
9622 self
9623 }
9624
9625 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9627 self.0.options = v.into();
9628 self
9629 }
9630
9631 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
9633 (*self.0.stub)
9634 .list_operations(self.0.request, self.0.options)
9635 .await
9636 .map(crate::Response::into_body)
9637 }
9638
9639 pub fn by_page(
9641 self,
9642 ) -> impl google_cloud_gax::paginator::Paginator<
9643 google_cloud_longrunning::model::ListOperationsResponse,
9644 crate::Error,
9645 > {
9646 use std::clone::Clone;
9647 let token = self.0.request.page_token.clone();
9648 let execute = move |token: String| {
9649 let mut builder = self.clone();
9650 builder.0.request = builder.0.request.set_page_token(token);
9651 builder.send()
9652 };
9653 google_cloud_gax::paginator::internal::new_paginator(token, execute)
9654 }
9655
9656 pub fn by_item(
9658 self,
9659 ) -> impl google_cloud_gax::paginator::ItemPaginator<
9660 google_cloud_longrunning::model::ListOperationsResponse,
9661 crate::Error,
9662 > {
9663 use google_cloud_gax::paginator::Paginator;
9664 self.by_page().items()
9665 }
9666
9667 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9669 self.0.request.name = v.into();
9670 self
9671 }
9672
9673 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
9675 self.0.request.filter = v.into();
9676 self
9677 }
9678
9679 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
9681 self.0.request.page_size = v.into();
9682 self
9683 }
9684
9685 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
9687 self.0.request.page_token = v.into();
9688 self
9689 }
9690
9691 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
9693 self.0.request.return_partial_success = v.into();
9694 self
9695 }
9696 }
9697
9698 #[doc(hidden)]
9699 impl crate::RequestBuilder for ListOperations {
9700 fn request_options(&mut self) -> &mut crate::RequestOptions {
9701 &mut self.0.options
9702 }
9703 }
9704
9705 #[derive(Clone, Debug)]
9722 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
9723
9724 impl GetOperation {
9725 pub(crate) fn new(
9726 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9727 ) -> Self {
9728 Self(RequestBuilder::new(stub))
9729 }
9730
9731 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
9733 mut self,
9734 v: V,
9735 ) -> Self {
9736 self.0.request = v.into();
9737 self
9738 }
9739
9740 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9742 self.0.options = v.into();
9743 self
9744 }
9745
9746 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
9748 (*self.0.stub)
9749 .get_operation(self.0.request, self.0.options)
9750 .await
9751 .map(crate::Response::into_body)
9752 }
9753
9754 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9756 self.0.request.name = v.into();
9757 self
9758 }
9759 }
9760
9761 #[doc(hidden)]
9762 impl crate::RequestBuilder for GetOperation {
9763 fn request_options(&mut self) -> &mut crate::RequestOptions {
9764 &mut self.0.options
9765 }
9766 }
9767
9768 #[derive(Clone, Debug)]
9785 pub struct CancelOperation(
9786 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
9787 );
9788
9789 impl CancelOperation {
9790 pub(crate) fn new(
9791 stub: std::sync::Arc<dyn super::super::stub::dynamic::Documents>,
9792 ) -> Self {
9793 Self(RequestBuilder::new(stub))
9794 }
9795
9796 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
9798 mut self,
9799 v: V,
9800 ) -> Self {
9801 self.0.request = v.into();
9802 self
9803 }
9804
9805 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9807 self.0.options = v.into();
9808 self
9809 }
9810
9811 pub async fn send(self) -> Result<()> {
9813 (*self.0.stub)
9814 .cancel_operation(self.0.request, self.0.options)
9815 .await
9816 .map(crate::Response::into_body)
9817 }
9818
9819 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9821 self.0.request.name = v.into();
9822 self
9823 }
9824 }
9825
9826 #[doc(hidden)]
9827 impl crate::RequestBuilder for CancelOperation {
9828 fn request_options(&mut self) -> &mut crate::RequestOptions {
9829 &mut self.0.options
9830 }
9831 }
9832}
9833
9834#[cfg(feature = "encryption-spec-service")]
9836#[cfg_attr(docsrs, doc(cfg(feature = "encryption-spec-service")))]
9837pub mod encryption_spec_service {
9838 use crate::Result;
9839
9840 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
9854
9855 pub(crate) mod client {
9856 use super::super::super::client::EncryptionSpecService;
9857 pub struct Factory;
9858 impl crate::ClientFactory for Factory {
9859 type Client = EncryptionSpecService;
9860 type Credentials = gaxi::options::Credentials;
9861 async fn build(
9862 self,
9863 config: gaxi::options::ClientConfig,
9864 ) -> crate::ClientBuilderResult<Self::Client> {
9865 Self::Client::new(config).await
9866 }
9867 }
9868 }
9869
9870 #[derive(Clone, Debug)]
9872 pub(crate) struct RequestBuilder<R: std::default::Default> {
9873 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9874 request: R,
9875 options: crate::RequestOptions,
9876 }
9877
9878 impl<R> RequestBuilder<R>
9879 where
9880 R: std::default::Default,
9881 {
9882 pub(crate) fn new(
9883 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9884 ) -> Self {
9885 Self {
9886 stub,
9887 request: R::default(),
9888 options: crate::RequestOptions::default(),
9889 }
9890 }
9891 }
9892
9893 #[derive(Clone, Debug)]
9910 pub struct GetEncryptionSpec(RequestBuilder<crate::model::GetEncryptionSpecRequest>);
9911
9912 impl GetEncryptionSpec {
9913 pub(crate) fn new(
9914 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9915 ) -> Self {
9916 Self(RequestBuilder::new(stub))
9917 }
9918
9919 pub fn with_request<V: Into<crate::model::GetEncryptionSpecRequest>>(
9921 mut self,
9922 v: V,
9923 ) -> Self {
9924 self.0.request = v.into();
9925 self
9926 }
9927
9928 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9930 self.0.options = v.into();
9931 self
9932 }
9933
9934 pub async fn send(self) -> Result<crate::model::EncryptionSpec> {
9936 (*self.0.stub)
9937 .get_encryption_spec(self.0.request, self.0.options)
9938 .await
9939 .map(crate::Response::into_body)
9940 }
9941
9942 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
9946 self.0.request.name = v.into();
9947 self
9948 }
9949 }
9950
9951 #[doc(hidden)]
9952 impl crate::RequestBuilder for GetEncryptionSpec {
9953 fn request_options(&mut self) -> &mut crate::RequestOptions {
9954 &mut self.0.options
9955 }
9956 }
9957
9958 #[derive(Clone, Debug)]
9976 pub struct InitializeEncryptionSpec(
9977 RequestBuilder<crate::model::InitializeEncryptionSpecRequest>,
9978 );
9979
9980 impl InitializeEncryptionSpec {
9981 pub(crate) fn new(
9982 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
9983 ) -> Self {
9984 Self(RequestBuilder::new(stub))
9985 }
9986
9987 pub fn with_request<V: Into<crate::model::InitializeEncryptionSpecRequest>>(
9989 mut self,
9990 v: V,
9991 ) -> Self {
9992 self.0.request = v.into();
9993 self
9994 }
9995
9996 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
9998 self.0.options = v.into();
9999 self
10000 }
10001
10002 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10009 (*self.0.stub)
10010 .initialize_encryption_spec(self.0.request, self.0.options)
10011 .await
10012 .map(crate::Response::into_body)
10013 }
10014
10015 pub fn poller(
10017 self,
10018 ) -> impl google_cloud_lro::Poller<
10019 crate::model::InitializeEncryptionSpecResponse,
10020 crate::model::InitializeEncryptionSpecMetadata,
10021 > {
10022 type Operation = google_cloud_lro::internal::Operation<
10023 crate::model::InitializeEncryptionSpecResponse,
10024 crate::model::InitializeEncryptionSpecMetadata,
10025 >;
10026 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
10027 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
10028
10029 let stub = self.0.stub.clone();
10030 let mut options = self.0.options.clone();
10031 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
10032 let query = move |name| {
10033 let stub = stub.clone();
10034 let options = options.clone();
10035 async {
10036 let op = GetOperation::new(stub)
10037 .set_name(name)
10038 .with_options(options)
10039 .send()
10040 .await?;
10041 Ok(Operation::new(op))
10042 }
10043 };
10044
10045 let start = move || async {
10046 let op = self.send().await?;
10047 Ok(Operation::new(op))
10048 };
10049
10050 google_cloud_lro::internal::new_poller(
10051 polling_error_policy,
10052 polling_backoff_policy,
10053 start,
10054 query,
10055 )
10056 }
10057
10058 pub fn set_encryption_spec<T>(mut self, v: T) -> Self
10062 where
10063 T: std::convert::Into<crate::model::EncryptionSpec>,
10064 {
10065 self.0.request.encryption_spec = std::option::Option::Some(v.into());
10066 self
10067 }
10068
10069 pub fn set_or_clear_encryption_spec<T>(mut self, v: std::option::Option<T>) -> Self
10073 where
10074 T: std::convert::Into<crate::model::EncryptionSpec>,
10075 {
10076 self.0.request.encryption_spec = v.map(|x| x.into());
10077 self
10078 }
10079 }
10080
10081 #[doc(hidden)]
10082 impl crate::RequestBuilder for InitializeEncryptionSpec {
10083 fn request_options(&mut self) -> &mut crate::RequestOptions {
10084 &mut self.0.options
10085 }
10086 }
10087
10088 #[derive(Clone, Debug)]
10109 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
10110
10111 impl ListLocations {
10112 pub(crate) fn new(
10113 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10114 ) -> Self {
10115 Self(RequestBuilder::new(stub))
10116 }
10117
10118 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
10120 mut self,
10121 v: V,
10122 ) -> Self {
10123 self.0.request = v.into();
10124 self
10125 }
10126
10127 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10129 self.0.options = v.into();
10130 self
10131 }
10132
10133 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
10135 (*self.0.stub)
10136 .list_locations(self.0.request, self.0.options)
10137 .await
10138 .map(crate::Response::into_body)
10139 }
10140
10141 pub fn by_page(
10143 self,
10144 ) -> impl google_cloud_gax::paginator::Paginator<
10145 google_cloud_location::model::ListLocationsResponse,
10146 crate::Error,
10147 > {
10148 use std::clone::Clone;
10149 let token = self.0.request.page_token.clone();
10150 let execute = move |token: String| {
10151 let mut builder = self.clone();
10152 builder.0.request = builder.0.request.set_page_token(token);
10153 builder.send()
10154 };
10155 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10156 }
10157
10158 pub fn by_item(
10160 self,
10161 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10162 google_cloud_location::model::ListLocationsResponse,
10163 crate::Error,
10164 > {
10165 use google_cloud_gax::paginator::Paginator;
10166 self.by_page().items()
10167 }
10168
10169 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10171 self.0.request.name = v.into();
10172 self
10173 }
10174
10175 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10177 self.0.request.filter = v.into();
10178 self
10179 }
10180
10181 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10183 self.0.request.page_size = v.into();
10184 self
10185 }
10186
10187 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10189 self.0.request.page_token = v.into();
10190 self
10191 }
10192 }
10193
10194 #[doc(hidden)]
10195 impl crate::RequestBuilder for ListLocations {
10196 fn request_options(&mut self) -> &mut crate::RequestOptions {
10197 &mut self.0.options
10198 }
10199 }
10200
10201 #[derive(Clone, Debug)]
10218 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
10219
10220 impl GetLocation {
10221 pub(crate) fn new(
10222 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10223 ) -> Self {
10224 Self(RequestBuilder::new(stub))
10225 }
10226
10227 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
10229 mut self,
10230 v: V,
10231 ) -> Self {
10232 self.0.request = v.into();
10233 self
10234 }
10235
10236 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10238 self.0.options = v.into();
10239 self
10240 }
10241
10242 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
10244 (*self.0.stub)
10245 .get_location(self.0.request, self.0.options)
10246 .await
10247 .map(crate::Response::into_body)
10248 }
10249
10250 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10252 self.0.request.name = v.into();
10253 self
10254 }
10255 }
10256
10257 #[doc(hidden)]
10258 impl crate::RequestBuilder for GetLocation {
10259 fn request_options(&mut self) -> &mut crate::RequestOptions {
10260 &mut self.0.options
10261 }
10262 }
10263
10264 #[derive(Clone, Debug)]
10285 pub struct ListOperations(
10286 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
10287 );
10288
10289 impl ListOperations {
10290 pub(crate) fn new(
10291 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10292 ) -> Self {
10293 Self(RequestBuilder::new(stub))
10294 }
10295
10296 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
10298 mut self,
10299 v: V,
10300 ) -> Self {
10301 self.0.request = v.into();
10302 self
10303 }
10304
10305 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10307 self.0.options = v.into();
10308 self
10309 }
10310
10311 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
10313 (*self.0.stub)
10314 .list_operations(self.0.request, self.0.options)
10315 .await
10316 .map(crate::Response::into_body)
10317 }
10318
10319 pub fn by_page(
10321 self,
10322 ) -> impl google_cloud_gax::paginator::Paginator<
10323 google_cloud_longrunning::model::ListOperationsResponse,
10324 crate::Error,
10325 > {
10326 use std::clone::Clone;
10327 let token = self.0.request.page_token.clone();
10328 let execute = move |token: String| {
10329 let mut builder = self.clone();
10330 builder.0.request = builder.0.request.set_page_token(token);
10331 builder.send()
10332 };
10333 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10334 }
10335
10336 pub fn by_item(
10338 self,
10339 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10340 google_cloud_longrunning::model::ListOperationsResponse,
10341 crate::Error,
10342 > {
10343 use google_cloud_gax::paginator::Paginator;
10344 self.by_page().items()
10345 }
10346
10347 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10349 self.0.request.name = v.into();
10350 self
10351 }
10352
10353 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
10355 self.0.request.filter = v.into();
10356 self
10357 }
10358
10359 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10361 self.0.request.page_size = v.into();
10362 self
10363 }
10364
10365 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10367 self.0.request.page_token = v.into();
10368 self
10369 }
10370
10371 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
10373 self.0.request.return_partial_success = v.into();
10374 self
10375 }
10376 }
10377
10378 #[doc(hidden)]
10379 impl crate::RequestBuilder for ListOperations {
10380 fn request_options(&mut self) -> &mut crate::RequestOptions {
10381 &mut self.0.options
10382 }
10383 }
10384
10385 #[derive(Clone, Debug)]
10402 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
10403
10404 impl GetOperation {
10405 pub(crate) fn new(
10406 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10407 ) -> Self {
10408 Self(RequestBuilder::new(stub))
10409 }
10410
10411 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
10413 mut self,
10414 v: V,
10415 ) -> Self {
10416 self.0.request = v.into();
10417 self
10418 }
10419
10420 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10422 self.0.options = v.into();
10423 self
10424 }
10425
10426 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
10428 (*self.0.stub)
10429 .get_operation(self.0.request, self.0.options)
10430 .await
10431 .map(crate::Response::into_body)
10432 }
10433
10434 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10436 self.0.request.name = v.into();
10437 self
10438 }
10439 }
10440
10441 #[doc(hidden)]
10442 impl crate::RequestBuilder for GetOperation {
10443 fn request_options(&mut self) -> &mut crate::RequestOptions {
10444 &mut self.0.options
10445 }
10446 }
10447
10448 #[derive(Clone, Debug)]
10465 pub struct CancelOperation(
10466 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
10467 );
10468
10469 impl CancelOperation {
10470 pub(crate) fn new(
10471 stub: std::sync::Arc<dyn super::super::stub::dynamic::EncryptionSpecService>,
10472 ) -> Self {
10473 Self(RequestBuilder::new(stub))
10474 }
10475
10476 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
10478 mut self,
10479 v: V,
10480 ) -> Self {
10481 self.0.request = v.into();
10482 self
10483 }
10484
10485 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10487 self.0.options = v.into();
10488 self
10489 }
10490
10491 pub async fn send(self) -> Result<()> {
10493 (*self.0.stub)
10494 .cancel_operation(self.0.request, self.0.options)
10495 .await
10496 .map(crate::Response::into_body)
10497 }
10498
10499 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10501 self.0.request.name = v.into();
10502 self
10503 }
10504 }
10505
10506 #[doc(hidden)]
10507 impl crate::RequestBuilder for CancelOperation {
10508 fn request_options(&mut self) -> &mut crate::RequestOptions {
10509 &mut self.0.options
10510 }
10511 }
10512}
10513
10514#[cfg(feature = "entity-types")]
10516#[cfg_attr(docsrs, doc(cfg(feature = "entity-types")))]
10517pub mod entity_types {
10518 use crate::Result;
10519
10520 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
10534
10535 pub(crate) mod client {
10536 use super::super::super::client::EntityTypes;
10537 pub struct Factory;
10538 impl crate::ClientFactory for Factory {
10539 type Client = EntityTypes;
10540 type Credentials = gaxi::options::Credentials;
10541 async fn build(
10542 self,
10543 config: gaxi::options::ClientConfig,
10544 ) -> crate::ClientBuilderResult<Self::Client> {
10545 Self::Client::new(config).await
10546 }
10547 }
10548 }
10549
10550 #[derive(Clone, Debug)]
10552 pub(crate) struct RequestBuilder<R: std::default::Default> {
10553 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10554 request: R,
10555 options: crate::RequestOptions,
10556 }
10557
10558 impl<R> RequestBuilder<R>
10559 where
10560 R: std::default::Default,
10561 {
10562 pub(crate) fn new(
10563 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10564 ) -> Self {
10565 Self {
10566 stub,
10567 request: R::default(),
10568 options: crate::RequestOptions::default(),
10569 }
10570 }
10571 }
10572
10573 #[derive(Clone, Debug)]
10594 pub struct ListEntityTypes(RequestBuilder<crate::model::ListEntityTypesRequest>);
10595
10596 impl ListEntityTypes {
10597 pub(crate) fn new(
10598 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10599 ) -> Self {
10600 Self(RequestBuilder::new(stub))
10601 }
10602
10603 pub fn with_request<V: Into<crate::model::ListEntityTypesRequest>>(mut self, v: V) -> Self {
10605 self.0.request = v.into();
10606 self
10607 }
10608
10609 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10611 self.0.options = v.into();
10612 self
10613 }
10614
10615 pub async fn send(self) -> Result<crate::model::ListEntityTypesResponse> {
10617 (*self.0.stub)
10618 .list_entity_types(self.0.request, self.0.options)
10619 .await
10620 .map(crate::Response::into_body)
10621 }
10622
10623 pub fn by_page(
10625 self,
10626 ) -> impl google_cloud_gax::paginator::Paginator<
10627 crate::model::ListEntityTypesResponse,
10628 crate::Error,
10629 > {
10630 use std::clone::Clone;
10631 let token = self.0.request.page_token.clone();
10632 let execute = move |token: String| {
10633 let mut builder = self.clone();
10634 builder.0.request = builder.0.request.set_page_token(token);
10635 builder.send()
10636 };
10637 google_cloud_gax::paginator::internal::new_paginator(token, execute)
10638 }
10639
10640 pub fn by_item(
10642 self,
10643 ) -> impl google_cloud_gax::paginator::ItemPaginator<
10644 crate::model::ListEntityTypesResponse,
10645 crate::Error,
10646 > {
10647 use google_cloud_gax::paginator::Paginator;
10648 self.by_page().items()
10649 }
10650
10651 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10655 self.0.request.parent = v.into();
10656 self
10657 }
10658
10659 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10661 self.0.request.language_code = v.into();
10662 self
10663 }
10664
10665 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
10667 self.0.request.page_size = v.into();
10668 self
10669 }
10670
10671 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
10673 self.0.request.page_token = v.into();
10674 self
10675 }
10676 }
10677
10678 #[doc(hidden)]
10679 impl crate::RequestBuilder for ListEntityTypes {
10680 fn request_options(&mut self) -> &mut crate::RequestOptions {
10681 &mut self.0.options
10682 }
10683 }
10684
10685 #[derive(Clone, Debug)]
10702 pub struct GetEntityType(RequestBuilder<crate::model::GetEntityTypeRequest>);
10703
10704 impl GetEntityType {
10705 pub(crate) fn new(
10706 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10707 ) -> Self {
10708 Self(RequestBuilder::new(stub))
10709 }
10710
10711 pub fn with_request<V: Into<crate::model::GetEntityTypeRequest>>(mut self, v: V) -> Self {
10713 self.0.request = v.into();
10714 self
10715 }
10716
10717 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10719 self.0.options = v.into();
10720 self
10721 }
10722
10723 pub async fn send(self) -> Result<crate::model::EntityType> {
10725 (*self.0.stub)
10726 .get_entity_type(self.0.request, self.0.options)
10727 .await
10728 .map(crate::Response::into_body)
10729 }
10730
10731 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
10735 self.0.request.name = v.into();
10736 self
10737 }
10738
10739 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10741 self.0.request.language_code = v.into();
10742 self
10743 }
10744 }
10745
10746 #[doc(hidden)]
10747 impl crate::RequestBuilder for GetEntityType {
10748 fn request_options(&mut self) -> &mut crate::RequestOptions {
10749 &mut self.0.options
10750 }
10751 }
10752
10753 #[derive(Clone, Debug)]
10770 pub struct CreateEntityType(RequestBuilder<crate::model::CreateEntityTypeRequest>);
10771
10772 impl CreateEntityType {
10773 pub(crate) fn new(
10774 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10775 ) -> Self {
10776 Self(RequestBuilder::new(stub))
10777 }
10778
10779 pub fn with_request<V: Into<crate::model::CreateEntityTypeRequest>>(
10781 mut self,
10782 v: V,
10783 ) -> Self {
10784 self.0.request = v.into();
10785 self
10786 }
10787
10788 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10790 self.0.options = v.into();
10791 self
10792 }
10793
10794 pub async fn send(self) -> Result<crate::model::EntityType> {
10796 (*self.0.stub)
10797 .create_entity_type(self.0.request, self.0.options)
10798 .await
10799 .map(crate::Response::into_body)
10800 }
10801
10802 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
10806 self.0.request.parent = v.into();
10807 self
10808 }
10809
10810 pub fn set_entity_type<T>(mut self, v: T) -> Self
10814 where
10815 T: std::convert::Into<crate::model::EntityType>,
10816 {
10817 self.0.request.entity_type = std::option::Option::Some(v.into());
10818 self
10819 }
10820
10821 pub fn set_or_clear_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
10825 where
10826 T: std::convert::Into<crate::model::EntityType>,
10827 {
10828 self.0.request.entity_type = v.map(|x| x.into());
10829 self
10830 }
10831
10832 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10834 self.0.request.language_code = v.into();
10835 self
10836 }
10837 }
10838
10839 #[doc(hidden)]
10840 impl crate::RequestBuilder for CreateEntityType {
10841 fn request_options(&mut self) -> &mut crate::RequestOptions {
10842 &mut self.0.options
10843 }
10844 }
10845
10846 #[derive(Clone, Debug)]
10863 pub struct UpdateEntityType(RequestBuilder<crate::model::UpdateEntityTypeRequest>);
10864
10865 impl UpdateEntityType {
10866 pub(crate) fn new(
10867 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10868 ) -> Self {
10869 Self(RequestBuilder::new(stub))
10870 }
10871
10872 pub fn with_request<V: Into<crate::model::UpdateEntityTypeRequest>>(
10874 mut self,
10875 v: V,
10876 ) -> Self {
10877 self.0.request = v.into();
10878 self
10879 }
10880
10881 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10883 self.0.options = v.into();
10884 self
10885 }
10886
10887 pub async fn send(self) -> Result<crate::model::EntityType> {
10889 (*self.0.stub)
10890 .update_entity_type(self.0.request, self.0.options)
10891 .await
10892 .map(crate::Response::into_body)
10893 }
10894
10895 pub fn set_entity_type<T>(mut self, v: T) -> Self
10899 where
10900 T: std::convert::Into<crate::model::EntityType>,
10901 {
10902 self.0.request.entity_type = std::option::Option::Some(v.into());
10903 self
10904 }
10905
10906 pub fn set_or_clear_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
10910 where
10911 T: std::convert::Into<crate::model::EntityType>,
10912 {
10913 self.0.request.entity_type = v.map(|x| x.into());
10914 self
10915 }
10916
10917 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
10919 self.0.request.language_code = v.into();
10920 self
10921 }
10922
10923 pub fn set_update_mask<T>(mut self, v: T) -> Self
10925 where
10926 T: std::convert::Into<wkt::FieldMask>,
10927 {
10928 self.0.request.update_mask = std::option::Option::Some(v.into());
10929 self
10930 }
10931
10932 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10934 where
10935 T: std::convert::Into<wkt::FieldMask>,
10936 {
10937 self.0.request.update_mask = v.map(|x| x.into());
10938 self
10939 }
10940 }
10941
10942 #[doc(hidden)]
10943 impl crate::RequestBuilder for UpdateEntityType {
10944 fn request_options(&mut self) -> &mut crate::RequestOptions {
10945 &mut self.0.options
10946 }
10947 }
10948
10949 #[derive(Clone, Debug)]
10966 pub struct DeleteEntityType(RequestBuilder<crate::model::DeleteEntityTypeRequest>);
10967
10968 impl DeleteEntityType {
10969 pub(crate) fn new(
10970 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
10971 ) -> Self {
10972 Self(RequestBuilder::new(stub))
10973 }
10974
10975 pub fn with_request<V: Into<crate::model::DeleteEntityTypeRequest>>(
10977 mut self,
10978 v: V,
10979 ) -> Self {
10980 self.0.request = v.into();
10981 self
10982 }
10983
10984 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
10986 self.0.options = v.into();
10987 self
10988 }
10989
10990 pub async fn send(self) -> Result<()> {
10992 (*self.0.stub)
10993 .delete_entity_type(self.0.request, self.0.options)
10994 .await
10995 .map(crate::Response::into_body)
10996 }
10997
10998 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11002 self.0.request.name = v.into();
11003 self
11004 }
11005 }
11006
11007 #[doc(hidden)]
11008 impl crate::RequestBuilder for DeleteEntityType {
11009 fn request_options(&mut self) -> &mut crate::RequestOptions {
11010 &mut self.0.options
11011 }
11012 }
11013
11014 #[derive(Clone, Debug)]
11032 pub struct BatchUpdateEntityTypes(RequestBuilder<crate::model::BatchUpdateEntityTypesRequest>);
11033
11034 impl BatchUpdateEntityTypes {
11035 pub(crate) fn new(
11036 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11037 ) -> Self {
11038 Self(RequestBuilder::new(stub))
11039 }
11040
11041 pub fn with_request<V: Into<crate::model::BatchUpdateEntityTypesRequest>>(
11043 mut self,
11044 v: V,
11045 ) -> Self {
11046 self.0.request = v.into();
11047 self
11048 }
11049
11050 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11052 self.0.options = v.into();
11053 self
11054 }
11055
11056 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11063 (*self.0.stub)
11064 .batch_update_entity_types(self.0.request, self.0.options)
11065 .await
11066 .map(crate::Response::into_body)
11067 }
11068
11069 pub fn poller(
11071 self,
11072 ) -> impl google_cloud_lro::Poller<crate::model::BatchUpdateEntityTypesResponse, wkt::Struct>
11073 {
11074 type Operation = google_cloud_lro::internal::Operation<
11075 crate::model::BatchUpdateEntityTypesResponse,
11076 wkt::Struct,
11077 >;
11078 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11079 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11080
11081 let stub = self.0.stub.clone();
11082 let mut options = self.0.options.clone();
11083 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11084 let query = move |name| {
11085 let stub = stub.clone();
11086 let options = options.clone();
11087 async {
11088 let op = GetOperation::new(stub)
11089 .set_name(name)
11090 .with_options(options)
11091 .send()
11092 .await?;
11093 Ok(Operation::new(op))
11094 }
11095 };
11096
11097 let start = move || async {
11098 let op = self.send().await?;
11099 Ok(Operation::new(op))
11100 };
11101
11102 google_cloud_lro::internal::new_poller(
11103 polling_error_policy,
11104 polling_backoff_policy,
11105 start,
11106 query,
11107 )
11108 }
11109
11110 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11114 self.0.request.parent = v.into();
11115 self
11116 }
11117
11118 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11120 self.0.request.language_code = v.into();
11121 self
11122 }
11123
11124 pub fn set_update_mask<T>(mut self, v: T) -> Self
11126 where
11127 T: std::convert::Into<wkt::FieldMask>,
11128 {
11129 self.0.request.update_mask = std::option::Option::Some(v.into());
11130 self
11131 }
11132
11133 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11135 where
11136 T: std::convert::Into<wkt::FieldMask>,
11137 {
11138 self.0.request.update_mask = v.map(|x| x.into());
11139 self
11140 }
11141
11142 pub fn set_entity_type_batch<
11147 T: Into<Option<crate::model::batch_update_entity_types_request::EntityTypeBatch>>,
11148 >(
11149 mut self,
11150 v: T,
11151 ) -> Self {
11152 self.0.request.entity_type_batch = v.into();
11153 self
11154 }
11155
11156 pub fn set_entity_type_batch_uri<T: std::convert::Into<std::string::String>>(
11162 mut self,
11163 v: T,
11164 ) -> Self {
11165 self.0.request = self.0.request.set_entity_type_batch_uri(v);
11166 self
11167 }
11168
11169 pub fn set_entity_type_batch_inline<
11175 T: std::convert::Into<std::boxed::Box<crate::model::EntityTypeBatch>>,
11176 >(
11177 mut self,
11178 v: T,
11179 ) -> Self {
11180 self.0.request = self.0.request.set_entity_type_batch_inline(v);
11181 self
11182 }
11183 }
11184
11185 #[doc(hidden)]
11186 impl crate::RequestBuilder for BatchUpdateEntityTypes {
11187 fn request_options(&mut self) -> &mut crate::RequestOptions {
11188 &mut self.0.options
11189 }
11190 }
11191
11192 #[derive(Clone, Debug)]
11210 pub struct BatchDeleteEntityTypes(RequestBuilder<crate::model::BatchDeleteEntityTypesRequest>);
11211
11212 impl BatchDeleteEntityTypes {
11213 pub(crate) fn new(
11214 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11215 ) -> Self {
11216 Self(RequestBuilder::new(stub))
11217 }
11218
11219 pub fn with_request<V: Into<crate::model::BatchDeleteEntityTypesRequest>>(
11221 mut self,
11222 v: V,
11223 ) -> Self {
11224 self.0.request = v.into();
11225 self
11226 }
11227
11228 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11230 self.0.options = v.into();
11231 self
11232 }
11233
11234 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11241 (*self.0.stub)
11242 .batch_delete_entity_types(self.0.request, self.0.options)
11243 .await
11244 .map(crate::Response::into_body)
11245 }
11246
11247 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
11249 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
11250 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11251 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11252
11253 let stub = self.0.stub.clone();
11254 let mut options = self.0.options.clone();
11255 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11256 let query = move |name| {
11257 let stub = stub.clone();
11258 let options = options.clone();
11259 async {
11260 let op = GetOperation::new(stub)
11261 .set_name(name)
11262 .with_options(options)
11263 .send()
11264 .await?;
11265 Ok(Operation::new(op))
11266 }
11267 };
11268
11269 let start = move || async {
11270 let op = self.send().await?;
11271 Ok(Operation::new(op))
11272 };
11273
11274 google_cloud_lro::internal::new_unit_response_poller(
11275 polling_error_policy,
11276 polling_backoff_policy,
11277 start,
11278 query,
11279 )
11280 }
11281
11282 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11286 self.0.request.parent = v.into();
11287 self
11288 }
11289
11290 pub fn set_entity_type_names<T, V>(mut self, v: T) -> Self
11294 where
11295 T: std::iter::IntoIterator<Item = V>,
11296 V: std::convert::Into<std::string::String>,
11297 {
11298 use std::iter::Iterator;
11299 self.0.request.entity_type_names = v.into_iter().map(|i| i.into()).collect();
11300 self
11301 }
11302 }
11303
11304 #[doc(hidden)]
11305 impl crate::RequestBuilder for BatchDeleteEntityTypes {
11306 fn request_options(&mut self) -> &mut crate::RequestOptions {
11307 &mut self.0.options
11308 }
11309 }
11310
11311 #[derive(Clone, Debug)]
11329 pub struct BatchCreateEntities(RequestBuilder<crate::model::BatchCreateEntitiesRequest>);
11330
11331 impl BatchCreateEntities {
11332 pub(crate) fn new(
11333 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11334 ) -> Self {
11335 Self(RequestBuilder::new(stub))
11336 }
11337
11338 pub fn with_request<V: Into<crate::model::BatchCreateEntitiesRequest>>(
11340 mut self,
11341 v: V,
11342 ) -> Self {
11343 self.0.request = v.into();
11344 self
11345 }
11346
11347 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11349 self.0.options = v.into();
11350 self
11351 }
11352
11353 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11360 (*self.0.stub)
11361 .batch_create_entities(self.0.request, self.0.options)
11362 .await
11363 .map(crate::Response::into_body)
11364 }
11365
11366 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
11368 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
11369 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11370 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11371
11372 let stub = self.0.stub.clone();
11373 let mut options = self.0.options.clone();
11374 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11375 let query = move |name| {
11376 let stub = stub.clone();
11377 let options = options.clone();
11378 async {
11379 let op = GetOperation::new(stub)
11380 .set_name(name)
11381 .with_options(options)
11382 .send()
11383 .await?;
11384 Ok(Operation::new(op))
11385 }
11386 };
11387
11388 let start = move || async {
11389 let op = self.send().await?;
11390 Ok(Operation::new(op))
11391 };
11392
11393 google_cloud_lro::internal::new_unit_response_poller(
11394 polling_error_policy,
11395 polling_backoff_policy,
11396 start,
11397 query,
11398 )
11399 }
11400
11401 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11405 self.0.request.parent = v.into();
11406 self
11407 }
11408
11409 pub fn set_entities<T, V>(mut self, v: T) -> Self
11413 where
11414 T: std::iter::IntoIterator<Item = V>,
11415 V: std::convert::Into<crate::model::entity_type::Entity>,
11416 {
11417 use std::iter::Iterator;
11418 self.0.request.entities = v.into_iter().map(|i| i.into()).collect();
11419 self
11420 }
11421
11422 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11424 self.0.request.language_code = v.into();
11425 self
11426 }
11427 }
11428
11429 #[doc(hidden)]
11430 impl crate::RequestBuilder for BatchCreateEntities {
11431 fn request_options(&mut self) -> &mut crate::RequestOptions {
11432 &mut self.0.options
11433 }
11434 }
11435
11436 #[derive(Clone, Debug)]
11454 pub struct BatchUpdateEntities(RequestBuilder<crate::model::BatchUpdateEntitiesRequest>);
11455
11456 impl BatchUpdateEntities {
11457 pub(crate) fn new(
11458 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11459 ) -> Self {
11460 Self(RequestBuilder::new(stub))
11461 }
11462
11463 pub fn with_request<V: Into<crate::model::BatchUpdateEntitiesRequest>>(
11465 mut self,
11466 v: V,
11467 ) -> Self {
11468 self.0.request = v.into();
11469 self
11470 }
11471
11472 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11474 self.0.options = v.into();
11475 self
11476 }
11477
11478 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11485 (*self.0.stub)
11486 .batch_update_entities(self.0.request, self.0.options)
11487 .await
11488 .map(crate::Response::into_body)
11489 }
11490
11491 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
11493 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
11494 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11495 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11496
11497 let stub = self.0.stub.clone();
11498 let mut options = self.0.options.clone();
11499 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11500 let query = move |name| {
11501 let stub = stub.clone();
11502 let options = options.clone();
11503 async {
11504 let op = GetOperation::new(stub)
11505 .set_name(name)
11506 .with_options(options)
11507 .send()
11508 .await?;
11509 Ok(Operation::new(op))
11510 }
11511 };
11512
11513 let start = move || async {
11514 let op = self.send().await?;
11515 Ok(Operation::new(op))
11516 };
11517
11518 google_cloud_lro::internal::new_unit_response_poller(
11519 polling_error_policy,
11520 polling_backoff_policy,
11521 start,
11522 query,
11523 )
11524 }
11525
11526 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11530 self.0.request.parent = v.into();
11531 self
11532 }
11533
11534 pub fn set_entities<T, V>(mut self, v: T) -> Self
11538 where
11539 T: std::iter::IntoIterator<Item = V>,
11540 V: std::convert::Into<crate::model::entity_type::Entity>,
11541 {
11542 use std::iter::Iterator;
11543 self.0.request.entities = v.into_iter().map(|i| i.into()).collect();
11544 self
11545 }
11546
11547 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11549 self.0.request.language_code = v.into();
11550 self
11551 }
11552
11553 pub fn set_update_mask<T>(mut self, v: T) -> Self
11555 where
11556 T: std::convert::Into<wkt::FieldMask>,
11557 {
11558 self.0.request.update_mask = std::option::Option::Some(v.into());
11559 self
11560 }
11561
11562 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11564 where
11565 T: std::convert::Into<wkt::FieldMask>,
11566 {
11567 self.0.request.update_mask = v.map(|x| x.into());
11568 self
11569 }
11570 }
11571
11572 #[doc(hidden)]
11573 impl crate::RequestBuilder for BatchUpdateEntities {
11574 fn request_options(&mut self) -> &mut crate::RequestOptions {
11575 &mut self.0.options
11576 }
11577 }
11578
11579 #[derive(Clone, Debug)]
11597 pub struct BatchDeleteEntities(RequestBuilder<crate::model::BatchDeleteEntitiesRequest>);
11598
11599 impl BatchDeleteEntities {
11600 pub(crate) fn new(
11601 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11602 ) -> Self {
11603 Self(RequestBuilder::new(stub))
11604 }
11605
11606 pub fn with_request<V: Into<crate::model::BatchDeleteEntitiesRequest>>(
11608 mut self,
11609 v: V,
11610 ) -> Self {
11611 self.0.request = v.into();
11612 self
11613 }
11614
11615 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11617 self.0.options = v.into();
11618 self
11619 }
11620
11621 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
11628 (*self.0.stub)
11629 .batch_delete_entities(self.0.request, self.0.options)
11630 .await
11631 .map(crate::Response::into_body)
11632 }
11633
11634 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
11636 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
11637 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
11638 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
11639
11640 let stub = self.0.stub.clone();
11641 let mut options = self.0.options.clone();
11642 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
11643 let query = move |name| {
11644 let stub = stub.clone();
11645 let options = options.clone();
11646 async {
11647 let op = GetOperation::new(stub)
11648 .set_name(name)
11649 .with_options(options)
11650 .send()
11651 .await?;
11652 Ok(Operation::new(op))
11653 }
11654 };
11655
11656 let start = move || async {
11657 let op = self.send().await?;
11658 Ok(Operation::new(op))
11659 };
11660
11661 google_cloud_lro::internal::new_unit_response_poller(
11662 polling_error_policy,
11663 polling_backoff_policy,
11664 start,
11665 query,
11666 )
11667 }
11668
11669 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
11673 self.0.request.parent = v.into();
11674 self
11675 }
11676
11677 pub fn set_entity_values<T, V>(mut self, v: T) -> Self
11681 where
11682 T: std::iter::IntoIterator<Item = V>,
11683 V: std::convert::Into<std::string::String>,
11684 {
11685 use std::iter::Iterator;
11686 self.0.request.entity_values = v.into_iter().map(|i| i.into()).collect();
11687 self
11688 }
11689
11690 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
11692 self.0.request.language_code = v.into();
11693 self
11694 }
11695 }
11696
11697 #[doc(hidden)]
11698 impl crate::RequestBuilder for BatchDeleteEntities {
11699 fn request_options(&mut self) -> &mut crate::RequestOptions {
11700 &mut self.0.options
11701 }
11702 }
11703
11704 #[derive(Clone, Debug)]
11725 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
11726
11727 impl ListLocations {
11728 pub(crate) fn new(
11729 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11730 ) -> Self {
11731 Self(RequestBuilder::new(stub))
11732 }
11733
11734 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
11736 mut self,
11737 v: V,
11738 ) -> Self {
11739 self.0.request = v.into();
11740 self
11741 }
11742
11743 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11745 self.0.options = v.into();
11746 self
11747 }
11748
11749 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
11751 (*self.0.stub)
11752 .list_locations(self.0.request, self.0.options)
11753 .await
11754 .map(crate::Response::into_body)
11755 }
11756
11757 pub fn by_page(
11759 self,
11760 ) -> impl google_cloud_gax::paginator::Paginator<
11761 google_cloud_location::model::ListLocationsResponse,
11762 crate::Error,
11763 > {
11764 use std::clone::Clone;
11765 let token = self.0.request.page_token.clone();
11766 let execute = move |token: String| {
11767 let mut builder = self.clone();
11768 builder.0.request = builder.0.request.set_page_token(token);
11769 builder.send()
11770 };
11771 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11772 }
11773
11774 pub fn by_item(
11776 self,
11777 ) -> impl google_cloud_gax::paginator::ItemPaginator<
11778 google_cloud_location::model::ListLocationsResponse,
11779 crate::Error,
11780 > {
11781 use google_cloud_gax::paginator::Paginator;
11782 self.by_page().items()
11783 }
11784
11785 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11787 self.0.request.name = v.into();
11788 self
11789 }
11790
11791 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11793 self.0.request.filter = v.into();
11794 self
11795 }
11796
11797 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11799 self.0.request.page_size = v.into();
11800 self
11801 }
11802
11803 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11805 self.0.request.page_token = v.into();
11806 self
11807 }
11808 }
11809
11810 #[doc(hidden)]
11811 impl crate::RequestBuilder for ListLocations {
11812 fn request_options(&mut self) -> &mut crate::RequestOptions {
11813 &mut self.0.options
11814 }
11815 }
11816
11817 #[derive(Clone, Debug)]
11834 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
11835
11836 impl GetLocation {
11837 pub(crate) fn new(
11838 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11839 ) -> Self {
11840 Self(RequestBuilder::new(stub))
11841 }
11842
11843 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
11845 mut self,
11846 v: V,
11847 ) -> Self {
11848 self.0.request = v.into();
11849 self
11850 }
11851
11852 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11854 self.0.options = v.into();
11855 self
11856 }
11857
11858 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
11860 (*self.0.stub)
11861 .get_location(self.0.request, self.0.options)
11862 .await
11863 .map(crate::Response::into_body)
11864 }
11865
11866 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11868 self.0.request.name = v.into();
11869 self
11870 }
11871 }
11872
11873 #[doc(hidden)]
11874 impl crate::RequestBuilder for GetLocation {
11875 fn request_options(&mut self) -> &mut crate::RequestOptions {
11876 &mut self.0.options
11877 }
11878 }
11879
11880 #[derive(Clone, Debug)]
11901 pub struct ListOperations(
11902 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
11903 );
11904
11905 impl ListOperations {
11906 pub(crate) fn new(
11907 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
11908 ) -> Self {
11909 Self(RequestBuilder::new(stub))
11910 }
11911
11912 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
11914 mut self,
11915 v: V,
11916 ) -> Self {
11917 self.0.request = v.into();
11918 self
11919 }
11920
11921 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
11923 self.0.options = v.into();
11924 self
11925 }
11926
11927 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
11929 (*self.0.stub)
11930 .list_operations(self.0.request, self.0.options)
11931 .await
11932 .map(crate::Response::into_body)
11933 }
11934
11935 pub fn by_page(
11937 self,
11938 ) -> impl google_cloud_gax::paginator::Paginator<
11939 google_cloud_longrunning::model::ListOperationsResponse,
11940 crate::Error,
11941 > {
11942 use std::clone::Clone;
11943 let token = self.0.request.page_token.clone();
11944 let execute = move |token: String| {
11945 let mut builder = self.clone();
11946 builder.0.request = builder.0.request.set_page_token(token);
11947 builder.send()
11948 };
11949 google_cloud_gax::paginator::internal::new_paginator(token, execute)
11950 }
11951
11952 pub fn by_item(
11954 self,
11955 ) -> impl google_cloud_gax::paginator::ItemPaginator<
11956 google_cloud_longrunning::model::ListOperationsResponse,
11957 crate::Error,
11958 > {
11959 use google_cloud_gax::paginator::Paginator;
11960 self.by_page().items()
11961 }
11962
11963 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
11965 self.0.request.name = v.into();
11966 self
11967 }
11968
11969 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
11971 self.0.request.filter = v.into();
11972 self
11973 }
11974
11975 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
11977 self.0.request.page_size = v.into();
11978 self
11979 }
11980
11981 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
11983 self.0.request.page_token = v.into();
11984 self
11985 }
11986
11987 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
11989 self.0.request.return_partial_success = v.into();
11990 self
11991 }
11992 }
11993
11994 #[doc(hidden)]
11995 impl crate::RequestBuilder for ListOperations {
11996 fn request_options(&mut self) -> &mut crate::RequestOptions {
11997 &mut self.0.options
11998 }
11999 }
12000
12001 #[derive(Clone, Debug)]
12018 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
12019
12020 impl GetOperation {
12021 pub(crate) fn new(
12022 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
12023 ) -> Self {
12024 Self(RequestBuilder::new(stub))
12025 }
12026
12027 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
12029 mut self,
12030 v: V,
12031 ) -> Self {
12032 self.0.request = v.into();
12033 self
12034 }
12035
12036 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12038 self.0.options = v.into();
12039 self
12040 }
12041
12042 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
12044 (*self.0.stub)
12045 .get_operation(self.0.request, self.0.options)
12046 .await
12047 .map(crate::Response::into_body)
12048 }
12049
12050 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12052 self.0.request.name = v.into();
12053 self
12054 }
12055 }
12056
12057 #[doc(hidden)]
12058 impl crate::RequestBuilder for GetOperation {
12059 fn request_options(&mut self) -> &mut crate::RequestOptions {
12060 &mut self.0.options
12061 }
12062 }
12063
12064 #[derive(Clone, Debug)]
12081 pub struct CancelOperation(
12082 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
12083 );
12084
12085 impl CancelOperation {
12086 pub(crate) fn new(
12087 stub: std::sync::Arc<dyn super::super::stub::dynamic::EntityTypes>,
12088 ) -> Self {
12089 Self(RequestBuilder::new(stub))
12090 }
12091
12092 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
12094 mut self,
12095 v: V,
12096 ) -> Self {
12097 self.0.request = v.into();
12098 self
12099 }
12100
12101 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12103 self.0.options = v.into();
12104 self
12105 }
12106
12107 pub async fn send(self) -> Result<()> {
12109 (*self.0.stub)
12110 .cancel_operation(self.0.request, self.0.options)
12111 .await
12112 .map(crate::Response::into_body)
12113 }
12114
12115 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12117 self.0.request.name = v.into();
12118 self
12119 }
12120 }
12121
12122 #[doc(hidden)]
12123 impl crate::RequestBuilder for CancelOperation {
12124 fn request_options(&mut self) -> &mut crate::RequestOptions {
12125 &mut self.0.options
12126 }
12127 }
12128}
12129
12130#[cfg(feature = "environments")]
12132#[cfg_attr(docsrs, doc(cfg(feature = "environments")))]
12133pub mod environments {
12134 use crate::Result;
12135
12136 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
12150
12151 pub(crate) mod client {
12152 use super::super::super::client::Environments;
12153 pub struct Factory;
12154 impl crate::ClientFactory for Factory {
12155 type Client = Environments;
12156 type Credentials = gaxi::options::Credentials;
12157 async fn build(
12158 self,
12159 config: gaxi::options::ClientConfig,
12160 ) -> crate::ClientBuilderResult<Self::Client> {
12161 Self::Client::new(config).await
12162 }
12163 }
12164 }
12165
12166 #[derive(Clone, Debug)]
12168 pub(crate) struct RequestBuilder<R: std::default::Default> {
12169 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12170 request: R,
12171 options: crate::RequestOptions,
12172 }
12173
12174 impl<R> RequestBuilder<R>
12175 where
12176 R: std::default::Default,
12177 {
12178 pub(crate) fn new(
12179 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12180 ) -> Self {
12181 Self {
12182 stub,
12183 request: R::default(),
12184 options: crate::RequestOptions::default(),
12185 }
12186 }
12187 }
12188
12189 #[derive(Clone, Debug)]
12210 pub struct ListEnvironments(RequestBuilder<crate::model::ListEnvironmentsRequest>);
12211
12212 impl ListEnvironments {
12213 pub(crate) fn new(
12214 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12215 ) -> Self {
12216 Self(RequestBuilder::new(stub))
12217 }
12218
12219 pub fn with_request<V: Into<crate::model::ListEnvironmentsRequest>>(
12221 mut self,
12222 v: V,
12223 ) -> Self {
12224 self.0.request = v.into();
12225 self
12226 }
12227
12228 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12230 self.0.options = v.into();
12231 self
12232 }
12233
12234 pub async fn send(self) -> Result<crate::model::ListEnvironmentsResponse> {
12236 (*self.0.stub)
12237 .list_environments(self.0.request, self.0.options)
12238 .await
12239 .map(crate::Response::into_body)
12240 }
12241
12242 pub fn by_page(
12244 self,
12245 ) -> impl google_cloud_gax::paginator::Paginator<
12246 crate::model::ListEnvironmentsResponse,
12247 crate::Error,
12248 > {
12249 use std::clone::Clone;
12250 let token = self.0.request.page_token.clone();
12251 let execute = move |token: String| {
12252 let mut builder = self.clone();
12253 builder.0.request = builder.0.request.set_page_token(token);
12254 builder.send()
12255 };
12256 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12257 }
12258
12259 pub fn by_item(
12261 self,
12262 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12263 crate::model::ListEnvironmentsResponse,
12264 crate::Error,
12265 > {
12266 use google_cloud_gax::paginator::Paginator;
12267 self.by_page().items()
12268 }
12269
12270 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
12274 self.0.request.parent = v.into();
12275 self
12276 }
12277
12278 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12280 self.0.request.page_size = v.into();
12281 self
12282 }
12283
12284 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12286 self.0.request.page_token = v.into();
12287 self
12288 }
12289 }
12290
12291 #[doc(hidden)]
12292 impl crate::RequestBuilder for ListEnvironments {
12293 fn request_options(&mut self) -> &mut crate::RequestOptions {
12294 &mut self.0.options
12295 }
12296 }
12297
12298 #[derive(Clone, Debug)]
12315 pub struct GetEnvironment(RequestBuilder<crate::model::GetEnvironmentRequest>);
12316
12317 impl GetEnvironment {
12318 pub(crate) fn new(
12319 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12320 ) -> Self {
12321 Self(RequestBuilder::new(stub))
12322 }
12323
12324 pub fn with_request<V: Into<crate::model::GetEnvironmentRequest>>(mut self, v: V) -> Self {
12326 self.0.request = v.into();
12327 self
12328 }
12329
12330 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12332 self.0.options = v.into();
12333 self
12334 }
12335
12336 pub async fn send(self) -> Result<crate::model::Environment> {
12338 (*self.0.stub)
12339 .get_environment(self.0.request, self.0.options)
12340 .await
12341 .map(crate::Response::into_body)
12342 }
12343
12344 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12348 self.0.request.name = v.into();
12349 self
12350 }
12351 }
12352
12353 #[doc(hidden)]
12354 impl crate::RequestBuilder for GetEnvironment {
12355 fn request_options(&mut self) -> &mut crate::RequestOptions {
12356 &mut self.0.options
12357 }
12358 }
12359
12360 #[derive(Clone, Debug)]
12377 pub struct CreateEnvironment(RequestBuilder<crate::model::CreateEnvironmentRequest>);
12378
12379 impl CreateEnvironment {
12380 pub(crate) fn new(
12381 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12382 ) -> Self {
12383 Self(RequestBuilder::new(stub))
12384 }
12385
12386 pub fn with_request<V: Into<crate::model::CreateEnvironmentRequest>>(
12388 mut self,
12389 v: V,
12390 ) -> Self {
12391 self.0.request = v.into();
12392 self
12393 }
12394
12395 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12397 self.0.options = v.into();
12398 self
12399 }
12400
12401 pub async fn send(self) -> Result<crate::model::Environment> {
12403 (*self.0.stub)
12404 .create_environment(self.0.request, self.0.options)
12405 .await
12406 .map(crate::Response::into_body)
12407 }
12408
12409 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
12413 self.0.request.parent = v.into();
12414 self
12415 }
12416
12417 pub fn set_environment<T>(mut self, v: T) -> Self
12421 where
12422 T: std::convert::Into<crate::model::Environment>,
12423 {
12424 self.0.request.environment = std::option::Option::Some(v.into());
12425 self
12426 }
12427
12428 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
12432 where
12433 T: std::convert::Into<crate::model::Environment>,
12434 {
12435 self.0.request.environment = v.map(|x| x.into());
12436 self
12437 }
12438
12439 pub fn set_environment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
12443 self.0.request.environment_id = v.into();
12444 self
12445 }
12446 }
12447
12448 #[doc(hidden)]
12449 impl crate::RequestBuilder for CreateEnvironment {
12450 fn request_options(&mut self) -> &mut crate::RequestOptions {
12451 &mut self.0.options
12452 }
12453 }
12454
12455 #[derive(Clone, Debug)]
12472 pub struct UpdateEnvironment(RequestBuilder<crate::model::UpdateEnvironmentRequest>);
12473
12474 impl UpdateEnvironment {
12475 pub(crate) fn new(
12476 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12477 ) -> Self {
12478 Self(RequestBuilder::new(stub))
12479 }
12480
12481 pub fn with_request<V: Into<crate::model::UpdateEnvironmentRequest>>(
12483 mut self,
12484 v: V,
12485 ) -> Self {
12486 self.0.request = v.into();
12487 self
12488 }
12489
12490 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12492 self.0.options = v.into();
12493 self
12494 }
12495
12496 pub async fn send(self) -> Result<crate::model::Environment> {
12498 (*self.0.stub)
12499 .update_environment(self.0.request, self.0.options)
12500 .await
12501 .map(crate::Response::into_body)
12502 }
12503
12504 pub fn set_environment<T>(mut self, v: T) -> Self
12508 where
12509 T: std::convert::Into<crate::model::Environment>,
12510 {
12511 self.0.request.environment = std::option::Option::Some(v.into());
12512 self
12513 }
12514
12515 pub fn set_or_clear_environment<T>(mut self, v: std::option::Option<T>) -> Self
12519 where
12520 T: std::convert::Into<crate::model::Environment>,
12521 {
12522 self.0.request.environment = v.map(|x| x.into());
12523 self
12524 }
12525
12526 pub fn set_update_mask<T>(mut self, v: T) -> Self
12530 where
12531 T: std::convert::Into<wkt::FieldMask>,
12532 {
12533 self.0.request.update_mask = std::option::Option::Some(v.into());
12534 self
12535 }
12536
12537 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12541 where
12542 T: std::convert::Into<wkt::FieldMask>,
12543 {
12544 self.0.request.update_mask = v.map(|x| x.into());
12545 self
12546 }
12547
12548 pub fn set_allow_load_to_draft_and_discard_changes<T: Into<bool>>(mut self, v: T) -> Self {
12550 self.0.request.allow_load_to_draft_and_discard_changes = v.into();
12551 self
12552 }
12553 }
12554
12555 #[doc(hidden)]
12556 impl crate::RequestBuilder for UpdateEnvironment {
12557 fn request_options(&mut self) -> &mut crate::RequestOptions {
12558 &mut self.0.options
12559 }
12560 }
12561
12562 #[derive(Clone, Debug)]
12579 pub struct DeleteEnvironment(RequestBuilder<crate::model::DeleteEnvironmentRequest>);
12580
12581 impl DeleteEnvironment {
12582 pub(crate) fn new(
12583 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12584 ) -> Self {
12585 Self(RequestBuilder::new(stub))
12586 }
12587
12588 pub fn with_request<V: Into<crate::model::DeleteEnvironmentRequest>>(
12590 mut self,
12591 v: V,
12592 ) -> Self {
12593 self.0.request = v.into();
12594 self
12595 }
12596
12597 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12599 self.0.options = v.into();
12600 self
12601 }
12602
12603 pub async fn send(self) -> Result<()> {
12605 (*self.0.stub)
12606 .delete_environment(self.0.request, self.0.options)
12607 .await
12608 .map(crate::Response::into_body)
12609 }
12610
12611 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12615 self.0.request.name = v.into();
12616 self
12617 }
12618 }
12619
12620 #[doc(hidden)]
12621 impl crate::RequestBuilder for DeleteEnvironment {
12622 fn request_options(&mut self) -> &mut crate::RequestOptions {
12623 &mut self.0.options
12624 }
12625 }
12626
12627 #[derive(Clone, Debug)]
12648 pub struct GetEnvironmentHistory(RequestBuilder<crate::model::GetEnvironmentHistoryRequest>);
12649
12650 impl GetEnvironmentHistory {
12651 pub(crate) fn new(
12652 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12653 ) -> Self {
12654 Self(RequestBuilder::new(stub))
12655 }
12656
12657 pub fn with_request<V: Into<crate::model::GetEnvironmentHistoryRequest>>(
12659 mut self,
12660 v: V,
12661 ) -> Self {
12662 self.0.request = v.into();
12663 self
12664 }
12665
12666 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12668 self.0.options = v.into();
12669 self
12670 }
12671
12672 pub async fn send(self) -> Result<crate::model::EnvironmentHistory> {
12674 (*self.0.stub)
12675 .get_environment_history(self.0.request, self.0.options)
12676 .await
12677 .map(crate::Response::into_body)
12678 }
12679
12680 pub fn by_page(
12682 self,
12683 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::EnvironmentHistory, crate::Error>
12684 {
12685 use std::clone::Clone;
12686 let token = self.0.request.page_token.clone();
12687 let execute = move |token: String| {
12688 let mut builder = self.clone();
12689 builder.0.request = builder.0.request.set_page_token(token);
12690 builder.send()
12691 };
12692 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12693 }
12694
12695 pub fn by_item(
12697 self,
12698 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12699 crate::model::EnvironmentHistory,
12700 crate::Error,
12701 > {
12702 use google_cloud_gax::paginator::Paginator;
12703 self.by_page().items()
12704 }
12705
12706 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
12710 self.0.request.parent = v.into();
12711 self
12712 }
12713
12714 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12716 self.0.request.page_size = v.into();
12717 self
12718 }
12719
12720 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12722 self.0.request.page_token = v.into();
12723 self
12724 }
12725 }
12726
12727 #[doc(hidden)]
12728 impl crate::RequestBuilder for GetEnvironmentHistory {
12729 fn request_options(&mut self) -> &mut crate::RequestOptions {
12730 &mut self.0.options
12731 }
12732 }
12733
12734 #[derive(Clone, Debug)]
12755 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
12756
12757 impl ListLocations {
12758 pub(crate) fn new(
12759 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12760 ) -> Self {
12761 Self(RequestBuilder::new(stub))
12762 }
12763
12764 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
12766 mut self,
12767 v: V,
12768 ) -> Self {
12769 self.0.request = v.into();
12770 self
12771 }
12772
12773 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12775 self.0.options = v.into();
12776 self
12777 }
12778
12779 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
12781 (*self.0.stub)
12782 .list_locations(self.0.request, self.0.options)
12783 .await
12784 .map(crate::Response::into_body)
12785 }
12786
12787 pub fn by_page(
12789 self,
12790 ) -> impl google_cloud_gax::paginator::Paginator<
12791 google_cloud_location::model::ListLocationsResponse,
12792 crate::Error,
12793 > {
12794 use std::clone::Clone;
12795 let token = self.0.request.page_token.clone();
12796 let execute = move |token: String| {
12797 let mut builder = self.clone();
12798 builder.0.request = builder.0.request.set_page_token(token);
12799 builder.send()
12800 };
12801 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12802 }
12803
12804 pub fn by_item(
12806 self,
12807 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12808 google_cloud_location::model::ListLocationsResponse,
12809 crate::Error,
12810 > {
12811 use google_cloud_gax::paginator::Paginator;
12812 self.by_page().items()
12813 }
12814
12815 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12817 self.0.request.name = v.into();
12818 self
12819 }
12820
12821 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
12823 self.0.request.filter = v.into();
12824 self
12825 }
12826
12827 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
12829 self.0.request.page_size = v.into();
12830 self
12831 }
12832
12833 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
12835 self.0.request.page_token = v.into();
12836 self
12837 }
12838 }
12839
12840 #[doc(hidden)]
12841 impl crate::RequestBuilder for ListLocations {
12842 fn request_options(&mut self) -> &mut crate::RequestOptions {
12843 &mut self.0.options
12844 }
12845 }
12846
12847 #[derive(Clone, Debug)]
12864 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
12865
12866 impl GetLocation {
12867 pub(crate) fn new(
12868 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12869 ) -> Self {
12870 Self(RequestBuilder::new(stub))
12871 }
12872
12873 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
12875 mut self,
12876 v: V,
12877 ) -> Self {
12878 self.0.request = v.into();
12879 self
12880 }
12881
12882 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12884 self.0.options = v.into();
12885 self
12886 }
12887
12888 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
12890 (*self.0.stub)
12891 .get_location(self.0.request, self.0.options)
12892 .await
12893 .map(crate::Response::into_body)
12894 }
12895
12896 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12898 self.0.request.name = v.into();
12899 self
12900 }
12901 }
12902
12903 #[doc(hidden)]
12904 impl crate::RequestBuilder for GetLocation {
12905 fn request_options(&mut self) -> &mut crate::RequestOptions {
12906 &mut self.0.options
12907 }
12908 }
12909
12910 #[derive(Clone, Debug)]
12931 pub struct ListOperations(
12932 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
12933 );
12934
12935 impl ListOperations {
12936 pub(crate) fn new(
12937 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
12938 ) -> Self {
12939 Self(RequestBuilder::new(stub))
12940 }
12941
12942 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
12944 mut self,
12945 v: V,
12946 ) -> Self {
12947 self.0.request = v.into();
12948 self
12949 }
12950
12951 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
12953 self.0.options = v.into();
12954 self
12955 }
12956
12957 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
12959 (*self.0.stub)
12960 .list_operations(self.0.request, self.0.options)
12961 .await
12962 .map(crate::Response::into_body)
12963 }
12964
12965 pub fn by_page(
12967 self,
12968 ) -> impl google_cloud_gax::paginator::Paginator<
12969 google_cloud_longrunning::model::ListOperationsResponse,
12970 crate::Error,
12971 > {
12972 use std::clone::Clone;
12973 let token = self.0.request.page_token.clone();
12974 let execute = move |token: String| {
12975 let mut builder = self.clone();
12976 builder.0.request = builder.0.request.set_page_token(token);
12977 builder.send()
12978 };
12979 google_cloud_gax::paginator::internal::new_paginator(token, execute)
12980 }
12981
12982 pub fn by_item(
12984 self,
12985 ) -> impl google_cloud_gax::paginator::ItemPaginator<
12986 google_cloud_longrunning::model::ListOperationsResponse,
12987 crate::Error,
12988 > {
12989 use google_cloud_gax::paginator::Paginator;
12990 self.by_page().items()
12991 }
12992
12993 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
12995 self.0.request.name = v.into();
12996 self
12997 }
12998
12999 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13001 self.0.request.filter = v.into();
13002 self
13003 }
13004
13005 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13007 self.0.request.page_size = v.into();
13008 self
13009 }
13010
13011 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13013 self.0.request.page_token = v.into();
13014 self
13015 }
13016
13017 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13019 self.0.request.return_partial_success = v.into();
13020 self
13021 }
13022 }
13023
13024 #[doc(hidden)]
13025 impl crate::RequestBuilder for ListOperations {
13026 fn request_options(&mut self) -> &mut crate::RequestOptions {
13027 &mut self.0.options
13028 }
13029 }
13030
13031 #[derive(Clone, Debug)]
13048 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13049
13050 impl GetOperation {
13051 pub(crate) fn new(
13052 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
13053 ) -> Self {
13054 Self(RequestBuilder::new(stub))
13055 }
13056
13057 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13059 mut self,
13060 v: V,
13061 ) -> Self {
13062 self.0.request = v.into();
13063 self
13064 }
13065
13066 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13068 self.0.options = v.into();
13069 self
13070 }
13071
13072 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13074 (*self.0.stub)
13075 .get_operation(self.0.request, self.0.options)
13076 .await
13077 .map(crate::Response::into_body)
13078 }
13079
13080 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13082 self.0.request.name = v.into();
13083 self
13084 }
13085 }
13086
13087 #[doc(hidden)]
13088 impl crate::RequestBuilder for GetOperation {
13089 fn request_options(&mut self) -> &mut crate::RequestOptions {
13090 &mut self.0.options
13091 }
13092 }
13093
13094 #[derive(Clone, Debug)]
13111 pub struct CancelOperation(
13112 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13113 );
13114
13115 impl CancelOperation {
13116 pub(crate) fn new(
13117 stub: std::sync::Arc<dyn super::super::stub::dynamic::Environments>,
13118 ) -> Self {
13119 Self(RequestBuilder::new(stub))
13120 }
13121
13122 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13124 mut self,
13125 v: V,
13126 ) -> Self {
13127 self.0.request = v.into();
13128 self
13129 }
13130
13131 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13133 self.0.options = v.into();
13134 self
13135 }
13136
13137 pub async fn send(self) -> Result<()> {
13139 (*self.0.stub)
13140 .cancel_operation(self.0.request, self.0.options)
13141 .await
13142 .map(crate::Response::into_body)
13143 }
13144
13145 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13147 self.0.request.name = v.into();
13148 self
13149 }
13150 }
13151
13152 #[doc(hidden)]
13153 impl crate::RequestBuilder for CancelOperation {
13154 fn request_options(&mut self) -> &mut crate::RequestOptions {
13155 &mut self.0.options
13156 }
13157 }
13158}
13159
13160#[cfg(feature = "fulfillments")]
13162#[cfg_attr(docsrs, doc(cfg(feature = "fulfillments")))]
13163pub mod fulfillments {
13164 use crate::Result;
13165
13166 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13180
13181 pub(crate) mod client {
13182 use super::super::super::client::Fulfillments;
13183 pub struct Factory;
13184 impl crate::ClientFactory for Factory {
13185 type Client = Fulfillments;
13186 type Credentials = gaxi::options::Credentials;
13187 async fn build(
13188 self,
13189 config: gaxi::options::ClientConfig,
13190 ) -> crate::ClientBuilderResult<Self::Client> {
13191 Self::Client::new(config).await
13192 }
13193 }
13194 }
13195
13196 #[derive(Clone, Debug)]
13198 pub(crate) struct RequestBuilder<R: std::default::Default> {
13199 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13200 request: R,
13201 options: crate::RequestOptions,
13202 }
13203
13204 impl<R> RequestBuilder<R>
13205 where
13206 R: std::default::Default,
13207 {
13208 pub(crate) fn new(
13209 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13210 ) -> Self {
13211 Self {
13212 stub,
13213 request: R::default(),
13214 options: crate::RequestOptions::default(),
13215 }
13216 }
13217 }
13218
13219 #[derive(Clone, Debug)]
13236 pub struct GetFulfillment(RequestBuilder<crate::model::GetFulfillmentRequest>);
13237
13238 impl GetFulfillment {
13239 pub(crate) fn new(
13240 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13241 ) -> Self {
13242 Self(RequestBuilder::new(stub))
13243 }
13244
13245 pub fn with_request<V: Into<crate::model::GetFulfillmentRequest>>(mut self, v: V) -> Self {
13247 self.0.request = v.into();
13248 self
13249 }
13250
13251 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13253 self.0.options = v.into();
13254 self
13255 }
13256
13257 pub async fn send(self) -> Result<crate::model::Fulfillment> {
13259 (*self.0.stub)
13260 .get_fulfillment(self.0.request, self.0.options)
13261 .await
13262 .map(crate::Response::into_body)
13263 }
13264
13265 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13269 self.0.request.name = v.into();
13270 self
13271 }
13272 }
13273
13274 #[doc(hidden)]
13275 impl crate::RequestBuilder for GetFulfillment {
13276 fn request_options(&mut self) -> &mut crate::RequestOptions {
13277 &mut self.0.options
13278 }
13279 }
13280
13281 #[derive(Clone, Debug)]
13298 pub struct UpdateFulfillment(RequestBuilder<crate::model::UpdateFulfillmentRequest>);
13299
13300 impl UpdateFulfillment {
13301 pub(crate) fn new(
13302 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13303 ) -> Self {
13304 Self(RequestBuilder::new(stub))
13305 }
13306
13307 pub fn with_request<V: Into<crate::model::UpdateFulfillmentRequest>>(
13309 mut self,
13310 v: V,
13311 ) -> Self {
13312 self.0.request = v.into();
13313 self
13314 }
13315
13316 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13318 self.0.options = v.into();
13319 self
13320 }
13321
13322 pub async fn send(self) -> Result<crate::model::Fulfillment> {
13324 (*self.0.stub)
13325 .update_fulfillment(self.0.request, self.0.options)
13326 .await
13327 .map(crate::Response::into_body)
13328 }
13329
13330 pub fn set_fulfillment<T>(mut self, v: T) -> Self
13334 where
13335 T: std::convert::Into<crate::model::Fulfillment>,
13336 {
13337 self.0.request.fulfillment = std::option::Option::Some(v.into());
13338 self
13339 }
13340
13341 pub fn set_or_clear_fulfillment<T>(mut self, v: std::option::Option<T>) -> Self
13345 where
13346 T: std::convert::Into<crate::model::Fulfillment>,
13347 {
13348 self.0.request.fulfillment = v.map(|x| x.into());
13349 self
13350 }
13351
13352 pub fn set_update_mask<T>(mut self, v: T) -> Self
13356 where
13357 T: std::convert::Into<wkt::FieldMask>,
13358 {
13359 self.0.request.update_mask = std::option::Option::Some(v.into());
13360 self
13361 }
13362
13363 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13367 where
13368 T: std::convert::Into<wkt::FieldMask>,
13369 {
13370 self.0.request.update_mask = v.map(|x| x.into());
13371 self
13372 }
13373 }
13374
13375 #[doc(hidden)]
13376 impl crate::RequestBuilder for UpdateFulfillment {
13377 fn request_options(&mut self) -> &mut crate::RequestOptions {
13378 &mut self.0.options
13379 }
13380 }
13381
13382 #[derive(Clone, Debug)]
13403 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
13404
13405 impl ListLocations {
13406 pub(crate) fn new(
13407 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13408 ) -> Self {
13409 Self(RequestBuilder::new(stub))
13410 }
13411
13412 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
13414 mut self,
13415 v: V,
13416 ) -> Self {
13417 self.0.request = v.into();
13418 self
13419 }
13420
13421 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13423 self.0.options = v.into();
13424 self
13425 }
13426
13427 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
13429 (*self.0.stub)
13430 .list_locations(self.0.request, self.0.options)
13431 .await
13432 .map(crate::Response::into_body)
13433 }
13434
13435 pub fn by_page(
13437 self,
13438 ) -> impl google_cloud_gax::paginator::Paginator<
13439 google_cloud_location::model::ListLocationsResponse,
13440 crate::Error,
13441 > {
13442 use std::clone::Clone;
13443 let token = self.0.request.page_token.clone();
13444 let execute = move |token: String| {
13445 let mut builder = self.clone();
13446 builder.0.request = builder.0.request.set_page_token(token);
13447 builder.send()
13448 };
13449 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13450 }
13451
13452 pub fn by_item(
13454 self,
13455 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13456 google_cloud_location::model::ListLocationsResponse,
13457 crate::Error,
13458 > {
13459 use google_cloud_gax::paginator::Paginator;
13460 self.by_page().items()
13461 }
13462
13463 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13465 self.0.request.name = v.into();
13466 self
13467 }
13468
13469 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13471 self.0.request.filter = v.into();
13472 self
13473 }
13474
13475 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13477 self.0.request.page_size = v.into();
13478 self
13479 }
13480
13481 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13483 self.0.request.page_token = v.into();
13484 self
13485 }
13486 }
13487
13488 #[doc(hidden)]
13489 impl crate::RequestBuilder for ListLocations {
13490 fn request_options(&mut self) -> &mut crate::RequestOptions {
13491 &mut self.0.options
13492 }
13493 }
13494
13495 #[derive(Clone, Debug)]
13512 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
13513
13514 impl GetLocation {
13515 pub(crate) fn new(
13516 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13517 ) -> Self {
13518 Self(RequestBuilder::new(stub))
13519 }
13520
13521 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
13523 mut self,
13524 v: V,
13525 ) -> Self {
13526 self.0.request = v.into();
13527 self
13528 }
13529
13530 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13532 self.0.options = v.into();
13533 self
13534 }
13535
13536 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
13538 (*self.0.stub)
13539 .get_location(self.0.request, self.0.options)
13540 .await
13541 .map(crate::Response::into_body)
13542 }
13543
13544 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13546 self.0.request.name = v.into();
13547 self
13548 }
13549 }
13550
13551 #[doc(hidden)]
13552 impl crate::RequestBuilder for GetLocation {
13553 fn request_options(&mut self) -> &mut crate::RequestOptions {
13554 &mut self.0.options
13555 }
13556 }
13557
13558 #[derive(Clone, Debug)]
13579 pub struct ListOperations(
13580 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
13581 );
13582
13583 impl ListOperations {
13584 pub(crate) fn new(
13585 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13586 ) -> Self {
13587 Self(RequestBuilder::new(stub))
13588 }
13589
13590 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
13592 mut self,
13593 v: V,
13594 ) -> Self {
13595 self.0.request = v.into();
13596 self
13597 }
13598
13599 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13601 self.0.options = v.into();
13602 self
13603 }
13604
13605 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
13607 (*self.0.stub)
13608 .list_operations(self.0.request, self.0.options)
13609 .await
13610 .map(crate::Response::into_body)
13611 }
13612
13613 pub fn by_page(
13615 self,
13616 ) -> impl google_cloud_gax::paginator::Paginator<
13617 google_cloud_longrunning::model::ListOperationsResponse,
13618 crate::Error,
13619 > {
13620 use std::clone::Clone;
13621 let token = self.0.request.page_token.clone();
13622 let execute = move |token: String| {
13623 let mut builder = self.clone();
13624 builder.0.request = builder.0.request.set_page_token(token);
13625 builder.send()
13626 };
13627 google_cloud_gax::paginator::internal::new_paginator(token, execute)
13628 }
13629
13630 pub fn by_item(
13632 self,
13633 ) -> impl google_cloud_gax::paginator::ItemPaginator<
13634 google_cloud_longrunning::model::ListOperationsResponse,
13635 crate::Error,
13636 > {
13637 use google_cloud_gax::paginator::Paginator;
13638 self.by_page().items()
13639 }
13640
13641 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13643 self.0.request.name = v.into();
13644 self
13645 }
13646
13647 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
13649 self.0.request.filter = v.into();
13650 self
13651 }
13652
13653 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
13655 self.0.request.page_size = v.into();
13656 self
13657 }
13658
13659 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
13661 self.0.request.page_token = v.into();
13662 self
13663 }
13664
13665 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
13667 self.0.request.return_partial_success = v.into();
13668 self
13669 }
13670 }
13671
13672 #[doc(hidden)]
13673 impl crate::RequestBuilder for ListOperations {
13674 fn request_options(&mut self) -> &mut crate::RequestOptions {
13675 &mut self.0.options
13676 }
13677 }
13678
13679 #[derive(Clone, Debug)]
13696 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
13697
13698 impl GetOperation {
13699 pub(crate) fn new(
13700 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13701 ) -> Self {
13702 Self(RequestBuilder::new(stub))
13703 }
13704
13705 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
13707 mut self,
13708 v: V,
13709 ) -> Self {
13710 self.0.request = v.into();
13711 self
13712 }
13713
13714 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13716 self.0.options = v.into();
13717 self
13718 }
13719
13720 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
13722 (*self.0.stub)
13723 .get_operation(self.0.request, self.0.options)
13724 .await
13725 .map(crate::Response::into_body)
13726 }
13727
13728 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13730 self.0.request.name = v.into();
13731 self
13732 }
13733 }
13734
13735 #[doc(hidden)]
13736 impl crate::RequestBuilder for GetOperation {
13737 fn request_options(&mut self) -> &mut crate::RequestOptions {
13738 &mut self.0.options
13739 }
13740 }
13741
13742 #[derive(Clone, Debug)]
13759 pub struct CancelOperation(
13760 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
13761 );
13762
13763 impl CancelOperation {
13764 pub(crate) fn new(
13765 stub: std::sync::Arc<dyn super::super::stub::dynamic::Fulfillments>,
13766 ) -> Self {
13767 Self(RequestBuilder::new(stub))
13768 }
13769
13770 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
13772 mut self,
13773 v: V,
13774 ) -> Self {
13775 self.0.request = v.into();
13776 self
13777 }
13778
13779 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13781 self.0.options = v.into();
13782 self
13783 }
13784
13785 pub async fn send(self) -> Result<()> {
13787 (*self.0.stub)
13788 .cancel_operation(self.0.request, self.0.options)
13789 .await
13790 .map(crate::Response::into_body)
13791 }
13792
13793 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
13795 self.0.request.name = v.into();
13796 self
13797 }
13798 }
13799
13800 #[doc(hidden)]
13801 impl crate::RequestBuilder for CancelOperation {
13802 fn request_options(&mut self) -> &mut crate::RequestOptions {
13803 &mut self.0.options
13804 }
13805 }
13806}
13807
13808#[cfg(feature = "generators")]
13810#[cfg_attr(docsrs, doc(cfg(feature = "generators")))]
13811pub mod generators {
13812 use crate::Result;
13813
13814 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
13828
13829 pub(crate) mod client {
13830 use super::super::super::client::Generators;
13831 pub struct Factory;
13832 impl crate::ClientFactory for Factory {
13833 type Client = Generators;
13834 type Credentials = gaxi::options::Credentials;
13835 async fn build(
13836 self,
13837 config: gaxi::options::ClientConfig,
13838 ) -> crate::ClientBuilderResult<Self::Client> {
13839 Self::Client::new(config).await
13840 }
13841 }
13842 }
13843
13844 #[derive(Clone, Debug)]
13846 pub(crate) struct RequestBuilder<R: std::default::Default> {
13847 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13848 request: R,
13849 options: crate::RequestOptions,
13850 }
13851
13852 impl<R> RequestBuilder<R>
13853 where
13854 R: std::default::Default,
13855 {
13856 pub(crate) fn new(
13857 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13858 ) -> Self {
13859 Self {
13860 stub,
13861 request: R::default(),
13862 options: crate::RequestOptions::default(),
13863 }
13864 }
13865 }
13866
13867 #[derive(Clone, Debug)]
13884 pub struct CreateGenerator(RequestBuilder<crate::model::CreateGeneratorRequest>);
13885
13886 impl CreateGenerator {
13887 pub(crate) fn new(
13888 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13889 ) -> Self {
13890 Self(RequestBuilder::new(stub))
13891 }
13892
13893 pub fn with_request<V: Into<crate::model::CreateGeneratorRequest>>(mut self, v: V) -> Self {
13895 self.0.request = v.into();
13896 self
13897 }
13898
13899 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13901 self.0.options = v.into();
13902 self
13903 }
13904
13905 pub async fn send(self) -> Result<crate::model::Generator> {
13907 (*self.0.stub)
13908 .create_generator(self.0.request, self.0.options)
13909 .await
13910 .map(crate::Response::into_body)
13911 }
13912
13913 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
13917 self.0.request.parent = v.into();
13918 self
13919 }
13920
13921 pub fn set_generator<T>(mut self, v: T) -> Self
13925 where
13926 T: std::convert::Into<crate::model::Generator>,
13927 {
13928 self.0.request.generator = std::option::Option::Some(v.into());
13929 self
13930 }
13931
13932 pub fn set_or_clear_generator<T>(mut self, v: std::option::Option<T>) -> Self
13936 where
13937 T: std::convert::Into<crate::model::Generator>,
13938 {
13939 self.0.request.generator = v.map(|x| x.into());
13940 self
13941 }
13942
13943 pub fn set_generator_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
13945 self.0.request.generator_id = v.into();
13946 self
13947 }
13948 }
13949
13950 #[doc(hidden)]
13951 impl crate::RequestBuilder for CreateGenerator {
13952 fn request_options(&mut self) -> &mut crate::RequestOptions {
13953 &mut self.0.options
13954 }
13955 }
13956
13957 #[derive(Clone, Debug)]
13974 pub struct GetGenerator(RequestBuilder<crate::model::GetGeneratorRequest>);
13975
13976 impl GetGenerator {
13977 pub(crate) fn new(
13978 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
13979 ) -> Self {
13980 Self(RequestBuilder::new(stub))
13981 }
13982
13983 pub fn with_request<V: Into<crate::model::GetGeneratorRequest>>(mut self, v: V) -> Self {
13985 self.0.request = v.into();
13986 self
13987 }
13988
13989 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
13991 self.0.options = v.into();
13992 self
13993 }
13994
13995 pub async fn send(self) -> Result<crate::model::Generator> {
13997 (*self.0.stub)
13998 .get_generator(self.0.request, self.0.options)
13999 .await
14000 .map(crate::Response::into_body)
14001 }
14002
14003 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14007 self.0.request.name = v.into();
14008 self
14009 }
14010 }
14011
14012 #[doc(hidden)]
14013 impl crate::RequestBuilder for GetGenerator {
14014 fn request_options(&mut self) -> &mut crate::RequestOptions {
14015 &mut self.0.options
14016 }
14017 }
14018
14019 #[derive(Clone, Debug)]
14040 pub struct ListGenerators(RequestBuilder<crate::model::ListGeneratorsRequest>);
14041
14042 impl ListGenerators {
14043 pub(crate) fn new(
14044 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14045 ) -> Self {
14046 Self(RequestBuilder::new(stub))
14047 }
14048
14049 pub fn with_request<V: Into<crate::model::ListGeneratorsRequest>>(mut self, v: V) -> Self {
14051 self.0.request = v.into();
14052 self
14053 }
14054
14055 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14057 self.0.options = v.into();
14058 self
14059 }
14060
14061 pub async fn send(self) -> Result<crate::model::ListGeneratorsResponse> {
14063 (*self.0.stub)
14064 .list_generators(self.0.request, self.0.options)
14065 .await
14066 .map(crate::Response::into_body)
14067 }
14068
14069 pub fn by_page(
14071 self,
14072 ) -> impl google_cloud_gax::paginator::Paginator<
14073 crate::model::ListGeneratorsResponse,
14074 crate::Error,
14075 > {
14076 use std::clone::Clone;
14077 let token = self.0.request.page_token.clone();
14078 let execute = move |token: String| {
14079 let mut builder = self.clone();
14080 builder.0.request = builder.0.request.set_page_token(token);
14081 builder.send()
14082 };
14083 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14084 }
14085
14086 pub fn by_item(
14088 self,
14089 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14090 crate::model::ListGeneratorsResponse,
14091 crate::Error,
14092 > {
14093 use google_cloud_gax::paginator::Paginator;
14094 self.by_page().items()
14095 }
14096
14097 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14101 self.0.request.parent = v.into();
14102 self
14103 }
14104
14105 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14107 self.0.request.page_size = v.into();
14108 self
14109 }
14110
14111 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14113 self.0.request.page_token = v.into();
14114 self
14115 }
14116 }
14117
14118 #[doc(hidden)]
14119 impl crate::RequestBuilder for ListGenerators {
14120 fn request_options(&mut self) -> &mut crate::RequestOptions {
14121 &mut self.0.options
14122 }
14123 }
14124
14125 #[derive(Clone, Debug)]
14142 pub struct DeleteGenerator(RequestBuilder<crate::model::DeleteGeneratorRequest>);
14143
14144 impl DeleteGenerator {
14145 pub(crate) fn new(
14146 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14147 ) -> Self {
14148 Self(RequestBuilder::new(stub))
14149 }
14150
14151 pub fn with_request<V: Into<crate::model::DeleteGeneratorRequest>>(mut self, v: V) -> Self {
14153 self.0.request = v.into();
14154 self
14155 }
14156
14157 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14159 self.0.options = v.into();
14160 self
14161 }
14162
14163 pub async fn send(self) -> Result<()> {
14165 (*self.0.stub)
14166 .delete_generator(self.0.request, self.0.options)
14167 .await
14168 .map(crate::Response::into_body)
14169 }
14170
14171 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14175 self.0.request.name = v.into();
14176 self
14177 }
14178 }
14179
14180 #[doc(hidden)]
14181 impl crate::RequestBuilder for DeleteGenerator {
14182 fn request_options(&mut self) -> &mut crate::RequestOptions {
14183 &mut self.0.options
14184 }
14185 }
14186
14187 #[derive(Clone, Debug)]
14204 pub struct UpdateGenerator(RequestBuilder<crate::model::UpdateGeneratorRequest>);
14205
14206 impl UpdateGenerator {
14207 pub(crate) fn new(
14208 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14209 ) -> Self {
14210 Self(RequestBuilder::new(stub))
14211 }
14212
14213 pub fn with_request<V: Into<crate::model::UpdateGeneratorRequest>>(mut self, v: V) -> Self {
14215 self.0.request = v.into();
14216 self
14217 }
14218
14219 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14221 self.0.options = v.into();
14222 self
14223 }
14224
14225 pub async fn send(self) -> Result<crate::model::Generator> {
14227 (*self.0.stub)
14228 .update_generator(self.0.request, self.0.options)
14229 .await
14230 .map(crate::Response::into_body)
14231 }
14232
14233 pub fn set_generator<T>(mut self, v: T) -> Self
14237 where
14238 T: std::convert::Into<crate::model::Generator>,
14239 {
14240 self.0.request.generator = std::option::Option::Some(v.into());
14241 self
14242 }
14243
14244 pub fn set_or_clear_generator<T>(mut self, v: std::option::Option<T>) -> Self
14248 where
14249 T: std::convert::Into<crate::model::Generator>,
14250 {
14251 self.0.request.generator = v.map(|x| x.into());
14252 self
14253 }
14254
14255 pub fn set_update_mask<T>(mut self, v: T) -> Self
14257 where
14258 T: std::convert::Into<wkt::FieldMask>,
14259 {
14260 self.0.request.update_mask = std::option::Option::Some(v.into());
14261 self
14262 }
14263
14264 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14266 where
14267 T: std::convert::Into<wkt::FieldMask>,
14268 {
14269 self.0.request.update_mask = v.map(|x| x.into());
14270 self
14271 }
14272 }
14273
14274 #[doc(hidden)]
14275 impl crate::RequestBuilder for UpdateGenerator {
14276 fn request_options(&mut self) -> &mut crate::RequestOptions {
14277 &mut self.0.options
14278 }
14279 }
14280
14281 #[derive(Clone, Debug)]
14302 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
14303
14304 impl ListLocations {
14305 pub(crate) fn new(
14306 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14307 ) -> Self {
14308 Self(RequestBuilder::new(stub))
14309 }
14310
14311 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
14313 mut self,
14314 v: V,
14315 ) -> Self {
14316 self.0.request = v.into();
14317 self
14318 }
14319
14320 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14322 self.0.options = v.into();
14323 self
14324 }
14325
14326 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
14328 (*self.0.stub)
14329 .list_locations(self.0.request, self.0.options)
14330 .await
14331 .map(crate::Response::into_body)
14332 }
14333
14334 pub fn by_page(
14336 self,
14337 ) -> impl google_cloud_gax::paginator::Paginator<
14338 google_cloud_location::model::ListLocationsResponse,
14339 crate::Error,
14340 > {
14341 use std::clone::Clone;
14342 let token = self.0.request.page_token.clone();
14343 let execute = move |token: String| {
14344 let mut builder = self.clone();
14345 builder.0.request = builder.0.request.set_page_token(token);
14346 builder.send()
14347 };
14348 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14349 }
14350
14351 pub fn by_item(
14353 self,
14354 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14355 google_cloud_location::model::ListLocationsResponse,
14356 crate::Error,
14357 > {
14358 use google_cloud_gax::paginator::Paginator;
14359 self.by_page().items()
14360 }
14361
14362 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14364 self.0.request.name = v.into();
14365 self
14366 }
14367
14368 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14370 self.0.request.filter = v.into();
14371 self
14372 }
14373
14374 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14376 self.0.request.page_size = v.into();
14377 self
14378 }
14379
14380 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14382 self.0.request.page_token = v.into();
14383 self
14384 }
14385 }
14386
14387 #[doc(hidden)]
14388 impl crate::RequestBuilder for ListLocations {
14389 fn request_options(&mut self) -> &mut crate::RequestOptions {
14390 &mut self.0.options
14391 }
14392 }
14393
14394 #[derive(Clone, Debug)]
14411 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
14412
14413 impl GetLocation {
14414 pub(crate) fn new(
14415 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14416 ) -> Self {
14417 Self(RequestBuilder::new(stub))
14418 }
14419
14420 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
14422 mut self,
14423 v: V,
14424 ) -> Self {
14425 self.0.request = v.into();
14426 self
14427 }
14428
14429 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14431 self.0.options = v.into();
14432 self
14433 }
14434
14435 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
14437 (*self.0.stub)
14438 .get_location(self.0.request, self.0.options)
14439 .await
14440 .map(crate::Response::into_body)
14441 }
14442
14443 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14445 self.0.request.name = v.into();
14446 self
14447 }
14448 }
14449
14450 #[doc(hidden)]
14451 impl crate::RequestBuilder for GetLocation {
14452 fn request_options(&mut self) -> &mut crate::RequestOptions {
14453 &mut self.0.options
14454 }
14455 }
14456
14457 #[derive(Clone, Debug)]
14478 pub struct ListOperations(
14479 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
14480 );
14481
14482 impl ListOperations {
14483 pub(crate) fn new(
14484 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14485 ) -> Self {
14486 Self(RequestBuilder::new(stub))
14487 }
14488
14489 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
14491 mut self,
14492 v: V,
14493 ) -> Self {
14494 self.0.request = v.into();
14495 self
14496 }
14497
14498 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14500 self.0.options = v.into();
14501 self
14502 }
14503
14504 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
14506 (*self.0.stub)
14507 .list_operations(self.0.request, self.0.options)
14508 .await
14509 .map(crate::Response::into_body)
14510 }
14511
14512 pub fn by_page(
14514 self,
14515 ) -> impl google_cloud_gax::paginator::Paginator<
14516 google_cloud_longrunning::model::ListOperationsResponse,
14517 crate::Error,
14518 > {
14519 use std::clone::Clone;
14520 let token = self.0.request.page_token.clone();
14521 let execute = move |token: String| {
14522 let mut builder = self.clone();
14523 builder.0.request = builder.0.request.set_page_token(token);
14524 builder.send()
14525 };
14526 google_cloud_gax::paginator::internal::new_paginator(token, execute)
14527 }
14528
14529 pub fn by_item(
14531 self,
14532 ) -> impl google_cloud_gax::paginator::ItemPaginator<
14533 google_cloud_longrunning::model::ListOperationsResponse,
14534 crate::Error,
14535 > {
14536 use google_cloud_gax::paginator::Paginator;
14537 self.by_page().items()
14538 }
14539
14540 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14542 self.0.request.name = v.into();
14543 self
14544 }
14545
14546 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
14548 self.0.request.filter = v.into();
14549 self
14550 }
14551
14552 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
14554 self.0.request.page_size = v.into();
14555 self
14556 }
14557
14558 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
14560 self.0.request.page_token = v.into();
14561 self
14562 }
14563
14564 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
14566 self.0.request.return_partial_success = v.into();
14567 self
14568 }
14569 }
14570
14571 #[doc(hidden)]
14572 impl crate::RequestBuilder for ListOperations {
14573 fn request_options(&mut self) -> &mut crate::RequestOptions {
14574 &mut self.0.options
14575 }
14576 }
14577
14578 #[derive(Clone, Debug)]
14595 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
14596
14597 impl GetOperation {
14598 pub(crate) fn new(
14599 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14600 ) -> Self {
14601 Self(RequestBuilder::new(stub))
14602 }
14603
14604 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
14606 mut self,
14607 v: V,
14608 ) -> Self {
14609 self.0.request = v.into();
14610 self
14611 }
14612
14613 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14615 self.0.options = v.into();
14616 self
14617 }
14618
14619 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14621 (*self.0.stub)
14622 .get_operation(self.0.request, self.0.options)
14623 .await
14624 .map(crate::Response::into_body)
14625 }
14626
14627 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14629 self.0.request.name = v.into();
14630 self
14631 }
14632 }
14633
14634 #[doc(hidden)]
14635 impl crate::RequestBuilder for GetOperation {
14636 fn request_options(&mut self) -> &mut crate::RequestOptions {
14637 &mut self.0.options
14638 }
14639 }
14640
14641 #[derive(Clone, Debug)]
14658 pub struct CancelOperation(
14659 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
14660 );
14661
14662 impl CancelOperation {
14663 pub(crate) fn new(
14664 stub: std::sync::Arc<dyn super::super::stub::dynamic::Generators>,
14665 ) -> Self {
14666 Self(RequestBuilder::new(stub))
14667 }
14668
14669 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
14671 mut self,
14672 v: V,
14673 ) -> Self {
14674 self.0.request = v.into();
14675 self
14676 }
14677
14678 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14680 self.0.options = v.into();
14681 self
14682 }
14683
14684 pub async fn send(self) -> Result<()> {
14686 (*self.0.stub)
14687 .cancel_operation(self.0.request, self.0.options)
14688 .await
14689 .map(crate::Response::into_body)
14690 }
14691
14692 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14694 self.0.request.name = v.into();
14695 self
14696 }
14697 }
14698
14699 #[doc(hidden)]
14700 impl crate::RequestBuilder for CancelOperation {
14701 fn request_options(&mut self) -> &mut crate::RequestOptions {
14702 &mut self.0.options
14703 }
14704 }
14705}
14706
14707#[cfg(feature = "generator-evaluations")]
14709#[cfg_attr(docsrs, doc(cfg(feature = "generator-evaluations")))]
14710pub mod generator_evaluations {
14711 use crate::Result;
14712
14713 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
14727
14728 pub(crate) mod client {
14729 use super::super::super::client::GeneratorEvaluations;
14730 pub struct Factory;
14731 impl crate::ClientFactory for Factory {
14732 type Client = GeneratorEvaluations;
14733 type Credentials = gaxi::options::Credentials;
14734 async fn build(
14735 self,
14736 config: gaxi::options::ClientConfig,
14737 ) -> crate::ClientBuilderResult<Self::Client> {
14738 Self::Client::new(config).await
14739 }
14740 }
14741 }
14742
14743 #[derive(Clone, Debug)]
14745 pub(crate) struct RequestBuilder<R: std::default::Default> {
14746 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14747 request: R,
14748 options: crate::RequestOptions,
14749 }
14750
14751 impl<R> RequestBuilder<R>
14752 where
14753 R: std::default::Default,
14754 {
14755 pub(crate) fn new(
14756 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14757 ) -> Self {
14758 Self {
14759 stub,
14760 request: R::default(),
14761 options: crate::RequestOptions::default(),
14762 }
14763 }
14764 }
14765
14766 #[derive(Clone, Debug)]
14784 pub struct CreateGeneratorEvaluation(
14785 RequestBuilder<crate::model::CreateGeneratorEvaluationRequest>,
14786 );
14787
14788 impl CreateGeneratorEvaluation {
14789 pub(crate) fn new(
14790 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14791 ) -> Self {
14792 Self(RequestBuilder::new(stub))
14793 }
14794
14795 pub fn with_request<V: Into<crate::model::CreateGeneratorEvaluationRequest>>(
14797 mut self,
14798 v: V,
14799 ) -> Self {
14800 self.0.request = v.into();
14801 self
14802 }
14803
14804 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14806 self.0.options = v.into();
14807 self
14808 }
14809
14810 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
14817 (*self.0.stub)
14818 .create_generator_evaluation(self.0.request, self.0.options)
14819 .await
14820 .map(crate::Response::into_body)
14821 }
14822
14823 pub fn poller(
14825 self,
14826 ) -> impl google_cloud_lro::Poller<
14827 crate::model::GeneratorEvaluation,
14828 crate::model::GeneratorEvaluationOperationMetadata,
14829 > {
14830 type Operation = google_cloud_lro::internal::Operation<
14831 crate::model::GeneratorEvaluation,
14832 crate::model::GeneratorEvaluationOperationMetadata,
14833 >;
14834 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
14835 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
14836
14837 let stub = self.0.stub.clone();
14838 let mut options = self.0.options.clone();
14839 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
14840 let query = move |name| {
14841 let stub = stub.clone();
14842 let options = options.clone();
14843 async {
14844 let op = GetOperation::new(stub)
14845 .set_name(name)
14846 .with_options(options)
14847 .send()
14848 .await?;
14849 Ok(Operation::new(op))
14850 }
14851 };
14852
14853 let start = move || async {
14854 let op = self.send().await?;
14855 Ok(Operation::new(op))
14856 };
14857
14858 google_cloud_lro::internal::new_poller(
14859 polling_error_policy,
14860 polling_backoff_policy,
14861 start,
14862 query,
14863 )
14864 }
14865
14866 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
14870 self.0.request.parent = v.into();
14871 self
14872 }
14873
14874 pub fn set_generator_evaluation<T>(mut self, v: T) -> Self
14878 where
14879 T: std::convert::Into<crate::model::GeneratorEvaluation>,
14880 {
14881 self.0.request.generator_evaluation = std::option::Option::Some(v.into());
14882 self
14883 }
14884
14885 pub fn set_or_clear_generator_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
14889 where
14890 T: std::convert::Into<crate::model::GeneratorEvaluation>,
14891 {
14892 self.0.request.generator_evaluation = v.map(|x| x.into());
14893 self
14894 }
14895 }
14896
14897 #[doc(hidden)]
14898 impl crate::RequestBuilder for CreateGeneratorEvaluation {
14899 fn request_options(&mut self) -> &mut crate::RequestOptions {
14900 &mut self.0.options
14901 }
14902 }
14903
14904 #[derive(Clone, Debug)]
14921 pub struct GetGeneratorEvaluation(RequestBuilder<crate::model::GetGeneratorEvaluationRequest>);
14922
14923 impl GetGeneratorEvaluation {
14924 pub(crate) fn new(
14925 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14926 ) -> Self {
14927 Self(RequestBuilder::new(stub))
14928 }
14929
14930 pub fn with_request<V: Into<crate::model::GetGeneratorEvaluationRequest>>(
14932 mut self,
14933 v: V,
14934 ) -> Self {
14935 self.0.request = v.into();
14936 self
14937 }
14938
14939 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
14941 self.0.options = v.into();
14942 self
14943 }
14944
14945 pub async fn send(self) -> Result<crate::model::GeneratorEvaluation> {
14947 (*self.0.stub)
14948 .get_generator_evaluation(self.0.request, self.0.options)
14949 .await
14950 .map(crate::Response::into_body)
14951 }
14952
14953 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
14957 self.0.request.name = v.into();
14958 self
14959 }
14960 }
14961
14962 #[doc(hidden)]
14963 impl crate::RequestBuilder for GetGeneratorEvaluation {
14964 fn request_options(&mut self) -> &mut crate::RequestOptions {
14965 &mut self.0.options
14966 }
14967 }
14968
14969 #[derive(Clone, Debug)]
14990 pub struct ListGeneratorEvaluations(
14991 RequestBuilder<crate::model::ListGeneratorEvaluationsRequest>,
14992 );
14993
14994 impl ListGeneratorEvaluations {
14995 pub(crate) fn new(
14996 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
14997 ) -> Self {
14998 Self(RequestBuilder::new(stub))
14999 }
15000
15001 pub fn with_request<V: Into<crate::model::ListGeneratorEvaluationsRequest>>(
15003 mut self,
15004 v: V,
15005 ) -> Self {
15006 self.0.request = v.into();
15007 self
15008 }
15009
15010 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15012 self.0.options = v.into();
15013 self
15014 }
15015
15016 pub async fn send(self) -> Result<crate::model::ListGeneratorEvaluationsResponse> {
15018 (*self.0.stub)
15019 .list_generator_evaluations(self.0.request, self.0.options)
15020 .await
15021 .map(crate::Response::into_body)
15022 }
15023
15024 pub fn by_page(
15026 self,
15027 ) -> impl google_cloud_gax::paginator::Paginator<
15028 crate::model::ListGeneratorEvaluationsResponse,
15029 crate::Error,
15030 > {
15031 use std::clone::Clone;
15032 let token = self.0.request.page_token.clone();
15033 let execute = move |token: String| {
15034 let mut builder = self.clone();
15035 builder.0.request = builder.0.request.set_page_token(token);
15036 builder.send()
15037 };
15038 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15039 }
15040
15041 pub fn by_item(
15043 self,
15044 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15045 crate::model::ListGeneratorEvaluationsResponse,
15046 crate::Error,
15047 > {
15048 use google_cloud_gax::paginator::Paginator;
15049 self.by_page().items()
15050 }
15051
15052 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15056 self.0.request.parent = v.into();
15057 self
15058 }
15059
15060 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15062 self.0.request.page_size = v.into();
15063 self
15064 }
15065
15066 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15068 self.0.request.page_token = v.into();
15069 self
15070 }
15071 }
15072
15073 #[doc(hidden)]
15074 impl crate::RequestBuilder for ListGeneratorEvaluations {
15075 fn request_options(&mut self) -> &mut crate::RequestOptions {
15076 &mut self.0.options
15077 }
15078 }
15079
15080 #[derive(Clone, Debug)]
15097 pub struct DeleteGeneratorEvaluation(
15098 RequestBuilder<crate::model::DeleteGeneratorEvaluationRequest>,
15099 );
15100
15101 impl DeleteGeneratorEvaluation {
15102 pub(crate) fn new(
15103 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15104 ) -> Self {
15105 Self(RequestBuilder::new(stub))
15106 }
15107
15108 pub fn with_request<V: Into<crate::model::DeleteGeneratorEvaluationRequest>>(
15110 mut self,
15111 v: V,
15112 ) -> Self {
15113 self.0.request = v.into();
15114 self
15115 }
15116
15117 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15119 self.0.options = v.into();
15120 self
15121 }
15122
15123 pub async fn send(self) -> Result<()> {
15125 (*self.0.stub)
15126 .delete_generator_evaluation(self.0.request, self.0.options)
15127 .await
15128 .map(crate::Response::into_body)
15129 }
15130
15131 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15135 self.0.request.name = v.into();
15136 self
15137 }
15138 }
15139
15140 #[doc(hidden)]
15141 impl crate::RequestBuilder for DeleteGeneratorEvaluation {
15142 fn request_options(&mut self) -> &mut crate::RequestOptions {
15143 &mut self.0.options
15144 }
15145 }
15146
15147 #[derive(Clone, Debug)]
15168 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
15169
15170 impl ListLocations {
15171 pub(crate) fn new(
15172 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15173 ) -> Self {
15174 Self(RequestBuilder::new(stub))
15175 }
15176
15177 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
15179 mut self,
15180 v: V,
15181 ) -> Self {
15182 self.0.request = v.into();
15183 self
15184 }
15185
15186 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15188 self.0.options = v.into();
15189 self
15190 }
15191
15192 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
15194 (*self.0.stub)
15195 .list_locations(self.0.request, self.0.options)
15196 .await
15197 .map(crate::Response::into_body)
15198 }
15199
15200 pub fn by_page(
15202 self,
15203 ) -> impl google_cloud_gax::paginator::Paginator<
15204 google_cloud_location::model::ListLocationsResponse,
15205 crate::Error,
15206 > {
15207 use std::clone::Clone;
15208 let token = self.0.request.page_token.clone();
15209 let execute = move |token: String| {
15210 let mut builder = self.clone();
15211 builder.0.request = builder.0.request.set_page_token(token);
15212 builder.send()
15213 };
15214 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15215 }
15216
15217 pub fn by_item(
15219 self,
15220 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15221 google_cloud_location::model::ListLocationsResponse,
15222 crate::Error,
15223 > {
15224 use google_cloud_gax::paginator::Paginator;
15225 self.by_page().items()
15226 }
15227
15228 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15230 self.0.request.name = v.into();
15231 self
15232 }
15233
15234 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15236 self.0.request.filter = v.into();
15237 self
15238 }
15239
15240 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15242 self.0.request.page_size = v.into();
15243 self
15244 }
15245
15246 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15248 self.0.request.page_token = v.into();
15249 self
15250 }
15251 }
15252
15253 #[doc(hidden)]
15254 impl crate::RequestBuilder for ListLocations {
15255 fn request_options(&mut self) -> &mut crate::RequestOptions {
15256 &mut self.0.options
15257 }
15258 }
15259
15260 #[derive(Clone, Debug)]
15277 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
15278
15279 impl GetLocation {
15280 pub(crate) fn new(
15281 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15282 ) -> Self {
15283 Self(RequestBuilder::new(stub))
15284 }
15285
15286 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
15288 mut self,
15289 v: V,
15290 ) -> Self {
15291 self.0.request = v.into();
15292 self
15293 }
15294
15295 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15297 self.0.options = v.into();
15298 self
15299 }
15300
15301 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
15303 (*self.0.stub)
15304 .get_location(self.0.request, self.0.options)
15305 .await
15306 .map(crate::Response::into_body)
15307 }
15308
15309 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15311 self.0.request.name = v.into();
15312 self
15313 }
15314 }
15315
15316 #[doc(hidden)]
15317 impl crate::RequestBuilder for GetLocation {
15318 fn request_options(&mut self) -> &mut crate::RequestOptions {
15319 &mut self.0.options
15320 }
15321 }
15322
15323 #[derive(Clone, Debug)]
15344 pub struct ListOperations(
15345 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
15346 );
15347
15348 impl ListOperations {
15349 pub(crate) fn new(
15350 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15351 ) -> Self {
15352 Self(RequestBuilder::new(stub))
15353 }
15354
15355 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
15357 mut self,
15358 v: V,
15359 ) -> Self {
15360 self.0.request = v.into();
15361 self
15362 }
15363
15364 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15366 self.0.options = v.into();
15367 self
15368 }
15369
15370 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
15372 (*self.0.stub)
15373 .list_operations(self.0.request, self.0.options)
15374 .await
15375 .map(crate::Response::into_body)
15376 }
15377
15378 pub fn by_page(
15380 self,
15381 ) -> impl google_cloud_gax::paginator::Paginator<
15382 google_cloud_longrunning::model::ListOperationsResponse,
15383 crate::Error,
15384 > {
15385 use std::clone::Clone;
15386 let token = self.0.request.page_token.clone();
15387 let execute = move |token: String| {
15388 let mut builder = self.clone();
15389 builder.0.request = builder.0.request.set_page_token(token);
15390 builder.send()
15391 };
15392 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15393 }
15394
15395 pub fn by_item(
15397 self,
15398 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15399 google_cloud_longrunning::model::ListOperationsResponse,
15400 crate::Error,
15401 > {
15402 use google_cloud_gax::paginator::Paginator;
15403 self.by_page().items()
15404 }
15405
15406 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15408 self.0.request.name = v.into();
15409 self
15410 }
15411
15412 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
15414 self.0.request.filter = v.into();
15415 self
15416 }
15417
15418 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15420 self.0.request.page_size = v.into();
15421 self
15422 }
15423
15424 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15426 self.0.request.page_token = v.into();
15427 self
15428 }
15429
15430 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
15432 self.0.request.return_partial_success = v.into();
15433 self
15434 }
15435 }
15436
15437 #[doc(hidden)]
15438 impl crate::RequestBuilder for ListOperations {
15439 fn request_options(&mut self) -> &mut crate::RequestOptions {
15440 &mut self.0.options
15441 }
15442 }
15443
15444 #[derive(Clone, Debug)]
15461 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
15462
15463 impl GetOperation {
15464 pub(crate) fn new(
15465 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15466 ) -> Self {
15467 Self(RequestBuilder::new(stub))
15468 }
15469
15470 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
15472 mut self,
15473 v: V,
15474 ) -> Self {
15475 self.0.request = v.into();
15476 self
15477 }
15478
15479 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15481 self.0.options = v.into();
15482 self
15483 }
15484
15485 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
15487 (*self.0.stub)
15488 .get_operation(self.0.request, self.0.options)
15489 .await
15490 .map(crate::Response::into_body)
15491 }
15492
15493 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15495 self.0.request.name = v.into();
15496 self
15497 }
15498 }
15499
15500 #[doc(hidden)]
15501 impl crate::RequestBuilder for GetOperation {
15502 fn request_options(&mut self) -> &mut crate::RequestOptions {
15503 &mut self.0.options
15504 }
15505 }
15506
15507 #[derive(Clone, Debug)]
15524 pub struct CancelOperation(
15525 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
15526 );
15527
15528 impl CancelOperation {
15529 pub(crate) fn new(
15530 stub: std::sync::Arc<dyn super::super::stub::dynamic::GeneratorEvaluations>,
15531 ) -> Self {
15532 Self(RequestBuilder::new(stub))
15533 }
15534
15535 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
15537 mut self,
15538 v: V,
15539 ) -> Self {
15540 self.0.request = v.into();
15541 self
15542 }
15543
15544 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15546 self.0.options = v.into();
15547 self
15548 }
15549
15550 pub async fn send(self) -> Result<()> {
15552 (*self.0.stub)
15553 .cancel_operation(self.0.request, self.0.options)
15554 .await
15555 .map(crate::Response::into_body)
15556 }
15557
15558 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15560 self.0.request.name = v.into();
15561 self
15562 }
15563 }
15564
15565 #[doc(hidden)]
15566 impl crate::RequestBuilder for CancelOperation {
15567 fn request_options(&mut self) -> &mut crate::RequestOptions {
15568 &mut self.0.options
15569 }
15570 }
15571}
15572
15573#[cfg(feature = "intents")]
15575#[cfg_attr(docsrs, doc(cfg(feature = "intents")))]
15576pub mod intents {
15577 use crate::Result;
15578
15579 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
15593
15594 pub(crate) mod client {
15595 use super::super::super::client::Intents;
15596 pub struct Factory;
15597 impl crate::ClientFactory for Factory {
15598 type Client = Intents;
15599 type Credentials = gaxi::options::Credentials;
15600 async fn build(
15601 self,
15602 config: gaxi::options::ClientConfig,
15603 ) -> crate::ClientBuilderResult<Self::Client> {
15604 Self::Client::new(config).await
15605 }
15606 }
15607 }
15608
15609 #[derive(Clone, Debug)]
15611 pub(crate) struct RequestBuilder<R: std::default::Default> {
15612 stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>,
15613 request: R,
15614 options: crate::RequestOptions,
15615 }
15616
15617 impl<R> RequestBuilder<R>
15618 where
15619 R: std::default::Default,
15620 {
15621 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15622 Self {
15623 stub,
15624 request: R::default(),
15625 options: crate::RequestOptions::default(),
15626 }
15627 }
15628 }
15629
15630 #[derive(Clone, Debug)]
15651 pub struct ListIntents(RequestBuilder<crate::model::ListIntentsRequest>);
15652
15653 impl ListIntents {
15654 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15655 Self(RequestBuilder::new(stub))
15656 }
15657
15658 pub fn with_request<V: Into<crate::model::ListIntentsRequest>>(mut self, v: V) -> Self {
15660 self.0.request = v.into();
15661 self
15662 }
15663
15664 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15666 self.0.options = v.into();
15667 self
15668 }
15669
15670 pub async fn send(self) -> Result<crate::model::ListIntentsResponse> {
15672 (*self.0.stub)
15673 .list_intents(self.0.request, self.0.options)
15674 .await
15675 .map(crate::Response::into_body)
15676 }
15677
15678 pub fn by_page(
15680 self,
15681 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListIntentsResponse, crate::Error>
15682 {
15683 use std::clone::Clone;
15684 let token = self.0.request.page_token.clone();
15685 let execute = move |token: String| {
15686 let mut builder = self.clone();
15687 builder.0.request = builder.0.request.set_page_token(token);
15688 builder.send()
15689 };
15690 google_cloud_gax::paginator::internal::new_paginator(token, execute)
15691 }
15692
15693 pub fn by_item(
15695 self,
15696 ) -> impl google_cloud_gax::paginator::ItemPaginator<
15697 crate::model::ListIntentsResponse,
15698 crate::Error,
15699 > {
15700 use google_cloud_gax::paginator::Paginator;
15701 self.by_page().items()
15702 }
15703
15704 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15708 self.0.request.parent = v.into();
15709 self
15710 }
15711
15712 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15714 self.0.request.language_code = v.into();
15715 self
15716 }
15717
15718 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
15720 self.0.request.intent_view = v.into();
15721 self
15722 }
15723
15724 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
15726 self.0.request.page_size = v.into();
15727 self
15728 }
15729
15730 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
15732 self.0.request.page_token = v.into();
15733 self
15734 }
15735 }
15736
15737 #[doc(hidden)]
15738 impl crate::RequestBuilder for ListIntents {
15739 fn request_options(&mut self) -> &mut crate::RequestOptions {
15740 &mut self.0.options
15741 }
15742 }
15743
15744 #[derive(Clone, Debug)]
15761 pub struct GetIntent(RequestBuilder<crate::model::GetIntentRequest>);
15762
15763 impl GetIntent {
15764 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15765 Self(RequestBuilder::new(stub))
15766 }
15767
15768 pub fn with_request<V: Into<crate::model::GetIntentRequest>>(mut self, v: V) -> Self {
15770 self.0.request = v.into();
15771 self
15772 }
15773
15774 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15776 self.0.options = v.into();
15777 self
15778 }
15779
15780 pub async fn send(self) -> Result<crate::model::Intent> {
15782 (*self.0.stub)
15783 .get_intent(self.0.request, self.0.options)
15784 .await
15785 .map(crate::Response::into_body)
15786 }
15787
15788 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
15792 self.0.request.name = v.into();
15793 self
15794 }
15795
15796 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15798 self.0.request.language_code = v.into();
15799 self
15800 }
15801
15802 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
15804 self.0.request.intent_view = v.into();
15805 self
15806 }
15807 }
15808
15809 #[doc(hidden)]
15810 impl crate::RequestBuilder for GetIntent {
15811 fn request_options(&mut self) -> &mut crate::RequestOptions {
15812 &mut self.0.options
15813 }
15814 }
15815
15816 #[derive(Clone, Debug)]
15833 pub struct CreateIntent(RequestBuilder<crate::model::CreateIntentRequest>);
15834
15835 impl CreateIntent {
15836 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15837 Self(RequestBuilder::new(stub))
15838 }
15839
15840 pub fn with_request<V: Into<crate::model::CreateIntentRequest>>(mut self, v: V) -> Self {
15842 self.0.request = v.into();
15843 self
15844 }
15845
15846 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15848 self.0.options = v.into();
15849 self
15850 }
15851
15852 pub async fn send(self) -> Result<crate::model::Intent> {
15854 (*self.0.stub)
15855 .create_intent(self.0.request, self.0.options)
15856 .await
15857 .map(crate::Response::into_body)
15858 }
15859
15860 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
15864 self.0.request.parent = v.into();
15865 self
15866 }
15867
15868 pub fn set_intent<T>(mut self, v: T) -> Self
15872 where
15873 T: std::convert::Into<crate::model::Intent>,
15874 {
15875 self.0.request.intent = std::option::Option::Some(v.into());
15876 self
15877 }
15878
15879 pub fn set_or_clear_intent<T>(mut self, v: std::option::Option<T>) -> Self
15883 where
15884 T: std::convert::Into<crate::model::Intent>,
15885 {
15886 self.0.request.intent = v.map(|x| x.into());
15887 self
15888 }
15889
15890 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15892 self.0.request.language_code = v.into();
15893 self
15894 }
15895
15896 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
15898 self.0.request.intent_view = v.into();
15899 self
15900 }
15901 }
15902
15903 #[doc(hidden)]
15904 impl crate::RequestBuilder for CreateIntent {
15905 fn request_options(&mut self) -> &mut crate::RequestOptions {
15906 &mut self.0.options
15907 }
15908 }
15909
15910 #[derive(Clone, Debug)]
15927 pub struct UpdateIntent(RequestBuilder<crate::model::UpdateIntentRequest>);
15928
15929 impl UpdateIntent {
15930 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
15931 Self(RequestBuilder::new(stub))
15932 }
15933
15934 pub fn with_request<V: Into<crate::model::UpdateIntentRequest>>(mut self, v: V) -> Self {
15936 self.0.request = v.into();
15937 self
15938 }
15939
15940 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
15942 self.0.options = v.into();
15943 self
15944 }
15945
15946 pub async fn send(self) -> Result<crate::model::Intent> {
15948 (*self.0.stub)
15949 .update_intent(self.0.request, self.0.options)
15950 .await
15951 .map(crate::Response::into_body)
15952 }
15953
15954 pub fn set_intent<T>(mut self, v: T) -> Self
15958 where
15959 T: std::convert::Into<crate::model::Intent>,
15960 {
15961 self.0.request.intent = std::option::Option::Some(v.into());
15962 self
15963 }
15964
15965 pub fn set_or_clear_intent<T>(mut self, v: std::option::Option<T>) -> Self
15969 where
15970 T: std::convert::Into<crate::model::Intent>,
15971 {
15972 self.0.request.intent = v.map(|x| x.into());
15973 self
15974 }
15975
15976 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
15978 self.0.request.language_code = v.into();
15979 self
15980 }
15981
15982 pub fn set_update_mask<T>(mut self, v: T) -> Self
15984 where
15985 T: std::convert::Into<wkt::FieldMask>,
15986 {
15987 self.0.request.update_mask = std::option::Option::Some(v.into());
15988 self
15989 }
15990
15991 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
15993 where
15994 T: std::convert::Into<wkt::FieldMask>,
15995 {
15996 self.0.request.update_mask = v.map(|x| x.into());
15997 self
15998 }
15999
16000 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
16002 self.0.request.intent_view = v.into();
16003 self
16004 }
16005 }
16006
16007 #[doc(hidden)]
16008 impl crate::RequestBuilder for UpdateIntent {
16009 fn request_options(&mut self) -> &mut crate::RequestOptions {
16010 &mut self.0.options
16011 }
16012 }
16013
16014 #[derive(Clone, Debug)]
16031 pub struct DeleteIntent(RequestBuilder<crate::model::DeleteIntentRequest>);
16032
16033 impl DeleteIntent {
16034 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16035 Self(RequestBuilder::new(stub))
16036 }
16037
16038 pub fn with_request<V: Into<crate::model::DeleteIntentRequest>>(mut self, v: V) -> Self {
16040 self.0.request = v.into();
16041 self
16042 }
16043
16044 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16046 self.0.options = v.into();
16047 self
16048 }
16049
16050 pub async fn send(self) -> Result<()> {
16052 (*self.0.stub)
16053 .delete_intent(self.0.request, self.0.options)
16054 .await
16055 .map(crate::Response::into_body)
16056 }
16057
16058 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16062 self.0.request.name = v.into();
16063 self
16064 }
16065 }
16066
16067 #[doc(hidden)]
16068 impl crate::RequestBuilder for DeleteIntent {
16069 fn request_options(&mut self) -> &mut crate::RequestOptions {
16070 &mut self.0.options
16071 }
16072 }
16073
16074 #[derive(Clone, Debug)]
16092 pub struct BatchUpdateIntents(RequestBuilder<crate::model::BatchUpdateIntentsRequest>);
16093
16094 impl BatchUpdateIntents {
16095 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16096 Self(RequestBuilder::new(stub))
16097 }
16098
16099 pub fn with_request<V: Into<crate::model::BatchUpdateIntentsRequest>>(
16101 mut self,
16102 v: V,
16103 ) -> Self {
16104 self.0.request = v.into();
16105 self
16106 }
16107
16108 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16110 self.0.options = v.into();
16111 self
16112 }
16113
16114 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16121 (*self.0.stub)
16122 .batch_update_intents(self.0.request, self.0.options)
16123 .await
16124 .map(crate::Response::into_body)
16125 }
16126
16127 pub fn poller(
16129 self,
16130 ) -> impl google_cloud_lro::Poller<crate::model::BatchUpdateIntentsResponse, wkt::Struct>
16131 {
16132 type Operation = google_cloud_lro::internal::Operation<
16133 crate::model::BatchUpdateIntentsResponse,
16134 wkt::Struct,
16135 >;
16136 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16137 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16138
16139 let stub = self.0.stub.clone();
16140 let mut options = self.0.options.clone();
16141 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16142 let query = move |name| {
16143 let stub = stub.clone();
16144 let options = options.clone();
16145 async {
16146 let op = GetOperation::new(stub)
16147 .set_name(name)
16148 .with_options(options)
16149 .send()
16150 .await?;
16151 Ok(Operation::new(op))
16152 }
16153 };
16154
16155 let start = move || async {
16156 let op = self.send().await?;
16157 Ok(Operation::new(op))
16158 };
16159
16160 google_cloud_lro::internal::new_poller(
16161 polling_error_policy,
16162 polling_backoff_policy,
16163 start,
16164 query,
16165 )
16166 }
16167
16168 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16172 self.0.request.parent = v.into();
16173 self
16174 }
16175
16176 pub fn set_language_code<T: Into<std::string::String>>(mut self, v: T) -> Self {
16178 self.0.request.language_code = v.into();
16179 self
16180 }
16181
16182 pub fn set_update_mask<T>(mut self, v: T) -> Self
16184 where
16185 T: std::convert::Into<wkt::FieldMask>,
16186 {
16187 self.0.request.update_mask = std::option::Option::Some(v.into());
16188 self
16189 }
16190
16191 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
16193 where
16194 T: std::convert::Into<wkt::FieldMask>,
16195 {
16196 self.0.request.update_mask = v.map(|x| x.into());
16197 self
16198 }
16199
16200 pub fn set_intent_view<T: Into<crate::model::IntentView>>(mut self, v: T) -> Self {
16202 self.0.request.intent_view = v.into();
16203 self
16204 }
16205
16206 pub fn set_intent_batch<
16211 T: Into<Option<crate::model::batch_update_intents_request::IntentBatch>>,
16212 >(
16213 mut self,
16214 v: T,
16215 ) -> Self {
16216 self.0.request.intent_batch = v.into();
16217 self
16218 }
16219
16220 pub fn set_intent_batch_uri<T: std::convert::Into<std::string::String>>(
16226 mut self,
16227 v: T,
16228 ) -> Self {
16229 self.0.request = self.0.request.set_intent_batch_uri(v);
16230 self
16231 }
16232
16233 pub fn set_intent_batch_inline<
16239 T: std::convert::Into<std::boxed::Box<crate::model::IntentBatch>>,
16240 >(
16241 mut self,
16242 v: T,
16243 ) -> Self {
16244 self.0.request = self.0.request.set_intent_batch_inline(v);
16245 self
16246 }
16247 }
16248
16249 #[doc(hidden)]
16250 impl crate::RequestBuilder for BatchUpdateIntents {
16251 fn request_options(&mut self) -> &mut crate::RequestOptions {
16252 &mut self.0.options
16253 }
16254 }
16255
16256 #[derive(Clone, Debug)]
16274 pub struct BatchDeleteIntents(RequestBuilder<crate::model::BatchDeleteIntentsRequest>);
16275
16276 impl BatchDeleteIntents {
16277 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16278 Self(RequestBuilder::new(stub))
16279 }
16280
16281 pub fn with_request<V: Into<crate::model::BatchDeleteIntentsRequest>>(
16283 mut self,
16284 v: V,
16285 ) -> Self {
16286 self.0.request = v.into();
16287 self
16288 }
16289
16290 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16292 self.0.options = v.into();
16293 self
16294 }
16295
16296 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16303 (*self.0.stub)
16304 .batch_delete_intents(self.0.request, self.0.options)
16305 .await
16306 .map(crate::Response::into_body)
16307 }
16308
16309 pub fn poller(self) -> impl google_cloud_lro::Poller<(), wkt::Struct> {
16311 type Operation = google_cloud_lro::internal::Operation<wkt::Empty, wkt::Struct>;
16312 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
16313 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
16314
16315 let stub = self.0.stub.clone();
16316 let mut options = self.0.options.clone();
16317 options.set_retry_policy(google_cloud_gax::retry_policy::NeverRetry);
16318 let query = move |name| {
16319 let stub = stub.clone();
16320 let options = options.clone();
16321 async {
16322 let op = GetOperation::new(stub)
16323 .set_name(name)
16324 .with_options(options)
16325 .send()
16326 .await?;
16327 Ok(Operation::new(op))
16328 }
16329 };
16330
16331 let start = move || async {
16332 let op = self.send().await?;
16333 Ok(Operation::new(op))
16334 };
16335
16336 google_cloud_lro::internal::new_unit_response_poller(
16337 polling_error_policy,
16338 polling_backoff_policy,
16339 start,
16340 query,
16341 )
16342 }
16343
16344 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16348 self.0.request.parent = v.into();
16349 self
16350 }
16351
16352 pub fn set_intents<T, V>(mut self, v: T) -> Self
16356 where
16357 T: std::iter::IntoIterator<Item = V>,
16358 V: std::convert::Into<crate::model::Intent>,
16359 {
16360 use std::iter::Iterator;
16361 self.0.request.intents = v.into_iter().map(|i| i.into()).collect();
16362 self
16363 }
16364 }
16365
16366 #[doc(hidden)]
16367 impl crate::RequestBuilder for BatchDeleteIntents {
16368 fn request_options(&mut self) -> &mut crate::RequestOptions {
16369 &mut self.0.options
16370 }
16371 }
16372
16373 #[derive(Clone, Debug)]
16394 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
16395
16396 impl ListLocations {
16397 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16398 Self(RequestBuilder::new(stub))
16399 }
16400
16401 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
16403 mut self,
16404 v: V,
16405 ) -> Self {
16406 self.0.request = v.into();
16407 self
16408 }
16409
16410 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16412 self.0.options = v.into();
16413 self
16414 }
16415
16416 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
16418 (*self.0.stub)
16419 .list_locations(self.0.request, self.0.options)
16420 .await
16421 .map(crate::Response::into_body)
16422 }
16423
16424 pub fn by_page(
16426 self,
16427 ) -> impl google_cloud_gax::paginator::Paginator<
16428 google_cloud_location::model::ListLocationsResponse,
16429 crate::Error,
16430 > {
16431 use std::clone::Clone;
16432 let token = self.0.request.page_token.clone();
16433 let execute = move |token: String| {
16434 let mut builder = self.clone();
16435 builder.0.request = builder.0.request.set_page_token(token);
16436 builder.send()
16437 };
16438 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16439 }
16440
16441 pub fn by_item(
16443 self,
16444 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16445 google_cloud_location::model::ListLocationsResponse,
16446 crate::Error,
16447 > {
16448 use google_cloud_gax::paginator::Paginator;
16449 self.by_page().items()
16450 }
16451
16452 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16454 self.0.request.name = v.into();
16455 self
16456 }
16457
16458 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16460 self.0.request.filter = v.into();
16461 self
16462 }
16463
16464 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16466 self.0.request.page_size = v.into();
16467 self
16468 }
16469
16470 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16472 self.0.request.page_token = v.into();
16473 self
16474 }
16475 }
16476
16477 #[doc(hidden)]
16478 impl crate::RequestBuilder for ListLocations {
16479 fn request_options(&mut self) -> &mut crate::RequestOptions {
16480 &mut self.0.options
16481 }
16482 }
16483
16484 #[derive(Clone, Debug)]
16501 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
16502
16503 impl GetLocation {
16504 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16505 Self(RequestBuilder::new(stub))
16506 }
16507
16508 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
16510 mut self,
16511 v: V,
16512 ) -> Self {
16513 self.0.request = v.into();
16514 self
16515 }
16516
16517 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16519 self.0.options = v.into();
16520 self
16521 }
16522
16523 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
16525 (*self.0.stub)
16526 .get_location(self.0.request, self.0.options)
16527 .await
16528 .map(crate::Response::into_body)
16529 }
16530
16531 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16533 self.0.request.name = v.into();
16534 self
16535 }
16536 }
16537
16538 #[doc(hidden)]
16539 impl crate::RequestBuilder for GetLocation {
16540 fn request_options(&mut self) -> &mut crate::RequestOptions {
16541 &mut self.0.options
16542 }
16543 }
16544
16545 #[derive(Clone, Debug)]
16566 pub struct ListOperations(
16567 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
16568 );
16569
16570 impl ListOperations {
16571 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16572 Self(RequestBuilder::new(stub))
16573 }
16574
16575 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
16577 mut self,
16578 v: V,
16579 ) -> Self {
16580 self.0.request = v.into();
16581 self
16582 }
16583
16584 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16586 self.0.options = v.into();
16587 self
16588 }
16589
16590 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
16592 (*self.0.stub)
16593 .list_operations(self.0.request, self.0.options)
16594 .await
16595 .map(crate::Response::into_body)
16596 }
16597
16598 pub fn by_page(
16600 self,
16601 ) -> impl google_cloud_gax::paginator::Paginator<
16602 google_cloud_longrunning::model::ListOperationsResponse,
16603 crate::Error,
16604 > {
16605 use std::clone::Clone;
16606 let token = self.0.request.page_token.clone();
16607 let execute = move |token: String| {
16608 let mut builder = self.clone();
16609 builder.0.request = builder.0.request.set_page_token(token);
16610 builder.send()
16611 };
16612 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16613 }
16614
16615 pub fn by_item(
16617 self,
16618 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16619 google_cloud_longrunning::model::ListOperationsResponse,
16620 crate::Error,
16621 > {
16622 use google_cloud_gax::paginator::Paginator;
16623 self.by_page().items()
16624 }
16625
16626 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16628 self.0.request.name = v.into();
16629 self
16630 }
16631
16632 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16634 self.0.request.filter = v.into();
16635 self
16636 }
16637
16638 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16640 self.0.request.page_size = v.into();
16641 self
16642 }
16643
16644 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16646 self.0.request.page_token = v.into();
16647 self
16648 }
16649
16650 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
16652 self.0.request.return_partial_success = v.into();
16653 self
16654 }
16655 }
16656
16657 #[doc(hidden)]
16658 impl crate::RequestBuilder for ListOperations {
16659 fn request_options(&mut self) -> &mut crate::RequestOptions {
16660 &mut self.0.options
16661 }
16662 }
16663
16664 #[derive(Clone, Debug)]
16681 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
16682
16683 impl GetOperation {
16684 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16685 Self(RequestBuilder::new(stub))
16686 }
16687
16688 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
16690 mut self,
16691 v: V,
16692 ) -> Self {
16693 self.0.request = v.into();
16694 self
16695 }
16696
16697 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16699 self.0.options = v.into();
16700 self
16701 }
16702
16703 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
16705 (*self.0.stub)
16706 .get_operation(self.0.request, self.0.options)
16707 .await
16708 .map(crate::Response::into_body)
16709 }
16710
16711 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16713 self.0.request.name = v.into();
16714 self
16715 }
16716 }
16717
16718 #[doc(hidden)]
16719 impl crate::RequestBuilder for GetOperation {
16720 fn request_options(&mut self) -> &mut crate::RequestOptions {
16721 &mut self.0.options
16722 }
16723 }
16724
16725 #[derive(Clone, Debug)]
16742 pub struct CancelOperation(
16743 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
16744 );
16745
16746 impl CancelOperation {
16747 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Intents>) -> Self {
16748 Self(RequestBuilder::new(stub))
16749 }
16750
16751 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
16753 mut self,
16754 v: V,
16755 ) -> Self {
16756 self.0.request = v.into();
16757 self
16758 }
16759
16760 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16762 self.0.options = v.into();
16763 self
16764 }
16765
16766 pub async fn send(self) -> Result<()> {
16768 (*self.0.stub)
16769 .cancel_operation(self.0.request, self.0.options)
16770 .await
16771 .map(crate::Response::into_body)
16772 }
16773
16774 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
16776 self.0.request.name = v.into();
16777 self
16778 }
16779 }
16780
16781 #[doc(hidden)]
16782 impl crate::RequestBuilder for CancelOperation {
16783 fn request_options(&mut self) -> &mut crate::RequestOptions {
16784 &mut self.0.options
16785 }
16786 }
16787}
16788
16789#[cfg(feature = "knowledge-bases")]
16791#[cfg_attr(docsrs, doc(cfg(feature = "knowledge-bases")))]
16792pub mod knowledge_bases {
16793 use crate::Result;
16794
16795 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
16809
16810 pub(crate) mod client {
16811 use super::super::super::client::KnowledgeBases;
16812 pub struct Factory;
16813 impl crate::ClientFactory for Factory {
16814 type Client = KnowledgeBases;
16815 type Credentials = gaxi::options::Credentials;
16816 async fn build(
16817 self,
16818 config: gaxi::options::ClientConfig,
16819 ) -> crate::ClientBuilderResult<Self::Client> {
16820 Self::Client::new(config).await
16821 }
16822 }
16823 }
16824
16825 #[derive(Clone, Debug)]
16827 pub(crate) struct RequestBuilder<R: std::default::Default> {
16828 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16829 request: R,
16830 options: crate::RequestOptions,
16831 }
16832
16833 impl<R> RequestBuilder<R>
16834 where
16835 R: std::default::Default,
16836 {
16837 pub(crate) fn new(
16838 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16839 ) -> Self {
16840 Self {
16841 stub,
16842 request: R::default(),
16843 options: crate::RequestOptions::default(),
16844 }
16845 }
16846 }
16847
16848 #[derive(Clone, Debug)]
16869 pub struct ListKnowledgeBases(RequestBuilder<crate::model::ListKnowledgeBasesRequest>);
16870
16871 impl ListKnowledgeBases {
16872 pub(crate) fn new(
16873 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16874 ) -> Self {
16875 Self(RequestBuilder::new(stub))
16876 }
16877
16878 pub fn with_request<V: Into<crate::model::ListKnowledgeBasesRequest>>(
16880 mut self,
16881 v: V,
16882 ) -> Self {
16883 self.0.request = v.into();
16884 self
16885 }
16886
16887 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
16889 self.0.options = v.into();
16890 self
16891 }
16892
16893 pub async fn send(self) -> Result<crate::model::ListKnowledgeBasesResponse> {
16895 (*self.0.stub)
16896 .list_knowledge_bases(self.0.request, self.0.options)
16897 .await
16898 .map(crate::Response::into_body)
16899 }
16900
16901 pub fn by_page(
16903 self,
16904 ) -> impl google_cloud_gax::paginator::Paginator<
16905 crate::model::ListKnowledgeBasesResponse,
16906 crate::Error,
16907 > {
16908 use std::clone::Clone;
16909 let token = self.0.request.page_token.clone();
16910 let execute = move |token: String| {
16911 let mut builder = self.clone();
16912 builder.0.request = builder.0.request.set_page_token(token);
16913 builder.send()
16914 };
16915 google_cloud_gax::paginator::internal::new_paginator(token, execute)
16916 }
16917
16918 pub fn by_item(
16920 self,
16921 ) -> impl google_cloud_gax::paginator::ItemPaginator<
16922 crate::model::ListKnowledgeBasesResponse,
16923 crate::Error,
16924 > {
16925 use google_cloud_gax::paginator::Paginator;
16926 self.by_page().items()
16927 }
16928
16929 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
16933 self.0.request.parent = v.into();
16934 self
16935 }
16936
16937 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
16939 self.0.request.page_size = v.into();
16940 self
16941 }
16942
16943 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
16945 self.0.request.page_token = v.into();
16946 self
16947 }
16948
16949 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
16951 self.0.request.filter = v.into();
16952 self
16953 }
16954 }
16955
16956 #[doc(hidden)]
16957 impl crate::RequestBuilder for ListKnowledgeBases {
16958 fn request_options(&mut self) -> &mut crate::RequestOptions {
16959 &mut self.0.options
16960 }
16961 }
16962
16963 #[derive(Clone, Debug)]
16980 pub struct GetKnowledgeBase(RequestBuilder<crate::model::GetKnowledgeBaseRequest>);
16981
16982 impl GetKnowledgeBase {
16983 pub(crate) fn new(
16984 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
16985 ) -> Self {
16986 Self(RequestBuilder::new(stub))
16987 }
16988
16989 pub fn with_request<V: Into<crate::model::GetKnowledgeBaseRequest>>(
16991 mut self,
16992 v: V,
16993 ) -> Self {
16994 self.0.request = v.into();
16995 self
16996 }
16997
16998 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17000 self.0.options = v.into();
17001 self
17002 }
17003
17004 pub async fn send(self) -> Result<crate::model::KnowledgeBase> {
17006 (*self.0.stub)
17007 .get_knowledge_base(self.0.request, self.0.options)
17008 .await
17009 .map(crate::Response::into_body)
17010 }
17011
17012 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17016 self.0.request.name = v.into();
17017 self
17018 }
17019 }
17020
17021 #[doc(hidden)]
17022 impl crate::RequestBuilder for GetKnowledgeBase {
17023 fn request_options(&mut self) -> &mut crate::RequestOptions {
17024 &mut self.0.options
17025 }
17026 }
17027
17028 #[derive(Clone, Debug)]
17045 pub struct CreateKnowledgeBase(RequestBuilder<crate::model::CreateKnowledgeBaseRequest>);
17046
17047 impl CreateKnowledgeBase {
17048 pub(crate) fn new(
17049 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17050 ) -> Self {
17051 Self(RequestBuilder::new(stub))
17052 }
17053
17054 pub fn with_request<V: Into<crate::model::CreateKnowledgeBaseRequest>>(
17056 mut self,
17057 v: V,
17058 ) -> Self {
17059 self.0.request = v.into();
17060 self
17061 }
17062
17063 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17065 self.0.options = v.into();
17066 self
17067 }
17068
17069 pub async fn send(self) -> Result<crate::model::KnowledgeBase> {
17071 (*self.0.stub)
17072 .create_knowledge_base(self.0.request, self.0.options)
17073 .await
17074 .map(crate::Response::into_body)
17075 }
17076
17077 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17081 self.0.request.parent = v.into();
17082 self
17083 }
17084
17085 pub fn set_knowledge_base<T>(mut self, v: T) -> Self
17089 where
17090 T: std::convert::Into<crate::model::KnowledgeBase>,
17091 {
17092 self.0.request.knowledge_base = std::option::Option::Some(v.into());
17093 self
17094 }
17095
17096 pub fn set_or_clear_knowledge_base<T>(mut self, v: std::option::Option<T>) -> Self
17100 where
17101 T: std::convert::Into<crate::model::KnowledgeBase>,
17102 {
17103 self.0.request.knowledge_base = v.map(|x| x.into());
17104 self
17105 }
17106 }
17107
17108 #[doc(hidden)]
17109 impl crate::RequestBuilder for CreateKnowledgeBase {
17110 fn request_options(&mut self) -> &mut crate::RequestOptions {
17111 &mut self.0.options
17112 }
17113 }
17114
17115 #[derive(Clone, Debug)]
17132 pub struct DeleteKnowledgeBase(RequestBuilder<crate::model::DeleteKnowledgeBaseRequest>);
17133
17134 impl DeleteKnowledgeBase {
17135 pub(crate) fn new(
17136 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17137 ) -> Self {
17138 Self(RequestBuilder::new(stub))
17139 }
17140
17141 pub fn with_request<V: Into<crate::model::DeleteKnowledgeBaseRequest>>(
17143 mut self,
17144 v: V,
17145 ) -> Self {
17146 self.0.request = v.into();
17147 self
17148 }
17149
17150 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17152 self.0.options = v.into();
17153 self
17154 }
17155
17156 pub async fn send(self) -> Result<()> {
17158 (*self.0.stub)
17159 .delete_knowledge_base(self.0.request, self.0.options)
17160 .await
17161 .map(crate::Response::into_body)
17162 }
17163
17164 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17168 self.0.request.name = v.into();
17169 self
17170 }
17171
17172 pub fn set_force<T: Into<bool>>(mut self, v: T) -> Self {
17174 self.0.request.force = v.into();
17175 self
17176 }
17177 }
17178
17179 #[doc(hidden)]
17180 impl crate::RequestBuilder for DeleteKnowledgeBase {
17181 fn request_options(&mut self) -> &mut crate::RequestOptions {
17182 &mut self.0.options
17183 }
17184 }
17185
17186 #[derive(Clone, Debug)]
17203 pub struct UpdateKnowledgeBase(RequestBuilder<crate::model::UpdateKnowledgeBaseRequest>);
17204
17205 impl UpdateKnowledgeBase {
17206 pub(crate) fn new(
17207 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17208 ) -> Self {
17209 Self(RequestBuilder::new(stub))
17210 }
17211
17212 pub fn with_request<V: Into<crate::model::UpdateKnowledgeBaseRequest>>(
17214 mut self,
17215 v: V,
17216 ) -> Self {
17217 self.0.request = v.into();
17218 self
17219 }
17220
17221 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17223 self.0.options = v.into();
17224 self
17225 }
17226
17227 pub async fn send(self) -> Result<crate::model::KnowledgeBase> {
17229 (*self.0.stub)
17230 .update_knowledge_base(self.0.request, self.0.options)
17231 .await
17232 .map(crate::Response::into_body)
17233 }
17234
17235 pub fn set_knowledge_base<T>(mut self, v: T) -> Self
17239 where
17240 T: std::convert::Into<crate::model::KnowledgeBase>,
17241 {
17242 self.0.request.knowledge_base = std::option::Option::Some(v.into());
17243 self
17244 }
17245
17246 pub fn set_or_clear_knowledge_base<T>(mut self, v: std::option::Option<T>) -> Self
17250 where
17251 T: std::convert::Into<crate::model::KnowledgeBase>,
17252 {
17253 self.0.request.knowledge_base = v.map(|x| x.into());
17254 self
17255 }
17256
17257 pub fn set_update_mask<T>(mut self, v: T) -> Self
17259 where
17260 T: std::convert::Into<wkt::FieldMask>,
17261 {
17262 self.0.request.update_mask = std::option::Option::Some(v.into());
17263 self
17264 }
17265
17266 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17268 where
17269 T: std::convert::Into<wkt::FieldMask>,
17270 {
17271 self.0.request.update_mask = v.map(|x| x.into());
17272 self
17273 }
17274 }
17275
17276 #[doc(hidden)]
17277 impl crate::RequestBuilder for UpdateKnowledgeBase {
17278 fn request_options(&mut self) -> &mut crate::RequestOptions {
17279 &mut self.0.options
17280 }
17281 }
17282
17283 #[derive(Clone, Debug)]
17304 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
17305
17306 impl ListLocations {
17307 pub(crate) fn new(
17308 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17309 ) -> Self {
17310 Self(RequestBuilder::new(stub))
17311 }
17312
17313 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
17315 mut self,
17316 v: V,
17317 ) -> Self {
17318 self.0.request = v.into();
17319 self
17320 }
17321
17322 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17324 self.0.options = v.into();
17325 self
17326 }
17327
17328 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
17330 (*self.0.stub)
17331 .list_locations(self.0.request, self.0.options)
17332 .await
17333 .map(crate::Response::into_body)
17334 }
17335
17336 pub fn by_page(
17338 self,
17339 ) -> impl google_cloud_gax::paginator::Paginator<
17340 google_cloud_location::model::ListLocationsResponse,
17341 crate::Error,
17342 > {
17343 use std::clone::Clone;
17344 let token = self.0.request.page_token.clone();
17345 let execute = move |token: String| {
17346 let mut builder = self.clone();
17347 builder.0.request = builder.0.request.set_page_token(token);
17348 builder.send()
17349 };
17350 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17351 }
17352
17353 pub fn by_item(
17355 self,
17356 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17357 google_cloud_location::model::ListLocationsResponse,
17358 crate::Error,
17359 > {
17360 use google_cloud_gax::paginator::Paginator;
17361 self.by_page().items()
17362 }
17363
17364 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17366 self.0.request.name = v.into();
17367 self
17368 }
17369
17370 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17372 self.0.request.filter = v.into();
17373 self
17374 }
17375
17376 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17378 self.0.request.page_size = v.into();
17379 self
17380 }
17381
17382 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17384 self.0.request.page_token = v.into();
17385 self
17386 }
17387 }
17388
17389 #[doc(hidden)]
17390 impl crate::RequestBuilder for ListLocations {
17391 fn request_options(&mut self) -> &mut crate::RequestOptions {
17392 &mut self.0.options
17393 }
17394 }
17395
17396 #[derive(Clone, Debug)]
17413 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
17414
17415 impl GetLocation {
17416 pub(crate) fn new(
17417 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17418 ) -> Self {
17419 Self(RequestBuilder::new(stub))
17420 }
17421
17422 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
17424 mut self,
17425 v: V,
17426 ) -> Self {
17427 self.0.request = v.into();
17428 self
17429 }
17430
17431 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17433 self.0.options = v.into();
17434 self
17435 }
17436
17437 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
17439 (*self.0.stub)
17440 .get_location(self.0.request, self.0.options)
17441 .await
17442 .map(crate::Response::into_body)
17443 }
17444
17445 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17447 self.0.request.name = v.into();
17448 self
17449 }
17450 }
17451
17452 #[doc(hidden)]
17453 impl crate::RequestBuilder for GetLocation {
17454 fn request_options(&mut self) -> &mut crate::RequestOptions {
17455 &mut self.0.options
17456 }
17457 }
17458
17459 #[derive(Clone, Debug)]
17480 pub struct ListOperations(
17481 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
17482 );
17483
17484 impl ListOperations {
17485 pub(crate) fn new(
17486 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17487 ) -> Self {
17488 Self(RequestBuilder::new(stub))
17489 }
17490
17491 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
17493 mut self,
17494 v: V,
17495 ) -> Self {
17496 self.0.request = v.into();
17497 self
17498 }
17499
17500 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17502 self.0.options = v.into();
17503 self
17504 }
17505
17506 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
17508 (*self.0.stub)
17509 .list_operations(self.0.request, self.0.options)
17510 .await
17511 .map(crate::Response::into_body)
17512 }
17513
17514 pub fn by_page(
17516 self,
17517 ) -> impl google_cloud_gax::paginator::Paginator<
17518 google_cloud_longrunning::model::ListOperationsResponse,
17519 crate::Error,
17520 > {
17521 use std::clone::Clone;
17522 let token = self.0.request.page_token.clone();
17523 let execute = move |token: String| {
17524 let mut builder = self.clone();
17525 builder.0.request = builder.0.request.set_page_token(token);
17526 builder.send()
17527 };
17528 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17529 }
17530
17531 pub fn by_item(
17533 self,
17534 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17535 google_cloud_longrunning::model::ListOperationsResponse,
17536 crate::Error,
17537 > {
17538 use google_cloud_gax::paginator::Paginator;
17539 self.by_page().items()
17540 }
17541
17542 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17544 self.0.request.name = v.into();
17545 self
17546 }
17547
17548 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
17550 self.0.request.filter = v.into();
17551 self
17552 }
17553
17554 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
17556 self.0.request.page_size = v.into();
17557 self
17558 }
17559
17560 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
17562 self.0.request.page_token = v.into();
17563 self
17564 }
17565
17566 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
17568 self.0.request.return_partial_success = v.into();
17569 self
17570 }
17571 }
17572
17573 #[doc(hidden)]
17574 impl crate::RequestBuilder for ListOperations {
17575 fn request_options(&mut self) -> &mut crate::RequestOptions {
17576 &mut self.0.options
17577 }
17578 }
17579
17580 #[derive(Clone, Debug)]
17597 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
17598
17599 impl GetOperation {
17600 pub(crate) fn new(
17601 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17602 ) -> Self {
17603 Self(RequestBuilder::new(stub))
17604 }
17605
17606 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
17608 mut self,
17609 v: V,
17610 ) -> Self {
17611 self.0.request = v.into();
17612 self
17613 }
17614
17615 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17617 self.0.options = v.into();
17618 self
17619 }
17620
17621 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
17623 (*self.0.stub)
17624 .get_operation(self.0.request, self.0.options)
17625 .await
17626 .map(crate::Response::into_body)
17627 }
17628
17629 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17631 self.0.request.name = v.into();
17632 self
17633 }
17634 }
17635
17636 #[doc(hidden)]
17637 impl crate::RequestBuilder for GetOperation {
17638 fn request_options(&mut self) -> &mut crate::RequestOptions {
17639 &mut self.0.options
17640 }
17641 }
17642
17643 #[derive(Clone, Debug)]
17660 pub struct CancelOperation(
17661 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
17662 );
17663
17664 impl CancelOperation {
17665 pub(crate) fn new(
17666 stub: std::sync::Arc<dyn super::super::stub::dynamic::KnowledgeBases>,
17667 ) -> Self {
17668 Self(RequestBuilder::new(stub))
17669 }
17670
17671 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
17673 mut self,
17674 v: V,
17675 ) -> Self {
17676 self.0.request = v.into();
17677 self
17678 }
17679
17680 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17682 self.0.options = v.into();
17683 self
17684 }
17685
17686 pub async fn send(self) -> Result<()> {
17688 (*self.0.stub)
17689 .cancel_operation(self.0.request, self.0.options)
17690 .await
17691 .map(crate::Response::into_body)
17692 }
17693
17694 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17696 self.0.request.name = v.into();
17697 self
17698 }
17699 }
17700
17701 #[doc(hidden)]
17702 impl crate::RequestBuilder for CancelOperation {
17703 fn request_options(&mut self) -> &mut crate::RequestOptions {
17704 &mut self.0.options
17705 }
17706 }
17707}
17708
17709#[cfg(feature = "participants")]
17711#[cfg_attr(docsrs, doc(cfg(feature = "participants")))]
17712pub mod participants {
17713 use crate::Result;
17714
17715 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
17729
17730 pub(crate) mod client {
17731 use super::super::super::client::Participants;
17732 pub struct Factory;
17733 impl crate::ClientFactory for Factory {
17734 type Client = Participants;
17735 type Credentials = gaxi::options::Credentials;
17736 async fn build(
17737 self,
17738 config: gaxi::options::ClientConfig,
17739 ) -> crate::ClientBuilderResult<Self::Client> {
17740 Self::Client::new(config).await
17741 }
17742 }
17743 }
17744
17745 #[derive(Clone, Debug)]
17747 pub(crate) struct RequestBuilder<R: std::default::Default> {
17748 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17749 request: R,
17750 options: crate::RequestOptions,
17751 }
17752
17753 impl<R> RequestBuilder<R>
17754 where
17755 R: std::default::Default,
17756 {
17757 pub(crate) fn new(
17758 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17759 ) -> Self {
17760 Self {
17761 stub,
17762 request: R::default(),
17763 options: crate::RequestOptions::default(),
17764 }
17765 }
17766 }
17767
17768 #[derive(Clone, Debug)]
17785 pub struct CreateParticipant(RequestBuilder<crate::model::CreateParticipantRequest>);
17786
17787 impl CreateParticipant {
17788 pub(crate) fn new(
17789 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17790 ) -> Self {
17791 Self(RequestBuilder::new(stub))
17792 }
17793
17794 pub fn with_request<V: Into<crate::model::CreateParticipantRequest>>(
17796 mut self,
17797 v: V,
17798 ) -> Self {
17799 self.0.request = v.into();
17800 self
17801 }
17802
17803 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17805 self.0.options = v.into();
17806 self
17807 }
17808
17809 pub async fn send(self) -> Result<crate::model::Participant> {
17811 (*self.0.stub)
17812 .create_participant(self.0.request, self.0.options)
17813 .await
17814 .map(crate::Response::into_body)
17815 }
17816
17817 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
17821 self.0.request.parent = v.into();
17822 self
17823 }
17824
17825 pub fn set_participant<T>(mut self, v: T) -> Self
17829 where
17830 T: std::convert::Into<crate::model::Participant>,
17831 {
17832 self.0.request.participant = std::option::Option::Some(v.into());
17833 self
17834 }
17835
17836 pub fn set_or_clear_participant<T>(mut self, v: std::option::Option<T>) -> Self
17840 where
17841 T: std::convert::Into<crate::model::Participant>,
17842 {
17843 self.0.request.participant = v.map(|x| x.into());
17844 self
17845 }
17846 }
17847
17848 #[doc(hidden)]
17849 impl crate::RequestBuilder for CreateParticipant {
17850 fn request_options(&mut self) -> &mut crate::RequestOptions {
17851 &mut self.0.options
17852 }
17853 }
17854
17855 #[derive(Clone, Debug)]
17872 pub struct GetParticipant(RequestBuilder<crate::model::GetParticipantRequest>);
17873
17874 impl GetParticipant {
17875 pub(crate) fn new(
17876 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17877 ) -> Self {
17878 Self(RequestBuilder::new(stub))
17879 }
17880
17881 pub fn with_request<V: Into<crate::model::GetParticipantRequest>>(mut self, v: V) -> Self {
17883 self.0.request = v.into();
17884 self
17885 }
17886
17887 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17889 self.0.options = v.into();
17890 self
17891 }
17892
17893 pub async fn send(self) -> Result<crate::model::Participant> {
17895 (*self.0.stub)
17896 .get_participant(self.0.request, self.0.options)
17897 .await
17898 .map(crate::Response::into_body)
17899 }
17900
17901 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
17905 self.0.request.name = v.into();
17906 self
17907 }
17908 }
17909
17910 #[doc(hidden)]
17911 impl crate::RequestBuilder for GetParticipant {
17912 fn request_options(&mut self) -> &mut crate::RequestOptions {
17913 &mut self.0.options
17914 }
17915 }
17916
17917 #[derive(Clone, Debug)]
17938 pub struct ListParticipants(RequestBuilder<crate::model::ListParticipantsRequest>);
17939
17940 impl ListParticipants {
17941 pub(crate) fn new(
17942 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
17943 ) -> Self {
17944 Self(RequestBuilder::new(stub))
17945 }
17946
17947 pub fn with_request<V: Into<crate::model::ListParticipantsRequest>>(
17949 mut self,
17950 v: V,
17951 ) -> Self {
17952 self.0.request = v.into();
17953 self
17954 }
17955
17956 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
17958 self.0.options = v.into();
17959 self
17960 }
17961
17962 pub async fn send(self) -> Result<crate::model::ListParticipantsResponse> {
17964 (*self.0.stub)
17965 .list_participants(self.0.request, self.0.options)
17966 .await
17967 .map(crate::Response::into_body)
17968 }
17969
17970 pub fn by_page(
17972 self,
17973 ) -> impl google_cloud_gax::paginator::Paginator<
17974 crate::model::ListParticipantsResponse,
17975 crate::Error,
17976 > {
17977 use std::clone::Clone;
17978 let token = self.0.request.page_token.clone();
17979 let execute = move |token: String| {
17980 let mut builder = self.clone();
17981 builder.0.request = builder.0.request.set_page_token(token);
17982 builder.send()
17983 };
17984 google_cloud_gax::paginator::internal::new_paginator(token, execute)
17985 }
17986
17987 pub fn by_item(
17989 self,
17990 ) -> impl google_cloud_gax::paginator::ItemPaginator<
17991 crate::model::ListParticipantsResponse,
17992 crate::Error,
17993 > {
17994 use google_cloud_gax::paginator::Paginator;
17995 self.by_page().items()
17996 }
17997
17998 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18002 self.0.request.parent = v.into();
18003 self
18004 }
18005
18006 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
18008 self.0.request.page_size = v.into();
18009 self
18010 }
18011
18012 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
18014 self.0.request.page_token = v.into();
18015 self
18016 }
18017 }
18018
18019 #[doc(hidden)]
18020 impl crate::RequestBuilder for ListParticipants {
18021 fn request_options(&mut self) -> &mut crate::RequestOptions {
18022 &mut self.0.options
18023 }
18024 }
18025
18026 #[derive(Clone, Debug)]
18043 pub struct UpdateParticipant(RequestBuilder<crate::model::UpdateParticipantRequest>);
18044
18045 impl UpdateParticipant {
18046 pub(crate) fn new(
18047 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18048 ) -> Self {
18049 Self(RequestBuilder::new(stub))
18050 }
18051
18052 pub fn with_request<V: Into<crate::model::UpdateParticipantRequest>>(
18054 mut self,
18055 v: V,
18056 ) -> Self {
18057 self.0.request = v.into();
18058 self
18059 }
18060
18061 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18063 self.0.options = v.into();
18064 self
18065 }
18066
18067 pub async fn send(self) -> Result<crate::model::Participant> {
18069 (*self.0.stub)
18070 .update_participant(self.0.request, self.0.options)
18071 .await
18072 .map(crate::Response::into_body)
18073 }
18074
18075 pub fn set_participant<T>(mut self, v: T) -> Self
18079 where
18080 T: std::convert::Into<crate::model::Participant>,
18081 {
18082 self.0.request.participant = std::option::Option::Some(v.into());
18083 self
18084 }
18085
18086 pub fn set_or_clear_participant<T>(mut self, v: std::option::Option<T>) -> Self
18090 where
18091 T: std::convert::Into<crate::model::Participant>,
18092 {
18093 self.0.request.participant = v.map(|x| x.into());
18094 self
18095 }
18096
18097 pub fn set_update_mask<T>(mut self, v: T) -> Self
18101 where
18102 T: std::convert::Into<wkt::FieldMask>,
18103 {
18104 self.0.request.update_mask = std::option::Option::Some(v.into());
18105 self
18106 }
18107
18108 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
18112 where
18113 T: std::convert::Into<wkt::FieldMask>,
18114 {
18115 self.0.request.update_mask = v.map(|x| x.into());
18116 self
18117 }
18118 }
18119
18120 #[doc(hidden)]
18121 impl crate::RequestBuilder for UpdateParticipant {
18122 fn request_options(&mut self) -> &mut crate::RequestOptions {
18123 &mut self.0.options
18124 }
18125 }
18126
18127 #[derive(Clone, Debug)]
18144 pub struct AnalyzeContent(RequestBuilder<crate::model::AnalyzeContentRequest>);
18145
18146 impl AnalyzeContent {
18147 pub(crate) fn new(
18148 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18149 ) -> Self {
18150 Self(RequestBuilder::new(stub))
18151 }
18152
18153 pub fn with_request<V: Into<crate::model::AnalyzeContentRequest>>(mut self, v: V) -> Self {
18155 self.0.request = v.into();
18156 self
18157 }
18158
18159 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18161 self.0.options = v.into();
18162 self
18163 }
18164
18165 pub async fn send(self) -> Result<crate::model::AnalyzeContentResponse> {
18167 (*self.0.stub)
18168 .analyze_content(self.0.request, self.0.options)
18169 .await
18170 .map(crate::Response::into_body)
18171 }
18172
18173 pub fn set_participant<T: Into<std::string::String>>(mut self, v: T) -> Self {
18177 self.0.request.participant = v.into();
18178 self
18179 }
18180
18181 pub fn set_reply_audio_config<T>(mut self, v: T) -> Self
18183 where
18184 T: std::convert::Into<crate::model::OutputAudioConfig>,
18185 {
18186 self.0.request.reply_audio_config = std::option::Option::Some(v.into());
18187 self
18188 }
18189
18190 pub fn set_or_clear_reply_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
18192 where
18193 T: std::convert::Into<crate::model::OutputAudioConfig>,
18194 {
18195 self.0.request.reply_audio_config = v.map(|x| x.into());
18196 self
18197 }
18198
18199 pub fn set_query_params<T>(mut self, v: T) -> Self
18201 where
18202 T: std::convert::Into<crate::model::QueryParameters>,
18203 {
18204 self.0.request.query_params = std::option::Option::Some(v.into());
18205 self
18206 }
18207
18208 pub fn set_or_clear_query_params<T>(mut self, v: std::option::Option<T>) -> Self
18210 where
18211 T: std::convert::Into<crate::model::QueryParameters>,
18212 {
18213 self.0.request.query_params = v.map(|x| x.into());
18214 self
18215 }
18216
18217 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
18219 where
18220 T: std::convert::Into<crate::model::AssistQueryParameters>,
18221 {
18222 self.0.request.assist_query_params = std::option::Option::Some(v.into());
18223 self
18224 }
18225
18226 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
18228 where
18229 T: std::convert::Into<crate::model::AssistQueryParameters>,
18230 {
18231 self.0.request.assist_query_params = v.map(|x| x.into());
18232 self
18233 }
18234
18235 pub fn set_cx_parameters<T>(mut self, v: T) -> Self
18237 where
18238 T: std::convert::Into<wkt::Struct>,
18239 {
18240 self.0.request.cx_parameters = std::option::Option::Some(v.into());
18241 self
18242 }
18243
18244 pub fn set_or_clear_cx_parameters<T>(mut self, v: std::option::Option<T>) -> Self
18246 where
18247 T: std::convert::Into<wkt::Struct>,
18248 {
18249 self.0.request.cx_parameters = v.map(|x| x.into());
18250 self
18251 }
18252
18253 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
18255 self.0.request.request_id = v.into();
18256 self
18257 }
18258
18259 pub fn set_input<T: Into<Option<crate::model::analyze_content_request::Input>>>(
18264 mut self,
18265 v: T,
18266 ) -> Self {
18267 self.0.request.input = v.into();
18268 self
18269 }
18270
18271 pub fn set_text_input<T: std::convert::Into<std::boxed::Box<crate::model::TextInput>>>(
18277 mut self,
18278 v: T,
18279 ) -> Self {
18280 self.0.request = self.0.request.set_text_input(v);
18281 self
18282 }
18283
18284 pub fn set_audio_input<T: std::convert::Into<std::boxed::Box<crate::model::AudioInput>>>(
18290 mut self,
18291 v: T,
18292 ) -> Self {
18293 self.0.request = self.0.request.set_audio_input(v);
18294 self
18295 }
18296
18297 pub fn set_event_input<T: std::convert::Into<std::boxed::Box<crate::model::EventInput>>>(
18303 mut self,
18304 v: T,
18305 ) -> Self {
18306 self.0.request = self.0.request.set_event_input(v);
18307 self
18308 }
18309
18310 pub fn set_suggestion_input<
18316 T: std::convert::Into<std::boxed::Box<crate::model::SuggestionInput>>,
18317 >(
18318 mut self,
18319 v: T,
18320 ) -> Self {
18321 self.0.request = self.0.request.set_suggestion_input(v);
18322 self
18323 }
18324 }
18325
18326 #[doc(hidden)]
18327 impl crate::RequestBuilder for AnalyzeContent {
18328 fn request_options(&mut self) -> &mut crate::RequestOptions {
18329 &mut self.0.options
18330 }
18331 }
18332
18333 #[derive(Clone, Debug)]
18350 pub struct SuggestArticles(RequestBuilder<crate::model::SuggestArticlesRequest>);
18351
18352 impl SuggestArticles {
18353 pub(crate) fn new(
18354 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18355 ) -> Self {
18356 Self(RequestBuilder::new(stub))
18357 }
18358
18359 pub fn with_request<V: Into<crate::model::SuggestArticlesRequest>>(mut self, v: V) -> Self {
18361 self.0.request = v.into();
18362 self
18363 }
18364
18365 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18367 self.0.options = v.into();
18368 self
18369 }
18370
18371 pub async fn send(self) -> Result<crate::model::SuggestArticlesResponse> {
18373 (*self.0.stub)
18374 .suggest_articles(self.0.request, self.0.options)
18375 .await
18376 .map(crate::Response::into_body)
18377 }
18378
18379 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18383 self.0.request.parent = v.into();
18384 self
18385 }
18386
18387 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
18389 self.0.request.latest_message = v.into();
18390 self
18391 }
18392
18393 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
18395 self.0.request.context_size = v.into();
18396 self
18397 }
18398
18399 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
18401 where
18402 T: std::convert::Into<crate::model::AssistQueryParameters>,
18403 {
18404 self.0.request.assist_query_params = std::option::Option::Some(v.into());
18405 self
18406 }
18407
18408 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
18410 where
18411 T: std::convert::Into<crate::model::AssistQueryParameters>,
18412 {
18413 self.0.request.assist_query_params = v.map(|x| x.into());
18414 self
18415 }
18416 }
18417
18418 #[doc(hidden)]
18419 impl crate::RequestBuilder for SuggestArticles {
18420 fn request_options(&mut self) -> &mut crate::RequestOptions {
18421 &mut self.0.options
18422 }
18423 }
18424
18425 #[derive(Clone, Debug)]
18442 pub struct SuggestFaqAnswers(RequestBuilder<crate::model::SuggestFaqAnswersRequest>);
18443
18444 impl SuggestFaqAnswers {
18445 pub(crate) fn new(
18446 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18447 ) -> Self {
18448 Self(RequestBuilder::new(stub))
18449 }
18450
18451 pub fn with_request<V: Into<crate::model::SuggestFaqAnswersRequest>>(
18453 mut self,
18454 v: V,
18455 ) -> Self {
18456 self.0.request = v.into();
18457 self
18458 }
18459
18460 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18462 self.0.options = v.into();
18463 self
18464 }
18465
18466 pub async fn send(self) -> Result<crate::model::SuggestFaqAnswersResponse> {
18468 (*self.0.stub)
18469 .suggest_faq_answers(self.0.request, self.0.options)
18470 .await
18471 .map(crate::Response::into_body)
18472 }
18473
18474 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18478 self.0.request.parent = v.into();
18479 self
18480 }
18481
18482 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
18484 self.0.request.latest_message = v.into();
18485 self
18486 }
18487
18488 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
18490 self.0.request.context_size = v.into();
18491 self
18492 }
18493
18494 pub fn set_assist_query_params<T>(mut self, v: T) -> Self
18496 where
18497 T: std::convert::Into<crate::model::AssistQueryParameters>,
18498 {
18499 self.0.request.assist_query_params = std::option::Option::Some(v.into());
18500 self
18501 }
18502
18503 pub fn set_or_clear_assist_query_params<T>(mut self, v: std::option::Option<T>) -> Self
18505 where
18506 T: std::convert::Into<crate::model::AssistQueryParameters>,
18507 {
18508 self.0.request.assist_query_params = v.map(|x| x.into());
18509 self
18510 }
18511 }
18512
18513 #[doc(hidden)]
18514 impl crate::RequestBuilder for SuggestFaqAnswers {
18515 fn request_options(&mut self) -> &mut crate::RequestOptions {
18516 &mut self.0.options
18517 }
18518 }
18519
18520 #[derive(Clone, Debug)]
18537 pub struct SuggestSmartReplies(RequestBuilder<crate::model::SuggestSmartRepliesRequest>);
18538
18539 impl SuggestSmartReplies {
18540 pub(crate) fn new(
18541 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18542 ) -> Self {
18543 Self(RequestBuilder::new(stub))
18544 }
18545
18546 pub fn with_request<V: Into<crate::model::SuggestSmartRepliesRequest>>(
18548 mut self,
18549 v: V,
18550 ) -> Self {
18551 self.0.request = v.into();
18552 self
18553 }
18554
18555 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18557 self.0.options = v.into();
18558 self
18559 }
18560
18561 pub async fn send(self) -> Result<crate::model::SuggestSmartRepliesResponse> {
18563 (*self.0.stub)
18564 .suggest_smart_replies(self.0.request, self.0.options)
18565 .await
18566 .map(crate::Response::into_body)
18567 }
18568
18569 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18573 self.0.request.parent = v.into();
18574 self
18575 }
18576
18577 pub fn set_current_text_input<T>(mut self, v: T) -> Self
18579 where
18580 T: std::convert::Into<crate::model::TextInput>,
18581 {
18582 self.0.request.current_text_input = std::option::Option::Some(v.into());
18583 self
18584 }
18585
18586 pub fn set_or_clear_current_text_input<T>(mut self, v: std::option::Option<T>) -> Self
18588 where
18589 T: std::convert::Into<crate::model::TextInput>,
18590 {
18591 self.0.request.current_text_input = v.map(|x| x.into());
18592 self
18593 }
18594
18595 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
18597 self.0.request.latest_message = v.into();
18598 self
18599 }
18600
18601 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
18603 self.0.request.context_size = v.into();
18604 self
18605 }
18606 }
18607
18608 #[doc(hidden)]
18609 impl crate::RequestBuilder for SuggestSmartReplies {
18610 fn request_options(&mut self) -> &mut crate::RequestOptions {
18611 &mut self.0.options
18612 }
18613 }
18614
18615 #[derive(Clone, Debug)]
18632 pub struct SuggestKnowledgeAssist(RequestBuilder<crate::model::SuggestKnowledgeAssistRequest>);
18633
18634 impl SuggestKnowledgeAssist {
18635 pub(crate) fn new(
18636 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18637 ) -> Self {
18638 Self(RequestBuilder::new(stub))
18639 }
18640
18641 pub fn with_request<V: Into<crate::model::SuggestKnowledgeAssistRequest>>(
18643 mut self,
18644 v: V,
18645 ) -> Self {
18646 self.0.request = v.into();
18647 self
18648 }
18649
18650 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18652 self.0.options = v.into();
18653 self
18654 }
18655
18656 pub async fn send(self) -> Result<crate::model::SuggestKnowledgeAssistResponse> {
18658 (*self.0.stub)
18659 .suggest_knowledge_assist(self.0.request, self.0.options)
18660 .await
18661 .map(crate::Response::into_body)
18662 }
18663
18664 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
18668 self.0.request.parent = v.into();
18669 self
18670 }
18671
18672 pub fn set_latest_message<T: Into<std::string::String>>(mut self, v: T) -> Self {
18674 self.0.request.latest_message = v.into();
18675 self
18676 }
18677
18678 pub fn set_context_size<T: Into<i32>>(mut self, v: T) -> Self {
18680 self.0.request.context_size = v.into();
18681 self
18682 }
18683
18684 pub fn set_previous_suggested_query<T: Into<std::string::String>>(mut self, v: T) -> Self {
18686 self.0.request.previous_suggested_query = v.into();
18687 self
18688 }
18689 }
18690
18691 #[doc(hidden)]
18692 impl crate::RequestBuilder for SuggestKnowledgeAssist {
18693 fn request_options(&mut self) -> &mut crate::RequestOptions {
18694 &mut self.0.options
18695 }
18696 }
18697
18698 #[derive(Clone, Debug)]
18719 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
18720
18721 impl ListLocations {
18722 pub(crate) fn new(
18723 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18724 ) -> Self {
18725 Self(RequestBuilder::new(stub))
18726 }
18727
18728 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
18730 mut self,
18731 v: V,
18732 ) -> Self {
18733 self.0.request = v.into();
18734 self
18735 }
18736
18737 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18739 self.0.options = v.into();
18740 self
18741 }
18742
18743 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
18745 (*self.0.stub)
18746 .list_locations(self.0.request, self.0.options)
18747 .await
18748 .map(crate::Response::into_body)
18749 }
18750
18751 pub fn by_page(
18753 self,
18754 ) -> impl google_cloud_gax::paginator::Paginator<
18755 google_cloud_location::model::ListLocationsResponse,
18756 crate::Error,
18757 > {
18758 use std::clone::Clone;
18759 let token = self.0.request.page_token.clone();
18760 let execute = move |token: String| {
18761 let mut builder = self.clone();
18762 builder.0.request = builder.0.request.set_page_token(token);
18763 builder.send()
18764 };
18765 google_cloud_gax::paginator::internal::new_paginator(token, execute)
18766 }
18767
18768 pub fn by_item(
18770 self,
18771 ) -> impl google_cloud_gax::paginator::ItemPaginator<
18772 google_cloud_location::model::ListLocationsResponse,
18773 crate::Error,
18774 > {
18775 use google_cloud_gax::paginator::Paginator;
18776 self.by_page().items()
18777 }
18778
18779 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18781 self.0.request.name = v.into();
18782 self
18783 }
18784
18785 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
18787 self.0.request.filter = v.into();
18788 self
18789 }
18790
18791 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
18793 self.0.request.page_size = v.into();
18794 self
18795 }
18796
18797 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
18799 self.0.request.page_token = v.into();
18800 self
18801 }
18802 }
18803
18804 #[doc(hidden)]
18805 impl crate::RequestBuilder for ListLocations {
18806 fn request_options(&mut self) -> &mut crate::RequestOptions {
18807 &mut self.0.options
18808 }
18809 }
18810
18811 #[derive(Clone, Debug)]
18828 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
18829
18830 impl GetLocation {
18831 pub(crate) fn new(
18832 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18833 ) -> Self {
18834 Self(RequestBuilder::new(stub))
18835 }
18836
18837 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
18839 mut self,
18840 v: V,
18841 ) -> Self {
18842 self.0.request = v.into();
18843 self
18844 }
18845
18846 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18848 self.0.options = v.into();
18849 self
18850 }
18851
18852 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
18854 (*self.0.stub)
18855 .get_location(self.0.request, self.0.options)
18856 .await
18857 .map(crate::Response::into_body)
18858 }
18859
18860 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18862 self.0.request.name = v.into();
18863 self
18864 }
18865 }
18866
18867 #[doc(hidden)]
18868 impl crate::RequestBuilder for GetLocation {
18869 fn request_options(&mut self) -> &mut crate::RequestOptions {
18870 &mut self.0.options
18871 }
18872 }
18873
18874 #[derive(Clone, Debug)]
18895 pub struct ListOperations(
18896 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
18897 );
18898
18899 impl ListOperations {
18900 pub(crate) fn new(
18901 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
18902 ) -> Self {
18903 Self(RequestBuilder::new(stub))
18904 }
18905
18906 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
18908 mut self,
18909 v: V,
18910 ) -> Self {
18911 self.0.request = v.into();
18912 self
18913 }
18914
18915 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
18917 self.0.options = v.into();
18918 self
18919 }
18920
18921 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
18923 (*self.0.stub)
18924 .list_operations(self.0.request, self.0.options)
18925 .await
18926 .map(crate::Response::into_body)
18927 }
18928
18929 pub fn by_page(
18931 self,
18932 ) -> impl google_cloud_gax::paginator::Paginator<
18933 google_cloud_longrunning::model::ListOperationsResponse,
18934 crate::Error,
18935 > {
18936 use std::clone::Clone;
18937 let token = self.0.request.page_token.clone();
18938 let execute = move |token: String| {
18939 let mut builder = self.clone();
18940 builder.0.request = builder.0.request.set_page_token(token);
18941 builder.send()
18942 };
18943 google_cloud_gax::paginator::internal::new_paginator(token, execute)
18944 }
18945
18946 pub fn by_item(
18948 self,
18949 ) -> impl google_cloud_gax::paginator::ItemPaginator<
18950 google_cloud_longrunning::model::ListOperationsResponse,
18951 crate::Error,
18952 > {
18953 use google_cloud_gax::paginator::Paginator;
18954 self.by_page().items()
18955 }
18956
18957 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
18959 self.0.request.name = v.into();
18960 self
18961 }
18962
18963 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
18965 self.0.request.filter = v.into();
18966 self
18967 }
18968
18969 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
18971 self.0.request.page_size = v.into();
18972 self
18973 }
18974
18975 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
18977 self.0.request.page_token = v.into();
18978 self
18979 }
18980
18981 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
18983 self.0.request.return_partial_success = v.into();
18984 self
18985 }
18986 }
18987
18988 #[doc(hidden)]
18989 impl crate::RequestBuilder for ListOperations {
18990 fn request_options(&mut self) -> &mut crate::RequestOptions {
18991 &mut self.0.options
18992 }
18993 }
18994
18995 #[derive(Clone, Debug)]
19012 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
19013
19014 impl GetOperation {
19015 pub(crate) fn new(
19016 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
19017 ) -> Self {
19018 Self(RequestBuilder::new(stub))
19019 }
19020
19021 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
19023 mut self,
19024 v: V,
19025 ) -> Self {
19026 self.0.request = v.into();
19027 self
19028 }
19029
19030 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19032 self.0.options = v.into();
19033 self
19034 }
19035
19036 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
19038 (*self.0.stub)
19039 .get_operation(self.0.request, self.0.options)
19040 .await
19041 .map(crate::Response::into_body)
19042 }
19043
19044 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19046 self.0.request.name = v.into();
19047 self
19048 }
19049 }
19050
19051 #[doc(hidden)]
19052 impl crate::RequestBuilder for GetOperation {
19053 fn request_options(&mut self) -> &mut crate::RequestOptions {
19054 &mut self.0.options
19055 }
19056 }
19057
19058 #[derive(Clone, Debug)]
19075 pub struct CancelOperation(
19076 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
19077 );
19078
19079 impl CancelOperation {
19080 pub(crate) fn new(
19081 stub: std::sync::Arc<dyn super::super::stub::dynamic::Participants>,
19082 ) -> Self {
19083 Self(RequestBuilder::new(stub))
19084 }
19085
19086 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
19088 mut self,
19089 v: V,
19090 ) -> Self {
19091 self.0.request = v.into();
19092 self
19093 }
19094
19095 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19097 self.0.options = v.into();
19098 self
19099 }
19100
19101 pub async fn send(self) -> Result<()> {
19103 (*self.0.stub)
19104 .cancel_operation(self.0.request, self.0.options)
19105 .await
19106 .map(crate::Response::into_body)
19107 }
19108
19109 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19111 self.0.request.name = v.into();
19112 self
19113 }
19114 }
19115
19116 #[doc(hidden)]
19117 impl crate::RequestBuilder for CancelOperation {
19118 fn request_options(&mut self) -> &mut crate::RequestOptions {
19119 &mut self.0.options
19120 }
19121 }
19122}
19123
19124#[cfg(feature = "sessions")]
19126#[cfg_attr(docsrs, doc(cfg(feature = "sessions")))]
19127pub mod sessions {
19128 use crate::Result;
19129
19130 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
19144
19145 pub(crate) mod client {
19146 use super::super::super::client::Sessions;
19147 pub struct Factory;
19148 impl crate::ClientFactory for Factory {
19149 type Client = Sessions;
19150 type Credentials = gaxi::options::Credentials;
19151 async fn build(
19152 self,
19153 config: gaxi::options::ClientConfig,
19154 ) -> crate::ClientBuilderResult<Self::Client> {
19155 Self::Client::new(config).await
19156 }
19157 }
19158 }
19159
19160 #[derive(Clone, Debug)]
19162 pub(crate) struct RequestBuilder<R: std::default::Default> {
19163 stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>,
19164 request: R,
19165 options: crate::RequestOptions,
19166 }
19167
19168 impl<R> RequestBuilder<R>
19169 where
19170 R: std::default::Default,
19171 {
19172 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19173 Self {
19174 stub,
19175 request: R::default(),
19176 options: crate::RequestOptions::default(),
19177 }
19178 }
19179 }
19180
19181 #[derive(Clone, Debug)]
19198 pub struct DetectIntent(RequestBuilder<crate::model::DetectIntentRequest>);
19199
19200 impl DetectIntent {
19201 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19202 Self(RequestBuilder::new(stub))
19203 }
19204
19205 pub fn with_request<V: Into<crate::model::DetectIntentRequest>>(mut self, v: V) -> Self {
19207 self.0.request = v.into();
19208 self
19209 }
19210
19211 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19213 self.0.options = v.into();
19214 self
19215 }
19216
19217 pub async fn send(self) -> Result<crate::model::DetectIntentResponse> {
19219 (*self.0.stub)
19220 .detect_intent(self.0.request, self.0.options)
19221 .await
19222 .map(crate::Response::into_body)
19223 }
19224
19225 pub fn set_session<T: Into<std::string::String>>(mut self, v: T) -> Self {
19229 self.0.request.session = v.into();
19230 self
19231 }
19232
19233 pub fn set_query_params<T>(mut self, v: T) -> Self
19235 where
19236 T: std::convert::Into<crate::model::QueryParameters>,
19237 {
19238 self.0.request.query_params = std::option::Option::Some(v.into());
19239 self
19240 }
19241
19242 pub fn set_or_clear_query_params<T>(mut self, v: std::option::Option<T>) -> Self
19244 where
19245 T: std::convert::Into<crate::model::QueryParameters>,
19246 {
19247 self.0.request.query_params = v.map(|x| x.into());
19248 self
19249 }
19250
19251 pub fn set_query_input<T>(mut self, v: T) -> Self
19255 where
19256 T: std::convert::Into<crate::model::QueryInput>,
19257 {
19258 self.0.request.query_input = std::option::Option::Some(v.into());
19259 self
19260 }
19261
19262 pub fn set_or_clear_query_input<T>(mut self, v: std::option::Option<T>) -> Self
19266 where
19267 T: std::convert::Into<crate::model::QueryInput>,
19268 {
19269 self.0.request.query_input = v.map(|x| x.into());
19270 self
19271 }
19272
19273 pub fn set_output_audio_config<T>(mut self, v: T) -> Self
19275 where
19276 T: std::convert::Into<crate::model::OutputAudioConfig>,
19277 {
19278 self.0.request.output_audio_config = std::option::Option::Some(v.into());
19279 self
19280 }
19281
19282 pub fn set_or_clear_output_audio_config<T>(mut self, v: std::option::Option<T>) -> Self
19284 where
19285 T: std::convert::Into<crate::model::OutputAudioConfig>,
19286 {
19287 self.0.request.output_audio_config = v.map(|x| x.into());
19288 self
19289 }
19290
19291 pub fn set_output_audio_config_mask<T>(mut self, v: T) -> Self
19293 where
19294 T: std::convert::Into<wkt::FieldMask>,
19295 {
19296 self.0.request.output_audio_config_mask = std::option::Option::Some(v.into());
19297 self
19298 }
19299
19300 pub fn set_or_clear_output_audio_config_mask<T>(mut self, v: std::option::Option<T>) -> Self
19302 where
19303 T: std::convert::Into<wkt::FieldMask>,
19304 {
19305 self.0.request.output_audio_config_mask = v.map(|x| x.into());
19306 self
19307 }
19308
19309 pub fn set_input_audio<T: Into<::bytes::Bytes>>(mut self, v: T) -> Self {
19311 self.0.request.input_audio = v.into();
19312 self
19313 }
19314 }
19315
19316 #[doc(hidden)]
19317 impl crate::RequestBuilder for DetectIntent {
19318 fn request_options(&mut self) -> &mut crate::RequestOptions {
19319 &mut self.0.options
19320 }
19321 }
19322
19323 #[derive(Clone, Debug)]
19344 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
19345
19346 impl ListLocations {
19347 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19348 Self(RequestBuilder::new(stub))
19349 }
19350
19351 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
19353 mut self,
19354 v: V,
19355 ) -> Self {
19356 self.0.request = v.into();
19357 self
19358 }
19359
19360 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19362 self.0.options = v.into();
19363 self
19364 }
19365
19366 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
19368 (*self.0.stub)
19369 .list_locations(self.0.request, self.0.options)
19370 .await
19371 .map(crate::Response::into_body)
19372 }
19373
19374 pub fn by_page(
19376 self,
19377 ) -> impl google_cloud_gax::paginator::Paginator<
19378 google_cloud_location::model::ListLocationsResponse,
19379 crate::Error,
19380 > {
19381 use std::clone::Clone;
19382 let token = self.0.request.page_token.clone();
19383 let execute = move |token: String| {
19384 let mut builder = self.clone();
19385 builder.0.request = builder.0.request.set_page_token(token);
19386 builder.send()
19387 };
19388 google_cloud_gax::paginator::internal::new_paginator(token, execute)
19389 }
19390
19391 pub fn by_item(
19393 self,
19394 ) -> impl google_cloud_gax::paginator::ItemPaginator<
19395 google_cloud_location::model::ListLocationsResponse,
19396 crate::Error,
19397 > {
19398 use google_cloud_gax::paginator::Paginator;
19399 self.by_page().items()
19400 }
19401
19402 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19404 self.0.request.name = v.into();
19405 self
19406 }
19407
19408 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
19410 self.0.request.filter = v.into();
19411 self
19412 }
19413
19414 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
19416 self.0.request.page_size = v.into();
19417 self
19418 }
19419
19420 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
19422 self.0.request.page_token = v.into();
19423 self
19424 }
19425 }
19426
19427 #[doc(hidden)]
19428 impl crate::RequestBuilder for ListLocations {
19429 fn request_options(&mut self) -> &mut crate::RequestOptions {
19430 &mut self.0.options
19431 }
19432 }
19433
19434 #[derive(Clone, Debug)]
19451 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
19452
19453 impl GetLocation {
19454 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19455 Self(RequestBuilder::new(stub))
19456 }
19457
19458 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
19460 mut self,
19461 v: V,
19462 ) -> Self {
19463 self.0.request = v.into();
19464 self
19465 }
19466
19467 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19469 self.0.options = v.into();
19470 self
19471 }
19472
19473 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
19475 (*self.0.stub)
19476 .get_location(self.0.request, self.0.options)
19477 .await
19478 .map(crate::Response::into_body)
19479 }
19480
19481 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19483 self.0.request.name = v.into();
19484 self
19485 }
19486 }
19487
19488 #[doc(hidden)]
19489 impl crate::RequestBuilder for GetLocation {
19490 fn request_options(&mut self) -> &mut crate::RequestOptions {
19491 &mut self.0.options
19492 }
19493 }
19494
19495 #[derive(Clone, Debug)]
19516 pub struct ListOperations(
19517 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
19518 );
19519
19520 impl ListOperations {
19521 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19522 Self(RequestBuilder::new(stub))
19523 }
19524
19525 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
19527 mut self,
19528 v: V,
19529 ) -> Self {
19530 self.0.request = v.into();
19531 self
19532 }
19533
19534 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19536 self.0.options = v.into();
19537 self
19538 }
19539
19540 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
19542 (*self.0.stub)
19543 .list_operations(self.0.request, self.0.options)
19544 .await
19545 .map(crate::Response::into_body)
19546 }
19547
19548 pub fn by_page(
19550 self,
19551 ) -> impl google_cloud_gax::paginator::Paginator<
19552 google_cloud_longrunning::model::ListOperationsResponse,
19553 crate::Error,
19554 > {
19555 use std::clone::Clone;
19556 let token = self.0.request.page_token.clone();
19557 let execute = move |token: String| {
19558 let mut builder = self.clone();
19559 builder.0.request = builder.0.request.set_page_token(token);
19560 builder.send()
19561 };
19562 google_cloud_gax::paginator::internal::new_paginator(token, execute)
19563 }
19564
19565 pub fn by_item(
19567 self,
19568 ) -> impl google_cloud_gax::paginator::ItemPaginator<
19569 google_cloud_longrunning::model::ListOperationsResponse,
19570 crate::Error,
19571 > {
19572 use google_cloud_gax::paginator::Paginator;
19573 self.by_page().items()
19574 }
19575
19576 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19578 self.0.request.name = v.into();
19579 self
19580 }
19581
19582 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
19584 self.0.request.filter = v.into();
19585 self
19586 }
19587
19588 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
19590 self.0.request.page_size = v.into();
19591 self
19592 }
19593
19594 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
19596 self.0.request.page_token = v.into();
19597 self
19598 }
19599
19600 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
19602 self.0.request.return_partial_success = v.into();
19603 self
19604 }
19605 }
19606
19607 #[doc(hidden)]
19608 impl crate::RequestBuilder for ListOperations {
19609 fn request_options(&mut self) -> &mut crate::RequestOptions {
19610 &mut self.0.options
19611 }
19612 }
19613
19614 #[derive(Clone, Debug)]
19631 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
19632
19633 impl GetOperation {
19634 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19635 Self(RequestBuilder::new(stub))
19636 }
19637
19638 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
19640 mut self,
19641 v: V,
19642 ) -> Self {
19643 self.0.request = v.into();
19644 self
19645 }
19646
19647 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19649 self.0.options = v.into();
19650 self
19651 }
19652
19653 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
19655 (*self.0.stub)
19656 .get_operation(self.0.request, self.0.options)
19657 .await
19658 .map(crate::Response::into_body)
19659 }
19660
19661 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19663 self.0.request.name = v.into();
19664 self
19665 }
19666 }
19667
19668 #[doc(hidden)]
19669 impl crate::RequestBuilder for GetOperation {
19670 fn request_options(&mut self) -> &mut crate::RequestOptions {
19671 &mut self.0.options
19672 }
19673 }
19674
19675 #[derive(Clone, Debug)]
19692 pub struct CancelOperation(
19693 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
19694 );
19695
19696 impl CancelOperation {
19697 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Sessions>) -> Self {
19698 Self(RequestBuilder::new(stub))
19699 }
19700
19701 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
19703 mut self,
19704 v: V,
19705 ) -> Self {
19706 self.0.request = v.into();
19707 self
19708 }
19709
19710 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19712 self.0.options = v.into();
19713 self
19714 }
19715
19716 pub async fn send(self) -> Result<()> {
19718 (*self.0.stub)
19719 .cancel_operation(self.0.request, self.0.options)
19720 .await
19721 .map(crate::Response::into_body)
19722 }
19723
19724 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19726 self.0.request.name = v.into();
19727 self
19728 }
19729 }
19730
19731 #[doc(hidden)]
19732 impl crate::RequestBuilder for CancelOperation {
19733 fn request_options(&mut self) -> &mut crate::RequestOptions {
19734 &mut self.0.options
19735 }
19736 }
19737}
19738
19739#[cfg(feature = "session-entity-types")]
19741#[cfg_attr(docsrs, doc(cfg(feature = "session-entity-types")))]
19742pub mod session_entity_types {
19743 use crate::Result;
19744
19745 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
19759
19760 pub(crate) mod client {
19761 use super::super::super::client::SessionEntityTypes;
19762 pub struct Factory;
19763 impl crate::ClientFactory for Factory {
19764 type Client = SessionEntityTypes;
19765 type Credentials = gaxi::options::Credentials;
19766 async fn build(
19767 self,
19768 config: gaxi::options::ClientConfig,
19769 ) -> crate::ClientBuilderResult<Self::Client> {
19770 Self::Client::new(config).await
19771 }
19772 }
19773 }
19774
19775 #[derive(Clone, Debug)]
19777 pub(crate) struct RequestBuilder<R: std::default::Default> {
19778 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19779 request: R,
19780 options: crate::RequestOptions,
19781 }
19782
19783 impl<R> RequestBuilder<R>
19784 where
19785 R: std::default::Default,
19786 {
19787 pub(crate) fn new(
19788 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19789 ) -> Self {
19790 Self {
19791 stub,
19792 request: R::default(),
19793 options: crate::RequestOptions::default(),
19794 }
19795 }
19796 }
19797
19798 #[derive(Clone, Debug)]
19819 pub struct ListSessionEntityTypes(RequestBuilder<crate::model::ListSessionEntityTypesRequest>);
19820
19821 impl ListSessionEntityTypes {
19822 pub(crate) fn new(
19823 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19824 ) -> Self {
19825 Self(RequestBuilder::new(stub))
19826 }
19827
19828 pub fn with_request<V: Into<crate::model::ListSessionEntityTypesRequest>>(
19830 mut self,
19831 v: V,
19832 ) -> Self {
19833 self.0.request = v.into();
19834 self
19835 }
19836
19837 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19839 self.0.options = v.into();
19840 self
19841 }
19842
19843 pub async fn send(self) -> Result<crate::model::ListSessionEntityTypesResponse> {
19845 (*self.0.stub)
19846 .list_session_entity_types(self.0.request, self.0.options)
19847 .await
19848 .map(crate::Response::into_body)
19849 }
19850
19851 pub fn by_page(
19853 self,
19854 ) -> impl google_cloud_gax::paginator::Paginator<
19855 crate::model::ListSessionEntityTypesResponse,
19856 crate::Error,
19857 > {
19858 use std::clone::Clone;
19859 let token = self.0.request.page_token.clone();
19860 let execute = move |token: String| {
19861 let mut builder = self.clone();
19862 builder.0.request = builder.0.request.set_page_token(token);
19863 builder.send()
19864 };
19865 google_cloud_gax::paginator::internal::new_paginator(token, execute)
19866 }
19867
19868 pub fn by_item(
19870 self,
19871 ) -> impl google_cloud_gax::paginator::ItemPaginator<
19872 crate::model::ListSessionEntityTypesResponse,
19873 crate::Error,
19874 > {
19875 use google_cloud_gax::paginator::Paginator;
19876 self.by_page().items()
19877 }
19878
19879 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
19883 self.0.request.parent = v.into();
19884 self
19885 }
19886
19887 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
19889 self.0.request.page_size = v.into();
19890 self
19891 }
19892
19893 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
19895 self.0.request.page_token = v.into();
19896 self
19897 }
19898 }
19899
19900 #[doc(hidden)]
19901 impl crate::RequestBuilder for ListSessionEntityTypes {
19902 fn request_options(&mut self) -> &mut crate::RequestOptions {
19903 &mut self.0.options
19904 }
19905 }
19906
19907 #[derive(Clone, Debug)]
19924 pub struct GetSessionEntityType(RequestBuilder<crate::model::GetSessionEntityTypeRequest>);
19925
19926 impl GetSessionEntityType {
19927 pub(crate) fn new(
19928 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19929 ) -> Self {
19930 Self(RequestBuilder::new(stub))
19931 }
19932
19933 pub fn with_request<V: Into<crate::model::GetSessionEntityTypeRequest>>(
19935 mut self,
19936 v: V,
19937 ) -> Self {
19938 self.0.request = v.into();
19939 self
19940 }
19941
19942 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
19944 self.0.options = v.into();
19945 self
19946 }
19947
19948 pub async fn send(self) -> Result<crate::model::SessionEntityType> {
19950 (*self.0.stub)
19951 .get_session_entity_type(self.0.request, self.0.options)
19952 .await
19953 .map(crate::Response::into_body)
19954 }
19955
19956 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
19960 self.0.request.name = v.into();
19961 self
19962 }
19963 }
19964
19965 #[doc(hidden)]
19966 impl crate::RequestBuilder for GetSessionEntityType {
19967 fn request_options(&mut self) -> &mut crate::RequestOptions {
19968 &mut self.0.options
19969 }
19970 }
19971
19972 #[derive(Clone, Debug)]
19989 pub struct CreateSessionEntityType(
19990 RequestBuilder<crate::model::CreateSessionEntityTypeRequest>,
19991 );
19992
19993 impl CreateSessionEntityType {
19994 pub(crate) fn new(
19995 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
19996 ) -> Self {
19997 Self(RequestBuilder::new(stub))
19998 }
19999
20000 pub fn with_request<V: Into<crate::model::CreateSessionEntityTypeRequest>>(
20002 mut self,
20003 v: V,
20004 ) -> Self {
20005 self.0.request = v.into();
20006 self
20007 }
20008
20009 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20011 self.0.options = v.into();
20012 self
20013 }
20014
20015 pub async fn send(self) -> Result<crate::model::SessionEntityType> {
20017 (*self.0.stub)
20018 .create_session_entity_type(self.0.request, self.0.options)
20019 .await
20020 .map(crate::Response::into_body)
20021 }
20022
20023 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
20027 self.0.request.parent = v.into();
20028 self
20029 }
20030
20031 pub fn set_session_entity_type<T>(mut self, v: T) -> Self
20035 where
20036 T: std::convert::Into<crate::model::SessionEntityType>,
20037 {
20038 self.0.request.session_entity_type = std::option::Option::Some(v.into());
20039 self
20040 }
20041
20042 pub fn set_or_clear_session_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
20046 where
20047 T: std::convert::Into<crate::model::SessionEntityType>,
20048 {
20049 self.0.request.session_entity_type = v.map(|x| x.into());
20050 self
20051 }
20052 }
20053
20054 #[doc(hidden)]
20055 impl crate::RequestBuilder for CreateSessionEntityType {
20056 fn request_options(&mut self) -> &mut crate::RequestOptions {
20057 &mut self.0.options
20058 }
20059 }
20060
20061 #[derive(Clone, Debug)]
20078 pub struct UpdateSessionEntityType(
20079 RequestBuilder<crate::model::UpdateSessionEntityTypeRequest>,
20080 );
20081
20082 impl UpdateSessionEntityType {
20083 pub(crate) fn new(
20084 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20085 ) -> Self {
20086 Self(RequestBuilder::new(stub))
20087 }
20088
20089 pub fn with_request<V: Into<crate::model::UpdateSessionEntityTypeRequest>>(
20091 mut self,
20092 v: V,
20093 ) -> Self {
20094 self.0.request = v.into();
20095 self
20096 }
20097
20098 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20100 self.0.options = v.into();
20101 self
20102 }
20103
20104 pub async fn send(self) -> Result<crate::model::SessionEntityType> {
20106 (*self.0.stub)
20107 .update_session_entity_type(self.0.request, self.0.options)
20108 .await
20109 .map(crate::Response::into_body)
20110 }
20111
20112 pub fn set_session_entity_type<T>(mut self, v: T) -> Self
20116 where
20117 T: std::convert::Into<crate::model::SessionEntityType>,
20118 {
20119 self.0.request.session_entity_type = std::option::Option::Some(v.into());
20120 self
20121 }
20122
20123 pub fn set_or_clear_session_entity_type<T>(mut self, v: std::option::Option<T>) -> Self
20127 where
20128 T: std::convert::Into<crate::model::SessionEntityType>,
20129 {
20130 self.0.request.session_entity_type = v.map(|x| x.into());
20131 self
20132 }
20133
20134 pub fn set_update_mask<T>(mut self, v: T) -> Self
20136 where
20137 T: std::convert::Into<wkt::FieldMask>,
20138 {
20139 self.0.request.update_mask = std::option::Option::Some(v.into());
20140 self
20141 }
20142
20143 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
20145 where
20146 T: std::convert::Into<wkt::FieldMask>,
20147 {
20148 self.0.request.update_mask = v.map(|x| x.into());
20149 self
20150 }
20151 }
20152
20153 #[doc(hidden)]
20154 impl crate::RequestBuilder for UpdateSessionEntityType {
20155 fn request_options(&mut self) -> &mut crate::RequestOptions {
20156 &mut self.0.options
20157 }
20158 }
20159
20160 #[derive(Clone, Debug)]
20177 pub struct DeleteSessionEntityType(
20178 RequestBuilder<crate::model::DeleteSessionEntityTypeRequest>,
20179 );
20180
20181 impl DeleteSessionEntityType {
20182 pub(crate) fn new(
20183 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20184 ) -> Self {
20185 Self(RequestBuilder::new(stub))
20186 }
20187
20188 pub fn with_request<V: Into<crate::model::DeleteSessionEntityTypeRequest>>(
20190 mut self,
20191 v: V,
20192 ) -> Self {
20193 self.0.request = v.into();
20194 self
20195 }
20196
20197 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20199 self.0.options = v.into();
20200 self
20201 }
20202
20203 pub async fn send(self) -> Result<()> {
20205 (*self.0.stub)
20206 .delete_session_entity_type(self.0.request, self.0.options)
20207 .await
20208 .map(crate::Response::into_body)
20209 }
20210
20211 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20215 self.0.request.name = v.into();
20216 self
20217 }
20218 }
20219
20220 #[doc(hidden)]
20221 impl crate::RequestBuilder for DeleteSessionEntityType {
20222 fn request_options(&mut self) -> &mut crate::RequestOptions {
20223 &mut self.0.options
20224 }
20225 }
20226
20227 #[derive(Clone, Debug)]
20248 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
20249
20250 impl ListLocations {
20251 pub(crate) fn new(
20252 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20253 ) -> Self {
20254 Self(RequestBuilder::new(stub))
20255 }
20256
20257 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
20259 mut self,
20260 v: V,
20261 ) -> Self {
20262 self.0.request = v.into();
20263 self
20264 }
20265
20266 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20268 self.0.options = v.into();
20269 self
20270 }
20271
20272 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
20274 (*self.0.stub)
20275 .list_locations(self.0.request, self.0.options)
20276 .await
20277 .map(crate::Response::into_body)
20278 }
20279
20280 pub fn by_page(
20282 self,
20283 ) -> impl google_cloud_gax::paginator::Paginator<
20284 google_cloud_location::model::ListLocationsResponse,
20285 crate::Error,
20286 > {
20287 use std::clone::Clone;
20288 let token = self.0.request.page_token.clone();
20289 let execute = move |token: String| {
20290 let mut builder = self.clone();
20291 builder.0.request = builder.0.request.set_page_token(token);
20292 builder.send()
20293 };
20294 google_cloud_gax::paginator::internal::new_paginator(token, execute)
20295 }
20296
20297 pub fn by_item(
20299 self,
20300 ) -> impl google_cloud_gax::paginator::ItemPaginator<
20301 google_cloud_location::model::ListLocationsResponse,
20302 crate::Error,
20303 > {
20304 use google_cloud_gax::paginator::Paginator;
20305 self.by_page().items()
20306 }
20307
20308 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20310 self.0.request.name = v.into();
20311 self
20312 }
20313
20314 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
20316 self.0.request.filter = v.into();
20317 self
20318 }
20319
20320 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
20322 self.0.request.page_size = v.into();
20323 self
20324 }
20325
20326 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
20328 self.0.request.page_token = v.into();
20329 self
20330 }
20331 }
20332
20333 #[doc(hidden)]
20334 impl crate::RequestBuilder for ListLocations {
20335 fn request_options(&mut self) -> &mut crate::RequestOptions {
20336 &mut self.0.options
20337 }
20338 }
20339
20340 #[derive(Clone, Debug)]
20357 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
20358
20359 impl GetLocation {
20360 pub(crate) fn new(
20361 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20362 ) -> Self {
20363 Self(RequestBuilder::new(stub))
20364 }
20365
20366 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
20368 mut self,
20369 v: V,
20370 ) -> Self {
20371 self.0.request = v.into();
20372 self
20373 }
20374
20375 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20377 self.0.options = v.into();
20378 self
20379 }
20380
20381 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
20383 (*self.0.stub)
20384 .get_location(self.0.request, self.0.options)
20385 .await
20386 .map(crate::Response::into_body)
20387 }
20388
20389 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20391 self.0.request.name = v.into();
20392 self
20393 }
20394 }
20395
20396 #[doc(hidden)]
20397 impl crate::RequestBuilder for GetLocation {
20398 fn request_options(&mut self) -> &mut crate::RequestOptions {
20399 &mut self.0.options
20400 }
20401 }
20402
20403 #[derive(Clone, Debug)]
20424 pub struct ListOperations(
20425 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
20426 );
20427
20428 impl ListOperations {
20429 pub(crate) fn new(
20430 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20431 ) -> Self {
20432 Self(RequestBuilder::new(stub))
20433 }
20434
20435 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
20437 mut self,
20438 v: V,
20439 ) -> Self {
20440 self.0.request = v.into();
20441 self
20442 }
20443
20444 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20446 self.0.options = v.into();
20447 self
20448 }
20449
20450 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
20452 (*self.0.stub)
20453 .list_operations(self.0.request, self.0.options)
20454 .await
20455 .map(crate::Response::into_body)
20456 }
20457
20458 pub fn by_page(
20460 self,
20461 ) -> impl google_cloud_gax::paginator::Paginator<
20462 google_cloud_longrunning::model::ListOperationsResponse,
20463 crate::Error,
20464 > {
20465 use std::clone::Clone;
20466 let token = self.0.request.page_token.clone();
20467 let execute = move |token: String| {
20468 let mut builder = self.clone();
20469 builder.0.request = builder.0.request.set_page_token(token);
20470 builder.send()
20471 };
20472 google_cloud_gax::paginator::internal::new_paginator(token, execute)
20473 }
20474
20475 pub fn by_item(
20477 self,
20478 ) -> impl google_cloud_gax::paginator::ItemPaginator<
20479 google_cloud_longrunning::model::ListOperationsResponse,
20480 crate::Error,
20481 > {
20482 use google_cloud_gax::paginator::Paginator;
20483 self.by_page().items()
20484 }
20485
20486 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20488 self.0.request.name = v.into();
20489 self
20490 }
20491
20492 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
20494 self.0.request.filter = v.into();
20495 self
20496 }
20497
20498 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
20500 self.0.request.page_size = v.into();
20501 self
20502 }
20503
20504 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
20506 self.0.request.page_token = v.into();
20507 self
20508 }
20509
20510 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
20512 self.0.request.return_partial_success = v.into();
20513 self
20514 }
20515 }
20516
20517 #[doc(hidden)]
20518 impl crate::RequestBuilder for ListOperations {
20519 fn request_options(&mut self) -> &mut crate::RequestOptions {
20520 &mut self.0.options
20521 }
20522 }
20523
20524 #[derive(Clone, Debug)]
20541 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
20542
20543 impl GetOperation {
20544 pub(crate) fn new(
20545 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20546 ) -> Self {
20547 Self(RequestBuilder::new(stub))
20548 }
20549
20550 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
20552 mut self,
20553 v: V,
20554 ) -> Self {
20555 self.0.request = v.into();
20556 self
20557 }
20558
20559 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20561 self.0.options = v.into();
20562 self
20563 }
20564
20565 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
20567 (*self.0.stub)
20568 .get_operation(self.0.request, self.0.options)
20569 .await
20570 .map(crate::Response::into_body)
20571 }
20572
20573 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20575 self.0.request.name = v.into();
20576 self
20577 }
20578 }
20579
20580 #[doc(hidden)]
20581 impl crate::RequestBuilder for GetOperation {
20582 fn request_options(&mut self) -> &mut crate::RequestOptions {
20583 &mut self.0.options
20584 }
20585 }
20586
20587 #[derive(Clone, Debug)]
20604 pub struct CancelOperation(
20605 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
20606 );
20607
20608 impl CancelOperation {
20609 pub(crate) fn new(
20610 stub: std::sync::Arc<dyn super::super::stub::dynamic::SessionEntityTypes>,
20611 ) -> Self {
20612 Self(RequestBuilder::new(stub))
20613 }
20614
20615 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
20617 mut self,
20618 v: V,
20619 ) -> Self {
20620 self.0.request = v.into();
20621 self
20622 }
20623
20624 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20626 self.0.options = v.into();
20627 self
20628 }
20629
20630 pub async fn send(self) -> Result<()> {
20632 (*self.0.stub)
20633 .cancel_operation(self.0.request, self.0.options)
20634 .await
20635 .map(crate::Response::into_body)
20636 }
20637
20638 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20640 self.0.request.name = v.into();
20641 self
20642 }
20643 }
20644
20645 #[doc(hidden)]
20646 impl crate::RequestBuilder for CancelOperation {
20647 fn request_options(&mut self) -> &mut crate::RequestOptions {
20648 &mut self.0.options
20649 }
20650 }
20651}
20652
20653#[cfg(feature = "sip-trunks")]
20655#[cfg_attr(docsrs, doc(cfg(feature = "sip-trunks")))]
20656pub mod sip_trunks {
20657 use crate::Result;
20658
20659 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
20673
20674 pub(crate) mod client {
20675 use super::super::super::client::SipTrunks;
20676 pub struct Factory;
20677 impl crate::ClientFactory for Factory {
20678 type Client = SipTrunks;
20679 type Credentials = gaxi::options::Credentials;
20680 async fn build(
20681 self,
20682 config: gaxi::options::ClientConfig,
20683 ) -> crate::ClientBuilderResult<Self::Client> {
20684 Self::Client::new(config).await
20685 }
20686 }
20687 }
20688
20689 #[derive(Clone, Debug)]
20691 pub(crate) struct RequestBuilder<R: std::default::Default> {
20692 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20693 request: R,
20694 options: crate::RequestOptions,
20695 }
20696
20697 impl<R> RequestBuilder<R>
20698 where
20699 R: std::default::Default,
20700 {
20701 pub(crate) fn new(
20702 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20703 ) -> Self {
20704 Self {
20705 stub,
20706 request: R::default(),
20707 options: crate::RequestOptions::default(),
20708 }
20709 }
20710 }
20711
20712 #[derive(Clone, Debug)]
20729 pub struct CreateSipTrunk(RequestBuilder<crate::model::CreateSipTrunkRequest>);
20730
20731 impl CreateSipTrunk {
20732 pub(crate) fn new(
20733 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20734 ) -> Self {
20735 Self(RequestBuilder::new(stub))
20736 }
20737
20738 pub fn with_request<V: Into<crate::model::CreateSipTrunkRequest>>(mut self, v: V) -> Self {
20740 self.0.request = v.into();
20741 self
20742 }
20743
20744 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20746 self.0.options = v.into();
20747 self
20748 }
20749
20750 pub async fn send(self) -> Result<crate::model::SipTrunk> {
20752 (*self.0.stub)
20753 .create_sip_trunk(self.0.request, self.0.options)
20754 .await
20755 .map(crate::Response::into_body)
20756 }
20757
20758 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
20762 self.0.request.parent = v.into();
20763 self
20764 }
20765
20766 pub fn set_sip_trunk<T>(mut self, v: T) -> Self
20770 where
20771 T: std::convert::Into<crate::model::SipTrunk>,
20772 {
20773 self.0.request.sip_trunk = std::option::Option::Some(v.into());
20774 self
20775 }
20776
20777 pub fn set_or_clear_sip_trunk<T>(mut self, v: std::option::Option<T>) -> Self
20781 where
20782 T: std::convert::Into<crate::model::SipTrunk>,
20783 {
20784 self.0.request.sip_trunk = v.map(|x| x.into());
20785 self
20786 }
20787 }
20788
20789 #[doc(hidden)]
20790 impl crate::RequestBuilder for CreateSipTrunk {
20791 fn request_options(&mut self) -> &mut crate::RequestOptions {
20792 &mut self.0.options
20793 }
20794 }
20795
20796 #[derive(Clone, Debug)]
20813 pub struct DeleteSipTrunk(RequestBuilder<crate::model::DeleteSipTrunkRequest>);
20814
20815 impl DeleteSipTrunk {
20816 pub(crate) fn new(
20817 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20818 ) -> Self {
20819 Self(RequestBuilder::new(stub))
20820 }
20821
20822 pub fn with_request<V: Into<crate::model::DeleteSipTrunkRequest>>(mut self, v: V) -> Self {
20824 self.0.request = v.into();
20825 self
20826 }
20827
20828 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20830 self.0.options = v.into();
20831 self
20832 }
20833
20834 pub async fn send(self) -> Result<()> {
20836 (*self.0.stub)
20837 .delete_sip_trunk(self.0.request, self.0.options)
20838 .await
20839 .map(crate::Response::into_body)
20840 }
20841
20842 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
20846 self.0.request.name = v.into();
20847 self
20848 }
20849 }
20850
20851 #[doc(hidden)]
20852 impl crate::RequestBuilder for DeleteSipTrunk {
20853 fn request_options(&mut self) -> &mut crate::RequestOptions {
20854 &mut self.0.options
20855 }
20856 }
20857
20858 #[derive(Clone, Debug)]
20879 pub struct ListSipTrunks(RequestBuilder<crate::model::ListSipTrunksRequest>);
20880
20881 impl ListSipTrunks {
20882 pub(crate) fn new(
20883 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20884 ) -> Self {
20885 Self(RequestBuilder::new(stub))
20886 }
20887
20888 pub fn with_request<V: Into<crate::model::ListSipTrunksRequest>>(mut self, v: V) -> Self {
20890 self.0.request = v.into();
20891 self
20892 }
20893
20894 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20896 self.0.options = v.into();
20897 self
20898 }
20899
20900 pub async fn send(self) -> Result<crate::model::ListSipTrunksResponse> {
20902 (*self.0.stub)
20903 .list_sip_trunks(self.0.request, self.0.options)
20904 .await
20905 .map(crate::Response::into_body)
20906 }
20907
20908 pub fn by_page(
20910 self,
20911 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListSipTrunksResponse, crate::Error>
20912 {
20913 use std::clone::Clone;
20914 let token = self.0.request.page_token.clone();
20915 let execute = move |token: String| {
20916 let mut builder = self.clone();
20917 builder.0.request = builder.0.request.set_page_token(token);
20918 builder.send()
20919 };
20920 google_cloud_gax::paginator::internal::new_paginator(token, execute)
20921 }
20922
20923 pub fn by_item(
20925 self,
20926 ) -> impl google_cloud_gax::paginator::ItemPaginator<
20927 crate::model::ListSipTrunksResponse,
20928 crate::Error,
20929 > {
20930 use google_cloud_gax::paginator::Paginator;
20931 self.by_page().items()
20932 }
20933
20934 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
20938 self.0.request.parent = v.into();
20939 self
20940 }
20941
20942 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
20944 self.0.request.page_size = v.into();
20945 self
20946 }
20947
20948 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
20950 self.0.request.page_token = v.into();
20951 self
20952 }
20953 }
20954
20955 #[doc(hidden)]
20956 impl crate::RequestBuilder for ListSipTrunks {
20957 fn request_options(&mut self) -> &mut crate::RequestOptions {
20958 &mut self.0.options
20959 }
20960 }
20961
20962 #[derive(Clone, Debug)]
20979 pub struct GetSipTrunk(RequestBuilder<crate::model::GetSipTrunkRequest>);
20980
20981 impl GetSipTrunk {
20982 pub(crate) fn new(
20983 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
20984 ) -> Self {
20985 Self(RequestBuilder::new(stub))
20986 }
20987
20988 pub fn with_request<V: Into<crate::model::GetSipTrunkRequest>>(mut self, v: V) -> Self {
20990 self.0.request = v.into();
20991 self
20992 }
20993
20994 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
20996 self.0.options = v.into();
20997 self
20998 }
20999
21000 pub async fn send(self) -> Result<crate::model::SipTrunk> {
21002 (*self.0.stub)
21003 .get_sip_trunk(self.0.request, self.0.options)
21004 .await
21005 .map(crate::Response::into_body)
21006 }
21007
21008 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21012 self.0.request.name = v.into();
21013 self
21014 }
21015 }
21016
21017 #[doc(hidden)]
21018 impl crate::RequestBuilder for GetSipTrunk {
21019 fn request_options(&mut self) -> &mut crate::RequestOptions {
21020 &mut self.0.options
21021 }
21022 }
21023
21024 #[derive(Clone, Debug)]
21041 pub struct UpdateSipTrunk(RequestBuilder<crate::model::UpdateSipTrunkRequest>);
21042
21043 impl UpdateSipTrunk {
21044 pub(crate) fn new(
21045 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21046 ) -> Self {
21047 Self(RequestBuilder::new(stub))
21048 }
21049
21050 pub fn with_request<V: Into<crate::model::UpdateSipTrunkRequest>>(mut self, v: V) -> Self {
21052 self.0.request = v.into();
21053 self
21054 }
21055
21056 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21058 self.0.options = v.into();
21059 self
21060 }
21061
21062 pub async fn send(self) -> Result<crate::model::SipTrunk> {
21064 (*self.0.stub)
21065 .update_sip_trunk(self.0.request, self.0.options)
21066 .await
21067 .map(crate::Response::into_body)
21068 }
21069
21070 pub fn set_sip_trunk<T>(mut self, v: T) -> Self
21074 where
21075 T: std::convert::Into<crate::model::SipTrunk>,
21076 {
21077 self.0.request.sip_trunk = std::option::Option::Some(v.into());
21078 self
21079 }
21080
21081 pub fn set_or_clear_sip_trunk<T>(mut self, v: std::option::Option<T>) -> Self
21085 where
21086 T: std::convert::Into<crate::model::SipTrunk>,
21087 {
21088 self.0.request.sip_trunk = v.map(|x| x.into());
21089 self
21090 }
21091
21092 pub fn set_update_mask<T>(mut self, v: T) -> Self
21094 where
21095 T: std::convert::Into<wkt::FieldMask>,
21096 {
21097 self.0.request.update_mask = std::option::Option::Some(v.into());
21098 self
21099 }
21100
21101 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
21103 where
21104 T: std::convert::Into<wkt::FieldMask>,
21105 {
21106 self.0.request.update_mask = v.map(|x| x.into());
21107 self
21108 }
21109 }
21110
21111 #[doc(hidden)]
21112 impl crate::RequestBuilder for UpdateSipTrunk {
21113 fn request_options(&mut self) -> &mut crate::RequestOptions {
21114 &mut self.0.options
21115 }
21116 }
21117
21118 #[derive(Clone, Debug)]
21139 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
21140
21141 impl ListLocations {
21142 pub(crate) fn new(
21143 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21144 ) -> Self {
21145 Self(RequestBuilder::new(stub))
21146 }
21147
21148 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
21150 mut self,
21151 v: V,
21152 ) -> Self {
21153 self.0.request = v.into();
21154 self
21155 }
21156
21157 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21159 self.0.options = v.into();
21160 self
21161 }
21162
21163 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
21165 (*self.0.stub)
21166 .list_locations(self.0.request, self.0.options)
21167 .await
21168 .map(crate::Response::into_body)
21169 }
21170
21171 pub fn by_page(
21173 self,
21174 ) -> impl google_cloud_gax::paginator::Paginator<
21175 google_cloud_location::model::ListLocationsResponse,
21176 crate::Error,
21177 > {
21178 use std::clone::Clone;
21179 let token = self.0.request.page_token.clone();
21180 let execute = move |token: String| {
21181 let mut builder = self.clone();
21182 builder.0.request = builder.0.request.set_page_token(token);
21183 builder.send()
21184 };
21185 google_cloud_gax::paginator::internal::new_paginator(token, execute)
21186 }
21187
21188 pub fn by_item(
21190 self,
21191 ) -> impl google_cloud_gax::paginator::ItemPaginator<
21192 google_cloud_location::model::ListLocationsResponse,
21193 crate::Error,
21194 > {
21195 use google_cloud_gax::paginator::Paginator;
21196 self.by_page().items()
21197 }
21198
21199 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21201 self.0.request.name = v.into();
21202 self
21203 }
21204
21205 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
21207 self.0.request.filter = v.into();
21208 self
21209 }
21210
21211 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
21213 self.0.request.page_size = v.into();
21214 self
21215 }
21216
21217 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
21219 self.0.request.page_token = v.into();
21220 self
21221 }
21222 }
21223
21224 #[doc(hidden)]
21225 impl crate::RequestBuilder for ListLocations {
21226 fn request_options(&mut self) -> &mut crate::RequestOptions {
21227 &mut self.0.options
21228 }
21229 }
21230
21231 #[derive(Clone, Debug)]
21248 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
21249
21250 impl GetLocation {
21251 pub(crate) fn new(
21252 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21253 ) -> Self {
21254 Self(RequestBuilder::new(stub))
21255 }
21256
21257 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
21259 mut self,
21260 v: V,
21261 ) -> Self {
21262 self.0.request = v.into();
21263 self
21264 }
21265
21266 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21268 self.0.options = v.into();
21269 self
21270 }
21271
21272 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
21274 (*self.0.stub)
21275 .get_location(self.0.request, self.0.options)
21276 .await
21277 .map(crate::Response::into_body)
21278 }
21279
21280 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21282 self.0.request.name = v.into();
21283 self
21284 }
21285 }
21286
21287 #[doc(hidden)]
21288 impl crate::RequestBuilder for GetLocation {
21289 fn request_options(&mut self) -> &mut crate::RequestOptions {
21290 &mut self.0.options
21291 }
21292 }
21293
21294 #[derive(Clone, Debug)]
21315 pub struct ListOperations(
21316 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
21317 );
21318
21319 impl ListOperations {
21320 pub(crate) fn new(
21321 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21322 ) -> Self {
21323 Self(RequestBuilder::new(stub))
21324 }
21325
21326 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
21328 mut self,
21329 v: V,
21330 ) -> Self {
21331 self.0.request = v.into();
21332 self
21333 }
21334
21335 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21337 self.0.options = v.into();
21338 self
21339 }
21340
21341 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
21343 (*self.0.stub)
21344 .list_operations(self.0.request, self.0.options)
21345 .await
21346 .map(crate::Response::into_body)
21347 }
21348
21349 pub fn by_page(
21351 self,
21352 ) -> impl google_cloud_gax::paginator::Paginator<
21353 google_cloud_longrunning::model::ListOperationsResponse,
21354 crate::Error,
21355 > {
21356 use std::clone::Clone;
21357 let token = self.0.request.page_token.clone();
21358 let execute = move |token: String| {
21359 let mut builder = self.clone();
21360 builder.0.request = builder.0.request.set_page_token(token);
21361 builder.send()
21362 };
21363 google_cloud_gax::paginator::internal::new_paginator(token, execute)
21364 }
21365
21366 pub fn by_item(
21368 self,
21369 ) -> impl google_cloud_gax::paginator::ItemPaginator<
21370 google_cloud_longrunning::model::ListOperationsResponse,
21371 crate::Error,
21372 > {
21373 use google_cloud_gax::paginator::Paginator;
21374 self.by_page().items()
21375 }
21376
21377 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21379 self.0.request.name = v.into();
21380 self
21381 }
21382
21383 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
21385 self.0.request.filter = v.into();
21386 self
21387 }
21388
21389 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
21391 self.0.request.page_size = v.into();
21392 self
21393 }
21394
21395 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
21397 self.0.request.page_token = v.into();
21398 self
21399 }
21400
21401 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
21403 self.0.request.return_partial_success = v.into();
21404 self
21405 }
21406 }
21407
21408 #[doc(hidden)]
21409 impl crate::RequestBuilder for ListOperations {
21410 fn request_options(&mut self) -> &mut crate::RequestOptions {
21411 &mut self.0.options
21412 }
21413 }
21414
21415 #[derive(Clone, Debug)]
21432 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
21433
21434 impl GetOperation {
21435 pub(crate) fn new(
21436 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21437 ) -> Self {
21438 Self(RequestBuilder::new(stub))
21439 }
21440
21441 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
21443 mut self,
21444 v: V,
21445 ) -> Self {
21446 self.0.request = v.into();
21447 self
21448 }
21449
21450 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21452 self.0.options = v.into();
21453 self
21454 }
21455
21456 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
21458 (*self.0.stub)
21459 .get_operation(self.0.request, self.0.options)
21460 .await
21461 .map(crate::Response::into_body)
21462 }
21463
21464 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21466 self.0.request.name = v.into();
21467 self
21468 }
21469 }
21470
21471 #[doc(hidden)]
21472 impl crate::RequestBuilder for GetOperation {
21473 fn request_options(&mut self) -> &mut crate::RequestOptions {
21474 &mut self.0.options
21475 }
21476 }
21477
21478 #[derive(Clone, Debug)]
21495 pub struct CancelOperation(
21496 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
21497 );
21498
21499 impl CancelOperation {
21500 pub(crate) fn new(
21501 stub: std::sync::Arc<dyn super::super::stub::dynamic::SipTrunks>,
21502 ) -> Self {
21503 Self(RequestBuilder::new(stub))
21504 }
21505
21506 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
21508 mut self,
21509 v: V,
21510 ) -> Self {
21511 self.0.request = v.into();
21512 self
21513 }
21514
21515 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21517 self.0.options = v.into();
21518 self
21519 }
21520
21521 pub async fn send(self) -> Result<()> {
21523 (*self.0.stub)
21524 .cancel_operation(self.0.request, self.0.options)
21525 .await
21526 .map(crate::Response::into_body)
21527 }
21528
21529 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21531 self.0.request.name = v.into();
21532 self
21533 }
21534 }
21535
21536 #[doc(hidden)]
21537 impl crate::RequestBuilder for CancelOperation {
21538 fn request_options(&mut self) -> &mut crate::RequestOptions {
21539 &mut self.0.options
21540 }
21541 }
21542}
21543
21544#[cfg(feature = "tools")]
21546#[cfg_attr(docsrs, doc(cfg(feature = "tools")))]
21547pub mod tools {
21548 use crate::Result;
21549
21550 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
21564
21565 pub(crate) mod client {
21566 use super::super::super::client::Tools;
21567 pub struct Factory;
21568 impl crate::ClientFactory for Factory {
21569 type Client = Tools;
21570 type Credentials = gaxi::options::Credentials;
21571 async fn build(
21572 self,
21573 config: gaxi::options::ClientConfig,
21574 ) -> crate::ClientBuilderResult<Self::Client> {
21575 Self::Client::new(config).await
21576 }
21577 }
21578 }
21579
21580 #[derive(Clone, Debug)]
21582 pub(crate) struct RequestBuilder<R: std::default::Default> {
21583 stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>,
21584 request: R,
21585 options: crate::RequestOptions,
21586 }
21587
21588 impl<R> RequestBuilder<R>
21589 where
21590 R: std::default::Default,
21591 {
21592 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21593 Self {
21594 stub,
21595 request: R::default(),
21596 options: crate::RequestOptions::default(),
21597 }
21598 }
21599 }
21600
21601 #[derive(Clone, Debug)]
21618 pub struct CreateTool(RequestBuilder<crate::model::CreateToolRequest>);
21619
21620 impl CreateTool {
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<crate::model::CreateToolRequest>>(mut self, v: V) -> Self {
21627 self.0.request = v.into();
21628 self
21629 }
21630
21631 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21633 self.0.options = v.into();
21634 self
21635 }
21636
21637 pub async fn send(self) -> Result<crate::model::Tool> {
21639 (*self.0.stub)
21640 .create_tool(self.0.request, self.0.options)
21641 .await
21642 .map(crate::Response::into_body)
21643 }
21644
21645 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
21649 self.0.request.parent = v.into();
21650 self
21651 }
21652
21653 pub fn set_tool<T>(mut self, v: T) -> Self
21657 where
21658 T: std::convert::Into<crate::model::Tool>,
21659 {
21660 self.0.request.tool = std::option::Option::Some(v.into());
21661 self
21662 }
21663
21664 pub fn set_or_clear_tool<T>(mut self, v: std::option::Option<T>) -> Self
21668 where
21669 T: std::convert::Into<crate::model::Tool>,
21670 {
21671 self.0.request.tool = v.map(|x| x.into());
21672 self
21673 }
21674
21675 pub fn set_tool_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
21677 self.0.request.tool_id = v.into();
21678 self
21679 }
21680 }
21681
21682 #[doc(hidden)]
21683 impl crate::RequestBuilder for CreateTool {
21684 fn request_options(&mut self) -> &mut crate::RequestOptions {
21685 &mut self.0.options
21686 }
21687 }
21688
21689 #[derive(Clone, Debug)]
21706 pub struct GetTool(RequestBuilder<crate::model::GetToolRequest>);
21707
21708 impl GetTool {
21709 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21710 Self(RequestBuilder::new(stub))
21711 }
21712
21713 pub fn with_request<V: Into<crate::model::GetToolRequest>>(mut self, v: V) -> Self {
21715 self.0.request = v.into();
21716 self
21717 }
21718
21719 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21721 self.0.options = v.into();
21722 self
21723 }
21724
21725 pub async fn send(self) -> Result<crate::model::Tool> {
21727 (*self.0.stub)
21728 .get_tool(self.0.request, self.0.options)
21729 .await
21730 .map(crate::Response::into_body)
21731 }
21732
21733 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21737 self.0.request.name = v.into();
21738 self
21739 }
21740 }
21741
21742 #[doc(hidden)]
21743 impl crate::RequestBuilder for GetTool {
21744 fn request_options(&mut self) -> &mut crate::RequestOptions {
21745 &mut self.0.options
21746 }
21747 }
21748
21749 #[derive(Clone, Debug)]
21770 pub struct ListTools(RequestBuilder<crate::model::ListToolsRequest>);
21771
21772 impl ListTools {
21773 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21774 Self(RequestBuilder::new(stub))
21775 }
21776
21777 pub fn with_request<V: Into<crate::model::ListToolsRequest>>(mut self, v: V) -> Self {
21779 self.0.request = v.into();
21780 self
21781 }
21782
21783 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21785 self.0.options = v.into();
21786 self
21787 }
21788
21789 pub async fn send(self) -> Result<crate::model::ListToolsResponse> {
21791 (*self.0.stub)
21792 .list_tools(self.0.request, self.0.options)
21793 .await
21794 .map(crate::Response::into_body)
21795 }
21796
21797 pub fn by_page(
21799 self,
21800 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListToolsResponse, crate::Error>
21801 {
21802 use std::clone::Clone;
21803 let token = self.0.request.page_token.clone();
21804 let execute = move |token: String| {
21805 let mut builder = self.clone();
21806 builder.0.request = builder.0.request.set_page_token(token);
21807 builder.send()
21808 };
21809 google_cloud_gax::paginator::internal::new_paginator(token, execute)
21810 }
21811
21812 pub fn by_item(
21814 self,
21815 ) -> impl google_cloud_gax::paginator::ItemPaginator<crate::model::ListToolsResponse, crate::Error>
21816 {
21817 use google_cloud_gax::paginator::Paginator;
21818 self.by_page().items()
21819 }
21820
21821 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
21825 self.0.request.parent = v.into();
21826 self
21827 }
21828
21829 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
21831 self.0.request.page_size = v.into();
21832 self
21833 }
21834
21835 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
21837 self.0.request.page_token = v.into();
21838 self
21839 }
21840 }
21841
21842 #[doc(hidden)]
21843 impl crate::RequestBuilder for ListTools {
21844 fn request_options(&mut self) -> &mut crate::RequestOptions {
21845 &mut self.0.options
21846 }
21847 }
21848
21849 #[derive(Clone, Debug)]
21866 pub struct DeleteTool(RequestBuilder<crate::model::DeleteToolRequest>);
21867
21868 impl DeleteTool {
21869 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21870 Self(RequestBuilder::new(stub))
21871 }
21872
21873 pub fn with_request<V: Into<crate::model::DeleteToolRequest>>(mut self, v: V) -> Self {
21875 self.0.request = v.into();
21876 self
21877 }
21878
21879 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21881 self.0.options = v.into();
21882 self
21883 }
21884
21885 pub async fn send(self) -> Result<()> {
21887 (*self.0.stub)
21888 .delete_tool(self.0.request, self.0.options)
21889 .await
21890 .map(crate::Response::into_body)
21891 }
21892
21893 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
21897 self.0.request.name = v.into();
21898 self
21899 }
21900 }
21901
21902 #[doc(hidden)]
21903 impl crate::RequestBuilder for DeleteTool {
21904 fn request_options(&mut self) -> &mut crate::RequestOptions {
21905 &mut self.0.options
21906 }
21907 }
21908
21909 #[derive(Clone, Debug)]
21926 pub struct UpdateTool(RequestBuilder<crate::model::UpdateToolRequest>);
21927
21928 impl UpdateTool {
21929 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
21930 Self(RequestBuilder::new(stub))
21931 }
21932
21933 pub fn with_request<V: Into<crate::model::UpdateToolRequest>>(mut self, v: V) -> Self {
21935 self.0.request = v.into();
21936 self
21937 }
21938
21939 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
21941 self.0.options = v.into();
21942 self
21943 }
21944
21945 pub async fn send(self) -> Result<crate::model::Tool> {
21947 (*self.0.stub)
21948 .update_tool(self.0.request, self.0.options)
21949 .await
21950 .map(crate::Response::into_body)
21951 }
21952
21953 pub fn set_tool<T>(mut self, v: T) -> Self
21957 where
21958 T: std::convert::Into<crate::model::Tool>,
21959 {
21960 self.0.request.tool = std::option::Option::Some(v.into());
21961 self
21962 }
21963
21964 pub fn set_or_clear_tool<T>(mut self, v: std::option::Option<T>) -> Self
21968 where
21969 T: std::convert::Into<crate::model::Tool>,
21970 {
21971 self.0.request.tool = v.map(|x| x.into());
21972 self
21973 }
21974
21975 pub fn set_update_mask<T>(mut self, v: T) -> Self
21977 where
21978 T: std::convert::Into<wkt::FieldMask>,
21979 {
21980 self.0.request.update_mask = std::option::Option::Some(v.into());
21981 self
21982 }
21983
21984 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
21986 where
21987 T: std::convert::Into<wkt::FieldMask>,
21988 {
21989 self.0.request.update_mask = v.map(|x| x.into());
21990 self
21991 }
21992 }
21993
21994 #[doc(hidden)]
21995 impl crate::RequestBuilder for UpdateTool {
21996 fn request_options(&mut self) -> &mut crate::RequestOptions {
21997 &mut self.0.options
21998 }
21999 }
22000
22001 #[derive(Clone, Debug)]
22022 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
22023
22024 impl ListLocations {
22025 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
22026 Self(RequestBuilder::new(stub))
22027 }
22028
22029 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
22031 mut self,
22032 v: V,
22033 ) -> Self {
22034 self.0.request = v.into();
22035 self
22036 }
22037
22038 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22040 self.0.options = v.into();
22041 self
22042 }
22043
22044 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
22046 (*self.0.stub)
22047 .list_locations(self.0.request, self.0.options)
22048 .await
22049 .map(crate::Response::into_body)
22050 }
22051
22052 pub fn by_page(
22054 self,
22055 ) -> impl google_cloud_gax::paginator::Paginator<
22056 google_cloud_location::model::ListLocationsResponse,
22057 crate::Error,
22058 > {
22059 use std::clone::Clone;
22060 let token = self.0.request.page_token.clone();
22061 let execute = move |token: String| {
22062 let mut builder = self.clone();
22063 builder.0.request = builder.0.request.set_page_token(token);
22064 builder.send()
22065 };
22066 google_cloud_gax::paginator::internal::new_paginator(token, execute)
22067 }
22068
22069 pub fn by_item(
22071 self,
22072 ) -> impl google_cloud_gax::paginator::ItemPaginator<
22073 google_cloud_location::model::ListLocationsResponse,
22074 crate::Error,
22075 > {
22076 use google_cloud_gax::paginator::Paginator;
22077 self.by_page().items()
22078 }
22079
22080 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22082 self.0.request.name = v.into();
22083 self
22084 }
22085
22086 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
22088 self.0.request.filter = v.into();
22089 self
22090 }
22091
22092 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
22094 self.0.request.page_size = v.into();
22095 self
22096 }
22097
22098 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
22100 self.0.request.page_token = v.into();
22101 self
22102 }
22103 }
22104
22105 #[doc(hidden)]
22106 impl crate::RequestBuilder for ListLocations {
22107 fn request_options(&mut self) -> &mut crate::RequestOptions {
22108 &mut self.0.options
22109 }
22110 }
22111
22112 #[derive(Clone, Debug)]
22129 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
22130
22131 impl GetLocation {
22132 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
22133 Self(RequestBuilder::new(stub))
22134 }
22135
22136 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
22138 mut self,
22139 v: V,
22140 ) -> Self {
22141 self.0.request = v.into();
22142 self
22143 }
22144
22145 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22147 self.0.options = v.into();
22148 self
22149 }
22150
22151 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
22153 (*self.0.stub)
22154 .get_location(self.0.request, self.0.options)
22155 .await
22156 .map(crate::Response::into_body)
22157 }
22158
22159 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22161 self.0.request.name = v.into();
22162 self
22163 }
22164 }
22165
22166 #[doc(hidden)]
22167 impl crate::RequestBuilder for GetLocation {
22168 fn request_options(&mut self) -> &mut crate::RequestOptions {
22169 &mut self.0.options
22170 }
22171 }
22172
22173 #[derive(Clone, Debug)]
22194 pub struct ListOperations(
22195 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
22196 );
22197
22198 impl ListOperations {
22199 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
22200 Self(RequestBuilder::new(stub))
22201 }
22202
22203 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
22205 mut self,
22206 v: V,
22207 ) -> Self {
22208 self.0.request = v.into();
22209 self
22210 }
22211
22212 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22214 self.0.options = v.into();
22215 self
22216 }
22217
22218 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
22220 (*self.0.stub)
22221 .list_operations(self.0.request, self.0.options)
22222 .await
22223 .map(crate::Response::into_body)
22224 }
22225
22226 pub fn by_page(
22228 self,
22229 ) -> impl google_cloud_gax::paginator::Paginator<
22230 google_cloud_longrunning::model::ListOperationsResponse,
22231 crate::Error,
22232 > {
22233 use std::clone::Clone;
22234 let token = self.0.request.page_token.clone();
22235 let execute = move |token: String| {
22236 let mut builder = self.clone();
22237 builder.0.request = builder.0.request.set_page_token(token);
22238 builder.send()
22239 };
22240 google_cloud_gax::paginator::internal::new_paginator(token, execute)
22241 }
22242
22243 pub fn by_item(
22245 self,
22246 ) -> impl google_cloud_gax::paginator::ItemPaginator<
22247 google_cloud_longrunning::model::ListOperationsResponse,
22248 crate::Error,
22249 > {
22250 use google_cloud_gax::paginator::Paginator;
22251 self.by_page().items()
22252 }
22253
22254 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22256 self.0.request.name = v.into();
22257 self
22258 }
22259
22260 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
22262 self.0.request.filter = v.into();
22263 self
22264 }
22265
22266 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
22268 self.0.request.page_size = v.into();
22269 self
22270 }
22271
22272 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
22274 self.0.request.page_token = v.into();
22275 self
22276 }
22277
22278 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
22280 self.0.request.return_partial_success = v.into();
22281 self
22282 }
22283 }
22284
22285 #[doc(hidden)]
22286 impl crate::RequestBuilder for ListOperations {
22287 fn request_options(&mut self) -> &mut crate::RequestOptions {
22288 &mut self.0.options
22289 }
22290 }
22291
22292 #[derive(Clone, Debug)]
22309 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
22310
22311 impl GetOperation {
22312 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
22313 Self(RequestBuilder::new(stub))
22314 }
22315
22316 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
22318 mut self,
22319 v: V,
22320 ) -> Self {
22321 self.0.request = v.into();
22322 self
22323 }
22324
22325 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22327 self.0.options = v.into();
22328 self
22329 }
22330
22331 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
22333 (*self.0.stub)
22334 .get_operation(self.0.request, self.0.options)
22335 .await
22336 .map(crate::Response::into_body)
22337 }
22338
22339 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22341 self.0.request.name = v.into();
22342 self
22343 }
22344 }
22345
22346 #[doc(hidden)]
22347 impl crate::RequestBuilder for GetOperation {
22348 fn request_options(&mut self) -> &mut crate::RequestOptions {
22349 &mut self.0.options
22350 }
22351 }
22352
22353 #[derive(Clone, Debug)]
22370 pub struct CancelOperation(
22371 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
22372 );
22373
22374 impl CancelOperation {
22375 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Tools>) -> Self {
22376 Self(RequestBuilder::new(stub))
22377 }
22378
22379 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
22381 mut self,
22382 v: V,
22383 ) -> Self {
22384 self.0.request = v.into();
22385 self
22386 }
22387
22388 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22390 self.0.options = v.into();
22391 self
22392 }
22393
22394 pub async fn send(self) -> Result<()> {
22396 (*self.0.stub)
22397 .cancel_operation(self.0.request, self.0.options)
22398 .await
22399 .map(crate::Response::into_body)
22400 }
22401
22402 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22404 self.0.request.name = v.into();
22405 self
22406 }
22407 }
22408
22409 #[doc(hidden)]
22410 impl crate::RequestBuilder for CancelOperation {
22411 fn request_options(&mut self) -> &mut crate::RequestOptions {
22412 &mut self.0.options
22413 }
22414 }
22415}
22416
22417#[cfg(feature = "versions")]
22419#[cfg_attr(docsrs, doc(cfg(feature = "versions")))]
22420pub mod versions {
22421 use crate::Result;
22422
22423 pub type ClientBuilder = crate::ClientBuilder<client::Factory, gaxi::options::Credentials>;
22437
22438 pub(crate) mod client {
22439 use super::super::super::client::Versions;
22440 pub struct Factory;
22441 impl crate::ClientFactory for Factory {
22442 type Client = Versions;
22443 type Credentials = gaxi::options::Credentials;
22444 async fn build(
22445 self,
22446 config: gaxi::options::ClientConfig,
22447 ) -> crate::ClientBuilderResult<Self::Client> {
22448 Self::Client::new(config).await
22449 }
22450 }
22451 }
22452
22453 #[derive(Clone, Debug)]
22455 pub(crate) struct RequestBuilder<R: std::default::Default> {
22456 stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>,
22457 request: R,
22458 options: crate::RequestOptions,
22459 }
22460
22461 impl<R> RequestBuilder<R>
22462 where
22463 R: std::default::Default,
22464 {
22465 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22466 Self {
22467 stub,
22468 request: R::default(),
22469 options: crate::RequestOptions::default(),
22470 }
22471 }
22472 }
22473
22474 #[derive(Clone, Debug)]
22495 pub struct ListVersions(RequestBuilder<crate::model::ListVersionsRequest>);
22496
22497 impl ListVersions {
22498 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22499 Self(RequestBuilder::new(stub))
22500 }
22501
22502 pub fn with_request<V: Into<crate::model::ListVersionsRequest>>(mut self, v: V) -> Self {
22504 self.0.request = v.into();
22505 self
22506 }
22507
22508 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22510 self.0.options = v.into();
22511 self
22512 }
22513
22514 pub async fn send(self) -> Result<crate::model::ListVersionsResponse> {
22516 (*self.0.stub)
22517 .list_versions(self.0.request, self.0.options)
22518 .await
22519 .map(crate::Response::into_body)
22520 }
22521
22522 pub fn by_page(
22524 self,
22525 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListVersionsResponse, crate::Error>
22526 {
22527 use std::clone::Clone;
22528 let token = self.0.request.page_token.clone();
22529 let execute = move |token: String| {
22530 let mut builder = self.clone();
22531 builder.0.request = builder.0.request.set_page_token(token);
22532 builder.send()
22533 };
22534 google_cloud_gax::paginator::internal::new_paginator(token, execute)
22535 }
22536
22537 pub fn by_item(
22539 self,
22540 ) -> impl google_cloud_gax::paginator::ItemPaginator<
22541 crate::model::ListVersionsResponse,
22542 crate::Error,
22543 > {
22544 use google_cloud_gax::paginator::Paginator;
22545 self.by_page().items()
22546 }
22547
22548 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
22552 self.0.request.parent = v.into();
22553 self
22554 }
22555
22556 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
22558 self.0.request.page_size = v.into();
22559 self
22560 }
22561
22562 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
22564 self.0.request.page_token = v.into();
22565 self
22566 }
22567 }
22568
22569 #[doc(hidden)]
22570 impl crate::RequestBuilder for ListVersions {
22571 fn request_options(&mut self) -> &mut crate::RequestOptions {
22572 &mut self.0.options
22573 }
22574 }
22575
22576 #[derive(Clone, Debug)]
22593 pub struct GetVersion(RequestBuilder<crate::model::GetVersionRequest>);
22594
22595 impl GetVersion {
22596 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22597 Self(RequestBuilder::new(stub))
22598 }
22599
22600 pub fn with_request<V: Into<crate::model::GetVersionRequest>>(mut self, v: V) -> Self {
22602 self.0.request = v.into();
22603 self
22604 }
22605
22606 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22608 self.0.options = v.into();
22609 self
22610 }
22611
22612 pub async fn send(self) -> Result<crate::model::Version> {
22614 (*self.0.stub)
22615 .get_version(self.0.request, self.0.options)
22616 .await
22617 .map(crate::Response::into_body)
22618 }
22619
22620 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22624 self.0.request.name = v.into();
22625 self
22626 }
22627 }
22628
22629 #[doc(hidden)]
22630 impl crate::RequestBuilder for GetVersion {
22631 fn request_options(&mut self) -> &mut crate::RequestOptions {
22632 &mut self.0.options
22633 }
22634 }
22635
22636 #[derive(Clone, Debug)]
22653 pub struct CreateVersion(RequestBuilder<crate::model::CreateVersionRequest>);
22654
22655 impl CreateVersion {
22656 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22657 Self(RequestBuilder::new(stub))
22658 }
22659
22660 pub fn with_request<V: Into<crate::model::CreateVersionRequest>>(mut self, v: V) -> Self {
22662 self.0.request = v.into();
22663 self
22664 }
22665
22666 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22668 self.0.options = v.into();
22669 self
22670 }
22671
22672 pub async fn send(self) -> Result<crate::model::Version> {
22674 (*self.0.stub)
22675 .create_version(self.0.request, self.0.options)
22676 .await
22677 .map(crate::Response::into_body)
22678 }
22679
22680 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
22684 self.0.request.parent = v.into();
22685 self
22686 }
22687
22688 pub fn set_version<T>(mut self, v: T) -> Self
22692 where
22693 T: std::convert::Into<crate::model::Version>,
22694 {
22695 self.0.request.version = std::option::Option::Some(v.into());
22696 self
22697 }
22698
22699 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
22703 where
22704 T: std::convert::Into<crate::model::Version>,
22705 {
22706 self.0.request.version = v.map(|x| x.into());
22707 self
22708 }
22709 }
22710
22711 #[doc(hidden)]
22712 impl crate::RequestBuilder for CreateVersion {
22713 fn request_options(&mut self) -> &mut crate::RequestOptions {
22714 &mut self.0.options
22715 }
22716 }
22717
22718 #[derive(Clone, Debug)]
22735 pub struct UpdateVersion(RequestBuilder<crate::model::UpdateVersionRequest>);
22736
22737 impl UpdateVersion {
22738 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22739 Self(RequestBuilder::new(stub))
22740 }
22741
22742 pub fn with_request<V: Into<crate::model::UpdateVersionRequest>>(mut self, v: V) -> Self {
22744 self.0.request = v.into();
22745 self
22746 }
22747
22748 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22750 self.0.options = v.into();
22751 self
22752 }
22753
22754 pub async fn send(self) -> Result<crate::model::Version> {
22756 (*self.0.stub)
22757 .update_version(self.0.request, self.0.options)
22758 .await
22759 .map(crate::Response::into_body)
22760 }
22761
22762 pub fn set_version<T>(mut self, v: T) -> Self
22766 where
22767 T: std::convert::Into<crate::model::Version>,
22768 {
22769 self.0.request.version = std::option::Option::Some(v.into());
22770 self
22771 }
22772
22773 pub fn set_or_clear_version<T>(mut self, v: std::option::Option<T>) -> Self
22777 where
22778 T: std::convert::Into<crate::model::Version>,
22779 {
22780 self.0.request.version = v.map(|x| x.into());
22781 self
22782 }
22783
22784 pub fn set_update_mask<T>(mut self, v: T) -> Self
22788 where
22789 T: std::convert::Into<wkt::FieldMask>,
22790 {
22791 self.0.request.update_mask = std::option::Option::Some(v.into());
22792 self
22793 }
22794
22795 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
22799 where
22800 T: std::convert::Into<wkt::FieldMask>,
22801 {
22802 self.0.request.update_mask = v.map(|x| x.into());
22803 self
22804 }
22805 }
22806
22807 #[doc(hidden)]
22808 impl crate::RequestBuilder for UpdateVersion {
22809 fn request_options(&mut self) -> &mut crate::RequestOptions {
22810 &mut self.0.options
22811 }
22812 }
22813
22814 #[derive(Clone, Debug)]
22831 pub struct DeleteVersion(RequestBuilder<crate::model::DeleteVersionRequest>);
22832
22833 impl DeleteVersion {
22834 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22835 Self(RequestBuilder::new(stub))
22836 }
22837
22838 pub fn with_request<V: Into<crate::model::DeleteVersionRequest>>(mut self, v: V) -> Self {
22840 self.0.request = v.into();
22841 self
22842 }
22843
22844 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22846 self.0.options = v.into();
22847 self
22848 }
22849
22850 pub async fn send(self) -> Result<()> {
22852 (*self.0.stub)
22853 .delete_version(self.0.request, self.0.options)
22854 .await
22855 .map(crate::Response::into_body)
22856 }
22857
22858 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22862 self.0.request.name = v.into();
22863 self
22864 }
22865 }
22866
22867 #[doc(hidden)]
22868 impl crate::RequestBuilder for DeleteVersion {
22869 fn request_options(&mut self) -> &mut crate::RequestOptions {
22870 &mut self.0.options
22871 }
22872 }
22873
22874 #[derive(Clone, Debug)]
22895 pub struct ListLocations(RequestBuilder<google_cloud_location::model::ListLocationsRequest>);
22896
22897 impl ListLocations {
22898 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
22899 Self(RequestBuilder::new(stub))
22900 }
22901
22902 pub fn with_request<V: Into<google_cloud_location::model::ListLocationsRequest>>(
22904 mut self,
22905 v: V,
22906 ) -> Self {
22907 self.0.request = v.into();
22908 self
22909 }
22910
22911 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
22913 self.0.options = v.into();
22914 self
22915 }
22916
22917 pub async fn send(self) -> Result<google_cloud_location::model::ListLocationsResponse> {
22919 (*self.0.stub)
22920 .list_locations(self.0.request, self.0.options)
22921 .await
22922 .map(crate::Response::into_body)
22923 }
22924
22925 pub fn by_page(
22927 self,
22928 ) -> impl google_cloud_gax::paginator::Paginator<
22929 google_cloud_location::model::ListLocationsResponse,
22930 crate::Error,
22931 > {
22932 use std::clone::Clone;
22933 let token = self.0.request.page_token.clone();
22934 let execute = move |token: String| {
22935 let mut builder = self.clone();
22936 builder.0.request = builder.0.request.set_page_token(token);
22937 builder.send()
22938 };
22939 google_cloud_gax::paginator::internal::new_paginator(token, execute)
22940 }
22941
22942 pub fn by_item(
22944 self,
22945 ) -> impl google_cloud_gax::paginator::ItemPaginator<
22946 google_cloud_location::model::ListLocationsResponse,
22947 crate::Error,
22948 > {
22949 use google_cloud_gax::paginator::Paginator;
22950 self.by_page().items()
22951 }
22952
22953 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
22955 self.0.request.name = v.into();
22956 self
22957 }
22958
22959 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
22961 self.0.request.filter = v.into();
22962 self
22963 }
22964
22965 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
22967 self.0.request.page_size = v.into();
22968 self
22969 }
22970
22971 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
22973 self.0.request.page_token = v.into();
22974 self
22975 }
22976 }
22977
22978 #[doc(hidden)]
22979 impl crate::RequestBuilder for ListLocations {
22980 fn request_options(&mut self) -> &mut crate::RequestOptions {
22981 &mut self.0.options
22982 }
22983 }
22984
22985 #[derive(Clone, Debug)]
23002 pub struct GetLocation(RequestBuilder<google_cloud_location::model::GetLocationRequest>);
23003
23004 impl GetLocation {
23005 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
23006 Self(RequestBuilder::new(stub))
23007 }
23008
23009 pub fn with_request<V: Into<google_cloud_location::model::GetLocationRequest>>(
23011 mut self,
23012 v: V,
23013 ) -> Self {
23014 self.0.request = v.into();
23015 self
23016 }
23017
23018 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
23020 self.0.options = v.into();
23021 self
23022 }
23023
23024 pub async fn send(self) -> Result<google_cloud_location::model::Location> {
23026 (*self.0.stub)
23027 .get_location(self.0.request, self.0.options)
23028 .await
23029 .map(crate::Response::into_body)
23030 }
23031
23032 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
23034 self.0.request.name = v.into();
23035 self
23036 }
23037 }
23038
23039 #[doc(hidden)]
23040 impl crate::RequestBuilder for GetLocation {
23041 fn request_options(&mut self) -> &mut crate::RequestOptions {
23042 &mut self.0.options
23043 }
23044 }
23045
23046 #[derive(Clone, Debug)]
23067 pub struct ListOperations(
23068 RequestBuilder<google_cloud_longrunning::model::ListOperationsRequest>,
23069 );
23070
23071 impl ListOperations {
23072 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
23073 Self(RequestBuilder::new(stub))
23074 }
23075
23076 pub fn with_request<V: Into<google_cloud_longrunning::model::ListOperationsRequest>>(
23078 mut self,
23079 v: V,
23080 ) -> Self {
23081 self.0.request = v.into();
23082 self
23083 }
23084
23085 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
23087 self.0.options = v.into();
23088 self
23089 }
23090
23091 pub async fn send(self) -> Result<google_cloud_longrunning::model::ListOperationsResponse> {
23093 (*self.0.stub)
23094 .list_operations(self.0.request, self.0.options)
23095 .await
23096 .map(crate::Response::into_body)
23097 }
23098
23099 pub fn by_page(
23101 self,
23102 ) -> impl google_cloud_gax::paginator::Paginator<
23103 google_cloud_longrunning::model::ListOperationsResponse,
23104 crate::Error,
23105 > {
23106 use std::clone::Clone;
23107 let token = self.0.request.page_token.clone();
23108 let execute = move |token: String| {
23109 let mut builder = self.clone();
23110 builder.0.request = builder.0.request.set_page_token(token);
23111 builder.send()
23112 };
23113 google_cloud_gax::paginator::internal::new_paginator(token, execute)
23114 }
23115
23116 pub fn by_item(
23118 self,
23119 ) -> impl google_cloud_gax::paginator::ItemPaginator<
23120 google_cloud_longrunning::model::ListOperationsResponse,
23121 crate::Error,
23122 > {
23123 use google_cloud_gax::paginator::Paginator;
23124 self.by_page().items()
23125 }
23126
23127 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
23129 self.0.request.name = v.into();
23130 self
23131 }
23132
23133 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
23135 self.0.request.filter = v.into();
23136 self
23137 }
23138
23139 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
23141 self.0.request.page_size = v.into();
23142 self
23143 }
23144
23145 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
23147 self.0.request.page_token = v.into();
23148 self
23149 }
23150
23151 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
23153 self.0.request.return_partial_success = v.into();
23154 self
23155 }
23156 }
23157
23158 #[doc(hidden)]
23159 impl crate::RequestBuilder for ListOperations {
23160 fn request_options(&mut self) -> &mut crate::RequestOptions {
23161 &mut self.0.options
23162 }
23163 }
23164
23165 #[derive(Clone, Debug)]
23182 pub struct GetOperation(RequestBuilder<google_cloud_longrunning::model::GetOperationRequest>);
23183
23184 impl GetOperation {
23185 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
23186 Self(RequestBuilder::new(stub))
23187 }
23188
23189 pub fn with_request<V: Into<google_cloud_longrunning::model::GetOperationRequest>>(
23191 mut self,
23192 v: V,
23193 ) -> Self {
23194 self.0.request = v.into();
23195 self
23196 }
23197
23198 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
23200 self.0.options = v.into();
23201 self
23202 }
23203
23204 pub async fn send(self) -> Result<google_cloud_longrunning::model::Operation> {
23206 (*self.0.stub)
23207 .get_operation(self.0.request, self.0.options)
23208 .await
23209 .map(crate::Response::into_body)
23210 }
23211
23212 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
23214 self.0.request.name = v.into();
23215 self
23216 }
23217 }
23218
23219 #[doc(hidden)]
23220 impl crate::RequestBuilder for GetOperation {
23221 fn request_options(&mut self) -> &mut crate::RequestOptions {
23222 &mut self.0.options
23223 }
23224 }
23225
23226 #[derive(Clone, Debug)]
23243 pub struct CancelOperation(
23244 RequestBuilder<google_cloud_longrunning::model::CancelOperationRequest>,
23245 );
23246
23247 impl CancelOperation {
23248 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Versions>) -> Self {
23249 Self(RequestBuilder::new(stub))
23250 }
23251
23252 pub fn with_request<V: Into<google_cloud_longrunning::model::CancelOperationRequest>>(
23254 mut self,
23255 v: V,
23256 ) -> Self {
23257 self.0.request = v.into();
23258 self
23259 }
23260
23261 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
23263 self.0.options = v.into();
23264 self
23265 }
23266
23267 pub async fn send(self) -> Result<()> {
23269 (*self.0.stub)
23270 .cancel_operation(self.0.request, self.0.options)
23271 .await
23272 .map(crate::Response::into_body)
23273 }
23274
23275 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
23277 self.0.request.name = v.into();
23278 self
23279 }
23280 }
23281
23282 #[doc(hidden)]
23283 impl crate::RequestBuilder for CancelOperation {
23284 fn request_options(&mut self) -> &mut crate::RequestOptions {
23285 &mut self.0.options
23286 }
23287 }
23288}