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