google_cloud_ces_v1/client.rs
1// Copyright 2026 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::bare_urls)]
17#![allow(rustdoc::broken_intra_doc_links)]
18#![allow(rustdoc::invalid_html_tags)]
19#![allow(rustdoc::redundant_explicit_links)]
20
21/// Implements a client for the Gemini Enterprise for Customer Experience API.
22///
23/// # Example
24/// ```
25/// # use google_cloud_ces_v1::client::AgentService;
26/// use google_cloud_gax::paginator::ItemPaginator as _;
27/// async fn sample(
28/// project_id: &str,
29/// location_id: &str,
30/// app_id: &str,
31/// ) -> anyhow::Result<()> {
32/// let client = AgentService::builder().build().await?;
33/// let mut list = client.list_agents()
34/// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
35/// .by_item();
36/// while let Some(item) = list.next().await.transpose()? {
37/// println!("{:?}", item);
38/// }
39/// Ok(())
40/// }
41/// ```
42///
43/// # Service Description
44///
45/// The service that manages agent-related resources in Gemini Enterprise for
46/// Customer Engagement (CES).
47///
48/// # Configuration
49///
50/// To configure `AgentService` use the `with_*` methods in the type returned
51/// by [builder()][AgentService::builder]. The default configuration should
52/// work for most applications. Common configuration changes include
53///
54/// * [with_endpoint()]: by default this client uses the global default endpoint
55/// (`https://ces.googleapis.com`). Applications using regional
56/// endpoints or running in restricted networks (e.g. a network configured
57/// with [Private Google Access with VPC Service Controls]) may want to
58/// override this default.
59/// * [with_credentials()]: by default this client uses
60/// [Application Default Credentials]. Applications using custom
61/// authentication may need to override this default.
62///
63/// [with_endpoint()]: super::builder::agent_service::ClientBuilder::with_endpoint
64/// [with_credentials()]: super::builder::agent_service::ClientBuilder::with_credentials
65/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
66/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
67///
68/// # Pooling and Cloning
69///
70/// `AgentService` holds a connection pool internally, it is advised to
71/// create one and reuse it. You do not need to wrap `AgentService` in
72/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
73/// already uses an `Arc` internally.
74#[derive(Clone, Debug)]
75pub struct AgentService {
76 inner: std::sync::Arc<dyn super::stub::dynamic::AgentService>,
77}
78
79impl AgentService {
80 /// Returns a builder for [AgentService].
81 ///
82 /// ```
83 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
84 /// # use google_cloud_ces_v1::client::AgentService;
85 /// let client = AgentService::builder().build().await?;
86 /// # Ok(()) }
87 /// ```
88 pub fn builder() -> super::builder::agent_service::ClientBuilder {
89 crate::new_client_builder(super::builder::agent_service::client::Factory)
90 }
91
92 /// Creates a new client from the provided stub.
93 ///
94 /// The most common case for calling this function is in tests mocking the
95 /// client's behavior.
96 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
97 where
98 T: super::stub::AgentService + 'static,
99 {
100 Self { inner: stub.into() }
101 }
102
103 pub(crate) async fn new(
104 config: gaxi::options::ClientConfig,
105 ) -> crate::ClientBuilderResult<Self> {
106 let inner = Self::build_inner(config).await?;
107 Ok(Self { inner })
108 }
109
110 async fn build_inner(
111 conf: gaxi::options::ClientConfig,
112 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::AgentService>> {
113 if gaxi::options::tracing_enabled(&conf) {
114 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
115 }
116 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
117 }
118
119 async fn build_transport(
120 conf: gaxi::options::ClientConfig,
121 ) -> crate::ClientBuilderResult<impl super::stub::AgentService> {
122 super::transport::AgentService::new(conf).await
123 }
124
125 async fn build_with_tracing(
126 conf: gaxi::options::ClientConfig,
127 ) -> crate::ClientBuilderResult<impl super::stub::AgentService> {
128 Self::build_transport(conf)
129 .await
130 .map(super::tracing::AgentService::new)
131 }
132
133 /// Lists apps in the given project and location.
134 ///
135 /// # Example
136 /// ```
137 /// # use google_cloud_ces_v1::client::AgentService;
138 /// use google_cloud_gax::paginator::ItemPaginator as _;
139 /// use google_cloud_ces_v1::Result;
140 /// async fn sample(
141 /// client: &AgentService, project_id: &str, location_id: &str
142 /// ) -> Result<()> {
143 /// let mut list = client.list_apps()
144 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
145 /// .by_item();
146 /// while let Some(item) = list.next().await.transpose()? {
147 /// println!("{:?}", item);
148 /// }
149 /// Ok(())
150 /// }
151 /// ```
152 pub fn list_apps(&self) -> super::builder::agent_service::ListApps {
153 super::builder::agent_service::ListApps::new(self.inner.clone())
154 }
155
156 /// Gets details of the specified app.
157 ///
158 /// # Example
159 /// ```
160 /// # use google_cloud_ces_v1::client::AgentService;
161 /// use google_cloud_ces_v1::Result;
162 /// async fn sample(
163 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
164 /// ) -> Result<()> {
165 /// let response = client.get_app()
166 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
167 /// .send().await?;
168 /// println!("response {:?}", response);
169 /// Ok(())
170 /// }
171 /// ```
172 pub fn get_app(&self) -> super::builder::agent_service::GetApp {
173 super::builder::agent_service::GetApp::new(self.inner.clone())
174 }
175
176 /// Creates a new app in the given project and location.
177 ///
178 /// # Long running operations
179 ///
180 /// This method is used to start, and/or poll a [long-running Operation].
181 /// The [Working with long-running operations] chapter in the [user guide]
182 /// covers these operations in detail.
183 ///
184 /// [long-running operation]: https://google.aip.dev/151
185 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
186 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
187 ///
188 /// # Example
189 /// ```
190 /// # use google_cloud_ces_v1::client::AgentService;
191 /// use google_cloud_lro::Poller;
192 /// use google_cloud_ces_v1::model::App;
193 /// use google_cloud_ces_v1::Result;
194 /// async fn sample(
195 /// client: &AgentService, project_id: &str, location_id: &str
196 /// ) -> Result<()> {
197 /// let response = client.create_app()
198 /// .set_parent(format!("projects/{project_id}/locations/{location_id}"))
199 /// .set_app_id("app_id_value")
200 /// .set_app(
201 /// App::new()/* set fields */
202 /// )
203 /// .poller().until_done().await?;
204 /// println!("response {:?}", response);
205 /// Ok(())
206 /// }
207 /// ```
208 pub fn create_app(&self) -> super::builder::agent_service::CreateApp {
209 super::builder::agent_service::CreateApp::new(self.inner.clone())
210 }
211
212 /// Updates the specified app.
213 ///
214 /// # Example
215 /// ```
216 /// # use google_cloud_ces_v1::client::AgentService;
217 /// # extern crate wkt as google_cloud_wkt;
218 /// use google_cloud_wkt::FieldMask;
219 /// use google_cloud_ces_v1::model::App;
220 /// use google_cloud_ces_v1::Result;
221 /// async fn sample(
222 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
223 /// ) -> Result<()> {
224 /// let response = client.update_app()
225 /// .set_app(
226 /// App::new().set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))/* set fields */
227 /// )
228 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
229 /// .send().await?;
230 /// println!("response {:?}", response);
231 /// Ok(())
232 /// }
233 /// ```
234 pub fn update_app(&self) -> super::builder::agent_service::UpdateApp {
235 super::builder::agent_service::UpdateApp::new(self.inner.clone())
236 }
237
238 /// Deletes the specified app.
239 ///
240 /// # Long running operations
241 ///
242 /// This method is used to start, and/or poll a [long-running Operation].
243 /// The [Working with long-running operations] chapter in the [user guide]
244 /// covers these operations in detail.
245 ///
246 /// [long-running operation]: https://google.aip.dev/151
247 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
248 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
249 ///
250 /// # Example
251 /// ```
252 /// # use google_cloud_ces_v1::client::AgentService;
253 /// use google_cloud_lro::Poller;
254 /// use google_cloud_ces_v1::Result;
255 /// async fn sample(
256 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
257 /// ) -> Result<()> {
258 /// client.delete_app()
259 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
260 /// .poller().until_done().await?;
261 /// Ok(())
262 /// }
263 /// ```
264 pub fn delete_app(&self) -> super::builder::agent_service::DeleteApp {
265 super::builder::agent_service::DeleteApp::new(self.inner.clone())
266 }
267
268 /// Exports the specified app.
269 ///
270 /// # Long running operations
271 ///
272 /// This method is used to start, and/or poll a [long-running Operation].
273 /// The [Working with long-running operations] chapter in the [user guide]
274 /// covers these operations in detail.
275 ///
276 /// [long-running operation]: https://google.aip.dev/151
277 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
278 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
279 ///
280 /// # Example
281 /// ```
282 /// # use google_cloud_ces_v1::client::AgentService;
283 /// use google_cloud_lro::Poller;
284 /// use google_cloud_ces_v1::Result;
285 /// async fn sample(
286 /// client: &AgentService
287 /// ) -> Result<()> {
288 /// let response = client.export_app()
289 /// /* set fields */
290 /// .poller().until_done().await?;
291 /// println!("response {:?}", response);
292 /// Ok(())
293 /// }
294 /// ```
295 pub fn export_app(&self) -> super::builder::agent_service::ExportApp {
296 super::builder::agent_service::ExportApp::new(self.inner.clone())
297 }
298
299 /// Imports the specified app.
300 ///
301 /// # Long running operations
302 ///
303 /// This method is used to start, and/or poll a [long-running Operation].
304 /// The [Working with long-running operations] chapter in the [user guide]
305 /// covers these operations in detail.
306 ///
307 /// [long-running operation]: https://google.aip.dev/151
308 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
309 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
310 ///
311 /// # Example
312 /// ```
313 /// # use google_cloud_ces_v1::client::AgentService;
314 /// use google_cloud_lro::Poller;
315 /// use google_cloud_ces_v1::Result;
316 /// async fn sample(
317 /// client: &AgentService
318 /// ) -> Result<()> {
319 /// let response = client.import_app()
320 /// /* set fields */
321 /// .poller().until_done().await?;
322 /// println!("response {:?}", response);
323 /// Ok(())
324 /// }
325 /// ```
326 pub fn import_app(&self) -> super::builder::agent_service::ImportApp {
327 super::builder::agent_service::ImportApp::new(self.inner.clone())
328 }
329
330 /// Lists agents in the given app.
331 ///
332 /// # Example
333 /// ```
334 /// # use google_cloud_ces_v1::client::AgentService;
335 /// use google_cloud_gax::paginator::ItemPaginator as _;
336 /// use google_cloud_ces_v1::Result;
337 /// async fn sample(
338 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
339 /// ) -> Result<()> {
340 /// let mut list = client.list_agents()
341 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
342 /// .by_item();
343 /// while let Some(item) = list.next().await.transpose()? {
344 /// println!("{:?}", item);
345 /// }
346 /// Ok(())
347 /// }
348 /// ```
349 pub fn list_agents(&self) -> super::builder::agent_service::ListAgents {
350 super::builder::agent_service::ListAgents::new(self.inner.clone())
351 }
352
353 /// Gets details of the specified agent.
354 ///
355 /// # Example
356 /// ```
357 /// # use google_cloud_ces_v1::client::AgentService;
358 /// use google_cloud_ces_v1::Result;
359 /// async fn sample(
360 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, agent_id: &str
361 /// ) -> Result<()> {
362 /// let response = client.get_agent()
363 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/agents/{agent_id}"))
364 /// .send().await?;
365 /// println!("response {:?}", response);
366 /// Ok(())
367 /// }
368 /// ```
369 pub fn get_agent(&self) -> super::builder::agent_service::GetAgent {
370 super::builder::agent_service::GetAgent::new(self.inner.clone())
371 }
372
373 /// Creates a new agent in the given app.
374 ///
375 /// # Example
376 /// ```
377 /// # use google_cloud_ces_v1::client::AgentService;
378 /// use google_cloud_ces_v1::model::Agent;
379 /// use google_cloud_ces_v1::Result;
380 /// async fn sample(
381 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
382 /// ) -> Result<()> {
383 /// let response = client.create_agent()
384 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
385 /// .set_agent_id("agent_id_value")
386 /// .set_agent(
387 /// Agent::new()/* set fields */
388 /// )
389 /// .send().await?;
390 /// println!("response {:?}", response);
391 /// Ok(())
392 /// }
393 /// ```
394 pub fn create_agent(&self) -> super::builder::agent_service::CreateAgent {
395 super::builder::agent_service::CreateAgent::new(self.inner.clone())
396 }
397
398 /// Updates the specified agent.
399 ///
400 /// # Example
401 /// ```
402 /// # use google_cloud_ces_v1::client::AgentService;
403 /// # extern crate wkt as google_cloud_wkt;
404 /// use google_cloud_wkt::FieldMask;
405 /// use google_cloud_ces_v1::model::Agent;
406 /// use google_cloud_ces_v1::Result;
407 /// async fn sample(
408 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, agent_id: &str
409 /// ) -> Result<()> {
410 /// let response = client.update_agent()
411 /// .set_agent(
412 /// Agent::new().set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/agents/{agent_id}"))/* set fields */
413 /// )
414 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
415 /// .send().await?;
416 /// println!("response {:?}", response);
417 /// Ok(())
418 /// }
419 /// ```
420 pub fn update_agent(&self) -> super::builder::agent_service::UpdateAgent {
421 super::builder::agent_service::UpdateAgent::new(self.inner.clone())
422 }
423
424 /// Deletes the specified agent.
425 ///
426 /// # Example
427 /// ```
428 /// # use google_cloud_ces_v1::client::AgentService;
429 /// use google_cloud_ces_v1::Result;
430 /// async fn sample(
431 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, agent_id: &str
432 /// ) -> Result<()> {
433 /// client.delete_agent()
434 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/agents/{agent_id}"))
435 /// .send().await?;
436 /// Ok(())
437 /// }
438 /// ```
439 pub fn delete_agent(&self) -> super::builder::agent_service::DeleteAgent {
440 super::builder::agent_service::DeleteAgent::new(self.inner.clone())
441 }
442
443 /// Lists examples in the given app.
444 ///
445 /// # Example
446 /// ```
447 /// # use google_cloud_ces_v1::client::AgentService;
448 /// use google_cloud_gax::paginator::ItemPaginator as _;
449 /// use google_cloud_ces_v1::Result;
450 /// async fn sample(
451 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
452 /// ) -> Result<()> {
453 /// let mut list = client.list_examples()
454 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
455 /// .by_item();
456 /// while let Some(item) = list.next().await.transpose()? {
457 /// println!("{:?}", item);
458 /// }
459 /// Ok(())
460 /// }
461 /// ```
462 pub fn list_examples(&self) -> super::builder::agent_service::ListExamples {
463 super::builder::agent_service::ListExamples::new(self.inner.clone())
464 }
465
466 /// Gets details of the specified example.
467 ///
468 /// # Example
469 /// ```
470 /// # use google_cloud_ces_v1::client::AgentService;
471 /// use google_cloud_ces_v1::Result;
472 /// async fn sample(
473 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, example_id: &str
474 /// ) -> Result<()> {
475 /// let response = client.get_example()
476 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/examples/{example_id}"))
477 /// .send().await?;
478 /// println!("response {:?}", response);
479 /// Ok(())
480 /// }
481 /// ```
482 pub fn get_example(&self) -> super::builder::agent_service::GetExample {
483 super::builder::agent_service::GetExample::new(self.inner.clone())
484 }
485
486 /// Creates a new example in the given app.
487 ///
488 /// # Example
489 /// ```
490 /// # use google_cloud_ces_v1::client::AgentService;
491 /// use google_cloud_ces_v1::model::Example;
492 /// use google_cloud_ces_v1::Result;
493 /// async fn sample(
494 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
495 /// ) -> Result<()> {
496 /// let response = client.create_example()
497 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
498 /// .set_example_id("example_id_value")
499 /// .set_example(
500 /// Example::new()/* set fields */
501 /// )
502 /// .send().await?;
503 /// println!("response {:?}", response);
504 /// Ok(())
505 /// }
506 /// ```
507 pub fn create_example(&self) -> super::builder::agent_service::CreateExample {
508 super::builder::agent_service::CreateExample::new(self.inner.clone())
509 }
510
511 /// Updates the specified example.
512 ///
513 /// # Example
514 /// ```
515 /// # use google_cloud_ces_v1::client::AgentService;
516 /// # extern crate wkt as google_cloud_wkt;
517 /// use google_cloud_wkt::FieldMask;
518 /// use google_cloud_ces_v1::model::Example;
519 /// use google_cloud_ces_v1::Result;
520 /// async fn sample(
521 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, example_id: &str
522 /// ) -> Result<()> {
523 /// let response = client.update_example()
524 /// .set_example(
525 /// Example::new().set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/examples/{example_id}"))/* set fields */
526 /// )
527 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
528 /// .send().await?;
529 /// println!("response {:?}", response);
530 /// Ok(())
531 /// }
532 /// ```
533 pub fn update_example(&self) -> super::builder::agent_service::UpdateExample {
534 super::builder::agent_service::UpdateExample::new(self.inner.clone())
535 }
536
537 /// Deletes the specified example.
538 ///
539 /// # Example
540 /// ```
541 /// # use google_cloud_ces_v1::client::AgentService;
542 /// use google_cloud_ces_v1::Result;
543 /// async fn sample(
544 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, example_id: &str
545 /// ) -> Result<()> {
546 /// client.delete_example()
547 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/examples/{example_id}"))
548 /// .send().await?;
549 /// Ok(())
550 /// }
551 /// ```
552 pub fn delete_example(&self) -> super::builder::agent_service::DeleteExample {
553 super::builder::agent_service::DeleteExample::new(self.inner.clone())
554 }
555
556 /// Lists tools in the given app.
557 ///
558 /// # Example
559 /// ```
560 /// # use google_cloud_ces_v1::client::AgentService;
561 /// use google_cloud_gax::paginator::ItemPaginator as _;
562 /// use google_cloud_ces_v1::Result;
563 /// async fn sample(
564 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
565 /// ) -> Result<()> {
566 /// let mut list = client.list_tools()
567 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
568 /// .by_item();
569 /// while let Some(item) = list.next().await.transpose()? {
570 /// println!("{:?}", item);
571 /// }
572 /// Ok(())
573 /// }
574 /// ```
575 pub fn list_tools(&self) -> super::builder::agent_service::ListTools {
576 super::builder::agent_service::ListTools::new(self.inner.clone())
577 }
578
579 /// Gets details of the specified tool.
580 ///
581 /// # Example
582 /// ```
583 /// # use google_cloud_ces_v1::client::AgentService;
584 /// use google_cloud_ces_v1::Result;
585 /// async fn sample(
586 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, tool_id: &str
587 /// ) -> Result<()> {
588 /// let response = client.get_tool()
589 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/tools/{tool_id}"))
590 /// .send().await?;
591 /// println!("response {:?}", response);
592 /// Ok(())
593 /// }
594 /// ```
595 pub fn get_tool(&self) -> super::builder::agent_service::GetTool {
596 super::builder::agent_service::GetTool::new(self.inner.clone())
597 }
598
599 /// Lists conversations in the given app.
600 ///
601 /// # Example
602 /// ```
603 /// # use google_cloud_ces_v1::client::AgentService;
604 /// use google_cloud_gax::paginator::ItemPaginator as _;
605 /// use google_cloud_ces_v1::Result;
606 /// async fn sample(
607 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
608 /// ) -> Result<()> {
609 /// let mut list = client.list_conversations()
610 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
611 /// .by_item();
612 /// while let Some(item) = list.next().await.transpose()? {
613 /// println!("{:?}", item);
614 /// }
615 /// Ok(())
616 /// }
617 /// ```
618 pub fn list_conversations(&self) -> super::builder::agent_service::ListConversations {
619 super::builder::agent_service::ListConversations::new(self.inner.clone())
620 }
621
622 /// Gets details of the specified conversation.
623 ///
624 /// # Example
625 /// ```
626 /// # use google_cloud_ces_v1::client::AgentService;
627 /// use google_cloud_ces_v1::Result;
628 /// async fn sample(
629 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, conversation_id: &str
630 /// ) -> Result<()> {
631 /// let response = client.get_conversation()
632 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/conversations/{conversation_id}"))
633 /// .send().await?;
634 /// println!("response {:?}", response);
635 /// Ok(())
636 /// }
637 /// ```
638 pub fn get_conversation(&self) -> super::builder::agent_service::GetConversation {
639 super::builder::agent_service::GetConversation::new(self.inner.clone())
640 }
641
642 /// Deletes the specified conversation.
643 ///
644 /// # Example
645 /// ```
646 /// # use google_cloud_ces_v1::client::AgentService;
647 /// use google_cloud_ces_v1::Result;
648 /// async fn sample(
649 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, conversation_id: &str
650 /// ) -> Result<()> {
651 /// client.delete_conversation()
652 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/conversations/{conversation_id}"))
653 /// .send().await?;
654 /// Ok(())
655 /// }
656 /// ```
657 pub fn delete_conversation(&self) -> super::builder::agent_service::DeleteConversation {
658 super::builder::agent_service::DeleteConversation::new(self.inner.clone())
659 }
660
661 /// Batch deletes the specified conversations.
662 ///
663 /// # Long running operations
664 ///
665 /// This method is used to start, and/or poll a [long-running Operation].
666 /// The [Working with long-running operations] chapter in the [user guide]
667 /// covers these operations in detail.
668 ///
669 /// [long-running operation]: https://google.aip.dev/151
670 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
671 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
672 ///
673 /// # Example
674 /// ```
675 /// # use google_cloud_ces_v1::client::AgentService;
676 /// use google_cloud_lro::Poller;
677 /// use google_cloud_ces_v1::Result;
678 /// async fn sample(
679 /// client: &AgentService
680 /// ) -> Result<()> {
681 /// let response = client.batch_delete_conversations()
682 /// /* set fields */
683 /// .poller().until_done().await?;
684 /// println!("response {:?}", response);
685 /// Ok(())
686 /// }
687 /// ```
688 pub fn batch_delete_conversations(
689 &self,
690 ) -> super::builder::agent_service::BatchDeleteConversations {
691 super::builder::agent_service::BatchDeleteConversations::new(self.inner.clone())
692 }
693
694 /// Creates a new tool in the given app.
695 ///
696 /// # Example
697 /// ```
698 /// # use google_cloud_ces_v1::client::AgentService;
699 /// use google_cloud_ces_v1::model::Tool;
700 /// use google_cloud_ces_v1::Result;
701 /// async fn sample(
702 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
703 /// ) -> Result<()> {
704 /// let response = client.create_tool()
705 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
706 /// .set_tool_id("tool_id_value")
707 /// .set_tool(
708 /// Tool::new()/* set fields */
709 /// )
710 /// .send().await?;
711 /// println!("response {:?}", response);
712 /// Ok(())
713 /// }
714 /// ```
715 pub fn create_tool(&self) -> super::builder::agent_service::CreateTool {
716 super::builder::agent_service::CreateTool::new(self.inner.clone())
717 }
718
719 /// Updates the specified tool.
720 ///
721 /// # Example
722 /// ```
723 /// # use google_cloud_ces_v1::client::AgentService;
724 /// # extern crate wkt as google_cloud_wkt;
725 /// use google_cloud_wkt::FieldMask;
726 /// use google_cloud_ces_v1::model::Tool;
727 /// use google_cloud_ces_v1::Result;
728 /// async fn sample(
729 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, tool_id: &str
730 /// ) -> Result<()> {
731 /// let response = client.update_tool()
732 /// .set_tool(
733 /// Tool::new().set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/tools/{tool_id}"))/* set fields */
734 /// )
735 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
736 /// .send().await?;
737 /// println!("response {:?}", response);
738 /// Ok(())
739 /// }
740 /// ```
741 pub fn update_tool(&self) -> super::builder::agent_service::UpdateTool {
742 super::builder::agent_service::UpdateTool::new(self.inner.clone())
743 }
744
745 /// Deletes the specified tool.
746 ///
747 /// # Example
748 /// ```
749 /// # use google_cloud_ces_v1::client::AgentService;
750 /// use google_cloud_ces_v1::Result;
751 /// async fn sample(
752 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, tool_id: &str
753 /// ) -> Result<()> {
754 /// client.delete_tool()
755 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/tools/{tool_id}"))
756 /// .send().await?;
757 /// Ok(())
758 /// }
759 /// ```
760 pub fn delete_tool(&self) -> super::builder::agent_service::DeleteTool {
761 super::builder::agent_service::DeleteTool::new(self.inner.clone())
762 }
763
764 /// Lists guardrails in the given app.
765 ///
766 /// # Example
767 /// ```
768 /// # use google_cloud_ces_v1::client::AgentService;
769 /// use google_cloud_gax::paginator::ItemPaginator as _;
770 /// use google_cloud_ces_v1::Result;
771 /// async fn sample(
772 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
773 /// ) -> Result<()> {
774 /// let mut list = client.list_guardrails()
775 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
776 /// .by_item();
777 /// while let Some(item) = list.next().await.transpose()? {
778 /// println!("{:?}", item);
779 /// }
780 /// Ok(())
781 /// }
782 /// ```
783 pub fn list_guardrails(&self) -> super::builder::agent_service::ListGuardrails {
784 super::builder::agent_service::ListGuardrails::new(self.inner.clone())
785 }
786
787 /// Gets details of the specified guardrail.
788 ///
789 /// # Example
790 /// ```
791 /// # use google_cloud_ces_v1::client::AgentService;
792 /// use google_cloud_ces_v1::Result;
793 /// async fn sample(
794 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, guardrail_id: &str
795 /// ) -> Result<()> {
796 /// let response = client.get_guardrail()
797 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/guardrails/{guardrail_id}"))
798 /// .send().await?;
799 /// println!("response {:?}", response);
800 /// Ok(())
801 /// }
802 /// ```
803 pub fn get_guardrail(&self) -> super::builder::agent_service::GetGuardrail {
804 super::builder::agent_service::GetGuardrail::new(self.inner.clone())
805 }
806
807 /// Creates a new guardrail in the given app.
808 ///
809 /// # Example
810 /// ```
811 /// # use google_cloud_ces_v1::client::AgentService;
812 /// use google_cloud_ces_v1::model::Guardrail;
813 /// use google_cloud_ces_v1::Result;
814 /// async fn sample(
815 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
816 /// ) -> Result<()> {
817 /// let response = client.create_guardrail()
818 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
819 /// .set_guardrail_id("guardrail_id_value")
820 /// .set_guardrail(
821 /// Guardrail::new()/* set fields */
822 /// )
823 /// .send().await?;
824 /// println!("response {:?}", response);
825 /// Ok(())
826 /// }
827 /// ```
828 pub fn create_guardrail(&self) -> super::builder::agent_service::CreateGuardrail {
829 super::builder::agent_service::CreateGuardrail::new(self.inner.clone())
830 }
831
832 /// Updates the specified guardrail.
833 ///
834 /// # Example
835 /// ```
836 /// # use google_cloud_ces_v1::client::AgentService;
837 /// # extern crate wkt as google_cloud_wkt;
838 /// use google_cloud_wkt::FieldMask;
839 /// use google_cloud_ces_v1::model::Guardrail;
840 /// use google_cloud_ces_v1::Result;
841 /// async fn sample(
842 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, guardrail_id: &str
843 /// ) -> Result<()> {
844 /// let response = client.update_guardrail()
845 /// .set_guardrail(
846 /// Guardrail::new().set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/guardrails/{guardrail_id}"))/* set fields */
847 /// )
848 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
849 /// .send().await?;
850 /// println!("response {:?}", response);
851 /// Ok(())
852 /// }
853 /// ```
854 pub fn update_guardrail(&self) -> super::builder::agent_service::UpdateGuardrail {
855 super::builder::agent_service::UpdateGuardrail::new(self.inner.clone())
856 }
857
858 /// Deletes the specified guardrail.
859 ///
860 /// # Example
861 /// ```
862 /// # use google_cloud_ces_v1::client::AgentService;
863 /// use google_cloud_ces_v1::Result;
864 /// async fn sample(
865 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, guardrail_id: &str
866 /// ) -> Result<()> {
867 /// client.delete_guardrail()
868 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/guardrails/{guardrail_id}"))
869 /// .send().await?;
870 /// Ok(())
871 /// }
872 /// ```
873 pub fn delete_guardrail(&self) -> super::builder::agent_service::DeleteGuardrail {
874 super::builder::agent_service::DeleteGuardrail::new(self.inner.clone())
875 }
876
877 /// Lists deployments in the given app.
878 ///
879 /// # Example
880 /// ```
881 /// # use google_cloud_ces_v1::client::AgentService;
882 /// use google_cloud_gax::paginator::ItemPaginator as _;
883 /// use google_cloud_ces_v1::Result;
884 /// async fn sample(
885 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
886 /// ) -> Result<()> {
887 /// let mut list = client.list_deployments()
888 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
889 /// .by_item();
890 /// while let Some(item) = list.next().await.transpose()? {
891 /// println!("{:?}", item);
892 /// }
893 /// Ok(())
894 /// }
895 /// ```
896 pub fn list_deployments(&self) -> super::builder::agent_service::ListDeployments {
897 super::builder::agent_service::ListDeployments::new(self.inner.clone())
898 }
899
900 /// Gets details of the specified deployment.
901 ///
902 /// # Example
903 /// ```
904 /// # use google_cloud_ces_v1::client::AgentService;
905 /// use google_cloud_ces_v1::Result;
906 /// async fn sample(
907 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, deployment_id: &str
908 /// ) -> Result<()> {
909 /// let response = client.get_deployment()
910 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/deployments/{deployment_id}"))
911 /// .send().await?;
912 /// println!("response {:?}", response);
913 /// Ok(())
914 /// }
915 /// ```
916 pub fn get_deployment(&self) -> super::builder::agent_service::GetDeployment {
917 super::builder::agent_service::GetDeployment::new(self.inner.clone())
918 }
919
920 /// Creates a new deployment in the given app.
921 ///
922 /// # Example
923 /// ```
924 /// # use google_cloud_ces_v1::client::AgentService;
925 /// use google_cloud_ces_v1::model::Deployment;
926 /// use google_cloud_ces_v1::Result;
927 /// async fn sample(
928 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
929 /// ) -> Result<()> {
930 /// let response = client.create_deployment()
931 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
932 /// .set_deployment_id("deployment_id_value")
933 /// .set_deployment(
934 /// Deployment::new()/* set fields */
935 /// )
936 /// .send().await?;
937 /// println!("response {:?}", response);
938 /// Ok(())
939 /// }
940 /// ```
941 pub fn create_deployment(&self) -> super::builder::agent_service::CreateDeployment {
942 super::builder::agent_service::CreateDeployment::new(self.inner.clone())
943 }
944
945 /// Updates the specified deployment.
946 ///
947 /// # Example
948 /// ```
949 /// # use google_cloud_ces_v1::client::AgentService;
950 /// # extern crate wkt as google_cloud_wkt;
951 /// use google_cloud_wkt::FieldMask;
952 /// use google_cloud_ces_v1::model::Deployment;
953 /// use google_cloud_ces_v1::Result;
954 /// async fn sample(
955 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, deployment_id: &str
956 /// ) -> Result<()> {
957 /// let response = client.update_deployment()
958 /// .set_deployment(
959 /// Deployment::new().set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/deployments/{deployment_id}"))/* set fields */
960 /// )
961 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
962 /// .send().await?;
963 /// println!("response {:?}", response);
964 /// Ok(())
965 /// }
966 /// ```
967 pub fn update_deployment(&self) -> super::builder::agent_service::UpdateDeployment {
968 super::builder::agent_service::UpdateDeployment::new(self.inner.clone())
969 }
970
971 /// Deletes the specified deployment.
972 ///
973 /// # Example
974 /// ```
975 /// # use google_cloud_ces_v1::client::AgentService;
976 /// use google_cloud_ces_v1::Result;
977 /// async fn sample(
978 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, deployment_id: &str
979 /// ) -> Result<()> {
980 /// client.delete_deployment()
981 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/deployments/{deployment_id}"))
982 /// .send().await?;
983 /// Ok(())
984 /// }
985 /// ```
986 pub fn delete_deployment(&self) -> super::builder::agent_service::DeleteDeployment {
987 super::builder::agent_service::DeleteDeployment::new(self.inner.clone())
988 }
989
990 /// Lists toolsets in the given app.
991 ///
992 /// # Example
993 /// ```
994 /// # use google_cloud_ces_v1::client::AgentService;
995 /// use google_cloud_gax::paginator::ItemPaginator as _;
996 /// use google_cloud_ces_v1::Result;
997 /// async fn sample(
998 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
999 /// ) -> Result<()> {
1000 /// let mut list = client.list_toolsets()
1001 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
1002 /// .by_item();
1003 /// while let Some(item) = list.next().await.transpose()? {
1004 /// println!("{:?}", item);
1005 /// }
1006 /// Ok(())
1007 /// }
1008 /// ```
1009 pub fn list_toolsets(&self) -> super::builder::agent_service::ListToolsets {
1010 super::builder::agent_service::ListToolsets::new(self.inner.clone())
1011 }
1012
1013 /// Gets details of the specified toolset.
1014 ///
1015 /// # Example
1016 /// ```
1017 /// # use google_cloud_ces_v1::client::AgentService;
1018 /// use google_cloud_ces_v1::Result;
1019 /// async fn sample(
1020 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, toolset_id: &str
1021 /// ) -> Result<()> {
1022 /// let response = client.get_toolset()
1023 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/toolsets/{toolset_id}"))
1024 /// .send().await?;
1025 /// println!("response {:?}", response);
1026 /// Ok(())
1027 /// }
1028 /// ```
1029 pub fn get_toolset(&self) -> super::builder::agent_service::GetToolset {
1030 super::builder::agent_service::GetToolset::new(self.inner.clone())
1031 }
1032
1033 /// Creates a new toolset in the given app.
1034 ///
1035 /// # Example
1036 /// ```
1037 /// # use google_cloud_ces_v1::client::AgentService;
1038 /// use google_cloud_ces_v1::model::Toolset;
1039 /// use google_cloud_ces_v1::Result;
1040 /// async fn sample(
1041 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
1042 /// ) -> Result<()> {
1043 /// let response = client.create_toolset()
1044 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
1045 /// .set_toolset_id("toolset_id_value")
1046 /// .set_toolset(
1047 /// Toolset::new()/* set fields */
1048 /// )
1049 /// .send().await?;
1050 /// println!("response {:?}", response);
1051 /// Ok(())
1052 /// }
1053 /// ```
1054 pub fn create_toolset(&self) -> super::builder::agent_service::CreateToolset {
1055 super::builder::agent_service::CreateToolset::new(self.inner.clone())
1056 }
1057
1058 /// Updates the specified toolset.
1059 ///
1060 /// # Example
1061 /// ```
1062 /// # use google_cloud_ces_v1::client::AgentService;
1063 /// # extern crate wkt as google_cloud_wkt;
1064 /// use google_cloud_wkt::FieldMask;
1065 /// use google_cloud_ces_v1::model::Toolset;
1066 /// use google_cloud_ces_v1::Result;
1067 /// async fn sample(
1068 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, toolset_id: &str
1069 /// ) -> Result<()> {
1070 /// let response = client.update_toolset()
1071 /// .set_toolset(
1072 /// Toolset::new().set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/toolsets/{toolset_id}"))/* set fields */
1073 /// )
1074 /// .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
1075 /// .send().await?;
1076 /// println!("response {:?}", response);
1077 /// Ok(())
1078 /// }
1079 /// ```
1080 pub fn update_toolset(&self) -> super::builder::agent_service::UpdateToolset {
1081 super::builder::agent_service::UpdateToolset::new(self.inner.clone())
1082 }
1083
1084 /// Deletes the specified toolset.
1085 ///
1086 /// # Example
1087 /// ```
1088 /// # use google_cloud_ces_v1::client::AgentService;
1089 /// use google_cloud_ces_v1::Result;
1090 /// async fn sample(
1091 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, toolset_id: &str
1092 /// ) -> Result<()> {
1093 /// client.delete_toolset()
1094 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/toolsets/{toolset_id}"))
1095 /// .send().await?;
1096 /// Ok(())
1097 /// }
1098 /// ```
1099 pub fn delete_toolset(&self) -> super::builder::agent_service::DeleteToolset {
1100 super::builder::agent_service::DeleteToolset::new(self.inner.clone())
1101 }
1102
1103 /// Lists all app versions in the given app.
1104 ///
1105 /// # Example
1106 /// ```
1107 /// # use google_cloud_ces_v1::client::AgentService;
1108 /// use google_cloud_gax::paginator::ItemPaginator as _;
1109 /// use google_cloud_ces_v1::Result;
1110 /// async fn sample(
1111 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
1112 /// ) -> Result<()> {
1113 /// let mut list = client.list_app_versions()
1114 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
1115 /// .by_item();
1116 /// while let Some(item) = list.next().await.transpose()? {
1117 /// println!("{:?}", item);
1118 /// }
1119 /// Ok(())
1120 /// }
1121 /// ```
1122 pub fn list_app_versions(&self) -> super::builder::agent_service::ListAppVersions {
1123 super::builder::agent_service::ListAppVersions::new(self.inner.clone())
1124 }
1125
1126 /// Gets details of the specified app version.
1127 ///
1128 /// # Example
1129 /// ```
1130 /// # use google_cloud_ces_v1::client::AgentService;
1131 /// use google_cloud_ces_v1::Result;
1132 /// async fn sample(
1133 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, version_id: &str
1134 /// ) -> Result<()> {
1135 /// let response = client.get_app_version()
1136 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/versions/{version_id}"))
1137 /// .send().await?;
1138 /// println!("response {:?}", response);
1139 /// Ok(())
1140 /// }
1141 /// ```
1142 pub fn get_app_version(&self) -> super::builder::agent_service::GetAppVersion {
1143 super::builder::agent_service::GetAppVersion::new(self.inner.clone())
1144 }
1145
1146 /// Creates a new app version in the given app.
1147 ///
1148 /// # Example
1149 /// ```
1150 /// # use google_cloud_ces_v1::client::AgentService;
1151 /// use google_cloud_ces_v1::model::AppVersion;
1152 /// use google_cloud_ces_v1::Result;
1153 /// async fn sample(
1154 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
1155 /// ) -> Result<()> {
1156 /// let response = client.create_app_version()
1157 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
1158 /// .set_app_version(
1159 /// AppVersion::new()/* set fields */
1160 /// )
1161 /// .send().await?;
1162 /// println!("response {:?}", response);
1163 /// Ok(())
1164 /// }
1165 /// ```
1166 pub fn create_app_version(&self) -> super::builder::agent_service::CreateAppVersion {
1167 super::builder::agent_service::CreateAppVersion::new(self.inner.clone())
1168 }
1169
1170 /// Deletes the specified app version.
1171 ///
1172 /// # Example
1173 /// ```
1174 /// # use google_cloud_ces_v1::client::AgentService;
1175 /// use google_cloud_ces_v1::Result;
1176 /// async fn sample(
1177 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, version_id: &str
1178 /// ) -> Result<()> {
1179 /// client.delete_app_version()
1180 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/versions/{version_id}"))
1181 /// .send().await?;
1182 /// Ok(())
1183 /// }
1184 /// ```
1185 pub fn delete_app_version(&self) -> super::builder::agent_service::DeleteAppVersion {
1186 super::builder::agent_service::DeleteAppVersion::new(self.inner.clone())
1187 }
1188
1189 /// Restores the specified app version.
1190 /// This will create a new app version from the current draft app and overwrite
1191 /// the current draft with the specified app version.
1192 ///
1193 /// # Long running operations
1194 ///
1195 /// This method is used to start, and/or poll a [long-running Operation].
1196 /// The [Working with long-running operations] chapter in the [user guide]
1197 /// covers these operations in detail.
1198 ///
1199 /// [long-running operation]: https://google.aip.dev/151
1200 /// [user guide]: https://googleapis.github.io/google-cloud-rust/
1201 /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
1202 ///
1203 /// # Example
1204 /// ```
1205 /// # use google_cloud_ces_v1::client::AgentService;
1206 /// use google_cloud_lro::Poller;
1207 /// use google_cloud_ces_v1::Result;
1208 /// async fn sample(
1209 /// client: &AgentService
1210 /// ) -> Result<()> {
1211 /// let response = client.restore_app_version()
1212 /// /* set fields */
1213 /// .poller().until_done().await?;
1214 /// println!("response {:?}", response);
1215 /// Ok(())
1216 /// }
1217 /// ```
1218 pub fn restore_app_version(&self) -> super::builder::agent_service::RestoreAppVersion {
1219 super::builder::agent_service::RestoreAppVersion::new(self.inner.clone())
1220 }
1221
1222 /// Lists the changelogs of the specified app.
1223 ///
1224 /// # Example
1225 /// ```
1226 /// # use google_cloud_ces_v1::client::AgentService;
1227 /// use google_cloud_gax::paginator::ItemPaginator as _;
1228 /// use google_cloud_ces_v1::Result;
1229 /// async fn sample(
1230 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str
1231 /// ) -> Result<()> {
1232 /// let mut list = client.list_changelogs()
1233 /// .set_parent(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}"))
1234 /// .by_item();
1235 /// while let Some(item) = list.next().await.transpose()? {
1236 /// println!("{:?}", item);
1237 /// }
1238 /// Ok(())
1239 /// }
1240 /// ```
1241 pub fn list_changelogs(&self) -> super::builder::agent_service::ListChangelogs {
1242 super::builder::agent_service::ListChangelogs::new(self.inner.clone())
1243 }
1244
1245 /// Gets the specified changelog.
1246 ///
1247 /// # Example
1248 /// ```
1249 /// # use google_cloud_ces_v1::client::AgentService;
1250 /// use google_cloud_ces_v1::Result;
1251 /// async fn sample(
1252 /// client: &AgentService, project_id: &str, location_id: &str, app_id: &str, changelog_id: &str
1253 /// ) -> Result<()> {
1254 /// let response = client.get_changelog()
1255 /// .set_name(format!("projects/{project_id}/locations/{location_id}/apps/{app_id}/changelogs/{changelog_id}"))
1256 /// .send().await?;
1257 /// println!("response {:?}", response);
1258 /// Ok(())
1259 /// }
1260 /// ```
1261 pub fn get_changelog(&self) -> super::builder::agent_service::GetChangelog {
1262 super::builder::agent_service::GetChangelog::new(self.inner.clone())
1263 }
1264
1265 /// Lists information about the supported locations for this service.
1266 ///
1267 /// This method lists locations based on the resource scope provided in
1268 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
1269 /// **Global locations**: If `name` is empty, the method lists the
1270 /// public locations available to all projects. * **Project-specific
1271 /// locations**: If `name` follows the format
1272 /// `projects/{project}`, the method lists locations visible to that
1273 /// specific project. This includes public, private, or other
1274 /// project-specific locations enabled for the project.
1275 ///
1276 /// For gRPC and client library implementations, the resource name is
1277 /// passed as the `name` field. For direct service calls, the resource
1278 /// name is
1279 /// incorporated into the request path based on the specific service
1280 /// implementation and version.
1281 ///
1282 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
1283 ///
1284 /// # Example
1285 /// ```
1286 /// # use google_cloud_ces_v1::client::AgentService;
1287 /// use google_cloud_gax::paginator::ItemPaginator as _;
1288 /// use google_cloud_ces_v1::Result;
1289 /// async fn sample(
1290 /// client: &AgentService
1291 /// ) -> Result<()> {
1292 /// let mut list = client.list_locations()
1293 /// /* set fields */
1294 /// .by_item();
1295 /// while let Some(item) = list.next().await.transpose()? {
1296 /// println!("{:?}", item);
1297 /// }
1298 /// Ok(())
1299 /// }
1300 /// ```
1301 pub fn list_locations(&self) -> super::builder::agent_service::ListLocations {
1302 super::builder::agent_service::ListLocations::new(self.inner.clone())
1303 }
1304
1305 /// Gets information about a location.
1306 ///
1307 /// # Example
1308 /// ```
1309 /// # use google_cloud_ces_v1::client::AgentService;
1310 /// use google_cloud_ces_v1::Result;
1311 /// async fn sample(
1312 /// client: &AgentService
1313 /// ) -> Result<()> {
1314 /// let response = client.get_location()
1315 /// /* set fields */
1316 /// .send().await?;
1317 /// println!("response {:?}", response);
1318 /// Ok(())
1319 /// }
1320 /// ```
1321 pub fn get_location(&self) -> super::builder::agent_service::GetLocation {
1322 super::builder::agent_service::GetLocation::new(self.inner.clone())
1323 }
1324
1325 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1326 ///
1327 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1328 ///
1329 /// # Example
1330 /// ```
1331 /// # use google_cloud_ces_v1::client::AgentService;
1332 /// use google_cloud_gax::paginator::ItemPaginator as _;
1333 /// use google_cloud_ces_v1::Result;
1334 /// async fn sample(
1335 /// client: &AgentService
1336 /// ) -> Result<()> {
1337 /// let mut list = client.list_operations()
1338 /// /* set fields */
1339 /// .by_item();
1340 /// while let Some(item) = list.next().await.transpose()? {
1341 /// println!("{:?}", item);
1342 /// }
1343 /// Ok(())
1344 /// }
1345 /// ```
1346 pub fn list_operations(&self) -> super::builder::agent_service::ListOperations {
1347 super::builder::agent_service::ListOperations::new(self.inner.clone())
1348 }
1349
1350 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1351 ///
1352 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1353 ///
1354 /// # Example
1355 /// ```
1356 /// # use google_cloud_ces_v1::client::AgentService;
1357 /// use google_cloud_ces_v1::Result;
1358 /// async fn sample(
1359 /// client: &AgentService
1360 /// ) -> Result<()> {
1361 /// let response = client.get_operation()
1362 /// /* set fields */
1363 /// .send().await?;
1364 /// println!("response {:?}", response);
1365 /// Ok(())
1366 /// }
1367 /// ```
1368 pub fn get_operation(&self) -> super::builder::agent_service::GetOperation {
1369 super::builder::agent_service::GetOperation::new(self.inner.clone())
1370 }
1371
1372 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1373 ///
1374 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1375 ///
1376 /// # Example
1377 /// ```
1378 /// # use google_cloud_ces_v1::client::AgentService;
1379 /// use google_cloud_ces_v1::Result;
1380 /// async fn sample(
1381 /// client: &AgentService
1382 /// ) -> Result<()> {
1383 /// client.delete_operation()
1384 /// /* set fields */
1385 /// .send().await?;
1386 /// Ok(())
1387 /// }
1388 /// ```
1389 pub fn delete_operation(&self) -> super::builder::agent_service::DeleteOperation {
1390 super::builder::agent_service::DeleteOperation::new(self.inner.clone())
1391 }
1392
1393 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1394 ///
1395 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1396 ///
1397 /// # Example
1398 /// ```
1399 /// # use google_cloud_ces_v1::client::AgentService;
1400 /// use google_cloud_ces_v1::Result;
1401 /// async fn sample(
1402 /// client: &AgentService
1403 /// ) -> Result<()> {
1404 /// client.cancel_operation()
1405 /// /* set fields */
1406 /// .send().await?;
1407 /// Ok(())
1408 /// }
1409 /// ```
1410 pub fn cancel_operation(&self) -> super::builder::agent_service::CancelOperation {
1411 super::builder::agent_service::CancelOperation::new(self.inner.clone())
1412 }
1413}
1414
1415/// Implements a client for the Gemini Enterprise for Customer Experience API.
1416///
1417/// # Example
1418/// ```
1419/// # use google_cloud_ces_v1::client::SessionService;
1420/// async fn sample(
1421/// ) -> anyhow::Result<()> {
1422/// let client = SessionService::builder().build().await?;
1423/// let response = client.run_session()
1424/// /* set fields */
1425/// .send().await?;
1426/// println!("response {:?}", response);
1427/// Ok(())
1428/// }
1429/// ```
1430///
1431/// # Service Description
1432///
1433/// Session service provides APIs for interacting with CES agents.
1434///
1435/// # Configuration
1436///
1437/// To configure `SessionService` use the `with_*` methods in the type returned
1438/// by [builder()][SessionService::builder]. The default configuration should
1439/// work for most applications. Common configuration changes include
1440///
1441/// * [with_endpoint()]: by default this client uses the global default endpoint
1442/// (`https://ces.googleapis.com`). Applications using regional
1443/// endpoints or running in restricted networks (e.g. a network configured
1444/// with [Private Google Access with VPC Service Controls]) may want to
1445/// override this default.
1446/// * [with_credentials()]: by default this client uses
1447/// [Application Default Credentials]. Applications using custom
1448/// authentication may need to override this default.
1449///
1450/// [with_endpoint()]: super::builder::session_service::ClientBuilder::with_endpoint
1451/// [with_credentials()]: super::builder::session_service::ClientBuilder::with_credentials
1452/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1453/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1454///
1455/// # Pooling and Cloning
1456///
1457/// `SessionService` holds a connection pool internally, it is advised to
1458/// create one and reuse it. You do not need to wrap `SessionService` in
1459/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1460/// already uses an `Arc` internally.
1461#[derive(Clone, Debug)]
1462pub struct SessionService {
1463 inner: std::sync::Arc<dyn super::stub::dynamic::SessionService>,
1464}
1465
1466impl SessionService {
1467 /// Returns a builder for [SessionService].
1468 ///
1469 /// ```
1470 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1471 /// # use google_cloud_ces_v1::client::SessionService;
1472 /// let client = SessionService::builder().build().await?;
1473 /// # Ok(()) }
1474 /// ```
1475 pub fn builder() -> super::builder::session_service::ClientBuilder {
1476 crate::new_client_builder(super::builder::session_service::client::Factory)
1477 }
1478
1479 /// Creates a new client from the provided stub.
1480 ///
1481 /// The most common case for calling this function is in tests mocking the
1482 /// client's behavior.
1483 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1484 where
1485 T: super::stub::SessionService + 'static,
1486 {
1487 Self { inner: stub.into() }
1488 }
1489
1490 pub(crate) async fn new(
1491 config: gaxi::options::ClientConfig,
1492 ) -> crate::ClientBuilderResult<Self> {
1493 let inner = Self::build_inner(config).await?;
1494 Ok(Self { inner })
1495 }
1496
1497 async fn build_inner(
1498 conf: gaxi::options::ClientConfig,
1499 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SessionService>> {
1500 if gaxi::options::tracing_enabled(&conf) {
1501 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1502 }
1503 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1504 }
1505
1506 async fn build_transport(
1507 conf: gaxi::options::ClientConfig,
1508 ) -> crate::ClientBuilderResult<impl super::stub::SessionService> {
1509 super::transport::SessionService::new(conf).await
1510 }
1511
1512 async fn build_with_tracing(
1513 conf: gaxi::options::ClientConfig,
1514 ) -> crate::ClientBuilderResult<impl super::stub::SessionService> {
1515 Self::build_transport(conf)
1516 .await
1517 .map(super::tracing::SessionService::new)
1518 }
1519
1520 /// Initiates a single-turn interaction with the CES agent within a session.
1521 ///
1522 /// # Example
1523 /// ```
1524 /// # use google_cloud_ces_v1::client::SessionService;
1525 /// use google_cloud_ces_v1::Result;
1526 /// async fn sample(
1527 /// client: &SessionService
1528 /// ) -> Result<()> {
1529 /// let response = client.run_session()
1530 /// /* set fields */
1531 /// .send().await?;
1532 /// println!("response {:?}", response);
1533 /// Ok(())
1534 /// }
1535 /// ```
1536 pub fn run_session(&self) -> super::builder::session_service::RunSession {
1537 super::builder::session_service::RunSession::new(self.inner.clone())
1538 }
1539
1540 /// Lists information about the supported locations for this service.
1541 ///
1542 /// This method lists locations based on the resource scope provided in
1543 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
1544 /// **Global locations**: If `name` is empty, the method lists the
1545 /// public locations available to all projects. * **Project-specific
1546 /// locations**: If `name` follows the format
1547 /// `projects/{project}`, the method lists locations visible to that
1548 /// specific project. This includes public, private, or other
1549 /// project-specific locations enabled for the project.
1550 ///
1551 /// For gRPC and client library implementations, the resource name is
1552 /// passed as the `name` field. For direct service calls, the resource
1553 /// name is
1554 /// incorporated into the request path based on the specific service
1555 /// implementation and version.
1556 ///
1557 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
1558 ///
1559 /// # Example
1560 /// ```
1561 /// # use google_cloud_ces_v1::client::SessionService;
1562 /// use google_cloud_gax::paginator::ItemPaginator as _;
1563 /// use google_cloud_ces_v1::Result;
1564 /// async fn sample(
1565 /// client: &SessionService
1566 /// ) -> Result<()> {
1567 /// let mut list = client.list_locations()
1568 /// /* set fields */
1569 /// .by_item();
1570 /// while let Some(item) = list.next().await.transpose()? {
1571 /// println!("{:?}", item);
1572 /// }
1573 /// Ok(())
1574 /// }
1575 /// ```
1576 pub fn list_locations(&self) -> super::builder::session_service::ListLocations {
1577 super::builder::session_service::ListLocations::new(self.inner.clone())
1578 }
1579
1580 /// Gets information about a location.
1581 ///
1582 /// # Example
1583 /// ```
1584 /// # use google_cloud_ces_v1::client::SessionService;
1585 /// use google_cloud_ces_v1::Result;
1586 /// async fn sample(
1587 /// client: &SessionService
1588 /// ) -> Result<()> {
1589 /// let response = client.get_location()
1590 /// /* set fields */
1591 /// .send().await?;
1592 /// println!("response {:?}", response);
1593 /// Ok(())
1594 /// }
1595 /// ```
1596 pub fn get_location(&self) -> super::builder::session_service::GetLocation {
1597 super::builder::session_service::GetLocation::new(self.inner.clone())
1598 }
1599
1600 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1601 ///
1602 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1603 ///
1604 /// # Example
1605 /// ```
1606 /// # use google_cloud_ces_v1::client::SessionService;
1607 /// use google_cloud_gax::paginator::ItemPaginator as _;
1608 /// use google_cloud_ces_v1::Result;
1609 /// async fn sample(
1610 /// client: &SessionService
1611 /// ) -> Result<()> {
1612 /// let mut list = client.list_operations()
1613 /// /* set fields */
1614 /// .by_item();
1615 /// while let Some(item) = list.next().await.transpose()? {
1616 /// println!("{:?}", item);
1617 /// }
1618 /// Ok(())
1619 /// }
1620 /// ```
1621 pub fn list_operations(&self) -> super::builder::session_service::ListOperations {
1622 super::builder::session_service::ListOperations::new(self.inner.clone())
1623 }
1624
1625 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1626 ///
1627 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1628 ///
1629 /// # Example
1630 /// ```
1631 /// # use google_cloud_ces_v1::client::SessionService;
1632 /// use google_cloud_ces_v1::Result;
1633 /// async fn sample(
1634 /// client: &SessionService
1635 /// ) -> Result<()> {
1636 /// let response = client.get_operation()
1637 /// /* set fields */
1638 /// .send().await?;
1639 /// println!("response {:?}", response);
1640 /// Ok(())
1641 /// }
1642 /// ```
1643 pub fn get_operation(&self) -> super::builder::session_service::GetOperation {
1644 super::builder::session_service::GetOperation::new(self.inner.clone())
1645 }
1646
1647 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1648 ///
1649 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1650 ///
1651 /// # Example
1652 /// ```
1653 /// # use google_cloud_ces_v1::client::SessionService;
1654 /// use google_cloud_ces_v1::Result;
1655 /// async fn sample(
1656 /// client: &SessionService
1657 /// ) -> Result<()> {
1658 /// client.delete_operation()
1659 /// /* set fields */
1660 /// .send().await?;
1661 /// Ok(())
1662 /// }
1663 /// ```
1664 pub fn delete_operation(&self) -> super::builder::session_service::DeleteOperation {
1665 super::builder::session_service::DeleteOperation::new(self.inner.clone())
1666 }
1667
1668 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1669 ///
1670 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1671 ///
1672 /// # Example
1673 /// ```
1674 /// # use google_cloud_ces_v1::client::SessionService;
1675 /// use google_cloud_ces_v1::Result;
1676 /// async fn sample(
1677 /// client: &SessionService
1678 /// ) -> Result<()> {
1679 /// client.cancel_operation()
1680 /// /* set fields */
1681 /// .send().await?;
1682 /// Ok(())
1683 /// }
1684 /// ```
1685 pub fn cancel_operation(&self) -> super::builder::session_service::CancelOperation {
1686 super::builder::session_service::CancelOperation::new(self.inner.clone())
1687 }
1688}
1689
1690/// Implements a client for the Gemini Enterprise for Customer Experience API.
1691///
1692/// # Example
1693/// ```
1694/// # use google_cloud_ces_v1::client::ToolService;
1695/// async fn sample(
1696/// ) -> anyhow::Result<()> {
1697/// let client = ToolService::builder().build().await?;
1698/// let response = client.execute_tool()
1699/// /* set fields */
1700/// .send().await?;
1701/// println!("response {:?}", response);
1702/// Ok(())
1703/// }
1704/// ```
1705///
1706/// # Service Description
1707///
1708/// Tool service provides APIs for interacting with CES tools.
1709///
1710/// # Configuration
1711///
1712/// To configure `ToolService` use the `with_*` methods in the type returned
1713/// by [builder()][ToolService::builder]. The default configuration should
1714/// work for most applications. Common configuration changes include
1715///
1716/// * [with_endpoint()]: by default this client uses the global default endpoint
1717/// (`https://ces.googleapis.com`). Applications using regional
1718/// endpoints or running in restricted networks (e.g. a network configured
1719/// with [Private Google Access with VPC Service Controls]) may want to
1720/// override this default.
1721/// * [with_credentials()]: by default this client uses
1722/// [Application Default Credentials]. Applications using custom
1723/// authentication may need to override this default.
1724///
1725/// [with_endpoint()]: super::builder::tool_service::ClientBuilder::with_endpoint
1726/// [with_credentials()]: super::builder::tool_service::ClientBuilder::with_credentials
1727/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1728/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1729///
1730/// # Pooling and Cloning
1731///
1732/// `ToolService` holds a connection pool internally, it is advised to
1733/// create one and reuse it. You do not need to wrap `ToolService` in
1734/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1735/// already uses an `Arc` internally.
1736#[derive(Clone, Debug)]
1737pub struct ToolService {
1738 inner: std::sync::Arc<dyn super::stub::dynamic::ToolService>,
1739}
1740
1741impl ToolService {
1742 /// Returns a builder for [ToolService].
1743 ///
1744 /// ```
1745 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1746 /// # use google_cloud_ces_v1::client::ToolService;
1747 /// let client = ToolService::builder().build().await?;
1748 /// # Ok(()) }
1749 /// ```
1750 pub fn builder() -> super::builder::tool_service::ClientBuilder {
1751 crate::new_client_builder(super::builder::tool_service::client::Factory)
1752 }
1753
1754 /// Creates a new client from the provided stub.
1755 ///
1756 /// The most common case for calling this function is in tests mocking the
1757 /// client's behavior.
1758 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1759 where
1760 T: super::stub::ToolService + 'static,
1761 {
1762 Self { inner: stub.into() }
1763 }
1764
1765 pub(crate) async fn new(
1766 config: gaxi::options::ClientConfig,
1767 ) -> crate::ClientBuilderResult<Self> {
1768 let inner = Self::build_inner(config).await?;
1769 Ok(Self { inner })
1770 }
1771
1772 async fn build_inner(
1773 conf: gaxi::options::ClientConfig,
1774 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::ToolService>> {
1775 if gaxi::options::tracing_enabled(&conf) {
1776 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1777 }
1778 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1779 }
1780
1781 async fn build_transport(
1782 conf: gaxi::options::ClientConfig,
1783 ) -> crate::ClientBuilderResult<impl super::stub::ToolService> {
1784 super::transport::ToolService::new(conf).await
1785 }
1786
1787 async fn build_with_tracing(
1788 conf: gaxi::options::ClientConfig,
1789 ) -> crate::ClientBuilderResult<impl super::stub::ToolService> {
1790 Self::build_transport(conf)
1791 .await
1792 .map(super::tracing::ToolService::new)
1793 }
1794
1795 /// Executes the given tool with the given arguments.
1796 ///
1797 /// # Example
1798 /// ```
1799 /// # use google_cloud_ces_v1::client::ToolService;
1800 /// use google_cloud_ces_v1::Result;
1801 /// async fn sample(
1802 /// client: &ToolService
1803 /// ) -> Result<()> {
1804 /// let response = client.execute_tool()
1805 /// /* set fields */
1806 /// .send().await?;
1807 /// println!("response {:?}", response);
1808 /// Ok(())
1809 /// }
1810 /// ```
1811 pub fn execute_tool(&self) -> super::builder::tool_service::ExecuteTool {
1812 super::builder::tool_service::ExecuteTool::new(self.inner.clone())
1813 }
1814
1815 /// Retrieve the schema of the given tool. The schema is computed on the fly
1816 /// for the given instance of the tool.
1817 ///
1818 /// # Example
1819 /// ```
1820 /// # use google_cloud_ces_v1::client::ToolService;
1821 /// use google_cloud_ces_v1::Result;
1822 /// async fn sample(
1823 /// client: &ToolService
1824 /// ) -> Result<()> {
1825 /// let response = client.retrieve_tool_schema()
1826 /// /* set fields */
1827 /// .send().await?;
1828 /// println!("response {:?}", response);
1829 /// Ok(())
1830 /// }
1831 /// ```
1832 pub fn retrieve_tool_schema(&self) -> super::builder::tool_service::RetrieveToolSchema {
1833 super::builder::tool_service::RetrieveToolSchema::new(self.inner.clone())
1834 }
1835
1836 /// Retrieve the list of tools included in the specified toolset.
1837 ///
1838 /// # Example
1839 /// ```
1840 /// # use google_cloud_ces_v1::client::ToolService;
1841 /// use google_cloud_ces_v1::Result;
1842 /// async fn sample(
1843 /// client: &ToolService
1844 /// ) -> Result<()> {
1845 /// let response = client.retrieve_tools()
1846 /// /* set fields */
1847 /// .send().await?;
1848 /// println!("response {:?}", response);
1849 /// Ok(())
1850 /// }
1851 /// ```
1852 pub fn retrieve_tools(&self) -> super::builder::tool_service::RetrieveTools {
1853 super::builder::tool_service::RetrieveTools::new(self.inner.clone())
1854 }
1855
1856 /// Lists information about the supported locations for this service.
1857 ///
1858 /// This method lists locations based on the resource scope provided in
1859 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
1860 /// **Global locations**: If `name` is empty, the method lists the
1861 /// public locations available to all projects. * **Project-specific
1862 /// locations**: If `name` follows the format
1863 /// `projects/{project}`, the method lists locations visible to that
1864 /// specific project. This includes public, private, or other
1865 /// project-specific locations enabled for the project.
1866 ///
1867 /// For gRPC and client library implementations, the resource name is
1868 /// passed as the `name` field. For direct service calls, the resource
1869 /// name is
1870 /// incorporated into the request path based on the specific service
1871 /// implementation and version.
1872 ///
1873 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
1874 ///
1875 /// # Example
1876 /// ```
1877 /// # use google_cloud_ces_v1::client::ToolService;
1878 /// use google_cloud_gax::paginator::ItemPaginator as _;
1879 /// use google_cloud_ces_v1::Result;
1880 /// async fn sample(
1881 /// client: &ToolService
1882 /// ) -> Result<()> {
1883 /// let mut list = client.list_locations()
1884 /// /* set fields */
1885 /// .by_item();
1886 /// while let Some(item) = list.next().await.transpose()? {
1887 /// println!("{:?}", item);
1888 /// }
1889 /// Ok(())
1890 /// }
1891 /// ```
1892 pub fn list_locations(&self) -> super::builder::tool_service::ListLocations {
1893 super::builder::tool_service::ListLocations::new(self.inner.clone())
1894 }
1895
1896 /// Gets information about a location.
1897 ///
1898 /// # Example
1899 /// ```
1900 /// # use google_cloud_ces_v1::client::ToolService;
1901 /// use google_cloud_ces_v1::Result;
1902 /// async fn sample(
1903 /// client: &ToolService
1904 /// ) -> Result<()> {
1905 /// let response = client.get_location()
1906 /// /* set fields */
1907 /// .send().await?;
1908 /// println!("response {:?}", response);
1909 /// Ok(())
1910 /// }
1911 /// ```
1912 pub fn get_location(&self) -> super::builder::tool_service::GetLocation {
1913 super::builder::tool_service::GetLocation::new(self.inner.clone())
1914 }
1915
1916 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1917 ///
1918 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1919 ///
1920 /// # Example
1921 /// ```
1922 /// # use google_cloud_ces_v1::client::ToolService;
1923 /// use google_cloud_gax::paginator::ItemPaginator as _;
1924 /// use google_cloud_ces_v1::Result;
1925 /// async fn sample(
1926 /// client: &ToolService
1927 /// ) -> Result<()> {
1928 /// let mut list = client.list_operations()
1929 /// /* set fields */
1930 /// .by_item();
1931 /// while let Some(item) = list.next().await.transpose()? {
1932 /// println!("{:?}", item);
1933 /// }
1934 /// Ok(())
1935 /// }
1936 /// ```
1937 pub fn list_operations(&self) -> super::builder::tool_service::ListOperations {
1938 super::builder::tool_service::ListOperations::new(self.inner.clone())
1939 }
1940
1941 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1942 ///
1943 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1944 ///
1945 /// # Example
1946 /// ```
1947 /// # use google_cloud_ces_v1::client::ToolService;
1948 /// use google_cloud_ces_v1::Result;
1949 /// async fn sample(
1950 /// client: &ToolService
1951 /// ) -> Result<()> {
1952 /// let response = client.get_operation()
1953 /// /* set fields */
1954 /// .send().await?;
1955 /// println!("response {:?}", response);
1956 /// Ok(())
1957 /// }
1958 /// ```
1959 pub fn get_operation(&self) -> super::builder::tool_service::GetOperation {
1960 super::builder::tool_service::GetOperation::new(self.inner.clone())
1961 }
1962
1963 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1964 ///
1965 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1966 ///
1967 /// # Example
1968 /// ```
1969 /// # use google_cloud_ces_v1::client::ToolService;
1970 /// use google_cloud_ces_v1::Result;
1971 /// async fn sample(
1972 /// client: &ToolService
1973 /// ) -> Result<()> {
1974 /// client.delete_operation()
1975 /// /* set fields */
1976 /// .send().await?;
1977 /// Ok(())
1978 /// }
1979 /// ```
1980 pub fn delete_operation(&self) -> super::builder::tool_service::DeleteOperation {
1981 super::builder::tool_service::DeleteOperation::new(self.inner.clone())
1982 }
1983
1984 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
1985 ///
1986 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
1987 ///
1988 /// # Example
1989 /// ```
1990 /// # use google_cloud_ces_v1::client::ToolService;
1991 /// use google_cloud_ces_v1::Result;
1992 /// async fn sample(
1993 /// client: &ToolService
1994 /// ) -> Result<()> {
1995 /// client.cancel_operation()
1996 /// /* set fields */
1997 /// .send().await?;
1998 /// Ok(())
1999 /// }
2000 /// ```
2001 pub fn cancel_operation(&self) -> super::builder::tool_service::CancelOperation {
2002 super::builder::tool_service::CancelOperation::new(self.inner.clone())
2003 }
2004}
2005
2006/// Implements a client for the Gemini Enterprise for Customer Experience API.
2007///
2008/// # Example
2009/// ```
2010/// # use google_cloud_ces_v1::client::WidgetService;
2011/// async fn sample(
2012/// ) -> anyhow::Result<()> {
2013/// let client = WidgetService::builder().build().await?;
2014/// let response = client.generate_chat_token()
2015/// /* set fields */
2016/// .send().await?;
2017/// println!("response {:?}", response);
2018/// Ok(())
2019/// }
2020/// ```
2021///
2022/// # Service Description
2023///
2024/// Provides APIs for widgets to interact with CES APIs.
2025///
2026/// # Configuration
2027///
2028/// To configure `WidgetService` use the `with_*` methods in the type returned
2029/// by [builder()][WidgetService::builder]. The default configuration should
2030/// work for most applications. Common configuration changes include
2031///
2032/// * [with_endpoint()]: by default this client uses the global default endpoint
2033/// (`https://ces.googleapis.com`). Applications using regional
2034/// endpoints or running in restricted networks (e.g. a network configured
2035/// with [Private Google Access with VPC Service Controls]) may want to
2036/// override this default.
2037/// * [with_credentials()]: by default this client uses
2038/// [Application Default Credentials]. Applications using custom
2039/// authentication may need to override this default.
2040///
2041/// [with_endpoint()]: super::builder::widget_service::ClientBuilder::with_endpoint
2042/// [with_credentials()]: super::builder::widget_service::ClientBuilder::with_credentials
2043/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2044/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2045///
2046/// # Pooling and Cloning
2047///
2048/// `WidgetService` holds a connection pool internally, it is advised to
2049/// create one and reuse it. You do not need to wrap `WidgetService` in
2050/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2051/// already uses an `Arc` internally.
2052#[derive(Clone, Debug)]
2053pub struct WidgetService {
2054 inner: std::sync::Arc<dyn super::stub::dynamic::WidgetService>,
2055}
2056
2057impl WidgetService {
2058 /// Returns a builder for [WidgetService].
2059 ///
2060 /// ```
2061 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2062 /// # use google_cloud_ces_v1::client::WidgetService;
2063 /// let client = WidgetService::builder().build().await?;
2064 /// # Ok(()) }
2065 /// ```
2066 pub fn builder() -> super::builder::widget_service::ClientBuilder {
2067 crate::new_client_builder(super::builder::widget_service::client::Factory)
2068 }
2069
2070 /// Creates a new client from the provided stub.
2071 ///
2072 /// The most common case for calling this function is in tests mocking the
2073 /// client's behavior.
2074 pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2075 where
2076 T: super::stub::WidgetService + 'static,
2077 {
2078 Self { inner: stub.into() }
2079 }
2080
2081 pub(crate) async fn new(
2082 config: gaxi::options::ClientConfig,
2083 ) -> crate::ClientBuilderResult<Self> {
2084 let inner = Self::build_inner(config).await?;
2085 Ok(Self { inner })
2086 }
2087
2088 async fn build_inner(
2089 conf: gaxi::options::ClientConfig,
2090 ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::WidgetService>> {
2091 if gaxi::options::tracing_enabled(&conf) {
2092 return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2093 }
2094 Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2095 }
2096
2097 async fn build_transport(
2098 conf: gaxi::options::ClientConfig,
2099 ) -> crate::ClientBuilderResult<impl super::stub::WidgetService> {
2100 super::transport::WidgetService::new(conf).await
2101 }
2102
2103 async fn build_with_tracing(
2104 conf: gaxi::options::ClientConfig,
2105 ) -> crate::ClientBuilderResult<impl super::stub::WidgetService> {
2106 Self::build_transport(conf)
2107 .await
2108 .map(super::tracing::WidgetService::new)
2109 }
2110
2111 /// Generates a session scoped token for chat widget to authenticate with
2112 /// Session APIs.
2113 ///
2114 /// # Example
2115 /// ```
2116 /// # use google_cloud_ces_v1::client::WidgetService;
2117 /// use google_cloud_ces_v1::Result;
2118 /// async fn sample(
2119 /// client: &WidgetService
2120 /// ) -> Result<()> {
2121 /// let response = client.generate_chat_token()
2122 /// /* set fields */
2123 /// .send().await?;
2124 /// println!("response {:?}", response);
2125 /// Ok(())
2126 /// }
2127 /// ```
2128 pub fn generate_chat_token(&self) -> super::builder::widget_service::GenerateChatToken {
2129 super::builder::widget_service::GenerateChatToken::new(self.inner.clone())
2130 }
2131
2132 /// Lists information about the supported locations for this service.
2133 ///
2134 /// This method lists locations based on the resource scope provided in
2135 /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
2136 /// **Global locations**: If `name` is empty, the method lists the
2137 /// public locations available to all projects. * **Project-specific
2138 /// locations**: If `name` follows the format
2139 /// `projects/{project}`, the method lists locations visible to that
2140 /// specific project. This includes public, private, or other
2141 /// project-specific locations enabled for the project.
2142 ///
2143 /// For gRPC and client library implementations, the resource name is
2144 /// passed as the `name` field. For direct service calls, the resource
2145 /// name is
2146 /// incorporated into the request path based on the specific service
2147 /// implementation and version.
2148 ///
2149 /// [google.cloud.location.ListLocationsRequest.name]: google_cloud_location::model::ListLocationsRequest::name
2150 ///
2151 /// # Example
2152 /// ```
2153 /// # use google_cloud_ces_v1::client::WidgetService;
2154 /// use google_cloud_gax::paginator::ItemPaginator as _;
2155 /// use google_cloud_ces_v1::Result;
2156 /// async fn sample(
2157 /// client: &WidgetService
2158 /// ) -> Result<()> {
2159 /// let mut list = client.list_locations()
2160 /// /* set fields */
2161 /// .by_item();
2162 /// while let Some(item) = list.next().await.transpose()? {
2163 /// println!("{:?}", item);
2164 /// }
2165 /// Ok(())
2166 /// }
2167 /// ```
2168 pub fn list_locations(&self) -> super::builder::widget_service::ListLocations {
2169 super::builder::widget_service::ListLocations::new(self.inner.clone())
2170 }
2171
2172 /// Gets information about a location.
2173 ///
2174 /// # Example
2175 /// ```
2176 /// # use google_cloud_ces_v1::client::WidgetService;
2177 /// use google_cloud_ces_v1::Result;
2178 /// async fn sample(
2179 /// client: &WidgetService
2180 /// ) -> Result<()> {
2181 /// let response = client.get_location()
2182 /// /* set fields */
2183 /// .send().await?;
2184 /// println!("response {:?}", response);
2185 /// Ok(())
2186 /// }
2187 /// ```
2188 pub fn get_location(&self) -> super::builder::widget_service::GetLocation {
2189 super::builder::widget_service::GetLocation::new(self.inner.clone())
2190 }
2191
2192 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2193 ///
2194 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2195 ///
2196 /// # Example
2197 /// ```
2198 /// # use google_cloud_ces_v1::client::WidgetService;
2199 /// use google_cloud_gax::paginator::ItemPaginator as _;
2200 /// use google_cloud_ces_v1::Result;
2201 /// async fn sample(
2202 /// client: &WidgetService
2203 /// ) -> Result<()> {
2204 /// let mut list = client.list_operations()
2205 /// /* set fields */
2206 /// .by_item();
2207 /// while let Some(item) = list.next().await.transpose()? {
2208 /// println!("{:?}", item);
2209 /// }
2210 /// Ok(())
2211 /// }
2212 /// ```
2213 pub fn list_operations(&self) -> super::builder::widget_service::ListOperations {
2214 super::builder::widget_service::ListOperations::new(self.inner.clone())
2215 }
2216
2217 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2218 ///
2219 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2220 ///
2221 /// # Example
2222 /// ```
2223 /// # use google_cloud_ces_v1::client::WidgetService;
2224 /// use google_cloud_ces_v1::Result;
2225 /// async fn sample(
2226 /// client: &WidgetService
2227 /// ) -> Result<()> {
2228 /// let response = client.get_operation()
2229 /// /* set fields */
2230 /// .send().await?;
2231 /// println!("response {:?}", response);
2232 /// Ok(())
2233 /// }
2234 /// ```
2235 pub fn get_operation(&self) -> super::builder::widget_service::GetOperation {
2236 super::builder::widget_service::GetOperation::new(self.inner.clone())
2237 }
2238
2239 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2240 ///
2241 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2242 ///
2243 /// # Example
2244 /// ```
2245 /// # use google_cloud_ces_v1::client::WidgetService;
2246 /// use google_cloud_ces_v1::Result;
2247 /// async fn sample(
2248 /// client: &WidgetService
2249 /// ) -> Result<()> {
2250 /// client.delete_operation()
2251 /// /* set fields */
2252 /// .send().await?;
2253 /// Ok(())
2254 /// }
2255 /// ```
2256 pub fn delete_operation(&self) -> super::builder::widget_service::DeleteOperation {
2257 super::builder::widget_service::DeleteOperation::new(self.inner.clone())
2258 }
2259
2260 /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
2261 ///
2262 /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
2263 ///
2264 /// # Example
2265 /// ```
2266 /// # use google_cloud_ces_v1::client::WidgetService;
2267 /// use google_cloud_ces_v1::Result;
2268 /// async fn sample(
2269 /// client: &WidgetService
2270 /// ) -> Result<()> {
2271 /// client.cancel_operation()
2272 /// /* set fields */
2273 /// .send().await?;
2274 /// Ok(())
2275 /// }
2276 /// ```
2277 pub fn cancel_operation(&self) -> super::builder::widget_service::CancelOperation {
2278 super::builder::widget_service::CancelOperation::new(self.inner.clone())
2279 }
2280}